Code Review Swarm
The code review swarm dispatches multiple specialized sub-agents to review a pull request in parallel. Each agent focuses on a single dimension — security, performance, style, or logic — then a root agent synthesizes the findings into a single structured report.
How it works
- Parallel sub-agents — When a review is triggered, the root agent spawns one sub-agent per enabled dimension. All sub-agents receive the diff and any relevant context (README, test files, dependency manifest) simultaneously and run in parallel
- Dimension analysis — Each sub-agent applies its specialized evaluation criteria to the diff and produces a list of findings with file, line, severity, and a plain-language explanation
- Synthesis — After all sub-agents complete, the root agent deduplicates overlapping findings, resolves conflicting assessments, assigns an overall risk score, and renders the final structured report
Invoking
bash
# Trigger a code review swarm on a pull request
POST /agents/code-review
{
"repo": "owner/repository",
"pr_number": 42,
"dimensions": ["security", "performance", "style", "logic"]
}
# Retrieve the completed report
GET /agents/code-review/reports/:reportIdReview dimensions
| Dimension | Focus area | Example findings |
|---|---|---|
| Security | Vulnerabilities, injection risks, secrets in code | SQL injection, hardcoded API key, insecure deserialization |
| Performance | Algorithmic complexity, unnecessary allocations, N+1 queries | O(n²) loop, missing index, unbounded fetch |
| Style | Naming conventions, formatting, idiomatic patterns | Non-standard casing, deep nesting, magic numbers |
| Logic | Correctness, edge cases, off-by-one errors, null handling | Missing null guard, incorrect boundary condition, unreachable branch |
| Test coverage | Uncovered paths, missing assertions, test quality | New branch without test, assertion on mutable state, empty test body |
Output format
The synthesized report is returned as JSON and rendered as a structured document. Each finding includes:
- Severity —
critical,high,medium,low, orinfo - Dimension — Which sub-agent raised the finding
- Location — File path and line range within the diff
- Description — Plain-language explanation of the issue
- Suggestion — Concrete recommended fix or refactor
The report also includes a top-level riskScore (0–100) and a recommendation field with one of: approve, approve_with_suggestions, or request_changes.
Configuration
yaml
codeReview:
enabled: true
maxAgents: 5 # Maximum parallel sub-agents
dimensions:
- security
- performance
- style
- logic
- testCoverage
severityThreshold: medium # Only surface findings at this severity or above
postComment: true # Automatically post report as a PR commentℹSet
postComment: true together with a configured GitLab integration to have the swarm post its report directly as a pull request review comment, including inline annotations at the relevant diff lines.