The Karpathy LLM wiki foundation is a memory pattern in which sources are compiled once into a wiki and the wiki is then queried. A compiled wiki is what is queried,1 whereas RAG re-reads raw sources on every question.2
Overview
Sources stay immutable, and the model writes the wiki.2 A schema states how to ingest, query, and maintain it.2 Useful answers are filed back, so later questions start from the wiki.2
Mechanism
- Immutable sources are indexed, and wiki pages are compiled from them.2
- On a question, the index is read, then the pages, and the answer cites them.2
- Useful outputs are filed back into the wiki.2
- The wiki is linted for stale claims, orphans, and missing links.2
Applications
The pattern applies when memory should be a maintained wiki instead of a fresh read of the sources on every question.
Limitations
The pattern is not a product to clone, and fine-tuning weights is not a substitute for first making the wiki the thing that is queried. RAG is not the primary memory when a compiled wiki already holds the answer.2
See also
- Ephemeral wiki compile-lint – a per-question ephemeral wiki, lint, loop, and report
- Thin harness, fat skills – thin harness, fat skills
- Autoresearch loop – the human iterates the prompt, the agent iterates code, and a metric gates keep or discard