Overview
By default, Nectr uses a single agentic loop where Claude decides what context to fetch. WhenPARALLEL_REVIEW_AGENTS=true, Nectr runs 3 specialized agents concurrently:
- Security Agent — Injection, auth, secrets, crypto
- Performance Agent — N+1 queries, memory leaks, algorithm complexity
- Style Agent — Tests, naming, error handling, API breakages
app/services/ai_service.py:720
Configuration
Enable Parallel Mode
Entry Point
File:app/services/pr_review_service.py:559
Agent Definitions
Security Agent
Prompt:ai_service.py:181
ai_service.py:169):
- Can read files to check for secrets/injection
- Can search project memory for security patterns
- Cannot access file history (not relevant to security)
Performance Agent
Prompt:ai_service.py:195
ai_service.py:172):
- Can read files to spot N+1 queries
- Can check file history to see if file is performance-sensitive
- Cannot access developer memory (not relevant)
Style Agent
Prompt:ai_service.py:209
ai_service.py:175):
- Can search developer memory for patterns (e.g., “@alice forgets error handling”)
- Can read files to check test coverage
- Can search project memory for style conventions
Parallel Execution
File:app/services/ai_service.py:720
- All 3 agents receive the same diff (truncated at 12 KB to fit in context)
- Each agent runs its own tool loop (max 5 rounds per agent)
asyncio.gatherruns all 3 concurrently → ~3x faster than sequential
Agent Tool Loop
File:app/services/ai_service.py:797
Synthesis Agent
File:app/services/ai_service.py:852
After all 3 agents finish, a final agent combines their findings:
changes_requested— Any CRITICAL/HIGH security or performance issueapproved— Only low/medium style issues or no issuescomment— Borderline (medium issues only)
Error Handling
File:app/services/ai_service.py:776
[agent error: ...] — synthesis agent still produces a review using the other two.
Performance Comparison
| Mode | Agents | Rounds | Latency | Use Case |
|---|---|---|---|---|
| Agentic | 1 | Up to 8 | ~12-20s | Best for small PRs (under 10 files), deep context needed |
| Parallel | 3 | Up to 5 each | ~8-15s | Best for large PRs (over 10 files), faster but less context |
- Parallel mode is faster (agents run concurrently) but each agent sees less context (12 KB diff cap, no cross-agent memory)
- Agentic mode is slower but Claude can follow deeper reasoning chains (read file → check history → search memory)
Debugging
Logs
Known Limitations
- Diff truncation: Each agent sees max 12 KB of diff (vs. 15 KB in agentic mode)
- No cross-agent context: Security agent can’t see what performance agent found
- Deduplication: Synthesis agent must manually dedupe overlapping issues
- Cost: 3 agents + 1 synthesis = 4 LLM calls (vs. 1 in agentic mode)
Future Improvements
- Agent memory: Share findings across agents via a shared context buffer
- Adaptive routing: Route only security-sensitive PRs to security agent
- Agent specialization: Add a “testing agent” for test coverage analysis
Next Steps
- Review Flow — Single agentic mode details
- AI Service — Core prompt engineering patterns