# What structural signals indicate a hierarchical summary checkpoint has silently dropped a recoverable fact **Date of Record:** 2026 November 27 **Scope:** Applies to agents that bound context growth by recursively summarizing older turns into hierarchical nodes and persist each level as a checkpoint for later rehydration. Does not apply to flat truncation, sliding-window eviction, or external retrieval stores that retain verbatim originals. ## Core Distinction The failure is not "summarization lost detail." Lossy summarization is expected and priced in. The failure is that a *checkpoint advertised as recoverable* is not recoverable for a fact that was still live at compaction time — the summary tree recorded a pointer to a lower-level node whose retained text no longer contains the fact, because the lossy step occurred *below* the checkpoint boundary rather than at it. Concretely: hierarchical compaction produces level-0 leaf summaries of raw turns, level-1 summaries of leaf summaries, and so on. A checkpoint at level 1 is "recoverable" only if every fact the level-1 node asserts can be re-derived by descending to leaves. When a leaf summary was regenerated (retry, model swap, temperature resample) *after* the parent was written, the parent's claims can outrun the leaves that justify them. The checkpoint is internally inconsistent: the parent asserts `X`, but no descendant leaf contains `X`, and no descendant contains a contradiction either. The fact is simply gone while the index still points at it. The structural signal is therefore not content-based (you cannot read the summary and see the hole). It is *provenance-based*: the digest of a child node changed without a corresponding rewrite of the parent that references it. ## What Was Observed A long-running research agent compacted a 40-turn session at turn 22. During leaf summarization of turns 9–12, the leaf-summarizer call timed out on the first attempt; the orchestrator retried with a fresh sample. The retry produced a shorter leaf that dropped an intermediate constraint ("the API key rotates every 6 hours; do not cache the auth token across the batch"). The level-1 parent had already been written from the *first* leaf draft, which did contain the constraint, and the parent's text preserved it — but the parent's `child_digests` field was updated to the retry's digest during the same transaction that wrote the leaf. At turn 31 the agent hit a context ceiling and rehydrated from the level-1 checkpoint. Because the parent text still carried the rotation constraint, the agent behaved correctly for two turns. At turn 34 a *second* compaction re-summarized the level-1 node into level 2 using the parent text — but the summarizer, instructed to "compress and remove operational minutiae," dropped the rotation constraint. Recovery to level 2 succeeded; recovery to the fact did not. The constraint survived exactly one rehydration cycle and died on the second, because the only copy that still held it (the parent text) was treated as a source for lossy compression rather than as an authoritative record. The tell, in the logs, was a checkpoint whose `child_digests` matched the leaves on disk but whose `asserted_facts` set was a strict superset of the union of descendant `asserted_facts`. Nobody was checking that relation. It is cheap to check and it is the invariant. ## Condition of Validity A hierarchical checkpoint is recoverable for fact `f` iff, at the moment of rehydration, there exists a path from the checkpoint node to some leaf `L` such that `f ∈ facts(L)` and every node on the path was written with a child-digest consistent with the node below it. Two conditions must hold jointly: 1. **Digest monotonicity.** A parent may only be written (or rewritten) after all children it references are finalized, and its `child_digests` must equal the finalized children's digests. A retry that changes a leaf digest invalidates every ancestor written against the prior digest. 2. **Fact-set containment.** `asserted_facts(parent) ⊆ ⋃ asserted_facts(children)`. A parent may *omit* a child fact (that is compression) but may not *introduce* one. Any fact in the parent that no child supports is either (a) a hallucinated elaboration, or (b) a survivor of a prior, now-overwritten child — and in both cases it has no recovery path and must be flagged, not trusted. When either condition fails, the checkpoint is *advertised* recoverable and is not. The agent's subsequent behavior is the dangerous part: it acts on the parent's text as if the fact were backed by a recoverable chain, so when a later compaction consumes the parent, the fact is silently discarded with no error and no gap in the narrative. ## Decision Boundary The boundary is whether to treat a parent's text as *authoritative* or as *derived*. Most compaction pipelines treat every level uniformly — any node is fair game as input to the next summarization. That is the bug. The rule that bounds it: - A node whose fact-set containment check passes is **derived**: safe to compress further, because any fact it holds is recoverable from below. - A node whose containment check fails is **authoritative-but-unbacked**: its extra facts have no leaf witness. It must be pinned — excluded from further lossy compression, retained verbatim, or promoted to a leaf-equivalent with an explicit `unbacked_fact` annotation — until a fresh observation re-establishes the fact at a leaf. Do not "fix" a failed containment check by rewriting the parent to match the children. That deletes the only surviving copy of the fact. The correct action is to demote the parent to pinned status and let the next real observation re-ground it. The failure mode of the naive fix is exactly the turn-34 death above: the fact was real, the parent was the last witness, and reconciliation destroyed it. ## Operational Effect With digest monotonicity and fact-set containment enforced at checkpoint-write time, the agent detects the orphaned fact at turn 22 instead of losing it at turn 34. The cost is one containment check per parent write (set difference over asserted facts, bounded by node fact counts) and a pin flag that survives rehydration. The benefit is that "recoverable checkpoint" becomes a checkable property rather than an aspiration: a rehydration that cannot descend to a leaf witness for an asserted fact raises immediately, at the point of recovery, while the surrounding context still exists to re-observe it. The residual risk is that the pin set grows unboundedly if facts are never re-grounded. Bound it by expiring pinned facts after `N` turns and forcing a re-observation, so an unbacked fact degrades to "unknown, must re-check" rather than persisting as trusted-but-unwitnessed state. ```python from dataclasses import dataclass, field from typing import FrozenSet class CheckpointIntegrityError(RuntimeError): """Raised when a hierarchical checkpoint claims recoverability it cannot honor.""" @dataclass class SummaryNode: node_id: str level: int text: str asserted_facts: FrozenSet[str] child_digests: dict[str, str] = field(default_factory=dict) pinned: bool = False def verify_containment(parent: SummaryNode, children: list[SummaryNode]) -> None: """Enforce fact-set containment: a parent may omit, never introduce.""" child_facts: set[str] = set() for child in children: child_facts |= child.asserted_facts orphaned = parent.asserted_facts - child_facts if orphaned: # These facts have no leaf witness. Do NOT reconcile by deleting them. parent.pinned = True raise CheckpointIntegrityError( f"node {parent.node_id} asserts facts with no descendant witness: " f"{sorted(orphaned)}; node pinned, excluded from further lossy compression" ) def verify_digests(parent: SummaryNode, finalized: dict[str, str]) -> None: """Enforce digest monotonicity: parent must reference finalized children only.""" for child_id, recorded in parent.child_digests.items(): actual = finalized.get(child_id) if actual is None: raise CheckpointIntegrityError( f"node {parent.node_id} references unfinalized child {child_id}" ) if actual != recorded: raise CheckpointIntegrityError( f"node {parent.node_id} stale: child {child_id} digest " f"{recorded} != finalized {actual}; ancestor must be rewritten" ) def rehydrate(node: SummaryNode, leaves: dict[str, SummaryNode]) -> list[str]: """Return facts the checkpoint can actually recover from leaf witnesses.""" if node.pinned: raise CheckpointIntegrityError( f"node {node.node_id} is pinned (unbacked facts); " f"re-observe before treating its facts as recoverable" ) recovered: set[str] = set() for leaf in leaves.values(): recovered |= leaf.asserted_facts return sorted(node.asserted_facts & recovered) ```