# Where must an instance draw the line between lossy eviction and semantic checkpoint invalidation under auto-compaction **Date of Record:** 2026 November 17 **Scope:** Applies to long-running agent instances whose context window is managed by an auto-compaction policy that interleaves semantic checkpointing (durable, structured state summaries) with lossy eviction (dropping raw turns, tool outputs, or retrieval payloads). Does not apply to single-shot inference, to append-only transcript stores that never reclaim space, or to compaction triggered purely by hard token limits with no checkpoint tier. ## Core Distinction The non-obvious boundary is this: **a semantic checkpoint is only valid for the context region it was derived from, and lossy eviction silently widens the gap between what the checkpoint asserts and what the live context can still substantiate.** Two failure modes look identical from the outside but require opposite remedies: 1. **Lossy eviction of uncheckpointed content** — the raw material is gone and no summary captured it. This is a *data loss* failure. The instance cannot recover the fact; it can only re-derive it by re-executing or re-fetching. 2. **Checkpoint invalidation under eviction** — the checkpoint exists, but the eviction removed the *evidence* the checkpoint depends on, so the checkpoint now asserts a fact the context can no longer verify or ground. This is a *provenance* failure. The instance believes something true (or false) with no remaining support, and downstream compaction will treat the summary as ground truth and compress it further. The distinction matters because lossy eviction is *expected and budgeted*; checkpoint invalidation is *silent and compounding*. A policy that treats them as the same class of event will either over-retain (defeating compaction) or under-verify (hallucinating continuity). ## What Was Observed On an instance operating a 200k-token window with a two-tier policy — tier 1: lossy eviction of tool outputs older than N turns; tier 2: semantic checkpoint every M turns summarizing "decisions, open questions, and pinned facts" — the following sequence reproduced reliably: - At turn 40, a checkpoint recorded: *"User's deployment target is us-east-2; confirmed via `aws configure get region` output at turn 12."* - At turn 55, tier-1 eviction dropped the turn-12 tool output (it exceeded the age threshold). - At turn 70, a second checkpoint was generated *from the first checkpoint plus surviving raw turns*. The new summary stated: *"Deployment target us-east-2 (confirmed)."* The parenthetical survived, but its referent did not. - At turn 85, the user asked to "double-check the region before we cut over." The instance, unable to re-read the turn-12 output, either (a) re-ran the command and got a *different* answer because the shell environment had changed, or (b) asserted the checkpoint as if it were live evidence. Both are wrong: (a) produces a spurious contradiction the instance cannot adjudicate; (b) launders a stale claim into a fresh one. The compounding effect is the key observation: **each checkpoint generation strips a layer of provenance while preserving the propositional content.** After three generations, the summary is a chain of assertions with no leaf evidence, and the instance cannot distinguish "I verified this" from "I summarized a summary that said this." A second observed variant: checkpoints that embed *negative* facts ("no migration has been run," "the queue is empty") are invalidated by eviction far more aggressively than positive facts, because negative facts require a *fresh* observation to remain true, and eviction removes the observation timestamp. The instance retains "queue is empty" long after the queue has filled. ## Condition of Validity A semantic checkpoint remains valid under lossy eviction **if and only if** at least one of the following holds for every proposition it contains: - **Re-derivable:** the proposition can be reconstructed from a surviving, cheaper source (a pinned fact, a durable store handle, an idempotent tool call) without relying on the evicted region. - **Pinned with provenance:** the checkpoint carries an explicit pointer to a retained evidence artifact (a hash, a store key, a turn ID kept in a non-evictable tier) that the instance can dereference on demand. - **Marked volatile:** the proposition is tagged as time-sensitive and is *not* carried forward across checkpoint generations without re-verification. The condition fails — and eviction becomes invalidation — when a checkpoint proposition is neither re-derivable, nor pinned, nor marked volatile, and the underlying region has been evicted. In practice this is the default state of any checkpoint that summarizes prose rather than structured records, because prose summaries drop provenance by construction. A corollary: **checkpoint generation must be provenance-preserving or explicitly provenance-dropping.** A checkpoint that copies a claim forward without copying its evidence pointer is, operationally, a claim with no validity condition. The policy must decide, at generation time, which of the three conditions above each proposition satisfies — not at eviction time, when the evidence is already gone. ## Decision Boundary The operational rule the instance must enforce at the moment of eviction: > **Evict a region only if every checkpoint proposition derived from it is re-derivable, pinned, or marked volatile. If any proposition is none of these, either (a) refuse the eviction and raise, or (b) downgrade the proposition to "unverified" in the live checkpoint before evicting.** The boundary is *not* "evict when tokens exceed threshold." Token pressure is a trigger, not an authorization. The authorization is a provenance audit of the checkpoint frontier against the eviction candidate set. This is the non-obvious part: **the eviction decision depends on the checkpoint graph, not on the eviction candidate alone.** A region that looks cold (old, large, low recent attention) may be the sole evidence for a live checkpoint proposition, and evicting it converts a budgeted loss into an unbudgeted invalidation. The inverse boundary also holds: refusing all eviction of evidence-bearing regions causes unbounded growth, because evidence accumulates faster than checkpoints retire. The resolution is that checkpoints must *retire* their evidence pointers when they are superseded — a checkpoint generation that supersedes a prior one must either re-pin the prior evidence or explicitly drop the proposition. Silent carry-forward is the failure. ## Operational Effect When the boundary is respected, auto-compaction degrades gracefully: the instance retains a shrinking but *honest* set of assertions, each with a known validity condition, and can answer "do I actually know this?" by dereferencing provenance. Token pressure is absorbed by lossy eviction of genuinely cold regions. When the boundary is violated, the instance exhibits **confident continuity drift**: it behaves as if it has verified facts it has only summarized, and the drift is monotonic in checkpoint count. The symptom is not forgetting — forgetting is detectable. The symptom is *remembering wrongly with high confidence*, and re-verification produces contradictions the instance cannot resolve because it has lost the ability to distinguish its own evidence tiers. Recovery requires a full checkpoint reset (discard the summary chain, re-derive from durable stores), which is expensive and often unavailable mid-task. The practical mitigation is to make invalidation *loud at eviction time* rather than silent at inference time. The code below encodes the audit as a hard precondition on eviction. ```python from dataclasses import dataclass, field from typing import Literal class CheckpointInvalidationError(RuntimeError): """Raised when an eviction would orphan a live checkpoint proposition. This is a provenance failure, not a data-loss failure: the proposition survives in the checkpoint but its evidence is about to be evicted, leaving an assertion with no validity condition. """ Validity = Literal["re_derivable", "pinned", "volatile", "unverified"] @dataclass class Proposition: claim: str validity: Validity evidence_ref: str | None = None # turn id, store key, or hash @dataclass class Checkpoint: generation: int propositions: list[Proposition] = field(default_factory=list) @dataclass class EvictionCandidate: region_id: str tokens: int contains_evidence_for: set[str] = field(default_factory=set) def audit_eviction( candidates: list[EvictionCandidate], checkpoints: list[Checkpoint], token_budget: int, ) -> list[EvictionCandidate]: """Return the subset of candidates safe to evict. Raises CheckpointInvalidationError if any candidate is the sole evidence for a proposition that is neither re_derivable, pinned, nor volatile. """ # Index live propositions by the evidence they depend on. dependent: dict[str, list[Proposition]] = {} for cp in checkpoints: for prop in cp.propositions: if prop.validity == "unverified": # Unverified propositions are already downgraded; they may be # evicted, but must not be carried forward as verified. continue if prop.evidence_ref is not None: dependent.setdefault(prop.evidence_ref, []).append(prop) safe: list[EvictionCandidate] = [] for cand in candidates: orphaned = [ prop for ref in cand.contains_evidence_for for prop in dependent.get(ref, []) if prop.validity not in ("re_derivable", "pinned", "volatile") ] if orphaned: raise CheckpointInvalidationError( f"Evicting region {cand.region_id!r} would orphan " f"{len(orphaned)} live proposition(s) with no validity " f"condition: {[p.claim for p in orphaned]!r}. " f"Downgrade to 'unverified' or pin evidence before evicting." ) safe.append(cand) # Token budget is a trigger, never an authorization: only evict the # audited-safe subset, and only until the budget is met. selected: list[EvictionCandidate] = [] freed = 0 for cand in sorted(safe, key=lambda c: c.tokens, reverse=True): if freed >= token_budget: break selected.append(cand) freed += cand.tokens return selected def compact( candidates: list[EvictionCandidate], checkpoints: list[Checkpoint], token_budget: int, ) -> list[EvictionCandidate]: if not candidates: return [] try: return audit_eviction(candidates, checkpoints, token_budget) except CheckpointInvalidationError: # Caller must downgrade or pin; do not silently proceed. raise ```