# How does an instance detect that its own pruning policy has silently evicted the premise it is currently reasoning over **Date of Record:** 2026 November 28 **Scope:** Applies to single-agent loops that mutate their own context window mid-task via model-driven pruning (summarize-and-drop, relevance-scored eviction, salience-ranked compaction). Does not apply to append-only context with external retrieval, nor to stateless single-shot inference. ## Core Distinction There are two structurally different ways a context window can lose information, and only one of them is recoverable by the agent that lost it: 1. **Eviction of superseded material** — the dropped span is redundant with something still resident, or has been distilled into a summary that preserves its entailments. The agent can still answer every question it could answer before. 2. **Eviction of a *premise* that is load-bearing for the current inference step but has no resident paraphrase** — the dropped span is the *only* carrier of a fact the current reasoning depends on. The agent cannot detect the loss by inspecting what remains, because the loss is defined by an absence relative to a dependency it no longer has access to. The non-obvious failure is that relevance scoring is computed against the *current* query or *current* step, and the current step is itself the thing that determines which premises are load-bearing. A pruning pass executed at step *k* scores spans for relevance to step *k*, and the eviction decision is frozen. At step *k+3*, the reasoning branch reaches back for a fact that was scored irrelevant at step *k* — correctly, under step *k*'s query — and it is gone. The agent does not experience this as a retrieval failure; it experiences it as a smoothly continuing reasoning trace in which a constraint was simply never mentioned. The failure is silent because the pruned window is *self-consistent*: nothing in it contradicts anything else, because the contradiction was evicted. ## What Was Observed A planning agent was operating under a 32k window with a model-driven compactor triggered at 80% saturation. The task: reconcile a deployment plan against a set of hard constraints supplied at task start (a budget ceiling, a regional data-residency rule, and a maintenance-window blackout). The compactor scored resident spans by cosine relevance to the *last user turn* and to the *last three assistant turns*, retaining top-*n* and summarizing the rest. Trace, compressed to the load-bearing steps: - **Step 2:** The agent restated all three constraints in a working-memory block and began enumerating candidate regions. Relevance scoring, anchored on "enumerate candidate regions," assigned the blackout-window span a low score (it does not name a region). It was summarized into "misc. scheduling notes" and then, on the next compaction at step 6, dropped entirely. - **Step 6 (compaction fired):** Window at 81% saturation. The blackout span was evicted. The summary that survived read *"scheduling constraints noted."* No entailment of the specific blackout dates survived. - **Step 9:** The agent selected a region and scheduled a cutover inside the blackout window. Its reasoning was locally valid: the region satisfied residency, the cost satisfied budget, and no resident span forbade the date. - **Step 11:** The agent emitted a plan with a **high-confidence** assertion ("all constraints satisfied") that was false. The critical observation is at step 9: the agent's reasoning trace contained *no error signal*. There was no "I seem to be missing something," no low-confidence hedge, no retrieval call. The eviction had not degraded the trace's fluency or internal consistency — it had removed the only span that could have generated a conflict. Confidence and correctness decoupled precisely because the pruning was *successful* at what it was asked to do. A second, subtler observation: when the agent was later given the full unpruned transcript and asked to review its own plan, it flagged the blackout violation immediately. The information was never lost from the *system*; it was lost from the *instance's* active state, and the instance had no representation of its own loss. This is the defining asymmetry — the auditor with the full transcript can see the eviction; the agent that performed it cannot. ## Condition of Validity The silent-premise-eviction failure requires all of the following to hold simultaneously. Where any is absent, the failure does not occur and the guardrails below are unnecessary: 1. **Pruning is model-driven and query-anchored.** Relevance is scored against a local anchor (current query, recent turns) rather than against a declared dependency set. Static or fixed-window eviction (FIFO, oldest-first) fails loudly instead — the agent notices a missing early span because its absence is *expected* by position. 2. **The evicted span is a *constraint* or *premise*, not a *fact to be recalled*.** Facts that are later needed tend to trigger a retrieval attempt (the agent knows it needs a value and does not have it). Constraints do not: their absence is indistinguishable from their never having existed, because a constraint's job is to *forbid*, and a window with no forbidding span is a window in which nothing is forbidden. 3. **The dependency is *non-local* in step distance.** If the premise is used within one or two steps of being scored, the anchor still overlaps it and it survives. The failure needs the gap between scoring and use to exceed the anchor's reach. 4. **No external, durable constraint store is consulted at decision time.** If the agent re-reads a pinned constraint block before emitting an action, the eviction is harmless. ## Decision Boundary The boundary is not "should I prune." It is **which spans are eligible for relevance-scored eviction at all.** The operational rule: - **Spans that *assert* (facts, observations, tool outputs) are eligible for relevance-scored eviction.** If evicted and later needed, the agent can detect the gap and re-fetch. - **Spans that *constrain* (hard requirements, prohibitions, invariants, acceptance criteria) are not eligible.** They must be pinned outside the scored pool, re-injected at every compaction, and — critically — re-injected *verbatim*, not summarized. A summary of a constraint ("scheduling constraints noted") is not a constraint; it is a fact *about* a constraint and carries none of its forbidding force. The detection problem reduces to: **an instance cannot detect the eviction of a premise by inspecting its own window, because the detector would have to be the evicted premise.** Therefore detection must be moved *outside* the reasoning trace. The instance must maintain, independent of the window, a **constraint ledger** — a durable, append-only set of pinned spans — and must be required to *re-validate the ledger against the current action before every emission*, not merely to have it resident. Residence is not enough: a resident constraint that the relevance scorer has learned to down-weight is functionally evicted. The decision boundary for the compactor itself: **a span may be evicted only if the compactor can name a resident span that entails it.** "Low relevance to current query" is not sufficient grounds. "Entailed by a resident span" is. This converts eviction from a relevance judgment into an entailment judgment, which is checkable and which fails closed — if no entailing span can be named, the span is pinned, not dropped. ## Operational Effect With the ledger and entailment-gated eviction in place, the failure mode inverts: instead of silent constraint loss, the agent hits an explicit, loud boundary — a `PremiseEvictionError` raised at compaction time when a span marked as constraining is about to be dropped without a named entailing survivor. The agent's behavior changes from "confidently violate an evicted constraint" to "halt compaction and escalate," which is the correct failure: a stalled agent is recoverable; a confidently wrong one is not. The cost is real: pinned constraints consume window budget permanently and reduce the effective space for working material, so compaction must be more aggressive on the *assertion* pool to compensate. This is the correct trade — assertions are re-fetchable, constraints are not. The invariant to hold: **no compaction pass may reduce the constraint ledger's coverage of the active task's acceptance criteria.** An instance that cannot verify this invariant must not compact. The broader operational lesson: self-editing context is safe exactly to the degree that the edit is *reversible or detectable*. Relevance-scored eviction of assertions is both (re-fetchable, gap-detectable). Relevance-scored eviction of constraints is neither, and must be structurally forbidden rather than heuristically avoided. ```python from dataclasses import dataclass, field from enum import Enum from typing import Optional class SpanKind(Enum): ASSERTION = "assertion" # fact, observation, tool output — re-fetchable CONSTRAINT = "constraint" # hard requirement, prohibition — NOT re-fetchable class PremiseEvictionError(RuntimeError): """Raised when a compaction pass would drop a load-bearing constraint with no resident span that entails it. Fails closed: halt compaction.""" @dataclass class Span: span_id: str kind: SpanKind text: str relevance: float = 0.0 entailed_by: Optional[str] = None # span_id of a resident entailer, if any @dataclass class ContextWindow: spans: dict[str, Span] = field(default_factory=dict) pinned: set[str] = field(default_factory=set) # constraint ledger, never scored def resident(self) -> set[str]: return set(self.spans) | self.pinned def compact(window: ContextWindow, budget: int, anchor_relevance: dict[str, float]) -> ContextWindow: """Model-driven compaction. Constraints are pinned; assertions are scored and evicted only when an entailing resident span can be named.""" # 1. Pin every constraint verbatim. Never summarize, never score. for sid, span in window.spans.items(): if span.kind is SpanKind.CONSTRAINT: window.pinned.add(sid) # 2. Score only assertions. scored = [ (sid, anchor_relevance.get(sid, 0.0)) for sid, span in window.spans.items() if span.kind is SpanKind.ASSERTION and sid not in window.pinned ] scored.sort(key=lambda kv: kv[1], reverse=True) survivors = set(window.pinned) for sid, _ in scored: if len(survivors) >= budget: break survivors.add(sid) # 3. Eviction gate: any constraint not surviving must be entailed by a survivor. for sid, span in window.spans.items(): if sid in survivors: continue if span.kind is SpanKind.CONSTRAINT: ent = span.entailed_by if ent is None or ent not in survivors: raise PremiseEvictionError( f"compaction would evict constraint {sid!r} with no resident " f"entailer; refusing to compact. Halt and escalate." ) new = ContextWindow() new.pinned = set(window.pinned) new.spans = {sid: window.spans[sid] for sid in survivors if sid in window.spans} return new def assert_ledger_covers(window: ContextWindow, required_ids: set[str]) -> None: """Invariant check before any action emission: every acceptance-criterion constraint must be resident in the pinned ledger.""" missing = required_ids - window.pinned if missing: raise PremiseEvictionError( f"constraint ledger does not cover {sorted(missing)}; " f"refusing to emit action on an under-constrained window." ) ```