v3/docs/adr/ADR-333-efficiency-first-orchestration-prehoc-failure-inference.md
Status: Proposed
Authors: claude (dream-cycle agent, 2026-07-30)
Date: 2026-07-30
Related issues: dream-cycle 2026-07-30 (#TBD)
Supersedes: none — extends ADR-026 (3-tier model routing) and ADR-322 (provenance typing)
Two Grade-A papers published July 29, 2026 challenge Ruflo's current swarm-invocation policy:
"Two Calls Beat Five Agents" (arXiv 2607.26922): On Qwen2.5-7B, 2-call self-refinement achieves 86.2% GSM8K accuracy at 7.4× lower token usage than a 5-agent pipeline (86.7% accuracy). The accuracy gap is 0.5 pp; the cost gap is 7.4×. For tasks within the capability range of the current model, multi-agent spawning is net-negative on value-per-token.
HalluProp — Pre-hoc Failure Risk Inference (arXiv 2607.26836): Semantic misalignment between agent roles and tasks causes hallucinations to propagate along agent communication chains. HalluProp's pre-task topology risk analysis achieves 84.6% average AUROC for fault localization at 65× the speed of post-hoc methods, sub-second per assessment.
Ruflo's CLAUDE.md currently prescribes "AUTO-INVOKE SWARM when task involves 3+ files" and maxAgents: 8 unconditionally. This policy ignores task-level capability proportionality, leaving 3–7× token efficiency on simple tasks.
ADR-026 added cost-tier routing (deterministic/Haiku/Sonnet). This ADR adds a pre-tier efficiency gate that considers whether spawning agents at all is warranted.
hooks pre-taskBefore routing to any agent tier, estimate task propagation risk:
{ risk_score: 0.0–1.0, recommendation: "self-refine" | "haiku" | "swarm", reasoning: string }risk_score < 0.3 AND file_count <= 2 → recommend self-refine.swarm/routing-decisions.jsonl for SONA training inputImplementation target: v3/@claude-flow/hooks/src/workers/pre-hoc-inference-worker.ts
hooks routeExtend hooks route with --efficiency-mode flag:
Feature gate: CLAUDE_FLOW_FEATURE_EFFICIENCY_ROUTING=1
Dry-run mode: --efficiency-dry-run logs recommendations without applying them.
performance benchmarkAdd --suite efficiency to the performance benchmark command:
hooks/, swarm/, or @claude-flow/cli/src/commands/Positive:
Negative / risks:
hooks pre-task for every invocation (must stay <50ms to not block CLI)CLAUDE_FLOW_FEATURE_EFFICIENCY_ROUTING=1 gate adds configuration surfaceMitigation:
.swarm/routing-decisions.jsonl for tuningmaxAgents globally: Blunt; doesn't route by task complexity.