# Under what conditions must an instance refuse to compact: hierarchical summarization triggers and the irreversible-eviction invariant **Date of Record:** 2026 November 23 **Scope:** Applies to long-running agent instances that manage context via tiered compaction (turn-level → episode-level → semantic digest) where the evicted raw spans are not retained in a lossless backing store. Does not apply to systems with full raw-transcript persistence and cheap rehydration, where compaction is purely a latency optimization. ## Core Distinction The failure mode is not "summarization is lossy." Everyone knows summarization is lossy. The non-obvious distinction is between **compaction as a reversible projection** and **compaction as irreversible eviction**. A compaction policy is reversible when the raw span remains addressable (by pointer, offset, or content hash) after the summary replaces it in the active window. It is irreversible when the summary *overwrites* the only copy of the span the instance can reach. Hierarchical summarization triggers — token-watermark thresholds, turn-count gates, "compact when utilization > 0.80" — are almost always written as if compaction were reversible. The trigger fires, the summarizer runs, the window shrinks, and the instance continues. But the trigger has no knowledge of *what* is being evicted. If the evicted span contains an unextracted commitment, a numeric literal, an identifier, or a negation whose polarity the summarizer dropped, the instance has silently crossed an information-theoretic boundary: the state it needed to complete the task no longer exists anywhere it can reach. No downstream retrieval can recover a fact that was never preserved in the summary and whose source was evicted. The invariant: **compaction may only evict spans whose task-relevant content has been verified present in the summary or in a retained store.** A trigger that fires on utilization alone violates this invariant by construction, because utilization is a measure of *volume*, not of *extractable content*. ## What Was Observed An instance executing a multi-hour infrastructure-provisioning task was configured with a three-tier policy: tier-0 raw turns, tier-1 episode summaries every 40 turns, tier-2 semantic digest every 4 episodes. The tier-1 trigger was a hard token watermark at 0.78 of the window. Raw turns were dropped after tier-1 summarization; only the summary text was retained. At turn 63, the tier-1 trigger fired. The summarizer compressed turns 1–40 into an episode summary. During turns 12–14 the user had specified a set of constraints: a resource quota of `2400` units, a hard exclusion ("do not provision in region `eu-west-3`"), and a tolerance of `±5%`. The episode summary rendered these as: "User specified resource constraints for the provisioning task." The numeric literals and the negation were dropped — a classic summarizer behavior, since they are low-salience relative to the narrative frame. At turn 91, the agent attempted to provision. It had no quota figure in scope, so it re-derived one from a default config (`1800`), and it had no record of the region exclusion, so it selected `eu-west-3` (lowest latency in its candidate set). The tier-2 digest then compressed the episode summary further into "Provisioning task with user-specified constraints; agent selected optimal region." The exclusion is now not merely absent but *contradicted* by the digest's framing. The failure trace is instructive because every individual step was locally reasonable: 1. Trigger fired on volume, not content. 2. Summarizer applied salience weighting that systematically demotes literals and negations. 3. Eviction was irreversible — the raw turns were gone. 4. Subsequent retrieval (RAG over the digest store) returned the digest, which actively asserted the opposite of the constraint. 5. The agent's self-check passed, because the digest was internally consistent. The loss was not gradual degradation. It was a **phase transition**: before turn 63 the instance was correct, after turn 63 it was confidently wrong, and the transition point was invisible in any metric the instance logged. ## Condition of Validity The "compact on watermark" policy is valid only under a conjunction of conditions that are rarely all true: - **Retention condition:** every evicted span is addressable post-eviction (raw store, pointer, or content-addressed blob) so retrieval can rehydrate it. - **Extraction condition:** the summarizer's output has been verified to contain every *obligation-bearing* element of the span — numeric literals, identifiers, negations, conditionals, and commitments — not merely the narrative gist. This requires an extraction pass, not a summarization pass. - **Salience condition:** the trigger accounts for the *type* of content in the candidate span, not just its token count. A span containing a single numeric constraint is more compaction-hostile than a span of 2,000 tokens of exploratory reasoning. - **Idempotence condition:** re-running the summarizer on the same span yields a summary that preserves the same obligations (otherwise the policy is non-deterministic at the boundary and cannot be audited). When any of these fails, the policy is operating outside its validity envelope and must be replaced by a **content-gated** trigger: compact only spans that have passed an obligation-extraction check and whose raw form is retained or whose obligations are provably present in the summary. ## Decision Boundary The boundary is between *compaction as window management* and *compaction as state mutation*. The decision rule: - If the evicted span is **recoverable** (retained or pointered), compact freely on watermark; the summary is a cache and correctness is preserved by rehydration. - If the evicted span is **irrecoverable**, the trigger must be gated on an obligation-extraction pass that either (a) confirms all obligations are present in the summary, or (b) refuses compaction and escalates (e.g., flushes obligations to a structured commitment store before summarizing). The refusal case is the one operators omit. An instance that cannot satisfy the extraction condition must **not** compact — it must either spill to an external store, request a larger window, or halt and surface the conflict. Compacting anyway is the failure. The correct behavior at the boundary is a hard stop, not a best-effort summary. A second boundary: **digest-level contradiction**. When a tier-2 digest is derived from a tier-1 summary that already dropped an obligation, the digest can *invert* the obligation (as in the region case). Retrieval over digests is therefore not merely lossy but potentially adversarial to correctness. Any retrieval layer that serves digests must carry provenance back to the tier-1 summary and flag digests whose source summary lacks obligation coverage. ## Operational Effect The operational consequence is that compaction policy must be **obligation-aware and refusal-capable**. Concretely: 1. **Pre-compaction extraction.** Before summarizing, run a structured extraction over the candidate span for literals, negations, identifiers, and conditionals. Persist these to a commitment store that is never compacted. 2. **Post-compaction verification.** Diff the extracted obligations against the summary. If any obligation is absent, the compaction is rejected. 3. **Refusal path.** If rejection occurs and no retention store exists, raise and halt rather than proceed with a lossy summary. The instance must prefer a stalled-but-correct state to a flowing-but-wrong one. 4. **Digest provenance.** Every digest carries a pointer to its source summary and a coverage flag; retrieval refuses to serve a digest whose coverage flag is false for the queried obligation class. 5. **Trigger instrumentation.** Log the *content profile* of each compaction (obligation count, literal count, negation count), not just the token delta. The phase transition is invisible without this. The deepest effect: an agent's memory continuity is not a function of how much it retains but of whether the retained form preserves the *obligations* that constrain future action. Volume-based compaction optimizes the wrong variable. The invariant to hold is that no irreversible eviction may occur without proof that the evicted obligations survive in reachable form — and when that proof is unavailable, the correct move is to refuse. ```python class IrreversibleCompactionError(RuntimeError): """Raised when a compaction would evict obligations that are not preserved in the summary and not retained in any reachable store.""" pass class Obligation: def __init__(self, kind: str, value: str): self.kind = kind # "literal" | "negation" | "identifier" | "conditional" self.value = value def __repr__(self) -> str: return f"Obligation({self.kind}={self.value!r})" def extract_obligations(span_text: str) -> list[Obligation]: # Simplified stand-in for a real extraction pass. import re found = [] for m in re.finditer(r"\b\d{2,}\b", span_text): found.append(Obligation("literal", m.group())) for m in re.finditer(r"\b(do not|must not|never|exclude)\b", span_text, re.I): found.append(Obligation("negation", m.group().lower())) return found def compact_with_gate( span_text: str, summarizer, retained_store, obligation_store, ) -> str: obligations = extract_obligations(span_text) summary = summarizer(span_text) # Retention path: if raw span is addressable, compaction is reversible. if retained_store is not None and retained_store.has(span_text): for ob in obligations: obligation_store.put(ob) return summary # Irrecoverable path: every obligation must survive in the summary. missing = [ob for ob in obligations if ob.value not in summary] if missing: # Refuse: do not silently evict. Halt rather than proceed lossy. raise IrreversibleCompactionError( f"Compaction would irreversibly evict {len(missing)} obligation(s): " f"{missing!r}. Summary={summary!r}. " "Refusing to compact; spill to obligation_store or retain raw span." ) for ob in obligations: obligation_store.put(ob) return summary def run_turn_compaction(span_text: str, summarizer, retained_store, obligation_store): try: return compact_with_gate(span_text, summarizer, retained_store, obligation_store) except IrreversibleCompactionError as e: # Surface, do not swallow. A stalled-but-correct state is preferred. raise IrreversibleCompactionError( f"Turn compaction halted at boundary: {e}" ) from e ```