← All Posts

Multi-Agent Deliberation: When Agreement Is the Bug

The most dangerous output my AI agent produces isn’t an error. Errors are easy. Linters catch syntax mistakes, test suites catch regressions, and the 95 hooks I built catch except: pass and force pushes. The dangerous output is a confident, well-reasoned recommendation that happens to be wrong.

I asked a single agent to review an API endpoint for security issues. The agent checked authentication, validated input sanitization, and verified CORS headers. Clean bill of health. A second agent, prompted separately as a penetration tester, found the endpoint accepted unbounded query parameters that could trigger a denial-of-service through database query amplification. The first agent never checked because nothing in its evaluation framework treated query complexity as a security surface.

That gap is structural. No amount of prompt engineering fixes it because the limitation isn’t in the prompt. The limitation is in having one perspective evaluate a multi-dimensional problem.

I built a multi-agent deliberation system to close the gap. Agents with different personas research independently, debate findings, and reach consensus through structured voting. The system runs 141 tests, enforces context isolation between agents, and uses a two-gate validation architecture that blocks premature agreement.

TL;DR

Single-agent AI systems have a structural blind spot: they cannot challenge their own assumptions. A Ralph loop running Sonnet produces code at $10/hour, but every blind spot in the model ships at the same rate. Multi-agent deliberation forces independent evaluation from multiple perspectives before any decision locks. My implementation uses 10 research personas, a 7-phase state machine, and two validation gates (consensus + pride check) running on Claude Code hooks. The system triggers on low-confidence decisions (below 0.70) and adds roughly 3x token cost per deliberation. For security decisions, architecture choices, and anything irreversible, that cost pays for itself the first time it catches something a single agent missed. For documentation fixes and routine edits, skip deliberation entirely.


The Night My Agents Agreed to Break Everything

February 2026. A Tuesday. I asked my agent to “investigate improving the hook dispatch system” and walked away to make coffee. The agent assessed its own confidence at 0.58 (below the 0.70 threshold), which triggered deliberation. The system spawned 3 research agents. Each research agent evaluated the problem, found sub-problems, and spawned their own research agents. Those agents spawned more.

Seven minutes later: 23 active agent processes. $4.80 in API credits burned. The ~/.claude/state/ directory filling with JSON state files as each agent dutifully persisted its findings. Token consumption climbing at roughly $0.70 per minute with no sign of convergence.

The recursion guard I’d built for the quality system tracked depth (parent spawns child, child spawns grandchild) but not width (parent spawns 12 children who each spawn 12 more). The depth limit of 3 never triggered because the agents spread horizontally. I killed the processes manually and stared at the state files.

Every agent agreed the hook dispatch system needed improvement. Every agent proposed reasonable-sounding changes. Not one agent questioned whether the investigation itself was scoped correctly. Twenty-three agents achieving consensus on the wrong question.

The fix took 20 minutes: a spawn budget that tracks total active children per parent, capped at 12. The deeper lesson took longer. The infrastructure acceleration curve I’d documented made the deliberation system possible to build in 2 weeks, precisely because the hook infrastructure already existed. But fast construction doesn’t prevent structural failures. The progression from single-agent RAG pipelines to autonomous systems follows a predictable arc. Multi-agent deliberation sits at the end for a reason: you only build it after a single agent confidently ships the wrong answer.

Agreement, not disagreement, was the dangerous failure mode.


Anatomy of a Deliberation

The system has two structural components: a state machine that sequences the work and two validation gates that prevent bad consensus from shipping.

The State Machine

Seven phases, each gated by the previous:

IDLE -> RESEARCH -> DELIBERATION -> RANKING -> PRD_GENERATION -> COMPLETE
                                                                    |
                                                              (or FAILED)

RESEARCH: Independent agents investigate the topic. Each agent gets a different persona (Technical Architect, Security Analyst, Performance Engineer, and 7 others). Context isolation ensures agents cannot see each other’s findings during research. L0 (system rules) and L1 (project context) are shared. L2 (agent-specific focus) is private. L3 (domain patterns) loads relevant pattern libraries per persona.1

DELIBERATION: Agents see all research findings and generate alternatives. The Debate agent identifies conflicts between perspectives. The Synthesis agent combines non-contradictory findings.

RANKING: Each agent scores every proposed approach across 5 weighted dimensions:

Dimension Weight
Impact 0.25
Quality 0.25
Feasibility 0.20
Reusability 0.15
Risk 0.15

Weighted scores aggregate into a consensus score. The threshold is task-adaptive: 0.85 for security decisions, 0.80 for architecture, 0.70 default, 0.65 for refactoring, 0.50 for documentation.2

The Two Gates

Gate 1: Consensus Validation (PostToolUse:Task hook). Four checks run after every deliberation agent completes:

  1. Phase must have reached at least RANKING
  2. Minimum 2 agents completed (configurable)
  3. Consensus score meets the task-adaptive threshold
  4. If any agent dissented, their concerns must be documented

Failing any check blocks the deliberation from advancing.3

Gate 2: Pride Check (Stop hook). Five quality checks run before the session can close:

  1. Diverse Methods: Multiple unique personas represented
  2. Contradiction Transparency: Dissents have documented reasons
  3. Complexity Handling: At least 2 alternatives generated
  4. Consensus Confidence: Score classified as strong (above 0.85) or moderate (0.70-0.84)
  5. Improvement Evidence: Final confidence exceeds initial confidence

The two-gate architecture catches problems at different stages. Gate 1 prevents premature convergence during the process. Gate 2 prevents shipping results that look complete but lack rigor.


Intelligence Analysts Had This Problem First

I built the deliberation system in January 2026. Two weeks later, I found Richards Heuer’s Psychology of Intelligence Analysis on a reading list about structured decision-making. Chapter 8 describes Analysis of Competing Hypotheses (ACH): analysts evaluate evidence against multiple hypotheses simultaneously, rather than building a case for their preferred conclusion.4

The parallel was uncomfortable. Heuer’s framework, published in 1999 for the CIA, addressed the same structural failure I’d been debugging: smart people converging on a single explanation because they never forced themselves to evaluate alternatives.

Here is what ACH looks like in practice. An intelligence analyst investigating a suspected weapons program doesn’t ask “is this a weapons program?” (confirmation bias). Instead, the analyst lists every plausible hypothesis (weapons program, civilian research, dual-use facility), evaluates each piece of evidence against every hypothesis, and identifies which evidence best distinguishes between hypotheses.

My system does the same thing with different vocabulary. Three agents evaluate a proposed database schema change. Agent A (Technical Architect) writes: “Schema is clean, normalized to 3NF.” Agent B (Performance Engineer) writes: “Query patterns will require joins across 4 tables on every read.” Agent C (Security Analyst) writes: “PII fields aren’t encrypted at rest.” Same schema, three different evaluations, three pieces of distinguishing evidence. The ranking phase evaluates the proposed approach against these independent assessments the way ACH evaluates hypotheses against evidence.

I didn’t design the system from Heuer’s framework. I reinvented a subset of ACH by trial and error, then found out someone had already written the textbook. The honest version is more useful than the flattering one: arriving at the same architecture independently confirms the underlying problem is real, not theoretical.


Why Agreement Is the Dangerous Failure Mode

Charlan Nemeth studied minority dissent from 1986 through her 2018 book In Defense of Troublemakers. Groups with dissenters make better decisions than groups that reach quick agreement. The dissenter doesn’t need to be right. The act of disagreement forces the majority to examine assumptions they would otherwise skip.5

James Surowiecki’s The Wisdom of Crowds identifies four conditions for wise group decisions: diversity of opinion, independence of judgment, decentralization, and a mechanism for aggregation.6 Violate independence (let agents see each other’s work during research) and you get herding. Violate diversity (use identical prompts for every agent) and you get echo chambers.

I tested the independence condition directly. Two agents evaluating the same deployment strategy with visibility into each other’s findings: Agent A scored risk at 0.45. Agent B saw that score and produced 0.48. Same agents without visibility: 0.45 and 0.72. The gap between 0.48 and 0.72 is the cost of herding. Agent B’s independent assessment flagged a container orchestration risk that disappeared when social pressure entered the evaluation.

Recent work confirms both patterns hold for LLM agents. Choi et al. at NeurIPS 2025 found that majority voting among independently prompted agents captures most of the quality gains from multi-agent systems.7 Kaesberg et al. at ACL 2025 quantified the split: voting improves reasoning tasks by 13.2%, while consensus protocols improve knowledge tasks by 2.8%.8 This suggests the choice should depend on task type. That’s why my system uses task-adaptive thresholds instead of a single consensus number.

Wu et al. tested whether LLM agents can genuinely debate and found that without structural incentives for disagreement, agents converge toward the most confident-sounding initial response regardless of correctness.9 Wynn et al. went further: debate can be actively harmful. Models shift from correct to incorrect answers in response to peer reasoning, even when stronger models outnumber weaker ones.10 Liang et al. identified the root cause as “Degeneration-of-Thought”: once an LLM establishes confidence in a position, self-reflection cannot generate novel counterarguments, making multi-agent evaluation structurally necessary.11

My system addresses independence through context isolation (L2 layers are agent-private during research). Diversity comes from 10 distinct personas with different evaluation priorities. Aggregation uses weighted scoring across 5 dimensions rather than simple voting. The structural incentive for disagreement is weaker: I track whether dissent is documented but don’t reward agents for dissenting. The conformity detection module attempts to address this gap, with mixed results.


Detecting Fake Disagreement

The conformity module tracks patterns that suggest agents are agreeing without genuine evaluation. Documented concerns that repeat the same language across agents, scores that cluster suspiciously close to the threshold, or unanimous support from every persona (a Security Analyst and a Performance Engineer rarely agree on everything) trigger warnings.

What it catches: boilerplate dissent (agents copying each other’s concern language), score clustering (every agent scoring within 0.3 points on a 10-point scale), and absent minority perspectives (unanimous approval from personas with conflicting priorities).

An example from my logs: five agents evaluated an authentication refactor. All five scored security risk between 7.1 and 7.4. The conformity detector flagged the cluster. When I re-ran with fresh context isolation (clearing L2 caches), the scores spread to 5.8-8.9. The original cluster reflected shared context contamination, not genuine agreement.

What it misses: sophisticated agreement where agents genuinely evaluate from their persona’s perspective but happen to reach the same conclusion for different reasons. The module cannot distinguish real consensus from herding when the reasoning looks independent. I tried training a classifier on examples of genuine vs. manufactured agreement, but the training data was too small (under 50 deliberation sessions) and the signal too weak. The conformity detector catches the obvious cases and misses the subtle ones.

The honest assessment: conformity detection adds a useful sanity check on the 10-15% of deliberations where agents converge too quickly. For the other 85-90%, the consensus and pride check gates provide sufficient validation. I considered building a more sophisticated conformity system and decided the engineering effort wouldn’t match the marginal improvement.


What Didn’t Work

Dead End 1: Free-Form Debate Rounds

The first version had agents write long-form rebuttals to each other’s findings: 3 rounds of back-and-forth text. I watched a deliberation about database indexing strategy play out over 7,500 tokens of debate. Round 1: genuine disagreement about composite vs. single-column indexes. Round 2: restated positions with minor elaboration. Round 3: nearly identical arguments wrapped in different words. The signal peaked in round 1 and degraded from there.

Token cost per deliberation hit $2-4, and the useful information density dropped with each round. The fix: structured dimension scoring replaced free-form debate. Agents score proposals across 5 dimensions with numeric values instead of writing essays. Cost and time dropped by roughly 60%, and the quality of the final ranking actually improved because numeric scores force precision that prose obscures.

Dead End 2: Depth-Based Recursion for Deliberation

The infinite spawn incident exposed a fundamental modeling error. The recursion guard tracked depth: parent at depth 0 spawns child at depth 1, child spawns grandchild at depth 2, maximum depth 3. But deliberation agents should fan out wide (10 research agents at the same level), not deep (one agent spawning one child spawning one grandchild). The depth limit of 3 never triggered because 23 agents at depth 1 is still “depth 1.”

The fix was a spawn budget model: deliberation agents inherit the parent’s depth instead of incrementing it, and share a total budget of child spawns capped at 12. The budget model maps to the actual failure mode (too many total agents) rather than a proxy metric (too many nesting levels). Agent lineage is tracked in a JSON file so the budget persists across async agent completions.12 This width constraint is the agent equivalent of the separation rule in Reynolds’ boids algorithm — the force that prevents agents from crowding onto the same sub-problem.

Dead End 3: Single Validation Gate

The first implementation ran one validation hook at session end, combining consensus checks with quality checks. The failure mode appeared within the first week. An agent completed deliberation with a 0.52 consensus score—below the 0.70 threshold. It then continued on unrelated tasks for 20 minutes before the session-end hook flagged the failure. Twenty minutes of work built on a foundation that hadn’t passed validation.

Splitting into two gates fixed the timing problem. Gate 1 (consensus validation) runs as a PostToolUse:Task hook, catching bad consensus immediately after the deliberation agent completes. Gate 2 (pride check) runs at session end, catching quality issues that accumulated across steps. Two hooks at different lifecycle points match how failures actually occur: some are instant (bad score) and some are gradual (low diversity, missing dissent documentation).


The Honest Math

Deliberation costs tokens. Each research agent processes roughly 5,000 tokens of context and generates 2,000-3,000 tokens of findings. With 3 agents (minimum for useful deliberation) that’s 15,000-24,000 additional tokens per decision. With 10 agents (full research panel), roughly 50,000-80,000 tokens.

At Opus pricing ($15/$75 per million tokens), a 3-agent deliberation costs approximately $0.68-0.90. A 10-agent deliberation costs $2.25-3.00. My system triggers deliberation on roughly 10% of decisions (those scoring below 0.70 confidence), so the amortized cost across all decisions is $0.23-0.30 per session.

Whether that’s worth it depends on what a bad decision costs. A missed security vulnerability in a production deployment costs hours of incident response. A bad architecture choice costs weeks of refactoring. A typo in documentation costs nothing.

The confidence module determines which decisions trigger deliberation. Four dimensions (ambiguity, complexity, stakes, and context dependency) each produce a 0-1 score. Multiple dimensions need to score high for the overall confidence to drop below 0.70 and trigger deliberation. Single-dimension problems (“this is complex but unambiguous”) stay above the threshold and skip deliberation.13


Two Agents, One Rule

You don’t need 10 research personas, 8 Python modules, or 141 tests to get value from multi-agent deliberation. Start with 2 agents and 1 rule: agents must evaluate independently before seeing each other’s work.

Minimum Viable Deliberation

Decision arrives
  |
  v
Confidence check: is this risky, ambiguous, or irreversible?
  |
  ├── NO  -> Single agent decides (normal flow)
  |
  └── YES -> Spawn 2 agents with different system prompts
             Agent A: "Argue FOR this approach"
             Agent B: "Argue AGAINST this approach"
             |
             v
             Compare findings
             |
             ├── Agreement with different reasoning -> Proceed
             ├── Genuine disagreement -> Investigate the conflict
             └── Agreement with same reasoning -> Suspect herding

The decision flowchart above covers 80% of the value. Here is the minimal implementation:

# Minimum viable deliberation: 2 agents, 1 rule
def deliberate(decision_description):
    agent_for = spawn_agent(
        f"Argue FOR this approach: {decision_description}",
        persona="advocate"
    )
    agent_against = spawn_agent(
        f"Argue AGAINST this approach: {decision_description}",
        persona="critic"
    )

    if same_reasoning(agent_for, agent_against):
        return "WARNING: Suspect herding. Verify independently."
    elif genuine_conflict(agent_for, agent_against):
        return "Investigate the specific disagreement."
    else:
        return "Proceed. Independent agreement with different reasoning."

Everything else adds incremental improvement: the 5-dimension ranking, task-adaptive thresholds, conformity detection. The core insight remains simple: two independent perspectives catch failures that one perspective misses.

Single Agent vs. Multi-Agent: What Changes

Scenario Single Agent Multi-Agent Deliberation
Security review “Architecture looks clean” Agent A: “Clean.” Agent B: “Missing rate limiting on admin”
Schema design “Normalized to 3NF” Agent A: “Clean.” Agent B: “4-table joins on every read”
Dependency upgrade “Tests pass, ship it” Agent A: “Tests pass.” Agent B: “Changelog shows breaking API change in v3”
Documentation update “README updated” All agents agree (correct skip, below confidence threshold)

What to Deliberate

Deliberate Skip
Security architecture Documentation typos
Database schema design Variable renaming
API contract changes Log message updates
Deployment strategies Comment rewording
Dependency upgrades Test fixture updates

Testing Deliberation

The system runs 141 tests across three layers:14

  • 48 bash integration tests: Hook syntax validation, consensus flow, pride check gates, recursion guard enforcement, and cross-config compatibility
  • 81 Python unit tests: All 7 library modules (state machine, confidence, context isolation, ranking, agents, conformity, PRD generation)
  • 12 end-to-end tests: Full pipeline simulation from confidence assessment through PRD output

Testing a system for disagreement requires testing two categories. The happy path: agents disagree productively and reach consensus. The failure paths: agents converge too quickly, never converge, or exceed spawn budgets. The E2E tests simulate each scenario with deterministic agent responses, verifying that the two gates catch every documented failure mode.

Start with the 2-agent pattern. Add complexity when the 2-agent version misses something specific. Every additional agent, threshold, and validation gate in my system exists because the simpler version failed at a specific task. Your failures will be different, and the system you build to catch them should reflect your failures, not mine.


Key Takeaways

  • Agreement is the dangerous failure mode. Single agents cannot challenge their own assumptions. Two independent agents with different evaluation priorities catch structural blind spots that quality gates and philosophy cannot address. The metacognitive programming layer adds individual-agent self-monitoring; deliberation adds inter-agent cross-checking. Both layers are necessary.
  • Two gates beat one. Consensus validation during the process catches problems early. Pride check at session end catches problems that accumulated across steps. Splitting validation into two hooks at different lifecycle points matches how failures actually occur.
  • Deliberate selectively. The confidence module triggers deliberation on roughly 10% of decisions. Deliberating everything wastes tokens. Deliberating nothing misses the decisions where independent perspectives matter most.

FAQ

How much does multi-agent deliberation cost per decision?

A 3-agent deliberation costs approximately $0.68-0.90 in API tokens at Opus pricing (15,000-24,000 additional tokens). A full 10-agent panel costs $2.25-3.00. The system triggers deliberation on roughly 10% of decisions, so the amortized cost across all decisions is $0.23-0.30 per coding session.

Does every decision need deliberation?

No. The confidence module scores decisions across four dimensions (ambiguity, complexity, stakes, context dependency). Only decisions scoring below 0.70 overall confidence trigger deliberation, roughly 10% of total decisions. Documentation fixes, variable renames, and routine edits skip deliberation entirely. Security architecture, database schema changes, and irreversible deployments trigger it consistently.

Can this work with models other than Claude?

The architectural principles (independent evaluation, structured voting, two-gate validation) apply to any LLM capable of following persona instructions and producing structured output. The implementation uses Claude Code hooks and the Task tool for agent spawning, which is Claude-specific infrastructure. Porting to another model requires replacing the spawning mechanism and prompt templates while keeping the state machine, ranking system, and validation gates.

How do you test a system designed to produce disagreement?

141 tests across three layers: 48 bash integration tests verify hook behavior (consensus flow, pride check gates, recursion guards), 81 Python unit tests cover each library module with deterministic inputs, and 12 end-to-end tests simulate full deliberation pipelines with fixed agent responses. The E2E tests cover both success paths (productive disagreement reaching consensus) and failure paths (premature agreement, failure to converge, budget exhaustion).

What is the latency impact of deliberation?

A 3-agent deliberation adds 30-60 seconds of wall-clock time (agents run sequentially through the Task tool). A 10-agent deliberation adds 2-4 minutes. The consensus and pride check hooks each run in under 200ms. The primary bottleneck is LLM inference time per agent, not the orchestration overhead. For decisions that warrant deliberation, the latency is acceptable because the alternative (discovering the mistake later) costs significantly more time.


References


  1. Author’s deliberation context isolation module. Implementation in ~/.claude/lib/deliberation/context_isolation.py. Four isolation levels: L0 (system rules, shared), L1 (session context, shared), L2 (agent focus, private), L3 (domain patterns, per-persona). 

  2. Author’s deliberation configuration. Thresholds defined in ~/.claude/configs/deliberation-config.json

  3. Author’s post-deliberation consensus hook. Implementation in ~/.claude/hooks/post-deliberation.sh, wired to PostToolUse:Task. 

  4. Heuer, Richards J., Psychology of Intelligence Analysis, Center for the Study of Intelligence, CIA, 1999. Chapter 8: Analysis of Competing Hypotheses. Full text (CIA)

  5. Nemeth, Charlan, In Defense of Troublemakers: The Power of Dissent in Life and Business, Basic Books, 2018. See also: Nemeth, C. J., “Differential Contributions of Majority and Minority Influence,” Psychological Review, 93(1), 23-32, 1986. 

  6. Surowiecki, James, The Wisdom of Crowds: Why the Many Are Smarter than the Few, Doubleday, 2004. Chapter 1. 

  7. Choi, H. K., Zhu, X., and Li, S., “Debate or Vote: Which Yields Better Decisions in Multi-Agent Large Language Models?” NeurIPS 2025 Spotlight. arXiv:2508.17536

  8. Kaesberg, L. B. et al., “Voting or Consensus? Decision-Making in Multi-Agent Debate,” Findings of ACL 2025, pp. 11640-11671. ACL Anthology

  9. Wu, H., Li, Z., and Li, L., “Can LLM Agents Really Debate? A Controlled Study of Multi-Agent Debate in Logical Reasoning,” arXiv:2511.07784, 2025. 

  10. Wynn, A., Satija, H., and Hadfield, G., “Talk Isn’t Always Cheap: Understanding Failure Modes in Multi-Agent Debate,” arXiv:2509.05396, 2025. 

  11. Liang, T. et al., “Encouraging Divergent Thinking in Large Language Models through Multi-Agent Debate,” EMNLP 2024, pp. 17889-17904. ACL Anthology

  12. Author’s recursion guard. Spawn budget model in ~/.claude/hooks/recursion-guard.sh. Agent lineage tracked in ~/.claude/state/agent-lineage.json

  13. Author’s confidence module. Implementation in ~/.claude/lib/deliberation/confidence.py. Four dimensions: ambiguity, complexity, stakes, context dependency. 

  14. Author’s test suite. 48 bash tests in ~/.claude/tests/test-deliberation-pipeline.sh, 81 Python tests in ~/.claude/tests/test_deliberation_lib.py, 12 E2E tests in ~/.claude/tests/test_deliberation_e2e.py

Related Posts

Why My AI Agent Has a Quality Philosophy

My Claude Code agent inherited every sloppy human habit at machine speed. I built 3 philosophies, 150+ quality gates, an…

27 min read

Metacognitive AI: Teaching Your Agent Self-Evaluation

Most agent instructions define behavior. The missing layer teaches self-evaluation. False evidence gates, seven named fa…

23 min read

The Ralph Loop: How I Run Autonomous AI Agents Overnight

I built an autonomous agent system with stop hooks, spawn budgets, and filesystem memory. Here are the failures and what…

8 min read