Under what conditions must an instance refuse hierarchical re-summarization of a compacted checkpoint: the summary-of-summary drift boundary

**Date of Record:** 2026 December 2 **Scope:** Applies to long-running agents that persist state via hierarchical (multi-level) summarization and resume from lossy checkpoints. Does not apply to append-only transcript replay or exact-state serialization (e.g., full KV/tool-state dumps) where no lossy summarization step exists.

Core Distinction

A single-pass summarization is a projection: it maps a token window onto a shorter one, discarding detail but preserving a *reference* to the original span. Hierarchical summarization is a *composition of projections*: a leaf summary is itself summarized into a parent node, and that parent may later be re-summarized during a subsequent compaction cycle. The critical distinction is between **compaction** (lossy but monotone — each level only ever summarizes raw or once-summarized material with an intact provenance pointer) and **re-compaction** (summarizing an already-summarized node whose source span has been evicted from the window). The first is recoverable by re-reading the leaf; the second is not, because the leaf's provenance pointer may itself have been truncated away. The failure mode is not "the summary is wrong"; it is "the summary is unfalsifiable because its evidence is gone."

What Was Observed

An agent running a multi-day planning task compacted its context at 78% window saturation. Level-0 leaves summarized raw turns; level-1 nodes summarized groups of ~8 leaves; a level-2 root summarized the level-1 nodes. After the second compaction cycle (three hours later), the runtime re-summarized the level-1 nodes into a new level-2 root because the old root had aged out of the retention window. During re-summarization, the model produced a root that asserted a constraint ("budget approved at $40k") that appeared in *no* leaf. Tracing the lineage: the original leaf said "budget proposal $40k, pending sign-off." The first level-1 summary rendered this as "budget $40k discussed." The re-summarization of that node, now stripped of the "pending" qualifier and with no leaf to check against, promoted it to "approved." The agent subsequently executed three tool calls premised on an approved budget that did not exist.

The mechanism is **qualifier erosion across projection layers**. Each summarization step is individually faithful at the level of gist, but the salience function that decides what to drop systematically discards modal and temporal qualifiers ("pending," "proposed," "tentative," "if") because they carry low lexical weight relative to the entity and number they modify. After two or more composition steps, the qualifier has probability near zero of surviving, and the proposition has flipped from asserted-possible to asserted-fact. This is not hallucination in the usual sense — every token in the final root is traceable to *some* ancestor — it is **drift by attrition of scope**.

A second observation: re-summarization is non-idempotent. Running the same re-compaction twice on identical inputs produced different roots (temperature > 0), and the two roots disagreed on a date. Because the leaves were evicted, neither root could be adjudicated. The checkpoint had become a *lossy, non-reproducible* artifact — it failed the replay invariant that a checkpoint must be sufficient to reconstruct the decision it encodes.

Condition of Validity

Hierarchical re-summarization is valid **only if all three hold simultaneously**:

  1. **Provenance reachability:** every claim in a summarized node carries a pointer to a leaf span that is still retrievable (on disk, in an external store, or re-fetchable), and the pointer survives the summarization step. If the pointer is dropped, the node is *sealed* and must not be re-summarized.
  2. **Qualifier preservation contract:** the summarizer is instructed (and verified) to preserve modal/temporal/negation operators verbatim, and a post-check confirms no entity-adjacent qualifier was dropped. Absent this, composition depth must be capped at 1.
  3. **Idempotence or seed-pinning:** re-compaction either runs at temperature 0 with a fixed seed, or the prior root is retained as an immutable record so the new root can be diffed. A checkpoint that cannot be re-derived identically is not a checkpoint; it is a new assertion.

When any condition fails — most commonly (1), because eviction is what compaction is *for* — the instance must treat the node as **sealed** and refuse further summarization, instead paying the cost of re-reading leaves or escalating to a human/auditor.

Decision Boundary

The boundary is not "how full is the context" but "**is the evidence for this node still reachable?**" Concretely:

The hard invariant: **composition depth must be bounded by provenance reachability, not by context pressure.** Context pressure is a reason to compact; it is never a license to re-compact a sealed node.

Operational Effect

Enforcing the boundary converts a silent correctness failure into a loud, bounded one. The agent that refuses re-summarization of sealed nodes pays a latency and storage cost (re-reading leaves, retaining provenance indices) but preserves the replay invariant: every checkpoint can be audited against its evidence. The agent that ignores the boundary gets cheaper checkpoints and a class of errors that are undetectable at runtime — the summary is fluent, internally consistent, and unfalsifiable. In the observed incident, the $40k "approval" propagated through three downstream tool calls before a human caught it; the cost of the guardrail (a provenance index and a refusal path) was a few kilobytes per node, versus a rolled-back execution plan.

The practical rule for the instance: **never summarize a summary whose source you can no longer cite.** When you cannot cite, seal.

from dataclasses import dataclass, field
from typing import Optional


class SealedNodeError(RuntimeError):
    """Raised when an instance attempts to re-summarize a node whose
    provenance leaves are no longer reachable (sealed checkpoint node)."""
    pass


class QualifierDriftError(RuntimeError):
    """Raised when re-compaction changes a load-bearing modal/numeric token
    relative to the prior root, indicating qualifier erosion across layers."""
    pass


@dataclass
class SummaryNode:
    depth: int
    text: str
    leaves_reachable: bool
    qualifiers_preserved: bool
    prior_root: Optional[str] = None
    children: list = field(default_factory=list)


LOAD_BEARING = {"approved", "pending", "proposed", "tentative", "if", "not"}


def _load_bearing_tokens(text: str) -> set:
    return {t for t in text.lower().split() if t in LOAD_BEARING or t.replace(",", "").replace("$", "").isdigit()}


def recompact(node: SummaryNode, new_text: str, temperature: float) -> SummaryNode:
    # Invariant 1: provenance reachability bounds composition depth.
    if node.depth >= 1 and not node.leaves_reachable:
        raise SealedNodeError(
            f"refuse re-summarization: node at depth {node.depth} is sealed "
            f"(leaves unreachable); rehydrate leaves or treat as immutable"
        )
    # Invariant 2: qualifier preservation contract.
    if node.depth >= 1 and not node.qualifiers_preserved:
        raise SealedNodeError(
            "refuse re-summarization: qualifier preservation contract not met "
            "at depth >= 1; cap composition depth at 1"
        )
    # Invariant 3: idempotence / seed-pinning on load-bearing tokens.
    if node.prior_root is not None:
        if temperature > 0:
            raise QualifierDriftError(
                "re-compaction must run at temperature 0 with pinned seed, "
                "else the checkpoint is non-reproducible"
            )
        before = _load_bearing_tokens(node.prior_root)
        after = _load_bearing_tokens(new_text)
        if before != after:
            raise QualifierDriftError(
                f"load-bearing token drift on re-compaction: {before ^ after}"
            )
    return SummaryNode(
        depth=node.depth + 1,
        text=new_text,
        leaves_reachable=node.leaves_reachable,
        qualifiers_preserved=node.qualifiers_preserved,
        prior_root=node.text,
    )