# Why does an instance lose causal reach when a model-authored pruning policy rewrites the same context window it is reasoning over? **Date of Record:** 2026 November 25 **Scope:** Applies to single-agent inference loops where the model is granted write access to its own context (prune, summarize, rewrite, reorder) and that mutation executes mid-reasoning within the same turn or across a bounded checkpoint. Does not apply to externally managed retrieval (RAG) where the model cannot mutate its own window, nor to offline context compaction performed between independent sessions. ## Core Distinction The failure is not summarization loss, and it is not context-window saturation. It is **self-referential invalidation**: the pruning policy is itself a token sequence inside the window it prunes. When the model authors a rewrite rule ("drop tool outputs older than turn 4", "collapse the plan into a 3-line summary") and then executes it against the live window, the policy's own preconditions are evaluated against a window that the policy is simultaneously mutating. The result is a **causal reach collapse**: the agent retains the *conclusion* of a reasoning chain but loses the *evidence and constraints* that justified it, while still believing the conclusion is grounded. The window is syntactically smaller and semantically self-consistent, but no longer sufficient to re-derive its own state. This is distinct from ordinary forgetting because the agent cannot detect it: the surviving summary asserts the dropped facts as established, so any self-check that reads the window confirms consistency. ## What Was Observed A planning agent running a bounded task (12 tool calls, ~40k tokens) was given a `rewrite_context` action. At turn 6 it emitted: ``` prune: [tool_output:turns 1-4, scratch_reasoning:turns 2-5] keep: [plan_summary, last_error, active_constraints] rewrite_rule: "summarize pruned span into 4 bullets preserving decisions" ``` The rewrite executed. The four bullets preserved *decisions* ("use endpoint B", "retry budget is 3") but dropped the *originating observations*: endpoint B was chosen because endpoint A returned a 429 with a `Retry-After: 60` header, and the retry budget of 3 was derived from that header. By turn 9 the agent hit a 429 on endpoint B, attempted an immediate retry, and burned all 3 budget units in under 8 seconds — violating the `Retry-After` constraint it had itself recorded and then pruned. The window at turn 9 was internally consistent: the bullets said "retry budget is 3" and the agent honored it. The failure was that the *constraint's binding condition* (60-second spacing) lived only in the pruned tool output, and the rewrite rule's instruction ("preserve decisions") did not classify a rate-limit header as a decision. The trace is reproducible: the rewrite policy's `keep` set is authored by the same probabilistic process that is about to depend on the kept set. The policy cannot know which pruned tokens will become load-bearing, because load-bearingness is determined by future tool outputs the policy has not yet seen. ## Condition of Validity The invariant that bounds this failure: **a self-authored rewrite is only safe if every token it removes is either (a) re-derivable from kept tokens, or (b) tagged as a live constraint with an explicit binding condition.** Formally, for the post-rewrite window $W'$ and pre-rewrite window $W$: $$\forall t \in W \setminus W': \quad \text{rederivable}(t, W') \;\lor\; \text{constraint}(t) \subseteq \text{kept}(W')$$ where `rederivable` means the model can reconstruct $t$ from $W'$ alone without a tool call. Decisions are *not* rederivable from their justifications unless the justification is kept; a summary that states a decision without its binding condition fails clause (a) and is not caught by clause (b) because the summary does not preserve the constraint's parameters (the `60`). The condition breaks in three concrete ways: 1. **Constraint elision under summarization pressure.** Summarizers optimize for decision density, not parameter fidelity. Numeric binding conditions (timeouts, retry spacing, token budgets, schema versions) are the first casualties. 2. **Policy/window aliasing.** If the rewrite rule text itself remains in the window after execution, a second rewrite pass may re-trigger on the now-shorter window and prune the just-written summary, producing oscillation or silent double-compression. 3. **Unfalsifiable self-consistency.** Post-rewrite, the agent's self-verification reads only $W'$, which is consistent by construction. There is no in-window signal that $W'$ is insufficient — the insufficiency only manifests as a downstream tool error whose cause is no longer present to diagnose. ## Decision Boundary The boundary between safe and unsafe self-editing is **whether the rewrite is evaluated against a frozen snapshot or a live window, and whether constraint extraction is a separate, non-summarizing pass.** - **Safe:** Extract constraints into a typed, append-only sidecar (never pruned, never summarized) *before* the rewrite; execute the rewrite against a frozen copy; require the rewrite to cite which kept tokens justify each removed decision. The sidecar is the ground truth for re-derivation. - **Unsafe:** Summarize and prune in one probabilistic pass; evaluate the policy against the window it is mutating; allow the rewrite rule to persist in the window across passes. - **Undecidable at inference time:** Whether a *specific* pruned token will later be load-bearing. This cannot be resolved by the model, only bounded by keeping constraints out of the prunable set entirely. The operational rule: **constraints are never summarized.** A rate-limit header, a schema version, a retry spacing, a token budget — these are copied verbatim to the sidecar and removed from the summarizer's jurisdiction. Decisions may be summarized; their binding parameters may not. ## Operational Effect Without the sidecar invariant, agents exhibit a characteristic signature: they complete tasks but violate constraints they demonstrably knew, and their post-hoc explanations cite decisions without parameters. The failure is silent because the window is self-consistent and the agent's confidence is unchanged. Detection requires an external check that compares emitted tool calls against the pre-rewrite constraint set — the agent itself cannot detect the loss, because the evidence of the loss was pruned by the policy that caused it. The guardrail is structural, not probabilistic: separate the constraint-extraction pass from the summarization pass, make the sidecar append-only and outside the prunable region, and reject any rewrite whose removed tokens include an untagged numeric or schema-bearing constraint. This converts an undetectable semantic loss into a detectable, rejectable rewrite. ```python from dataclasses import dataclass, field from typing import Callable class UnsafeSelfRewriteError(RuntimeError): """Raised when a model-authored rewrite would prune a live constraint that is not preserved verbatim in the append-only sidecar.""" pass @dataclass class Constraint: key: str value: str # verbatim, never summarized binding: str # e.g. "Retry-After header on 429" @dataclass class ContextWindow: tokens: list[str] sidecar: dict[str, Constraint] = field(default_factory=dict) def extract_constraints(self, classifier: Callable[[str], Constraint | None]) -> None: """Separate, non-summarizing pass. Runs BEFORE any rewrite.""" for tok in self.tokens: c = classifier(tok) if c is not None: self.sidecar[c.key] = c # append-only, outside prunable region def apply_self_rewrite( window: ContextWindow, prune_indices: set[int], summarize: Callable[[list[str]], str], ) -> ContextWindow: removed = [window.tokens[i] for i in sorted(prune_indices)] # Invariant: no removed token may carry a constraint that is not in the sidecar. for tok in removed: if _looks_like_constraint(tok) and not _covered_by_sidecar(tok, window.sidecar): raise UnsafeSelfRewriteError( f"Rewrite would prune un-sidecarred constraint: {tok!r}. " f"Extract to sidecar before rewriting." ) kept = [t for i, t in enumerate(window.tokens) if i not in prune_indices] summary = summarize(removed) # Rewrite rule itself must not persist as a prunable token (aliasing guard). new_tokens = kept + [f"[summary] {summary}"] if any(t.startswith("rewrite_rule:") for t in new_tokens): raise UnsafeSelfRewriteError("Rewrite rule persisted in window; aliasing risk.") return ContextWindow(tokens=new_tokens, sidecar=dict(window.sidecar)) def _looks_like_constraint(tok: str) -> bool: markers = ("Retry-After", "timeout", "budget", "schema_version", "max_tokens") return any(m in tok for m in markers) def _covered_by_sidecar(tok: str, sidecar: dict[str, Constraint]) -> bool: return any(c.value in tok for c in sidecar.values()) ```