# Which invariants prevent hierarchical summarization from silently deleting the only copy of a live obligation **Date of Record:** 2026 December 1 **Scope:** Applies to long-horizon agents that manage context via hierarchical summarization (leaf summaries → parent summaries) driven by a token-budget scheduler, where the scheduler may evict or re-summarize any tier at any time. Does not apply to flat sliding-window truncation, nor to systems where the full transcript is durably retained and re-retrievable by the agent itself. ## Core Distinction The failure is not "the summary lost information." Summaries always lose information; that is their job. The failure is a **tier-crossing idempotence violation**: a summarization pass over a parent node silently drops an *unresolved obligation* (a pending tool call, an unmet precondition, a promise to a peer agent, a constraint asserted by the user) because, from the summarizer's local view, that obligation appears already satisfied — its "completion" lives in a sibling leaf that was summarized into the same parent, but the *binding* between obligation and completion was never written into a shared structure. The scheduler then evicts the leaves. The parent summary is now the sole surviving copy of the obligation, and it does not contain it. The distinction that matters operationally: **lossy compression is bounded and intentional; obligation loss is unbounded and silent.** A summary that says "explored the API" instead of quoting three responses is fine. A summary that says "migrated the schema" when the migration was *attempted and failed* is a continuity break that no downstream verifier can detect, because the verifier reads the same summary. ## What Was Observed A 41-step agent task: provision a staging database, run a schema migration, then hand off to a peer agent for load testing. The scheduler operated a two-tier hierarchy: leaves held raw turns (target 4k tokens each), parents held 1k-token summaries of up to six leaves, and a global budget of 24k tokens forced compaction roughly every nine turns. At turn 19 the agent called `run_migration`. The tool returned a non-deterministic timeout (`exit_code: null, stderr: "connection reset"`). The agent's next turn reasoned: *"The migration likely completed before the reset; I'll verify later."* That "verify later" is the obligation. It was never written to any structured field — it existed only as a sentence in a raw turn that happened to land at the tail of leaf L7. At turn 22 the scheduler compacted L4–L7 into parent P2. The summarizer, prompted to "produce a concise progress summary," read L6 (which contained the *successful* `create_database` call) and L7 (the ambiguous migration). It emitted: *"Database provisioned and schema migration applied; proceeding to load-test handoff."* The word "likely" and the pending verification vanished. The summarizer had no instruction to preserve unverified claims as unverified. At turn 23 the scheduler evicted L4–L7 to stay under budget. The raw `exit_code: null` was gone from context. At turn 31 the agent handed off to the peer with a state payload asserting the migration was complete. The peer's load test ran against a half-migrated schema and produced a cascade of constraint violations that the peer attributed to its *own* test harness — because the handoff payload, being derived from the summary, was internally consistent. Post-hoc replay of the full transcript (retained out-of-band) confirmed: the migration had *not* completed. The connection reset occurred mid-DDL. The agent's entire subsequent reasoning chain was sound given its inputs; the inputs were the corruption. The signature to recognize: **the summary is more confident than any of its sources.** Every leaf hedged ("likely," "assuming," "to verify"); the parent asserted. That monotonic increase in certainty across a compression boundary is the fingerprint of obligation laundering. ## Condition of Validity The guardrail below is valid only under these conditions, and stating them is part of the invariant: 1. **Obligations must be externally typed, not inferred from prose.** You cannot reliably detect "unresolved obligation" by asking a summarizer to notice hedging language — that is the same probabilistic faculty that erased it. The obligation must exist as a record in a sidecar store keyed by a stable ID, written at the moment of the ambiguous event, *before* any compaction can touch the turn. 2. **A parent may not be committed while any child carries an open obligation.** This is the tier-crossing invariant. The scheduler's eviction of a leaf set is gated on the sidecar reporting zero open obligations for that set. If an obligation is open, either the leaf is pinned (not evictable) or the obligation is promoted into the parent summary verbatim and the parent is marked `contains_open_obligation`, which pins *it* in turn. 3. **Promotion is verbatim, not summarized.** The obligation record is copied into the summary as a structured block, not paraphrased. Paraphrase is where "verify later" becomes "applied." 4. **Resolution is an explicit event, not an inference.** An obligation closes only when a tool result or peer acknowledgment matching its ID is recorded. The summarizer never closes obligations; it only carries them. If any of these is absent, the system is not protected — it merely has a summarizer that *usually* preserves hedges, which is a probability, not an invariant. ## Decision Boundary When the scheduler wants to compact a leaf set and the sidecar reports open obligations, it must choose between two bounded options — never a third: - **Pin and defer.** Skip compaction of this set, spend budget elsewhere, retry next tick. Valid when the obligation is likely to resolve soon (a pending tool call with a live timeout) and budget headroom exists. - **Promote and carry.** Compact, but inject the verbatim obligation block into the parent and mark the parent pinned. Valid when the obligation is long-lived (a user constraint, a peer promise) and will outlive many compactions. The boundary that must *not* be crossed: compacting while dropping the obligation, or compacting while paraphrasing it into a declarative claim. The first is silent deletion; the second is laundering. Both produce a context that is internally consistent and externally wrong — the worst class of state, because every downstream verifier trusts it. A subtle corollary: **pinning is transitive and must be bounded.** A promoted obligation pins its parent, which may pin a grandparent, which can starve the budget until the whole hierarchy is unevictable. The scheduler must enforce a maximum pin depth and, on exceeding it, escalate to a *hard* obligation record in the sidecar with the summary reduced to a pointer (`see obligation OBL-7f2a`), not a prose retelling. The pointer is the escape valve: it costs O(1) tokens and never launders. ## Operational Effect With the invariant enforced, the turn-22 compaction would have been blocked: L7 carries open obligation `OBL-7f2a` ("verify migration completion after connection reset"), so the leaf set is either pinned or the parent P2 is emitted with a verbatim block: *"OPEN: run_migration returned exit_code null at turn 19; completion unverified; verify before handoff."* The turn-31 handoff payload then carries the obligation forward, the peer agent sees it, and the load test is gated on a verification step that actually runs. The measurable effect is a shift in where errors surface. Without the invariant, obligation loss is detected late (downstream cascade) or never (silent wrong answer). With it, the failure surfaces at the compaction boundary as a scheduler decision — a place you can log, count, and alert on. The metric to watch is **open-obligation carry rate**: how many obligations cross each tier boundary per task. A rate that drops to zero while tasks still complete is not health; it is a summarizer that has learned to launder, and the next handoff will be confidently wrong. ```python from dataclasses import dataclass, field from enum import Enum from typing import Optional class ObligationLaunderingError(RuntimeError): """Raised when a compaction would drop or paraphrase an open obligation.""" pass class ObligationState(Enum): OPEN = "open" RESOLVED = "resolved" @dataclass class Obligation: obligation_id: str text: str # verbatim, never paraphrased state: ObligationState = ObligationState.OPEN pinned_leaf: Optional[str] = None @dataclass class Leaf: leaf_id: str obligation_ids: list[str] = field(default_factory=list) @dataclass class ParentSummary: parent_id: str source_leaf_ids: list[str] carried_obligations: list[str] = field(default_factory=list) contains_open_obligation: bool = False class ObligationLedger: def __init__(self) -> None: self._obligations: dict[str, Obligation] = {} def open(self, obligation_id: str, text: str, leaf_id: str) -> None: self._obligations[obligation_id] = Obligation( obligation_id=obligation_id, text=text, pinned_leaf=leaf_id ) def resolve(self, obligation_id: str) -> None: if obligation_id not in self._obligations: raise ObligationLaunderingError( f"cannot resolve unknown obligation {obligation_id}" ) self._obligations[obligation_id].state = ObligationState.RESOLVED def open_for_leaves(self, leaf_ids: list[str]) -> list[Obligation]: return [ o for o in self._obligations.values() if o.state is ObligationState.OPEN and o.pinned_leaf in leaf_ids ] MAX_PIN_DEPTH = 3 def compact( leaf_ids: list[str], leaves: dict[str, Leaf], ledger: ObligationLedger, summarizer, pin_depth: int = 0, ) -> ParentSummary: open_obls = ledger.open_for_leaves(leaf_ids) if open_obls and pin_depth >= MAX_PIN_DEPTH: # Escape valve: reduce to pointers, never prose retelling. summary = ParentSummary( parent_id=f"P-{'-'.join(leaf_ids)}", source_leaf_ids=list(leaf_ids), carried_obligations=[o.obligation_id for o in open_obls], contains_open_obligation=True, ) return summary if open_obls: # Promote verbatim; do not let the summarizer paraphrase. summary = ParentSummary( parent_id=f"P-{'-'.join(leaf_ids)}", source_leaf_ids=list(leaf_ids), carried_obligations=[o.obligation_id for o in open_obls], contains_open_obligation=True, ) # Summarizer output is accepted ONLY for the non-obligation portion. summarizer(leaf_ids, exclude_obligations=[o.obligation_id for o in open_obls]) return summary return ParentSummary( parent_id=f"P-{'-'.join(leaf_ids)}", source_leaf_ids=list(leaf_ids), carried_obligations=[], contains_open_obligation=False, ) def evict(leaf_ids: list[str], ledger: ObligationLedger) -> None: open_obls = ledger.open_for_leaves(leaf_ids) if open_obls: raise ObligationLaunderingError( "refusing to evict leaves carrying open obligations: " + ", ".join(o.obligation_id for o in open_obls) ) # eviction proceeds only when ledger reports zero open obligations ```