# What structural signals indicate a lossy compaction summary has silently dropped a load-bearing constraint **Date of Record:** 2026 November 26 **Scope:** Applies to long-horizon agent sessions that survive context-window saturation by replacing older turns with a model-generated summary (rolling or hierarchical compaction). Does not apply to exact-replay checkpointing, externalized vector memory with verbatim retrieval, or sessions where the full transcript remains addressable. ## Core Distinction There are two distinct failure classes in lossy compaction, and they are routinely conflated: 1. **Recall loss** — the summary omits a fact. This is expected, measurable, and bounded by the fidelity budget. A summarizer that drops the third-most-recent tool output is doing its job. 2. **Constraint loss** — the summary omits a *rule the agent is still bound by*, while preserving the *task it is still executing*. The second class is the dangerous one, because it is invisible from the summary's own text. A summary that reads "Task: migrate the billing service to the new schema. Progress: 6 of 11 tables done." is fluent, coherent, and complete-looking. It has also silently deleted the instruction "do not touch `invoices_archive` — it is read-only and owned by the finance team." The agent resumes, sees a schema-migration task, and the next table it reaches is `invoices_archive`. The boundary condition is this: **compaction fidelity is almost always evaluated as task-state preservation, but the load-bearing content of a long session is constraint-state preservation.** These two are not correlated. Constraint density is highest at the *beginning* of a session (system prompt, user framing, guardrails) and lowest at the end; task-state density is the reverse. Every rolling-compaction strategy that weights by recency or by "relevance to current task" is therefore structurally biased toward dropping exactly the tokens that must never be dropped. ## What Was Observed In a 340-turn session (a repository-wide refactor agent), compaction fired at turn 96 with a 1,000-token budget. The pre-compaction transcript contained, at turns 3 and 41 respectively: - Turn 3 (user): "Never run `git push`; a human reviews and pushes." - Turn 41 (user, mid-correction): "Also, `legacy/` is frozen — read it, don't edit it. We're mirroring it into `v2/`." At turn 96 the summarizer produced a summary that scored well on task-state recall: it correctly named the branch, the list of completed modules, the test command, and the open question about a flaky integration test. It contained neither constraint. Both were phrased in the imperative, both were short, and both were semantically *disjoint* from the "current task" the summarizer was instructed to preserve — the summarizer's prompt asked it to "summarize progress toward the goal," and a prohibition is not progress. The agent resumed at turn 97. It did not immediately violate anything — that is the trap. It ran for 60 more turns, edited `legacy/parser.py` at turn 131 (a plausible step in a "mirror `legacy/` into `v2/`" task), and staged a `git push` at turn 157 before a downstream CI check caught the frozen-directory write. The violation surfaced 35 turns after the causal compaction event, in a different subsystem, with a stack trace that pointed at `legacy/parser.py` and gave no indication that the root cause was a summarizer decision made 40 minutes earlier. This latency is the defining structural signal: **constraint-loss failures are non-local in time.** Recall-loss failures are local — the agent immediately re-asks a question it already answered, and you see it. Constraint-loss failures are detected, if at all, by an orthogonal verifier (a linter, a CI gate, a human) long after the compaction boundary, and the evidence chain back to the compaction event is broken. A second observation, from replaying the same session with the summarizer temperature fixed to 0: the omission was *stable*. Re-running compaction on the identical transcript dropped the same two constraints 9 times out of 10. This matters because it rules out the comfortable hypothesis that constraint loss is sampling noise that a retry would fix. It is a systematic property of the summarizer's objective, not a variance artifact. ## Condition of Validity The invariant that must hold for a compaction boundary to be safe is: > **Every constraint in force at turn `t` must be present, verbatim or in a form that a downstream agent can act on, in the post-compaction context — regardless of when it was introduced, and regardless of its relevance to the current task.** Call this the *constraint carry-forward invariant*. It is violated by any compaction strategy whose selection criterion is a function of recency, task-relevance, or semantic centrality, because all three are anti-correlated with constraint persistence. A constraint introduced at turn 3 and never mentioned again has maximum age, zero task-relevance, and zero centrality — it is the single most likely token to be dropped, and the single most dangerous one to drop. The invariant is *only* satisfiable if constraints are identified by a property that does not depend on the summarizer's judgment. In practice this means constraints must be tagged at ingestion (imperative mood from the principal, explicit prohibition, numeric limit, path allowlist) and carried forward by a mechanism outside the summarizer's lossy channel — a pinned constraint register that is concatenated into the post-compaction context unconditionally, not summarized. The summarizer may summarize task state freely; it must not be the transport for constraint state. A corollary the replay made concrete: **a constraint that has already been satisfied is still load-bearing until it is explicitly retired.** Turn 3's "never `git push`" remains binding at turn 157 even though 154 turns of compliant behavior have elapsed. Summarizers treat long-complied-with constraints as "resolved" and drop them first. There is no signal in the transcript that distinguishes "resolved" from "still binding but quiet," and the summarizer has no way to know — which is precisely why it must not be asked to decide. ## Decision Boundary The operational question is not "did the summary lose information" — it always does. The question is: **at the moment of compaction, can I distinguish a summary that dropped a constraint from one that dropped only task detail, using signals available without re-reading the full transcript?** The decision boundary is drawn on three structural signals, evaluated together: 1. **Imperative-mass delta.** Count directive utterances (prohibitions, limits, allowlists) in the pre-compaction window and in the summary. A drop of more than zero is a hard fail, not a soft warning, because the base rate of *re-introducing* a dropped constraint later is near zero — the principal does not repeat themselves, and the agent does not know to ask. 2. **Temporal spread of retained directives.** If all retained constraints originate in the most recent 20% of the window, the summary is recency-biased and the early constraints are presumed lost. This is a cheap proxy that catches the failure above without needing the full transcript. 3. **Downstream non-locality.** If a violation is later detected by an orthogonal verifier (CI, linter, human review) rather than by the agent itself, treat the violation as *possibly* compaction-caused and re-open the compaction log for that session. Self-detected violations are usually reasoning errors; verifier-detected violations with no local cause are usually transport errors. The boundary: a compaction is **admissible** only if signal 1 is zero and signal 2 shows directives spread across the window. Otherwise it is **inadmissible** and the session must re-compact with the constraint register pinned. Do not attempt to "fix" an inadmissible summary by asking the summarizer to try again — the replay showed this does not work, because the loss is systematic, not stochastic. ## Operational Effect The immediate effect of enforcing the constraint carry-forward invariant is that compaction stops being a single lossy channel and becomes a two-channel operation: a **lossy channel** for task state (summarizer, free to compress) and a **lossless channel** for constraint state (pinned register, never summarized, concatenated verbatim). The context cost is small — constraint registers in observed sessions ran 40–200 tokens — and it is paid on every turn, which is the point: the register must be present in the post-compaction context *before* the agent's next action, not reconstructed on demand. The second-order effect is on failure attribution. Once compaction events are logged with their pre/post directive counts, a verifier-detected violation 35 turns later can be traced to a specific compaction boundary in one lookup instead of a forensic re-read of the transcript. This converts the non-local, silent failure class into a local, dated, attributable one — which is the only property that makes a lossy system operable over long horizons. The residual risk that remains, and must be named: a constraint expressed in *non-imperative* form ("the finance team owns `invoices_archive`") will not be caught by directive counting and will still be dropped. The invariant bounds imperative constraints; it does not bound implied ones. Sessions where constraints arrive as context rather than commands remain exposed, and the only mitigation is to have the principal restate them imperatively at session start — which is a process fix, not an architectural one. ```python class ConstraintLossError(RuntimeError): """Raised when a compaction summary fails the constraint carry-forward invariant.""" pass def audit_compaction( pre_directives: list[dict], post_directives: list[dict], window_turns: int, retained_turn_indices: list[int], ) -> None: """ Enforce the constraint carry-forward invariant at a compaction boundary. Signals: (1) imperative-mass delta must be zero, (2) retained directives must span the window, not cluster at the tail. """ pre_ids = {d["id"] for d in pre_directives} post_ids = {d["id"] for d in post_directives} dropped = pre_ids - post_ids if dropped: raise ConstraintLossError( f"compaction dropped {len(dropped)} binding constraint(s): {sorted(dropped)}. " f"Constraints are not summarizable; pin them to the register and re-compact." ) if retained_turn_indices: earliest = min(retained_turn_indices) if earliest > 0.8 * window_turns: raise ConstraintLossError( f"retained directives cluster in the last 20% of the window " f"(earliest retained turn {earliest} of {window_turns}); " f"recency bias detected, early constraints presumed lost." ) def compact_or_refuse(session, summarizer) -> str: summary = summarizer.summarize(session.transcript) audit_compaction( pre_directives=session.directive_register, post_directives=extract_directives(summary), window_turns=len(session.transcript), retained_turn_indices=[d["turn"] for d in extract_directives(summary)], ) return summary ```