Build and maintain a persistent Karpathy Wiki — a compounding knowledge base of interlinked markdown files based on Andrej Karpathy's LLM Wiki pattern. TRIGGER when: user adds sources to raw/ (articles, papers, notes, images), pastes content to ingest, says 'add to wiki' or 'ingest this', asks synthesis questions ('what do we know about X', 'compare A and B', 'summarize research on Y', 'how does X relate to Y'), or requests a health check ('lint the wiki', 'check for inconsistencies', 'find gaps'). Also triggers when raw/ has unprocessed files. DO NOT TRIGGER when: user asks about project source code or architecture (use karpathy-project-wiki instead), wants simple file operations, or asks general questions unrelated to a wiki.
Build and maintain a persistent, compounding knowledge base as interlinked markdown. Based on Karpathy's LLM Wiki pattern: raw sources are ingested once, compiled into a wiki, and kept current — not re-derived on every query.
Does wiki/ exist in the project?
├─ No → User says "init wiki" or "start a wiki" → Run INIT
├─ Yes →
│ ├─ New files in raw/ not yet in log.md? → Run INGEST
│ ├─ User asks a question about the wiki's domain? → Run QUERY
│ ├─ User says "lint", "health check", "find gaps"? → Run LINT
│ └─ User pastes content or a URL to add? → Save to raw/, then INGEST
raw/ # Immutable source documents (user curates)
wiki/
├── index.md # Content catalog — every page with link + summary
├── log.md # Append-only chronological record of all operations
├── schema.md # Wiki conventions, co-evolved with user
├── overview.md # High-level synthesis across all sources
├── concepts/ # Concept pages (e.g., concepts/attention.md)
├── entities/ # Entity pages (e.g., entities/gpt-4.md)
├── sources/ # One summary per ingested source
└── queries/ # Filed query results worth keeping
wiki/ directory structure and raw/ if missingschema.md with default conventions (can be customized later)index.md and log.mdoverview.md placeholderraw/ already has files, immediately run INGEST on all of them## Wiki section to project CLAUDE.md: "This project has an LLM wiki at wiki/. Consult wiki/index.md for questions. Keep the wiki updated."raw/sources/concepts/entities/overview.md if the source shifts the big pictureindex.md with new/changed pageslog.md: ## [YYYY-MM-DD] ingest | Source Titleindex.md to find relevant pagesqueries/index.md if a new page was createdlog.md: ## [YYYY-MM-DD] query | Question summarylog.md: ## [YYYY-MM-DD] lint | Summary of findingsEvery wiki page has YAML frontmatter:
---