Skip to content
Hiep Lam
Go back

Compile Once, Maintain Forever: Karpathy's LLM Wiki Pattern

Edit page 🇻🇳 Tiếng Việt

TL;DR


1. What it actually is

The LLM Wiki is not a product and not a codebase. It’s a prose pattern - a few paragraphs of instructions you paste into a coding agent (Claude Code, Cursor, Codex, Gemini CLI, …) so the agent builds and maintains a personal knowledge base for you.

It grew out of a Karpathy tweet on “LLM knowledge bases”: he noticed a growing fraction of his own token throughput was going not into manipulating code, but into manipulating knowledge - building durable, structured notes for research topics. Two days later he posted the llm-wiki.md gist describing the pattern concretely.

2. The core idea: wiki, not RAG

The pattern is best understood as a contrast with the default way people use LLMs over documents.

Default = RAG (retrieve-and-answer):

LLM Wiki = compile-once, maintain-forever:

The crisp framing: with RAG the LLM rediscovers knowledge on every question; with a wiki the knowledge is already distilled and waiting.

3. Three-layer structure

LayerMutabilityOwnerContents
raw/ - sourcesimmutablehuman curatesarticles, papers, transcripts, docs. The LLM reads but never edits these; they’re the source of truth.
wiki/ - the wikiLLM-ownedthe LLMsummaries, entity pages, concept pages, comparison pages, and an overview. You almost never hand-edit.
schema / confighuman-definedhumana doc that defines the wiki’s structure, naming conventions, and workflows. This is what turns a generic chatbot into a disciplined wiki maintainer.

Two bookkeeping files keep the system coherent:

4. The three workflows

Ingest

Drop a new source into raw/. The LLM:

  1. reads it,
  2. extracts the durable knowledge,
  3. updates ~10–15 existing pages - a single source ripples across many pages via cross-references rather than landing in one place,
  4. appends an entry to log.md.

The “one source touches many pages” behavior is the whole point - it’s what builds the interlinked graph.

Query (Q&A)

Ask a question against the wiki. The LLM reads index.md, searches the relevant pages, and synthesizes a cited answer. Ideally it then files valuable new findings back into the wiki as new pages - so even asking questions makes the wiki grow.

Lint

Periodic health check of the whole graph. The LLM hunts for:

Linting is what keeps a growing wiki from rotting into an inconsistent mess.

5. Why this works (and why now)

The honest reason humans abandon wikis is maintenance is tedious - nobody wants to keep fixing cross-links, reconciling contradictions, and re-summarizing as new material arrives.

LLMs don’t get bored. So the division of labor flips:

Karpathy explicitly frames this as finally delivering Vannevar Bush’s 1945 Memex - a personal store of documents with associative trails between them. The Memex always failed on the maintenance labor problem; the LLM is the labor that makes it real.

6. Ecosystem

Because the pattern is just prose + a directory convention, lots of people built tooling around it:

7. Honest caveats

8. A familiar shape: personal research notes as a manual instance

A personal research wiki - the kind of durable, bilingual notes many people keep on topics they return to - is essentially a manual instance of the LLM-Wiki pattern already:

The gist’s contribution over an informal version of this is the rigor: an explicit index.md, an append-only log.md, and a recurring lint step to catch contradictions and orphans. Adopting those three would bring an ad-hoc personal wiki much closer to the disciplined pattern Karpathy describes.


Sources

Key idea: with RAG the LLM rediscovers knowledge on every question; with a wiki, the knowledge is already distilled and waiting - the LLM just has to keep it that way.


Edit page
Share this post:

Previous Post
The EF Core Livelock That Looks Like a Hang: Stale ChangeTracker State and the Atomic-Claim Fix
Next Post
Beyond Coverage, Part 0: Why Coverage Lies (and What Your Instinct Gets Right)

Keep reading

A few more pieces in the same vein.

Rather read on your own time? Subscribe via RSS