1.6 KiB
1.6 KiB
LLM Wiki Pattern (Karpathy)
A method for building persistent, structured knowledge bases using LLM agents — compiled once, kept current, queried efficiently.
Tags
concept methodology knowledge-management 2026-05-10
Overview
Andrej Karpathy proposed the "LLM Wiki" pattern as an alternative to RAG (Retrieval-Augmented Generation). Instead of searching raw documents on every query, an LLM agent incrementally builds and maintains a wiki of interlinked markdown pages.
Core Architecture
Three Layers
- Raw Sources (
raw/) — Original documents, immutable. Never modified by the LLM. - Wiki (
wiki/) — Structured, interlinked markdown pages compiled by the LLM. - Schema (
AGENTS.md) — Rules, conventions, and workflows. The "operating system" of the wiki.
Workflows
- Ingest: Drop source in
raw/→ LLM reads, extracts, creates/updates ~10-15 wiki pages per source - Query: Ask question → LLM reads
index.md→ drills into relevant pages → synthesizes answer with citations - Lint: Periodically audit wiki for contradictions, orphans, stale claims
Key Principles
- One concept = one file
- Cross-reference everything with
[[wikilinks]] - The LLM owns the wiki directory; humans only edit
raw/and the schema - Good answers get filed back into the wiki as new pages (compounding knowledge)
- Works with any LLM that can read/write files (Claude Code, Codex, Cursor, local models via Ollama)
Related
Sources
- Karpathy's original idea file (GitHub Gist)