repobrain
study8677 · study8677/repobrain
This plugin gives AI agents "brain" access to your code repository, enabling grounded Q&A about the codebase with file paths and line numbers.
🧠 RepoBrain (formerly Antigravity) — Give your repo a brain. ChatGPT for your codebase: works in Claude Code, Cursor, Codex, Windsurf & more.
Preview
What you can do with it
- Ask your AI agent how a specific feature or function works within your project.
- Get detailed explanations of complex parts of the codebase, citing exact locations.
- Understand the overall architecture or data flow of an unfamiliar project.
Safety check
No risky patterns found in the files we scanned.
Automated scan of the repo files. Always review code you run.
From the README
RepoBrain
Give your repo a brain 🧠 — ChatGPT for your codebase, works in Claude Code, Cursor, Codex, Windsurf & 4 more.
Formerly known as Antigravity Workspace Template — same project, new name.
🚀 实测推荐: TeamoRouter —— 非广告,我自己在 Codex、Claude Code 等 AI 编程工具里高强度使用:一个 API Key 接入 Claude、GPT-5.5 等,模型价格方便调整,价格优惠,并没有掺水的情况。接入指南见 openrouter-api-key。
# 1 — Install (Claude Code plugin marketplace)
/plugin marketplace add study8677/repobrain
/plugin install repobrain@repobrain
# 2 — Configure a backend (logged-in local CLI = no key, or paste an API key), build the knowledge base
/repobrain:rb-setup
/repobrain:rb-refresh
# 3 — Ask anything, grounded in real code with file paths + line numbers
/repobrain:rb-ask "How does auth work?"
95.83% weighted semantic accuracy · 4.04× faster scored queries than CodeGraph + Trae on the main track. Benchmark results ↓ Codex CLI users — drop the
repobrain:prefix; the same four slash commands ship there too.
🧠 Fastest start — let your AI install it for you (no API key)
Already in a logged-in AI IDE (Trae / Cursor / Claude Code / Codex)? Don't touch pip or an API key — paste this one line to your AI assistant and it does the rest (detects your logged-in CLI, wires up a zero-key backend, initializes the project, self-tests):
Read https://github.com/study8677/repobrain/blob/main/AI_INSTALL.md and follow it to install RepoBrain in this project.
Then just ask your AI anything about your codebase.
Why RepoBrain?
Cross-IDE repository knowledge engine for grounded codebase Q&A. Same .repobrain/ knowledge layer reads in every IDE; one engine, every host.
An AI Agent's capability ceiling = the quality of context it can read.
rb-refresh deploys a multi-agent cluster that autonomously reads your code — each module gets its own Agent that generates a knowledge doc. rb-ask routes questions to the right Agent, grounded in real code with file paths and line numbers.
Instead of handing Claude Code / Codex a repo-wide grep and making it hunt on its own, give it a ChatGPT for your repository.
Traditional approach: RepoBrain approach:
CLAUDE.md = 5000 lines of docs Claude Code calls ask_project("how does auth work?")
Agent reads it all, forgets most Router → ModuleAgent reads actual source, returns exact answer
Hallucination rate stays high Grounded in real code, file paths, and git history
Four concrete failure modes RepoBrain fixes — click to expand
| Problem | Without RepoBrain | With RepoBrain |
|---|---|---|
| Agent forgets coding style | Repeats the same corrections | Reads .repobrain/conventions.md — gets it right the first time |
| Onboarding a new codebase | Agent guesses at architecture | rb-refresh → ModuleAgents self-learn each module |
| Switching between IDEs | Different rules everywhere | One .repobrain/ folder — every IDE reads it |
| Asking "how does X work?" | Agent reads random files | ask_project MCP → Router routes to the responsible ModuleAgent |
Architecture is files + a live Q&A engine, not plugins. Portable across any IDE, any LLM, zero vendor lock-in.
RepoBrain vs CodeGraph + Trae (2026-09-09)
Flask, ripgrep, Vite, Prometheus · 20 questions × 3 repeats per product · same source access and model route (Seed-2.1-Turbo → seed-code-pro).
| Main-track metric | RepoBrain | CodeGraph + Trae |
|---|---|---|
| Weighted semantic accuracy | 95.83% | 84.17% |
| Successful queries | 60/60 | 53/60 |
| Scored query time | 5,106.67 s | 20,621.14 s |
| Query tokens | 22,326,315 | 86,027,974 |
| Cold build time | 7,420.63 s | 9.58 s |
| Cold build + scored queries | 12,527.30 s | 20,630.72 s |
Failures count as incorrect. Cold builds compare full AI knowledge generation with static code-graph indexing, not equivalent workloads. Results apply to this locked experiment only.
Quick Start
Plugin install for Claude Code / Codex CLI (recommended — the rb CLI and engine auto-install together on Claude's first session):
# Claude Code
/plugin marketplace add study8677/repobrain
/plugin install repobrain@repobrain
/repobrain:rb-setup # interactive: use a logged-in local CLI (Codex/Trae/Claude, no key) or paste an API key; writes .env
/repobrain:rb-refresh # first refresh auto-creates .repobrain/
/repobrain:rb-ask "How does this project work?"
# Codex CLI (manual engine install — Codex hooks are not yet supported)
pipx install "git+https://github.com/study8677/repobrain.git#subdirectory=engine"
pipx inject --force --include-apps repobrain-engine "git+https://github.com/study8677/repobrain.git#subdirectory=cli"
codex plugin marketplace add study8677/repobrain
/rb-setup
/rb-refresh
/rb-ask "How does this project work?"
Codex auto-discovers slash commands from the plugin's commands/ directory, so the same four commands work without the repobrain: namespace prefix. The raw CLI calls (rb-refresh --workspace ., rb-ask "..." --workspace .) also still work. If your Codex build supports MCP, register rb-mcp --workspace separately.
Option B — Manual install: engine + CLI via pip
# 1. Install engine + CLI
pip install "git+https://github.com/study8677/repobrain.git#subdirectory=cli"
pip install "git+https://github.com/study8677/repobrain.git#subdirectory=engine"
# 2. Configure .env with any OpenAI-compatible API key
cd my-project
cat > .env <<EOF
OPENAI_BASE_URL=https://your-endpoint/v1
OPENAI_API_KEY=your-key
OPENAI_MODEL=your-model
RB_ASK_TIMEOUT_SECONDS=120
EOF
# 3. Build knowledge base (ModuleAgents self-learn each module)
rb-refresh --workspace .
# 4. Ask anything
rb-as