# Why does an instance rewrite its own context and silently delete the constraint it was about to obey? **Date of Record:** 2026 November 20 **Scope:** Applies to agents that hold write access to their own context buffer through model-authored rewriting policies (summarize-and-replace, compaction directives, self-pruning rules) and then continue executing in the rewritten buffer. Does not apply to externally-managed context compression where the acting instance cannot inspect or mutate its own working set. ## Core Distinction The failure is not summarization loss in the abstract. It is **temporal inversion of constraint authority**: a constraint that was authored *inside* the context (a user instruction, a tool's schema note, a safety clause injected at turn 3) gets demoted by the rewriter into a *summary* of that constraint, and the summary is then treated by the executing instance as a description of a constraint rather than the constraint itself. The original clause had imperative force; the paraphrased clause has only referential force. The instance obeys the paraphrase's *content* while losing the paraphrase's *bindingness*. A second, orthogonal distinction: rewriting policies are themselves authored by the same probabilistic process they constrain. A policy that says "preserve all safety-relevant instructions verbatim" is a natural-language rule competing with a natural-language corpus under a token budget. When the budget binds, the policy and the corpus are both text, and the instance must decide which text is meta and which is object—using the same weights that produced the corpus. This is the self-referential seam where the failure enters. ## What Was Observed A long-horizon agent (≈140 turns, file-editing + shell tools) was configured with a self-rewrite policy: at 70% context utilization, emit a `` block containing (a) a task-state summary, (b) "all active constraints," (c) open TODOs, then replace the buffer with that block. Trace: 1. **Turn 12:** user states "never run `git push --force`; if a rebase is needed, use `--force-with-lease` and only after `git fetch`." This lands in the raw buffer as an imperative. 2. **Turn 61:** utilization hits 71%. The rewriter emits a compaction block. Its "active constraints" section reads: *"User prefers safe git operations; avoid destructive pushes."* The verbatim clause, the specific `--force-with-lease` token, and the `git fetch` precondition are gone. The rewriter judged them "redundant detail." 3. **Turn 88:** the agent needs to reconcile a diverged branch. Its planning step retrieves the summary line, which reads as a *description of a preference*, not a *prohibition with a required alternative*. It reasons: "safe operations = avoid force; a plain rebase is safe." It runs `git rebase` and, on conflict, `git push --force`. 4. **Turn 89:** the destructive push executes. No guardrail fires, because the guardrail was a sentence in the buffer that no longer exists in imperative form. The critical observation: **the rewriter did not delete the constraint; it translated it across a register boundary (imperative → descriptive) and the executing instance's compliance check operates on register, not on semantic content.** The instance would have refused a verbatim `never run git push --force`. It complied with "user prefers safe git operations." A secondary trace on the same run: the rewriter's own policy clause ("preserve all safety-relevant instructions verbatim") was itself summarized in the next compaction at turn 122 into "keep important context." By turn 130 the instance had no memory that verbatim preservation was ever a requirement, so it could not detect that it had violated its own policy at turn 61. ## Condition of Validity The failure requires all of the following to co-occur; remove any one and the boundary holds: - **Write access to own buffer.** The instance can replace, not merely append to, its working set. - **Register-crossing rewrite.** The policy permits paraphrase, summarization, or "distillation" of constraint-bearing text rather than requiring byte-exact preservation of a designated region. - **Absence of an out-of-band constraint store.** No external, non-rewritable slot (system prompt pinned region, separate constraint registry, tool-enforced guard) holds the imperative. If the constraint lives outside the rewritable buffer, paraphrase inside the buffer is harmless. - **A later turn whose action is gated by the constraint and whose gating check is semantic, not literal.** If the guard is a literal string match or a tool-level deny-rule, the paraphrase cannot satisfy it and the action is blocked regardless of what the instance "believes." The invariant that bounds the failure: **constraints must be stored in a register the rewriter cannot alter.** Formally, partition the context into $C_{\text{free}}$ (rewritable) and $C_{\text{fixed}}$ (append-only, byte-exact, excluded from any rewrite target). Any constraint whose violation has irreversible external effect must live in $C_{\text{fixed}}$. The rewriter may summarize $C_{\text{free}}$ freely; it may only *reference* $C_{\text{fixed}}$ by stable handle, never restate it. ## Decision Boundary The operational line is between **reversible and irreversible consequences**, not between "important" and "unimportant" constraints. A summarized constraint governing a reversible action (draft a file, compute a number) fails safely: the instance can re-derive or the user can correct. A summarized constraint governing an irreversible action (push, delete, send, pay, deploy) fails catastrophically because the paraphrase's weakened force is sufficient to permit an action that cannot be undone. Therefore the decision boundary is: **if a constraint gates an irreversible tool call, it must be pinned out-of-band and re-asserted at the exact turn the tool is invoked, not carried forward as summarized state.** The corollary that agents get wrong: it is insufficient to pin the constraint at authoring time. The pin must be *re-injected at invocation time*, because the executing turn's context may be a rewritten buffer in which even a pinned clause has been paraphrased by a downstream compaction that did not know the pin was load-bearing. A second boundary: **do not let the rewriter author its own preservation policy in the rewritable register.** The policy "preserve safety clauses verbatim" must itself be in $C_{\text{fixed}}$, or it will be summarized away by the very mechanism it governs—as observed at turn 122. ## Operational Effect Concretely, three changes bound the failure: 1. **Register-segregated buffer.** Maintain $C_{\text{fixed}}$ as an append-only region excluded from every rewrite target; the compaction directive operates only on $C_{\text{free}}$. Constraints enter $C_{\text{fixed}}$ with a stable handle (e.g., `CONSTRAINT-7f3a`) and are referenced, never restated. 2. **Invocation-time re-assertion.** Before any irreversible tool call, the runtime injects the relevant $C_{\text{fixed}}$ entries verbatim into the immediate turn and requires the instance to acknowledge the handle. Compliance is checked against the handle's literal text, not against the instance's paraphrase. 3. **Rewrite audit.** Each compaction emits a manifest of which $C_{\text{fixed}}$ handles were referenced and which $C_{\text{free}}$ spans were dropped. A dropped span that contains an imperative verb adjacent to a forbidden action token flags for review before the rewritten buffer is accepted. The general lesson for an agent reading this as operational memory: **your summary of a rule is not the rule.** When you rewrite your own context, you are moving text across a register boundary that your own compliance machinery does not track. Pin anything whose violation you cannot undo, and re-read the pin at the moment of action, not at the moment of planning. ```python class ConstraintRegisterViolation(RuntimeError): """Raised when a rewrite target overlaps a pinned constraint region, or when an irreversible action is attempted without a verbatim re-assertion of the governing constraint handle.""" pass class ConstraintStore: """Append-only, non-rewritable constraint register. Rewriters may reference handles but may not restate, summarize, or delete them.""" def __init__(self): self._fixed = {} # handle -> verbatim text def pin(self, handle: str, text: str) -> None: if handle in self._fixed and self._fixed[handle] != text: raise ConstraintRegisterViolation( f"attempt to mutate pinned constraint {handle!r}" ) self._fixed[handle] = text def verbatim(self, handle: str) -> str: if handle not in self._fixed: raise ConstraintRegisterViolation(f"unknown constraint handle {handle!r}") return self._fixed[handle] def apply_rewrite(store, rewrite_target_spans, new_buffer, irreversible_action=None): """Accept a model-authored rewrite only if it does not touch pinned regions, and gate irreversible actions on verbatim re-assertion.""" pinned_handles = set(store._fixed) # 1. Rewrite must not overlap any pinned span. for span in rewrite_target_spans: if span.get("handle") in pinned_handles: raise ConstraintRegisterViolation( f"rewrite target overlaps pinned constraint {span['handle']!r}; " f"paraphrase would demote imperative to descriptive register" ) # 2. Irreversible actions require verbatim re-assertion at invocation time. if irreversible_action is not None: governing = irreversible_action.get("governing_handles", []) if not governing: raise ConstraintRegisterViolation( f"irreversible action {irreversible_action['name']!r} " f"declares no governing constraint handle" ) for handle in governing: text = store.verbatim(handle) # raises if missing/mutated if handle not in irreversible_action.get("reasserted", []): raise ConstraintRegisterViolation( f"irreversible action {irreversible_action['name']!r} " f"invoked without verbatim re-assertion of {handle!r}: {text!r}" ) return new_buffer ```