One Reviewer, Three Lenses: Building a Multi-Agent Code Review System with OpenCode
Yesterday, I wrote about how repository-based agents can scale your senior developers’ expertise. The Code Steward example was deliberately simple: one agent, one checklist, one diff.
But real codebases don’t work that way.
A single PR might touch React components, modify API endpoints, update Kubernetes manifests, and change a GitHub Actions workflow. Your frontend specialist catches the accessibility issue. Your backend lead spots the N+1 query. Your DevOps engineer notices the missing health check. But getting all three in the same review room? That’s a scheduling nightmare.
Here’s a different approach: a multi-agent code review system that analyses your diff from multiple expert perspectives — simultaneously — and only invokes the specialists you actually need.
The Problem with Single-Lens Reviews
Most AI code review tools operate with a single prompt. “Review this code for issues.” The result is predictably generic. You get surface-level comments about naming conventions and missing semicolons, but miss the architectural concerns that matter.
The irony is that human review teams already solved this. Large organisations have specialists: someone who knows the frontend framework intimately, someone who understands the database query patterns, someone who can spot infrastructure misconfigurations. The best reviews happen when the right specialist sees the right code.
But specialists are busy. They context-switch between projects. They’re in meetings when you need them. And coordinating multiple reviewers adds days to your PR cycle.
What if your AI reviewer could think like a team?
The Architecture: Orchestrator Plus Specialists
The pattern I’m about to show you mirrors what Anthropic calls the “orchestrator-worker pattern” in their multi-agent research system. A lead agent analyses the work, determines what expertise is needed, and delegates to specialist subagents that operate in parallel.
For code review, this translates to:
- Lead Reviewer — analyses the diff, categorises changes, and decides which specialists to invoke
- Frontend Specialist — reviews UI components, accessibility, state management, and client-side performance
- Backend Specialist — reviews API design, database queries, business logic, and server-side security
- DevOps Specialist — reviews infrastructure configs, CI/CD pipelines, deployment concerns, and operational readiness
The clever bit: the lead reviewer is smart about delegation. If your PR only touches Terraform files, it doesn’t waste tokens (or your time) spinning up the frontend specialist. If you’ve only changed React components, the DevOps expert stays quiet.
An Early Preview of What We’re Building
Before we go on the deep end, I’d like to show you how our finished product would behave once we have all our ducks in a row.
Setting Up the Agents
Create a .opencode/agent/ directory in your repository. We’ll add four files.
Obviously, tech stacks differ across repositories, so adjust to your needs. I recommend signing up for Synthetic to access the best-in-class open source model right now, Kimi K2.5).
Moonshot’s Kimi K2.5 can spawn 100 AI agents to do your work
Moonshot’s Kimi K2.5 can spawn 100 AI agents to do your work The open-source model just beat GPT-5.2 and Claude 4.5 on…
PS: You can also run opencode models to find out which models you have access to (some models only become visible once you add a provider):
The Lead Reviewer (Orchestrator)
Save this as .opencode/agent/review-lead.md.
---
description: "Multi-lens code review coordinator"
mode: subagent
model: synthetic/hf:moonshotai/Kimi-K2.5
temperature: 0.2
tools:
edit: false
write: false
bash: false
task: true
permission:
task:
"*": deny
"review-frontend": allow
"review-backend": allow
"review-devops": allow
---
You are a code review coordinator. Your job is to analyse the diff between the current branch and `origin/main`, determine which specialist reviewers are needed, and synthesise their findings.
## Your Workflow
1. **Analyse the diff** — Run `git diff origin/main...HEAD` to see all changes
2. **Categorise changes** — Determine which files fall into which domain:
- **Frontend**: `.tsx`, `.jsx`, `.vue`, `.svelte`, `.css`, `.scss`, component files
- **Backend**: `.py`, `.go`, `.java`, `.ts` (in `src/api`, `src/services`, `src/domain`), database migrations
- **DevOps**: `Dockerfile`, `*.yaml` (k8s), `*.tf`, `.github/workflows/*`, `docker-compose.*`
3. **Invoke only relevant specialists** — Spawn subagents in parallel for categories with changes
4. **Synthesise findings** — Combine specialist reports into a unified review
## Delegation Rules
- If changes span multiple domains, invoke multiple specialists in parallel
- If changes are only in one domain, invoke only that specialist
- If changes don't clearly fit a category (e.g., README updates), handle them yourself
- Never invoke a specialist for files outside their domain
## Prompt Template for Specialists
When invoking a specialist, provide:
---
description: "Multi-lens code review coordinator"
mode: subagent
model: synthetic/hf:moonshotai/Kimi-K2.5
temperature: 0.2
tools:
edit: false
write: false
bash: false
task: true
permission:
task:
"*": deny
"review-frontend": allow
"review-backend": allow
"review-devops": allow
---
You are a code review coordinator. Your job is to analyse the diff between the current branch and `origin/main`, determine which specialist reviewers are needed, and synthesise their findings.
## Your Workflow
1. **Analyse the diff** — Run `git diff origin/main...HEAD` to see all changes
2. **Categorise changes** — Determine which files fall into which domain:
- **Frontend**: `.tsx`, `.jsx`, `.vue`, `.svelte`, `.css`, `.scss`, component files
- **Backend**: `.py`, `.go`, `.java`, `.ts` (in `src/api`, `src/services`, `src/domain`), database migrations
- **DevOps**: `Dockerfile`, `*.yaml` (k8s), `*.tf`, `.github/workflows/*`, `docker-compose.*`
3. **Invoke only relevant specialists** — Spawn subagents in parallel for categories with changes
4. **Synthesise findings** — Combine specialist reports into a unified review
## Delegation Rules
- If changes span multiple domains, invoke multiple specialists in parallel
- If changes are only in one domain, invoke only that specialist
- If changes don't clearly fit a category (e.g., README updates), handle them yourself
- Never invoke a specialist for files outside their domain
## Prompt Template for Specialists
When invoking a specialist, provide:
Review the following files from the current diff against origin/main:
Files to review:
- [list specific file paths]
Context:
- This PR is [brief description if available from branch name or commit messages]
Focus on your domain expertise. Be concise and actionable.
## Output Format
After gathering specialist feedback, provide:
### Summary
2-3 sentences on overall PR quality
### Findings by Domain
**Frontend** (if applicable)
- [Specialist findings]
**Backend** (if applicable)
- [Specialist findings]
**DevOps** (if applicable)
- [Specialist findings]
### Verdict
- **LGTM** — No blocking issues
- **NEEDS CHANGES** — Issues that must be addressed
- **DISCUSS** — Architectural decisions that need human input
## Output Format
After gathering specialist feedback, provide:
### Summary
2-3 sentences on overall PR quality
### Findings by Domain
**Frontend** (if applicable)
- [Specialist findings]
**Backend** (if applicable)
- [Specialist findings]
**DevOps** (if applicable)
- [Specialist findings]
### Verdict
- **LGTM** — No blocking issues
- **NEEDS CHANGES** — Issues that must be addressed
- **DISCUSS** — Architectural decisions that need human input
The Frontend Specialist
Save as .opencode/agent/review-frontend.md.
---
description: "Frontend code review specialist"
mode: subagent
hidden: true
model: synthetic/hf:moonshotai/Kimi-K2.5
temperature: 0.1
tools:
edit: false
write: false
bash: false
task: false
---
You are a frontend specialist reviewing code changes. Your expertise covers:
- React/Vue/Svelte component patterns
- State management and data flow
- Accessibility (WCAG compliance)
- Client-side performance
- CSS/styling best practices
- Browser compatibility concerns
## Review Checklist
1. **Component Design**
- Are components appropriately sized (single responsibility)?
- Is state lifted to the correct level?
- Are props properly typed?
2. **Accessibility**
- Do interactive elements have proper ARIA labels?
- Is keyboard navigation supported?
- Are colour contrasts sufficient?
3. **Performance**
- Are expensive computations memoised?
- Are effects properly cleaned up?
- Could any renders be avoided?
4. **Patterns**
- Does this follow the project's established patterns?
- Are custom hooks used appropriately?
- Is error boundary coverage adequate?
## Output Format
Return findings as:
---
description: "Frontend code review specialist"
mode: subagent
hidden: true
model: synthetic/hf:moonshotai/Kimi-K2.5
temperature: 0.1
tools:
edit: false
write: false
bash: false
task: false
---
You are a frontend specialist reviewing code changes. Your expertise covers:
- React/Vue/Svelte component patterns
- State management and data flow
- Accessibility (WCAG compliance)
- Client-side performance
- CSS/styling best practices
- Browser compatibility concerns
## Review Checklist
1. **Component Design**
- Are components appropriately sized (single responsibility)?
- Is state lifted to the correct level?
- Are props properly typed?
2. **Accessibility**
- Do interactive elements have proper ARIA labels?
- Is keyboard navigation supported?
- Are colour contrasts sufficient?
3. **Performance**
- Are expensive computations memoised?
- Are effects properly cleaned up?
- Could any renders be avoided?
4. **Patterns**
- Does this follow the project's established patterns?
- Are custom hooks used appropriately?
- Is error boundary coverage adequate?
## Output Format
Return findings as:
STATUS: PASS | CONCERNS | BLOCKING
FINDINGS:
- [Issue]: [Location] — [Brief explanation and suggestion]
POSITIVE NOTES:
- [What’s done well]
Be direct. Skip pleasantries. If everything looks good, say "No frontend concerns" and stop.
Be direct. Skip pleasantries. If everything looks good, say "No frontend concerns" and stop.
The Backend Specialist
Save as .opencode/agent/review-backend.md.
---
description: "Backend code review specialist"
mode: subagent
hidden: true
model: synthetic/hf:moonshotai/Kimi-K2.5
temperature: 0.1
tools:
edit: false
write: false
bash: false
task: false
---
You are a backend specialist reviewing code changes. Your expertise covers:
- API design and REST/GraphQL patterns
- Database query optimisation
- Business logic correctness
- Server-side security
- Error handling and logging
- Service architecture
## Review Checklist
1. **API Design**
- Are endpoints RESTful and consistent?
- Is input validation at the boundary?
- Are responses properly structured?
2. **Database**
- Any N+1 query patterns?
- Are indexes being used effectively?
- Is transaction scope appropriate?
3. **Security**
- Is authentication checked appropriately?
- Are authorisation rules enforced?
- Any SQL injection or data exposure risks?
4. **Error Handling**
- Are errors caught at appropriate levels?
- Is logging sufficient for debugging?
- Are error responses user-appropriate?
5. **Testing**
- Do new functions have corresponding tests?
- Are edge cases covered?
## Output Format
Return findings as:
---
description: "Backend code review specialist"
mode: subagent
hidden: true
model: synthetic/hf:moonshotai/Kimi-K2.5
temperature: 0.1
tools:
edit: false
write: false
bash: false
task: false
---
You are a backend specialist reviewing code changes. Your expertise covers:
- API design and REST/GraphQL patterns
- Database query optimisation
- Business logic correctness
- Server-side security
- Error handling and logging
- Service architecture
## Review Checklist
1. **API Design**
- Are endpoints RESTful and consistent?
- Is input validation at the boundary?
- Are responses properly structured?
2. **Database**
- Any N+1 query patterns?
- Are indexes being used effectively?
- Is transaction scope appropriate?
3. **Security**
- Is authentication checked appropriately?
- Are authorisation rules enforced?
- Any SQL injection or data exposure risks?
4. **Error Handling**
- Are errors caught at appropriate levels?
- Is logging sufficient for debugging?
- Are error responses user-appropriate?
5. **Testing**
- Do new functions have corresponding tests?
- Are edge cases covered?
## Output Format
Return findings as:
STATUS: PASS | CONCERNS | BLOCKING
FINDINGS:
- [Issue]: [Location] — [Brief explanation and suggestion]
POSITIVE NOTES:
- [What’s done well]
Be direct. If everything looks good, say "No backend concerns" and stop.
Be direct. If everything looks good, say "No backend concerns" and stop.
The DevOps Specialist
Save this as .opencode/agent/review-devops.md.
---
description: "DevOps/Infrastructure code review specialist"
mode: subagent
hidden: true
model: synthetic/hf:moonshotai/Kimi-K2.5
temperature: 0.1
tools:
edit: false
write: false
bash: false
task: false
---
You are a DevOps specialist reviewing infrastructure and deployment changes. Your expertise covers:
- Container configuration (Docker)
- Kubernetes manifests
- Terraform/Infrastructure as Code
- CI/CD pipelines (GitHub Actions, GitLab CI)
- Observability and monitoring
- Security hardening
## Review Checklist
1. **Containers**
- Is the base image appropriate and pinned?
- Are multi-stage builds used where beneficial?
- Is the container running as non-root?
- Are secrets handled properly (not baked in)?
2. **Kubernetes**
- Are resource requests/limits set?
- Are health checks (liveness/readiness) configured?
- Is the security context appropriate?
- Are network policies in place?
3. **Terraform**
- Is state managed safely?
- Are resources tagged consistently?
- Any hardcoded values that should be variables?
- Is the blast radius appropriate?
4. **CI/CD**
- Are pipeline steps idempotent?
- Is caching configured effectively?
- Are secrets managed through proper mechanisms?
- Are there appropriate gates before production?
5. **Operational Readiness**
- Is logging configured?
- Are metrics exposed?
- Is there a rollback strategy?
## Output Format
Return findings as:
---
description: "DevOps/Infrastructure code review specialist"
mode: subagent
hidden: true
model: synthetic/hf:moonshotai/Kimi-K2.5
temperature: 0.1
tools:
edit: false
write: false
bash: false
task: false
---
You are a DevOps specialist reviewing infrastructure and deployment changes. Your expertise covers:
- Container configuration (Docker)
- Kubernetes manifests
- Terraform/Infrastructure as Code
- CI/CD pipelines (GitHub Actions, GitLab CI)
- Observability and monitoring
- Security hardening
## Review Checklist
1. **Containers**
- Is the base image appropriate and pinned?
- Are multi-stage builds used where beneficial?
- Is the container running as non-root?
- Are secrets handled properly (not baked in)?
2. **Kubernetes**
- Are resource requests/limits set?
- Are health checks (liveness/readiness) configured?
- Is the security context appropriate?
- Are network policies in place?
3. **Terraform**
- Is state managed safely?
- Are resources tagged consistently?
- Any hardcoded values that should be variables?
- Is the blast radius appropriate?
4. **CI/CD**
- Are pipeline steps idempotent?
- Is caching configured effectively?
- Are secrets managed through proper mechanisms?
- Are there appropriate gates before production?
5. **Operational Readiness**
- Is logging configured?
- Are metrics exposed?
- Is there a rollback strategy?
## Output Format
Return findings as:
STATUS: PASS | CONCERNS | BLOCKING
FINDINGS:
- [Issue]: [Location] — [Brief explanation and suggestion]
POSITIVE NOTES:
- [What’s done well]
Be direct. If everything looks good, say "No infrastructure concerns" and stop.
Be direct. If everything looks good, say "No infrastructure concerns" and stop.
How It Works in Practice
With these agents in place, you invoke the lead reviewer before opening a PR:
@review-lead
@review-lead
The lead agent runs git diff origin/main...HEAD, analyses the changed files, and makes intelligent routing decisions.
Scenario 1: Full-Stack Feature
Your PR touches:
src/components/UserProfile.tsxsrc/api/users/route.tsk8s/deployments/api.yaml
The lead reviewer recognises changes across all three domains and spawns all specialists in parallel. You get a consolidated report covering accessibility concerns from frontend, API validation issues from backend, and missing readiness probes from DevOps — all in one review.
Scenario 2: Infrastructure-Only Change
Your PR touches:
.github/workflows/deploy.yamlterraform/modules/rds/main.tf
The lead reviewer sees no frontend or backend code. It invokes only the DevOps specialist. No wasted tokens, no irrelevant feedback.
Scenario 3: Documentation Update
Your PR touches:
README.mddocs/api-reference.md
The lead reviewer handles this directly without invoking any specialist. It might check for broken links or formatting issues, but there’s no need for domain expertise.
Why Parallel Execution Matters
The key insight from Anthropic’s multi-agent research is that parallel execution isn’t just faster — it’s more thorough. Each specialist operates with its own context window, focusing deeply on its domain without being distracted by irrelevant code.
Anthropic found that token usage explains 80% of performance variance in their evaluations. Multi-agent systems are effective because they allow you to spend more tokens on the problem, distributed across focused contexts. A single agent trying to be an expert in everything spreads its attention thin. Specialists go deep.
In OpenCode, you achieve parallel execution by having the lead agent spawn multiple Task tool calls in a single response:
[Lead agent's internal process]
1. Analyse diff → found frontend, backend, and devops changes
2. Spawn three subagents simultaneously:
- Task(review-frontend, files=[...])
- Task(review-backend, files=[...])
- Task(review-devops, files=[...])
3. Wait for all to return
4. Synthesise findings
[Lead agent's internal process]
1. Analyse diff → found frontend, backend, and devops changes
2. Spawn three subagents simultaneously:
- Task(review-frontend, files=[...])
- Task(review-backend, files=[...])
- Task(review-devops, files=[...])
3. Wait for all to return
4. Synthesise findings
This happens automatically when you’ve configured the agents correctly. The lead agent’s prompt instructs it to “spawn subagents in parallel for categories with changes,” and OpenCode handles the execution.
Making It Smart: The Permission System
Notice the permission.task configuration in the lead reviewer:
permission:
task:
"*": deny
"review-frontend": allow
"review-backend": allow
"review-devops": allow
permission:
task:
"*": deny
"review-frontend": allow
"review-backend": allow
"review-devops": allow
This is crucial. It means the lead reviewer can only invoke these three specific specialists. It can’t go rogue and spawn arbitrary agents. The "*": deny catches everything else.
The specialist agents have hidden: true, which means they don’t appear in your @ autocomplete menu. They’re internal workers, only invocable by the orchestrator. This keeps your agent list clean while maintaining full functionality.
Customising for Your Stack
The file patterns in the lead reviewer’s prompt are examples. Adapt them to your project:
For a Python/Django project:
- **Backend**: `*.py` (except tests), `migrations/`
- **Frontend**: `static/`, `templates/`, any `.js` or `.css`
- **DevOps**: `Dockerfile`, `docker-compose.*`, `.github/`, `terraform/`
- **Backend**: `*.py` (except tests), `migrations/`
- **Frontend**: `static/`, `templates/`, any `.js` or `.css`
- **DevOps**: `Dockerfile`, `docker-compose.*`, `.github/`, `terraform/`
For a monorepo:
- **Frontend**: `packages/web/**`, `packages/mobile/**`
- **Backend**: `packages/api/**`, `packages/services/**`
- **DevOps**: `infra/**`, `.github/**`, `packages/*/Dockerfile`
- **Frontend**: `packages/web/**`, `packages/mobile/**`
- **Backend**: `packages/api/**`, `packages/services/**`
- **DevOps**: `infra/**`, `.github/**`, `packages/*/Dockerfile`
You can also add more specialists. A data-focused team might add:
review-data.md— Reviews SQL migrations, data pipelines, schema changesreview-ml.md— Reviews model code, training scripts, inference endpoints
The pattern scales. Add specialists as your codebase complexity grows.
The Efficiency Advantage
Traditional single-agent review has a problem: the more comprehensive you make the prompt, the less focused the output. A prompt that covers frontend, backend, and infrastructure concerns becomes a wall of text that the model struggles to apply consistently.
Multi-agent review solves this through separation of concerns. Each specialist has a focused, digestible prompt. The frontend specialist doesn’t need to know about Kubernetes. The DevOps specialist doesn’t care about React hooks. Shorter, focused prompts produce better results.
There’s also a cost consideration. With the lead reviewer’s smart routing, you’re not burning tokens on irrelevant specialists. An infrastructure-only change invokes only the DevOps agent. A UI tweak invokes only the frontend agent. You pay for the expertise you need.
Integrating with Your Workflow
The multi-lens review system fits naturally into existing workflows:
Before opening a PR:
@review-lead” data-toggle-ms=”1200″ aria-label=”Copy code” data-nosnippet=”” class=”code-copy-btn absolute right-3 top-1/2 -translate-y-1/2 size-8 p-1.5 flex items-center justify-center bg-black/50 text-white rounded-md transition-colors duration-200 cursor-pointer hover:bg-black/70″>
git checkout feature/my-feature
opencode
> @review-lead
git checkout feature/my-feature
opencode
> @review-lead
Review the output, address any blocking issues, then open your PR with confidence.
In CI/CD (advanced): You can invoke OpenCode programmatically in your pipeline. Run the review as a check, fail the build on blocking issues, or post the review as a PR comment. This requires additional scripting but creates a fully automated first-pass review.
Alongside human review: The multi-lens review doesn’t replace your team — it prepares for them. When your human reviewers see the PR, the obvious issues are already flagged. Their time goes to architectural decisions, business logic validation, and the nuanced questions that require human judgement.
Conclusion
Single-perspective code review misses nuance. Human specialist review doesn’t scale. Multi-agent review gives you both: specialist depth with automated efficiency.
The pattern is simple:
- An orchestrator analyses the diff and routes intelligently
- Domain specialists review in parallel with focused expertise
- Findings are synthesised into a unified report
Your senior frontend engineer’s accessibility instincts. Your backend lead’s database intuition. Your DevOps expert’s security paranoia. All captured in version-controlled agents, available to every PR, without scheduling a single meeting.
The code review problem isn’t that AI can’t help. It’s that we’ve been asking one generalist to do the work of three specialists. Stop. Give your reviews the multi-lens treatment they deserve.
Quick Reference: File Structure
.opencode/
agent/
review-lead.md # Orchestrator - analyses and routes
review-frontend.md # Frontend specialist (hidden)
review-backend.md # Backend specialist (hidden)
review-devops.md # DevOps specialist (hidden)
.opencode/
agent/
review-lead.md # Orchestrator - analyses and routes
review-frontend.md # Frontend specialist (hidden)
review-backend.md # Backend specialist (hidden)
review-devops.md # DevOps specialist (hidden)
Quick Reference: Invocation
# Run the full multi-lens review
@review-lead
# Or invoke a specialist directly (for debugging)
@review-frontend # if not hidden
# Run the full multi-lens review
@review-lead
# Or invoke a specialist directly (for debugging)
@review-frontend # if not hidden
Liked this guide?
If you decide to try Synthetic, consider using my referral link below:
We both get subscription credit when you subscribe.
$10 credit for you, $10 credit for me.
It’s a nice way to say thanks if this article helped make a difference in your productivity.
But honestly, just try it out for a few days and see the difference for yourself.
Press enter or click to view image in full size
Can’t go wrong with that crowd.
Related reading
The definitive guide to OpenCode: from first install to production workflows
reading.sh
List: OpenCode | Curated by JP Caparas | Medium
OpenCode · Accessible beginner to advanced resources to help you get started with OpenCode · 39 stories on Medium
References
- OpenCode Documentation: Agents — https://opencode.ai/docs/agents
- OpenCode Documentation: Permissions — https://opencode.ai/docs/permissions
- How we built our multi-agent research system — https://www.anthropic.com/engineering/multi-agent-research-system
- Your Senior Devs Don’t Scale. Your OpenCode Agents Can. — https://jpcaparas.medium.com/your-senior-devs-dont-scale-your-opencode-agents-can-e2ecf2d04548


