A GitHub App that uses a multi-agent architecture to review Pull Requests with cross-file reasoning and codebase memory.
Unlike other AI reviewers that only see the diff, this bot understands your entire codebase:
- Indexes your repo on installation
- Finds related code across files you didn't change
- Learns patterns from your codebase
- Self-hosted = your code never leaves your infrastructure
- π« Block Bad PRs: High-risk PRs get a failing status check (can't merge!)
- π§ Auto-Fix Suggestions: AI generates code fixes for issues found
- π Multi-Language: Python, JavaScript/TypeScript, Java, C/C++, Go, Rust
- π§ RAG Context: Indexes your codebase for smarter reviews
- π Map-Reduce: Handles large PRs by summarizing files individually
- π³ Tree-sitter: Parses code structure (functions, classes, imports)
- π Cross-File Impact: Identifies files affected by your changes
- π Multi-Key Manager: Rotates Gemini API keys with rate-limit handling
β οΈ Risk Scoring: Assigns risk based on size, tests, and impact
-
Install Dependencies:
pip install -r requirements.txt
-
Configure Environment: Copy
.env.exampleto.envand fill in:APP_ID: Your GitHub App IDPRIVATE_KEY_PATH: Path to your GitHub App private keyWEBHOOK_SECRET: Your webhook secretGEMINI_API_KEYS: Comma-separated list of Gemini API keys
-
Run the Server:
uvicorn app.main:app --reload
- Receives
installationwebhook - Indexes entire repository in background
- Stores embeddings in local vector store
- Status: Pending β Shows "AI review in progress"
- Diff Analysis β Fetch changed files
- Tree-sitter β Parse code structure (7 languages)
- Map β Summarize each file
- RAG β Find related code in codebase
- Risk β Calculate risk score (0-100)
- Reduce β Generate final review
- Auto-Fix β Generate code suggestions if issues found
- Status: Pass/Fail β Block merge if risk β₯ 70
app/
βββ main.py # FastAPI + webhooks
βββ core/
β βββ config.py # Settings
β βββ security.py # GitHub App JWT auth
β βββ llm.py # Gemini client
β βββ key_manager.py # Multi-key rotation
β βββ embeddings.py # Gemini embeddings
β βββ vector_store.py # ChromaDB wrapper
β βββ indexer.py # Codebase indexer
β βββ code_parser.py # Tree-sitter parser
βββ agents/
βββ master.py # Orchestrator
βββ diff.py # PR diff analysis
βββ dependency.py # Cross-file dependencies
βββ file_summary.py # File summarizer (MAP)
βββ context.py # RAG context retrieval
βββ test.py # Test impact
βββ risk.py # Risk scoring
βββ writer.py # Review composer (REDUCE)
| Endpoint | Description |
|---|---|
POST /webhook |
GitHub webhook handler |
GET / |
Health check |
GET /stats/{owner}/{repo} |
Index statistics |
| Variable | Description |
|---|---|
APP_ID |
GitHub App ID |
PRIVATE_KEY_PATH |
Path to private key file |
WEBHOOK_SECRET |
Webhook signature secret |
GEMINI_API_KEYS |
Comma-separated API keys |
MIT