Skip to main content

Self-learning AI agent that gets smarter over time. Routes between local and cloud models by confidence; learns from every escalation.

Project description

๐Ÿง  Autodidact (v1.0.x)

** A local-first, self-evolving AI agent framework that slashes cloud API costs by distilling knowledge onto the edge.

Autodidact is an AI agent with a local brain that works like a human. When asked a question or given a task, it thinks first and evaluates whether the local brain can handle it. If yes, it executes. If not, it escalates - by searching Google or asking someone smarter (a more powerful cloud model) - just like how humans work. After the escalation, it learns the new knowledge, skills, or tool usages so next time it won't have to ask similar questions again.

https://github.com/user-attachments/assets/fe196a13-4046-4be2-82db-74445109cbca

๐Ÿ“Š Core Benchmarks (v1.x Dev Run)

  • 67% of repetitive codebase/doc queries successfully intercepted by local memory or rag.
  • ~70% cost saved over just 30 standard development queries.
autodidact-session-summary

Four-command quickstart

pip install autodidact             # or: pip install "autodidact[openai,bedrock,pdf]"
autodidact init                    # zero-friction setup: auto-detects Ollama, pulls models, configures cloud
autodidact learn <path>            # A brand-new agent has an empty brain. `autodidact learn` seeds it with existing knowledge. <Path> points to the folder having documents or code you want the agent to learn.
autodidact chat                    # start talking to the agent

Windows note: If autodidact isn't found after install, use python -m autodidact instead (e.g. python -m autodidact init). This happens when Python's Scripts/ folder isn't in your PATH.

That's it. autodidact init walks you through five setup modes:

  1. Local + Cloud (default) โ€” Ollama local model + cloud API for escalation. Best cost savings.
  2. Cloud + Cloud โ€” cheap cloud model + expensive cloud model. No GPU or Ollama required.
  3. Local + Local โ€” small Ollama + big Ollama. Fully offline, still learns from escalations. Free.
  4. Custom local โ€” any OpenAI-compatible server (llama.cpp, LM Studio, vLLM, LocalAI) + optional cloud.
  5. Local only โ€” single Ollama model. Free. No escalation learning.

If Ollama isn't installed, the wizard offers to install it (with retry on failure). If your model isn't pulled, it pulls it automatically. If Ollama isn't running, it starts the daemon for you. On corporate networks where Ollama can't be installed, mode 2 or 4 work without it.

How it works - the human analogy

When you encounter a question, you go through this sequence:

  1. Do I know the answer? โ†’ Check your memory
  2. Am I confident I can answer it? โ†’ Self-assess
  3. If yes โ†’ Answer (free, fast)
  4. If no โ†’ Ask someone smarter (costs time and often money too, but you get the right answer)
  5. Remember what you learned โ†’ Store it
  6. Next time, start from step 1 โ†’ You're smarter now

Humans do this every day. The more tasks we do, the more knowledgeable we become, the fewer questions we ask.

Autodidact makes AI work the same way.

On day one, it asks a lot of questions. By week two, it handles most tasks independently. By month three, it's the expert. Every cloud escalation becomes permanent local knowledge. Every interaction makes it smarter. It never forgets what it learned.

Query โ†’ Think  (check memory)
      โ†’ Try    (local model answers if confident)
      โ†’ Ask    (escalate to cloud when uncertain)
      โ†’ Learn  (store the answer for next time)
      โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
      Next similar query โ†’ Answer from memory, $0.00

Solving the cold start

A brand-new agent has an empty brain. autodidact learn seeds it with existing knowledge:

autodidact learn ~/docs/policies/     # ingest a folder of docs
autodidact learn ./README.md          # ingest a single file
autodidact learn --stats              # show what's been ingested

Supports .md, .txt, .py, .ts, .js, .yaml, .json, .csv, .html, and 15+ other text formats. Code files are split on function/class boundaries via tree-sitter (pip install "autodidact[code]"). PDFs via pip install "autodidact[pdf]". Chunks are stored separately from learned Q&A (one is reference material, the other is experience), but both get retrieved and injected into the prompt at query time.

See it learn

https://github.com/user-attachments/assets/fe196a13-4046-4be2-82db-74445109cbca

Feed it your docs:

$ autodidact learn ./engineering-docs/
[1] deployment-guide.md โ†’ 8 chunks
[2] architecture.md     โ†’ 15 chunks
โ”€โ”€โ”€ Ingestion Complete โ”€โ”€โ”€
Files: 2 ยท Chunks: 23 ยท Synthesizing knowledge in background...

Ask something the docs alone can't fully answer:

you> How do I fix "connection refused" on staging?

[CLOUD] Three common causes, ranked by frequency:
  1. VPN dropped after sleep โ€” `vpn connect staging`
  2. Service crashed         โ€” `kubectl get pods -n staging`
  3. Stale DNS post-deploy   โ€” `sudo dscacheutil -flushcache`

โ†ณ Source: deployment-guide.md
๐Ÿ’ฐ $0.012 | Route: cloud | โœ… Learned

The docs had the deployment steps, but the local model does not have the troubleshooting wisdom or not confident enough in in reasoning or judgemnt. Cloud provided it. The agent learned it.

Next time:

you> Staging is down again, connection errors

[LOCAL] This is almost always the VPN (it drops after sleep). Quick fix:
  1. `vpn connect staging`
  2. Still failing? `kubectl get pods -n staging` โ€” service may have crashed
  3. After a deploy, flush DNS: `sudo dscacheutil -flushcache`
  โ†ณ Context: memory (2 facts)
  ๐Ÿ’ฐ $0.00 | Route: local

Same knowledge. Zero cost. The answer is better than raw docs because it leads with the most likely cause (learned from the cloud's reasoning, not just document text).

That's the loop. Every escalation makes the agent smarter. Every smart answer saves money. Over time, cloud calls approach zero.

What's in v1.0.x

  • Zero-friction setup wizard. Auto-detects Ollama, pulls models, starts daemon, retries on failure. Installs via Homebrew (macOS) or official installer. Presets for 11 cloud providers including Google AI Studio (free tier, no credit card).
  • Five setup modes. Local+Cloud, Cloud+Cloud, Local+Local, Custom server, Local-only. Works everywhere โ€” GPU, no GPU, corporate network, offline.
  • AST-aware code chunking. autodidact learn uses tree-sitter to split code on function/class boundaries (Python, JS, TS). Each chunk is a complete semantic unit with its class header preserved. Non-code files use overlap-based text splitting.
  • Hybrid retrieval. BM25 keyword search (FTS5) + vector similarity, merged via Reciprocal Rank Fusion. RRF orders results; cosine similarity scores them โ€” so downstream thresholds remain meaningful.
  • Document synthesis. autodidact learn doesn't just index โ€” it extracts key facts into memory (background, non-blocking). The agent answers from internalized knowledge, not raw chunks.
  • Confidence-based routing. GSA pre-screen + logprob uncertainty + refusal detection. Escalates when uncertain, stays local when confident. Non-answer detection prevents learning from "I don't know" cloud responses.
  • Learning from escalations. Structured knowledge extraction from cloud responses (background, non-blocking). Deduplication on insert. Memory recall at 0.80+ similarity serves learned answers directly.
  • Visible learning UX. [THINKING], [MEMORY], [LOCAL], [CLOUD], [LEARNED] tags show what the agent is doing and why.
  • Cost tracking. autodidact savings reports cumulative cost avoided vs an all-cloud baseline.
  • Local-first. All state in one portable SQLite file (~/.autodidact/memory.db). Works offline after setup.
  • Multi-provider. Ollama, any OpenAI-compatible server (llama.cpp, LM Studio, vLLM), AWS Bedrock, Google AI Studio, OpenRouter, and 8 more. 11 cloud provider presets.

Commands

autodidact init             Zero-friction setup wizard
autodidact chat             Interactive chat with visible thought process
autodidact query "q"        Single-query mode
autodidact learn <path>     Ingest documents (cold-start fix)
autodidact savings          Cumulative cost savings
autodidact memory stats     Knowledge store size + breakdown
autodidact memory search    Search what the agent has learned

What's NOT in v1.0.x (coming in v1.5 and v2.0)

  • No conversational query rewriting (v1.5 โ€” rewrite follow-up queries into self-contained searches using conversation history)
  • No markdown-aware chunking (v1.5 โ€” respect tables, code fences, headings as atomic units; tree-sitter markdown grammar)
  • No parent-child retrieval (v1.5 โ€” index small chunks, return parent section on hit)
  • No contextual chunking (v1.5 โ€” prepend LLM-generated context to chunks before embedding, bridges NLโ†”code gap)
  • No topic-based knowledge pages (v1.5 โ€” knowledge compiled into pages, not flat facts)
  • No OpenAI-compatible proxy mode (v1.5 โ€” autodidact serve)
  • No agentic retrieval (v2.0 โ€” model reads files on demand via tools, no static chunking needed)
  • No tool execution (v2.0 โ€” terminal, file ops, ReAct loop)
  • No skill learning from tasks (v2.0 โ€” learns procedures, not just facts)
  • No reranking (v2.0 โ€” cross-encoder on retrieval candidates)
  • No MCP server (v2.0)

All of these are designed and planned.

What we have verified empirically:

  • logprob_uncertainty is the dominant routing signal (AUROC 0.65-0.83 across 3 model families ร— 2 datasets).
  • Zero-shot inference-time signals match supervised routing baselines (RouteLLM) at zero per-model training cost.
  • Naive multi-signal fusion hurts - the best single signal beats the mean of all 6 signals.
  • Signal quality correlates with RLHF calibration training across model families (Qwen > Llama).

Full write-up: paper. Research findings have their own home at zero-shot-llm-confidence.

Roadmap

Version What Status
v1.0.7 AST-aware chunking, Google AI Studio provider, memory transfer, non-answer filtering Current
v1.5 Query rewriting, markdown-aware chunking, parent-child retrieval, contextual chunking, topic pages, autodidact serve proxy Planned
v2.0 Agentic retrieval (readFile), tool execution, skill learning, tiered routing, reranking, MCP server Designed
v3.0 Agent network โ€” agents teaching each other Planned

Tech stack

  • Python 3.10+
  • SQLite (WAL mode) - all state in one portable file
  • FAISS - vector retrieval
  • tree-sitter - AST-aware code chunking (optional, for .py, .js, .ts)
  • Pydantic v2 - validation
  • Typer + Rich - CLI
  • Ollama / OpenAI-compatible / AWS Bedrock / Google AI Studio - LLM backends

Contributing

See CONTRIBUTING.md.

Good first issues:

  • autodidact serve - OpenAI-compatible proxy (drop-in for Cursor, Aider, any tool)
  • MCP server for Claude Desktop / Cursor / Gemini CLI
  • PDF document ingestion (unstructured parser)
  • Topic-based knowledge pages (v1.5 core feature)
  • Skill extraction from cloud responses (procedures, not just facts)
  • autodidact status dashboard (learning curve + cost savings visualization)

License

MIT - see LICENSE.


Built by BuffaloTechRider. Repository: BuffaloTechRider/Autodidact.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autodidact-1.0.7.tar.gz (164.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

autodidact-1.0.7-py3-none-any.whl (93.6 kB view details)

Uploaded Python 3

File details

Details for the file autodidact-1.0.7.tar.gz.

File metadata

  • Download URL: autodidact-1.0.7.tar.gz
  • Upload date:
  • Size: 164.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for autodidact-1.0.7.tar.gz
Algorithm Hash digest
SHA256 448074d205e729004442e57aaf9cbe0959e2a20d5134d4ea7febc0481d833c61
MD5 95751d32485e92d6b7880db46b11d3b5
BLAKE2b-256 dd079d1800f9c0103a266b369accf82c903960804fde739a207d108493668871

See more details on using hashes here.

Provenance

The following attestation bundles were made for autodidact-1.0.7.tar.gz:

Publisher: release.yml on BuffaloTechRider/Autodidact

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file autodidact-1.0.7-py3-none-any.whl.

File metadata

  • Download URL: autodidact-1.0.7-py3-none-any.whl
  • Upload date:
  • Size: 93.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for autodidact-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 d0114231e0f7fc27fc75a933653018188338ed0608430fc2d795a8e0a54af00f
MD5 66597f5dd80d23bdaf3cc30408572194
BLAKE2b-256 65ab10ce47d8c61b14b39c4d1b6b975a72a03c4ecb7fa8d6ab4008ea9fed9a58

See more details on using hashes here.

Provenance

The following attestation bundles were made for autodidact-1.0.7-py3-none-any.whl:

Publisher: release.yml on BuffaloTechRider/Autodidact

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page