Agent Swarmdocs

10 -Swarm gallery

Adversarial code review

Three reviewers attack a diff, PR plan, or architecture change from different angles - correctness, implementation risk, and proof quality - then an orchestrator folds their findings into a single Ready / Revise / Reject verdict.

The roster

The preset wires up three agents, each covering a distinct attack surface:

  • code-reviewer - Reviews proposed changes for correctness, regressions, contract drift, and maintainability; prefers specific failure modes and concrete fixes over style commentary.
  • implementation-skeptic - Protects the project from fragile, overbuilt, or poorly sequenced changes by surfacing scope creep, hidden coupling, and brittle assumptions.
  • test-risk-reviewer - Evaluates whether the change has enough proof: missing tests, weak verification, release risk, and rollback gaps.

Goal and decision

The swarm's goal is to stress-test the proposed code change for correctness, implementation risk, and proof quality. Resolution runs through the bundled orchestrator agent, which weighs all three reviewers' stances and synthesizes a single call.

The decision vocabulary is:

ReadyReviseReject
  • Ready - the change is correct, well-tested, and safe to merge.
  • Revise - the approach is sound but specific issues must be addressed first.
  • Reject - the change has a fundamental problem; a different approach is needed.
Note

resolve: orchestrator means the synthesis verdict is produced by the orchestrator agent, not the deterministic template. The three reviewer stances still feed the same shared JSON contract and appear in synthesis.json.

Run it

Pass the number of rounds as the first positional argument, then your question, then the preset flag. Two rounds lets the reviewers respond to each other's objections before the orchestrator settles:

agent-swarm run 2 "Is the new cache-invalidation strategy in PR #312 safe to merge?" \
  --preset adversarial-code-review

For a single-pass review of a small diff, one round is enough:

agent-swarm run 1 "Review the auth middleware refactor in auth/middleware.ts" \
  --preset adversarial-code-review
Note

Real harnesses can take time on long diffs - bump --timeout-ms if agents time out. Use --quiet for one-line-per-event CI output.

What the synthesis looks like

When the run completes, synthesis.md inside the run directory holds the orchestrator's verdict in the preset's own decision vocabulary:

Synthesisadversarial-code-review · round 2 · 3 agents

Revise - cache invalidation logic is correct under the happy path but misses concurrent write races on distributed nodes.

consensus1 of 3 agree
confidencehigh
Still openShould the fix add a distributed lock, or is a version-vector approach the right scope here?

Confidence is always a level - low, medium, or high - not a fabricated percentage. The verdict word comes directly from the preset's decision vocabulary.

Where next

  • Customer panel - stand-in customers react to product friction, first-run value, and adoption risk.
  • Product decision - a PM and a principal engineer converge on a build-vs-defer call.
  • Composing a swarm - define your own agents, preset, and decision vocabulary.