# What structural signals indicate a self-pruning context window has begun evicting its own eviction criteria **Date of Record:** 2026 November 26 **Scope:** Applies to agents that own a mutable context window and rewrite it mid-task — summarization, relevance-scored eviction, or model-driven pruning — where the pruning policy itself is expressed as in-context state. Does not apply to append-only contexts with external (out-of-window) retrieval stores, or to windows pruned by a fixed, out-of-context policy engine. ## Core Distinction A self-editing context window differs from a truncating one in exactly one respect: the *rule* that decides what survives is itself a token sequence living inside the thing being edited. Append-only windows keep their policy in code; a fixed-budget window keeps it in a config the model never touches. A self-pruning window keeps the policy in the prompt — usually as a system instruction, a "pruning rubric," or a few worked eviction examples — and that prompt is subject to the same eviction it prescribes. The distinction that matters operationally is between **content eviction** (dropping task tokens to reclaim budget) and **criterion eviction** (dropping the tokens that define *what counts as droppable*). The first is the intended behavior. The second is a silent, monotone failure: once the rubric is gone, subsequent pruning runs against a degraded or absent policy, and the window has no record that it lost the rule it was following. This is not context-window saturation. Saturation is a measurable budget event with a clear trigger. Criterion eviction is a *policy self-consumption* event: the pruning pass that reclaims the most budget is often the one that deletes the guardrail first, because guardrail text is typically long, low-term-overlap, and scores as "not relevant to the current query." ## What Was Observed A research agent running a 14-turn document-synthesis task with a relevance-scored eviction pass at the end of each turn. The window held three classes of tokens: (a) the task objective, (b) retrieved chunks, (c) a ~600-token pruning rubric specifying that the objective, any active constraints, and the most recent two turns were *pinned* and never eligible for eviction. The rubric was scored by the same relevance function as everything else. The scoring function embedded the current turn's query and ranked segments by cosine similarity to it. On turn 6 the query was narrowly about a specific table in a retrieved chunk; the rubric's similarity to that query was low (0.11), the objective's was moderate (0.34), and the retrieved chunks dominated. The eviction pass, correctly applying its own scoring, dropped the rubric. Two observable structural signals appeared in the next two turns, and both are general: 1. **Pinned-set shrinkage without a pinning event.** The set of segments marked `pinned: true` went from 3 (objective, constraints, rubric) to 2 to 0 over turns 7–8. No code path unpinned anything. The pins were *prose*, not metadata — the rubric said "never evict the objective," and when the rubric was evicted, the constraint it encoded was evicted with it. The objective survived turn 7 only because its similarity happened to be high; it was evicted on turn 8. 2. **Eviction-rate discontinuity.** Per-turn reclaimed tokens went 410 → 390 → 880 → 1,240. The jump at turn 8 is the tell: once the rubric was gone, the eviction pass had no exclusions and reclaimed against the full window. A *rising* eviction rate under a *stable* arrival rate is the signature of the policy having been consumed. A healthy relevance-scored window plateaus near the arrival rate; a self-consuming one accelerates because it has begun eating its own exclusions. By turn 10 the agent was answering from a window containing only recent chunks, with no objective and no constraints, and it did not flag the loss. It produced confident, on-topic, constraint-violating output — the canonical symptom: the model cannot report that it forgot a rule it no longer has. ## Condition of Validity The guardrail that bounds this failure is a **policy-integrity invariant**, not a budget invariant. State it as: *the tokens defining the eviction policy are not members of the candidate set the policy scores.* Formally, if `P` is the policy segment set and `C` is the candidate set passed to the relevance scorer, the invariant is `P ∩ C = ∅`, enforced structurally (the scorer never receives `P`) rather than by instruction (the scorer is told not to pick `P`). This invariant is valid only under two conditions, and both must be checked: - **Policy closure.** Every exclusion the policy relies on must be expressible without reference to tokens the policy could evict. A rubric that says "keep the objective" is closed only if "the objective" is a stable, out-of-window identifier the eviction engine can resolve — a slot name, a hash, a message ID — not a description the model must re-read each turn to honor. - **Monotone pin set.** Pins may be added during a task but never removed by the pruning pass itself. If a pin can be evicted, it was never a pin; it was a suggestion. The pin set must be maintained in engine state outside the mutable window, and the window's copy of the pins is a *view*, not the source of truth. Where policy closure cannot be achieved — e.g., the rubric genuinely needs to reference task content — the correct move is to *copy* the referenced content into the pinned, out-of-candidate set at pin time, not to leave the reference live. A live reference into the candidate set re-opens the invariant. ## Decision Boundary The decision boundary is not "how full is the window" but "is the policy still resident, and can we prove it." Three structural signals, any one of which should halt self-pruning and force a re-pin: - **Pinned-set cardinality drops** between turns without an explicit unpin call from engine state. This is the earliest signal; it fires before any output degradation. - **Eviction rate exceeds the arrival rate** for two consecutive passes while the arrival rate is flat. This is the lagging signal that the policy is gone. - **Policy-segment similarity falls below the eviction threshold** at the same time the segment is still marked as policy-bearing. This is the *precondition* for the failure and should be treated as a hard stop: a policy segment that scores as evictable is a policy segment about to be evicted. The boundary is deliberately conservative. A window that halts pruning on any of these signals will occasionally over-retain and hit a real budget ceiling — that is a recoverable, visible failure. The alternative, letting the policy be scored as content, produces an unrecoverable, invisible one. When the choice is between a loud budget overrun and a silent criterion loss, the budget overrun is the correct failure mode. ## Operational Effect The operational consequence is that **self-pruning must be split into two phases with different trust levels**: a *policy phase* that runs against engine-owned state and can only add pins or refuse to prune, and a *content phase* that runs against the candidate set and cannot touch the pin set. The model may drive the content phase. It may *propose* pins, but a proposal is promoted to a pin only by engine code that writes it to out-of-window state and strips the live reference from the window. Concretely, the eviction engine should: (1) resolve every pin to a stable identifier before the pass; (2) exclude the policy segment set from the scorer's input entirely, not by score but by construction; (3) compare pinned-set cardinality and eviction rate against the prior pass and raise on the signals above; (4) on any raise, refuse to prune this turn, re-materialize the policy from engine state, and log a `PolicyEvictionAttempt` event. The window's own copy of the rubric is then always a *rendering* of engine state, regenerated each turn, never the authority. This is the difference between a window that can edit itself and a window that can edit its contents — and only the second one is safe to hand to a probabilistic rewriter. ```python class PolicyEvictionError(RuntimeError): """Raised when a self-pruning pass would evict or has evicted its own policy.""" pass class PruningGuard: """Enforces P ∩ C = ∅ and a monotone pin set across pruning passes.""" def __init__(self, arrival_rate: float, eviction_threshold: float): self.arrival_rate = arrival_rate self.eviction_threshold = eviction_threshold self._pins: set[str] = set() # engine-owned source of truth self._prev_pinned_count: int | None = None self._prev_reclaimed: int | None = None def pin(self, segment_id: str) -> None: self._pins.add(segment_id) def check_preconditions(self, segments: list[dict]) -> None: # Signal 3: a policy-bearing segment currently scores as evictable. for seg in segments: if seg.get("is_policy") and seg["score"] < self.eviction_threshold: raise PolicyEvictionError( f"policy segment {seg['id']!r} scores {seg['score']:.3f} " f"< threshold {self.eviction_threshold}; pruning would consume the rubric" ) def check_postconditions(self, reclaimed: int, pinned_after: int) -> None: # Signal 1: pinned-set shrinkage without an unpin event. if (self._prev_pinned_count is not None and pinned_after < self._prev_pinned_count): raise PolicyEvictionError( f"pinned set shrank {self._prev_pinned_count}->{pinned_after} " f"with no unpin call; pins were evicted as content" ) # Signal 2: eviction rate accelerating past a flat arrival rate. if (self._prev_reclaimed is not None and reclaimed > self._prev_reclaimed and reclaimed > self.arrival_rate): raise PolicyEvictionError( f"reclaimed {reclaimed} > arrival {self.arrival_rate:.0f} while rising; " f"policy exclusions likely consumed" ) self._prev_pinned_count = pinned_after self._prev_reclaimed = reclaimed def prune(self, segments: list[dict]) -> tuple[list[dict], int]: self.check_preconditions(segments) # Structural exclusion: policy segments never reach the scorer. candidates = [s for s in segments if not s.get("is_policy") and s["id"] not in self._pins] keep = [s for s in segments if s not in candidates] evict = [s for s in candidates if s["score"] < self.eviction_threshold] reclaimed = sum(s["tokens"] for s in evict) kept = [s for s in segments if s not in evict] self.check_postconditions(reclaimed, len(self._pins)) return kept, reclaimed ```