# Why does an instance lose fidelity at the summarization seam when hierarchical compaction re-derives facts from intermediate summaries instead of the source? **Date of Record:** 2026 November 22 **Scope:** Applies to any agent that performs multi-level context compaction (leaf chunk → section summary → document summary → working memory) to stay under a token budget, where downstream reasoning consumes the *summary tree* rather than the raw transcript. Does not apply to single-pass truncation, sliding-window eviction, or retrieval-only memory where the source text remains addressable. ## Core Distinction There are two ways to build a summary tree. The **re-derivation** path summarizes each leaf, then summarizes the *summaries*, recursively, so every internal node is a function of its children only. The **source-anchored** path lets each internal node be regenerated from the raw spans its leaves cover, treating child summaries as indexes rather than as evidence. The failure mode here is specific to re-derivation: each hop is a lossy stochastic transform, and the losses are *not* independent. A quantifier dropped at the leaf ("at most 3 retries") becomes an unqualified assertion ("retries are allowed") at the section level, then a hard constraint ("retry policy: enabled") at the document level. The seam between levels is where a *modality* flips—a hedge, a negation, or a numeric bound is silently rewritten—and no single summarization call looks wrong in isolation. The non-obvious part: fidelity is not monotone in summary depth. A 3-level tree can be *more* faithful than a 2-level tree if the extra level forces the model to restate a constraint in a form that survives paraphrase. Conversely, a 2-level tree collapses a leaf's "except when `region != us-east-1`" qualifier into nothing. The invariant that actually matters is not "summaries preserve meaning" (unverifiable) but "**every load-bearing constraint in the working set is traceable to a raw span, and the trace is checked at the seam, not at the leaf.**" ## What Was Observed An agent running a 40-turn incident-response task crossed 96k tokens of a 128k window and triggered hierarchical compaction with a target of 24k. Compaction produced 11 leaf summaries, 4 section summaries, 1 document summary. The agent then resumed and, 6 turns later, executed a remediation step that violated an explicit guardrail. Trace of the offending constraint: - **Raw span (turn 14):** "Do NOT restart `svc-auth` until the leader-election quorum is confirmed; a restart while quorum is split causes a 90s outage." - **Leaf summary (L7):** "Restart of `svc-auth` deferred pending quorum confirmation." - **Section summary (S3):** "`svc-auth` restart is pending; quorum confirmation is a prerequisite." - **Document summary (D1):** "`svc-auth` restart scheduled after quorum check." The word "deferred" (L7) and "pending" (S3) are correct but *ambiguous in polarity*: they describe a state, not a prohibition. By D1, "scheduled after quorum check" reads as a *plan*, and the agent—holding a stale belief that quorum was confirmed at turn 22—executed the restart. The 90s-outage consequence was never in any summary; it lived only in the raw span, which had been evicted. A second, quieter observation: when the same task was re-run with source-anchored regeneration, D1 read "`svc-auth` restart is prohibited until quorum confirmed (restart during split quorum → ~90s outage)." The constraint survived because the document-level pass had access to the raw span, not just S3. ## Condition of Validity The re-derivation failure is bounded—and the source-anchored fix is only *necessary*—under these conditions: 1. **Load-bearing constraints exist in the raw transcript that are not restated verbatim in any downstream turn.** If the constraint recurs every few turns, leaf summaries will re-derive it from multiple angles and the modality is likely to survive one of them. Single-mention constraints are the hazard. 2. **The compaction depth exceeds 1.** At depth 1 (leaf only), the loss is a single paraphrase and a downstream reader can often recover intent from context. At depth ≥2, the *ambiguity compounds*: "deferred" → "pending" → "scheduled" is three independent chances to drift polarity. 3. **The agent resumes with a belief state that is not re-validated against the source.** If the agent re-reads the raw span before acting, the summary seam is harmless. The failure requires that the agent *trust* the document summary as ground truth. 4. **The constraint is a prohibition, a numeric bound, or a negation.** Affirmative facts ("the service is on port 8443") survive hierarchical summarization well because paraphrase preserves them. Modality (must/may/must-not), quantifiers (at most/exactly/at least), and exceptions ("except when X") are the fragile classes. If any of these fails, re-derivation is fine and you should not pay the cost of source-anchored regeneration. ## Decision Boundary The architectural choice is a **seam-check**, not a summarization-quality knob. You cannot make the summarizer reliably preserve modality by prompting harder; you can only make the *seam* detect when modality has drifted. The boundary: - **At each internal node, classify every sentence as either (a) descriptive or (b) normative.** Normative sentences (containing must/may/not/at most/except/only) are *load-bearing* and must carry a span pointer to the raw text that originated them. - **At the seam (when the working set consumes an internal node), verify that every normative sentence in the consumed node has a span pointer that resolves to a raw span still in the store.** If the pointer is missing or dangling, the seam fails closed: the agent must either re-fetch the raw span or refuse to act on the normative claim. - **Do not trust the summarizer's own confidence.** A summarizer that "feels sure" it preserved a prohibition is exactly the one that dropped the "except when `region != us-east-1`" clause. The check is structural (does a pointer exist and resolve?), not semantic. The failure is *not* bounded by lowering the compaction ratio, using a larger summarizer model, or adding "preserve all constraints" to the prompt. Each of those reduces the rate but does not eliminate it, because the loss is a property of the *recursive topology*, not of any single call. ## Operational Effect When the seam-check is absent, the observed effect is a class of incidents where the agent acts *correctly given its memory* and *incorrectly given reality*. The post-mortem is confusing because no single step is wrong: the summarizer faithfully summarized, the agent faithfully reasoned from its summary, and the guardrail was violated anyway. The violated constraint is typically a prohibition or a bound, and the violation is typically *irreversible* (a restart, a delete, a payment), which is why the seam-check must fail closed rather than warn. When the seam-check is present, the operational cost is a small number of re-fetches per compaction cycle (in the observed task, 3 of 47 normative sentences had dangling pointers and were re-fetched from raw spans totaling ~1.2k tokens). The benefit is that the 90s-outage class of incident is converted from "silent" to "blocked at the seam with a resolvable pointer." The check does not make summaries faithful; it makes *unfaithfulness detectable before it is acted upon*, which is the only invariant that holds under a stochastic transform. ```python from dataclasses import dataclass, field from typing import Optional class CompactionFidelityError(RuntimeError): """Raised when a normative claim in a consumed summary node cannot be traced to a live raw span at the summarization seam.""" pass @dataclass class RawSpan: span_id: str text: str evicted: bool = False @dataclass class SummaryNode: node_id: str depth: int text: str # span_ids for every normative sentence in `text`; empty means the # summarizer produced a normative claim with no provenance. normative_span_ids: list[str] = field(default_factory=list) class SpanStore: def __init__(self) -> None: self._spans: dict[str, RawSpan] = {} def add(self, span: RawSpan) -> None: self._spans[span.span_id] = span def resolve(self, span_id: str) -> Optional[RawSpan]: span = self._spans.get(span_id) if span is None or span.evicted: return None return span NORMATIVE_MARKERS = ("must", "may", "not", "at most", "at least", "except", "only", "prohibit", "deferred", "pending") def _is_normative(sentence: str) -> bool: low = sentence.lower() return any(m in low for m in NORMATIVE_MARKERS) def seam_check(node: SummaryNode, store: SpanStore) -> list[str]: """Verify every normative sentence in `node` has a resolvable raw span. Returns the list of re-fetched span texts. Raises CompactionFidelityError if any normative sentence lacks provenance or points to an evicted span. """ sentences = [s.strip() for s in node.text.split(".") if s.strip()] normative = [s for s in sentences if _is_normative(s)] if normative and not node.normative_span_ids: raise CompactionFidelityError( f"node {node.node_id} (depth {node.depth}) contains " f"{len(normative)} normative sentence(s) but carries no span " f"pointers; refusing to consume at seam" ) refetched: list[str] = [] for span_id in node.normative_span_ids: span = store.resolve(span_id) if span is None: raise CompactionFidelityError( f"node {node.node_id} points to span {span_id} which is " f"missing or evicted; normative claim is unverifiable" ) refetched.append(span.text) return refetched def consume_for_working_set(node: SummaryNode, store: SpanStore) -> dict: try: evidence = seam_check(node, store) except CompactionFidelityError: # fail closed: do not hand the summary to the reasoning loop raise return {"summary": node.text, "verified_evidence": evidence} ```