repo-brain
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., "@repo-brainWhich files are impacted by changing src/auth/token.py?"
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.
Repo Brain
Persistent repository memory for coding agents.
English · Português do Brasil · 简体中文
Repo Brain is an offline-first skill, CLI, SQLite memory and MCP server that helps a coding agent find the right place to work without rereading an entire repository at the start of every task.
Memory guides discovery. Current source code determines truth.
What the skill does
The repo-brain skill teaches an agent a repeatable, evidence-first workflow:
Check the repository health and run an incremental scan.
Search the memory for the task and rank likely files, symbols, tests and dependencies.
Read the current source through an auditable
readoperation before editing.Check stale analyses, direct dependents and architectural decisions.
Create a persistent plan for a feature, refactor, migration, security change or multi-module bug.
Make the change, run project tests and scan again.
Refresh the analysis using the new source hash and finish the session.
The skill never grants permission to edit from an old summary. When a file hash changes, its analysis becomes stale; direct dependents can become needs_review. An agent must reread the current file before a critical change.
Related MCP server: Cortex Hub
Requirements
Python 3.11 or newer.
SQLite 3 with WAL support (included with Python).
Git is optional. Git repositories share a database between worktrees; non-Git projects store data under
.repo-brain/.No API key, cloud account, external database, model or internet connection is required during normal use.
FTS5 is used when available. A deterministic SQL/ranking fallback keeps search working when FTS5 is unavailable.
Install
From a published package:
python -m pip install repo-brainFrom this repository while developing:
python -m pip install -e ".[dev]"Then install the agent integrations in the project you want to remember:
cd /path/to/your-project
repo-brain install --all
repo-brain initinstall --codex creates .agents/skills/repo-brain/SKILL.md and a managed block in AGENTS.md. install --claude creates the Claude skill and a managed block in CLAUDE.md. Existing user content is preserved. Use --dry-run to preview changes.
First run and database location
repo-brain init creates configuration, applies migrations, inventories files, calculates hashes, extracts static symbols and dependencies, fills the bootstrap queue and generates .repo-brain/INDEX.md.
To see the exact database path:
repo-brain db pathFor a Git repository, the default is <git-common-dir>/repo-brain/brain.db, so worktrees use the same memory. For a non-Git project, it is .repo-brain/brain.db. The database and WAL sidecars should not be committed; .repo-brain/INDEX.md is a compact human dashboard and can be generated whenever needed.
Daily agent workflow
status → scan → context → read current code → plan (if needed)
→ edit → tests → scan → analysis refresh → index/session finishTypical commands:
repo-brain status
repo-brain scan
repo-brain context "change password reset token expiration and email flow"
repo-brain read src/auth/password_reset.py
repo-brain impact src/auth/token.py --depth 3
repo-brain analyze src/auth/password_reset.py --json-file analysis.json
repo-brain scanUse --json on status, context, search, coverage, reads, changes, graph, bootstrap and other commands when an agent or script consumes the result.
What is stored
SQLite stores repository identity, relative paths, normalized paths, file hashes, language/category, line counts, analysis states, symbols, dependency edges, modules, sessions, reads, changes, plans, decisions, observations and tags. Agent analyses are versioned in analysis_history.
Repo Brain does not store full source files by default. Secret-looking files (.env, keys, certificates, credentials and similar patterns) are excluded from semantic analysis. Read and write hooks record paths, hashes, tools, sessions and timestamps—not raw write content.
Core commands
Area | Commands |
Setup |
|
Health |
|
Discovery |
|
Graph |
|
Audit |
|
Agent memory |
|
Bootstrap |
|
Portability |
|
Integrations |
|
Run repo-brain COMMAND --help for the exact arguments.
Bootstrap mode
Large projects can be analyzed cooperatively:
repo-brain bootstrap claim --limit 10
repo-brain read path/to/file.py --purpose bootstrap
repo-brain analyze path/to/file.py --json-file analysis.json
repo-brain bootstrap complete path/to/file.pyClaims have leases, so two agents do not receive the same active item. A failed worker can leave an item to be reclaimed after the lease expires.
Analyses and evidence
An agent can persist a concise factual analysis such as:
{
"summary": "Creates and rotates password-reset tokens.",
"responsibilities": ["validate expiry", "prevent replay"],
"security_notes": ["invalidate the previous token after rotation"],
"risks": ["replay if rotation is not atomic"],
"tags": ["auth", "security"],
"confidence": 0.9
}Important observations should include the file, source hash, line range and confidence. Do not store private model reasoning or secrets.
MCP server
Start the local stdio server:
repo-brain mcp serveIt exposes tools for status, scan, context, search, file reads, symbols, dependencies, impact, sessions, analysis, plans, decisions, bootstrap and index refresh. brain_read_file validates the path, reads a line range, records the read and returns the current hash and analysis state.
Configure an MCP host to run repo-brain with arguments mcp serve. The repository also includes a Claude plugin manifest and .mcp.json template.
Local interface
The dependency-free local dashboard is served by the same application layer:
repo-brain ui --host 127.0.0.1 --port 8765Open http://127.0.0.1:8765. It shows file counts, semantic coverage, fresh/stale state and contextual search results. The server is local-only unless you deliberately bind it to another interface.
Codex and Claude Code
The canonical skill is skills/repo-brain/SKILL.md. The Claude distributable plugin is under integrations/claude-plugin/; it contains a skill, hook configuration, safe hook script and MCP configuration. Hooks are best-effort: a Repo Brain failure must never block the user's edit.
Configuration
repo-brain init creates .repo-brain/config.toml. Configure include/exclude patterns, maximum file size, allowed/ignored extensions, secret patterns, ranking limits and bootstrap lease duration. Keep the database, WAL sidecars and local logs out of version control.
Export and import
repo-brain export
repo-brain import .repo-brain/export/snapshot.jsonlSnapshots contain sanitized metadata, hashes, analyses, relationships and decisions—not full source. Imported facts are tied to their original hashes and must be treated as stale when the current source differs.
Security and privacy
Offline-first and no telemetry.
Canonical path validation prevents traversal and repository-root escapes.
Parameterized SQL prevents query injection.
Secret, binary and oversized files are not loaded for semantic analysis.
WAL, foreign keys, busy timeouts and short transactions support concurrent agents.
Current source always outranks memory.
Read docs/SECURITY_MODEL.md for the threat model.
Demo and development
The acceptance example is in examples/demo-project/. Try:
repo-brain --root examples/demo-project init
repo-brain --root examples/demo-project context "change password reset token expiration and update its email flow"Run the test and build checks:
python -m pip install -e ".[dev]"
python -m pytest
python -m ruff check src tests
python -m buildMore detail is available in docs/ARCHITECTURE.md, docs/DATABASE.md, docs/MCP.md, docs/CODEX.md, docs/CLAUDE.md and docs/TROUBLESHOOTING.md.
License
Apache License 2.0. See LICENSE.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityBmaintenanceEnables AI coding agents to maintain persistent, cross-session memory of codebase architecture, naming conventions, and decisions through MCP tools. Eliminates repetitive project re-explanation by automatically injecting stored context into every session with local-first SQLite storage and optional team sharing capabilities.4MIT
- Alicense-qualityAmaintenanceSelf-hosted AI Agent Memory + Code Intelligence Platform providing persistent memory, AST-aware code search, and quality enforcement via a single MCP endpoint.58MIT
- Alicense-qualityAmaintenanceLocal-first repository memory for AI coding agents that indexes codebases into SQLite and exposes it through MCP tools, with a browser dashboard for architecture inspection.13MIT
- Alicense-qualityDmaintenancePersistent memory for AI coding agents. Builds semantic memory from git history and codebase, searchable via MCP tools.62MIT
Related MCP Connectors
User-owned memory for AI agents, Copilot, Claude, IDEs, CLIs, and chat apps over remote MCP.
Persistent memory and knowledge management for AI agents with semantic search and 50+ tools.
Universal memory for AI agents and tools. Save, organize and search context anywhere.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/lucianum7/repo-brain'
If you have feedback or need assistance with the MCP directory API, please join our Discord server