โ† Back to all posts

How to Build a Second Brain with an LLM Wiki

A second brain is a place outside your head that holds what you have learned, in a form you can find and use again. People have built them from notebooks, index cards and note-taking apps for a long time. What changed in 2026 is who does the filing. In April, Andrej Karpathy published a short document called LLM Wiki that hands the tedious part to an AI agent: you supply the sources, and the agent writes and maintains an organised wiki from them.

This guide explains the idea in plain terms, shows how the pieces fit together, says what the pattern does not do for you, and ends with a path you can follow this weekend. The basic version needs no programming. Developers get a section of their own, because a second brain is unusually useful when you look after many software repositories at once.

What a second brain is

The term was popularised by Tiago Forte, whose method Building a Second Brain aims at "an external, centralized, digital repository for the things you learn and the resources from which they come". The method has four steps, known as CODE: Capture, Organize, Distill, and Express. You save what matters, sort it, boil it down, and use it to make something.

The method is sound. The weak point is the person in the middle. Capturing is easy and even pleasant. Organising and distilling are chores, and chores get skipped. Karpathy puts the failure in one sentence: "Humans abandon wikis because the maintenance burden grows faster than the value." By that diagnosis a personal knowledge base dies of neglect, not of bad design. The notes are fine. Nobody updated the links between them.

The LLM Wiki idea in plain words

Most people who have used AI with documents know one way of doing it: upload some files, ask a question, get an answer. Behind the scenes the tool searches your files for passages that look relevant and writes an answer from those. Engineers call this retrieval-augmented generation, or RAG.

Picture a librarian who, for every question, runs to the shelves, skims a few pages, answers you, and then forgets everything. Ask a similar question tomorrow and the running starts again. In Karpathy's words, "the LLM is rediscovering knowledge from scratch on every question."

The LLM Wiki pattern changes when the reading happens. Picture a second librarian who reads each new book once, on the day it arrives, and then updates a set of well-organised notes: a page per topic, a page per person or product, links between them, and a remark wherever the new book contradicts an old one. When you ask a question, the answer comes from those notes. Karpathy calls the result "a persistent, compounding artifact". Each source you add improves pages that already exist, instead of sitting in a pile waiting to be searched.

The pattern has three layers:

  • Raw sources. The documents you collect: articles, papers, transcripts, meeting notes. They are never edited. The gist calls them "immutable โ€” the LLM reads from them but never modifies them."
  • The wiki. Pages written and maintained by the AI: summaries, topic pages, comparisons. You read it. The agent writes it.
  • The schema. One instruction file that tells the agent how the wiki is organised and what to do when a source arrives. In the gist's words it is what makes the model "a disciplined wiki maintainer rather than a generic chatbot".

It has three operations:

  • Ingest. You add a source and ask the agent to process it. It reads the source, writes or updates the relevant pages, and links them.
  • Query. You ask a question. The agent answers from the wiki and says which pages the answer came from.
  • Lint. A health check. The agent looks for contradictions, claims that newer sources have replaced, pages nothing links to, and gaps.

Two small files hold the rest together. index.md is a catalog of every page with a one-line summary, which the agent reads first to find its way around. log.md is a dated list of everything that was done.

One thing to know before you go looking for a download: there is none. The gist describes itself as an idea file, written to be pasted into an AI agent that then works out the details with you. It says so plainly: "This document is intentionally abstract."

 you add a source
      |
      v
 +---------------------------+
 | raw/   sources, untouched |
 +---------------------------+
      |
      |  INGEST: the agent
      |  reads, writes, links
      v
 +---------------------------+
 | wiki/     topic pages     |
 | index.md  the catalog     |
 | log.md    the history     |
 +---------------------------+
      |
      |  QUERY: you ask
      v
 an answer, with citations

A second brain's memory, without the jargon

A useful way to hold the whole structure in your head is to compare it with how people usually describe memory. It is an analogy, not neuroscience, but it tells you where each thing belongs.

  • The buffer is the raw/ folder. Things exactly as they arrived, never edited. If you ever doubt a claim in the wiki, this is where you check it.
  • The diary is a journal/ folder. Dated notes in your own words: what happened today, what you decided, what surprised you. You only ever add to it.
  • The body of knowledge is the wiki/ folder. Compiled, de-duplicated and timeless. This is what you actually read.
  • The how-to shelf is one corner of the wiki for procedures: checklists and step-by-step instructions, written as steps.
  • The index is index.md, the catalog that makes everything findable, with log.md beside it as the record of what changed.
  • The rulebook is the schema file, where you and the agent write down how all of this is run.

The diary is an addition. Karpathy's gist treats everything you add as a source, your own notes included. Keeping your own notes apart is worth doing from the first day, for one reason: somebody else's article should be kept word for word, while your own notes are raw experience waiting to be distilled. A good rule of thumb is to move a lesson from the diary into the wiki only when it has come up at least twice. One occurrence is an anecdote.

The rule that keeps it honest

An AI that writes your knowledge base can also write mistakes into it, fluently and with confidence. In a compiled wiki a mistake does not stay in one answer. It gets linked to, built on and repeated.

The best defence so far comes from an unofficial community implementation of the pattern, karpathy-llm-wiki, which packages it as a skill for coding agents. It adds a rule it calls the grounding invariant: "Every load-bearing fact in wiki/ โ€” numbers, dates, direct quotes โ€” exists verbatim in the raw/ files linked by that article's Raw field." Every wiki page names the sources it was compiled from, and a small script searches those sources for the page's distinctive numbers, dates and longer quotations. Anything it cannot find is reported to you.

Two more of its rules are worth copying whatever tool you use. The first: "Do not force an article out of a thin source." A source that adds nothing new is kept and logged, and no page is written. The second: "Never silently rewrite history." When a newer source replaces an old claim, the old claim stays on the page, marked as outdated, with the date and the reason.

Know the limit of this check. A script can confirm that a number appears in a source. It cannot confirm that the sentence around the number says what the source meant. Somebody still has to read.

What the bare pattern does not do

This is the section to read twice.

  • It does not maintain itself. Every operation happens because you asked. The gist's own wording is "Periodically, ask the LLM to health-check the wiki." A public comparison of second-brain tools, awesome-second-brain, rates an agent running an LLM wiki as only partial on what it calls memory evolution, with the caveat: "Not an autonomous maintenance loop by default; user or Hermes automation must trigger upkeep."
  • It does not capture for you. Nothing connects to your email or your chat history. A source enters because you put it there.
  • It does not scale forever on an index alone. The gist says the index approach works "at moderate scale (~100 sources, ~hundreds of pages)". Beyond that you add a search tool. It suggests qmd, a local search engine for markdown files.
  • It does not remove the need to review. The same comparison notes that "Quality depends on the agent following the skill instructions and the user's review discipline."
  • It is not built for teams. Sharing one means deciding who may change what, and that is a process you design yourself.
  • It is not private by default. The agent sends what it reads to whichever AI provider you use. Decide what may go into raw/ before you start, not after.

Then there is the cost of keeping it up. Time comes first. Karpathy writes that he prefers to ingest sources one at a time and stay involved, reading the summaries and guiding what gets emphasised. That is attention, for every source. Then money: the agent reads the whole source and may rewrite many pages for it ("A single source might touch 10-15 wiki pages"), which uses up a subscription allowance or paid API usage. And discipline: a wiki nobody checks drifts away from the truth quietly.

Closing the gap: a maintenance loop

The missing piece is a routine. A second brain stays useful when four things happen on a schedule, not just when you remember them.

   +---> 1. CAPTURE
   |     sources and notes
   |          |
   |          v
   |     2. COMPILE
   |     agent updates wiki
   |          |
   |          v
   |     3. CHECK
   |     lint, measure again
   |          |
   |          v
   |     4. REPAIR
   |     agent proposes,
   |     you approve
   |          |
   +----------+

Capture and compile are the ingest you already know. The loop adds two habits.

Check. Run lint. Also look again at facts that go stale without telling you: prices, version numbers, the state of a project. Save each new measurement as a new dated source. Do not edit the old one.

Repair. Ask the agent to propose what to merge, what to mark as outdated and which diary notes are ready to become knowledge. Then read the proposal before anything is written. The awesome-second-brain rubric asks this of every tool it reviews: "Can users inspect proposed changes before they become durable memory?" With a wiki you keep yourself, you can make the answer yes.

You can put the trigger on a timer. Several tools in that comparison name the job after sleep, with commands such as dream. Automate the reminder and the proposal if you like. Keep the approval for yourself.

Why a second brain suits developers with many repositories

Take a developer with a dozen repositories. Each one documents itself, more or less: a README, some comments, a commit history. What none of them documents is everything in between.

  • Which service calls which, and what breaks elsewhere when this one changes.
  • The product name people actually use, when the folder is called something else.
  • Which repository deploys the moment you push, and which needs a manual step.
  • What is stalled and why, and what was tried last time.
  • The procedure you run twice a year and work out again from scratch each time.

That knowledge lives in one head, and it is the first thing lost after a month away from a project. It is also what an AI coding agent lacks. An agent opens a repository with no memory of the other eleven. An LLM wiki gives both of you a map to read first. This is knowledge management for developers in the most practical sense: fewer wrong assumptions before the first edit.

A sensible setup:

  • One page per project. What it is, the names it goes by, how it deploys, what depends on it, known traps.
  • One page for the connections. Shared libraries, shared databases, who calls whom.
  • A how-to shelf. Release checklists, key rotation, the restore procedure.
  • Dated surveys as sources. Have the agent collect each repository's README, recent commits, open pull requests and build status into a dated file in raw/, then compile the pages from that file. Next month's survey is a new file. The wiki shows what changed and keeps what used to be true.
  • A rule in the schema. Before touching a repository, the agent reads that project's page.

One caution. For how something works, the code is the truth. The wiki is for what the code cannot say about itself: why, for whom, in what state, connected to what. When the two disagree about mechanics, believe the code and correct the page.

Build your second brain this weekend

You need a folder, an AI agent that can read and write files in that folder, and about two half-days.

Step 1: make the folders. Technical readers should make it a git repository, since the gist points out that "The wiki is just a git repo of markdown files." Everyone else can use an ordinary folder.

brain/
  raw/        sources, as-is
  journal/    your dated notes
  wiki/
    index.md  the catalog
    log.md    the history
    how-to/   checklists
  AGENTS.md   the rules

Step 2: pick an agent. The gist names OpenAI Codex, Claude Code and OpenCode as examples. Any assistant that can open a folder and edit the files in it will do. To browse the result, Karpathy uses Obsidian, a note-taking app that reads the same plain files. It is optional.

Step 3: write the rulebook together. Paste the text of the gist into the agent and ask it to set up the schema file with you. That is the use the gist was written for. If you would rather begin from something finished, install the community skill mentioned above.

Step 4: ingest five sources on one subject. Choose something you care about this month. Add the sources one at a time and read what the agent writes after each. This is where you learn what to tell it to do differently.

Step 5: ask three real questions. Check that each answer names the pages it used. When an answer is good, ask the agent to file it as a page. The gist makes the point that "good answers can be filed back into the wiki as new pages."

Step 6: run a lint pass. Have the agent report contradictions, orphan pages and unsupported claims. Fix what it finds, and write every lesson into the rulebook so the next session starts with it.

Step 7: book the loop. Put a recurring half hour in your calendar for check and repair. Without that appointment, this is one more abandoned wiki.

Step 8, for developers. Pick three repositories. Have the agent survey each into a dated file in raw/ and compile one project page per repository plus one page on how they connect. Then start your next coding session by pointing the agent at those pages.

After a month, judge it honestly. Can you answer a real question faster from the wiki than from a search? Did lint find anything? Are you still reading what the agent writes? If the last answer is no, make it smaller: fewer sources, one subject, the same weekly check.

Common questions

Is an LLM wiki the same as RAG? No. RAG finds passages in your raw documents each time you ask. An LLM wiki compiles the documents into pages once and keeps those pages current. Past a certain size you may add search on top of the wiki, so the two can work together.

Is this the same as a personal knowledge base? It is one way to keep one. The difference from a notes app is who maintains it: you curate and ask, the agent files.

Do I need to be a programmer to build an AI second brain? No, but you need an AI assistant that can edit files in a folder, and the patience to review what it writes.

Can it be wrong? Yes. That is what the immutable sources, the grounding rule and the review step are for.

Sources and further reading

Book: AI-Savvy in 15 Minutes

A 39-page beginnerโ€™s PDF on using Claude and GitHub Copilot well.

$9.99 reduced from $19.99