Set Up Claude Code with a Brain Vault
Wire Claude Code to a long-lived Obsidian vault so every session starts with the context, decisions, and prior conversations the previous session earned.
Overview
An Obsidian vault at ~/brain wired to Claude Code as persistent memory — so the next session knows what the last one figured out.
Why a Brain Vault
I work across a lot of projects with Claude Code. Each session has a context window, which closes when the session closes. A pattern I figured out yesterday in one project is gone tomorrow when I'm in a different project unless I wrote it down somewhere both me and Claude can read.
The fix is a personal knowledge vault — an Obsidian vault at ~/brain that lives outside any single project. Claude Code reads from it on startup, can save to it during a session, and rebuilds a search index on every commit.
What You'll Build
- An Obsidian vault at
~/brainwith a structured layout (journal, learnings, projects, repos, runbooks, scripts, templates). - A
CLAUDE.mdat the vault root that tells Claude the structure and the conventions. - A
/brainskill at~/.claude/skills/brain/SKILL.md— invoked when you say "save this as a learning." - A SessionStart hook — primes context when a session opens.
- A Stop hook — prompts to save anything worth keeping.
- An auto-committing git repo — every change pushes to GitHub on a 10-minute timer.
- A semantic search index — a small Python script that embeds every note locally.
Prerequisites
- macOS or Linux
- Obsidian installed
- Claude Code installed
- A GitHub account
- Ollama installed for local embeddings (optional)
- Python 3.9+
Steps
Step 1 — Create the vault
Create ~/brain with folders: journal/, learnings/, projects/, repos/, runbooks/, scripts/, templates/.
Step 2 — Write CLAUDE.md
Place a CLAUDE.md at ~/brain/CLAUDE.md describing the vault structure, naming conventions, and how to save notes.
Step 3 — Create the /brain skill
Write ~/.claude/skills/brain/SKILL.md with instructions for drafting, approving, and committing learning notes.
Step 4 — Configure hooks
Add SessionStart and Stop hooks to your Claude Code configuration that prime context and prompt for saves.
Step 5 — Set up auto-commit
Install the Obsidian Git plugin and configure a 10-minute auto-push to GitHub.
Step 6 — Build the search index
Write a small Python script using Ollama embeddings to index all notes and expose a brain shell command.
Companion Skill
set-up-claude-code-with-brain-vault