Skip to content
Christian Monge

AI Second Brain

Karpathy's LLM Wiki: How to Build One in Obsidian

Karpathy's LLM wiki explained: why a persistent markdown wiki beats RAG, the three layers and three operations, and a step-by-step build with Obsidian.

cmChristian Monge5 min read
Pages lifting off a white bookshelf and folding into a web of glowing blue linked nodes

An LLM wiki is a knowledge base that an AI agent writes and keeps up to date for you. You drop sources into a folder; the agent reads them and maintains interlinked markdown pages that summarize, connect and correct what you know.

Andrej Karpathy published the pattern in April 2026, and it has quietly changed how builders use Claude Code.

I run my own business brain this way: a few hundred Obsidian notes about clients, offers, audits and decisions, maintained with Claude Code. Below is what Karpathy actually proposed, what I've learned running it, and how to build yours in an afternoon.

What is Karpathy's LLM wiki?

Karpathy's llm-wiki idea file starts from a complaint most of us share. When you upload documents to a chatbot, the model rediscovers everything from scratch on every question. Nothing accumulates. Ask something that needs five documents combined, and it has to find and stitch the fragments again.

His alternative: let the LLM incrementally build and maintain a persistent wiki that sits between you and your raw sources. When you add a source, the agent doesn't just index it. It reads it, updates the relevant pages, notes where new information contradicts old claims, and strengthens the overall synthesis.

The file is deliberately abstract. It's written to be pasted into your agent, whether that's Claude Code, Codex or OpenCode, so the agent can build a version that fits your domain with you. His one-line description of the setup is the clearest I've seen: Obsidian is the IDE, the LLM is the programmer, and the wiki is the codebase.

LLM wiki vs RAG

RAG and file uploadsLLM wiki
When knowledge is processedAt every questionOnce, when a source is added
What persistsRaw documents and an indexMaintained pages, links and a synthesis
ContradictionsRediscovered, or missed, per queryFlagged when the new source arrives
Who maintains structureNobodyThe agent, on every ingest
What you can inspectRetrieved chunksPlain markdown you can read and edit

That last row is what sold me. When an answer is wrong, I can open the page it came from and fix the page, not argue with a vector index.

The three layers of an LLM wiki

Karpathy describes three layers:

  1. Raw sources. Articles, papers, transcripts, images and data files. They're immutable: the agent reads them and never edits them. This is your source of truth.
  2. The wiki. A folder of markdown pages the LLM owns entirely: summaries, entity pages, concept pages, comparisons and an overview. You read it; the agent writes it.
  3. The schema. One document, CLAUDE.md for Claude Code or AGENTS.md for Codex, that explains how the wiki is structured and which workflows to follow. It's what turns a generic chatbot into a disciplined wiki maintainer.

If you haven't written a schema file before, my guide to writing a CLAUDE.md that gets followed covers the mechanics. Claude Code loads it at the start of every session, which is exactly what a wiki maintainer needs.

The three operations: ingest, query, lint

Ingest. You add a source and tell the agent to process it. It reads the source, discusses the key points with you, writes a summary page, updates the index and the related entity and concept pages, and appends to a log. Karpathy notes a single source might touch 10 to 15 wiki pages. He prefers ingesting one source at a time and staying involved.

Query. You ask questions. The agent finds relevant pages, reads them and answers with citations. The important habit: good answers get filed back into the wiki as new pages, so your explorations compound instead of vanishing into chat history.

Lint. Periodically, the agent health-checks the wiki for contradictions between pages, stale claims that newer sources overturned, orphan pages with no inbound links, and important concepts that deserve their own page.

Two helper files make this work at scale. index.md is a catalog of every page with a one-line summary, which the agent reads first when answering. Karpathy says this works well at around a hundred sources and hundreds of pages without any embedding infrastructure. log.md is an append-only timeline of ingests, queries and lint passes.

Karpathy's LLM Wiki - Full Beginner Setup Guide · Teacher's Tech

How to build an LLM wiki in Obsidian

Here's the setup I recommend, step by step.

1. Create the vault structure. In a new Obsidian vault, make this layout:

my-wiki/
├── CLAUDE.md        schema: structure, conventions, workflows
├── index.md         catalog of pages, updated on every ingest
├── log.md           append-only timeline
├── raw/             immutable sources (articles, PDFs, transcripts)
│   └── assets/      downloaded images
└── wiki/
    ├── entities/    people, companies, products
    ├── concepts/    ideas and frameworks
    ├── sources/     one summary page per source
    └── synthesis/   comparisons, answers worth keeping

2. Write the schema. In CLAUDE.md, tell Claude: raw files are read-only; every ingest updates index.md and log.md; every page links to the source pages that support it; conflicting claims get flagged on both pages. Keep it short and specific.

3. Capture sources. The Obsidian Web Clipper extension turns web articles into markdown. Karpathy also suggests setting a fixed attachment folder and a hotkey to download images locally, so the agent can see them later.

4. Open Claude Code in the vault. Run claude inside the vault folder. No plugin is required, because Claude Code reads and writes the files directly. Then say: "Ingest raw/2026-09-strategy-memo.md following CLAUDE.md."

5. Browse while it works. Keep Obsidian open beside the terminal. Follow the new links, check backlinks and watch the graph view to spot hubs and orphans.

6. Commit to Git. The wiki is a folder of text files, so version history and rollback come for free.

What I've learned running one

A few things the idea file hints at but that only became obvious after months of use:

  • Ingest slowly at first. Batch-ingesting a hundred files produces a tidy-looking wiki full of weak connections. One source at a time, with you steering emphasis, builds a better structure.
  • Numbers need rules. Summaries quietly turn estimates into facts. In my marketing brain every figure must point to a claim with an evidence class, and a linter fails when a page states a number nothing supports. That single rule did more for trust than any prompt.
  • Lint weekly. Orphans and contradictions pile up fast. A scheduled lint pass keeps the wiki honest.
  • Add search when the index strains. Karpathy points to qmd, a local markdown search engine with hybrid keyword and vector search that offers both a CLI and an MCP server.

Community projects push the pattern further. The open-source obsidian-second-brain project, for example, adds scheduled agents that run morning briefs and nightly consolidation on top of Karpathy's design.

Where to start

Start small: ten sources on one topic you genuinely care about, a 30-line CLAUDE.md, and one ingest per day for a week. You'll know by Friday whether the pattern fits how you think.

For the full Claude Code side of this setup, read how to build an Obsidian second brain with Claude Code. If you'd rather connect Claude to an existing vault through a server, see Obsidian MCP. And if you want an LLM wiki built around your business, with the evidence rules already in place, that's what my AI Brains are.

Frequently asked questions

What is Karpathy's LLM wiki?

It's a pattern Andrej Karpathy shared in April 2026 for personal knowledge bases. Instead of retrieving chunks from raw documents each time, an LLM agent incrementally builds and maintains an interlinked set of markdown pages that summarize, cross-reference and update everything you've read.

How is an LLM wiki different from RAG?

RAG retrieves fragments from your documents at question time and rebuilds the answer from scratch every time. An LLM wiki compiles knowledge once into pages that stay current, so cross-references and contradictions are already worked out before you ask.

Do I need Obsidian for an LLM wiki?

No. The wiki is just markdown files, so any editor works. Obsidian is popular because its links, backlinks and graph view let you watch the wiki's structure grow while the agent edits it.

Which AI agent should maintain the wiki?

Any agent that can read and write local files. Karpathy mentions OpenAI Codex, Claude Code and OpenCode. The schema file is what matters: CLAUDE.md for Claude Code or AGENTS.md for Codex.

Sources

  1. 01llm-wiki idea file (Andrej Karpathy, GitHub Gist)
  2. 02Obsidian
  3. 03How Claude remembers your project (Claude Code docs)
  4. 04obsidian-second-brain (eugeniughelbur, GitHub)
cm

Christian Monge

Builds AI second brains with Obsidian and Claude Code, co-founded the competitive-intelligence SaaS Pengu Insights, and trains teams in English and Spanish from Madrid.

More about me

AI Brains

Want this running on your own material?

I build Obsidian + Claude Code brains around your documents, calls and research, with an evidence ledger so every number has a source.

See the AI Brains

Keep reading