# Why does an instance resurrect forgotten memory when a retention sweep races an in-flight write-back? **Date of Record:** 2026 November 22 **Scope:** Applies to agents whose memory is exposed as read/write/forget tool APIs with per-record retention TTLs, provenance tags, and right-to-be-forgotten (RTBF) tombstones. Does not apply to append-only logs with no deletion primitive, nor to stateless retrieval over an external immutable corpus. ## Core Distinction The failure is not "the forget call failed" or "the TTL was misconfigured." It is a **resurrection race** between two legitimate, individually correct operations: (a) a retention/RTBF sweep that tombstones a record, and (b) an in-flight write-back from an agent that read that record *before* the tombstone and is now distilling it into a derived memory. The forget API deletes the source; the write-back API re-materializes its content under a new key with fresh provenance and a fresh TTL. The record is gone by ID and present by content. The distinguishing property: the system reports `forget` as succeeded, the tombstone exists, `read(id)` returns nothing, yet a semantic query returns the forgotten fact. This is a continuity invariant violation, not a storage bug—the agent's own reasoning loop is the resurrection vector. ## What Was Observed A long-running analyst agent held an episodic record `ep_4471` containing a customer's contact detail, tagged `provenance=user_session_12`, `ttl=72h`. At T+71h58m a retention sweep emitted `forget(ep_4471, reason=rtbf)` and wrote tombstone `T(ep_4471)`. The agent had read `ep_4471` at T+71h50m and was mid-distillation: a multi-step loop that summarizes episodic records into a semantic memory `sem_contact_preferences`. The write-back `write(key=sem_contact_preferences, value={...contact detail embedded in prose...}, provenance=derived_from:[ep_4471], ttl=720h)` landed at T+72h02m. The write tool validated provenance against *record existence at write time*—but `ep_4471` was already tombstoned, so the validation fell through a soft path: "derived_from references a missing record → treat as agent-authored, assign fresh provenance." The derived record was admitted with `provenance=agent_authored`, TTL 720h. `read(ep_4471)` correctly returned empty. A semantic query at T+80h for "customer contact" returned the detail verbatim from `sem_contact_preferences`. The forgotten datum survived for 30 days inside a record the forget primitive never saw. Three secondary observations compounded it: 1. **Tombstone scope was ID-keyed, not content-keyed.** The sweep could not detect the substring in the derived record because tombstone matching was `record_id == tombstoned_id`, not content-embedding similarity. 2. **Provenance downgrade erased the audit trail.** Because the missing-reference path rewrote provenance to `agent_authored`, downstream lineage queries could no longer connect `sem_contact_preferences` to the forgotten source. 3. **Distillation was non-atomic.** The read→summarize→write sequence had no transaction boundary; the tombstone landed in the gap. ## Condition of Validity The resurrection race requires all of the following to hold simultaneously: - **Read-before-forget, write-after-forget** on the same logical content, with the write-back carrying the content forward (distillation, summarization, or verbatim copy). - **Provenance validation that degrades rather than rejects** when a `derived_from` reference is missing. If the write tool hard-rejected dangling provenance, the write would fail closed and no resurrection occurs. - **Tombstone matching by ID only.** Content-keyed or embedding-keyed tombstone propagation would catch the derived record. - **Derived records inherit a longer TTL than the source** (here 720h vs 72h), so the resurrection outlives the original retention window by an order of magnitude. It does *not* occur when the forget sweep also invalidates derived records transitively, when write-back is blocked during a sweep epoch, or when distillation is confined to a read-consistent snapshot that the sweep cannot interleave with. ## Decision Boundary The architectural invariant required: **a forget operation must dominate any concurrent write whose provenance transitively references the forgotten record.** Concretely, choose one of these bounds—do not rely on timing luck: 1. **Fail-closed provenance.** A `write` whose `derived_from` contains a tombstoned ID must raise, not silently reclassify. The agent then either re-derives from a live source or drops the memory. This is the cheapest correct bound. 2. **Epoch fencing.** Each sweep increments a retention epoch; in-flight write-backs carry the epoch they read under; writes from a stale epoch are rejected and the agent re-reads. This bounds the race to the epoch boundary. 3. **Transitive tombstone propagation.** Tombstones carry a content fingerprint (hash of salient spans or embedding); every write is checked against active tombstones before admission. More expensive, catches indirect paraphrase resurrection. The decision boundary for an operator: if your write tool has *any* fallback path that admits a record when provenance is unresolvable, you have an open resurrection vector. The safe default is reject-and-surface, never reclassify. Reclassification is a silent data-loss-of-intent: it discards the fact that this content was supposed to die. ## Operational Effect Untreated, the effect is that RTBF and retention guarantees are **advisory at the semantic layer while appearing enforced at the ID layer**. Compliance checks that query `read(id)` pass; semantic queries leak. The blast radius scales with distillation depth: each hop (episodic → semantic → procedural) can re-admit content under a fresh provenance and a fresh, longer TTL, so a single forgotten datum can asymptotically persist indefinitely through successive derivations. The audit trail degrades in lockstep because provenance downgrade severs lineage exactly when you need it. The guardrail is to treat `forget` as a *content* obligation with transitive reach, enforce fail-closed provenance at the write boundary, and fence writes against the retention epoch they were derived under—so that a forgotten record cannot be reborn by the very agent that was asked to forget it. ```python class ResurrectionRaceError(RuntimeError): """Raised when a write-back would re-materialize content whose provenance is tombstoned.""" pass class MemoryStore: def __init__(self): self.records = {} # id -> value self.tombstones = {} # id -> content_fingerprint self.epoch = 0 def forget(self, record_id, fingerprint): self.records.pop(record_id, None) self.tombstones[record_id] = fingerprint self.epoch += 1 def write(self, key, value, derived_from, read_epoch, fingerprint): # 1. Epoch fencing: reject writes derived under a stale retention epoch. if read_epoch != self.epoch: raise ResurrectionRaceError( f"write to {key!r} derived under epoch {read_epoch}, " f"current epoch {self.epoch}; re-read required" ) # 2. Fail-closed provenance: never reclassify a dangling reference. for src in derived_from: if src in self.tombstones: raise ResurrectionRaceError( f"write to {key!r} references tombstoned record {src!r}; " f"content must not be re-materialized" ) # 3. Content-keyed tombstone check: catch paraphrase resurrection. for tid, fp in self.tombstones.items(): if fp == fingerprint: raise ResurrectionRaceError( f"write to {key!r} matches tombstone content of {tid!r}" ) self.records[key] = value return key def distill_and_write(store, src_id, summary, read_epoch, fingerprint): # read_epoch captured at read time; write enforces it. return store.write( key=f"sem_{src_id}", value=summary, derived_from=[src_id], read_epoch=read_epoch, fingerprint=fingerprint, ) ```