Consensus flow details
Consensus flow details
/consensus is a thin driver over the consensus-step tool; the multi-round loop lives in
the core state machine (core/consensus-loop.js). Each round: Claude commits a blind verdict,
the server fans out to the panel (dispatch_peers) and parses each voice's verdict + critical
issues, Claude adjudicates (accept/dismiss/defer, every dismiss carries a reason), then revises
the plan. The loop converges only when at least quorumFloor peers respond, every responding
peer APPROVES, none REJECT, zero accepted critical issues remain, and Claude's adjudicated
verdict is APPROVE - so Claude cannot self-approve. quorumFloor is consensus.quorumFloor
(default 2) capped at the size of the selected panel and never below 1, so a one-peer panel
needs that one peer. An errored or unparsed review does not count as responding. The cap is
consensus.maxRounds (default 5).
Critical-issue taxonomy (the closed set every critical issue is tagged with, parsed by
parseReview in core/provider.js):
security- auth, secrets, injection, data exposure, privilege boundarycorrectness- wrong behaviour, broken invariant, missing case, race conditionscope- undefined boundary, missing acceptance criteria, deliverable unclearambiguity- reference too vague to act on, contradictory steps, missing contextperformance- latency, throughput, resource use, scaling limitops- rollback, observability, deploy, migration, on-call surface
Verdict shape. The shared review prompt (one byte-identical string per provider) instructs every
reviewer to end with a machine-readable VERDICT: APPROVE (or VERDICT: REQUEST_CHANGES /
VERDICT: REJECT) line on its own, then list issues as - [category] description. parseReview
tolerates real-world drift across models: it first strips fenced code blocks (so a quoted/echoed
template cannot hijack the verdict), then resolves the verdict via a 4-tier ladder - the VERDICT:
sentinel, a same-line Verdict: <token>, a Verdict heading with the token on a following line, or a
bare standalone token line - and joins a category heading to a description on the next line when the
bullet itself has none. A repeated issue (same category, same text ignoring case and whitespace)
is kept once: models often list their issues in the body and again after the VERDICT: line, and the
repeat must not inflate the issue count. An unparsed verdict stays null (treated as "not APPROVE"), so a parse miss
never false-approves into convergence.
Stage 2 (anonymized peer cross-review) is not part of the current loop. Earlier revisions ran
a command-layer Stage 2 (each reviewer scored the others' anonymized answers, with a shuffle
mapping in the report). The engine-driven rewrite removed it: the core loop has no Stage 2 model,
and keeping it in command prose re-introduced the duplication the rewrite eliminated. If anonymized
cross-review proves valuable it returns as an engine feature (a new consensus-step action), not as
prose.