The Second Brain That Builds Itself
Karpathy's "LLM Wiki" pattern: stop re-reading the same sources every time you have a question. Point an agent at a folder and let it grow a linked, self-auditing knowledge base instead.
RAG rediscovers. A wiki compounds.
Ask a typical RAG setup a question and it does the same work every single time: search the raw documents, pull the closest chunks, stitch together an answer. It never gets smarter about your material — it just re-searches the same haystack, forever.
Andrej Karpathy's "LLM Wiki" idea flips that. Instead of an agent that retrieves on demand, you run an agent that incrementally builds and maintains a persistent wiki — a structured, interlinked set of markdown pages that sits between you and your raw sources. Every new source doesn't just get filed away; the agent synthesizes it, updates the pages it touches, and strengthens the web of cross-references. In his words, the wiki is "a persistent, compounding artifact."
Karpathy's own framing: "the tedious part of maintaining a knowledge base is not the reading or the thinking — it's the bookkeeping." Humans stop maintaining a Zettelkasten or a personal wiki because cross-referencing dozens of pages by hand is exhausting. An agent doesn't get bored. That's the whole trade.
Three layers, each with one job
The pattern only has three moving parts. Keep them separate and the whole thing stays simple enough to trust.
Articles, transcripts, PDFs, meeting notes. The agent reads these but never edits them. They're the source of truth you can always point back to.
Markdown pages the agent generates and maintains: entity pages, concept pages, summaries, an overview page, synthesis that connects ideas across multiple sources.
A short config document (a CLAUDE.md works fine) that tells the agent your conventions: how to name pages, what counts as an entity vs. a concept, how much to cross-link. It's meant to be edited as you learn what works.
Karpathy's stated principle: start minimal, add structure only once you've actually hit the case that needs it. A schema written before you have ten pages is a guess. A schema refined after fifty pages is a lesson.
Three operations run the whole system
Everything you do to the wiki reduces to three verbs. Learn these and you've learned the entire workflow.
Drop a new source in. The agent reads it, extracts the key takeaways, writes or updates its page, and — in the same pass — touches roughly 10-15 related existing pages to add links and reconcile claims.
Ask the wiki a question. The agent searches the wiki pages first (not the raw sources), synthesizes an answer with citations, and — if the answer is worth keeping — files it back in as a new page.
A periodic health check. The agent audits the whole wiki for contradictions between pages, stale claims, orphan pages nothing links to, and gaps in coverage — the self-auditing step that keeps the wiki honest.
index.md is a content catalog — every page, one-line summary, organized by category. log.md is an append-only, timestamped record of every ingest, query, and lint pass. Between the two you can always answer "what's in this wiki" and "how did it get this way" without opening a single page.
What this looks like as actual files
Strip away the theory and it's a folder. No database, no vector store required to get the core benefit — just markdown files and an agent that keeps them honest.
raw/ → sources, read-only
wiki/ → entity + concept pages
index.md → catalog of every page
log.md → append-only run history
CLAUDE.md → the schema / conventions
Drop a new file into raw/ and tell the agent to ingest it — it never edits what's already in that folder.
The agent writes and rewrites pages in wiki/ as understanding deepens — this is where the synthesis lives.
index.md and log.md are the two files you'd open first to orient yourself in a wiki you didn't build today.
CLAUDE.md is the only file you hand-write the rules for. Everything downstream follows it.
One ingest, start to finish
Here's the shape of a real ingest pass in Claude Code — one new source triggering updates across the wiki in a single turn.
A wiki that silently overwrites an old claim with a new one is worse than no wiki — it hides that something changed. The lint discipline means contradictions surface for a human decision instead of getting quietly resolved in whichever direction the agent guessed.
What's proven, what's borrowed, and a check
Karpathy shares this as an idea file — a pattern to copy-paste into an agent tool, not a published, benchmarked system. He frames it as intentionally abstract: "a pattern rather than a specific implementation." Worth knowing before you adopt it wholesale:
Touching "10-15 related pages" per ingest costs more context as the wiki grows. Nothing in the source says when that becomes slow or expensive — you'll find that ceiling yourself.
Karpathy describes working with Obsidian open on one side, the agent on the other — Obsidian as the human's IDE for backlinks and graph view. That's convenience, not a requirement: the pattern is just markdown files, and works in Claude Code with plain files on disk, no Obsidian dependency needed.
This is the same shape as your own ~/.claude/CLAUDE.md + memory files — a schema plus a compounding set of markdown pages, maintained by Claude Code across sessions instead of rebuilt from scratch each time. You're already living a version of this pattern; the gist just names it and generalizes it past personal-assistant memory into any body of knowledge you want to own.
Check yourself
Three questions on the pattern and what it actually requires.
A teammate says "isn't this just RAG with extra steps? You still need an agent to read the sources and answer questions."
What's the actual difference between typical RAG and Karpathy's wiki pattern?
You want to periodically check your wiki for pages nothing links to, claims that contradict each other, and coverage gaps — not process any one new source.
Which of the three core operations is that?
Someone on the team says "we can't try this, we don't use Obsidian."
Is Obsidian actually required to run this pattern?
Pick one folder of notes, articles, or transcripts you keep re-reading. Make a raw/, a wiki/, an index.md, a log.md, and a two-paragraph CLAUDE.md describing your conventions. Ingest your first source and see what the agent decides is worth linking.