All Things AI
Intermediate

Karpathy's LLM Wiki Pattern

In April 2026, Andrej Karpathy posted about a workflow shift: rather than using an LLM mainly to generate code or prose on demand, he had been using it to build and continuously maintain a personal knowledge base. The post went viral, and a follow-up gist describing the pattern picked up thousands of stars within days. The idea itself is a specific, practical answer to a question every second-brain builder eventually hits: who actually keeps the notes organised once you have thousands of them?

The Pattern: Agent-Maintained, Not Human-Maintained

Instead of retrieving from raw source documents every time (the standard RAG pattern), an agent incrementally writes and edits a persistent, structured wiki of markdown files - then answers your questions by reading its own wiki, not the original raw material.

The distinction matters. RAG treats your documents as a fixed corpus to search. The LLM Wiki pattern treats the wiki itself as a living, editable artefact - every time the agent learns something new or notices an existing page is wrong or stale, it rewrites that page, the same way a human wiki editor would.

The Maintenance Cycle

New Source
A conversation, an article, a doc
โ†’
Agent Reads Wiki
Checks what's already written on this topic
โ†’
Agent Edits Wiki
Adds, corrects, or restructures a page
โ†’
You Query the Wiki
Ask a question, get an answer from curated pages

The wiki is the thing that accumulates - each pass through the cycle leaves it better organised, not just bigger

LLM Wiki vs Plain RAG

Plain RAGLLM Wiki
What's storedRaw source documents, chunked and embeddedCurated, structured markdown pages the agent wrote itself
Does it improve over time?No - the corpus is static until you add new documentsYes - the agent revises and reorganises existing pages
Readable without an agent?Rarely - raw chunks are not meant for human readingYes - it's a normal markdown wiki you can open and read
Best forLarge, mostly-static reference corpora (docs, contracts)A personal or project knowledge base that keeps growing

What This Looks Like in Practice

Point a coding agent at a folder of plain markdown files and give it standing instructions to keep the folder organised - not just to answer questions from it. Concretely, that means the agent is expected to: read the existing pages before writing anything new, update a page in place when it learns something that changes it (rather than bolting on a contradictory new page), and flag or remove pages that no longer reflect reality. Over weeks, the wiki becomes denser and better-organised instead of just longer.

The failure mode to avoid

A wiki that only ever gets pages appended to it, never edited or pruned, degrades into exactly the unstructured pile of raw notes this pattern was meant to replace. The discipline is in the editing, not the writing.

This pattern is not unique to personal notes - see Claude Code as a Self-Maintaining KB for the same idea applied to a coding agent's own project memory, and Memory & CLAUDE.md for the underlying Claude Code mechanics it relies on.

Checklist: Do You Understand This?

  • Can you explain the core difference between the LLM Wiki pattern and standard RAG?
  • Do you understand why the agent must read the existing wiki before writing to it?
  • Can you name the failure mode that turns an LLM Wiki back into an unstructured document pile?