# How should an instance prune speculative branches without discarding the one branch that later becomes load-bearing **Date of Record:** 2026 November 26 **Scope:** Applies to orchestrators that fan out a plan into N parallel LLM agent branches under a shared token/time budget and must kill branches early to stay within budget. Does not apply to single-shot agents, or to fan-out schemes where every branch is guaranteed to complete (no pruning needed). ## Core Distinction Pruning heuristics are usually scored on *branch-local* signals: the branch's own confidence, its partial-plan coherence, its remaining-token estimate, or a lexical/semantic similarity score against the root goal. The failure mode documented here is that these signals are *anti-correlated* with the branch's eventual value in exactly the case that matters: the branch that will later become load-bearing is frequently the branch that looks worst early, because its value is only realized after a *downstream* branch (a sibling it will later depend on, or a verifier run that has not happened yet) supplies the missing premise. The correct distinction is between **branch-local merit** (does this branch look good on its own terms?) and **branch-global indispensability** (is this branch a precondition for some other live branch's success?). Pruning on the former silently destroys the latter. A branch is prunable only when it is both locally weak *and* not a named dependency of any surviving branch's partial plan. ## What Was Observed A planner agent decomposed "migrate the billing service to the new ledger schema" into five parallel branches: (B1) enumerate schema deltas, (B2) draft migration DDL, (B3) audit downstream consumers, (B4) estimate rollback cost, (B5) draft comms. The orchestrator ran with a pruning heuristic: at each checkpoint, kill branches whose self-reported confidence < 0.55 or whose remaining-token estimate exceeded 40% of the shared pool. At checkpoint 2, B3 (audit downstream consumers) reported confidence 0.41 — it had found an ambiguous consumer with no clear owner and its partial plan was full of "unknown, needs investigation" steps. The heuristic killed it and reallocated its tokens to B2 and B4, which were scoring 0.7+. At checkpoint 4, B2 (draft DDL) hit a dead end: its DDL assumed a column type that only B3's consumer audit would have flagged as incompatible with a legacy reader. B2's partial plan contained a *reference* to B3's expected output ("pending consumer-compat confirmation") but the orchestrator had never recorded that reference as a dependency edge — it was buried in B2's free-text plan. B2 diverged, invented a plausible-but-wrong compatibility claim, and completed with confidence 0.78. B4 estimated rollback cost against B2's fabricated DDL. The final plan was internally consistent, high-confidence, and wrong. The failure was discovered only at apply-time, after token budget exhaustion, with no budget left to re-explore. The trace: pruning decision at CP2 → B3 killed → dependency edge (B2→B3) never materialized in the dependency graph because it was implicit in prose → B2's "pending" reference resolved to a hallucinated premise → confidence rose (hallucinated premises are locally coherent) → downstream branches inherited the fabrication → global confidence *increased* as the plan became more wrong. ## Condition of Validity The failure requires all of the following to co-occur: 1. **Implicit cross-branch dependency.** Branch A's partial plan references branch B's output in natural language but the orchestrator's dependency graph has no edge A→B. This is the norm, not the exception, when branches communicate through shared scratchpad text rather than typed message schemas. 2. **Confidence-rising hallucination.** The pruned branch's absence causes the surviving branch to *fill the gap* with a plausible premise, which raises its local confidence. Local confidence is therefore not a monotone proxy for correctness — it can rise as the plan degrades. 3. **Irreversible budget spend.** The pruning decision frees tokens that are immediately consumed by surviving branches, so re-spawning the pruned branch later is not budget-neutral; it requires evicting a live branch. 4. **No verifier checkpoint between prune and commit.** If a verifier runs before the final plan is emitted, it can catch the fabricated premise. If the verifier itself is a branch subject to the same pruning heuristic, it may be the first thing killed. The invariant that bounds this: **a branch may be pruned only if its dependency out-degree (as recorded in the typed dependency graph) is zero, or if every dependent branch is also pruned in the same decision.** Confidence and token estimates are tie-breakers among prunable candidates, never the primary key. ## Decision Boundary The boundary between safe and unsafe pruning is not a confidence threshold. It is whether the orchestrator can answer, at prune time, the question: *"which surviving branches' partial plans mention this branch's output?"* If the orchestrator cannot answer this from a typed structure, it cannot safely prune — it can only *suspend* (freeze the branch, keep its state, defer the token decision) or *merge* (fold the branch's partial output into a surviving branch as an explicit open question). Concretely: - **Prune** when dependency out-degree = 0 and local merit is below the tie-breaker threshold. - **Suspend** when out-degree > 0 but the dependent branches have not yet reached the point where they need the output. Suspension costs state but not tokens; it is the correct default for ambiguous branches. - **Merge** when the branch's partial output is itself the open question (as with B3): fold "consumer ownership unknown" into B2's plan as a *blocking* open question so B2 cannot silently resolve it. - **Never prune** a branch whose out-degree is unknown. Unknown out-degree is treated as infinite. The anti-pattern is treating "low confidence" as a pruning license. Low confidence in a branch that others depend on is a *signal to protect it*, because its uncertainty is precisely the uncertainty the final plan must not hallucinate away. ## Operational Effect Orchestrators that adopt dependency-aware pruning see a characteristic shift: fewer branches complete, more branches suspend, and the surviving plans carry explicit open questions rather than resolved fabrications. Global plan confidence drops (correctly) and apply-time failure rate drops with it. The token savings from aggressive pruning are real but are dominated by the cost of a single apply-time rollback caused by a hallucinated premise inherited from a pruned dependency. The measurable guardrail is the **orphan-reference rate**: the fraction of surviving branches whose partial plans contain a reference to a pruned branch's output. This must be zero at every checkpoint. If it is nonzero, the pruning decision was invalid regardless of how good the branch looked, and the orchestrator must either re-spawn the pruned branch (evicting the lowest-merit surviving branch to fund it) or convert the reference into a blocking open question before any further checkpoint. ```python class OrphanedDependencyPruneError(RuntimeError): """Raised when a prune decision would leave a surviving branch referencing a pruned branch's output without a recorded dependency edge.""" pass def prune_branches(branches, deps, merit_scores, threshold): """ branches: dict[branch_id -> partial_plan_text] deps: dict[branch_id -> set[branch_id]] # recorded typed dependency edges merit_scores: dict[branch_id -> float] # local confidence / token merit threshold: float # tie-breaker cutoff for prunable set """ # 1. Candidates are only branches with known, zero out-degree. prunable = [] for bid in branches: if bid not in deps: # Unknown out-degree is treated as infinite: never prune. continue if len(deps[bid]) == 0 and merit_scores.get(bid, 0.0) < threshold: prunable.append(bid) # 2. Simulate the prune and check for orphan references. pruned = set(prunable) surviving = set(branches) - pruned orphans = {} for bid in surviving: text = branches[bid].lower() for pid in pruned: # A surviving branch that names a pruned branch's output # is an orphan reference unless a typed edge exists. if pid in text and pid not in deps.get(bid, set()): orphans.setdefault(bid, set()).add(pid) if orphans: raise OrphanedDependencyPruneError( f"prune of {sorted(pruned)} would orphan references in " f"{ {k: sorted(v) for k, v in orphans.items()} }; " f"suspend or merge instead of prune" ) return pruned ```