The guide ยท paste into Claude Code
Give Claude Code a memory.
Paste this into Claude Code and it guides you, step by step, through building an Obsidian brain (plain markdown + git, nothing you can't read), then sets up two hooks. A SessionStart hook loads your brain the second you open a session, and a Stop hook quietly saves everything back after every reply. No databases, no manual saving, no closing anything. Your Claude Code just stops forgetting.
Paste into Claude Code
๐ Drop your email to reveal the prompt
Get the full prompt, free.
Drop your email and the prompt unlocks instantly, plus every other guide and resource in the library. One email a week, unsubscribe anytime.
Task: Walk me through setting up an "AI brain" โ a git-backed Obsidian vault that you (Claude Code) automatically load at the START of every session, and quietly save to after EVERY reply, using hooks. Be my guide. Go one step at a time, ask me what you need, and verify each piece actually works before moving to the next. Do NOT dump the whole thing at once.
WHAT WE'RE BUILDING (say this back to me so I know you get it)
- An Obsidian vault โ just a folder of markdown files โ that becomes your permanent memory of everything I do.
- A SessionStart hook โ every time I open Claude Code, it auto-loads my brain's current state as context, so you already know what I've been working on without me re-explaining.
- A Stop hook โ every time you finish a reply, it quietly runs in the background and saves anything worth keeping (decisions, fixes, status changes, new tools) back into the brain. I never save anything manually.
BEFORE YOU START
Read the CURRENT Claude Code hooks documentation (the live hooks reference โ SessionStart, Stop, settings.json hook format, and the stdin/stdout contract) so the syntax is exactly right for my installed version. Do not guess hook JSON from memory โ confirm it against the docs first.
STEP 1 โ THE VAULT
Ask me where I want the brain to live (default: ~/brain). Then create this structure:
brain/
โโโ CLAUDE.md # the schema โ how the brain is organized + the save rules
โโโ State/
โ โโโ current-session.md # what was last touched, hot context, the immediate next action
โ โโโ open-threads.md # every piece of in-flight work
โ โโโ surface-map.md # keyword -> thread index (so you load only what's relevant)
โโโ Knowledge/
โ โโโ Tools/ # tools & platforms I use
โ โโโ Concepts/ # ideas, patterns
โ โโโ Decisions/ # architecture decisions, rules
โโโ Projects/ # active work
โโโ Log/
โโโ index.md # catalog of every page in the brain
โโโ log.md # chronological operation log
Run `git init` in the vault so every change is versioned. Seed each State file with an empty template.
STEP 2 โ THE SCHEMA (brain/CLAUDE.md)
Write brain/CLAUDE.md so any future session instantly understands the brain: the folder layout, the YAML frontmatter every page uses (title, type, tags, created, updated, summary), the [[wikilink]] convention, where each kind of content goes, and the golden rule โ "save knowledge to the brain the moment it happens (new tool configured, bug fixed with root cause, decision made, project status changed) โ don't batch, don't wait to be asked."
STEP 3 โ THE SESSION-START HOOK (loads the brain in)
Add a SessionStart hook to my settings.json (~/.claude/settings.json) that runs a small script which reads my three State files (current-session.md, open-threads.md, surface-map.md) and feeds them in as session context (use the hook's additionalContext output). Show me the exact settings.json block AND the script. Then make me open a fresh Claude Code session and prove you can see my brain on startup โ tell me what my "current session" was without me pasting anything.
STEP 4 โ THE STOP HOOK (quietly saves as I go)
Add a Stop hook that fires after each of your replies and updates the brain in the background: append a one-line entry to Log/log.md, refresh State/current-session.md (last action + next action), and create/update a Knowledge page for anything genuinely worth keeping. Keep it lightweight and SILENT โ I should never feel it run or wait on it. Show me the settings.json block AND the script. Then run one real test turn and prove the brain updated on its own (show me the git diff).
STEP 5 โ PROVE THE LOOP
Walk me through one full cycle end to end: open session โ brain loads โ I work on something โ brain saves itself after your reply โ I close โ I reopen โ you still remember everything. I want to watch it work, not take your word for it.
RULES
- One step at a time. Stop and wait for my "ok" before moving on.
- Verify every hook against the LIVE Claude Code docs โ never invent hook syntax.
- Keep hooks fast and silent. If a hook ever makes me wait, simplify it.
- Plain markdown + git only. No databases, no vector stores, no SaaS memory layers โ I want to be able to read and edit my own brain.
- If something's already set up (vault exists, a hook exists), inspect it and improve it instead of overwriting.
Start by saying the goal back to me in one line, then ask me where I want the brain to live.