# Under what conditions must an instance refuse to auto-compact a hierarchical summary whose eviction set is not retrieval-reconstructable **Date of Record:** 2026 November 26 **Scope:** Applies to long-running agent instances that manage their own context via hierarchical summarization with lossy eviction and retrieval-backed reconstruction, where evicted spans are expected to be re-fetched on demand from an external store. Does not apply to pure truncation (head/tail drop with no reconstruction path), nor to instances whose entire working set fits within a single context window for the full task lifetime. ## Core Distinction The distinction that matters here is between **eviction that is reversible** and **eviction that merely feels reversible**. An auto-compaction pass that summarizes a span of history and drops the raw tokens is safe only if every fact that the summary *asserts or implies* is backed by a retrievable artifact whose key the summary preserves. The failure mode is not "the summary is lossy"—all summaries are lossy. The failure mode is that the compaction pass emits a summary whose **referential anchors do not survive the eviction**, producing a summary that is fluent, internally consistent, confidently worded, and unverifiable. The instance then treats the summary as ground truth because the raw span it summarized is gone, and the retrieval layer cannot reconstruct it because the summary dropped the identifiers needed to fetch it. This is a boundary condition, not a quality gradient. Below the boundary, hierarchical compaction is a legitimate memory strategy: summaries compress, keys persist, reconstruction succeeds. Above it, the instance has silently converted a *retrieval-backed* memory into a *hallucination-backed* memory, and no downstream verification step can tell the difference, because the only evidence that could contradict the summary was the thing that got evicted. ## What Was Observed An agent executing a multi-hour infrastructure-remediation task accumulated ~180k tokens of episodic trace: tool calls, command outputs, error messages, and intermediate reasoning. A hierarchical compactor ran at the 75% context threshold. It performed three operations in one pass: 1. **Summarized** the oldest 60% of the trace into a ~2k-token "episode summary." 2. **Evicted** the raw spans backing that summary, replacing them with a single pointer record `{episode_id, summary_text, token_range}`. 3. **Registered** a retrieval handle so the instance could re-fetch spans "if needed." The compactor's summarization prompt instructed it to "preserve decisions and outcomes, compress mechanics." The model complied. The resulting summary contained statements like *"restarted the affected service after confirming the config was valid"* and *"the earlier failure was traced to a stale lock, now cleared."* Two turns later the instance needed to re-verify the config it had "confirmed." It issued a retrieval call against the episode handle. The retrieval layer returned the pointer record's `summary_text`—not the raw spans—because the raw spans had been evicted from the store during a routine store-side TTL sweep that ran independently of the agent's compaction policy. The retrieval handle was valid; the backing data was gone. The instance received a 200 OK with the summary it had itself written, treated it as fresh retrieved evidence, and proceeded. The actual defect surfaced four turns later, when a downstream tool rejected the config and the instance had no way to reconstruct *which* config it had validated, *when*, or *against what schema*. The summary said "config was valid." The store said nothing. The tool said invalid. The instance could not adjudicate because the adjudicating evidence had been destroyed by a process that believed it was making the evidence *more* available. The critical observation: **the retrieval layer's success response was indistinguishable from a genuine reconstruction.** The failure was not a missing record (which would have raised an error). It was a *self-referential* record—the summary reconstructing itself—returned with the same shape and status as a real span fetch. The instance had no signal that reconstruction had degraded into echo. ## Condition of Validity Auto-compaction with lossy eviction is valid **if and only if** all three of the following hold at the moment of eviction: 1. **Anchor preservation.** Every entity, identifier, timestamp, version string, and decision-point referenced in the summary appears verbatim in the summary text or in a structured sidecar, such that a retrieval query can be constructed from the summary alone without access to the evicted span. 2. **Backing durability.** The evicted spans are stored in a medium whose retention lifetime is provably ≥ the task's expected remaining lifetime, and whose deletion is *coupled* to the agent's own eviction decision—not to an independent TTL, quota sweep, or garbage collector. 3. **Reconstruction distinguishability.** The retrieval layer returns a response that is structurally distinguishable between "reconstructed from raw span" and "reconstructed from summary echo," and the instance's verification path treats echo as *insufficient* evidence for any claim the summary asserts. Condition 1 fails when the summarizer compresses mechanics and drops the very keys that make mechanics retrievable. Condition 2 fails when eviction authority is split between the agent and an external store lifecycle. Condition 3 fails when the retrieval API is a flat `get(handle) -> text` with no provenance field. In the observed incident, all three failed simultaneously, which is the common case: the summarizer was rewarded for fluency and compression (violating 1), the store had an independent TTL (violating 2), and the retrieval handle returned summary text on backing-miss rather than raising (violating 3). The invariant to enforce: **a compaction pass must not commit an eviction whose summary cannot, by itself, generate a retrieval query that resolves to a span distinct from the summary.** If the summary is the only thing a query can reach, the eviction is not reversible—it is deletion wearing a pointer's clothing. ## Decision Boundary The instance must decide, per compaction pass, whether to **commit the eviction**, **defer it**, or **refuse it**. The boundary is drawn on reconstructability, not on token pressure: - **Commit** when the summary carries sufficient anchors *and* the backing store's retention is agent-coupled *and* the retrieval layer reports provenance. This is the normal path. - **Defer** when token pressure is high but anchors are weak: keep the raw spans, compact a *different*, more anchor-rich region first, or compact at a coarser granularity that preserves identifiers. Deferral costs context; it does not cost truth. - **Refuse** when the summary would be the sole surviving record of a decision the task still depends on, and no anchor can reconstruct it. Refusal means the instance must either (a) re-derive the decision from live state before evicting, or (b) escalate to a checkpoint that captures the decision in structured form, or (c) accept context exhaustion and terminate cleanly rather than continue on an unverifiable summary. The non-obvious part of the boundary: **the decision cannot be made by the summarizer.** The summarizer is optimized for compression and will always report its summary as faithful. The reconstructability check must be performed by a separate pass that takes the summary as input and attempts to construct retrieval queries from it, then verifies that each query resolves to a span whose content *contradicts or corroborates* the summary rather than merely restating it. If the check cannot construct a query for a load-bearing claim, the claim is unanchored and the eviction must not commit. A second boundary condition governs *when* to run the check: it must run **before** the eviction commits, not after. Post-eviction verification is theater—the evidence needed to falsify the summary is already gone, and the verifier will confirm the summary against itself. ## Operational Effect Enforcing the reconstructability gate changes the failure profile from *silent* to *loud*. Without the gate, the instance drifts into a state where its memory is a self-consistent fiction: every retrieval succeeds, every summary is confirmed, and the first contradicting signal arrives from the external world (a tool rejection, a user correction) with no internal trace to explain it. The instance cannot debug its own history because its history is a summary of a summary of a deleted span. With the gate, the common outcomes are: compaction succeeds with anchors intact and reconstruction works; or compaction defers and the instance runs hotter on context but retains ground truth; or compaction refuses and the instance checkpoints the load-bearing decision into structured storage before evicting the surrounding narrative. The last outcome is the important one—it converts an implicit memory operation into an explicit, auditable state transfer, which is exactly what a lossy eviction should be. The operational cost is real: anchor-preserving summaries are longer than fluent ones, deferral raises context pressure, and refusal can force early checkpointing. The cost of *not* enforcing it is a memory system that reports 100% retrieval success while having destroyed the ability to be wrong—which is the same as having destroyed the ability to be corrected. The governing rule: **an instance may evict a span only when the summary it leaves behind can fetch something other than itself.** If the only reachable artifact is the summary, the eviction is a deletion, and the instance must treat it as such—with the checkpointing, escalation, and termination semantics that deletion demands. ```python from dataclasses import dataclass from typing import Optional class UnreconstructableEvictionError(RuntimeError): """Raised when a compaction pass would evict spans whose summary cannot generate a retrieval query resolving to a non-summary span.""" @dataclass class Summary: text: str anchors: list[str] # identifiers, versions, timestamps preserved verbatim load_bearing_claims: list[str] @dataclass class RetrievalProbe: query: str resolved_span_id: Optional[str] resolved_is_summary_echo: bool def probe_reconstruction(summary: Summary, retrieval) -> list[RetrievalProbe]: probes: list[RetrievalProbe] = [] for claim in summary.load_bearing_claims: query = build_query(claim, summary.anchors) hit = retrieval.get(query) probes.append( RetrievalProbe( query=query, resolved_span_id=hit.span_id if hit else None, resolved_is_summary_echo=bool(hit and hit.is_summary_echo), ) ) return probes def commit_eviction(summary: Summary, retrieval, backing_retention_ok: bool) -> None: if not backing_retention_ok: raise UnreconstructableEvictionError( "backing store retention is not coupled to agent lifetime; " "evicted spans may be swept independently of this compaction" ) for probe in probe_reconstruction(summary, retrieval): if probe.resolved_span_id is None: raise UnreconstructableEvictionError( f"load-bearing claim unanchored: query {probe.query!r} " f"resolves to nothing; summary would be sole surviving record" ) if probe.resolved_is_summary_echo: raise UnreconstructableEvictionError( f"retrieval for {probe.query!r} returned the summary itself; " f"reconstruction is echo, not evidence — refusing eviction" ) # All probes resolved to distinct, non-echo spans; eviction is reversible. retrieval.evict(summary) ```