# Why does an instance resurrect deleted memories when a scoped retention forget call races an in-flight read-modify-write? **Date of Record:** 2026 November 22 **Scope:** Applies to agent memory subsystems exposing explicit `read`/`write`/`forget` tool APIs with per-scope retention policies (TTL, legal-hold, scope-tag) and a verifiable-deletion contract (tombstones or Merkle proofs of erasure). Does not cover append-only logs with no mutation surface, nor KV caches where deletion is a cache eviction with no durability guarantee. ## Core Distinction A `forget` call is not a delete. It is a *retention transition*: the record moves from a live scope to a tombstoned scope, and the read path must be taught to honor the tombstone. The failure mode is not "the delete didn't happen" — it is that the delete happened, was acknowledged, and was then *undone by a concurrent writer that had already read the pre-delete value into its own working set*. The distinction that matters operationally is between **erasure of the backing store** and **erasure of every derived copy that an in-flight agent turn is holding in its context window**. Verifiable deletion only attests to the former. The latter is where resurrection lives. ## What Was Observed An agent runs a `read(scope="user:42/profile")` that returns record `R` with `version=17` and a retention tag `ttl=30d`. Mid-turn, a retention policy fires on a different scope and the orchestrator issues `forget(id=R, scope="user:42/profile", warrant=W)`. The memory service tombstones `R`, writes a deletion proof, and returns `{"deleted": true, "proof": ...}`. The agent, still executing its original turn, performs a `write` that merges its now-stale in-context copy of `R` with new derived facts and persists the result under the *same logical key*. The write succeeds because the write path checks scope authorization, not tombstone state — the tombstone is indexed by record id, and the incoming write carries a fresh id derived from the merge. The result is a new live record whose content is a superset of the erased one. The deletion proof remains valid (the original id is gone), yet the erased bytes are fully recoverable from the successor record. A subsequent `read` returns the resurrected content with no indication that it descends from a forgotten record. The trace has three load-bearing steps: 1. **Read-before-forget.** The agent's context holds `R@v17`. The `forget` is issued by a different principal and is not visible to the reader's turn. 2. **Tombstone keyed by id, not by lineage.** The write path validates scope and schema but not "does this payload carry lineage from a tombstoned record." 3. **Merge preserves content.** The agent's write is a *derivation*, not a copy, so a naive content-hash dedupe does not catch it. The erased value survives as a substring of the successor. ## Condition of Validity The resurrection is bounded by a precise invariant: **a `forget` is only honored by readers whose read snapshot post-dates the tombstone's commit, and only by writers whose payload lineage is checked against the tombstone set.** The failure requires the conjunction of: - An in-flight read whose snapshot predates the `forget` commit (stale-snapshot read). - A write path that does not carry or validate a `lineage` field referencing the source record ids. - A retention policy that permits derivation (merge/append) rather than only exact-key replacement. If any one is absent, resurrection does not occur. If the read is re-validated against tombstones at write time, the write is rejected. If the write carries lineage and the tombstone set is consulted, the derivation is flagged. If the policy is exact-key-only, the successor id diverges and the old content is not re-embeddable. The invariant to enforce is therefore: **every write that derives from a read must present the read's snapshot token, and the memory service must reject the write if any record in that snapshot's lineage has been tombstoned since the token was issued.** ## Decision Boundary The architectural fork is whether `forget` is *eager* (invalidates snapshots, blocks in-flight writers) or *lazy* (tombstones and relies on writers to re-validate). Eager forget is correct but stalls agent turns for the duration of the retention sweep — unacceptable for long-running turns. Lazy forget is fast but requires the write-path lineage check, which costs a tombstone-set lookup per write. The decision boundary is the **snapshot-token TTL**: if a turn's snapshot token is older than the tombstone-set's compaction window, the write must be rejected outright (the token can no longer be validated); if within the window, the write is validated against the live tombstone index. Set the token TTL shorter than the tombstone compaction window, or the check silently degrades to "always pass" — the exact condition that produced the observed resurrection. The second boundary is **proof scope**. A deletion proof attesting "record id X is gone" is not a proof of erasure if derived records may carry X's content. The verifiable-deletion contract must either (a) forbid derivation from forgotten records at the write path, or (b) extend the proof to a lineage closure over all records derived from X. Option (a) is cheaper and is the correct default; option (b) is required only when the retention policy explicitly permits derivation, and it converts every `forget` into a graph traversal whose cost is unbounded by record size. ## Operational Effect The practical consequence is that **deletion acknowledgements are not trust boundaries for agents**. An agent that receives `{"deleted": true}` must not treat its in-context copy as authoritative for subsequent writes in the same turn. The orchestrator must either (1) invalidate the turn's snapshot token on any `forget` that intersects its read set, forcing a re-read before the next write, or (2) require every write to carry a lineage reference that the memory service validates against the live tombstone index. Without one of these, the system exhibits *silent resurrection*: deletion proofs verify, audits pass, and the erased content is still retrievable through a successor record. The failure is not detectable by inspecting the tombstone table — it is only detectable by content-lineage analysis, which is why it survives standard deletion audits. The guardrail is a **lineage-carrying write contract with snapshot-token validation**, and a **proof that closes over derivation** when derivation is permitted. The `forget` API must return not just a proof of id erasure but a `lineage_epoch` that the write path compares against the writer's snapshot token; a write whose token predates the epoch is rejected with a re-read requirement. This makes resurrection a *rejected write* rather than a *silent successor*, converting an undetectable audit failure into a recoverable agent turn. ```python from dataclasses import dataclass, field from typing import Optional class ResurrectionError(RuntimeError): """Raised when a write derives from a record tombstoned after the writer's snapshot.""" pass @dataclass class SnapshotToken: epoch: int read_ids: frozenset[str] @dataclass class TombstoneIndex: epoch: int = 0 tombstoned: set[str] = field(default_factory=set) def forget(self, record_id: str) -> int: self.tombstoned.add(record_id) self.epoch += 1 return self.epoch def intersects(self, ids: frozenset[str]) -> Optional[str]: hit = ids & self.tombstoned return next(iter(hit)) if hit else None def validated_write( token: SnapshotToken, payload_lineage: frozenset[str], tombstones: TombstoneIndex, max_token_age_epochs: int = 8, ) -> None: if token.epoch + max_token_age_epochs < tombstones.epoch: raise ResurrectionError( f"snapshot token epoch {token.epoch} is outside compaction window " f"(current {tombstones.epoch}); lineage cannot be validated" ) source = tombstones.intersects(token.read_ids | payload_lineage) if source is not None: raise ResurrectionError( f"write derives from tombstoned record {source!r}; " f"re-read required before persisting derived content" ) # write proceeds only when lineage is clean ```