Universal 6D Behavioral IR, Pure SQLite Graph-as-Storage (FTS5 + Recursive CTE + Delta Overlay), Polyglot AST Slicer (Py/TS/Go/Rust/Java/SQL), and Symbol-Anchored Patch Engine for AI Coding Agents
pip install projectbrain-mcp==0.8.3 Copy PIP instructions
Local-First 6D AST Coordinate Matrix, Pure SQLite Graph-as-Storage (.projectbrain.db), Polyglot Context Compiler, and Symbol-Anchored Patch Engine for AI Coding Agents.
Instead of forcing LLMs to search repositories as flat 1D text files (running rg/grep and reading dozens of overlapping read_file windows), ProjectBrain indexes your codebase across Python, TypeScript/JavaScript/React, Go, Rust, Java, and SQL into a 6D AST Coordinate Matrix and a Pure SQLite WAL Property Graph (.projectbrain.db) using pre-compiled tree-sitter C wheels—no external database daemon, no Docker, no cloud vector embeddings, and no API keys required:
pip install projectbrain-mcp (Alternatively, use pipx install projectbrain-mcp or uv tool install projectbrain-mcp.)
Verify both the CLI and MCP server binaries are available:
projectbrain --help projectbrain-mcp --help Step 2: Initialize Your Repository (One Command) Run projectbrain init --hooks inside any repository (or pass --path and optional --ide {all,antigravity,claude,cursor,vscode}):
projectbrain --path /path/to/your/repo init --hooks What projectbrain init --hooks does automatically:
Add projectbrain-mcp to your MCP configuration (pass --lean or set PROJECTBRAIN_LEAN_MCP=1 to expose only the 6 core high-leverage tools and save ~2,900 tokens of tool-schema overhead):
{ "mcpServers": { "projectbrain": { "command": "projectbrain-mcp", "args": ["--lean", "/path/to/your/repo"] } } } Or run directly with uvx:
{ "mcpServers": { "projectbrain": { "command": "uvx", "args": ["projectbrain-mcp", "--lean", "/path/to/your/repo"] } } } (Every MCP tool also accepts an optional repo_path argument per call for multi-repo workspaces.)
projectbrain --path /path/to/repo dossier "recover from a panic in an HTTP handler and abort with 500" projectbrain --path /path/to/repo dossier --zoom "how does JWT signature and exp claim verification work" 2. Surgically Slice Symbols or Line Ranges (slice) projectbrain --path /path/to/repo slice --summary src/App.tsx:ProtectedRoute recovery.go:CustomRecoveryWithWriter 3. Apply AST Symbol-Anchored or Line-Anchored Patches (patch) # AST Symbol-Anchored replacement (immune to line-number drift!) projectbrain --path /path/to/repo patch --apply --spec "@file recovery.go @replace_body Recovery return RecoveryWithWriter(DefaultErrorWriter) @end" # Intra-line substitution projectbrain --path /path/to/repo patch --apply --spec "@file src/App.tsx @sub L84 \`!profileCompleted\` -> \`isHydrated && !profileCompleted\`" 4. Compress Noisy Test / Command Output with 6D Traceback Resolution (run) projectbrain --path /path/to/repo run "pytest -v" # Or pipe arbitrary command output: pytest -v | projectbrain --path /path/to/repo run --stdin 5. View Structural Resolution & Session Telemetry (stats) projectbrain --path /path/to/repo stats --summary Blind Open-Source Repository Evaluation (v0.8.2) Evaluated zero-shot across 4 unseen open-source production repositories spanning Python, TypeScript/JSX, and Go (encode/httpx, pallets/flask, honojs/hono, gin-gonic/gin — 670 files, 6,713 functions, 656 classes/structs, 5,074 6D cells, 12,046 graph nodes, and 35,627 edges) using natural-language prompts with zero function/method identifiers:
Measured head-to-head across an 879-file production open-source repository comparing a Naive Search Agent (rg/grep + read_file) against a ProjectBrain Agent (including full cold-start index() time of 13.47s, 3.34s Tree-sitter AST parse across 879 files, and 1.24s 3-task dossier compilation):
projectbrain/ ├── src/projectbrain/ │ ├── brain.py # 6D Context Compiler, Dossier Engine, Slicer, Explorer & Contract Verifier │ ├── store.py # Pure SQLite WAL Graph-as-Storage (graph_nodes, edges WITHOUT ROWID, FTS5, source_blobs, Delta Overlay) │ ├── slicer.py # 6D Coordinate Matrix extractor, smart focus-window folding & signature skeletons │ ├── patcher.py # Two-Phase AST Symbol-Anchored & Line-Anchored Patch Engine + syntax/contract gates │ ├── parsers.py # Polyglot Tree-sitter CST codecs (Python, JS/TS/JSX/TSX, Go, Rust, Java, SQL) │ ├── graph.py # Multiplex CodeGraph, Dyck-Constrained Sublinear ACL Push (PPR) & Hub Damping │ ├── ledger.py # Page-accurate ROI & Token Savings Ledger (.projectbrain_ledger.json) │ ├── memory.py # Persistent AST-anchored repo memory (.projectbrain_memory.json) │ ├── resolve.py # Cross-file import & TypeScript path alias resolution │ ├── frameworks.py # Next.js, FastAPI, Flask, Express, Hono, Gin, Actix, Axum & Spring route inference │ ├── cli.py # CLI entry point (init --hooks, dossier, patch, slice, stats, compile, explore) │ └── server.py # FastMCP server entry point (standard 22-tool and --lean 6-tool modes) ├── tests/ # 193 unit, integration, security, and benchmark threshold tests └── eval/ # Polyglot scale benchmark, self-dogfooding & zero-identifier adversarial harness Key dates PyPI data Data sourced directly from PyPI's database. Released: Nov 8, 2026 Newer release available (0.8.10) 1 maintainer PyPI data Data sourced directly from PyPI's database. johanabhishek License MIT
ai agents mcp ast tree-sitter context-compression code-graph sqlite fts5 static-analysis llm
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
None of the files in this release were uploaded with provenance metadata.
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.




