code-review-adversarial

One reviewer isn't enough. Adversarial multi-agent code review — a committee of specialist reviewers that catches what single-pass AI review misses.
English | 中文
Quick start:
git clone https://github.com/yuefanxiao/code-review-adversarial.git
ln -s "$(pwd)/code-review-adversarial" ~/.agents/skills/code-review-adversarial # ZCode
ln -s "$(pwd)/code-review-adversarial" ~/.claude/skills/code-review-adversarial # Claude Code
ln -s "$(pwd)/code-review-adversarial" ~/.codex/skills/code-review-adversarial # Codex
Then just ask your agent: "adversarial review PR #123" or "深度评审这个 PR".
What is this?
An Agent Skill that turns a single AI coding agent into a committee of specialized reviewers. Instead of one agent giving you one opinion, this skill dispatches 2–4 reviewers from distinct stances, converges their findings, and outputs a structured verdict.
Before vs After
Single-agent review:
"The CAS implementation looks correct. The
WHERE updated_at=?condition properly guards against concurrent updates. Looks good ✅"
Adversarial committee:
Root-cause auditor (P1): The DECISIONS doc claims "no transaction infrastructure exists" but
repository.goalready has 3Transaction()call sites — the fix rationale is based on a factual error.Regression auditor (P1): The new
update_maskfield is server-enforced as required. The shipped frontend doesn't send it yet → every existing edit will 400 until the frontend is updated.Devil's advocate: 9 attack vectors tested, no blocking defects found. CAS token source is correctly client-side (
cmd.ExpectedUpdatedAt), not the internal read snapshot — no TOCTOU.Verdict: ready-with-fixes — fix the DECISIONS doc error + track frontend update as follow-up.
How it works

PR diff
│
▼ Phase 0: Baseline — lock merge-base, prevent diff pollution
▼ Phase 1: Classify — detect PR type → select personas
▼ Phase 2: Dispatch — 2-4 specialized reviewers in parallel
▼ Phase 3: Triage — discard out-of-scope, uncited, layer-violating findings
▼ Phase 4: Converge — independent→accept, conflict→arbitrate → verdict
│
▼ Output: markdown / JSON / PR comment (asks first)
PR-type-aware
The review focus adapts to what kind of PR it is:
| PR type | What gets reviewed | What gets skipped |
|---|---|---|
| Feature | Better alternatives? Design soundness? Edge cases? | — |
| Bugfix | Root cause vs symptom? Regression risk? | "Consider alternative architecture" (scope creep) |
| Refactor | Behavior preserved? Tests unchanged? | New feature suggestions |
| Design-heavy (proto/API only) | AIP compliance? Backward compat? Error codes? | Implementation correctness (no code yet) |
| Performance | Benchmark evidence? Hot path? Trade-off acceptable? | — |
11 Reviewer personas

| Persona | Role | Used for |
|---|---|---|
| Design auditor | Evaluate better alternatives | Feature |
| Correctness auditor | Logic, edge cases, concurrency | Feature / Perf |
| Root-cause auditor | Root cause vs symptom | Bugfix |
| Regression auditor | New defects introduced | Bugfix |
| Behavior auditor | Semantic equivalence | Refactor |
| Test coverage auditor | Test adequacy | Refactor |
| Security auditor | Vulnerabilities, secrets | Chore / Feature |
| Performance auditor | Benchmark validity | Performance |
| Devil's advocate | Adversarial — assume defects exist | Optional (high-stakes) |
| Contract auditor | AIP, compatibility, completeness | Design-heavy |
| Simplification auditor | Unnecessary complexity | Optional (all types) |
Installation
Prerequisites
Any agent runtime that supports the Agent Skills format.
Install via symlink (recommended — share one copy across agents)
git clone https://github.com/yuefanxiao/code-review-adversarial.git
cd code-review-adversarial
# Pick your agent(s):
ln -s "$(pwd)" ~/.agents/skills/code-review-adversarial # ZCode
ln -s "$(pwd)" ~/.claude/skills/code-review-adversarial # Claude Code
ln -s "$(pwd)" ~/.codex/skills/code-review-adversarial # Codex
Install via copy
cp -r code-review-adversarial ~/.agents/skills/ # or ~/.claude/skills/, ~/.codex/skills/
Usage
Just describe what you want — the skill auto-triggers on:
- "adversarial review PR #123"
- "深度评审 PR #123"
- "对抗复核 this PR"
- "does this PR have a better alternative?"
- "契约评审"
Options
| Parameter | Default | Description |
|---|---|---|
reviewers |
auto by PR type | Manually specify: design,security,devils-advocate, etc. |
devils-advocate |
off | Enable devil's advocate persona |
max-rounds |
2 | Convergence round limit |
format |
markdown | markdown / json / comment (asks before posting) |
pr-type |
auto-classify | Override: feature / bugfix / refactor / ... |
File structure
code-review-adversarial/
├── SKILL.md # Main workflow (326 lines)
├── DESIGN.md # Full design rationale + research
├── README.md # This file
├── assets/ # README images (before-after, pipeline, committee)
├── references/
│ ├── type-playbooks.md # Per-PR-type checklists
│ ├── reviewer-personas.md # Persona index + shared constraints
│ ├── convergence-protocol.md # Convergence rules
│ └── personas/ # One file per persona (15-73 lines)
│ ├── design.md
│ ├── correctness.md
│ ├── root-cause.md
│ ├── regression.md
│ ├── behavior.md
│ ├── test-coverage.md
│ ├── security.md
│ ├── perf.md
│ ├── devils-advocate.md
│ ├── contract.md
│ └── simplification.md
└── examples/
└── bugfix-cas-review.md # Sample review output
Design principles
- Specialized committee, not pro/con debate — Collaborative > adversarial (NeurIPS 2025)
- PR type determines focus — Feature → L3; Bugfix → L2 (L3 forbidden); Refactor → invariants
- Free exploration + finding-type constraints — Explore freely, but out-of-diff findings must be "diffusion-impact" only
- Independent Triage Filter — Primary precision lever (~51% false-positive reduction)
- Convergence by finding type — Independent → accept; intersection → high-confidence; conflict → arbitrate
- Merge-base baseline lock — Prevents diff pollution (the #1 real-world lesson)
See DESIGN.md for full rationale and ROADMAP.md for what's coming.
Compatibility
| Agent | Status |
|---|---|
| ZCode | ✅ Native |
| Claude Code | ✅ Via ~/.claude/skills/ |
| Codex | ✅ Via ~/.codex/skills/ |
| Cursor | 📋 Planned |
| Gemini CLI | 📋 Planned |
| GitHub Copilot | 📋 Planned |
Platform-agnostic — works with GitHub, GitLab, Gitea, or any git-based PR system.
Examples
See examples/ for real review outputs:
bugfix-cas-review.md— A concurrency-fix PR reviewed by root-cause + regression auditors + devil's advocate
Contributing
Contributions welcome! See CONTRIBUTING.md.
Areas where help is especially appreciated:
- New persona templates (e.g., accessibility, i18n, database migration)
- Benchmark data (single-agent vs committee detection rates)
- Platform-specific integration guides (Cursor, Gemini CLI, Copilot)
No comments yet
Be the first to share your take.