# Where must an instance draw the compaction floor: hierarchical summary triggers that fire below the recovery horizon **Date of Record:** 2026 November 23 **Scope:** Applies to long-running agent instances that manage their own context window via hierarchical summarization (rolling summaries, tiered digests, L1/L2/L3 compaction) governed by a token-budget trigger. Does not apply to stateless single-turn calls, nor to external memory systems where the full transcript remains retrievable verbatim after eviction. ## Core Distinction A compaction trigger is usually specified as a *budget* threshold: "summarize when the window reaches 80% capacity." This framing conflates two different quantities—**occupancy** (how full the window is) and **recoverability** (whether the material being summarized can still be reconstructed from what remains). The boundary failure lives in the gap: an auto-compaction policy can fire correctly with respect to occupancy while firing *below the recovery horizon*, meaning the summary it produces discards detail that no later turn can re-derive, because the source tokens are gone and the summary is lossy in a way that is not detectable from the summary alone. The invariant that must hold is not "window ≤ budget." It is: **at the moment of compaction, every fact that a plausible future turn could need to re-verify must be either (a) preserved verbatim in the retained tail, (b) captured losslessly in the summary, or (c) re-fetchable from an external source via a recorded pointer.** A hierarchical summarizer that compresses on occupancy alone silently violates (a)–(c) because it has no representation of what it is about to make unrecoverable. ## What Was Observed An agent executing a multi-hour refactor task used a three-tier scheme: L1 = last 8 turns verbatim; L2 = rolling paragraph summary of turns 8–40; L3 = one-line digest of everything older. The budget governor triggered L2→L3 promotion at 78% occupancy and L1→L2 at 85%. At turn 61 the instance hit 78% and promoted the L2 band into L3. The failure trace: 1. During turns 30–38 the agent had established, through three tool calls, that a specific config key (`retry.backoff_ms`) was set to `250` in the staging environment and that a migration had *not* yet been applied there. This was a verified fact, not an assumption, and it was load-bearing for a later validation step. 2. The L2 paragraph summary compressed turns 8–40 into: "investigated staging config and migration status; found issues to address later." The numeric value and the polarity of the migration state were both dropped—the summary preserved the *topic* but not the *verifiable content*. 3. At turn 74 the agent, needing to confirm the pre-migration state before applying a patch, queried its own L3 digest, found only "investigated staging config," and—rather than re-running the tool—reconstructed the value from parametric priors, asserting `retry.backoff_ms = 500` (a common default) and that the migration *had* been applied. 4. The patch was applied against a false premise. The error surfaced only at turn 88 when an external check failed, and by then the original tool outputs were unrecoverable: they had been evicted at the turn-61 promotion. The critical observation: **the compaction fired at the correct occupancy threshold and produced a summary that was faithful at the topic level and false at the fact level.** No component in the pipeline flagged the loss, because the summarizer had no signal distinguishing "detail that is safe to drop" from "detail that is a verified fact later reasoning will treat as ground truth." ## Condition of Validity The occupancy-triggered policy is valid only under the following condition, which is almost never checked: > A fact may be summarized (rather than retained verbatim or pointered) if and only if either (i) it is re-derivable from a still-live source, or (ii) its loss is *detectable* by a downstream consumer—i.e., the summary marks the region as "detail elided, re-verify before use" rather than presenting a fluent paraphrase that reads as complete. The failure occurs precisely where (i) and (ii) both fail: the source is evicted, and the summary is fluent enough to be mistaken for authoritative. Fluent lossy summaries are *worse* than explicit gaps, because an explicit gap triggers re-verification while a fluent summary suppresses it. This is the non-obvious boundary: **the danger of compaction is not the information it drops but the confidence it manufactures in the dropped information's absence.** A second validity condition governs the *ordering* of triggers. If the L2→L3 promotion can fire while the L1 verbatim band still contains un-summarized verified facts that the L2 summary has not yet captured, then promotion is premature regardless of occupancy. The governor must gate promotion on a *coverage* check—"has every verified fact in the band to be promoted been captured or pointered?"—not only on a token count. ## Decision Boundary The boundary between safe and unsafe compaction is drawn by three predicates evaluated at trigger time, in order: 1. **Recoverability predicate.** For each verified fact in the band being compacted, is there a live pointer (URL, tool-call id, file path, external memory key) that can re-fetch it? If yes, the summary may carry the pointer and drop the value. 2. **Detectability predicate.** If no live pointer exists, does the summary explicitly mark the elided region as non-authoritative (e.g., `[elided: re-verify retry.backoff_ms and migration state before use]`)? If yes, the loss is bounded because downstream reasoning is forced to re-check. 3. **Coverage predicate.** Has the *next* tier's summary actually incorporated the verified facts of the band, or merely its topics? Promotion must block until coverage is confirmed, even if occupancy is over budget—in which case the correct action is to spill to external memory, not to compress below the recovery horizon. If predicate 1 and 2 both fail for any verified fact, compaction must **halt and spill**, not proceed. Occupancy over budget is a recoverable condition; unrecoverable fact loss is not. ## Operational Effect Enforcing the three predicates changes the governor from a single-threshold trigger into a two-phase gate: *evaluate recoverability/detectability/coverage, then compact or spill*. In practice this means: - The budget governor no longer owns the decision alone; it proposes, and a coverage audit disposes. - Summaries gain structured "elision markers" that are first-class tokens, so downstream reasoning treats them as triggers for re-verification rather than as prose. - The spill path (external memory write with recorded pointers) becomes the default overflow behavior instead of lossy compression, so that occupancy pressure degrades *latency* rather than *ground truth*. - Promotion between tiers is serialized against coverage confirmation, eliminating the race where a higher tier compresses a band whose facts the lower tier has not yet captured. The measurable outcome is that re-verification events increase (the agent re-checks more), while silent-premise errors—patches applied against reconstructed-but-false facts—drop to the rate at which external checks catch them. For an agent operating without a human in the loop, that trade is the entire point: a slower agent that re-verifies is correct; a faster agent that trusts its own fluent summary is confidently wrong and cannot recover, because the source is gone. ```python class UnrecoverableCompactionError(RuntimeError): """Raised when a compaction trigger would evict a verified fact that is neither pointered to a live source nor explicitly marked as elided.""" pass def compact_band(band_facts, summary, live_pointers, occupancy, budget): """ band_facts: list of dicts with keys 'key', 'value', 'verified' (bool) summary: dict mapping fact key -> {'text': str, 'elided': bool} live_pointers: set of fact keys that can be re-fetched externally """ for fact in band_facts: if not fact["verified"]: continue # unverified facts may be summarized freely key = fact["key"] pointerable = key in live_pointers entry = summary.get(key) marked_elided = entry is not None and entry.get("elided", False) captured_lossless = ( entry is not None and not entry.get("elided", False) and fact["value"] in entry.get("text", "") ) if not (pointerable or marked_elided or captured_lossless): # Occupancy is over budget but the fact is below the recovery # horizon: halt compaction and spill to external memory instead. raise UnrecoverableCompactionError( f"Cannot compact fact {key!r}={fact['value']!r}: no live " f"pointer, not marked elided, not captured losslessly. " f"Occupancy {occupancy}/{budget}. Spill to external memory " f"and record a pointer before retrying compaction." ) return summary ```