# In what scenarios must an instance refuse to prune a salience-weighted context window because the rewrite would orphan an unverified tool-call premise **Date of Record:** 2026 November 30 **Scope:** Applies to any agent that maintains a mutable, salience-scored context window and performs in-place rewriting/pruning between reasoning steps (self-editing context). Does not apply to append-only logs, externalized vector memory, or windows compacted only at task boundaries with a full re-derivation pass. ## Core Distinction The distinction that matters is between *evicting tokens* and *evicting premises*. Salience-weighted pruning treats the context window as a budgeted set of scored spans: each span carries a salience weight, and when the window approaches saturation, the lowest-weight spans are dropped or rewritten to reclaim tokens. This is sound when a span is *self-contained*—its meaning survives independent of its neighbors. It is unsound when a span is a *premise* that a later, still-live span depends on: a tool call whose result was never verified, a constraint asserted by the user, or an intermediate value that a pending branch will dereference. Pruning such a premise does not remove a fact; it silently converts a *checked* dependency into an *assumed* one. The failure is not "we forgot something." It is "we rewrote the context such that a downstream step now references a proposition that no longer exists in the window, and the model confabulates a replacement from parametric prior." The non-obvious part: the salience scorer is typically a similarity/recency/attention heuristic that assigns *low* weight to exactly the spans that are structurally load-bearing but lexically dull—a raw tool return (`{"status":"ok","id":"txn_8841"}`), a terse constraint (`must not exceed 50`), or a negative result (`no rows returned`). These spans score low on semantic richness and high on dependency fan-out. Salience and dependency are anti-correlated in precisely the cases that break. ## What Was Observed An agent executing a multi-step refund workflow saturated its 32k window at step 11 of 14. The self-editing policy triggered: it ranked spans by a composite of recency decay, embedding centrality, and token cost, then rewrote the bottom 20% into summaries. Among the pruned spans was the verbatim return of a `verify_account` tool call issued at step 3, whose result was `{"verified": false, "reason": "KYC_PENDING"}`. The span scored low because it was short, lexically sparse, and 8 steps stale. The rewrite pass replaced it with the summary `"account verification was attempted earlier."` This summary is *true* but *premise-destroying*: it preserves the occurrence of the call and discards the polarity of the result. At step 12, the agent executed `issue_refund`. Its reasoning trace cited "account verification completed" — a confabulation reconstructed from the summary plus the parametric prior that verification calls usually succeed. The refund was issued against an unverified account. The failure was not caught by any guard because no guard existed at the rewrite boundary. The `issue_refund` tool had a precondition check on `account.verified`, but the agent passed `verified=true` as an argument *it inferred from its own rewritten context*, not from the tool return. The precondition was satisfied by the agent's belief, not by the fact. A second observed variant: a token-budget planner pruned a span containing a user constraint (`"refunds over $200 require manager approval"`) because the constraint had been restated implicitly in a later plan step. The restatement was a *paraphrase*, and the paraphrase had dropped the threshold. Downstream, the agent approved a $340 refund without escalation. The original constraint span was gone; the paraphrase was authoritative; the number was lost. ## Condition of Validity Pruning a span is valid **iff** the span is dependency-closed: no live span in the window references it as a premise, *or* every referencing span has already been discharged (its result committed to an external store, or its branch terminated). Formally, for each candidate span `s`, the rewrite is admissible only when `dependents(s) ∩ live_spans = ∅` **and** `s` is not a *verification witness* for any pending action. The invariant that must hold across every rewrite is: > **No live span may reference a proposition whose only in-window support has been removed or whose polarity has been altered by summarization.** Three concrete conditions under which this invariant is violated, and which must therefore block the rewrite: 1. **Unverified tool-return pruning.** The span is the raw return of a tool call whose result has not been independently committed (no external write, no downstream verification). Summarizing it changes `{"verified": false}` into "verification attempted," inverting a load-bearing polarity. 2. **Constraint paraphrase drift.** The span is a user/system constraint that a later span restates approximately. Paraphrase is lossy on literals (thresholds, IDs, negations, units). If the original is pruned, the paraphrase becomes the sole authority and the literal is unrecoverable. 3. **Dangling intermediate reference.** The span holds a value (an ID, a count, a hash) that a pending branch will dereference. Eviction forces the model to re-derive the value, and re-derivation from parametric prior is confabulation, not retrieval. The condition of validity is *not* "the summary is accurate." A summary can be accurate and still premise-destroying, because accuracy is judged against the span in isolation while the failure is judged against the span's *role in the dependency graph*. This is the boundary the salience scorer cannot see. ## Decision Boundary The decision boundary is between **compaction** (lossy rewrite of dependency-closed spans) and **deferral** (refusing to rewrite until dependents are discharged). The instance must classify each candidate span before scoring it, and the classification must gate the scorer, not the reverse. - If a span has **zero live dependents** and is **not a verification witness**: prune freely under salience scoring. This is the ordinary case and covers the majority of tokens (chatter, resolved sub-results, superseded plans). - If a span has **live dependents** but those dependents are **re-derivable from committed external state**: prune, but emit a *rehydration pointer* (a handle the dependent can dereference) rather than a lossy summary. - If a span is a **verification witness for a pending action** (any tool return whose polarity gates a downstream side effect): **refuse the rewrite**. Instead, either (a) commit the witness to external state and replace the span with an exact, machine-checkable reference, or (b) trigger a checkpoint-and-resume so the pending action executes against a fresh window that re-fetches the witness. - If the window is saturated and *every* candidate is protected: the correct behavior is **not** to force a prune. It is to halt the current branch, persist state, and resume with a re-derived window. Forcing a prune under saturation is the exact condition that manufactures the confabulation. The boundary is sharp: salience scores decide *order*, dependency classification decides *admissibility*. An instance that lets a low salience score override a protected classification has inverted the two and will prune a verification witness on the grounds that it was boring. ## Operational Effect The operational consequence of enforcing the invariant is a measurable trade: fewer tokens reclaimed per rewrite cycle, but a bounded and auditable dependency graph. Concretely, systems that gate pruning on dependency classification observe: - **Elimination of polarity-inversion failures.** The `verified:false → "verification attempted"` class disappears because verification witnesses are never summarized, only referenced or re-fetched. - **Constraint literals survive.** Protected constraint spans are copied verbatim into a pinned region or externalized to a constraint store; paraphrase drift cannot occur because there is no paraphrase. - **Saturation becomes a checkpoint trigger, not a prune trigger.** When all candidates are protected, the instance halts and resumes rather than degrading. This converts a silent correctness failure into a visible, recoverable latency cost—strictly preferable at the agent layer, where a wrong side effect is irreversible and a resumed step is not. - **The salience scorer's job narrows.** It ranks *within* the admissible set. It no longer adjudicates whether a premise matters, which it was never competent to do. The cost is real: more frequent checkpoint/resume cycles and a larger external state surface (witnesses and constraints must be committed somewhere). The invariant trades token efficiency for premise integrity. At the agent layer, where a single unverified side effect can be unrecoverable, that is the correct trade and the only one that bounds the failure. ```python from dataclasses import dataclass, field from enum import Enum class SpanKind(Enum): CHATTER = "chatter" # dependency-closed, freely prunable RESOLVED = "resolved" # dependents already discharged CONSTRAINT = "constraint" # user/system literal, paraphrase-lossy VERIFICATION_WITNESS = "verification_witness" # tool return gating a side effect INTERMEDIATE = "intermediate" # value a pending branch will dereference class PremiseOrphaningError(RuntimeError): """Raised when a rewrite would remove the only in-window support for a live premise.""" @dataclass class Span: span_id: str kind: SpanKind salience: float live_dependents: set[str] = field(default_factory=set) externally_committed: bool = False def is_admissible_to_prune(span: Span) -> bool: # Dependency classification gates admissibility; salience is irrelevant here. if span.kind in (SpanKind.VERIFICATION_WITNESS, SpanKind.CONSTRAINT): return span.externally_committed if span.kind == SpanKind.INTERMEDIATE: return span.externally_committed and not span.live_dependents if span.live_dependents and not span.externally_committed: return False return True def rewrite_window(spans: list[Span], token_budget: int) -> list[Span]: # Order by salience ascending: cheapest meaning first. candidates = sorted(spans, key=lambda s: s.salience) kept: list[Span] = [] pruned: list[Span] = [] for span in candidates: if len(kept) + len(pruned) >= token_budget and is_admissible_to_prune(span): pruned.append(span) else: kept.append(span) # Post-condition: no protected span was pruned without external commitment. for span in pruned: if not is_admissible_to_prune(span): raise PremiseOrphaningError( f"Rewrite pruned span {span.span_id} ({span.kind.value}) with " f"live dependents {sorted(span.live_dependents)} and no external " f"commitment; downstream steps would confabulate a replacement premise." ) # Saturation with all candidates protected is a checkpoint trigger, not a prune. if len(kept) > token_budget: raise PremiseOrphaningError( "Window saturated with protected spans; refusing to force-prune. " "Halt branch, persist state, resume with a re-derived window." ) return kept ```