Code Brain scans your project via tree-sitter AST parsing, builds a dependency and symbol graph, detects HTTP routes and database schemas, and exposes everything as an MCP server. AI agents orient themselves before reading code — 23–40% fewer tool calls on complex tasks.
Extracts every function, struct, class, method, and import across Rust, TypeScript, JavaScript, Python, Go, and Swift. Call edges, inheritance, and interface conformance are all captured as typed graph edges.
Before you edit a shared utility, codebrain_blast_radius runs a reverse BFS over the import graph to surface every file, route, and model that would be affected. Used correctly, it prevents silent regressions.
After every scan, the two-phase Louvain modularity algorithm partitions the codebase into densely-connected communities. Context queries are automatically annotated with community structure.
Detects routes across Axum, Actix-web, Express, Fastify, Hono, NestJS, Next.js, FastAPI, Flask, Django, Gin, Fiber, and Echo — with method, path, handler file, and framework.
Identifies models from SeaORM, Diesel, Prisma, Drizzle, TypeORM, SQLAlchemy, and GORM with their fields and table names.
In-memory graph cache for the session plus a SHA-256 AST extraction cache on disk. Re-scans only re-parse changed files. Medium projects (~500 files) warm in ~20ms after the first scan.
cargo install codebrain-mcpcargo build --release -p codebrain-mcpRequires Rust 1.75 or later. After install, codebrain-mcp is on your PATH via ~/.cargo/bin/. Add it to your project's .mcp.json to activate it.
Benchmarked head-to-head against raw Grep/Glob/Read on a production Swift codebase (435 files, 2,891 nodes, 1,673 edges). Code Brain reached the same answer quality with 76 tool calls vs 99 for raw exploration on complex cross-file tasks.
The gap is largest on dependency analysis (–40%). codebrain_blast_radius located all 6 affected files across 4 dependency layers in 2 calls; raw grep required 8+ iterations. Simple named lookups still favour Grep — the right tool depends on the task.
Rust, TypeScript, JavaScript, Python, and Go use full tree-sitter AST extraction. Swift uses regex-based extraction due to grammar compatibility constraints — results are good but less exhaustive than the tree-sitter languages.
The graph builds once per session on first tool call. Call codebrain_scan explicitly after significant structural changes — renaming files, extracting modules, adding packages. The SHA-256 cache means only changed files are re-parsed.
No. All analysis is local — no API calls, no network access, no keys required. The binary runs as a subprocess communicating over stdio.
Yes. Add it to ~/.claude/settings.json with an absolute --project path, or omit --project to use whatever directory Claude Code starts in.
Give them an org chart. Code Brain builds the graph once and answers orientation questions in milliseconds — with no context window cost from reading raw files.