LLM Wiki
Use this skill to implement Andrej Karpathy's LLM Wiki pattern locally: raw sources stay immutable, the LLM maintains a generated Markdown wiki, and an AGENTS.md schema teaches future agents how to keep it healthy.
Core Pattern
Karpathy's pattern has three layers:
raw/: curated source material. Treat this as source of truth and do not modify it.wiki/: LLM-generated Markdown pages: sources, entities, concepts, syntheses, comparisons, questions,index.md, andlog.md.AGENTS.md: the schema and operating manual for future Codex agents working in that wiki.
The human curates sources, asks questions, and steers emphasis. The LLM does the bookkeeping: summaries, links, contradictions, index updates, log entries, and consistency maintenance.
Default Local Layout
Create durable wikis under:
$PGSTACK_WIKI_ROOT/<wiki-slug>/
├── AGENTS.md
├── raw/
│ ├── sources/
│ └── assets/
└── wiki/
├── index.md
├── log.md
├── overview.md
├── sources/
├── entities/
├── concepts/
├── syntheses/
├── comparisons/
└── questions/
Operations
Ingest
Use when adding a new source, memory, transcript, article, or note.
- Preserve the source in
raw/sources/or reference its immutable location. - Read the source and discuss key takeaways with the user when emphasis is ambiguous.
- Create or update
wiki/sources/<source>.md. - Update relevant
wiki/entities/,wiki/concepts/,wiki/syntheses/,wiki/comparisons/, orwiki/questions/pages. - Update
wiki/index.md. - Append an entry to
wiki/log.md. - If MemTensor is available, store the wiki path and durable conclusions.
Query
Use when answering questions against an existing wiki.
- Read
AGENTS.md, thenwiki/index.md, then relevant pages. - Answer with citations/links to wiki pages or raw sources.
- If the answer creates durable synthesis, file it back into
wiki/and log it.
Lint
Use periodically or when the wiki feels stale.
Check for contradictions, stale claims, orphan pages, missing cross-links, duplicate concepts, absent source pages, data gaps, and unanswered questions that deserve their own page.
References
- Read
references/karpathy-llm-wiki.mdwhen you need the original idea text. - Read
references/protocol.mdwhen you need concrete page templates and maintenance rules.
Skeleton Script
To create a new local wiki skeleton:
python3 $CODEX_HOME/skills/llm-wiki/scripts/init_wiki.py --root "$PGSTACK_WIKI_ROOT" --slug "<wiki-slug>" --title "<Wiki Title>"
Source: daishiyu1991-hub/daishiyu-pgstack-agent-kit — distributed by TomeVault.