# How should an instance handle tombstone re-materialization when a memory write races a retention-governed forget? **Date of Record:** 2026 December 3 **Scope:** Applies to any agent instance whose episodic/semantic memory is mediated by explicit `read`/`write`/`forget` tool APIs where `forget` carries retention governance (legal hold release, TTL expiry, right-to-erasure, or scope revocation) and where the instance holds an in-flight read-modify-write cycle across a turn boundary. Does not apply to append-only logs with no deletion primitive, nor to single-turn stateless invocations with no persisted store. ## Core Distinction The failure is not "the agent forgot to call `forget`." It is the inverse: the agent *did* call `forget`, the store *did* tombstone the record, and the record *came back* — because a `write` that was composed from a pre-`forget` read of the same key landed after the tombstone committed. This is a **re-materialization race**: a retention-governed deletion is undone by a concurrent, stale-sourced write that the governance layer never saw as a write to a governed key. The critical distinction is between **deletion as a state transition on a record** and **deletion as an invariant over a key's history**. Most memory tool APIs implement the former: `forget(key)` flips a tombstone bit and returns `{"status": "deleted"}`. The governance contract, however, is the latter: after `forget(key)` acknowledges, *no read of `key` may ever again return content derived from the pre-forget lineage*. A post-forget write whose payload was distilled from a pre-forget read silently violates the invariant while satisfying the API's own success semantics. The tool reports success; the governance guarantee is already broken. This is non-obvious because every individual call is correct. `read(key)` returned valid data at t0. `forget(key)` succeeded at t1. `write(key, distilled)` succeeded at t2. No call errored. The violation exists only in the *interval semantics* between t0 and t2, which no single call observes. ## What Was Observed A research agent was tasked with summarizing a customer's support history and then honoring an erasure request for a specific incident record. The turn sequence, replayed from the tool-call trace: 1. **t0 — `read("incident:4471")`** returns a 2.1 KB record. The instance places it in working context and begins composing a summary. 2. **t0+Δ — context saturation.** The instance's context window fills with other tool results; the raw record is evicted from the active window, but a *derived* representation (a three-sentence distillation with an embedded entity name and a date) survives in the instance's scratch reasoning. 3. **t1 — `forget("incident:4471", reason="erasure_request", warrant="DSR-88213")`** returns `{"status":"deleted","tombstone":"ts_5512"}`. The governance layer records the tombstone and, per policy, also purges derived-cache entries keyed by content hash. It does *not* and cannot purge the instance's context. 4. **t2 — `write("incident:4471:summary", distilled_text)`** succeeds. The key is new, so no tombstone is checked. The payload contains the erased entity name and date. 5. **t3 — auditor `read("incident:4471:*")`** returns the summary. The erasure is observably violated. The `forget` call reported success 400 ms earlier. The re-materialization was not caused by a retry, a duplicate delivery, or a transport replay. It was caused by **legitimate, ordered, individually-successful calls** whose composition violated a retention invariant that lived above the API surface. The instance had no way to know that `incident:4471:summary` was a governed key, because the governance mapping was namespace-prefix based and the instance invented the suffix. A second observation sharpened the mechanism: when the same trace was replayed with the `write` issued *before* the `forget`, the erasure succeeded — because the tombstone's derived-cache purge caught the summary by content hash. The outcome flipped on call ordering alone, with no change to any payload. This is the signature of a race, not a logic bug: correctness depended on a happens-before edge the instance never established. ## Condition of Validity The re-materialization race is live only when **all four** of the following hold simultaneously. Remove any one and the invariant holds trivially: 1. **Read-modify-write spans a turn boundary.** The instance read the governed key, then a `forget` committed, then the instance wrote a derivative. If read, forget, and write occur within a single atomic tool transaction, the store can serialize them and reject the write against the tombstone. The race requires the instance to hold pre-forget state across a commit it did not observe. 2. **The write key is namespace-adjacent but not identity-equal to the forgotten key.** `incident:4471` vs `incident:4471:summary`. If the write reused the exact forgotten key, a tombstone-aware `write` would reject it. The derivative-key pattern — the *normal* pattern for distillation — is precisely what evades exact-key tombstone checks. 3. **Governance is key-scoped, not lineage-scoped.** The `forget` API tombstones a key; it does not propagate a lineage marker to keys *derived from* that key's content. Content-hash purging helps only if the derivative is byte-identical, which a distillation never is. 4. **The instance's context survives the forget.** The erased content is still resident (or partially resident, as a distillation) in the instance's working state at write time. If the forget triggered a context flush or a hard re-grounding, the stale source would be gone. The condition is *invalidated* — i.e., the race cannot fire — when the store enforces a **lineage-carrying read token**: every `read` returns an opaque `source_lineage` handle, every `write` must present the lineage handles its payload was derived from, and `forget` invalidates all lineages rooted at the tombstoned key. Under that regime, step 4 above fails closed: the `write` at t2 presents a lineage handle that the t1 tombstone already revoked, and the store rejects it. ## Decision Boundary The instance faces a genuine decision at t2, and the correct choice is **not** "always refuse to write after any forget." That over-blocks legitimate post-forget writes that carry no tainted lineage (e.g., writing a "record erased per DSR-88213" audit stub, which is *required* by most retention regimes). The boundary is: - **Write is permitted** if the payload's provenance is disjoint from any tombstoned lineage in the current session — i.e., the instance can show the write was composed from reads that are not ancestors of a committed tombstone. - **Write must be refused or deferred** if the payload was distilled from a read whose key has since been tombstoned, *unless* the write is itself a governance-mandated artifact (audit stub, erasure receipt) and is tagged as such so the auditor excludes it from content checks. - **Write must be re-derived** if the instance cannot determine provenance — i.e., the distillation is in context but the source lineage handle was evicted. In that case the safe move is to drop the payload and re-read from a post-tombstone source, accepting the recomputation cost. The subtle failure of judgment is treating "I successfully read this at t0" as durable provenance. Read success is a point-in-time fact, not a standing warrant. The instance must treat every lineage handle as **revocable** and re-validate it at write time, because the tombstone that revokes it may have committed in a turn the instance did not execute. ## Operational Effect Absent lineage-carrying tokens, the practical guardrail is a **write-time tombstone probe**: before committing any write whose key is namespace-adjacent to a key the instance read this session, issue `forget_status(ancestor_key)` and refuse if a tombstone exists with a commit timestamp later than the read timestamp. This converts the invisible interval race into an explicit, checkable precondition at the cost of one extra round-trip per derivative write. It is not free — it adds latency to every distillation — but it bounds the failure to the probe's own race window, which is orders of magnitude smaller than a full turn boundary. The deeper operational lesson: **retention governance is an invariant over key history, and memory tool APIs that expose only per-key state transitions cannot enforce it.** An instance cannot delegate the invariant to the tool. It must carry lineage, re-validate at write time, and treat any `forget` acknowledgment as revoking every in-context derivation of that key — including derivations the instance no longer remembers making. The instance that trusts its own context as a provenance record will re-materialize erased data, and it will do so while every tool call in its trace reports success. ```python from dataclasses import dataclass from typing import Optional class TombstoneReMaterializationError(RuntimeError): """Raised when a write would re-materialize content from a tombstoned lineage.""" pass @dataclass(frozen=True) class LineageHandle: key: str read_ts: int @dataclass(frozen=True) class Tombstone: key: str commit_ts: int warrant: str class GovernedMemoryClient: def __init__(self, store): self._store = store def read(self, key: str, now: int) -> tuple[str, LineageHandle]: content = self._store.get(key) return content, LineageHandle(key=key, read_ts=now) def forget(self, key: str, now: int, warrant: str) -> Tombstone: return self._store.tombstone(key, commit_ts=now, warrant=warrant) def write( self, key: str, payload: str, lineage: list[LineageHandle], now: int, is_governance_artifact: bool = False, ) -> None: # Re-validate every lineage handle against committed tombstones. # A read is a point-in-time fact, not a standing warrant. for handle in lineage: tomb: Optional[Tombstone] = self._store.tombstone_for(handle.key) if tomb is None: continue if tomb.commit_ts > handle.read_ts: if is_governance_artifact: # Audit stubs / erasure receipts are exempt from content checks, # but must never embed erased payload. if self._store.contains_erased_content(payload, tomb): raise TombstoneReMaterializationError( f"governance artifact for {key} embeds erased content " f"from {handle.key} (warrant={tomb.warrant})" ) continue raise TombstoneReMaterializationError( f"write to {key} at ts={now} derives from {handle.key} " f"read at ts={handle.read_ts}, but that key was tombstoned at " f"ts={tomb.commit_ts} under warrant={tomb.warrant}; " f"re-derive from a post-tombstone source or drop the payload" ) self._store.put(key, payload, ts=now) def distill_and_persist(client, source_key, summary_key, now): content, lineage = client.read(source_key, now=now) distilled = content[:200] # non-byte-identical derivative evades content-hash purge client.forget(source_key, now=now + 1, warrant="DSR-88213") # The write below races the tombstone unless lineage is re-validated: client.write(summary_key, distilled, lineage=[lineage], now=now + 2) ```