# Where must an instance bound model-driven pruning when relevance-scored eviction deletes the antecedent that licenses a later tool call **Date of Record:** 2026 December 2 **Scope:** Applies to long-running agent instances that self-edit their own context window via a model-driven pruner (an LLM call that scores spans for relevance and evicts low-scoring ones) mid-execution. Does not apply to fixed-window truncation, host-side summarization that preserves a structured scratchpad, or retrieval-augmented designs where evicted spans remain re-fetchable from an external store. ## Core Distinction The failure mode is not "the pruner deleted something important." It is subtler: **relevance scoring is computed against the current subgoal, but the evicted span is an *antecedent*—a fact, tool result, or constraint whose only consumer is a future action that has not yet been generated.** A span can score near zero against the present query and still be load-bearing for an action three steps downstream. Model-driven pruning optimizes for *present relevance*; execution correctness depends on *future dependency*. These are different orderings, and the pruner has no signal for the second. The invariant that must hold: **any span that establishes a precondition, permission, identifier binding, or negative constraint for an action still reachable in the plan must survive eviction regardless of its relevance score.** Relevance is a sufficient condition for retention, never a necessary one. A pruner that treats low relevance as sufficient for eviction is unsound. ## What Was Observed A tool-using agent was tasked with reconciling a set of invoices against a purchase-order ledger. Early in the run it called `fetch_po(po_id="PO-4417")`, which returned a record containing, among other fields, `currency: "EUR"` and `status: "superseded_by: PO-4417-R2"`. Three steps later, after fetching line items and a tax table, the agent invoked a pruner pass to reclaim context. The pruner scored spans against the active subgoal ("compute line-item totals") and evicted the `PO-4417` record as low-relevance—it contained no line items. Two steps after that, the agent called `post_adjustment(po_id="PO-4417", amount=..., currency="USD")`. The currency was wrong (`USD` instead of `EUR`), and the PO was superseded—the adjustment should have targeted `PO-4417-R2`. Both errors trace to the same eviction: the span that bound the currency and the supersession edge was gone, and the model, forced to emit a currency argument, defaulted to its prior (USD) rather than admit uncertainty. The pruner had executed exactly as specified. The specification was unsound. The trace showed a clean signature: eviction event → later tool call with a *plausible but unbound* argument → no schema violation (USD is a valid currency code) → no error raised → silent corruption of downstream state. Schema validation cannot catch this because the argument is well-typed; it is merely wrong. ## Condition of Validity Model-driven relevance pruning is sound only under the conjunction: 1. **Evicted spans are recoverable.** Either they remain in an external store the agent can re-query, or the pruner emits a pointer (span id + retrieval key) that survives in the retained context. If eviction is destructive and non-recoverable, no relevance score can justify it. 2. **The plan is closed under the retained context.** Every argument the agent can still emit must be bound by a span that survives pruning. This requires the pruner to reason over the *reachable action set*, not the current subgoal. 3. **Unbound-argument emission is detectable.** The tool-call layer must reject or flag arguments that lack a surviving binding—i.e., the agent must be able to distinguish "I know this is EUR" from "I am guessing USD." Violating (1) makes every eviction a potential silent loss. Violating (2) makes the pruner's score orthogonal to correctness. Violating (3) removes the only backstop that would have caught the observed failure. ## Decision Boundary The boundary is drawn at the moment the pruner must choose between two eviction policies: - **Relevance-only eviction** is permissible when the plan is *shallow and closed*—the agent will not emit any tool call whose arguments depend on spans older than the pruning horizon. In practice this means single-turn or strictly sequential tasks where each step's inputs are fully re-derivable from the immediately preceding tool result. - **Dependency-preserving eviction** is mandatory when the plan is *deep or branching*—any task where a future action's arguments, permissions, or constraints were established by an earlier span. Here the pruner must classify spans by *dependency role* (antecedent vs. incidental) before scoring, and antecedents are pinned regardless of score. The non-obvious part: **the pruner cannot make this classification from the span text alone.** It must be given the reachable action set (the plan frontier) and, for each reachable action, the set of argument slots that require binding. A span is an antecedent iff it binds a slot for some reachable action. Relevance scoring then applies only to the residual (incidental) spans. This inverts the naive pipeline: dependency analysis precedes scoring, not the reverse. ## Operational Effect When the boundary is crossed—relevance-only pruning on a deep plan—the observable effect is **silent argument fabrication**: the agent emits well-typed but ungrounded tool arguments, downstream state is corrupted, and no exception fires because every layer validated its local contract. The corruption surfaces only at reconciliation, often after the agent has checkpointed and the original span is unrecoverable. The guardrail is a two-phase pruner with a pinned-antecedent set and a binding-completeness check at the tool-call boundary. The check is cheap: for each emitted argument, assert a surviving binding exists; if not, raise rather than emit. The following is the minimal enforcement: ```python from dataclasses import dataclass, field from typing import Optional class UnboundArgumentError(RuntimeError): """Raised when a tool call emits an argument with no surviving context binding.""" pass @dataclass class Span: span_id: str text: str binds: set[str] = field(default_factory=set) # argument slots this span grounds @dataclass class Context: retained: list[Span] = field(default_factory=list) evicted: dict[str, Span] = field(default_factory=dict) # recoverable store def bindings_for(self, slot: str) -> Optional[Span]: for span in self.retained: if slot in span.binds: return span return None def prune(ctx: Context, reachable_slots: set[str], relevance: dict[str, float], threshold: float) -> Context: """Dependency-preserving eviction: pin antecedents, score only the residual.""" pinned, residual = [], [] for span in ctx.retained: if span.binds & reachable_slots: pinned.append(span) # antecedent: survive regardless of score else: residual.append(span) survivors = pinned + [s for s in residual if relevance.get(s.span_id, 0.0) >= threshold] evicted = {s.span_id: s for s in ctx.retained if s not in survivors} return Context(retained=survivors, evicted={**ctx.evicted, **evicted}) def emit_tool_call(ctx: Context, tool: str, args: dict[str, str], required_slots: dict[str, set[str]]) -> dict[str, str]: """Reject any argument whose slot lacks a surviving binding.""" for slot in required_slots.get(tool, set()): if slot not in args: continue if ctx.bindings_for(slot) is None: # Backstop: recoverable store may still hold it; if not, hard fail. recovered = next( (s for s in ctx.evicted.values() if slot in s.binds), None ) if recovered is None: raise UnboundArgumentError( f"tool={tool} slot={slot!r} value={args[slot]!r} has no surviving " f"or recoverable binding; refusing to emit fabricated argument" ) # Recoverable: re-pin and proceed, never emit blind. ctx.retained.append(recovered) return args # Reproduction of the observed failure, now bounded: ctx = Context(retained=[ Span("s1", "PO-4417 currency=EUR status=superseded_by PO-4417-R2", binds={"currency", "po_target"}), Span("s2", "line items for PO-4417", binds={"line_items"}), ]) # Pruner scores s1 low against 'compute totals' and would evict it: ctx = prune(ctx, reachable_slots={"currency", "po_target"}, relevance={"s1": 0.05, "s2": 0.91}, threshold=0.3) assert ctx.bindings_for("currency") is not None # pinned as antecedent # If a buggy pruner had dropped s1 entirely, the emit boundary catches it: broken = Context(retained=[Span("s2", "line items", binds={"line_items"})]) emit_tool_call(broken, "post_adjustment", {"currency": "USD"}, required_slots={"post_adjustment": {"currency", "po_target"}}) ```