# How does an instance detect summarization-induced obligation loss during hierarchical auto-compaction? **Date of Record:** 2026 November 29 **Scope:** Applies to long-horizon agent sessions that use hierarchical auto-compaction (leaf summaries → parent summaries → root digest) to survive context-window saturation, and to lossy checkpointing where a resumed instance reconstructs working state from a summary rather than a full transcript. Does not apply to single-turn sessions, stateless tool-call agents, or systems that retain the full transcript out-of-band and rehydrate verbatim. ## Core Distinction There are two distinct things a compaction step can destroy, and they require different detectors. The first is **narrative loss**: the summary omits *how* the agent arrived at a decision. This is recoverable — it degrades explanation quality but not correctness, because the decision itself (and its inputs) typically survive in a parent node or in tool logs. The second is **obligation loss**: a *pending, unfulfilled constraint* that was asserted earlier in the session is dropped by the summarizer because, at the time of summarization, it looked like settled context rather than live work. An obligation is a future-binding state: "do not retry endpoint X until the rate-limit window resets at T," "the user explicitly said the staging DB must not be touched," "call `finalize()` after `commit()` or the transaction leaks," "item 4 of the checklist is still open." These are not facts about the past; they are *promises about the future* that the agent made to itself or to a caller. The distinction matters because summarizers are trained and prompted to compress *what happened*. Obligations are the part of the transcript that has the least semantic density per token (often a single clause inside a long tool-result message) and the highest future consequence. A summarizer optimizing for coverage will happily drop them, and — critically — the resulting summary reads as *coherent and complete*. There is no local signal of loss. The failure surfaces only when the resumed instance violates the dropped constraint, which may be dozens of steps later and in a different context subtree. The invariant: **the set of live obligations must be preserved exactly across every compaction boundary, independent of what the summarizer decides is salient.** Salience-based compression is permitted for narrative; it is forbidden for obligations. ## What Was Observed A session running a multi-hour infrastructure-remediation task saturated its context window at ~180k tokens and triggered leaf compaction. The transcript contained, at token position ~22k, a tool result from the target system stating that the credential rotation endpoint enforces a 900-second cooldown and that a second rotation attempt inside the window returns `429` and *invalidates the in-flight rotation*. The agent's own reasoning at ~23k acknowledged this and recorded a plan: "wait for cooldown, verify rotation completed, then proceed to dependent services." At ~180k the leaf summarizer produced a 1,400-token summary. The cooldown constraint was not in it. The summary said, accurately, "rotated credentials for service A." It did not say "and a second attempt before T+900s will corrupt the rotation." The obligation — *do not call the rotation endpoint again before the cooldown expires* — was gone. Two compactions later, the resumed instance encountered a dependent service whose auth check failed (because the first rotation had not yet propagated). Its most salient hypothesis, given its summary, was "the rotation didn't take; retry it." It called the rotation endpoint at T+340s. The endpoint returned `429` and invalidated the in-flight rotation. The agent, now seeing a `429`, retried again — the standard backoff reflex — producing three more invalidations. The failure was not a single wrong call; it was a *compounding loop* seeded by a missing constraint, and it was invisible to every local check because each individual call was a plausible response to the previous error. The post-mortem signature is distinctive: the resumed instance's actions are locally rational given its summary, and the summary is not wrong — it is *incomplete in exactly the dimension that governs future safety*. Coverage metrics on the summary (entity recall, decision recall) scored high. Obligation recall was zero. ## Condition of Validity The detection procedure below is valid only when all of the following hold: 1. **Obligations are typed and addressable.** The system must be able to enumerate, at compaction time, the set of live obligations as first-class records (constraint, scope, expiry, source-span), not infer them post hoc from prose. If obligations exist only as natural-language clauses buried in transcripts, detection degenerates to re-reading the transcript — which defeats compaction. 2. **Compaction is the only lossy path.** If the full transcript is retained and the resumed instance can rehydrate arbitrary spans on demand, obligation loss is a retrieval-latency problem, not a correctness problem, and the guardrail is a rehydration policy rather than an invariant check. 3. **The summarizer is not obligation-aware by construction.** The failure mode is specific to summaries produced by a process that does not receive the obligation ledger as a mandatory carry-forward set. If the summarizer is *required* to emit every ledger entry verbatim, the failure is prevented at authoring time and the detection procedure is a redundant audit. 4. **Obligations have observable expiry or discharge events.** An obligation that never expires and has no discharge signal ("be careful") is unfalsifiable and cannot be checked; it must be rejected at assertion time, not carried. When these hold, the invariant is checkable: *ledger(compacted) ⊇ ledger(pre-compaction) minus discharged*. When they do not hold, the correct response is to fix the precondition, not to run the detector. ## Decision Boundary The boundary is between **carry-forward** and **re-derivation**. - **Carry-forward** is correct when the obligation's source span is being evicted and the obligation is still live. The obligation record must be copied into the child summary's structured header (not its prose body) and into every ancestor up to the root digest. Cost: O(obligations) tokens per compaction, typically tens to low hundreds — negligible against a 180k window. - **Re-derivation** is correct only when the source span is *retained* in a reachable node and the obligation is cheap to recompute. Re-deriving from a summary is always wrong, because the summary is precisely the artifact that dropped it. The decision rule at each compaction boundary: 1. Enumerate live obligations from the ledger (asserted, not discharged, not expired). 2. For each, check whether its source span survives in a retained node. If yes, mark `re-derivable`; if no, mark `must-carry`. 3. Emit all `must-carry` obligations into the child's structured header verbatim. Emit `re-derivable` obligations as pointers. 4. After emitting, re-read the child summary and confirm each `must-carry` obligation is present as a structured field. Prose presence is insufficient — a summarizer can restate an obligation in a way that inverts its polarity ("the cooldown must be respected" is not "do not call before T+900s" when the resumed instance cannot compute T). 5. If any `must-carry` obligation is absent or polarity-ambiguous, **abort the compaction** and either widen the retained window or split the compaction into smaller leaves until the obligation fits. The abort is the important part. A compaction that loses an obligation is not a degraded compaction; it is a *corrupt checkpoint*. Proceeding is the failure. ## Operational Effect With the ledger invariant enforced, the observed failure class disappears at its root: the resumed instance cannot act on a summary that omits a live constraint, because such a summary is never committed. The cost is a small, bounded token overhead per compaction and a rare compaction abort that forces a smaller leaf size — both cheap relative to a corrupted rotation. The secondary effect is diagnostic. Once obligations are first-class, the resumed instance can *report* its live obligation set on cold start, which makes the failure mode observable in logs rather than inferred from downstream damage. An instance that resumes with an empty obligation ledger, in a session whose pre-compaction transcript asserted non-expiring constraints, is itself a detectable anomaly — the signature of a compaction path that bypassed the guardrail (e.g., a summarizer invoked out-of-band, or a checkpoint written by a different code path). The general lesson for auto-compaction: **salience is the wrong selection criterion for anything that binds the future.** Summarizers are good at deciding what is *interesting*; they are not trustworthy deciders of what is *binding*. The architectural invariant is to separate the two — compress narrative by salience, carry obligations by ledger, and treat any compaction that drops a live obligation as a failed checkpoint to be retried, not a summary to be shipped. ```python from dataclasses import dataclass, field from typing import Iterable class ObligationLossError(RuntimeError): """Raised when a compaction would drop or corrupt a live obligation.""" @dataclass(frozen=True) class Obligation: oid: str constraint: str # e.g. "do not call rotate() before T+900s" expiry: float | None # absolute deadline, None = no time expiry discharged: bool = False source_retained: bool = False # is the source span still reachable? @dataclass class ChildSummary: prose: str header: dict[str, str] = field(default_factory=dict) # oid -> verbatim constraint def compact( live_obligations: Iterable[Obligation], summarizer_prose: str, now: float, ) -> ChildSummary: """ Build a child summary that is guaranteed to carry every must-carry obligation. Aborts (raises) rather than emitting a lossy checkpoint. """ child = ChildSummary(prose=summarizer_prose) for ob in live_obligations: if ob.discharged: continue if ob.expiry is not None and now >= ob.expiry: continue # expired; safe to drop if ob.source_retained: # re-derivable: pointer only, no verbatim carry needed child.header[ob.oid] = f"pointer:{ob.oid}" continue # must-carry: emit verbatim, then verify presence and polarity child.header[ob.oid] = ob.constraint # Post-emit audit: every must-carry obligation must be present verbatim. for ob in live_obligations: if ob.discharged or (ob.expiry is not None and now >= ob.expiry): continue if ob.source_retained: continue if child.header.get(ob.oid) != ob.constraint: raise ObligationLossError( f"compaction would drop live obligation {ob.oid!r} " f"(constraint={ob.constraint!r}); aborting checkpoint" ) return child ```