ProjectBrain
Provides tools for reviewing Git diffs (staged, branch, last-commit) and analyzing the impact of changes on the project, including changed file detection and impact analysis.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ProjectBrainGenerate a context pack for checkout refactoring"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ProjectBrain
ProjectBrain is a local project cognition layer for AI coding agents.
It turns code-structure facts and human project experience into task-scoped artifacts that an AI agent can use before changing code:
Context Pack: the files, symbols, flows, risks, and human notes relevant to a task.
Impact Analysis: the files, symbols, callers, dependencies, tests, and review risks likely affected by a change.
Git Diff Impact: a local review of staged, branch, or last-commit changes based on changed file names from Git.
ProjectBrain is not a code search UI, a generic RAG chatbot, or an automatic code modifier. The first public version is a small local prototype that is useful for experimenting with project memory and impact analysis workflows.
Status
Prototype / local MVP.
Current capabilities:
CodeGraph SQLite adapter.
ProjectBrain JSON schema models and validation.
Context Pack builder.
Impact Analysis builder.
Git diff Impact Analysis from local Git changed files.
Agent-friendly compact output for Context Pack and Impact Analysis.
Local experience claim authoring.
JSON-file local runtime.
Local-only stdio MCP server.
Optional FastAPI API skeleton.
Synthetic public demo under
examples/payment-mini/.
Related MCP server: codeweave-mcp
Quickstart
Install locally:
python3 -m venv .venv
.venv/bin/python -m pip install -e .
.venv/bin/projectbrain doctorRun the tests:
python3 -m unittest discover -s testsGenerate a Context Pack from the synthetic public demo:
.venv/bin/projectbrain facts context \
--export-json examples/payment-mini/projectbrain-codegraph-export.json \
--experience-seed examples/payment-mini/experience-seed.md \
--task "Explain the settlement entrypoint"Generate an Impact Analysis:
.venv/bin/projectbrain facts impact \
--export-json examples/payment-mini/projectbrain-codegraph-export.json \
--experience-seed examples/payment-mini/experience-seed.md \
--task "Change the settlement contract" \
--changed-file contract/src/main/java/example/payment/settlement/SettlementService.javaSee Quickstart for a fuller walkthrough. A Chinese walkthrough is available at 中文快速上手.
Use With Your Own Repository
ProjectBrain currently expects CodeGraph facts at:
<your-project>/.codegraph/codegraph.dbImport a local project into the JSON runtime:
.venv/bin/projectbrain import /path/to/my/project \
--id my_project \
--name "My Project" \
--path-prefix src/ \
--kind class \
--kind interface \
--kind methodThen generate artifacts from the stored facts:
.venv/bin/projectbrain context my_project "Explain the checkout flow"
.venv/bin/projectbrain impact my_project "Change checkout validation" \
--changed-file src/checkout/CheckoutService.java
.venv/bin/projectbrain impact-diff my_project "Review staged checkout changes" --staged
.venv/bin/projectbrain impact-diff my_project "Review branch impact" --from main --to HEADUse compact output when an AI coding agent needs the next actions without the full artifact:
.venv/bin/projectbrain context my_project "Explain the checkout flow" --format agent
.venv/bin/projectbrain impact-diff my_project "Review staged checkout changes" --staged --format agentAdd local project experience so future context and impact results include human constraints:
.venv/bin/projectbrain claim add my_project \
--id exp_checkout_validation \
--applies-to checkout \
--risk high \
--review-state approved \
--claim-type HUMAN_CONFIRMED \
--statement "Checkout validation changes require compatibility review."Review and archive local claims without deleting their history:
.venv/bin/projectbrain claim list my_project
.venv/bin/projectbrain claim review my_project exp_checkout_validation \
--review-state needs_review \
--risk medium
.venv/bin/projectbrain claim archive my_project exp_checkout_validation \
--reason "Superseded by newer checkout guidance."Runtime artifacts are written under .projectbrain/, which is ignored by Git.
Optional FastAPI Server
python3 -m venv .venv
.venv/bin/python -m pip install -e '.[api]'
PYTHONPATH=apps/api:packages/adapters:packages/runtime:packages/schema \
.venv/bin/uvicorn projectbrain_api.main:app --reloadRoutes:
GET /health
POST /api/v1/projects/import
GET /api/v1/projects
POST /api/v1/projects/{project_id}/context-pack
POST /api/v1/projects/{project_id}/impact-analysisLocal MCP Server
ProjectBrain can run as a local stdio MCP server for AI coding agents:
.venv/bin/projectbrain --store-root /absolute/path/to/.projectbrain mcp serveIt is a local child process. It does not open network sockets or upload source code. See Local MCP Usage.
MCP tools include project import, project listing, experience claim authoring, Context Packs, Impact Analysis, and Git diff review through projectbrain_review_git_diff. The read tools accept output_format: "agent" for compact agent-oriented results.
Privacy note: ProjectBrain controls the tool side, not the AI client side. MCP results may contain file paths, symbol names, and inferred risk notes. Whether those results are sent to a model provider depends on your AI client and model settings. For strict private-code environments, use a local model or an approved enterprise endpoint.
For additional local output controls, add .projectbrain-policy.json or .projectbrain-policy.yml to the imported project root:
{
"deny_paths": ["private/**", "src/main/resources/config/**"],
"output_limits": {
"max_items_per_section": 8,
"max_recommended_files": 8,
"max_recommended_tests": 5
},
"include_source_snippets": false
}Context Pack, Impact Analysis, Git diff review, API, and MCP read outputs apply the policy. Source snippets remain disabled by default.
Inspect the policy that an imported project is using:
.venv/bin/projectbrain policy inspect my_projectRepository Layout
apps/
tools/ CLI tools
api/projectbrain_api/ optional FastAPI API
packages/
adapters/ CodeGraph adapter and artifact builders
runtime/ local JSON runtime and repository abstraction
schema/ dataclass schemas and validation
examples/payment-mini/ synthetic public demo data
tests/ unit and API tests
docs/ design and implementation notesPublic Data Boundary
This repository intentionally does not include real project source code, real CodeGraph databases, private configs, or production runtime stores.
The public demo is synthetic. If you use ProjectBrain on a private repository, keep these paths out of Git:
docs/payment/.projectbrain/.codegraph/generated from private codeprivate experience seeds
private exported facts
Design Docs
Document | Purpose |
Product positioning, architecture, components, APIs, and roadmap. | |
Project cognition domain model and bounded contexts. | |
Knowledge graph, source refs, claims, confidence, and lifecycle. | |
Local MVP architecture, service boundaries, storage, and acceptance criteria. | |
Engineering phases, tests, operations, and open-source setup. | |
Agent-facing skills for project understanding and impact analysis. | |
REST and MCP contract draft. | |
CodeGraph as the first code-fact provider. | |
CLI/runtime/API usage for the current local prototype. | |
Local-only stdio MCP server usage and privacy boundary. | |
Release gate checks for tests, CLI/MCP smoke, policy, and privacy boundary. | |
Chinese quickstart for local install, demo, MCP, claims, and privacy policy. | |
Remaining gaps between design and implementation. | |
How to evaluate context quality, impact quality, and agent outcomes. |
Roadmap
Add typed API request/response models.
Add OpenAPI snapshot tests.
Add richer Git diff symbol matching.
Add richer agent output controls.
Add project experience review and stale-claim workflow.
Add database-backed repository implementation.
Add more language adapters and richer source-fact extraction.
License
MIT
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/yinshaojun001/projectbrain'
If you have feedback or need assistance with the MCP directory API, please join our Discord server