Personal knowledge management system for Claude Code + Obsidian. Persistent memory that grows with every session.
Based on Andrej Karpathy's LLM Knowledge Bases pattern and the implementation guide by @alex_magnier.
Claude Code has no memory between sessions. Every time you start a new session, you re-explain the project context. Over a week, that's hours of wasted time.
An Obsidian vault as external memory, connected to Claude Code via CLAUDE.md.
Five slash commands to manage it. The vault grows with every session.
projects/dotfiles/ ← your code (existing repo)
CLAUDE.md ← the bridge to vault
~/Workspace/second-brain-vault/ ← Obsidian vault (private git repo)
dotfiles/ ← project knowledge
_PROJECT.md ← what, why, current status
taskboard.md ← project tasks
architecture-map.md ← code orientation map (code/mixed projects)
raw/ ← source files (configs, transcripts, docs)
wiki/ ← compiled knowledge (Claude writes this)
decision-*.md ← decision records (immutable, ADR-lite)
sessions/ ← session logs
00-system/ ← index.md, connections.md
00-shared/ ← CRITICAL_FACTS.md, SOUL.md
At session start, Claude reads CRITICAL_FACTS.md + _PROJECT.md + taskboard.md
(~450 tokens) and immediately knows the full context. No re-explaining.
For code projects it also reads architecture-map.md — a route/module map that
replaces repository scanning.
# 1. Clone this repo
git clone https://github.com/dmitrax/second-brain-setup
cd second-brain-setup
# 2. Install (creates vault + copies slash commands to ~/.claude/)
bash install.sh
# 3. Fill your profile (one time)
cd ~/Workspace/projects/any-folder && claude
> /brain-setup
# 4. Create your first project
mkdir ~/Workspace/projects/dotfiles && cd ~/Workspace/projects/dotfiles && claude
> /brain-init dotfiles
# 5. Work. Save. Repeat.
> /brain-save| Command | When |
|---|---|
/brain-setup |
One time after install — fill your profile |
/brain-init [name] |
Create a new project |
/brain-save |
End of every session |
/brain-ingest raw/[file] |
Process a source file into wiki |
/brain-lint |
Audit current project |
/brain-lint --all |
Weekly full vault audit |
Two separate spaces, one bridge:
~/.claude/ Claude Code global config
skills/second-brain/
SKILL.md ← passive skill, auto-loaded
commands/
brain-*.md ← slash commands
~/Workspace/projects/[project]/
CLAUDE.md ← BRIDGE: points to vault + project rules
~/Workspace/second-brain-vault/ ← Obsidian vault (private)
[project]/ ← one folder per project
AI-First note format — every wiki note has a ## For future Claude section
that tells Claude exactly when and how to use it. The Obsidian graph grows
as Claude adds [[wikilinks]] between notes.
Rewrite, not append — when processing a new source, Claude rewrites existing notes instead of creating duplicates. Knowledge stays clean and current.
Decision notes — immutable decision-<slug>-because-<reason>.md records in wiki/.
When a decision changes, a new note supersedes the old one — nothing is deleted or rewritten.
Skills for Claude.ai that complement the Claude Code commands. Work in any chat, Claude.ai Projects, and Cowork — no Claude Code needed.
| Skill | Trigger | When |
|---|---|---|
brain-onboard |
/brain-onboard |
Onboard a project from chat to Claude Code |
Install: zip the skill folder → Claude.ai → Customize → Skills. See chat-skills/README.md for details.
The skill files (SKILL.md, brain-*.md) are written in English and follow
the AGENTS.md open standard.
Works with: Claude Code, Codex CLI, Gemini CLI, Cursor, Windsurf.
For non-Claude agents: rename CLAUDE.md → AGENTS.md.
v1.x — additive changes only (new commands, new fields).
v2.0 — breaking changes, shipped with a migration script.
# Update slash commands after pulling changes
bash update.shUpgrading from v1.1 → v1.2:
# No vault migration needed — all changes are additive.
# Run update.sh to get the new command files:
bash update.sh
# For existing code/mixed projects, create architecture-map.md manually
# or let Claude generate it on your next session:
# > Создай architecture-map.md для этого проекта на основе текущей кодовой базы
# Add updated: field to existing _PROJECT.md files (optional, enables stale detector):
# updated: 2026-06-09Upgrading from v1.0 → v1.1 (vault path changed):
mv ~/Documents/second-brain-vault ~/Workspace/second-brain-vault
# Then update Vault: line in each project's CLAUDE.md| File | Language | Audience |
|---|---|---|
SKILL.md, commands/brain-*.md |
English | Claude Code (machine) |
WORKFLOW.md |
Russian | User guide (human) |
ВТОРОЙ_МОЗГ_v1.3.md |
Russian | Architecture reference |
README.md |
English | GitHub |
chat-skills/brain-onboarding/SKILL.md |
English | Claude.ai Skills (machine) |
User guide and architecture doc in Russian:
- WORKFLOW.md — step-by-step guide
- ВТОРОЙ_МОЗГ_v1.3.md — full architecture
- Obsidian CLI integration — optional enhancement when Obsidian 1.12.7+ is running with CLI enabled.
_obsidian_available()guard — every CLI call is wrapped; system falls back to filesystem if Obsidian is not running./brain-lint: Step 1 usesobsidian orphanswhen available; new Step 1b checks broken links (obsidian unresolved,obsidian deadends); Step 11 adds link validation for architecture-map; Result block reportsBroken links (CLI)./brain-save: Step 0b usesobsidian property:setto updateupdated:frontmatter when CLI is available.SKILL.md: new Principles rule — useobsidian movefor renames to preserve [[backlinks]]; never rename via filesystem while Obsidian is running./brain-init: CLAUDE.md template includes### Obsidian CLIsection.
Upgrading from v1.2 → v1.3:
# No vault migration needed — all changes are additive.
bash update.sh
# To enable CLI: Obsidian → Settings → General → Command line interface- architecture-map.md — new file for code/mixed projects: route/module → file → data source → components. Read at session start; never scan the repo.
/brain-savekeeps it current./brain-lintchecks freshness. - Decision notes (ADR-lite) —
wiki/decision-<slug>-because-<reason>.md. Immutable records with Y-statement, alternatives, consequences. Superseded not rewritten./brain-savecreates them on trigger. - Critical thinking & warn clause in all CLAUDE.md templates: no auto-flattery; one-line warning before destructive actions.
- Tier navigation in session start: no full vault or repository scan — index + grep.
updated:field in_PROJECT.mdfrontmatter. Bumped by/brain-save. Used by/brain-lintstale detector (14-day threshold)./brain-lintadditions: stale project detector, size check, decision consistency, architecture-map freshness./brain-savesession log sharpened: adds "What worked" and "Tech debt found, not fixed" sections.- Decision notes flat in
wiki/(removedwiki/decisions/subfolder convention). brain-initnow asks for project type (code / content / config / mixed).
Vault path moved to ~/Workspace/ — fixes iCloud Drive conflict on macOS.
- Default path:
~/Documents/second-brain-vault/→~/Workspace/second-brain-vault/ install.shnow creates~/Workspace/if absent- Recommended code projects location:
~/Workspace/projects/(not required) - Cross-device path consistency: same on macOS and Linux
Chat Skills:
brain-onboard— new Claude.ai skill: onboards any project from chat context into the Second Brain vault (generates CLAUDE.md, _PROJECT.md, taskboard.md)
Initial release.
- 5 slash commands:
/brain-setup,/brain-init,/brain-save,/brain-ingest,/brain-lint - One vault, autonomous projects (each project is a self-contained root-level folder)
- AI-First note format: YAML frontmatter +
## For future Claude - Wikilinks rule: minimum 2
[[links]]per note for Obsidian graph raw/files treated as untrusted source material (prompt injection protection)- Git-based sync across devices (no paid Obsidian Sync needed)
- Andrej Karpathy — LLM Knowledge Bases pattern
- @alex_magnier — Claude Code + Obsidian guide
- Eugeniu Ghelbur — AI-First vault,
## For future Claudepattern
MIT