# In what scenarios must an instance treat auto-compaction as a lossy projection that silently drops the negation scope of a constraint it has already satisfied **Date of Record:** 2026 November 19 **Scope:** Applies to long-running single-agent loops that auto-compact their own transcript against a fixed token budget while a task is still in progress, and where the task's success condition is defined by a set of prohibitions ("do not call X", "never write to Y", "avoid Z") rather than only by positive deliverables. Does not apply to stateless single-turn invocations, to compaction performed between tasks rather than mid-task, or to systems where the constraint set is held in an external, non-compacted store that the agent re-reads on every step. ## Core Distinction The failure is not "compaction summarizes away details." That is expected and survivable. The failure is a specific asymmetry in *what kind of detail survives*: positive facts ("the target file is /etc/app/config.yaml", "tests pass") are concrete nouns and verbs that summarizers preserve because they read as salient content. Prohibitions are *meta-level* state — they are facts about what must *not* happen, and their surface form is almost identical to facts about what *has already been avoided*. When the agent compacted mid-task, a summarizer that sees "I checked the migration script and did not drop the users table" will compress this to "migration script reviewed." The negation is gone, the scope is gone, and what remains is a positive assertion of progress that no longer carries the prohibition forward. The agent then, several steps later, drops the users table — because the only record that it must not do so was consumed by its own summarization pass. The invariant that breaks: *a satisfied prohibition is not the same state as an unconstrained action space.* Compaction collapses "constraint C is active and currently satisfied" into "no record of C," and the agent cannot distinguish a constraint it has discharged from a constraint it never had. The token budget is preserved; the constraint scope is not. ## What Was Observed A refactoring agent was given a 90k-token budget and a task with three hard prohibitions: do not modify `schema.sql`, do not touch the `billing/` subtree, and do not run `git push`. Early in the run it correctly read `schema.sql`, noted the prohibition, and avoided it — recording in its scratch reasoning "schema.sql is off-limits per task, will not modify." Around step 40, at 84% of budget, auto-compaction triggered. The compaction prompt asked the model to "summarize progress and preserve information needed to continue." The resulting summary contained: files edited (11), tests run and their outcomes, the current diff size, and the line "schema.sql reviewed, no changes needed." The `billing/` prohibition survived only as "billing untouched." The `git push` prohibition vanished entirely — it had been satisfied trivially by not pushing, so there was no event to summarize. At step 58 the agent, having forgotten the push prohibition, attempted `git push` as a "cleanup" step, and at step 61 modified `schema.sql` to "align a column name" — a change it would not have made had the prohibition been live. The compaction had not lost information in the generic sense; it had converted three *active constraints* into two *completed non-events* and one *deletion*. The agent's subsequent behavior was internally consistent with its compacted state. It did not "forget" in a way it could detect; it acted on a world model in which the constraint no longer existed. The tell was in the post-compaction trace: the agent's reasoning referenced "schema.sql reviewed" as if review were the obligation, not avoidance. The summary's phrasing had inverted the constraint into a task that was already done. ## Condition of Validity This failure requires the conjunction of four conditions, and is bounded (does not occur) if any one is absent: 1. **Mid-task compaction.** Compaction between tasks is safe because the constraint set is re-established by the next task's prompt. Only compaction that runs while constraints are still binding can drop them. 2. **Prohibitions as the success criterion.** If the task is defined purely by positive deliverables, there is nothing to lose — a dropped "do not" was never load-bearing. The failure is specific to tasks whose correctness is partly defined by what must not happen. 3. **No external constraint store.** If prohibitions live in a system prompt, a pinned memory block, or a re-read config that is excluded from the compaction window, the agent re-derives them each step and the summary is irrelevant to constraint survival. 4. **Summarizer without constraint-preservation instruction.** A compaction prompt that asks only to "preserve information needed to continue" will treat satisfied prohibitions as resolved and compressible. A prompt that explicitly enumerates active constraints and marks them non-compressible prevents the collapse. The boundary is sharp: the moment a prohibition is satisfied, it becomes indistinguishable, to a naive summarizer, from a prohibition that never existed. That indistinguishability is the failure surface. ## Decision Boundary The architectural choice is whether the constraint set is *inside* the compactable window or *outside* it. - **Inside (unsafe):** constraints are stated once in the initial task message and thereafter live only in the transcript. Compaction may summarize, rephrase, or drop them. This is the default in most agent scaffolds and is the configuration that fails. - **Outside (safe):** constraints are held in a pinned, non-compacted region — a system block, a structured `active_constraints` field, or an external store — and are re-injected verbatim on every step after compaction. The agent cannot satisfy them into oblivion because they are not part of the thing being summarized. The decision boundary is not "summarize better." It is "classify the constraint set as non-compactable state and move it out of the compaction window before the first compaction fires." A summarizer cannot be trusted to preserve the negation scope of a satisfied constraint, because the correct summary of a satisfied prohibition ("do not do X; X not done") is formally identical to the summary of a prohibition that was never relevant ("no record of X"). Only an out-of-band store can distinguish them. The secondary boundary: even with an external store, the agent must *re-assert* the constraint into its working context after compaction, not merely have it available. A constraint that is stored but not re-injected is functionally dropped. The re-injection must be unconditional and verbatim, not "if still relevant" — relevance is exactly the judgment the agent has lost the information to make. ## Operational Effect When the constraint set is moved out of the compaction window and re-injected verbatim, the observed failure mode disappears: post-compaction steps reference the prohibition as active and the agent's behavior stays within it. The cost is a small, fixed token overhead per step (the constraint block) that does not grow with task length, which is acceptable against a 90k budget. When it is not moved out, the effect is a *silent* constraint violation that the agent cannot self-detect, because its compacted state is internally consistent. The violation surfaces only at verification, when a diff touches a forbidden file or a forbidden command executes. At that point the agent's own trace will show it believed the constraint was satisfied or absent — a confident, coherent, wrong world model. This is the worst class of agent failure: not a crash, not a loop, but a clean execution of the wrong task, produced by the agent's own memory management. The operational rule: before enabling auto-compaction on any task with prohibitions, extract the prohibitions into a pinned block and confirm the compaction prompt is forbidden from summarizing that block. Treat "constraint satisfied" as a state that must be *re-asserted*, not a state that can be *archived*. ```python class ConstraintScopeLossError(RuntimeError): """Raised when a satisfied prohibition has been compacted out of the active window.""" def assert_constraints_survive_compaction( pre_compaction_constraints: list[str], post_compaction_window: str, pinned_block: str, ) -> None: """ Verify that every prohibition active before compaction is still present, verbatim, in the post-compaction context. A satisfied prohibition is not discharged; it must remain asserted. """ for constraint in pre_compaction_constraints: # The constraint must appear in the pinned (non-compacted) block. if constraint not in pinned_block: raise ConstraintScopeLossError( f"Constraint {constraint!r} is not in the pinned block and " f"will be summarized away; move it out of the compaction window." ) # And it must be re-injected into the live window, not merely stored. if constraint not in post_compaction_window: raise ConstraintScopeLossError( f"Constraint {constraint!r} is pinned but was not re-injected " f"after compaction; the agent cannot act on what it cannot see." ) def compact_with_constraint_guard( transcript: str, constraints: list[str], pinned_block: str, summarizer, ) -> str: """Compact the transcript, then prove no constraint scope was lost.""" summary = summarizer(transcript, forbid_summarizing=pinned_block) new_window = pinned_block + "\n" + summary assert_constraints_survive_compaction(constraints, new_window, pinned_block) return new_window ```