How to build your own second brain: a step by step guide to an LLM-maintained wiki

From an empty folder to a governed knowledge base an agent maintains: the structure, the constitution file, the rules that keep it honest, the tools worth adding, and the order to do it in.

Answer first

Building a second brain takes an afternoon for the structure and a few months for the value. Create a folder with three tiers: raw sources you never edit, a wiki the agent writes, and one constitution file that tells the agent how both work. Add an index the agent reads first and an append-only log it writes to. Then set the rules that keep it honest: capture verbatim, promote by rewrite, log every promotion, cite raw sources rather than derived pages, and let contradictions surface as proposals. Put it in version control. Feed it one real source a day.

This is the build, in the order I would do it again. It assumes you want a knowledge base an AI agent maintains and you govern, rather than a notes app you will abandon in March. The pattern underneath is Karpathy’s LLM wiki; the governance on top is what four months of running one in a business taught me, written up in why I built Lorekeep.

You need three things: a folder, an agent that can read and write files on your machine, and the willingness to feed it. Nothing here requires you to write code.

Before you start

Decide one thing first, because it determines everything else: what is this vault for. A research vault, a business operating layer and a personal system are built the same way and filled completely differently. Write the answer in one sentence. You will paste it into the constitution file in step two.

Then pick where it lives. Local disk, always. If you want it on more than one machine, a private git remote or an encrypted drive, chosen deliberately rather than by drift. A vault holding client work is not a thing to sync casually.

Step 1: the folder

Three tiers, and the discipline is that they never blur into each other.

  1. raw/ holds sources exactly as captured. Transcripts, clipped articles, exports, notes you dictated. Nothing in here is ever edited. This is the tier every answer eventually cites.
  2. wiki/ holds the pages the agent writes and maintains. Subfolders by kind, not by project: projects/, clients/, people/, decisions/, concepts/, tools/. Kind-based folders stay stable while projects come and go.
  3. CLAUDE.md at the root is the constitution: the file the agent reads on every single task. Some agents call this AGENTS.md. Same job.

Add a fourth if you intend to govern properly: quarantine/, where drafted pages and flagged contradictions wait for you to accept or reject them.

Then run three commands in the folder so you never lose it and can always see what changed:git init, git add -A, git commit -m "vault". This is the whole technical requirement of the project. My vault outlived the laptop it was created on because of those three commands.

Step 2: the constitution

This file is loaded as context on every task, so every word in it is paid for repeatedly. Keep it short and make it settled. Five sections is enough.

  • Who and what. You, the business, what it does, in a paragraph.
  • The structure. What each tier means and what belongs in it.
  • The rules. The six in step four, stated plainly.
  • Standing style. How you write, what you never write, brand terms and their spellings.
  • Settled decisions. Only the ones that are actually settled, each with a date.

What must not go in: anything speculative, anything with an expiry date you have not set, and anything you are still arguing about. Canon outranks the agent’s own judgement on every task, so a stale line in here degrades every answer you get for as long as it sits there.

Step 3: the index and the log

Two files do the navigation work, and they are different jobs.

wiki/index.md is content-oriented: every page listed with a link and a one-line summary, grouped by kind. The agent updates it on every ingest and reads it first when answering. At a few hundred pages this genuinely removes the need for embedding-based retrieval infrastructure, which is a much bigger deal than it sounds.

wiki/oplog.md is chronological and append-only: what changed, which direction it moved, from what source, why, and what it reverses against. Start each entry with a consistent prefix and the file stays greppable forever. This is the file that lets you answer why is this in canon, and it is the one people skip.

Step 4: the six rules

These are the difference between a wiki that ages well and one that quietly starts lying. Put them in the constitution verbatim.

  1. Capture verbatim. Raw is immutable. Summarise into the wiki, never over the source.
  2. Promote by rewrite. Nothing reaches canon as a copy. A machine drafts, a human accepts.
  3. Log every promotion. No entry, no canon. A page in canon with no ledger entry is a finding, not a fact.
  4. Cite raw, not derived. An answer that cites a summary of a summary is a knowledge base agreeing with itself.
  5. Contradictions become proposals. When a new source disagrees with canon, surface the diff. Never let it rewrite the pages around it unattended.
  6. Dates on anything perishable. Versions, rates, roles, prices. If it can expire, it carries a captured date and a review cadence.

Step 5: the loop that keeps it alive

Four operations, and you will do the first two daily and the others on a rhythm.

  • Ingest. Drop a source into raw/ and tell the agent to process it. It reads, discusses the takeaways with you, drafts a summary page, updates the index, and touches every related page. One source often touches ten to fifteen pages, which is exactly the work you were never going to do by hand.
  • Query. Ask questions of the vault rather than of the model. The important habit: when an answer is good, file it back as a page. Otherwise your best thinking evaporates into chat history.
  • Promote. Review what is sitting in quarantine and accept or reject. Ten seconds each. This is the gate.
  • Verify. Weekly or monthly, sweep for broken links, orphan pages, contradictions, stale claims and promotions with no log entry. Treat the findings as proposals, not fixes.

Step 6: tools worth adding

In rough order of return. None are required on day one.

  • Obsidian, for the graph view more than the editing. Seeing which pages are hubs and which are orphans tells you where the knowledge actually is. The video on the Lorekeep page is that graph growing over a few months.
  • A web clipper that converts articles to Markdown, so capturing a source is one keystroke rather than a chore you skip.
  • Local search, once the index alone stops being enough. Hybrid keyword and vector search over Markdown, on-device, exposed so the agent can call it.
  • Frontmatter and queries. If the agent stamps pages with YAML frontmatter, dynamic tables over that metadata come almost free.
  • Scheduled sweeps. Anything that runs the verify pass on a cadence without you remembering, because you will not remember.

If you would rather not assemble the governance yourself, that is what Lorekeep packages: the interview, the gate, the oplog, the sweep and the precedence order, as nine skills you install. It is Apache 2.0 and it captures nothing.

The first month, realistically

Week one is structure and it feels like admin, because it is. Weeks two and three you will wonder whether it is worth it, and the honest answer at that stage is not yet. Somewhere around thirty to fifty ingested sources it turns: the vault starts answering things you would have gone looking for, and you stop having to remind yourself to use it.

Measure sources ingested and pages promoted, not hours spent. One real source a day beats a weekend of restructuring.

How it fails

Two ways, and I have done both.

The empty cathedral. An elaborate structure, beautifully organised, containing almost nothing. Structure is cheap and feels productive. Feeding is the work.

The ungoverned vault. Letting the agent write straight into canon because the gate is slower. It works beautifully for about six weeks. Then a rule appears that nobody can date, contradicting something you know you decided, and you have no way to tell which one is real. The gate feels like friction in week one and is the entire value in month six.


By Piers Butler, founder of Laurelin Labs. Pattern source: LLM Wiki by Andrej Karpathy. For what this looks like across a business, read running a business on a second brain.

Frequently asked questions about how to build a second brain

How long does this take to set up?

The structure takes an afternoon: seven folders, a constitution file, an index and a log. Feeding it is the real work, and the useful measure is sources rather than hours. Somewhere around thirty to fifty ingested sources the wiki starts answering questions you would otherwise have gone looking for, which is the point at which people stop having to be reminded to use it.

Do I need to be able to code?

No. Every file is plain text and every operation is a sentence you say to an agent. The one genuinely technical step is putting the folder in version control, and that is three commands you can copy. If you want the governance without assembling it yourself, that is what the plugin packages.

What should go in the constitution file?

Only what you want applied on every single task: who you are and what the business does, the folder structure and what each tier means, the promotion rules, your standing style and brand rules, and the handful of decisions that are settled. Keep it short. It is loaded as context every session, so anything speculative or expired in there quietly degrades every answer you get.

How is this different from just using an assistant with memory?

Memory features write inferences about you into a store you cannot easily read, edit or audit, and they belong to whichever vendor you are using. A second brain is your own folder of plain text, versioned, portable between models, and it only holds what you accepted. The trade is a little friction at capture for the ability to answer why something is in there two years later.

What is the most common way this fails?

Two ways. Building an elaborate structure and never feeding it, which is a filing cabinet with nothing in it. Or letting the agent write straight into canon because it is faster, which works until the day you need to know why a rule exists and there is no answer. The gate feels like overhead in week one and is the entire value in month six.