Autonomous multi-agent code intelligence platform β 6 specialized AI agents review every pull request in parallel, automatically.
CodeSense AI runs 6 specialized agents in parallel on every GitHub pull request:
| Agent | What it checks |
|---|---|
| π Security | OWASP Top 10, SQL injection, XSS, hardcoded secrets, insecure functions |
| β‘ Performance | Big-O complexity, N+1 queries, memory leaks, blocking I/O in async code |
| ποΈ Architecture | SOLID principles, God classes, design pattern opportunities, coupling |
| π§ͺ Tests | Coverage gaps, missing edge cases, generates ready-to-run test files |
| π Docs | Missing docstrings, outdated comments, missing type hints β auto-generates them |
| π§ AutoFix | Generates a unified diff with all fixes applied β paste-ready code |
Results appear as a structured comment directly on the PR β automatically, without you doing anything.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CodeSense AI Platform β
β β
β INPUT LAYER β
β βββββββββββββββ βββββββββββββββ ββββββββββββββββ β
β β Streamlit β β FastAPI β β GitHub β β
β β Web UI β β REST API β β Webhook β β
β ββββββββ¬βββββββ ββββββββ¬βββββββ ββββββββ¬ββββββββ β
β βββββββββββββββββββ΄ββββββββββββββββββ β
β β β
β ORCHESTRATION LAYER (LangGraph StateGraph) β
β βΌ β
β ββββββββββ ββββββββ ββββββββ βββββββββ ββββββββ β
β βSecurityβ β Perf β β Arch β β Tests β β Docs β β
β β Agent β βAgent β βAgent β β Agent β βAgent β β
β ββββββ¬ββββ ββββ¬ββββ ββββ¬ββββ ββββ¬βββββ ββββ¬ββββ β
β ββββββββββ΄ββββββββββ΄βββββββββ΄βββββββββββ β
β β fan-in (all 5 complete) β
β βΌ β
β βββββββββββββββββββ β
β β AutoFix Agent β β
β ββββββββββ¬βββββββββ β
β β β
β STORAGE LAYER βΌ β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Evolution Tracker (SQLite) β β
β β PR #1: 67/100 β PR #10: 82/100 β PR #25: 94/100 β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Tech stack: FastAPI Β· LangGraph Β· Groq (llama-3.3-70b) Β· LangSmith Β· Streamlit Β· SQLite Β· Docker Β· GitHub Actions
Set up once; every PR gets reviewed automatically in ~15 seconds.
1. Get a GitHub token
Settings β Developer settings β Personal access tokens β New token
Scopes: repo, write:discussion
2. Generate a webhook secret
python3 -c "import secrets; print(secrets.token_hex(32))"3. Add secrets to your repo Settings β Secrets and variables β Actions:
GROQ_API_KEYβ get free at console.groq.comGITHUB_WEBHOOK_SECRETβ generated aboveGITHUB_TOKENβ your personal access token
4. Deploy the backend (see Deployment) and note the URL
5. Add webhook in your GitHub repo Settings β Webhooks β Add webhook:
- Payload URL:
https://your-backend.render.com/webhook/github - Content type:
application/json - Secret: your generated secret
- Events: Pull requests only β
That's it. Open a PR and watch the review appear automatically.
The meta-feature: CodeSense AI reviews its own pull requests using itself.
The .github/workflows/self-review.yml workflow:
- Spins up the FastAPI backend in the CI runner
- Fetches the PR diff (Python, JS, TS, Java, Go, Rust files)
- Runs all 6 agents via the local API
- Posts a full structured review comment on the PR
This activates automatically on every PR to main. Add GROQ_API_KEY as a GitHub Actions secret to enable it.
Track code quality across pull requests over time:
Score
100 β ββββ
90 β βββββββ
80 β βββββββ
70 β β
60 β
ββββββββββββββββββββββββββββββββββΆ PRs over time
PR1 PR5 PR10 PR15 PR20 PR25
Every webhook-triggered PR review is saved to SQLite. The π Evolution page in the Streamlit sidebar shows:
- Overall score trend with colour-coded bands (Excellent / Good / Needs Work / Critical)
- Per-agent score breakdown (Security, Performance, Architecture, Docs)
- Critical issues per review (stacked bar chart)
- Full review history table
API endpoints:
GET /evolution/repos β list all tracked repos
GET /evolution/history β full history (filter by ?repo=owner/repo)
Full observability for every agent call β token usage, latency, and traces in LangSmith:
LANGSMITH_API_KEY=your_key_here
LANGSMITH_PROJECT=codesense-ai
LANGSMITH_TRACING_ENABLED=trueWhen configured, every LangGraph node execution is traced automatically. If not set, tracing is silently skipped β zero overhead.
- Python 3.11+
- Groq API key (free at console.groq.com) OR OpenAI key
git clone https://github.com/DadaMastan-code/codesense-ai.git
cd codesense-ai
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txtcp .env.example .env
# Edit .env β add your GROQ_API_KEY at minimum# Terminal 1: Backend
uvicorn backend.main:app --reload
# Terminal 2: Frontend
streamlit run frontend/app.pyOpen http://localhost:8501 β paste code, click Analyse.
docker compose -f docker/docker-compose.yml upInteractive docs: http://localhost:8000/docs
| Endpoint | Method | Description |
|---|---|---|
/analyze |
POST | Full 6-agent analysis (parallel via LangGraph) |
/analyze/stream |
POST | Server-Sent Events β results agent by agent |
/fix |
POST | AutoFix only β pass issue list |
/generate-tests |
POST | Test generation only |
/webhook/github |
POST | GitHub PR webhook handler |
/evolution/history |
GET | Quality score history |
/evolution/repos |
GET | List tracked repositories |
/health |
GET | Health check |
curl -X POST http://localhost:8000/analyze \
-H "Content-Type: application/json" \
-d '{
"code": "query = f\"SELECT * FROM users WHERE id={user_id}\"",
"language": "python",
"context": "auth handler"
}'- New Web Service on render.com β connect this repo
- Build:
pip install -r requirements.txt - Start:
uvicorn backend.main:app --host 0.0.0.0 --port $PORT - Env vars:
GROQ_API_KEY,GITHUB_WEBHOOK_SECRET,GITHUB_TOKEN
- share.streamlit.io β connect this repo
- Main file:
frontend/app.py - Update
API_BASEinfrontend/app.pyto your Render URL
codesense-ai/
βββ backend/
β βββ agents/
β β βββ security_agent.py # OWASP Top 10 checker
β β βββ performance_agent.py # Big-O + memory analyzer
β β βββ architecture_agent.py # SOLID + design patterns
β β βββ test_agent.py # Coverage + test generator
β β βββ doc_agent.py # Docstring generator
β β βββ fix_agent.py # AutoFix diff generator
β βββ api/
β β βββ github_webhook.py # GitHub PR webhook + comment bot
β β βββ evolution_route.py # Quality history endpoints
β βββ evolution/
β β βββ tracker.py # SQLite per-PR quality tracking
β βββ pipelines/
β β βββ orchestrator.py # LangGraph StateGraph (parallel fan-out)
β βββ utils/
β β βββ llm_client.py # Groq / OpenAI client with fallback
β β βββ tracing.py # LangSmith tracing (optional no-op)
β β βββ ...
β βββ models/schemas.py # Pydantic v2 schemas
β βββ config.py # Settings (pydantic-settings)
β βββ main.py # FastAPI app
βββ frontend/
β βββ app.py # Main analyzer UI
β βββ pages/
β βββ π_Evolution.py # Evolution dashboard
βββ tests/
βββ docker/
β βββ Dockerfile.backend
β βββ Dockerfile.frontend
β βββ docker-compose.yml
βββ .github/workflows/
β βββ ci.yml # Test β lint β mypy β docker build
β βββ self-review.yml # CodeSense reviews its own PRs β¨
βββ requirements.txt
| Basic Code Linters | CodeSense AI |
|---|---|
| Rule-based checks only | AI reasoning about context and intent |
| One dimension (style OR security) | 6 dimensions simultaneously in parallel |
| No explanation of WHY | Detailed reasoning + OWASP references for every finding |
| Manual trigger only | Automatic on every GitHub PR via webhook |
| No memory across PRs | Evolution tracking β sees quality patterns over time |
| Static suggestions | Auto-fix with unified diff β paste-ready |
MIT β see LICENSE
β Star this repo if it helped you