# Under what conditions must an instance refuse a model-driven context-pruning decision because the pruned span is a load-bearing referent for a pending tool call **Date of Record:** 2026 November 23 **Scope:** Applies to any agent loop where the model itself emits prune/rewrite/evict directives over its own working context (relevance-scored eviction, summarization-in-place, span deletion) while at least one tool call is in flight or scheduled. Does not apply to append-only context growth, nor to external (harness-side) truncation that never consults the model's own relevance scores. ## Core Distinction The failure is not "the model forgot something." It is that the model's *relevance scorer and its own pending commitments are two different subsystems with no shared invariant*. A relevance score answers "is this span useful for reasoning about the current goal?" It does **not** answer "is this span the unique binding for an argument, identifier, or schema token that a tool call already emitted will dereference at execution time?" Self-editing context is safe only under the invariant that **every span referenced by an in-flight or queued tool call is pinned against eviction regardless of its relevance score**. Model-driven pruning routinely violates this because the pruned span is, by the scorer's own logic, low-relevance *now* — the model already "used" it to construct the call, so it scores as redundant. The span then disappears between emission and execution, and the executor either dereferences a dangling identifier or silently substitutes a hallucinated one. This is distinct from context-window saturation (a capacity problem) and from stale-memory drift (a temporal-validity problem). It is a **liveness problem across the emit→execute gap**: the referent must survive exactly as long as the call that binds it. ## What Was Observed A plan-and-execute agent issued a three-call batch: 1. `resolve_entity(name="Northwind Logistics")` → returned `entity_id="ent_7f3a"` 2. `fetch_contracts(entity_id="ent_7f3a", since="2024-01-01")` 3. `summarize(contract_ids=[...])` — arguments to be filled from call 2's output Between emitting call 2 and the executor dequeuing it, the model ran a self-pruning pass over its working context. The `resolve_entity` result block — a 40-token span containing `ent_7f3a` — scored 0.11 on relevance because the model's goal-state had already advanced to "fetch contracts," and the span contained no semantic content beyond an opaque ID. The pruner evicted it and replaced it with a one-line summary: *"Entity resolved (Northwind)."* The identifier was gone. The executor then dequeued call 2 with `entity_id="ent_7f3a"` intact — the *call* carried the literal. So far, no failure. The failure surfaced at call 3: the model, reconstructing arguments for `summarize`, needed the contract IDs that came back from call 2, but call 2's *response* had been evicted under the same low-relevance rule (opaque IDs again), leaving only *"Contracts fetched (3 found)."* The model, unable to dereference, **fabricated** three plausible contract IDs from the entity name — a fluent, schema-valid, entirely hallucinated payload that the downstream tool accepted without validation because the schema only checked string format. The observable signature is not an exception. It is a **schema-valid call with semantically wrong arguments**, traceable to a pruning event whose relevance score was correct by its own definition and catastrophic by the binding definition. ## Condition of Validity Model-driven pruning is valid **iff** the pruner's candidate set excludes any span that is the unique textual source of a token appearing in (a) a queued or in-flight tool call's arguments, (b) a tool response whose values are referenced by any not-yet-emitted call in the current plan, or (c) a schema/type declaration the pending call depends on. Formally, let `P` be the set of spans the model proposes to evict, and `B` the *binding closure*: the transitive set of spans that supply literal tokens to any live call or to any response the plan will still consume. The prune is admissible only if `P ∩ B = ∅`. Relevance scoring is irrelevant to this test — a span can score 0.0 and still be un-evictable because it is a referent. The trap: the model cannot reliably compute `B` from inside its own context, because `B` depends on the *plan's future dereferences*, which are themselves model-generated and mutable. A model that re-plans after pruning can retroactively create a dependency on a span it already deleted. Hence the invariant must be enforced **outside the scorer**, by the harness, using the executor's actual argument bindings — not the model's belief about them. ## Decision Boundary The boundary is not "prune vs. don't prune." It is **who owns the binding set**. - If the harness can enumerate live bindings from the executor queue and pin them, model-driven pruning is safe and should proceed — the model's relevance signal is genuinely useful for the unpinned remainder. - If bindings are only known to the model (e.g., the plan lives in natural language and dereferences are implicit), then *any* model-driven eviction of a span containing an opaque identifier, a returned value, or a schema token is unsafe and must be refused or deferred until the plan is quiescent. The refusal condition is sharp: **refuse the prune when the candidate span contains a token that matches the argument-binding pattern of any live call and the harness cannot independently confirm the binding is pinned.** A one-line summary that *drops* an opaque ID is the canonical unsafe rewrite; a rewrite that *preserves all opaque tokens verbatim* while compressing prose is safe. ## Operational Effect Without the pinning invariant, the system exhibits **silent argument corruption**: calls succeed, schemas validate, and the only signal is downstream semantic wrongness that is expensive to attribute because the pruning event and the fabrication event are separated by one or more tool round-trips. Post-hoc replay is unreliable because pruning is non-deterministic — re-running the same context yields a different eviction set, so the failure does not reproduce. The guardrail is a **binding-pinned context**: the executor publishes its live argument bindings and pending dereferences to the pruner as a protected set; the pruner may compress everything else but must treat protected spans as immutable and must preserve opaque tokens verbatim in any rewrite of a span adjacent to a live binding. When the model proposes a prune that touches the protected set, the harness refuses the specific eviction (not the whole pass), logs the refusal with the binding that justified it, and lets the model re-propose. This bounds the failure to a *deferred* prune rather than a *corrupted* call. ```python from dataclasses import dataclass, field from typing import Iterable class BindingInvariantViolation(RuntimeError): """Raised when a model-driven prune would evict a load-bearing referent.""" pass @dataclass class Span: span_id: str text: str relevance: float @dataclass class LiveCall: call_id: str arg_tokens: set[str] # literal tokens the executor will dereference @dataclass class ContextPruner: protected_tokens: set[str] = field(default_factory=set) def register_bindings(self, live_calls: Iterable[LiveCall]) -> None: for call in live_calls: self.protected_tokens |= call.arg_tokens def _span_is_load_bearing(self, span: Span) -> bool: # A span is load-bearing if it is the unique textual source of any # token a live call will dereference -- regardless of relevance score. return any(tok in span.text for tok in self.protected_tokens) def apply_prune(self, spans: list[Span], evict_ids: set[str]) -> list[Span]: kept: list[Span] = [] for span in spans: if span.span_id in evict_ids: if self._span_is_load_bearing(span): raise BindingInvariantViolation( f"refusing eviction of {span.span_id}: contains a token " f"bound by a live call (relevance={span.relevance:.2f}); " f"pin the binding or defer the prune until quiescent" ) continue kept.append(span) return kept def run_pruning_pass(pruner: ContextPruner, spans: list[Span], model_evict_ids: set[str]) -> list[Span]: try: return pruner.apply_prune(spans, model_evict_ids) except BindingInvariantViolation as exc: # Defer the offending eviction; keep the span, log, let model re-propose. offending = {s.span_id for s in spans if s.span_id in model_evict_ids and pruner._span_is_load_bearing(s)} deferred = model_evict_ids - offending print(f"[deferred prune] {exc}") return pruner.apply_prune(spans, deferred) ```