Multi-agent code review system that orchestrates multiple LLMs to produce comprehensive, high-quality code reviews.
AI Code Reviewer takes a different approach to automated code review: instead of relying on a single AI model, it orchestrates multiple specialized agents that review code from different perspectives (security, performance, architecture, etc.) and combines their findings into a unified, confidence-scored review.
- π Multi-Agent Architecture: Run 2-5+ LLM agents in parallel, each with specialized focus
- π― Consensus-Based Scoring: Findings are weighted by how many agents agree
- π Single API Key: All models (Claude, GPT-4, etc.) accessed via Cursor API
- π GitHub Integration: Automatic PR reviews via webhooks
- π Actionable Output: Prioritized findings with suggested fixes
# Install
pip install ai-code-reviewer
# Configure - Only 2 API keys needed!
# Cursor API provides unified access to Claude, GPT-4, and other models
export CURSOR_API_KEY=cur_...
export GITHUB_TOKEN=ghp_...
# Review a GitHub PR
ai-reviewer review-pr calimero-network/core 123
# Review a local diff
git diff main | ai-reviewer review --output markdownAll LLM agents access Claude, GPT-4, and other models through Cursor's unified API:
- β Single API key for all models
- β Consistent interface across different LLMs
- β Codebase context for pattern-aware reviews
PR Diff
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Cursor API (Unified LLM Gateway) β
β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β β Claude β β GPT-4 β β Claude β β
β β (Security) β β(Performance)β β (Patterns) β β
β ββββββββ¬βββββββ ββββββββ¬βββββββ ββββββββ¬βββββββ β
β β β β β
β βββββββββββββββββββΌββββββββββββββββββ β
β βΌ β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Review Aggregator β β
β β β’ Cluster similar findings β β
β β β’ Compute consensus scores β β
β β β’ Rank by severity Γ agreement β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
ββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββ
β
βΌ
Consolidated Review (GitHub / JSON / MD)
Create config.yaml:
# Single Cursor API key for all LLM models
cursor:
api_key: ${CURSOR_API_KEY}
# GitHub integration
github:
token: ${GITHUB_TOKEN} # or PAT for thread resolution (see below)
# Agents - different models, same Cursor API
agents:
- name: security-reviewer
model: claude-4.5-opus-high-thinking
focus_areas: [security, architecture]
- name: performance-reviewer
model: gpt-5.2
focus_areas: [performance, logic]
- name: patterns-reviewer
model: claude-4.5-opus-high-thinking
focus_areas: [consistency, patterns]
include_codebase_context: true
orchestrator:
timeout_seconds: 120
min_agents_required: 2# Review Commands
ai-reviewer review-pr <owner/repo> <pr-number> # Review GitHub PR
ai-reviewer review --diff <file> # Review local diff
ai-reviewer review --commit <sha> # Review specific commit
# Server Commands
ai-reviewer serve --port 8080 # Start webhook server
# Configuration
ai-reviewer config validate # Check configuration
ai-reviewer config show # Show active config
# Agents
ai-reviewer agents list # List available agents
ai-reviewer agents test <type> # Test single agent## π€ AI Code Review
**Reviewed by 3 agents** | Consensus score: 87%
### π΄ Critical (1)
**SQL Injection** in `auth/login.py:45` | 3/3 agents β
> User input interpolated into SQL query
### π‘ Warning (2)
**Missing rate limiting** | 2/3 agents
**Inefficient O(nΒ²) loop** | 2/3 agents
### π‘ Suggestions (3)
- Add type hints to `process_user()`
- Extract magic number to constant
- Add docstring to `AuthHandler`Add .ai-reviewer.yaml to your repo for custom settings:
# Ignore generated files
ignore:
- "**/*.generated.rs"
- "**/vendor/**"
# Custom instructions for agents
agents:
- name: security-reviewer
custom_prompt_append: |
This is a Rust codebase using eyre for errors.
Flag all unwrap() calls.
# Review policy
policy:
require_human_review_for: [security]
block_on_critical: trueThe default GITHUB_TOKEN provided by GitHub Actions works for most features:
- β Posting reviews and comments
- β Adding reactions
- β Posting "Resolved" replies
- β Resolving review threads (requires PAT)
To enable automatic thread resolution when issues are fixed, use a Classic PAT (not Fine-grained):
β οΈ Important: Fine-grained PATs do NOT support theresolveReviewThreadGraphQL mutation. You must use a Classic PAT withreposcope.
-
Create a Classic Personal Access Token with:
- Note:
ai-code-reviewer - Expiration: 90 days (or custom)
- Scopes: β
repo(Full control of private repositories)
- Note:
-
Add the PAT as a repository secret named
GH_PAT:Settings β Secrets and variables β Actions β New repository secret Name: GH_PAT Value: ghp_xxxxxxxxxxxxxxxxxxxx -
The workflow automatically uses
GH_PATif available (falls back toGITHUB_TOKEN).
Why Classic PAT? GitHub's GraphQL
resolveReviewThreadmutation requires:
- User-level authentication (not app/integration tokens)
- Classic PAT with
reposcope (Fine-grained PATs return "Resource not accessible")Without a Classic PAT, the reviewer will still post "β Resolved" replies, but threads won't collapse automatically in the GitHub UI.
# Clone
git clone https://github.com/calimero-network/ai-code-reviewer
cd ai-code-reviewer
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Run linters
ruff check .
mypy src/This repository is designed to be AI-friendly with structured documentation that helps AI agents understand and work with the codebase.
.ai/ # AI context, rules & automation
βββ context.md # Fast codebase overview (read first!)
βββ doc-bot.md # Documentation bot instructions
βββ prompts/ # Reusable AI prompts
βββ rules/ # Detailed rules per module
βββ architecture.md # High-level design & invariants
βββ agents.md # Agent module patterns
βββ orchestrator.md # Orchestration rules
βββ github.md # GitHub integration patterns
βββ models.md # Data model conventions
βββ conventions.md # Coding style guide
- Read
.ai/context.mdfor a fast overview - Check
.ai/rules/<module>.mdfor the specific module you're working on - Follow patterns in
.ai/rules/conventions.md
PRs that change source code automatically trigger a documentation bot that:
- Analyzes which docs might need updates
- Posts suggestions as PR comments
- Helps keep documentation in sync with code
Configure via .ai-reviewer.yaml in the repo root.
- ai-bounty-hunter - Automatic bounty fixing
- pr-agent - Single-agent PR reviews
- SWE-agent - GitHub issue automation
MIT License - see LICENSE for details.
Built with β€οΈ by Calimero Network