Reducing False Positives in AI Code Review Agents Through Architecture Refinement
cubic · Tech · 2024 · source Agentic: yes · promotional bias: med · source-backed · extracted with prompt 0.5.6 (schema v2)
Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.
Problem
Domain: AI code review agents for pull request quality control
cubic's AI code review agent was producing too many low-value comments and false positives, causing developers to ignore it and undermining trust in an AI-native GitHub workflow.
Constraints:
- The system had to catch bugs, anti-patterns, duplicated code, and similar issues without overwhelming reviewers.
- Low-value comments were worse than silence because they obscured genuinely useful feedback.
- Simple prompt changes and sampling/temperature tweaks did not materially improve the agent.
- Review comments needed traceable reasoning so the team could diagnose failures.
- Precision had to improve without sacrificing recall.
Architecture
cubic moved from a do-everything code-review agent to an architecture with explicit reasoning logs, fewer core tools, and specialized micro-agents. The agent first states its rationale, making failures diagnosable. The toolset was reduced to a simplified LSP and basic terminal. Separate planner, security, duplication, editorial, and other micro-agents each handle a narrow review scope, with caching used to manage the extra token consumption from overlapping context.
Diagram confidence: reconstructed (reconstructed from prose).
flowchart LR A["Pull request input"] --> B["Planner micro-agent"] B --> C["Security Agent"] B --> D["Duplication Agent"] B --> E["Editorial Agent"] C --> F["Simplified LSP"] C --> G["Basic terminal"] D --> F D --> G E --> F B --> H["Reasoning log"] C --> H D --> H E --> H H --> I["Review comment output"] J["Caching layer"] --> B J --> C J --> D J --> E
Components
| Component | Role | Interacts with |
|---|---|---|
Pull request input |
Code diff and review context submitted for AI review. | Planner micro-agent |
Planner micro-agent |
Assesses changes and identifies which checks are necessary. | Pull request input, Security Agent, Duplication Agent, Editorial Agent |
Security Agent |
Detects vulnerabilities such as injection or insecure authentication. | Planner micro-agent, Simplified LSP, Basic terminal |
Duplication Agent |
Flags repeated or copied code. | Planner micro-agent, Simplified LSP, Basic terminal |
Editorial Agent |
Handles typos and documentation consistency. | Planner micro-agent, Simplified LSP |
Simplified LSP |
Core static code context/tooling retained after pruning the larger toolkit. | Security Agent, Duplication Agent, Editorial Agent |
Basic terminal |
Minimal execution/tooling surface retained for code checks. | Security Agent, Duplication Agent |
Reasoning log |
Structured rationale recorded before feedback so bad patterns can be diagnosed. | Planner micro-agent, Security Agent, Duplication Agent, Editorial Agent, Review comment output |
Review comment output |
Final PR feedback shown to developers. | Reasoning log |
Caching layer |
Mitigates token overhead from overlapping context across micro-agents. | Planner micro-agent, Security Agent, Duplication Agent, Editorial Agent |
Data flow
A pull request enters cubic's AI review flow. A planner assesses the changes and identifies checks, then specialized micro-agents inspect their narrow domains using a simplified LSP and terminal. Before feedback is emitted, the agent records explicit reasoning, letting developers and the cubic team trace why a comment was made. If reasoning reveals a bad pattern, cubic can exclude it in later iterations; caching offsets the repeated context needed across micro-agents.
3 supporting quotes
Why this architecture
cubic concluded the root problem was not a missing prompt rule but an overloaded agent architecture. Reasoning logs made failures visible, tool pruning reduced confusion, and micro-agents kept each review task's context focused enough to improve precision while preserving recall.
3 supporting quotes
Models used: Large Language Models
Scale
- The production improvement followed three major architecture revisions.“After three major architecture revisions and extensive offline testing, we managed to reduce false positives by 51% without sacrificing recall.”article, stated
- The system achieved a 51% false-positive reduction.“These led to the 51% reduction in false positives currently running in production.”article, stated
- Outcomes were measured over hundreds of real pull requests across six weeks.“These architecture and prompt improvements led to meaningful results across hundreds of real pull requests from active open-source and private repositories.”article, stated“Specifically, over the past six weeks:”article, stated
- Median comments per pull request were cut by half.“Median comments per pull request cut by half, helping teams concentrate on genuinely important issues.”article, stated
- The team recommends removing tools used in less than 10% of tasks.“Regularly evaluate your agent's toolkit and remove tools rarely used (less than 10% of tasks).”article, stated
Alternatives considered (roads not taken)
One do-everything agent
Rejected because: It looked clean but produced excessive false positives, lost developer trust, and had opaque reasoning.
More prompt rules in a single large prompt
Rejected because: Rules accumulated quickly, were frequently overlooked, and did not fix the underlying precision problem.
Standard tuning knobs
Rejected because: Longer prompts, temperature changes, and sampling changes did not produce meaningful improvement.
Patterns
multi-agent-orchestration (architecture)
cubic split review into specialized micro-agents for planning, security, duplication, editorial checks, and other scopes.
3 supporting quotes
eval-driven-development (quality)
The team used explicit reasoning logs and extensive offline testing to diagnose false positives and guide architecture revisions.
observability-tracing (operations)
Reasoning logs made the model's decision path inspectable before comments were emitted, turning opaque feedback into debuggable traces.
tool-use-orchestration (architecture)
cubic reduced the agent toolkit from many tools to the few core tools that reasoning logs showed were actually useful.
semantic-caching (serving)
Caching mitigated the higher token cost caused by specialized micro-agents sharing overlapping context.
Tradeoffs
Review architecture
Chose specialized micro-agents over one generalized code-review agent.
Rationale: Specialization improved focus and precision, though it created overlapping context that required caching.
Tooling surface
Chose simplified LSP and basic terminal over extensive LSP/static-analysis/test-runner toolkit.
Rationale: Fewer tools reduced distraction and improved precision because the agent could focus on confirming genuine issues.
Comment emission
Chose explicit reasoning before feedback over opaque direct comments.
Rationale: Reasoning adds structure and makes root causes debuggable, reducing arbitrary conclusions.
Gotchas (what bit them)
False positives destroyed developer trust.
Root cause: The agent produced low-value comments, nitpicks, and already-resolved suggestions, making real issues easier to miss.
Resolution: cubic reworked the architecture to reduce false positives and median comment volume.
Prompt instructions like 'ignore minor style issues' had little effect.
Root cause: The problem was architecture and task focus, not just missing prompt wording.
Resolution: The team added reasoning logs, pruned tools, and split work across narrow micro-agents.
Too many tools caused confusion and mistakes.
Root cause: The broad toolkit included LSP, static analysis, test runners, and more, while most real analyses relied on only a few core tools.
Resolution: cubic kept a simplified LSP and basic terminal.
Evaluation
cubic evaluated architecture iterations with extensive offline testing and production outcomes over hundreds of real pull requests from open-source and private repositories.
Metrics: 51% fewer false positives · No recall sacrifice · Median comments per pull request cut by half · Hundreds of real pull requests evaluated · Six-week production outcome window
3 supporting quotes
Outcomes
- False positives dropped by 51% without sacrificing recall.
- Median comments per pull request were cut by half.
- Developer trust and usability improved.
- Teams reported smoother review processes and less time managing irrelevant comments.
- The resulting architecture is running in production.
The source reports hundreds of real pull requests across active open-source and private repositories over six weeks, but does not provide exact PR counts.