<aside> 👋

What this is: a step-by-step kit for building a second brain your AI agents (Claude Code, Codex, Cursor, etc.) can actually read and work from. It is a folder of plain Markdown files in a Git repo, with rules that keep it organized as it grows.

Time to first working version: about 60–90 minutes.

You need: a GitHub account, Git, and an AI coding agent. No database or paid tools required.

</aside>

Why most “second brains” fail with AI

Most notes apps turn into a junk drawer. The same fact lives in five places, nobody knows which copy is current, and an AI agent that reads it gets confused or makes things up.

A second brain built for AI needs three things:

  1. One home for every fact. Each fact is written once, and everything else links to it.
  2. A predictable map. An agent should know where to look without searching every file.
  3. Written rules. A single file tells every agent how to read and write the brain.

The rest of this kit shows you how to set up those three things.


The 4-stage loop

Stage What happens Where it lives
1. Capture You, your agents, and your tools drop in raw notes inbox/
2. Organize Each useful fact is cleaned up and filed in one home Numbered domain folders
3. Guide Agents read the rules and the knowledge before they work AGENTS.md • folder maps
4. Act Agents draft, decide, and do real work using that context Your projects

The goal is to empty the inbox, not to keep adding to it. Raw notes get filed and then deleted, so the brain stays small and trustworthy.


Step 1 — Create the repo (5 min)

Use a private repository. Your second brain will hold real business context.

gh repo create my-second-brain --private --clone
cd my-second-brain

<aside> 🔒

Rule #1: never put secrets in the brain. No API keys, passwords, tokens, or customer personal data. Write down where a secret lives (for example, “Stripe key → 1Password, vault: Ops”), never the secret itself.

</aside>


Step 2 — Lay out the numbered folders (5 min)

Organize by business function, not by project or date. Put a number in front of each folder name so the order never changes and you can refer to a folder by its number (“check 02”).