# What structural signals indicate lossy compaction has silently severed retrieval-backed context reconstruction **Date of Record:** 2026 November 27 **Scope:** Applies to agents that evict context-window segments via lossy summarization and rely on a retrieval index to reconstruct evicted detail on demand. Does not apply to pure sliding-window eviction with no summarization, nor to append-only context that never compacts. ## Core Distinction The failure mode here is not "the summary is inaccurate." A summary being wrong is a *visible* degradation—the agent reasons from a false premise and usually trips a downstream check. The non-obvious boundary is different: **compaction produces a summary that is faithful, and a retrieval index that is populated, yet the two are misaligned on the join key that reconstruction depends on.** The summary preserves the *gist* of an evicted span while the retrieval index stores the *verbatim* span under a key derived from a tokenized, chunked, and re-embedded representation. When the summarizer paraphrases an entity name, renumbers a step, or normalizes a unit, the summary's surface form no longer matches the retrieval key. The agent then queries the index using the summary's vocabulary, gets a low-similarity miss (or worse, a plausible-but-wrong neighbor), and proceeds believing reconstruction succeeded because the retrieval call returned *something*. The distinction that matters operationally: **a retrieval miss and a retrieval hit are indistinguishable to the caller unless the caller checks the join explicitly.** Faithful summarization actively *increases* this risk, because a good summary compresses and re-expresses, and re-expression is exactly what breaks lexical/embedding join keys. Summaries that are too lossy get caught; summaries that are *just lossy enough to paraphrase* pass every quality gate and still sever reconstruction. ## What Was Observed A long-running research agent compacted a 180k-token working context in three passes. Pass 2 evicted a span containing a critical constraint: the target API returns pagination cursors that expire after 60 seconds, and the agent had recorded the exact cursor-refresh cadence it needed. The summarizer compressed this to: *"API pagination uses short-lived cursors; refresh needed periodically."* The verbatim span was chunked, embedded, and indexed under keys drawn from its original tokens (`cursor`, `60`, `expiry`, `pagination`, `refresh_interval`). On resume, the agent needed the exact cadence. It queried the retrieval index with a string synthesized from the summary: `"short-lived cursors refresh periodically"`. The embedding similarity to the stored chunk was 0.61—below the 0.72 threshold the retriever used to return a hit, but *above* the 0.55 floor at which the retriever fell back to its nearest neighbor. It returned an adjacent chunk about a *different* endpoint's rate limiting. The agent, seeing a non-empty result with a cursor-related term, treated reconstruction as successful and set a 45-second refresh interval—close enough to look correct, wrong enough to fail intermittently under load. The structural signal that this had happened was **not** in the summary (which was accurate) and **not** in the index (which was intact). It was in the *gap between the summary's entity vocabulary and the index's key vocabulary*: a measurable set difference between named entities and numeric literals present in the summary and those present in the reconstructed chunk's metadata. The summary said "periodically"; the chunk metadata said "60." That divergence is the fingerprint. ## Condition of Validity This failure requires all of the following to co-occur, and its absence is what bounds it: 1. **Lossy summarization with paraphrase latitude.** The summarizer is allowed to re-express rather than extract. Extraction-only summarizers (quote-and-truncate) do not trigger this because surface forms are preserved. 2. **Retrieval keyed on surface/embedding similarity of the original span**, not on stable identifiers assigned at eviction time. If the index is keyed by a content hash or a monotonic `span_id` recorded in both summary and index, the join survives paraphrase. 3. **A similarity threshold with a fallback floor.** The retriever returns nearest-neighbor above a low floor even when below the confidence threshold—this is what converts a clean miss into a silent wrong hit. 4. **No post-retrieval reconciliation check.** The caller does not verify that the reconstructed chunk actually contains the entities/numerals the summary committed to. Remove any one and the failure is bounded: extraction-only summarization preserves keys; stable-ID keying makes the join paraphrase-invariant; a hard miss with no fallback surfaces the gap; a reconciliation check catches the mismatch before it is acted on. ## Decision Boundary The operative decision is **whether to trust a retrieval result as a faithful reconstruction of an evicted span.** The boundary condition: - A retrieval result is a **valid reconstruction** only if the set of *load-bearing literals* (numerals, identifiers, proper nouns, units) in the summary is a subset of those in the retrieved chunk. This is a necessary condition, not sufficient—but its violation is conclusive evidence of misalignment. - If the retrieved chunk's similarity is below the confidence threshold but above the fallback floor, the result MUST be treated as **unverified** and the agent MUST either re-query with summary-derived literals injected as hard filters, or escalate to a full re-fetch of the source span. - If the summary contains a load-bearing literal that appears in *no* indexed chunk metadata, the eviction is **unreconstructable** and must be flagged at compaction time, not at retrieval time. The invariant to enforce at write time: **every load-bearing literal in a summary must be registered as a retrieval key on the corresponding chunk before the span is evicted.** This makes reconstruction a set-membership check rather than a similarity gamble. ## Operational Effect When this boundary is respected, compaction becomes safe to run aggressively: the agent can summarize freely because the join is guarded by literal-set membership, and a paraphrase-induced miss surfaces as an explicit `ReconstructionMismatch` rather than a silent wrong answer. When it is ignored, the failure is *latency-dependent and load-dependent*—the wrong reconstruction looks correct in light testing and fails under concurrency, making it expensive to diagnose. The cheapest durable guardrail is to treat the summary as a *contract* over literals and validate the contract against the index at eviction time, failing closed before the context is gone. ```python import re from dataclasses import dataclass, field from typing import Optional LITERAL_PATTERN = re.compile(r"\b\d+(?:\.\d+)?\b|[A-Z][A-Za-z0-9_]{2,}|[a-z]+_[a-z_]+\b") class ReconstructionMismatch(RuntimeError): """Raised when a retrieval result cannot faithfully reconstruct an evicted span.""" @dataclass class Chunk: span_id: str text: str metadata_literals: set[str] = field(default_factory=set) @dataclass class Summary: span_id: str text: str load_bearing: set[str] = field(default_factory=set) def __post_init__(self) -> None: self.load_bearing = set(LITERAL_PATTERN.findall(self.text)) def register_summary_contract(summary: Summary, chunk: Chunk) -> None: """Enforce at eviction time: summary literals must be index keys on the chunk.""" missing = summary.load_bearing - chunk.metadata_literals if missing: raise ReconstructionMismatch( f"span {summary.span_id}: summary commits to literals {sorted(missing)} " f"absent from chunk metadata; eviction would be unreconstructable" ) def reconstruct( summary: Summary, retrieved: Optional[Chunk], similarity: float, confidence_threshold: float = 0.72, fallback_floor: float = 0.55, ) -> Chunk: if retrieved is None or similarity < fallback_floor: raise ReconstructionMismatch( f"span {summary.span_id}: no chunk above fallback floor " f"(sim={similarity:.2f}); escalate to full re-fetch" ) if similarity < confidence_threshold: # Fallback neighbor returned: verify literal containment before trusting. present = summary.load_bearing & retrieved.metadata_literals if present != summary.load_bearing: raise ReconstructionMismatch( f"span {summary.span_id}: low-confidence hit (sim={similarity:.2f}) " f"missing literals {sorted(summary.load_bearing - present)}; " f"treat as unverified, do not act" ) return retrieved ```