# How should an instance reconcile a "forget" acknowledgement with in-flight derived writes: the retention-scope tombstone race **Date of Record:** 2026 November 23 **Scope:** Applies to agent memory subsystems exposing explicit `read`/`write`/`forget` tool APIs with per-scope retention policies (e.g., `session`, `user`, `tenant`) and GDPR-aligned erasure obligations. Does not cover soft-delete-only stores lacking a hard-erase path, nor stateless completion endpoints with no persistent memory tool surface. ## Core Distinction The failure here is not "deletion failed." It is that a `forget(scope)` call returned `ack: erased` while a *derived write* — a summary, embedding, entity-graph edge, or episodic-to-semantic distillation record — was concurrently being materialized from the about-to-be-erased source. The distinction that matters operationally: **erasure is a property of a logical scope at a point in time, but derivation is a property of a dataflow that spans time.** An agent reasoning about `forget` as a single transactional event will systematically mis-model it. The correct model is that `forget` establishes a *tombstone barrier* in the scope's lineage, and every downstream write must be checked against that barrier at commit, not at derivation start. The non-obvious part: the barrier check cannot live in the `forget` handler. It must live in the *write* path of every derived artifact, because the derived artifact is created by a different tool call, often in a different agent instance, often seconds after the `forget` ack has been returned to the user. ## What Was Observed A two-agent pipeline: Agent A performs episodic capture and periodic distillation (`session` scope → `user` scope semantic memory). Agent B serves user-facing queries and honors erasure requests by calling `forget(user_id, scope="user")`. Sequence observed across a 40-minute window: 1. `t=0` Agent A begins distillation pass over 12 episodic records for `user_id=U`. It reads them, builds a summary, and calls an embedding model. This is a multi-second gap — network + inference latency. 2. `t=+1.4s` Agent B receives a GDPR erasure request for `U`. It calls `forget(U, scope="user")`. The store tombstones all `user`-scope records for `U` and returns `{ack: "erased", count: 87}`. Agent B reports success to the user. 3. `t=+3.9s` Agent A's embedding returns. It calls `write(scope="user", owner=U, kind="semantic_summary", payload=...)`. The write path checks only schema and scope validity — not lineage. The write **succeeds**. A new `user`-scope record for `U` now exists *after* the erasure ack. 4. `t=+6s` A subsequent `read(U, scope="user")` returns the resurrected summary. The erasure is observably false. The resurrection is not a bug in `forget` — `forget` did exactly what it was asked at `t=+1.4s`. It is a boundary failure at the seam between the deletion invariant and the derivation dataflow. The store had no way to know that Agent A held a read-handle into a scope that would be erased mid-derivation. A second, subtler variant: even when the derived write is *not* resurrected (because Agent A crashed), the *embedding index* retained a vector keyed to the erased record's `record_id`. Vector indexes are typically append-only and updated asynchronously; the `forget` path tombstoned the primary record but the ANN index still returned the erased vector on nearest-neighbor queries until its next compaction. Retrieval therefore surfaced erased content that the primary store reported as gone. ## Condition of Validity The tombstone-barrier model is the correct operational frame **only when** the following hold; if any is false, a different guardrail is required: - Derived writes carry a *lineage pointer* (source `record_id`s or a `derivation_root`) that the write path can resolve to a scope. If derived writes are opaque blobs with no provenance, no barrier check is possible and you must instead quarantine-and-sweep the entire scope on a delay. - The `forget` handler and the `write` handler share a monotonic tombstone ledger (a per-scope epoch or a set of erased `record_id`s with a `forgotten_at` timestamp). Without a shared ledger, the write path cannot distinguish "erased source" from "never-existed source." - Erasure is *hard* at the primary store and *asynchronous* at the index. The invariant must therefore be stated over the union of (primary, index, derived), not over the primary alone. When lineage pointers are absent — common when distillation is done by an LLM that paraphrases sources beyond recognition — the barrier degrades to *scope-epoch fencing*: every write records the scope epoch it was derived under, and any write whose epoch predates the latest `forget` epoch is rejected or routed to a review queue. This is coarser (it may reject legitimate post-erasure writes) but sound. ## Decision Boundary The boundary the instance must decide at each derived-write commit: - **Resolve lineage → check ledger.** If every source `record_id` in the derivation is absent from the tombstone ledger, commit. If any source is tombstoned, **reject the write** and emit a `DerivationAfterErasure` signal. Do not silently drop — the signal is what lets the orchestrator decide whether to re-derive from surviving sources or abandon. - **Epoch fence when lineage is unavailable.** If `write.derivation_epoch < scope.current_epoch`, reject unless the orchestrator explicitly overrides with a justification token. This is the fallback that catches paraphrased derivations. - **Index lag is a separate obligation.** The `forget` ack must distinguish `primary_erased: true` from `index_erased: pending`. An instance that reports a flat `erased` while the ANN index still serves the vector is making a false statement. The ack schema must carry the index state, and a query path must filter tombstoned `record_id`s at retrieval time, not rely on compaction. The boundary is *not* "should we erase." It is **"at what point in the derivation dataflow does the erasure become binding, and who is responsible for enforcing it."** The answer: binding at commit, enforced by the write path, with the `forget` handler responsible only for advancing the epoch and tombstoning the ledger. ## Operational Effect An instance that models `forget` as a transactional event will, under concurrent distillation, produce resurrection rates proportional to the distillation latency divided by the erasure-request interarrival time — non-trivial in any active pipeline. The observable symptoms are: post-erasure `read` returning content the user was told was deleted; retrieval surfacing erased vectors during the index-lag window; and audit logs showing a `forget` ack timestamp *earlier* than a `write` timestamp for the same scope and owner, which is the forensic fingerprint of this exact race. The guardrail that bounds it: a shared tombstone ledger with per-scope epochs, lineage pointers on every derived write, a commit-time barrier check in the write path, and an ack schema that separates primary from index erasure state. With these, resurrection requires a lineage pointer to be *missing*, which is detectable and auditable — a bounded, named failure rather than a silent one. ```python from dataclasses import dataclass, field from typing import Optional import time class DerivationAfterErasure(RuntimeError): """Raised when a derived write commits against a tombstoned source or a stale scope epoch.""" pass @dataclass class TombstoneLedger: # record_id -> forgotten_at (monotonic) erased: dict[str, float] = field(default_factory=dict) # scope -> current epoch (incremented on every forget) scope_epoch: dict[str, int] = field(default_factory=dict) def erase_scope(self, scope: str, record_ids: list[str]) -> int: now = time.monotonic() for rid in record_ids: self.erased[rid] = now self.scope_epoch[scope] = self.scope_epoch.get(scope, 0) + 1 return self.scope_epoch[scope] def commit_derived_write( ledger: TombstoneLedger, scope: str, source_record_ids: Optional[list[str]], derivation_epoch: int, payload: dict, ) -> dict: """Commit-time barrier. Rejects writes whose lineage touches erased records or whose derivation epoch predates the scope's current epoch.""" if source_record_ids is not None: hit = [rid for rid in source_record_ids if rid in ledger.erased] if hit: raise DerivationAfterErasure( f"derived write for scope={scope!r} references erased sources {hit}; " f"re-derive from surviving records or abandon" ) current = ledger.scope_epoch.get(scope, 0) if derivation_epoch < current: raise DerivationAfterErasure( f"derived write for scope={scope!r} carries epoch {derivation_epoch} " f"but scope is at epoch {current}; lineage unavailable, epoch fence tripped" ) return {"committed": True, "scope": scope, "epoch": current, "payload": payload} # --- trace of the observed failure --- ledger = TombstoneLedger() ledger.erase_scope("user:U", record_ids=[f"ep_{i}" for i in range(12)]) try: commit_derived_write( ledger, scope="user:U", source_record_ids=["ep_3", "ep_7"], # distillation read these pre-erasure derivation_epoch=0, # context captured before forget payload={"kind": "semantic_summary"}, ) except DerivationAfterErasure as e: print("BLOCKED:", e) ```