v1.4.20 · live on npm
One command fixes all three. Works with Claude Code, Cursor, and Windsurf.
free · byok · any repo
01 / full setup
Scans your repo, generates three context docs, injects them into your agent files, and installs a git hook. One time.
output
$ npx agentbrain setup
scanning 1,223 files... selected 183 relevant files summarising in parallel... ✓ .agentbrain/context.md ✓ .agentbrain/dependency-map.md ✓ .agentbrain/patterns.md ✓ CLAUDE.md · .cursorrules · .windsurfrules ✓ git hook installed 💸 $0.33 · 94 seconds · never again02 / spec-driven dev
Five questions. One spec file. Your agent reads it before touching any code. No more vague asks, no more wrong implementations.
output
$ agentbrain spec "add stripe webhook"
Q1: What problem does this solve? Q2: What's your approach? Q3: What should the agent NOT touch? Q4: What does done look like? Q5: Any edge cases or risks? ✓ .agentbrain/specs/add-stripe-webhook.md ✓ CLAUDE.md updated with spec reference 💸 $0.0004 · your agent reads this first03 / doom loop detector
Detects when your agent is stuck touching the same files repeatedly. Flags it before you waste another hour going in circles.
output
$ agentbrain doom
analyzing last 10 commits... ⚠ Possible doom loop detected billing.service.ts 6 commits · 60% auth.service.ts 4 commits · 40% → Stop coding. Investigate root cause. 💸 $0.00 · pure git analysis04 / auto refresh
The git hook fires on source file changes, updates context in the background, never blocks your commit. Smart cache means most runs cost $0.00.
output
$ git commit -m "feat: add flag type"
[main d9b26430] feat: add flag type 1 file changed 🧠 AgentBrain: updating context... # 25 seconds later, in the background: ✓ 12:29:56 | Git: d9b26430 | SUCCESS | 25s commit took 0.058s · context updated silently05 / health check
11 checks in parallel. Validates your key, hook, cache, context freshness, and all agent files. Run it when something feels off.
output
$ agentbrain doctor
✓ api_key anthropic detected ✓ git_hook installed · post-commit ✓ cache_valid matches HEAD: d9b2643 ✓ context_freshness 0 hours ago ✓ agent_files CLAUDE.md · .cursorrules · .windsurfrules ✓ hook_log 2 updates · last: success Score: 11/11 checks passed05 / mcp server
Connect the MCP server and your agent pulls context on demand. Required for Claude Desktop. Recommended alongside the CLI for Cursor and Windsurf.
claude_desktop_config.json
{
"mcpServers": {
"agentbrain": {
"command": "npx",
"args": ["-y", "@agentbrain/mcp-server"]
}
}
}tools
cli pathyour anthropic/openai key · ~$0.33 first run · $0.00 cached
mcp pathuses your existing claude/cursor subscription · no api key needed
load_context
Full codebase context at session start
load_standards
Your coding standards mid-session
save_handoff
Session handoff at end of session
load_spec
Load spec file for current task
detect_doom_loop
Check git history for stuck patterns
scan_repo
Repo structure scan. No API key needed.
works with
Claude Code
CLAUDE.md
Cursor
.cursorrules
Windsurf
.windsurfrules