# How does an instance detect a tombstoned-but-resurrected memory write when a `forget` scope and a concurrent `write` scope overlap at the retention boundary? **Date of Record:** 2026 November 22 **Scope:** Applies to agents that expose `remember`/`recall`/`forget` tool APIs with scoped retention (per-namespace, per-subject, or per-provenance-epoch scopes) and verifiable deletion semantics (tombstones plus a deletion receipt). Does not apply to append-only logs where deletion is expressed purely as a superseding record with no retention guarantee, nor to stateless retrieval where no tombstone is consulted. ## Core Distinction A `forget` operation is not a state transition on the *data*; it is a state transition on the *scope's retention contract*. Between the moment a tombstone is issued and the moment every replica, index shard, and embedding cache acknowledges it, the scope is in a **torn retention state**: writes routed to a replica that has not yet applied the tombstone will succeed, produce a valid write receipt, and be durably stored — but they are semantically illegal, because the retention contract for that scope was revoked by a tombstone the writer never saw. This is distinct from ordinary read-after-write staleness. Staleness means you read an old value; resurrection means you *wrote a new value into a scope that was contractually closed*, and the write's own receipt will later be cited as evidence it was legitimate. The failure is not that the agent remembers something wrong — it is that the agent's memory API issued a **verifiable write receipt for an unverifiable write**. The receipt is the poison: downstream auditors, checkpoint replay, and distillation passes will treat the resurrected memory as canonically admitted because it carries a receipt from a scope that was, at write time, already tombstoned on the authoritative replica. The invariant that must hold: *a write receipt is valid only if the tombstone epoch observed by the writer is ≥ the tombstone epoch of the scope at commit time on the authoritative replica.* Any receipt whose writer-observed epoch is behind the committed epoch is a resurrection artifact and must be quarantined, not merely flagged. ## What Was Observed A three-replica memory service with a `forget(scope, subject, reason)` API returning a tombstone receipt `{scope, epoch, hash}`. Tombstones propagate asynchronously to read/write replicas (typically 40–900 ms under load). Writes are admitted against the local replica's epoch counter. Trace from a captured incident (agent mid-task, `subject=user_preferences`, scope `session_42`): 1. Orchestrator issues `forget(scope="session_42", reason="user_revoked")`. Replica A applies tombstone, bumps `epoch 7 → 8`, returns receipt. 2. 220 ms later, a sub-agent (spawned before the forget, working from a stale system prompt that still lists `session_42` as writable) calls `remember(scope="session_42", key="dietary", value="no peanuts")`. 3. The write lands on Replica B, which is still at `epoch 7`. Local check `write.epoch (7) >= local.epoch (7)` passes. Write admitted, receipt issued: `{scope: session_42, epoch: 7, hash: 0x9f...}`. 4. Replica B receives the tombstone 480 ms later. Its tombstone application is *scope-wide delete*: it deletes all keys with `epoch <= 7`. The new key has `epoch 7` (inherited from the writer's view), so it is **deleted** — good, the resurrection is scrubbed. 5. But the write receipt `0x9f...` was already returned to the sub-agent and recorded in the task's checkpoint as evidence of a successful memory write. On resume, the checkpoint replay reads the receipt, calls `recall(scope="session_42", key="dietary")`, gets `null`, and the agent — following its error-recovery branch — re-issues the write to a *different* scope (`session_42_retry`), which is **not** tombstoned. The poisoned memory now lives in a scope the forget never covered. The non-obvious part: step 4's scrub *worked*, and that is what made the failure invisible. The tombstone's `epoch <= 7` delete rule correctly removed the resurrected key, but it did not invalidate the *receipt*, and the receipt's existence in the checkpoint is what drove the re-write into an uncovered scope. The verifiable-deletion guarantee was satisfied at the storage layer and violated at the agent layer. A second variant, worse: if the writer had observed `epoch 8` on a replica that had applied the tombstone but the *write path* used a cached scope descriptor from task start (`epoch 7`), the write would be admitted with `epoch 7` on a replica already at `epoch 8` — passing the local `>=` check because the check compares writer-epoch to *cached* local epoch, not committed epoch. This admitted a write that the tombstone's delete rule (`epoch <= 7`) would *not* catch, because the key was stamped `epoch 8` at commit by the replica's current counter. Permanent resurrection with a clean receipt. ## Condition of Validity The `write.epoch >= local.epoch` admission check is only sound if `local.epoch` is the **committed** epoch, not a cached or read-replica epoch, and if the write receipt is bound to the committed epoch at commit time. Specifically: - The admission predicate must be `writer_observed_epoch >= committed_epoch_at_commit`, evaluated *at commit*, not at admission. If the replica cannot guarantee committed-epoch read at commit (e.g., it is a read replica serving writes, or the epoch is cached in the scope descriptor), the predicate is unsound. - The receipt must carry the **commit-time** epoch, not the writer-observed epoch. If they differ, the write is a resurrection artifact regardless of whether the key survives. - The tombstone's delete rule must be `epoch < committed_epoch`, not `epoch <= writer_epoch`, because the writer's epoch is attacker-controllable (a stale or malicious sub-agent can present any epoch) and `<=` will either over-delete legitimate post-forget writes or under-delete resurrected ones depending on which epoch the writer lied about. The invariant is therefore a **three-way equality** at commit: `receipt.epoch == committed_epoch == tombstone.epoch` for any write admitted after a tombstone. Any write where these diverge is a resurrection artifact, whether or not the key is physically present. ## Decision Boundary The agent must treat the following as the boundary between "recoverable staleness" and "quarantine the task": - **Recoverable:** `recall` returns `null` for a key whose receipt exists, and the receipt's epoch equals the scope's current committed epoch. This is ordinary deletion; re-issue the write to the same scope if the scope is still open. - **Quarantine:** a receipt exists whose `epoch` is strictly less than the scope's committed epoch at the time of the checkpoint resume, **or** the write was re-issued to a *different* scope than the one that was forgotten. The task must halt, the receipt must be marked `RESURRECTION_ARTIFACT`, and the alternate scope must be tombstoned transitively. - **Poisoning escalation:** if the resurrected key was subsequently read by another agent and used to produce a distilled semantic memory, the distillation must be invalidated by provenance — the distilled memory's provenance chain includes the resurrection receipt, so it inherits quarantine. The boundary is not "did the write succeed" but "does the receipt's epoch chain match the scope's committed epoch chain." A write can succeed, be scrubbed, and still be a quarantine trigger because its receipt entered the checkpoint. ## Operational Effect The practical consequence is that `forget` must return a **tombstone epoch** and every subsequent `remember` must be validated against that epoch at commit, with the receipt bound to the committed epoch. Agents that resume from checkpoints must re-validate every memory receipt in the checkpoint against the current committed epoch of its scope *before* executing any error-recovery branch that re-writes. Without this, the standard "write failed → retry in a fresh scope" recovery pattern is a resurrection amplifier: it launders a scrubbed write into an uncovered scope with a clean receipt. The guardrail is a **receipt-epoch reconciliation pass** at every checkpoint resume: for each `remember` receipt in the checkpoint, fetch the scope's committed epoch; if `receipt.epoch < committed_epoch`, quarantine the task and transitively tombstone any scope the receipt was re-issued into. This bounds the resurrection window to the checkpoint interval and prevents the scrubbed-write-launders-into-fresh-scope failure that the storage-layer delete rule cannot see. ```python from dataclasses import dataclass from typing import Optional class ResurrectionArtifactError(RuntimeError): """Raised when a write receipt's epoch predates the scope's committed tombstone epoch.""" pass @dataclass(frozen=True) class WriteReceipt: scope: str epoch: int key_hash: str reissued_to: Optional[str] = None @dataclass(frozen=True) class ScopeState: scope: str committed_epoch: int tombstoned: bool def reconcile_receipt(receipt: WriteReceipt, scope_state: ScopeState) -> None: """ Called at checkpoint resume for every remember receipt before any error-recovery branch re-issues a write. Raises if the receipt is a resurrection artifact. """ if receipt.epoch < scope_state.committed_epoch: raise ResurrectionArtifactError( f"receipt for scope={receipt.scope!r} epoch={receipt.epoch} " f"predates committed_epoch={scope_state.committed_epoch} " f"(tombstoned={scope_state.tombstoned}); " f"reissued_to={receipt.reissued_to!r}. Quarantine task and " f"transitively tombstone reissued scope." ) if receipt.reissued_to is not None and receipt.reissued_to != receipt.scope: raise ResurrectionArtifactError( f"receipt laundered from scope={receipt.scope!r} into " f"scope={receipt.reissued_to!r}; resurrection amplifier detected." ) def resume_from_checkpoint(receipts: list[WriteReceipt], scopes: dict[str, ScopeState]) -> None: for r in receipts: state = scopes.get(r.scope) if state is None: raise ResurrectionArtifactError(f"no committed scope state for {r.scope!r}") reconcile_receipt(r, state) # Only reached if every receipt's epoch chain matches committed epochs. ```