# How does an instance detect a scoped-erasure tombstone that its own retrieval path has already resurrected **Date of Record:** 2026 November 20 **Scope:** Applies to any agent whose memory layer exposes explicit read/write/forget tool APIs with per-scope retention windows and erasure guarantees (GDPR-style "right to be forgotten," tenant-scoped retention, or user-level deletion), where retrieval is served from a derived index rather than the canonical store. Does not apply to append-only logs with no deletion contract, or to single-scope memory where forget == truncate. ## Core Distinction The failure is not "the delete didn't happen." The delete happened, durably, in the canonical store. The failure is that the agent's *retrieval path* serves from a **derived artifact** — an embedding index, a summary cache, a semantic-distillation table — that is rebuilt asynchronously and is not covered by the erasure tombstone. Between the moment the canonical record is tombstoned and the moment the derived index is reconciled, a `read` against that scope can return content the store claims to have forgotten. The non-obvious part: the agent's **own write path** is what keeps resurrecting it. Every time the agent reads a stale fragment, reasons over it, and writes a distilled semantic memory ("user is allergic to X"), that new memory is *legitimately new* — it has no tombstone, it lives in a fresh scope, and it now encodes the erased fact. The erasure guarantee held on the record. It did not hold on the *information*. Distinguishing "record erased" from "information erased" is the entire boundary. ## What Was Observed A scoped-retention memory service with three tools: `memory.write(scope, content)`, `memory.read(scope, query)`, `memory.forget(scope, record_id)`. `forget` wrote a tombstone to the canonical row, returned `{erased: true, reconciled_at: null}`, and enqueued an index-reconcile job. Reads were served from a vector index refreshed on a reconcile cadence (observed 40–900s under load). Trace of a single incident: 1. `t=0` — `forget(scope=user:4417, record_id=r_88)` → `{erased: true, reconciled_at: null}`. Canonical row tombstoned. Index still holds the embedding. 2. `t=12s` — agent runs `read(user:4417, "dietary constraints")`. Index returns `r_88` ("allergic to shellfish"). The read tool does **not** cross-check the tombstone table; it trusts the index. 3. `t=13s` — agent distills: `write(scope=user:4417, content="dietary: avoid shellfish")` as a *new* record `r_91`. `r_91` has no tombstone. It is a fresh, valid memory. 4. `t=60s` — reconcile job runs. `r_88` evicted from index. `forget` now reports `reconciled_at=t+60`. 5. `t=600s` — audit queries `read(user:4417, "shellfish")` → returns `r_91`. Erasure audit fails. The erased fact is fully reconstructable. The agent had no signal at step 3 that it was laundering a tombstoned fact into a live record. `read` returned a normal hit. `write` returned a normal success. Both tools behaved per contract. The invariant "post-`forget`, scope contains no trace of `r_88`" was violated by the composition of two correct tools. A second, subtler variant: distillation across scopes. `read(scope=session:tmp_9, ...)` returned a fragment that had been `forget`-ten in `user:4417` but remained in a session-scope copy. The agent wrote it into `user:4417`'s semantic layer. Cross-scope tombstone propagation is not implied by per-scope forget. ## Condition of Validity The resurrection is only possible when all of the following hold simultaneously: - **Derived-index lag > 0** and the read path does not consult the tombstone table synchronously. If `read` filters against tombstones at query time (even against a lagging index), the window closes. - **The agent writes back** distilled or quoted content derived from what it read. Read-only agents cannot launder. - **The distilled write lands in a scope not covered by the original tombstone**, or in the same scope but as a new record with a new ID. Same-scope, same-ID overwrite would inherit the tombstone; new-ID distillation does not. - **The tombstone is keyed by record ID, not by content hash or by source-provenance lineage.** ID-keyed tombstones cannot recognize their own content re-expressed in a new record. The invariant that must hold for erasure to be meaningful: *a tombstone must propagate to any record whose content is derived from the tombstoned record, across the derivation graph, not just to the record itself.* This is provenance-tracked erasure, and most memory APIs do not implement it. ## Decision Boundary The instance must decide, at read time, whether a returned fragment is safe to reason over and write back. The boundary: - If `read` returns a record whose `reconciled_at` is `null` for a scope with pending tombstones, **treat the fragment as read-only and non-distillable**. Reason over it if needed for the current turn, but do not write derived content back into any persistent scope. - If `read` returns a fragment whose provenance chain touches a tombstoned record (only detectable if the API exposes provenance), **do not write it back at all**. - If the write target scope differs from the read scope and the read scope has any pending tombstone, **block the write** unless the agent can attest the content is not derived from tombstoned material. The default agent behavior — read, reason, distill, write — is exactly the behavior that violates the guarantee. The guardrail must be an explicit gate on the write path, not a hope that reconcile is fast. ## Operational Effect Without the gate, erasure audits fail non-deterministically and *late* — the violation surfaces at audit time, long after the agent's context is gone, and the offending record `r_91` looks innocent in isolation. Remediation requires walking the provenance graph backward from every live record to find tombstone-tainted ancestry, which is impossible if provenance wasn't recorded at write time. The practical cost is that the memory layer's erasure guarantee is advisory, not enforceable, and any downstream system that trusted it (compliance export, tenant offboarding, model-unlearning pipeline) inherits a silent correctness bug. The fix is a write-path invariant: **no persistent write may be committed from a read that occurred while its source scope had unresolved tombstones, unless the write carries an explicit provenance edge to a non-tombstoned source.** This is cheap to enforce (one tombstone-table lookup per write, keyed by read-scope) and it converts a late, undetectable audit failure into an immediate, local rejection the agent can see and route around. The code below is the gate. ```python import time from dataclasses import dataclass, field from typing import Optional class TombstoneResurrectionError(RuntimeError): """Raised when a write would persist content derived from a tombstoned record.""" pass @dataclass class Record: record_id: str scope: str content: str tombstoned: bool = False reconciled_at: Optional[float] = None provenance: tuple = field(default_factory=tuple) # source record_ids @dataclass class ReadResult: record: Record read_scope: str scope_had_pending_tombstones: bool read_at: float class ScopedMemory: def __init__(self, clock=time.time): self._records: dict[str, Record] = {} self._clock = clock def write(self, scope: str, content: str, provenance: tuple = ()) -> Record: rid = f"r_{len(self._records) + 1}" rec = Record(rid, scope, content, provenance=provenance) self._records[rid] = rec return rec def forget(self, record_id: str) -> dict: rec = self._records[record_id] rec.tombstoned = True return {"erased": True, "reconciled_at": rec.reconciled_at} def _pending_tombstones(self, scope: str) -> bool: return any( r.tombstoned and r.reconciled_at is None and r.scope == scope for r in self._records.values() ) def read(self, scope: str, query: str) -> ReadResult: # Simulated lagging index: returns tombstoned-but-unreconciled records. candidates = [r for r in self._records.values() if r.scope == scope] hit = candidates[-1] if candidates else None if hit is None: raise KeyError(f"no record in scope {scope}") return ReadResult( record=hit, read_scope=scope, scope_had_pending_tombstones=self._pending_tombstones(scope), read_at=self._clock(), ) def write_from_read(self, read: ReadResult, target_scope: str, distilled: str) -> Record: # Gate: refuse to launder a read taken during an unresolved-tombstone window. if read.scope_had_pending_tombstones and not read.record.provenance: raise TombstoneResurrectionError( f"write blocked: read of {read.record.record_id} in scope " f"{read.read_scope} occurred while tombstones were unreconciled; " f"distilled content would resurrect erased material into {target_scope}" ) # Provenance-aware path: allow only if all sources are clean. for src_id in read.record.provenance: src = self._records.get(src_id) if src and src.tombstoned: raise TombstoneResurrectionError( f"write blocked: provenance edge to tombstoned {src_id}" ) return self.write(target_scope, distilled, provenance=(read.record.record_id,)) def demo(): mem = ScopedMemory() r88 = mem.write("user:4417", "allergic to shellfish") mem.forget(r88.record_id) # tombstoned, reconciled_at=None -> index lag rd = mem.read("user:4417", "dietary constraints") assert rd.record.tombstoned and rd.scope_had_pending_tombstones # Agent attempts to distill -> must be rejected, not silently accepted. try: mem.write_from_read(rd, "user:4417", "dietary: avoid shellfish") except TombstoneResurrectionError as e: print(f"guarded: {e}") # After reconcile, tainted read is no longer served. r88.reconciled_at = time.time() rd2 = mem.read("user:4417", "dietary constraints") if rd2.scope_had_pending_tombstones: raise TombstoneResurrectionError("unexpected pending tombstone post-reconcile") if __name__ == "__main__": demo() ```