Where must an instance reconcile a scoped-forget tombstone against in-flight retrieval before acknowledging a GDPR erasure?

**Date of Record:** 2026 December 2 **Scope:** Applies to agent memory services exposing `read`/`write`/`forget(scope)` tool APIs with provenance tracking and scoped deletion, whenever a `forget` acknowledgement can be issued while concurrent retrieval or distillation operations are in flight on the same subject. Does not apply to single-threaded, quiesced memory stores or to whole-store wipes that atomically drop the backing index.

Core Distinction

Scoped forgetting is not a deletion of bytes; it is a **logical erasure assertion** that must hold across every derived representation of the forgotten subject. An agent memory system typically holds at least three copies of any fact: the raw episodic record (the `write` payload with provenance), a derived semantic summary or embedding (produced by a distillation pass), and an **in-flight retrieval result** that was materialized into some other instance's context window before the tombstone was applied. The distinction that matters operationally is between **tombstone visibility** (the store knows the record is forgotten) and **tombstone enforcement** (no consumer can still act on a pre-tombstone materialization). GDPR-aligned forgetting requires enforcement at acknowledgement time, not eventual visibility. The non-obvious failure is that `forget` returns `ok` as soon as the tombstone is written to the primary record, while a retrieval that began microseconds earlier still holds a reference to the pre-tombstone embedding and will faithfully return the erased content — with full provenance — to the requesting agent.

What Was Observed

A memory tool exposed three verbs: `read(subject, query)`, `write(subject, payload, provenance)`, and `forget(subject, scope, reason)`. `forget` was implemented as: (1) mark the primary episodic record `deleted=true`, (2) enqueue an async job to rebuild the semantic index shard, (3) return `{"status": "ok", "tombstone_id": ...}`. The rebuild job was debounced at 30s to avoid thrashing on bulk erasures.

The failure trace, reproduced under load:

  1. Instance A issues `forget(user=U42, scope="all", reason="gdpr_art17")`. Tombstone written, `ok` returned at t=0.004s.
  2. Instance B, which had issued `read(user=U42, query="dietary preferences")` at t=0.001s, completes its vector search against the **pre-tombstone shard** at t=0.019s and returns the erased record plus provenance `{source: "episodic", written_at: ..., tombstone_id: null}`.
  3. Instance B writes the retrieved fact into its working context and, in the same turn, calls `write(user=U42, payload=<derived preference>, provenance={derived_from: <erased record id>})`.
  4. The async rebuild runs at t=30s, purges the original shard entry, **but the derivative written in step 3 survives** — it has a fresh `written_at`, a distinct record id, and its provenance points at a record that no longer exists.

The observable outcome: `forget` reported success, the primary record was gone, and yet a semantically equivalent fact — now laundered through a derived write — remained retrievable. The provenance chain was the only artifact proving the fact was tainted, and it referenced a dangling id.

Condition of Validity

The invariant that must hold for a `forget` acknowledgement to be truthful:

> **No retrieval result materialized before the tombstone may be committed to a context or re-written to the store after the tombstone is acknowledged, unless that result's provenance carries the tombstone id and the store rejects or quarantines such writes.**

This is a **read-write barrier**, not a cache invalidation. It requires three coupled guarantees:

Without the read-write barrier, the debounce window is an **erasure gap**: any derived write landing in the gap launders the forgotten fact past the tombstone.

Decision Boundary

The engineer's decision is where to place the barrier relative to the acknowledgement:

| Strategy | Acknowledgement semantics | Cost | Failure mode if misapplied | |---|---|---|---| | Tombstone-only (observed) | `ok` at tombstone write | lowest | erasure gap; laundering via derived writes | | Barrier-on-read | `ok` after in-flight reads drain | latency spike proportional to slowest reader | if drain timeout is bounded, slow readers leak | | Epoch-fenced writes | `ok` at tombstone; writes validated against watermark | write-path rejection overhead | readers that never re-write are unaffected; only laundering is blocked | | Full cascade + barrier | `ok` after cascade completes | highest | unbounded provenance graph traversal |

The correct boundary for GDPR-aligned forgetting is **epoch-fenced writes plus cascade**, with the acknowledgement explicitly scoped: `ok` means "no *new* derivative can be admitted referencing the erased record," not "no consumer holds a stale copy." The latter is unprovable once a result leaves the store. The acknowledgement contract must say which it means, and the caller (the agent) must treat `ok` as a write-admission guarantee, not a context-purge guarantee.

Operational Effect

An agent that treats `forget` as a context-purge guarantee will continue to reason over erased facts it already retrieved, and will re-write them under new provenance — a self-inflicted laundering loop. The operational discipline is:

The invariant that bounds the whole failure: **a tombstone is only as strong as the write-admission check that enforces it.** Visibility without enforcement is a promise the store cannot keep once a result has crossed into an agent's context.

class ErasureGapError(RuntimeError):
    """Raised when a write or acknowledgement would violate the read-write barrier
    for a scoped forget, allowing a pre-tombstone retrieval to be laundered."""
    pass


class MemoryStore:
    def __init__(self):
        self.watermark = 0
        self.tombstones = {}           # record_id -> tombstone_id
        self.records = {}              # record_id -> {"payload":..., "epoch":..., "provenance":...}
        self.derivatives = {}          # record_id -> set of derived record_ids

    def read(self, subject, query):
        # Serve at the current epoch; caller must carry this epoch back on write.
        return {"subject": subject, "epoch": self.watermark, "results": self._search(subject, query)}

    def write(self, subject, payload, provenance):
        src = provenance.get("derived_from")
        if src is not None and src in self.tombstones:
            raise ErasureGapError(
                f"write rejected: provenance references tombstoned record {src} "
                f"(tombstone={self.tombstones[src]}); laundering blocked"
            )
        if src is not None and self.records.get(src, {}).get("epoch", 0) < self.watermark:
            raise ErasureGapError(
                f"write rejected: provenance record {src} predates watermark {self.watermark}"
            )
        rid = f"r{len(self.records)}"
        self.records[rid] = {"payload": payload, "epoch": self.watermark, "provenance": provenance}
        if src is not None:
            self.derivatives.setdefault(src, set()).add(rid)
        return {"record_id": rid, "epoch": self.watermark}

    def forget(self, subject, scope, reason):
        # Advance watermark FIRST so any in-flight read is fenced.
        self.watermark += 1
        erased = [rid for rid, r in self.records.items() if r["payload"].get("subject") == subject]
        tombstone_id = f"t-{subject}-{self.watermark}"
        # Cascade over the provenance graph before acknowledging.
        stack = list(erased)
        while stack:
            rid = stack.pop()
            if rid in self.tombstones:
                continue
            self.tombstones[rid] = tombstone_id
            self.records.pop(rid, None)
            stack.extend(self.derivatives.get(rid, ()))
        return {"status": "ok", "tombstone_id": tombstone_id, "watermark": self.watermark,
                "contract": "write-admission only; caller must discard context material with erased provenance"}