Cheat sheets

Debate, Roles and Review Panels

Run N agents for R rounds, split work into planner, executor, critic and verifier, and gate reviews with a quorum.

  • Concepts and terms
  • Tasks and commands
  • Annotated code
  • Diagrams
  • Comparisons
  • Defaults and numbers
  • Troubleshooting
  • Questions and tips

Source

Debate protocol#

1Each of N agentsproduces an initial answer to the question.2Round r = 2..Reach agent reads the other agents' round r-1answers.3Each agentcritiques the peers and gives an updated answer.4Every roundre-inject the question to stop topic drift.5After R roundsmajority-vote the final answers.6CostN agents × R rounds = N·R LLM calls with growingcontext.

Debate topologies#

FactorFull meshSparse star
Who reads whomEvery debater reads every peerSpokes read only the hub
Runnerfull_mesh_roundsparse_star_round
Ops per roundops += len(peers) per debaterSpokes read only the hub
N=5, R=360 critique ops12 critique ops
Proposals at N=5, R=31515
Main riskConvergence collapseHub failure
Fix for the riskRequired disagreement roundsRotate or use multiple hubs

Four canonical roles#

Planner
reads the goal. Output is a structured plan or spec.
Executor
reads one plan step at a time. Output is the artifact.
Critic
reads the artifact against the plan. Output is accept/reject with reasons.
Verifier
runs a deterministic check. Output is pass/fail with evidence.
Critic vs verifier
a critic is subjective and LLM-based. A verifier is code. They are not the same role.
Communicative dehallucination
the executor asks the relevant role by name when a detail is missing.
SOP pattern
Code = SOP(Team). Each role has a strict input/output schema.

Role pipeline in code#

spec = planner(user_wish)Spec with signature and 3 tests
art = executor(spec)Artifact holds a code string
crep = critic(spec, art)checks def, return, task name
vrep = verifier(spec, art)runs the tests
exec(art.code, ns, ns)verifier sandbox namespace
fn = ns.get(spec.task_name)no callable gives a failure
got = fn(*args)compare with expected
if crep.approved and vrep.passed:ship only when both pass

Software team architecture#

plan_requestsubtaskdiff_readyreview_neededapprovedtest_passedclientGitHub issueURLmodelArchitectplan withsubtasks +interfacesqueueTask boardfile / RedisprocessCoders A to Dworktree +Daytona eachprocessMergecoordinatorthree-way mergemodelReviewerapprove orrequest changesprocessTesterclean sandboxclientOpen PRplan_requestsubtaskdiff_readyreview_neededapprovedtest_passedclientGitHub issue URLmodelArchitectplan with subtasks+ interfacesqueueTask boardfile / RedisprocessCoders A to Dworktree + DaytonaeachprocessMerge coordinatorthree-way mergemodelReviewerapprove or requestchangesprocessTesterclean sandboxclientOpen PR

Review panel API#

TaskCode
Reject fake locationsvalidateFinding(raw, files)
Group by file, line, ruleaggregate(reviews, files, quorum = 2)
Run reviewers with limitsrunPanel(reviewers, budget, timeoutMs = 1000)
Score against labelsevaluate(predicted, expected)
Group keyJSON.stringify([f.file, f.line, f.rule])
Run the demonode cli.ts --input samples/review.json
Import a PR report--pr-report /path/review.json

Numbers to remember#

5 agents, 5 rounds
25 calls at growing context.
NLSOM
societies of 129 members.
MAST
1642 failures traced. 21.3% were verification gaps.
Validation loop
accuracy from 10% to 70%. A 7× gain from one role.
Token amplification
a 40-turn single-agent run becomes 160 turns across four roles.
Rubric
25 pass@1, 20 speedup, 20 review quality, 20 token efficiency, 15 coordination.

Task board messages#

CommandWhat it does
plan_requestArchitect posts the plan with a DAG of subtasks
subtaskArchitect sends one subtask and its files to a coder
diff_readyCoder posts the patch to merge_coord
review_neededMerge coordinator sends the merged diffs to the reviewer
review_feedbackReviewer routes change requests back to the coder
approvedReviewer passes the diff to the tester
test_passedTester tells pr_opener to open the PR
test_failedTester sends stacktraces back to the coder

Quorum and budget code#

if (ids.has(review.reviewer)) throw new Error("duplicate reviewer");
if (seen.has(key)) continue;one vote per reviewer per group
status: g.supporters.length >= quorum ? "consensus" : "needs-review",
disagreement: new Set(g.severities).size > 1,
if (spent + r.cost > budget) {trace status "budget-skipped"
controller.abort();deadline hit, status "timeout"
precision: p.size ? hits / p.size : 0,zero predictions give 0

Defaults and numbers#

SettingDefaultNote
Debate rounds cap33 rounds capture most of the gain
Debate agents cap5Beyond 5, context bloat and cost dominate
Original Du et al. setupN=3, R=2Chosen due to cost
Critic revision rounds2Then escalate to human
CLI quorum2Supporters needed for consensus
CLI budget3Units of reviewer cost
CLI timeout1000Milliseconds per reviewer
maxTurns12Coordinator turn limit

Failure modes#

SymptomCauseFix
All agents echo the loudest oneSycophancy cascadeOne agent must argue the counter-position
Answers leave the questionTopic drift over many roundsRe-inject the question every round
Cost over 10× one CoT callCompute blowup, N·R callsCap rounds at 3 and agents at 5
All agree on the same wrong answerSame prompt and model for allUse diverse prompts and models
One bad agent corrupts allBad hub in a star topologyRotate or use multiple hubs
Plausible code ships with a bugAll-LLM pipeline, no verifierAdd a code-based pass/fail check
Reviewer approves a known bugFalse approvalProbe with an injected bug, tune below 5%

Questions#

Why debate over self-consistency?
Samples from one model share errors. Debate decorrelates them.
Agents or rounds?
Each alone plateaus. Both together give the big jumps.
When does debate hurt?
Latency-sensitive UX, cost-sensitive scale and simple lookups.
Is consensus truth?
No. Consensus measures support, not truth.
Five reports from one reviewer?
Support counts distinct reviewer ids, not reports.

Ship checklist#

  • Use at least two different base models in the debate pool.
  • Log every round. Hidden rounds cannot be debugged or audited.
  • Keep at least one deterministic verifier. Never all-LLM.
  • Run the critic first and the verifier second.
  • Freeze the plan once coders start. A replan is a separate event.
  • The reviewer cannot approve its own changes.