跪拜 Guibai
← All articles
Artificial Intelligence

Anthropic's Six-Layer Review Pipeline: How Claude Code Reviews AI-Generated Code at Scale

By oil欧哟 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Teams that let agents write most of their code hit a review bottleneck that human-only processes can't scale past. This workflow shows a working trade-off: automate the routine, keep humans for judgment and accountability, and design for fast rollback rather than perfect upstream review.

Summary

Anthropic's Claude Code team writes roughly 90% of its code with Claude, so line-by-line human review is impossible. Between June and September, merged PRs more than doubled, yet the share of reverted PRs fell by over 40%. The team did this not by abandoning review but by automating most of it and tuning the flow around human time, with rollbacks as a safety net.

The review process has six layers: pre-PR validation where Claude proves its work with runnable checks, an AI review on every PR with cross-checking from multiple agents, a blocking security review, standard automated checks, risk-based human approval (risk level determined by the change, not the author), and a merge queue with feature flags and staged rollout. A dedicated revert mechanism catches anything that slips through.

Humans stay in the loop for architecture decisions, auditing high-risk code, verifying evidence, and taking responsibility. The team also solved the convergence problem: a single PR once looped 50 times overnight between author and reviewer agents. Limiting review rounds, reviewing only new diffs after the first round, and having agents fix issues overnight cut average review rounds sharply. Production incidents feed an eval set that re-scores the review system daily.

Takeaways
— 90% of Claude Code's code is written by Claude; merged PRs doubled between June and September while the revert rate fell by over 40%.
— Daily merged changes in Anthropic's monorepo rose from about 2,500 in May to over 30,000 in September.
— The review pipeline has six layers: pre-PR validation, AI review with cross-checking, security review, automated checks, risk-based human approval, and merge queue plus feature flags.
— Pre-PR validation requires Claude to run tests, builds, or screenshot comparisons, and a fresh-context subagent reviews the diff to avoid the author's own biases.
— Each PR gets a Claude review that analyzes the diff against the codebase and intent; the share of PRs receiving substantive comments rose from 16% to 54% since the research preview.
— Multiple agents run in parallel to find bugs, a voting mechanism filters false positives, and style nitpicks are filtered out after A/B testing.
— Risk level is based on the change, not the author; only trusted authors get relaxed approval, and bot approvals never count as human approval.
— A PR approval is valid only for the current commit; new commits require re-approval.
— A merge queue re-runs tests on main with each change applied, and feature flags let the team roll out internally first.
— A PR once looped 50 times overnight between author and reviewer agents; convergence mechanisms (limit rounds, review only new diffs) are now in place.
— About 59% of code flagged by the review system already existed in the first review round, so later rounds mostly surface old bugs.
— Production incidents and rollbacks feed an eval set that re-scores the review system daily, and human reactions to review comments measure noise.
— The team treats 'whoever merges owns it' as the norm, relying on small diffs, revertible everything, and public channels to keep quality.
Conclusions

Reframing code review as 'what could go wrong' instead of 'has a human read it' shifts effort to the failure modes that actually matter, making automation a natural fit.

The convergence problem is a real cost of agent-authored code: an author agent and reviewer agent can ping-pong indefinitely, so limiting rounds is as important as catching bugs.

Using production incidents as an eval set ties the review tool's quality directly to real-world failures, which is a more grounded metric than synthetic benchmarks.

Human review becomes a scarce resource reserved for irreplaceable judgment, which inverts the traditional workflow where humans read everything and machines only catch what they're told.

Concepts & terms
CLAUDE.md
A project instruction file that gives Claude Code context about the tech stack, coding conventions, goals, and non-goals. It is loaded into every review, so keeping it short and referencing other docs is recommended for large codebases.
REVIEW.md
A file code owners use to tell the review tool which issues matter most in their modules. It defines project-level errors, limits nitpicking, lists paths to ignore, and requires specific file/line references in review comments.
Merge queue
A mechanism that queues merged PRs in order and re-runs tests against the latest main branch combined with the change, preventing two independently passing PRs from breaking main when merged together.
Feature flag
A runtime toggle that lets you ship code while keeping it disabled for most users. It enables internal-only rollout and instant disabling without redeploying if something goes wrong.
Guardrail metric
A metric that acts as a boundary condition, like a highway crash barrier. Here, revert rate and failure rate are guardrails: if they rise while you speed up review, you've only shifted human time to firefighting.
From the discussion
Featured comments
去吧波波鸟

Using a fresh-context sub-agent for review is a brutal move; reviewing your own work indeed easily leads you astray.

See top comments, translated →
Source: juejin.cn ↗ Google Translate ↗ Backup ↗