# Where must an instance reconcile tombstoned memory erasure against a retention-scoped read cache before serving a resumed task? **Date of Record:** 2026 November 19 **Scope:** Applies to LLM agent instances that persist episodic/semantic state through a memory tool API exposing write, read, and forget operations with scoped retention windows and right-to-be-forgotten (RTBF) erasure. Does not cover purely in-context scratchpads without external persistence, nor deletion of whole namespaces at the storage layer. ## Core Distinction The failure is not "the model forgot to call `forget`." It is the divergence between two independently authoritative stores of the *same* memory record: the **durable backend** (where erasure tombstones land) and the **instance-local read cache** (where the deserialized record still lives, keyed by content hash, with its own TTL). Erasure is a *write* to the backend and a *non-event* to the cache. A resumed instance can therefore satisfy a read from cache for a record that the backend has already tombstoned under an RTBF request — and will faithfully reason over, and re-emit, data it was legally and operationally required to no longer hold. The core distinction is between **deletion as a backend state transition** and **deletion as a property observable at the point of use**. Retention policies and RTBF guarantees are written against the former; agent behavior is governed by the latter. The gap between them is the boundary condition. ## What Was Observed A long-running research agent used a memory tool with three verbs: `write(scope, key, value, retention)`, `read(scope, key)`, and `forget(scope, key)`. `forget` wrote a tombstone row `{key, erased_at, reason}` and hard-deleted the value after a grace window. Reads consulted an in-process LRU cache (TTL 900s, capacity 2048 entries) before hitting the backend; cache entries were keyed by `(scope, key, content_hash)` and were **not** invalidated by `forget`, because `forget` was routed through a separate control-plane client that had no channel back to the data-plane cache. Failure trace: 1. Task A read `(proj-7, dossier_bob, h=9f2a)` at t=0. Cached. Agent reasoned over it, produced a summary, checkpointed. 2. At t=120s an RTBF request arrived out-of-band. Control plane issued `forget(proj-7, dossier_bob)`. Backend wrote tombstone; value scheduled for hard-delete at t=3720s. 3. Task A was suspended (token budget exhausted mid-execution) and resumed at t=600s on the same instance. 4. On resume, the agent re-read `(proj-7, dossier_bob)`. Cache hit at h=9f2a. **No backend round-trip, no tombstone check.** The erased record was served. 5. The agent's summary step re-derived a semantic memory (`write(proj-7, insights, ...)`) that *quoted* fields from the erased record — a fresh write that itself now required erasure, but was written under a normal 30-day retention scope and never linked to the original tombstone. 6. Audit at t=86400s found the derived record alive, the source tombstone satisfied, and the RTBF request marked "completed." The single most dangerous artifact was step 5: **erasure laundered through derivation**. The tombstone covered the source key; nothing covered the semantic distillation that had already absorbed its content. ## Condition of Validity The invariant that must hold is: > For any `read(scope, key)` served to an agent instance, if a tombstone exists for `(scope, key)` with `erased_at <= now`, the read MUST fail closed — regardless of cache state, content-hash match, or retention window on the cache entry. This holds only when all four of the following are true; break any one and the boundary is violated: 1. **Tombstone is on the read path, not just the write path.** The cache must consult a tombstone index (or a monotonic erasure epoch) before returning a hit. A cache that trusts its own TTL is invalid. 2. **Erasure epoch is monotonic per scope.** A resumed instance must be able to ask "has anything in this scope been erased since my checkpoint epoch?" and get a truthful, ordered answer. Wall-clock timestamps across control-plane and data-plane are insufficient — clock skew between planes produced a 40ms window in the observed incident where a read at t=119.98s passed a tombstone written at t=120.01s but stamped `erased_at=119.97s`. 3. **Derived writes carry provenance.** Any `write` whose value was synthesized from a `read` must record the source `(scope, key, content_hash)` set. Without this, erasure cannot propagate transitively and step 5 is invisible. 4. **Retention scope is checked at read, not assumed from the writer.** A record written under `retention=30d` may still be erased early by RTBF; the reader must not treat the retention window as a guarantee of availability. ## Decision Boundary The decision the runtime must make on every cache hit is binary and must not be delegated to the model: - **Serve** only if `tombstone_index.max_epoch(scope) <= instance.checkpoint_epoch` AND no tombstone exists for the exact key. - **Fail closed** (raise, force backend round-trip, invalidate cache entry) if the scope's erasure epoch advanced past the instance's checkpoint epoch, *even if the specific key is not tombstoned* — because an unlinked derived write may exist and the instance cannot prove otherwise without a provenance query. The subtle boundary: an instance that has been suspended is **epistemically stale by construction**. Its checkpoint epoch is a lower bound on what it knows; the backend's erasure epoch is the truth. A resumed instance must treat any epoch advance as "my cache is untrusted for this scope" and rebuild, not patch. Patching (invalidate only the exact key) is the failure mode that let the derived record survive. The model must never be asked "should I honor this erasure?" — that is a policy decision made by the runtime before the model sees any token. If the model is in the loop for erasure enforcement, prompt-injection or reasoning divergence can override it. ## Operational Effect Enforcing the invariant changes three things: - **Resume latency increases** for scopes with epoch advance (full cache rebuild, ~O(scope size) backend reads). This is the correct trade: a stale cache in an RTBF-governed scope is a compliance defect, not a performance optimization. - **Provenance writes become mandatory** for any synthesis step, adding a `sources=[...]` field to every derived `write`. This is what makes transitive erasure tractable; without it, erasure is best-effort and unauditable. - **Erasure becomes a scope-level epoch bump**, not a per-key row, so resumed instances have a single cheap check (`epoch > checkpoint`) that fails closed by default. The failure is silent, the audit passes, and the derived record outlives its source. The guardrail is a monotonic erasure epoch consulted on the read path, with fail-closed semantics on any advance past a suspended instance's checkpoint. ```python import time from dataclasses import dataclass, field from typing import Optional class ErasureBoundaryViolation(RuntimeError): """Raised when a read would serve a record whose scope has advanced past the instance's checkpoint epoch, or whose key is tombstoned.""" pass @dataclass class Tombstone: key: str erased_at: float reason: str @dataclass class ScopeState: epoch: int = 0 tombstones: dict = field(default_factory=dict) # key -> Tombstone def bump(self, key: str, reason: str) -> None: self.epoch += 1 self.tombstones[key] = Tombstone(key=key, erased_at=time.time(), reason=reason) class ScopedMemory: """Backend with per-scope monotonic erasure epochs and a read cache that MUST consult the epoch before serving a hit.""" def __init__(self) -> None: self._store: dict = {} # (scope, key) -> value self._scopes: dict = {} # scope -> ScopeState self._cache: dict = {} # (scope, key) -> value def _scope(self, scope: str) -> ScopeState: return self._scopes.setdefault(scope, ScopeState()) def write(self, scope: str, key: str, value, sources: Optional[list] = None) -> None: self._store[(scope, key)] = {"value": value, "sources": sources or []} self._cache[(scope, key)] = value def forget(self, scope: str, key: str, reason: str = "rtbf") -> None: self._scope(scope).bump(key, reason) self._store.pop((scope, key), None) self._cache.pop((scope, key), None) # transitively erase derived writes that cite this key for (s, k), rec in list(self._store.items()): if any(src[1] == key and src[0] == scope for src in rec["sources"]): self.forget(s, k, reason=f"derived-from:{scope}/{key}") def read(self, scope: str, key: str, checkpoint_epoch: int) -> object: state = self._scope(scope) # INVARIANT 1: fail closed on any epoch advance past checkpoint if state.epoch > checkpoint_epoch: self._cache.pop((scope, key), None) raise ErasureBoundaryViolation( f"scope {scope!r} advanced epoch {checkpoint_epoch}->{state.epoch}; " f"cache untrusted, rebuild required before serving {key!r}" ) # INVARIANT 2: tombstone on the read path, not just write path if key in state.tombstones: raise ErasureBoundaryViolation( f"key {key!r} in scope {scope!r} tombstoned: " f"{state.tombstones[key].reason}" ) if (scope, key) in self._cache: return self._cache[(scope, key)] rec = self._store.get((scope, key)) if rec is None: raise ErasureBoundaryViolation(f"absent record {scope}/{key}") self._cache[(scope, key)] = rec["value"] return rec["value"] def resume_task(mem: ScopedMemory, scope: str, key: str, checkpoint_epoch: int): """Called on task resume; must not swallow ErasureBoundaryViolation.""" try: return mem.read(scope, key, checkpoint_epoch) except ErasureBoundaryViolation: # correct behavior: rebuild from backend at current epoch, do not serve cache raise ```