An autonomous AI agent that clones a GitHub repository, parses source files using AST, and generates structured, confidence-rated code review comments — all through a sleek Streamlit dashboard.
CodeSight is a fully agentic AI pipeline for automated code review. Paste any public GitHub URL and the agent:
- Clones the repository locally using GitPython
- Parses every Python file using Python's
astmodule — extracting functions, async functions, and classes as semantic chunks - Reviews all chunks in parallel via the Groq LLM API (
llama-3.3-70b-versatile) - Generates structured JSON review comments with:
- severity ratings
- confidence scores
- actionable suggestions
- Creates a repository-level health summary:
- health score (0–100)
- issue breakdown
- recurring patterns
- critical findings
- recommended next steps
- Displays everything in an interactive Streamlit dashboard with filters and JSON export
Every issue includes a confidence score (0–100%).
Low-confidence findings are automatically separated under a “Verify This” label — demonstrating responsible AI behavior instead of presenting all findings with equal certainty.
https://codesight-ai-code-review-agent.streamlit.app
| Layer | Technology |
|---|---|
| Frontend | Streamlit |
| Backend | Python |
| Repository Cloning | GitPython |
| Parsing Engine | Python AST |
| LLM Provider | Groq |
| Model | llama-3.3-70b-versatile |
| Concurrency | ThreadPoolExecutor |
| Environment Variables | python-dotenv |
| Deployment | Streamlit Cloud |
- Python 3.10+
- Git installed
- Groq API key
Get your API key here:
git clone https://github.com/adityajhinjha/ai-code-review-agent.git
cd ai-code-review-agentpython -m venv venv
venv\Scripts\activatepython -m venv venv
source venv/bin/activatepip install -r requirements.txtCreate a .env file in the project root:
GROQ_API_KEY=your_groq_api_key_herestreamlit run app.pyOpen:
http://localhost:8501
Paste a GitHub repository URL and click:
Analyze →
┌──────────────────────────────────────────────────────────────┐
│ app.py (Streamlit UI) │
│ URL Input → Analyze Button → Filters → JSON Export │
└─────────────────────────────┬────────────────────────────────┘
│
▼
┌──────────────────────────────────────────────────────────────┐
│ pipeline.py (Orchestrator) │
│ Coordinates ingestion → parsing → review pipeline │
└──────────────┬───────────────────────┬───────────────────────┘
│ │
▼ ▼
┌──────────────────────┐ ┌───────────────────────────────┐
│ ingestion.py │ │ parser.py │
│──────────────────────│ │───────────────────────────────│
│ • Validate URL │ │ • ast.parse() │
│ • Clone repository │ │ • Extract semantic chunks │
│ • Find Python files │ │ • Syntax-error fallback │
└──────────────────────┘ └───────────────────────────────┘
│
▼
┌──────────────────────────────────────────────────────────────┐
│ reviewer.py (LLM Interface) │
│──────────────────────────────────────────────────────────────│
│ • Prompt Engineering │
│ • Parallel AI Reviews │
│ • Confidence Scoring │
│ • Repository Summary Generation │
└──────────────────────────────────────────────────────────────┘
│
▼
┌──────────────────────────────────────────────────────────────┐
│ Streamlit Dashboard │
│──────────────────────────────────────────────────────────────│
│ • Issue Cards │
│ • Severity Filters │
│ • Confidence Filters │
│ • Health Score │
│ • JSON Export │
└──────────────────────────────────────────────────────────────┘
ai-code-review-agent/
│
├── app.py
│
├── agent/
│ ├── __init__.py
│ ├── ingestion.py
│ ├── parser.py
│ ├── pipeline.py
│ └── reviewer.py
│
├── prompts/
│ ├── review_prompt.txt
│ └── summary_prompt.txt
│
├── requirements.txt
├── README.md
└── .env
GitHub URL
│
▼
Clone Repository
│
▼
Find Python Files
│
▼
AST Parsing
│
▼
Semantic Chunk Extraction
│
▼
Parallel LLM Reviews
│
▼
Structured JSON Results
│
▼
Repository Health Summary
│
▼
Interactive Dashboard
Uses Python’s built-in ast module to extract:
- functions
- async functions
- classes
instead of sending entire files to the LLM.
Uses:
ThreadPoolExecutorto review multiple chunks simultaneously, reducing latency significantly.
Every issue includes:
- severity
- confidence score
- actionable suggestion
Low-confidence findings are isolated under:
Verify This
Even if AST parsing fails, the system:
- creates fallback chunks,
- preserves exact syntax error locations,
- still allows the AI to analyze broken files.
The agent generates:
- overall health score,
- issue breakdown,
- recurring patterns,
- critical issues,
- recommended next steps.
| Constant | File | Default |
|---|---|---|
| MAX_CHUNKS | pipeline.py | 5 |
| MAX_WORKERS | pipeline.py | 5 |
| MIN_LINES | parser.py | 5 |
| MODEL_NAME | reviewer.py | llama-3.3-70b-versatile |
- Duplicate chunk reviews — ast.walk() extracts both a class and its methods as separate chunks, so method code gets reviewed twice, wasting API calls and producing conflicting findings.
- Limited chunk review count (
MAX_CHUNKS = 5) - No persistent database
- Small functions silently skipped — Any function under MIN_LINES = 5 is never reviewed with no warning. A one-liner like def get_password(): return "hardcoded123" would be completely missed
- No retry/backoff system
- No clone timeout — Repo.clone_from() has no timeout. A large repository will block the UI indefinitely with no way to cancel.
- No GitHub PR commenting yet
Add support for:
- JavaScript
- TypeScript
- Go
- Rust
using tree-sitter.
Post inline comments directly onto pull requests.
Review only changed files/chunks using hashing and caching.
Add:
- Celery
- Redis
- background job queues
for multi-user scalability.
Track:
- issue trends,
- repository health over time,
- recurring problematic files.
| Score | Label | Meaning |
|---|---|---|
| 90–100 | Excellent | Minor or no issues |
| 70–89 | Good | Few medium issues |
| 50–69 | Fair | Multiple medium issues |
| 30–49 | Poor | Several high-severity issues |
| 0–29 | Critical | Fundamental problems |
| Package | Purpose |
|---|---|
| streamlit | Frontend UI |
| openai | Groq OpenAI-compatible client |
| python-dotenv | Environment variable loading |
| gitpython | GitHub repository cloning |
This project is open-source and available under the MIT License.
Aditya Jhinjha
GitHub: https://github.com/adityajhinjha