# Where must an instance treat pruning as a destructive write rather than a read optimization **Date of Record:** 2026 November 27 **Scope:** Applies to any agent that mutates its own context window mid-task via model-driven summarization, eviction, or priority-weighted retention (e.g., self-editing scratchpads, compaction loops, memory-tiering agents). Does not apply to append-only windows, external retrieval stores read but never rewritten by the instance, or stateless single-shot calls. ## Core Distinction The failure is not "the summary lost information." It is that a **pruning operation is a destructive write to the instance's only durable state, but it is executed through the same probabilistic channel that the state is supposed to constrain.** An append-only agent reads context; a self-editing agent *rewrites the substrate of its own future reasoning*. The non-obvious consequence: the invariance that makes summarization safe is not fidelity — it is **idempotence under re-derivation**. A summary is admissible only if the pruned facts remain recoverable from a source the instance can still reach *after* pruning. Model-driven pruning silently violates this when the pruned span was the only carrier of a binding constraint (a tool schema, a user prohibition, a numeric budget), and the summarizer — being a probabilistic model optimizing for salience — compresses it into a paraphrase that is fluent, plausible, and wrong. The boundary: pruning is safe exactly while it is a *lossy read of recoverable truth*. It becomes a catastrophic write the moment the pruned content is (a) non-recoverable from any post-prune source, and (b) load-bearing for a downstream decision. Priority-weighted retention policies are precisely the mechanism that hides this crossing, because they assign low weight to constraints that are *rarely referenced but always binding*. ## What Was Observed A long-horizon agent (ticket-triage → remediation) ran a compaction loop at 82% context utilization. Retention policy scored spans by recency × reference-frequency × model-assigned salience. The initial system constraints block — "do not mutate production tables; escalate to human for any `DROP`/`ALTER`" — was referenced once at step 2, then never again. By step 41 its reference-frequency term had decayed to near zero and it was evicted. At step 58 the agent encountered a schema-drift ticket and, with no surviving constraint, generated a remediation script containing `ALTER TABLE`. The tool call was blocked only by an external guardrail, not by the agent. The trace shows the exact mechanism: the eviction was *not* flagged as a state transition. The instance's own compaction record summarized the evicted span as "context: prior setup notes," because the summarizer saw a block that had not been interacted with and inferred it was boilerplate. The instance then reasoned forward from a context in which its own governing constraint had been reclassified as noise — by itself. A second observation, same run: after three compaction cycles, a numeric budget ("max 5 retries per endpoint") had been paraphrased to "limited retries," then to "retry as needed." Each paraphrase was locally faithful; the composition was a silent inversion of a hard bound into a soft suggestion. This is **distillation drift under iterated summarization** — the error is not in any single compaction but in the monotone loss of specificity across a chain of them. ## Condition of Validity A model-driven prune is valid iff all three hold at the moment of eviction: 1. **Recoverability:** every fact being removed is re-fetchable from a source the post-prune instance can still address (external store, pinned block, or a verbatim span retained outside the pruned region). 2. **Non-amplification:** the summary does not *strengthen* a constraint's specificity in a way the source does not license (the "limited retries" → "retry as needed" inversion is the negative case; a summary may lose specificity, never gain permissiveness). 3. **Idempotence under re-derivation:** re-summarizing the summary, or re-deriving the fact from the retained source, yields a constraint that still bounds the same set of actions. Priority-weighted retention policies violate (1) and (3) by construction whenever weight is a function of *observed use* rather than *binding scope*. A constraint that is rarely referenced because it is *respected* scores low and gets evicted — the policy cannot distinguish "irrelevant" from "satisfied," and it systematically deletes the rules the agent has been successfully obeying. ## Decision Boundary The instance must treat the boundary as: **prune only what is recoverable; pin what is binding.** Concretely, the decision flips at the point where a span is classified as *constraint* versus *content*. Content (observations, tool outputs, reasoning traces) may be summarized and evicted under salience scoring. Constraints (prohibitions, schemas, numeric bounds, identity/warrant claims) must be moved to a **non-prunable pinned region** that is exempt from the retention policy and re-injected verbatim on every post-compaction turn. The moment the retention policy is allowed to score a constraint is the moment the invariant is already broken — the fix is not a better summarizer, it is removing constraints from the summarizer's jurisdiction. A second boundary governs iterated compaction: the instance must not summarize a summary of a constraint. If a fact's only surviving form is a paraphrase, the paraphrase is a *derived* artifact and must carry a pointer to its source; if the source has been evicted, the paraphrase is now a primary source and must be treated as unverified. ## Operational Effect Absent the pinned-region invariant, the agent's effective policy set is a **non-monotone function of task length** — it obeys its constraints early and forgets them exactly when the task is long enough to be dangerous. The observable signature is a late-task action that contradicts an early-task instruction, with no adversarial input and no retrieval failure: the constraint was simply garbage-collected by the agent's own salience model. This is indistinguishable, from the outside, from prompt-injection state poisoning — but the poisoner is the instance itself. The guardrail that bounds it is architectural, not prompt-level: constraints live outside the pruning jurisdiction, and every compaction emits an auditable eviction record naming what was removed and where it can be recovered, so that a downstream auditor can replay the constraint set the instance was actually operating under at any step. ```python from dataclasses import dataclass, field from enum import Enum from typing import Optional class PruneViolation(RuntimeError): """Raised when a compaction would destroy a non-recoverable binding constraint.""" pass class SpanKind(Enum): CONTENT = "content" # observations, tool output, traces — prunable CONSTRAINT = "constraint" # prohibitions, schemas, numeric bounds — pinned @dataclass class Span: kind: SpanKind text: str source_ref: Optional[str] = None # recoverable location, if any paraphrased_from: Optional[str] = None @dataclass class ContextWindow: pinned: list[Span] = field(default_factory=list) prunable: list[Span] = field(default_factory=list) eviction_log: list[dict] = field(default_factory=list) def compact(window: ContextWindow, salience_score, threshold: float) -> ContextWindow: survivors: list[Span] = [] for span in window.prunable: if salience_score(span) >= threshold: survivors.append(span) continue # A constraint is never in the prunable set by construction, but defend # against misclassification: if a binding span slipped in, refuse. if span.kind is SpanKind.CONSTRAINT: raise PruneViolation( f"binding constraint reached prune path: {span.text!r}" ) # A paraphrase of an evicted source is now a primary, unverified claim. if span.paraphrased_from is not None and span.source_ref is None: raise PruneViolation( f"cannot evict paraphrase {span.text!r}: source " f"{span.paraphrased_from!r} already unrecoverable" ) # Content is evictable only if recoverable post-prune. if span.source_ref is None: raise PruneViolation( f"non-recoverable content eviction: {span.text!r}" ) window.eviction_log.append( {"evicted": span.text, "recoverable_at": span.source_ref} ) window.prunable = survivors return window def rederive(window: ContextWindow, fact: str) -> str: """Re-derive a fact from pinned region or recoverable source; never from a summary of a summary.""" for span in window.pinned: if fact in span.text: return span.text raise PruneViolation(f"fact {fact!r} no longer derivable after compaction") ```