Second Brain AI: Build Karpathy's LLM Wiki in Markdown
November 11, 2026 · 11 min read
Second Brain AI: Build Karpathy's LLM Wiki in Markdown
A second brain AI setup is a folder of Markdown notes that a language model reads, writes and keeps organized for you. Andrej Karpathy's LLM wiki is the cleanest version of the idea. This tutorial builds it with Claude Code as the agent and Obsidian as the viewer, showing the real folder layout and sample pages.
What Is an AI Second Brain?
An AI second brain is a personal knowledge base where the model does the upkeep. You collect sources and ask questions. The model writes summaries, links related notes, updates old pages when new evidence arrives and keeps an index current.
The classic second brain asks you to file, tag and link every note by hand, and that filing is where most people give up. The AI version keeps the same goal but hands the bookkeeping to the model. The result is a second brain Claude can maintain while you read. Everything stays in plain .md files, so you can still open, read and fix any page yourself.
What Is Karpathy's LLM Wiki?
The LLM wiki is a pattern Karpathy published on April 4, 2026 as a single file, llm-wiki.md, in a public GitHub gist. He calls it an idea file: you paste it into your own agent, such as Claude Code or Codex, and build the specifics together.
It has three layers:
- Raw sources. Articles, papers, images and data files you collect. The model reads them but never edits them.
- The wiki. A directory of Markdown pages the model writes and owns: summaries, concept pages, comparisons and an overview.
- The schema. One instruction file, such as
CLAUDE.mdorAGENTS.md, that tells the model how the wiki is structured and which steps to follow.
The gist contrasts this with retrieval at question time. A typical RAG setup finds chunks again on every question, so nothing accumulates. Here the knowledge is compiled once and kept current. Karpathy sums up the roles in one line: "Obsidian is the IDE; the LLM is the programmer; the wiki is the codebase."
Read the diagram as a loop. Ingest turns sources into pages, queries read those pages, good answers go back in as new pages, and lint passes keep the whole thing consistent.
The Folder Layout: raw, wiki and a Schema File
Karpathy leaves folder names open. Most builds settle on something like this:
my-brain/
├── CLAUDE.md # schema: rules the agent follows
├── raw/ # sources, never edited by the model
│ ├── 2026-11-02-forgetting-curve-article.md
│ └── 2026-11-09-anki-manual-notes.md
└── wiki/
├── index.md # catalog of every page, read first
├── log.md # append-only record of activity
├── spaced-repetition.md
└── forgetting-curve.md
Two files in wiki/ do the navigation. index.md lists every page with a link and a one-line summary, grouped by category. On a query, the model reads it first and then opens only the pages it needs. Karpathy reports this works well at moderate scale, around 100 sources and hundreds of pages, without any embedding search.
log.md is chronological. Each ingest, query or lint pass adds an entry, and the gist suggests a fixed prefix so the log stays greppable:
## [2026-11-09] ingest | Anki manual notes
## [2026-11-10] query | Does spacing beat cramming for vocabulary?
## [2026-11-11] lint | 2 orphan pages, 1 stale claim
With that prefix, grep "^## \[" wiki/log.md | tail -5 prints the last five entries.
Capturing Sources as Markdown
The raw folder only helps if sources land in it as clean text. The gist recommends Obsidian Web Clipper, a free browser extension that saves web pages as Markdown files in your vault.
You can also paste a link into our URL to Markdown tool. It fetches the page on our server without running JavaScript, turns the title into an H1 and makes links absolute.
It converts the whole page body, so trim the site menu and footer before you save the file to raw/. Each conversion uses one of the 3 free server operations a day, and Pro removes that daily cap. Our guide to converting a web page to Markdown covers the details.
Name raw files with a date prefix. It keeps them sorted and gives the model an easy way to cite them.
How Do You Build a Second Brain With Claude and Obsidian?
Here's a Claude second brain built end to end. It assumes you've installed Obsidian and Claude Code. Claude Code needs a paid Claude plan or an Anthropic Console account, since the free plan doesn't include it.
- Create the folders. Make
my-brain/withraw/andwiki/inside, then openmy-brain/as a vault in Obsidian. A vault is just a folder of plain-text Markdown files, and Obsidian refreshes when other programs change them. - Write the schema. Save a short
CLAUDE.mdat the root. Claude Code reads it at the start of every session, per the Claude Code memory docs. - Start the agent. Open a terminal in
my-brain/and runclaude. - Ingest one source. Drop a clipped article into
raw/and ask Claude to ingest it followingCLAUDE.md. - Watch it land. Keep Obsidian open beside the terminal and read each page as Claude writes it.
A starting schema can be this short:
# Wiki rules
## Folders
- raw/ holds sources. Never edit or delete anything in raw/.
- wiki/ holds pages you write. One concept or entity per page.
## Page format
- H1 title, then a 2-3 sentence summary.
- Key points as bullets, each citing its source as (source: raw/<file>.md).
- End with a Related section of relative Markdown links.
## Ingest steps
1. Read the new source and tell me the 3-5 main takeaways.
2. Create or update every affected page in wiki/.
3. Update wiki/index.md and append an entry to wiki/log.md.
We prefer starting with a one-page schema like this and growing it only when the model repeats a mistake. Long rule lists written up front tend to contradict each other. Each new rule should answer a problem you actually saw. Our guide to writing a CLAUDE.md file goes deeper on what belongs in it.
Your first ingest prompt can be plain English:
Ingest raw/2026-11-02-forgetting-curve-article.md following CLAUDE.md.
Tell me the main takeaways before you write any pages.
Asking for takeaways first lets you correct the model's reading before it edits anything. Karpathy notes that one source might touch 10 to 15 wiki pages, so a misread spreads fast. If the folder is a git repository, git status then lists the pages the model created and git diff shows its edits to existing ones.
What a Page in the Wiki Looks Like
After a couple of ingests, a concept page might look like this:
# Forgetting Curve
Memory of new material drops fast in the first days, then levels off.
Reviews reset the curve and flatten it.
## Key points
- Most loss happens soon after learning (source: raw/2026-11-02-forgetting-curve-article.md)
- Each review slows the next drop (source: raw/2026-11-09-anki-manual-notes.md)
## Open questions
- Does the curve differ for skills versus facts? No source yet.
## Related
- [Spaced repetition](spaced-repetition.md)
Every claim points to a raw file, so you can check it in seconds. The Open questions section gives the next lint pass something to chase.
Obsidian also understands [[wikilinks]], but our editor's preview doesn't render them, so the schema above asks for standard relative links. Those work in Obsidian, on GitHub and in any Markdown viewer. The editor below holds a second sample page, and its preview shows the headings, citations, table and links:
Querying and Linting: Keeping the Wiki Honest
Querying is where the setup pays off. Ask a question in the terminal, and the model reads index.md, opens the relevant pages and answers with citations. When an answer is worth keeping, such as a comparison table or a short analysis, ask Claude to file it as a new wiki page. Your questions then grow the wiki the same way sources do.
Linting is the maintenance pass. Every week or two, ask the model to check for:
- claims on two pages that contradict each other
- statements a newer source has replaced
- orphan pages that nothing links to
- concepts mentioned often that still lack a page
Here's the limitation. The model can summarize a source wrongly, and a confident wrong page reads just like a correct one. Review what changed after each ingest, keep raw/ read-only so you can always go back to the original, and expect token use to grow with the wiki. As the wiki outgrows a single index, the gist suggests adding proper search, such as qmd, a local search engine for Markdown files.
Where Is Karpathy's Second Brain on GitHub?
The original isn't a repository. Karpathy's version is the single gist linked above, and it holds no code. It describes the pattern and leaves the folder names, page format and tooling to you and your agent.
Search for a Karpathy second brain GitHub repo and you'll find many community builds: starter vaults, Claude Code skills and ingest scripts. None of them come from Karpathy. Treat each one as someone else's interpretation. Prefer repos that are only Markdown files over ones that ship scripts, since scripts run with access to your notes. If you do try one, read its schema file first, because that file decides how the model edits your pages. Our Obsidian second brain tutorial lists five checks to run before cloning any vault repo.
Second Brain AI Apps vs a Markdown Folder
Search for second brain AI tools and most results are hosted note apps with an assistant built in. They're quicker to start: no terminal, no schema file, and search works on day one. The trade is that your notes live in the app's format and you're limited to the models it offers.
A Markdown folder takes more setup, but every page opens in any editor and you can switch agents whenever a better model ships. If you're choosing a notes app anyway, our comparison of Markdown note-taking apps covers eight options, and our review of editing in Obsidian covers the viewer used here. If you do switch agents, our AGENTS.md guide lists which coding agents read the file out of the box.
Frequently Asked Questions
A second brain AI works because the files stay yours. Raw sources stay untouched, the model maintains the wiki, and a short schema keeps it consistent. Start with one source, read every page Claude writes, and add rules only when you spot a repeated mistake. When you want to check a single page's formatting, paste it into the editor and read the live preview beside your Markdown.