Claude Code
Integration via Hooks — the deepest, most seamless integration.
Setup
Claude Code integration is automatic. Run brainbase init and BrainBase detects Claude Code and installs 4 hooks into your Claude Code configuration.
$ brainbase init
Detected: Claude Code
Installing hooks... done
How it works: 4 Hooks
Claude Code supports lifecycle hooks — shell commands that execute at specific moments. BrainBase registers 4 hooks:
SessionStart
Fires when a new Claude Code session begins. BrainBase activates the brain, loads relevant context from the knowledge graph based on the current project directory, and generates a narrative briefing that Claude receives as context.
UserPrompt
Fires with every user message. BrainBase processes the message through the Thalamus (filtering), 6 Senses (analysis), and Extraction (knowledge pulling). Relevant context is refreshed and injected. This is where the brain learns in real-time.
SessionEnd
Fires when the session ends. BrainBase finalizes the session — stores session metadata, triggers post-session consolidation, and updates node importance based on what was discussed.
PreCompact
Fires before Claude Code compacts its context window. BrainBase ensures critical knowledge is preserved by refreshing the context with the most important, currently-activated nodes. Nothing important gets lost when the context shrinks.
Files created
BrainBase adds hook configurations to your Claude Code settings at ~/.claude/. The hooks point to the brainbase CLI binary with the appropriate hook event name.
Troubleshooting
Hooks not firing? Make sure brainbase is in your PATH. Run brainbase verify to check hook registration.
Context not appearing? Ensure the watcher is running: brainbase watcher status. The watcher handles memory processing.