Skip to content

NxtGenLegend/CodeReviewCouncil

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Code Review Council - Powered by Claude Haiku 3.5

A multi-agent code review system using Claude Haiku 3.5 with 6 specialized agents.

What You Need

  1. Python 3.7 or higher
  2. Anthropic API Key - Get one at https://console.anthropic.com/api-keys

Quick Setup

Step 1: Install Dependencies

pip install anthropic

Step 2: Set Up Your API Key

python setup.py

When prompted:

  • Enter your Anthropic API key (starts with "sk-ant-api03-...")
  • Choose option 1 (environment variable) or 2 (.env file)

Step 3: Run the Code Review

python main.py

When prompted:

  • Enter the path to the code file you want to review (e.g., example.py)
  • Wait for all 6 agents to analyze your code
  • Choose whether to save results to text file

What Each Agent Does

  1. Syntax & Logic Agent - Finds bugs, logic errors, and correctness issues
  2. Security Agent - Finds vulnerabilities and security issues
  3. Performance Agent - Identifies bottlenecks and optimization opportunities
  4. Architecture Agent - Reviews design patterns and code structure
  5. Testing Agent - Suggests test cases and identifies testing gaps
  6. Documentation Agent - Reviews and improves code documentation

Try the Demo (No API Key Needed!)

python DemoMode.py

This shows how the system works without using your API credits.

Review Multiple Files

python BatchReview.py /path/to/your/project

File Structure

β”œβ”€β”€ main.py              # Main entry point
β”œβ”€β”€ BaseAgent.py         # Base class for all agents
β”œβ”€β”€ SyntaxLogicAgent.py  # Syntax and logic error detection
β”œβ”€β”€ SecurityAgent.py     # Security analysis
β”œβ”€β”€ PerformanceAgent.py  # Performance analysis
β”œβ”€β”€ ArchitectureAgent.py # Architecture review
β”œβ”€β”€ TestingAgent.py      # Testing recommendations
β”œβ”€β”€ DocumentationAgent.py # Documentation review
β”œβ”€β”€ CodeReviewCouncil.py # Orchestrates all agents
β”œβ”€β”€ BatchReview.py       # Review multiple files
β”œβ”€β”€ DemoMode.py          # Demo without API
β”œβ”€β”€ setup.py             # API key setup
β”œβ”€β”€ config.json          # Configuration
β”œβ”€β”€ example.py           # Example code to test
└── README.md            # This file

Configuration

Edit config.json to:

  • Change the Claude model (default: claude-3-5-haiku-20241022)
  • Enable/disable specific agents
  • Adjust temperature and max tokens

Example Usage

$ python main.py
Enter the path to the code file to review: example.py

πŸ“‚ Reading example.py...
πŸ“ File size: 37 lines

πŸ” Starting code review for: example.py
============================================================
[β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ] Review complete! (6/6)
============================================================

============================================================
πŸ“Š REVIEW SUMMARY
============================================================

πŸ“ˆ Total Issues Found: 17

πŸ” Issues by Type:
   πŸ› Syntax & Logic: 3 issues
   πŸ”’ Security: 3 issues
   ⚑ Performance: 2 issues
   πŸ—οΈ Architecture: 3 issues
   πŸ§ͺ Testing: 3 issues
   πŸ“ Documentation: 3 issues

⚠️  Severity Breakdown:
   β€’ Critical: 5 πŸ”΄
   β€’ Warnings: 8 🟑
   β€’ Suggestions: 4 🟒

πŸ’‘ Key Findings:
   β€’ Syntax & Logic Agent: List Modification During Iteration (Lines 9-12)
   β€’ Security Agent: SQL Injection (Line 2)
   β€’ Performance Agent: O(nΒ²) Algorithm (Lines 9-12)
   β€’ Architecture Agent: Tight Coupling - Data access mixed with business logic
   β€’ Testing Agent: SQL Injection Testing (Line 2) - Security-critical code untested
   β€’ Documentation Agent: Missing Function Docstrings

============================================================
βœ… Review complete! Check the detailed report for full analysis.
============================================================

πŸ’Ύ Save Options:
Save detailed report as .txt? (y/n): y

πŸ“ Detailed report saved to: example_review_20241120_143022.txt

✨ Success! Review saved to: example_review_20241120_143022.txt
   Contains:
   β€’ Summary of issues found
   β€’ Detailed findings by agent
   β€’ Line-specific references
   β€’ Recommended fixes

Also save raw data as JSON? (y/n): n

πŸŽ‰ Done! Thanks for using Code Review Council.

Output Files

The system generates two types of output:

  1. Text Report (Recommended)

    • Human-readable format
    • Includes line numbers and code references
    • Detailed analysis from each agent
    • Code examples and fixes
    • Example: example_review_20241120_143022.txt
  2. JSON File (Optional)

    • Raw data for integration with other tools
    • Machine-readable format
    • Example: ReviewResults.json

Cost

Claude Haiku 3.5 is very affordable:

  • ~$0.25 per million input tokens
  • ~$1.25 per million output tokens
  • A typical code review costs less than $0.01

Troubleshooting

"API key not found" error

  • Make sure you ran python setup.py and entered your key
  • On Windows, restart your terminal after setup

"No module named 'anthropic'" error

  • Run: pip install anthropic

"File not found" error

  • Make sure the file path is correct
  • Try using the full path to your code file

About

An agentic code review system with 6 specialized agents.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages