LLM Wiki Pattern¶
Core Concept¶
Authored by Andrej Karpathy (April 2026), the "LLM Wiki" is a pattern for building personal knowledge bases using LLMs. It proposes a fundamental shift away from stateless Retrieval-Augmented Generation (RAG) toward a persistent, compounding artifact (a wiki).
Instead of an LLM retrieving from raw documents and rediscovering knowledge from scratch on every query, the LLM incrementally builds and maintains a structured, interlinked collection of markdown files. This wiki sits between the user and the raw sources.
Key Differences from RAG¶
- Stateless RAG: LLM retrieves chunks, generates answers, and forgets. Knowledge doesn't build up.
- Stateful Wiki: LLM reads new sources, updates entity pages, revises summaries, flags contradictions, and builds cross-references. Knowledge is "compiled" once and kept current.
3-Layer Architecture¶
- Raw Sources: Immutable curated collection (articles, papers, images). Read-only for the LLM.
- The Wiki: A directory of LLM-generated markdown files. The LLM owns this layer entirely (creates, updates, cross-references).
- The Schema: Instructions (
CLAUDE.md,AGENTS.md) detailing conventions and workflows for the agent.
Operations¶
- Ingest: Read a new source -> summarize -> update index -> update entity pages -> log entry.
- Query: Ask a question -> LLM reads index & relevant pages -> synthesizes answer. Valuable answers are saved as new wiki pages.
- Lint: Health checks by the LLM (finding contradictions, orphans, missing links, stale claims).
Indexing & Logging¶
index.md: Content-oriented catalog of all pages. The entry point for the LLM during queries.log.md: Chronological append-only record of actions (ingests, queries, lint passes). Helps the LLM understand recent history.
Associated Tooling¶
- Obsidian: Acts as the IDE for the knowledge base.
- Obsidian Web Clipper: Quick extraction of sources to markdown.
- qmd: Local hybrid search engine (BM25/vector/LLM re-ranking) for markdown files. Useful as an MCP tool for agents as the wiki grows beyond simple index files.
- Marp / Dataview: Used for generating presentations or querying metadata within the wiki.
Why It Works¶
The maintenance burden (bookkeeping, cross-referencing, consistency checks) is typically what kills human-maintained wikis. LLMs reduce this cost to near zero. The human curates and asks questions; the LLM maintains the structure.