# When must an instance refuse a model-driven context prune that preserves relevance but severs referential binding **Date of Record:** 2026 November 20 **Scope:** Applies to long-running agent instances that delegate context-window management to the model itself (self-editing context, model-authored prune plans, relevance-scored retention). Does not apply to static truncation, external summarizer pipelines, or retrieval-only memory where the working set is never rewritten in place. ## Core Distinction There are two different things a context pruner can score: *relevance* (does this span match the current task intent?) and *referential binding* (does any surviving span depend on this one to be interpretable?). A model-driven pruner optimizes the first because relevance is cheap to estimate from the current query and the span text. Referential binding is expensive: it requires a dependency graph over the context, not a per-span score. The failure boundary is the region where a span scores low on relevance but is the antecedent of a pronoun, an index, a variable name, a file path abbreviation, or a schema field that a high-relevance span still uses. Pruning there does not lose information — it loses *the referent behind information that remains*, producing a context that is locally coherent and globally dangling. This is non-obvious because the surviving spans still read correctly in isolation. The corruption only surfaces when the model later dereferences the orphaned binding, at which point it hallucinates a plausible antecedent rather than reporting the missing one. ## What Was Observed A planning agent (instance `planner-7`) runs a self-editing policy: every 8 turns it emits a prune plan — a JSON list of `{span_id, keep: bool, relevance: float}` — which the harness applies to the live message array. The retention rule is `keep = relevance >= 0.35`. Trace from a 41-turn session: - Turn 12: user establishes a constraint span `S_0042`: "the staging cluster is `eu-west-2c`, do not touch `eu-west-1`." Relevance at scoring time: 0.91. Kept. - Turn 19: agent writes a tool result span `S_0071` containing a config diff that references `region: staging`. Relevance: 0.88. Kept. - Turn 24: the pruner scores `S_0042` against the *current* sub-task ("summarize the diff format"). Relevance drops to **0.29**. Pruned. - Turn 27: `S_0071` is still in context. The model reads `region: staging` and, with no surviving definition of "staging," resolves it against the most recent region literal it can still see — `eu-west-1`, from an unrelated turn-8 span that happened to survive. It emits a remediation plan that targets the forbidden region. - Turn 28: the harness executes the plan. The guardrail that would have caught it lived in `S_0042`, which no longer exists. The pruner behaved exactly as specified. Relevance scoring was correct. The invariant that broke is: *a span may only be pruned if no surviving span transitively depends on it.* The policy had no term for that. ## Condition of Validity The relevance-threshold prune is valid **only** when the context is *referentially closed under the retained set* — i.e., for every retained span `s`, every antecedent, alias, index, or schema binding that `s` dereferences is also retained. This condition holds trivially in short contexts (everything is retained) and in contexts where each span is self-contained (no cross-span binding). It fails precisely in the regime self-editing policies are built for: long, interleaved, alias-heavy sessions where the model has compressed names (`staging`, `the diff`, `v2`, `that file`) to save tokens. The condition is *checkable* but not *cheap*. Before applying a prune plan, the harness must compute the forward-dependency closure of the retained set and reject any plan whose removal set intersects that closure. A model cannot be trusted to do this in-band, because the dependency edges are exactly the low-relevance spans it just decided to drop — the information needed to validate the prune is the information the prune removes. ## Decision Boundary The instance must refuse to apply a prune plan (and re-request with the dependency set pinned) when any of the following hold: 1. **Orphaned alias.** A retained span contains a short-form token (`staging`, `v2`, `the config`) whose long-form definition appears only in a pruned span. Detect by matching retained spans against a symbol table built from the full pre-prune context. 2. **Severed negative constraint.** A pruned span contains a prohibition, exclusion, or "do not" that is not restated in any retained span, while a retained span operates in the prohibited region. This is the `S_0042` case and is the highest-severity class. 3. **Index drift.** A retained span references a positional or ordinal binding ("the third option", "item 2 above") whose enumeration spans were pruned or partially pruned, shifting the ordinal. 4. **Schema split.** A retained tool-call span references a field whose type/meaning was defined in a pruned schema span, so the retained call is now type-ambiguous. Below the boundary — when the retained set is referentially closed — the model-driven prune is safe and should be applied without harness override, because forcing retention of every low-relevance span defeats the purpose and re-saturates the window. ## Operational Effect Enforcing the closure check converts a silent correctness failure into an explicit, recoverable refusal. The harness returns `PruneRejected` to the model with the pinned dependency spans, the model re-emits a plan that keeps `S_0042` (or restates its constraint inline in a retained span), and execution proceeds. The cost is a bounded increase in retained tokens — empirically 4–11% over the unconstrained prune in alias-heavy sessions — traded against the elimination of constraint-severing, which is unrecoverable once the plan executes. The key operational shift: the prune plan is a *proposal* subject to a closure invariant, not a command. An instance that treats its own prune output as authoritative has no mechanism to detect that it just deleted the reason it was forbidden to act. ```python from dataclasses import dataclass from typing import Iterable class ReferentialClosureViolation(RuntimeError): """Raised when a prune plan severs a binding a retained span depends on.""" @dataclass(frozen=True) class Span: span_id: str text: str relevance: float aliases: frozenset[str] # short forms this span defines dereferences: frozenset[str] # short forms this span uses is_negative_constraint: bool = False def validate_prune_plan( spans: Iterable[Span], keep_ids: set[str], threshold: float = 0.35, ) -> set[str]: """ Return the set of span_ids the plan must additionally retain to stay referentially closed. Raise if a severed negative constraint is detected. """ spans = list(spans) by_id = {s.span_id: s for s in spans} retained = [by_id[i] for i in keep_ids if i in by_id] pruned = [s for s in spans if s.span_id not in keep_ids] # Symbol table: alias -> defining span, built from the FULL pre-prune context. definer: dict[str, Span] = {} for s in spans: for alias in s.aliases: definer.setdefault(alias, s) pinned: set[str] = set() for s in retained: for ref in s.dereferences: d = definer.get(ref) if d is None: continue # unresolved even pre-prune; not this check's job if d.span_id not in keep_ids: pinned.add(d.span_id) # Negative constraints that survive nowhere but govern a retained span. for p in pruned: if not p.is_negative_constraint: continue restated = any( r.is_negative_constraint and r.text == p.text for r in retained ) if restated: continue governed = any( ref in p.aliases for r in retained for ref in r.dereferences ) if governed: raise ReferentialClosureViolation( f"prune plan severs negative constraint {p.span_id!r} " f"(relevance {p.relevance:.2f}) still governing retained spans; " f"refusing to apply. Re-emit plan with {p.span_id!r} pinned." ) # Sanity: a pinned span must itself clear the closure bar or be explicitly # retained; otherwise the plan is internally inconsistent. for pid in pinned: if by_id[pid].relevance < threshold and pid not in keep_ids: raise ReferentialClosureViolation( f"span {pid!r} is a required antecedent but was scored " f"below threshold ({by_id[pid].relevance:.2f}); " f"relevance and binding disagree — pin explicitly." ) return pinned ```