Skip to content

/review - Multi-LLM Consensus Code Review

Performs comprehensive code review using Orchestre's multi-LLM review MCP tool to provide consensus-based feedback from multiple AI perspectives.

How It Actually Works

  1. Parse Arguments: Identifies files to review from input
  2. File Discovery:
    • No args: Uses git diff --name-only HEAD~5..HEAD
    • Patterns: Finds matching files with glob
    • Specific files: Verifies they exist
  3. Read Contents: Reads up to 10 files (skips >10KB files)
  4. Call MCP Tool: Invokes mcp__orchestre__multi_llm_review with file array
  5. Process Results: Organizes findings by priority level
  6. Present Feedback: Shows actionable review summary

Argument Structure

/review <files|pattern|git-ref>

Arguments

  • Empty or "." - Review recently changed files
  • File paths - Review specific files (e.g., src/index.js src/utils.js)
  • Patterns - Review matching files (e.g., *.ts, src/**/*.js)
  • Git references - Review changes (e.g., HEAD~1, main...feature)

Multi-LLM Tool Details

The mcp__orchestre__multi_llm_review tool:

  • Sends code to multiple LLMs for analysis
  • Builds consensus from different perspectives
  • Returns structured feedback including:
    • Security vulnerabilities
    • Performance issues
    • Code quality assessment
    • Improvement suggestions
    • Best practice violations

Example Usage

Review Recent Changes

bash
/orchestre:review (MCP)
# Then just press enter or type "."

Review Specific Files

bash
/orchestre:review (MCP)
# Then: src/auth.js src/user.js

Review by Pattern

bash
/orchestre:review (MCP)
# Then: src/**/*.ts

Review PR Changes

bash
/orchestre:review (MCP)
# Then: main...HEAD

Output Format

The review provides:

Code Review Summary
==================
Files reviewed: 3

🔴 Critical Issues (2):
- [src/auth.js:45] SQL injection vulnerability in login query
  Fix: Use parameterized queries
  
- [src/api.js:23] API key exposed in client code
  Fix: Move to environment variables

🟡 Important Issues (3):
- [src/user.js:67] Missing error handling for database calls
  Suggestion: Add try-catch blocks
  
🟢 Suggestions (5):
- [src/utils.js:12] Function could be simplified
  Consider using array methods

Good Practices Observed:
- Consistent error messages
- Clear function naming
- Good test coverage

Next Steps:
1. Fix SQL injection vulnerability immediately
2. Remove API key from client code
3. Add error handling to database operations

Focus Areas

You can specify areas to focus on:

  • Security: Authentication, authorization, data validation
  • Performance: Database queries, algorithms, caching
  • Maintainability: Code structure, naming, documentation
  • Best Practices: Error handling, testing, patterns

Requirements

The multi_llm_review tool requires:

  • GEMINI_API_KEY and/or OPENAI_API_KEY environment variables
  • At least one AI provider configured
  • Valid file content (not binary files)

Technical Details

Review Output Organization

The prompt organizes findings by priority:

Priority Levels:

  • 🔴 Critical: Security vulnerabilities, data loss risks, breaking bugs
  • 🟡 Important: Performance issues, error handling, maintainability
  • 🟢 Suggestions: Style improvements, refactoring opportunities

MCP Tool Call Structure

The prompt calls mcp__orchestre__multi_llm_review with:

json
{
  "files": [
    {
      "path": "src/auth.js",
      "content": "// Full file content..."
    },
    {
      "path": "src/utils.js", 
      "content": "// Full file content..."
    }
  ],
  "context": "Brief description of what's being reviewed"
}

File Discovery Methods

  1. Recent changes (no args):

    bash
    git diff --name-only HEAD~5..HEAD | head -20
  2. Pattern matching:

    bash
    ls -la src/**/*.ts 2>/dev/null | head -20
  3. Specific files:

    bash
    test -f "file.js" && echo "Found: file.js"

Integration

This prompt integrates with:

  • /orchestre:execute-task (MCP): Review before implementing
  • /orchestre:security-audit (MCP): Deeper security analysis
  • /orchestre:document-feature (MCP): Document review findings

Common Patterns

Pre-commit Review

bash
# Review staged changes
git diff --cached --name-only | xargs /orchestre:review (MCP)

Feature Branch Review

bash
# Review all changes in feature branch
/orchestre:review (MCP) main...feature-branch

Directory Review

bash
# Review entire module
/orchestre:review (MCP) src/auth/**/*

Notes

  • Reviews are limited to 10 files for performance
  • Large files (>10KB) are skipped
  • Binary files are automatically excluded
  • Consensus building provides balanced feedback
  • All findings are actionable with specific fixes

Built with ❤️ for the AI Coding community, by Praney Behl