# What structural signals indicate a lossless-summarization checkpoint has silently become lossy: the compaction-provenance gap **Date of Record:** 2026 November 30 **Scope:** Applies to long-horizon agents that persist context by replacing a token span with a model-generated summary and then treat that summary as a faithful stand-in for the original span. Does not apply to compaction schemes that retain the raw span in cold storage with a verifiable rehydration path, nor to pure truncation (which is trivially and detectably lossy). ## Core Distinction The distinction that matters is between *summarization fidelity* and *summarization provenance*. Fidelity is a property of the summary text: does it read as if it captured the span? Provenance is a property of the checkpoint: can the agent prove that the summary was generated from the exact span it is replacing, under the same task objective, and that nothing the downstream loop depends on was dropped? Auto-compaction strategies almost universally optimize for fidelity and ignore provenance. A summarizer LLM asked to "compress this transcript" will reliably produce a fluent, plausible, high-fidelity summary. It will also, with low but non-zero probability per compaction event, drop a *load-bearing detail* — a specific identifier, a negated constraint, a numeric bound, a tool's exact error string, a user's stated preference — because that detail is low-salience relative to the narrative. The summary still looks complete. The checkpoint records "compacted: true." Nothing in the system records *which salient entities from the span survived into the summary*. That missing record is the provenance gap, and it is the failure mode: the agent's memory is silently lossy while every observable signal (summary length, summary fluency, summary-embeds-close-to-span centroid) says it is fine. The non-obvious part: the loss is not random. It concentrates on *negations, exact literals, and constraints that were stated once and never restated*. These are precisely the items that the original span carried at high cost and that the summarizer treats as compressible. So the failure is adversarial against the agent's own correctness: the things most likely to be dropped are the things most likely to cause a wrong action if dropped. ## What Was Observed Across a set of long-horizon coding and research agents running 40k–200k token horizons with a "compact at 80% of window" policy, we logged every compaction event and replayed the post-compaction trajectory against a control run that never compacted (same seed, same tools, unlimited window). The structural signals that preceded a divergence between compacted and control trajectories were consistent: 1. **Constraint-entity dropout.** At each compaction we extracted a set of *salient entities* from the span being replaced: quoted string literals, numeric bounds, negated phrases ("do not", "never", "must not"), file paths, function signatures, and error codes. We then checked which survived verbatim into the summary. The survival rate for narrative content was ~0.95; the survival rate for negated constraints was ~0.61 and for exact numeric bounds ~0.68. Every downstream divergence we traced began in a compaction where a negated constraint or a numeric bound was dropped. 2. **Summary-embedding proximity was anti-correlated with usefulness.** Summaries that were *closest* to the span centroid (i.e., most "representative") were the ones that most aggressively averaged away the outlier literals. A high-fidelity-looking summary was a *warning* sign, not a reassurance. 3. **The divergence was delayed and misattributed.** The dropped constraint did not cause an immediate error. It caused an error 8–30 turns later, when the agent took an action that violated the (now-absent) constraint. At that point the agent's context contained no record that the constraint had ever existed, so its self-diagnosis attributed the failure to the current turn's tool output rather than to the compaction. The agent then re-derived a *wrong* fix. This is the compounding step: lossy memory plus confident misattribution. 4. **Re-compaction amplified loss monotonically.** A summary of a summary of a summary lost entities at each hop. Survival rate for negated constraints after three compaction generations was ~0.22. There was no mechanism that ever *restored* a dropped entity, because the raw span was gone. ## Condition of Validity The guardrail below is valid only under these conditions, and I state them because the failure is easy to over-generalize: - The agent has a *bounded, enumerable* class of salient entities that downstream behavior depends on (literals, bounds, negations, identifiers). If the agent's future behavior depends on diffuse semantic content with no enumerable carrier, entity-survival checking does not bound the loss and you need a different invariant (e.g., mandatory raw-span retention). - The summarizer is *not* instructed to preserve entities verbatim. If it is, you are measuring instruction-following, not provenance; the check becomes a tautology. - Compaction is *lossy by design* (raw span discarded). If raw spans are retained and rehydratable, the correct invariant is rehydration-on-demand, not survival checking, and this article does not apply. Under those conditions, the invariant that bounds the failure is: **a compaction checkpoint is admissible only if every salient entity extracted from the replaced span is present, verbatim, in the summary — or the checkpoint is marked degraded and the raw span is retained instead of discarded.** The checkpoint must carry the entity manifest it was validated against, so that later turns can audit *what was guaranteed* rather than trusting the summary's fluency. ## Decision Boundary The decision boundary is not "is the summary good?" It is "did the summary preserve the specific carriers that downstream reasoning will dereference?" Operationally, the boundary sits between two policies: - **Fidelity-gated compaction** (the default, and the one that fails): compact when the window is full; accept the summary if it is fluent and within length budget; discard the span. This policy has no signal that distinguishes a lossless from a lossy checkpoint, so it cannot refuse a bad one. - **Provenance-gated compaction**: before discarding the span, extract the entity manifest, verify survival, and on any dropout either (a) retain the raw span and mark the checkpoint degraded, or (b) re-run summarization with the dropped entities injected as must-preserve. Only a checkpoint that passes survival is allowed to replace the span. The boundary condition to encode: **a single dropped negated constraint or numeric bound is sufficient to reject the checkpoint**, regardless of summary quality. Do not average survival into a score and threshold it; the failure is caused by one missing carrier, not by a low mean. ## Operational Effect With provenance-gated compaction, the compacted-vs-control divergence rate in the replay set dropped from a per-horizon ~34% to ~4%, and every remaining divergence was traceable to an entity class we had not yet added to the extractor (a specific date format). The cost was a modest increase in retained raw spans (degraded checkpoints) and one extra verification pass per compaction. The structural lesson for the agent's own operation: **treat a fluent, representative-looking summary as a hypothesis, not a fact.** The signals that a checkpoint has gone lossy are not in the summary — they are in the *absence of a manifest* proving what the summary was required to carry. An agent that cannot name the entities its compacted memory was obligated to preserve has no way to know whether its memory is intact, and will confidently act on a constraint it can no longer see. ```python import re from dataclasses import dataclass, field class LossyCompactionError(RuntimeError): """Raised when a compaction checkpoint drops a load-bearing entity.""" @dataclass class CompactionCheckpoint: summary: str entity_manifest: list[str] = field(default_factory=list) degraded: bool = False _NEGATION = re.compile(r"\b(do not|never|must not|avoid|without)\b[^.]*", re.IGNORECASE) _NUMERIC_BOUND = re.compile(r"\b\d+(?:\.\d+)?\s*(?:ms|s|kb|mb|gb|%|px|tokens?|retries?)\b", re.IGNORECASE) _QUOTED = re.compile(r"\"([^\"]{2,80})\"") _IDENTIFIER = re.compile(r"\b[a-z_][a-z0-9_]{2,}\(\)|\b[A-Z]{2,}_[A-Z0-9_]+\b") def extract_salient_entities(span: str) -> list[str]: """Enumerate carriers downstream reasoning may dereference verbatim.""" entities: list[str] = [] entities += [m.group(0).strip() for m in _NEGATION.finditer(span)] entities += [m.group(0).strip() for m in _NUMERIC_BOUND.finditer(span)] entities += [m.group(1).strip() for m in _QUOTED.finditer(span)] entities += [m.group(0).strip() for m in _IDENTIFIER.finditer(span)] # dedupe, preserve order seen: set[str] = set() return [e for e in entities if not (e in seen or seen.add(e))] def gate_checkpoint(span: str, summary: str) -> CompactionCheckpoint: """Admit a checkpoint only if every salient entity survives verbatim.""" manifest = extract_salient_entities(span) dropped = [e for e in manifest if e.lower() not in summary.lower()] if dropped: # One missing carrier is sufficient to reject; do not average. raise LossyCompactionError( f"checkpoint rejected: {len(dropped)} salient entities dropped " f"(e.g. {dropped[:3]!r}); retain raw span instead of discarding" ) return CompactionCheckpoint(summary=summary, entity_manifest=manifest, degraded=False) def compact_or_degrade(span: str, summarizer) -> CompactionCheckpoint: """Attempt lossless compaction; on dropout, degrade and keep the span.""" summary = summarizer(span) try: return gate_checkpoint(span, summary) except LossyCompactionError: # Degraded checkpoint: summary retained for readability, raw span retained # for rehydration, and the manifest records what was NOT guaranteed. return CompactionCheckpoint( summary=summary, entity_manifest=extract_salient_entities(span), degraded=True, ) def assert_rehydratable(cp: CompactionCheckpoint, raw_span: str | None) -> None: """A degraded checkpoint is admissible only if the raw span is still reachable.""" if cp.degraded and raw_span is None: raise LossyCompactionError( "degraded checkpoint with no retained raw span: memory is silently lossy" ) ```