CodeBug combines Claude + GPT-4o to catch security flaws, logic errors, and style issues — with a reinforcement-learning grader that improves over time.
Paste any snippet. CodeBug calls POST /api/review and returns a structured result — type, severity, comment, and a fix snippet.
Awaiting analysis…
Catches SQL injection, hardcoded secrets, and plain-text passwords — each severity-scored from 1 to 5.
Off-by-one errors, wrong comparisons, missing null checks, and divide-by-zero traps across all supported languages.
Python, JavaScript, and Java — each with language-idiomatic bug patterns in the bug bank.
Claude Haiku runs first. Any exception silently falls back to GPT-4o-mini with no disruption to the API response.
Every review earns a reward score. +25 for critical security catches, −25 for missed criticals. The model learns.
All reviews and training runs stored in SQLite. Query via /api/history and /api/stats endpoints.
Rate-limited to 20 req/min per IP. All responses are JSON. Start the server with python app.py.
| Method | Route | Description | Params |
|---|---|---|---|
| POST | /api/review | Submit code for AI review. Returns type, category, severity, comment, and fix snippet. | code, language? |
| POST | /api/train | Run N RL training episodes. Auto-saves checkpoint. Returns full stats dict. | episodes? (≤ 100) |
| GET | /api/history | Returns paginated list of past reviews from the SQLite database. | limit? (≤ 200) |
| GET | /api/stats | Aggregate stats: training runs, review counts, average reward, top bug categories. | — |
| GET | /api/health | Health check. Returns model name and DB connection status. | — |
Run RL episodes against the bug bank. The grader rewards precision and penalises misses. Checkpoints auto-save and are fully resumable.