convez.ai
AgenteDevOps & InfraestruturaAvançado
Badri-Narayanan

CodeSage — Assistente de Revisão de Código Multi-Agent

Badri-Narayanan/CodeSage

Revisão inteligente de PRs com multi-agent reasoning e contexto de codebase

Ver no GitHub
InicialPluginScore · de 0 a 100

Sistema multi-agent alimentado por Claude que revisa pull requests como um time sênior faria: com raciocínio, auto-reflexão e contexto da codebase. Integra pipeline RAG com pgvector, agentes paralelos de segurança/correção/estilo em LangGraph, e expõe tudo via REST API, MCP server e console web com SSE.

Instalação

$npx convez-ai Badri-Narayanan/CodeSage

1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

Métricas

Estrelas
0
Forks
0
Acompanhando
0
Saúde
57%
Último commit
há 1 mês
Versão
—
Issues abertas
0
Contribuidores
1

Casos de uso

  • Revisão automatizada de pull requests com análise de segurança, correção e estilo
  • Integração em fluxos CI/CD como gate de qualidade com aprovação humana
  • Avaliação contínua de modelos LLM e detecção de regressões

Veredito

Projeto maduro e bem-arquitetado que resolve o problema real de revisão de código em escala. Excelente para times que buscam CI/CD inteligente, mas requer setup complexo (PostgreSQL, pgvector, LangGraph) e conhecimento sólido em agents. Referência técnica de qualidade.

README

A tradução para o português deste README ainda está na fila.

CodeSage — Agentic Code Review Assistant

A Claude-powered multi-agent system that reviews pull requests the way a senior team would — reasoning, reflecting, and citing context from the codebase before it comments.

CI Python 3.11+ License: MIT

CodeSage ingests a pull request, retrieves relevant context from the surrounding codebase with a pgvector RAG pipeline, then runs parallel security, correctness, and style reviewer agents built on LangGraph (ReAct + self-reflection). Findings are aggregated, de-duplicated, run through an LLM-as-Judge eval harness, and surfaced behind a human-in-the-loop gate. Every model call is metered for token-cost telemetry, and the agents are exposed over both a REST API, an MCP server, and a real-time web console.


Highlights

CapabilityWhere it lives
Multi-agent PR review on LangGraph (ReAct + self-reflection)app/agents/
Parallel security / correctness / style reviewersapp/agents/reviewers/
pgvector RAG pipeline on PostgreSQLapp/rag/, app/db/vector_store.py
Sandboxed test executionapp/agents/sandbox.py
Human-in-the-loop gateapp/agents/graph.py
LLM-as-Judge eval harness + cross-version regression detectionapp/eval/
Token-cost telemetryapp/llm/telemetry.py
REST API (FastAPI)app/api/
MCP serverapp/mcp/server.py
Containerized + deployable (Docker / DigitalOcean / AWS)Dockerfile, deploy/
Real-time web console (React + Vite + SSE)web/

Workflow & use-cases

One review flows left-to-right through the pipeline; progress streams to the web console in real time. Each console view below maps to something you can do with the system — run reviews, clear the human-in-the-loop gate, watch cost, ingest a codebase for RAG, or evaluate models for regressions.

Architecture

                         ┌────────────────────────────────────────────┐
   PR diff ──▶ Ingest ──▶│  LangGraph orchestration (ReAct loop)        │
   (GitHub /             │                                              │
    REST / MCP)          │   ┌──────────┐  ┌────────────┐  ┌────────┐  │
                         │   │ Security │  │ Correctness │  │ Style  │  │ ← parallel
        ▲                │   │ reviewer │  │  reviewer   │  │reviewer│  │   reviewers
        │                │   └────┬─────┘  └─────┬───────┘  └───┬────┘  │
   pgvector RAG ◀────────┼────────┴──── tools ───┴──────────────┘       │
   (codebase context)    │              (retrieve_context,              │
                         │               run_sandboxed_tests)           │
                         │                     │                        │
                         │              Aggregate + self-reflect        │
                         │                     │                        │
                         │              Human-in-the-loop gate          │
                         └─────────────────────┬────────────────────────┘
                                               │
                                  LLM-as-Judge eval harness
                                  + cross-version regression
                                               │
                                       Review report

Every node records token usage and cost via the telemetry layer.

Quick start (local, Docker)

git clone https://github.com/badrinarayanan/CodeSage.git
cd CodeSage
cp .env.example .env          # add your ANTHROPIC_API_KEY
docker compose up --build

This starts three services wired together by docker-compose.yml:

ServiceURLWhat
webhttp://localhost:3000Operator console (React UI)
apihttp://localhost:8000REST API + SSE; docs at /docs
dblocalhost:5432PostgreSQL + pgvector

Open http://localhost:3000 for the web console; the API is also usable directly.

Web console (operator UI)

A React + Vite + TypeScript + Tailwind single-page app (web/) served by nginx, which reverse-proxies /api to the backend (so SSE streams straight through).

  • Review Console — submit a diff and watch the multi-agent pipeline run in real time over Server-Sent Events: a live stage timeline (security / correctness / style → reflection → judge → human gate), streamed activity log, judge scorecard, findings, and ReAct reasoning traces.
  • History — every review, with status, judge score, and severity breakdown.
  • Approval Queue — act on the human-in-the-loop gate (approve / reject).
  • Cost & Telemetry — token usage and USD cost per pipeline component.
  • RAG Ingestion — index a codebase into pgvector from the browser.
  • Eval & Regression — launch LLM-as-Judge runs and cross-version comparisons.
  • Dark / light theme toggle.

The real-time path is backed by async review jobs (POST /api/v1/reviews/async) that stream progress events from an in-process broker over GET /api/v1/reviews/{id}/stream (SSE). The original synchronous POST /api/v1/reviews is unchanged.

Screenshots

The images below auto-switch with your GitHub light/dark theme. Every screen is built in both themes via a one-click toggle.

DarkLight

Frontend dev (hot reload)

cd web
npm install
npm run dev      # http://localhost:5173, proxies /api to localhost:8000

Run a review

curl -X POST http://localhost:8000/api/v1/reviews \
  -H 'Content-Type: application/json' \
  -d '{
    "repo": "octocat/hello-world",
    "pr_number": 1,
    "diff": "diff --git a/app.py b/app.py\n@@ -1 +1,2 @@\n-print(1)\n+import os\n+os.system(input())"
  }'

You'll get back findings grouped by reviewer, a judge score, and a requires_human_approval flag if the gate tripped.

Local dev without Docker

python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
# bring up just Postgres+pgvector:
docker compose up -d db
export DATABASE_URL=postgresql+asyncpg://codesage:codesage@localhost:5432/codesage
export ANTHROPIC_API_KEY=sk-ant-...
python -m scripts.init_db
uvicorn app.main:app --reload

Ingesting a codebase for RAG

python -m scripts.ingest_repo --path /path/to/repo --repo owner/name

This chunks source files, embeds them, and stores vectors in pgvector so the reviewers can cite real surrounding code.

Evaluation & regression detection

# Score a batch of reviews with the LLM-as-Judge harness
python -m app.eval.harness run --dataset eval/datasets/sample.jsonl

# Compare two model versions and flag regressions
python -m app.eval.harness compare \
  --baseline claude-opus-4-7 --candidate claude-opus-4-8

MCP server

python -m app.mcp.server      # stdio MCP server exposing review_pull_request

Point any MCP-compatible client (Claude Desktop, etc.) at it to call CodeSage's review tools directly.

Deployment

See deploy/README.md for the DigitalOcean droplet path (one deploy.sh invocation) and notes on the AWS (ECS/Lambda) story.

Configuration

All settings are environment-driven; see .env.example.

VariableDefaultPurpose
ANTHROPIC_API_KEY—Claude API key (required)
CODESAGE_MODELclaude-opus-4-8Primary reviewing model
CODESAGE_JUDGE_MODELclaude-opus-4-8LLM-as-Judge model
CODESAGE_EMBED_MODELvoyage-3 (or hash fallback)Embedding model
DATABASE_URLpostgresql+asyncpg://codesage:codesage@db:5432/codesagePostgres DSN
CODESAGE_EFFORThighClaude effort level
CODESAGE_HITL_THRESHOLD0.6Judge score below which human approval is required

Tech stack

Python · FastAPI · LangGraph · LangChain · Claude API · pgvector · PostgreSQL · MCP · Docker · DigitalOcean / AWS

License

MIT — see LICENSE.

Ver o original no GitHub

Bom para

Relacionados