May 9, 20269 min readKnowledge Base · Karpathy · Pattern

The Karpathy LLM Wiki pattern, applied to a real company

Andrej Karpathy's three-layer LLM Wiki pattern (raw / wiki / schema) is the cleanest framework we've seen for a personal knowledge base that an AI can read. Here's how we wired it into Hope Hospital.

Andrej Karpathy published a gist describing how he uses an LLM to maintain a personal wiki — a self-organising knowledge base that the model both reads from and writes to. We've adopted the pattern, almost verbatim, as the knowledge substrate of every AI-First company we ship.

The three layers

Karpathy splits the knowledge base into three layers, and the distinction is the whole game:

  • Raw sources — immutable. The LLM reads them but never modifies them. PDFs, transcripts, emails, screenshots. Ground truth.
  • The wiki — LLM-owned markdown files. Summaries, entity pages, interconnected concepts. The LLM creates pages, updates them as new sources arrive, maintains cross-references.
  • The schema — a config file documenting the wiki's structure, conventions, and workflows. This is what turns a generic chatbot into a disciplined knowledge maintainer.

The three operations

  • Ingestion — process new sources one at a time or in batches. Extract key info, update relevant wiki pages, maintain cross-references.
  • Querying — treat the wiki as the primary source. Search relevant pages, synthesise answers. File valuable analyses back into the wiki as new pages.
  • Maintenance — periodic health checks for contradictions, orphaned pages, missing cross-references, knowledge gaps.

Why this works

Knowledge-base maintenance — updating references, noting contradictions, ensuring consistency — is the work humans abandon. LLMs excel at this bookkeeping. The humans focus on curation, analysis, and strategic questioning. The LLM keeps the substrate consistent.

Applied to Hope Hospital

Hope Hospital's vault is the Karpathy pattern with one extension — a _scratch/folder for in-flight drafts that's gitignored, so half-written thoughts don't pollute the agent corpus. The structure:

bettroi-vault/
├── raw/              # immutable — screenshots, exports, transcripts
├── wiki/             # LLM-owned — entity pages, summaries
│   ├── index.md      # catalog by category
│   └── log.md        # chronological record
├── _scratch/         # gitignored — drafts only
├── schema.md         # conventions doc
└── agents/           # the agents that read this brain

Step 5 of the Be AI-First Playbook walks through wiring this exact structure for your own company, using Claude Code as the LLM that maintains the wiki. See it on the Personal Brain page.


What's next

Want to do this in your company?

The Be AI-First Playbook walks you through the same 10 steps — interactive, with copy-to-clipboard commands for your engineer and plain-English explanations for everyone else.

Open the playbook →