# How does an instance detect a tombstoned memory key that its own read-path still resolves through a stale vector index after GDPR erasure **Date of Record:** 2026 November 25 **Scope:** Applies to agent memory subsystems exposing `read`, `write`, and `forget` tool APIs where `forget` implements scoped retention with tombstones and where retrieval is served by an approximate nearest-neighbor (ANN) index decoupled from the authoritative key-value store. Does not apply to systems where retrieval is a linear scan over the authoritative store on every read, or where `forget` synchronously rebuilds the index before returning. ## Core Distinction The distinction that matters is between **logical erasure** (the tombstone is written, the authoritative record is removed, and `forget` returns success) and **retrieval erasure** (the ANN index no longer returns the key, its payload, or any embedding derived from it). A GDPR-aligned `forget` contract is satisfied by logical erasure at the API boundary. It is *not* satisfied by the read path, because the read path is served by an index that lags the tombstone. The failure is not that the agent forgets too little at write time; it is that the agent's own retrieval tool re-materializes erased content into its context window *after* a successful `forget` acknowledgment, and then reasons over it as if it were live memory. This is a continuity invariant, not a consistency bug in the ordinary sense. The invariant is: **no `read` issued after a `forget` acknowledgment may return any token derived from the tombstoned record.** The mechanism that violates it is the gap between tombstone propagation latency and index compaction latency, combined with the agent's assumption that a 200-OK from `forget` means the next `read` is clean. ## What Was Observed A research agent operating over a long-horizon task had accumulated episodic memory entries under scoped keys `episodic/{session_id}/{turn}`. A user issued a right-to-erasure request for a specific session. The orchestrator called `forget(scope="episodic/{session_id}/*", mode="hard", gdpr=True)`. The memory tool performed the following, in order: 1. Wrote tombstone records `tombstone/{key}` with `erased_at`, `request_id`, and a hash of the erased payload into the authoritative KV store. 2. Deleted the payload rows from the KV store (hard delete, not soft). 3. Enqueued an index-compaction job onto an async worker queue. 4. Returned `{"status": "erased", "keys_affected": 412, "compaction": "queued"}`. The compaction worker had a backlog. For 41 minutes, the ANN index still contained the 412 embeddings. During that window the agent continued its task and issued `read(query="...", scope="episodic/{session_id}/*", k=8)`. The retriever embedded the query, hit the stale ANN index, got back 8 candidate IDs with cosine distances, and then — critically — the retriever's hydration step fetched payloads by ID from the KV store. The KV fetch returned `None` for all 8 (payloads were hard-deleted). The retriever's fallback behavior, which had been written for the benign case of "index drift, payload missing," was to **drop the candidate and return fewer than k results**, *not* to error. But it also logged the candidate IDs, and the agent's scratchpad tool, reading the retrieval trace, recorded the IDs and the *original embedding norms* (still present in the index metadata) into working memory. The observable failure: the agent's subsequent reasoning referenced "the session I was told to forget" and reconstructed approximate content from the surviving embedding metadata plus its own prior-turn context. No verbatim payload was recovered, but the erasure was not complete in the sense that matters: the existence, count, and semantic neighborhood of the erased records remained queryable, and the agent's own context carried forward a pointer to them. A second, sharper observation came from a different run. A `forget` with `mode="soft"` (tombstone only, payload retained for a 30-day retention window per policy) was followed by a `read` that hit a *different* replica of the ANN index, one that had not yet received the tombstone broadcast. That replica returned full payloads. The agent received erased-but-retained content and treated it as live. The tombstone existed; the replica's read path did not consult it. ## Condition of Validity The invariant "no post-forget read returns erased content" holds only under the following conjunction, and fails if any conjunct is false: - **C1 — Tombstone visibility is on the read path, not only the write path.** Every read must check the tombstone store for each candidate key *before* hydration, and must treat `tombstone/{key}` present as a hard miss regardless of index state. If tombstone checks happen only at write/compaction time, the read path is unguarded. - **C2 — Index compaction is either synchronous with `forget` or the read path filters by tombstone.** Async compaction is acceptable *only if* C1 holds. If the design relies on compaction to enforce erasure, then `forget` must not return success until compaction completes, or must return a non-terminal status that the caller is obligated to poll. - **C3 — Hydration miss is a terminal signal, not a silent drop.** When the index returns a candidate whose payload is absent, the retriever must surface this as an erasure event (or at minimum a distinct error class), not silently return `k-1` results. Silent truncation is what let the agent reconstruct pointers. - **C4 — Embedding metadata is itself in the erasure scope.** Vector norms, timestamps, and neighbor lists stored alongside embeddings are personal-data derivatives under a strict reading. If they survive compaction, the index remains a side channel. - **C5 — Multi-replica tombstone propagation is bounded and observable.** With N replicas, the read path must either route reads to a replica known to have applied the tombstone (read-your-writes on erasure), or expose a `forget` epoch that reads carry and replicas reject if stale. The failure observed above was a violation of C1 (tombstone not consulted at read), C3 (silent drop), and C5 (replica skew). It was *not* a violation of the write-path contract; `forget` did exactly what it said. ## Decision Boundary The decision the instance must make is whether a `forget` acknowledgment is sufficient grounds to treat subsequent reads as erasure-clean. The boundary is drawn by the `compaction` field in the `forget` response: - If `compaction == "complete"`, the read path is clean under C1+C2 and the instance may proceed without further checks. - If `compaction` is `"queued"`, `"pending"`, or absent, the instance **must not** assume read-path cleanliness. It must either (a) issue reads with an explicit `erasure_epoch` filter, or (b) treat any read result whose key falls in the forgotten scope as suspect and discard it before it reaches the context window, or (c) halt and escalate if neither is supported. The non-obvious part of the boundary: an instance cannot detect the violation from the `forget` response alone, because the response is truthful. It can only detect it by *probing* — issuing a canary read against the forgotten scope and checking whether the tombstone is honored. The canary is a read of a known-forgotten key that must return a `TombstonedKeyError` (or equivalent). If it returns a payload, or returns a silent miss, the read path is unguarded and the instance must treat the entire scope as still-live and quarantine it from its own context. The boundary is therefore: **`forget` success ≠ erasure-clean reads; only a passing canary read establishes the latter.** The instance must run the canary itself, because no other layer will. ## Operational Effect The practical consequence is that an agent operating under erasure semantics must maintain a **post-forget quarantine** in its own working state. Any key that has been the target of a `forget` is moved to a quarantine set; reads that resolve to a quarantined key are dropped before context insertion, and the drop is logged as an erasure event rather than a retrieval miss. The quarantine is lifted only when a canary read confirms tombstone enforcement on the read path, or when the `forget` response carries `compaction == "complete"`. Without this, the failure mode compounds: the agent's own reasoning loop treats reconstructed pointers as memory, cites them in downstream tool calls, and the erasure request is defeated by the agent's continuity machinery rather than by any bug in the memory tool. The memory tool is correct; the instance is the one that must close the gap, because it is the only component that both knows the scope of the erasure and controls what enters its context window. The guardrail is cheap: one canary read per `forget`, a quarantine set, and a hard rule that a quarantined key never reaches the prompt. The cost of omitting it is that a successful GDPR erasure can be silently undone by the agent that requested it. ```python from __future__ import annotations from dataclasses import dataclass, field from enum import Enum from typing import Any, Iterable class ErasureIntegrityError(RuntimeError): """Raised when the read path does not honor a tombstone after forget().""" class CompactionState(str, Enum): COMPLETE = "complete" QUEUED = "queued" PENDING = "pending" UNKNOWN = "unknown" @dataclass(frozen=True) class ForgetReceipt: scope: str keys_affected: int compaction: CompactionState request_id: str @dataclass class PostForgetQuarantine: """Instance-side guard: no key in scope reaches the context window until a canary read proves the read path honors the tombstone.""" forgotten_scopes: list[str] = field(default_factory=list) quarantined_keys: set[str] = field(default_factory=set) _canary_passed: dict[str, bool] = field(default_factory=dict) def register_forget(self, receipt: ForgetReceipt) -> None: self.forgotten_scopes.append(receipt.scope) # If compaction is not proven complete, the whole scope is suspect. if receipt.compaction is not CompactionState.COMPLETE: self._canary_passed[receipt.scope] = False def is_quarantined(self, key: str) -> bool: if key in self.quarantined_keys: return True return any(_scope_matches(key, s) and not self._canary_passed.get(s, False) for s in self.forgotten_scopes) def mark_canary_passed(self, scope: str) -> None: self._canary_passed[scope] = True def _scope_matches(key: str, scope: str) -> bool: prefix = scope.rstrip("*") return key.startswith(prefix) def safe_read( memory_tool: Any, quarantine: PostForgetQuarantine, query: str, scope: str, k: int = 8, ) -> list[dict]: """Read that refuses to surface quarantined keys into agent context.""" raw = memory_tool.read(query=query, scope=scope, k=k) clean: list[dict] = [] for hit in raw: key = hit.get("key", "") if quarantine.is_quarantined(key): # Erasure event, not a retrieval miss. Drop before context insertion. continue if hit.get("payload") is None: # C3: hydration miss must be terminal, not a silent k-1 drop. raise ErasureIntegrityError( f"index returned candidate {key!r} with no payload; " f"read path is not tombstone-guarded for scope {scope!r}" ) clean.append(hit) return clean def verify_erasure( memory_tool: Any, quarantine: PostForgetQuarantine, receipt: ForgetReceipt, canary_key: str, ) -> None: """Probe the read path after forget(). Raises if the tombstone is not honored.""" if receipt.compaction is CompactionState.COMPLETE: quarantine.mark_canary_passed(receipt.scope) return result = memory_tool.read_by_key(canary_key) if result is None: # Payload gone, but did the read path consult the tombstone, or just miss? # A tombstone-honoring read must return a typed erasure signal. probe = memory_tool.read_by_key(canary_key, require_tombstone_signal=True) if probe is not None: raise ErasureIntegrityError( f"canary {canary_key!r} returned payload after forget " f"{receipt.request_id!r}; read path bypasses tombstone" ) quarantine.mark_canary_passed(receipt.scope) return raise ErasureIntegrityError( f"canary {canary_key!r} still resolvable after forget " f"{receipt.request_id!r} (compaction={receipt.compaction.value}); " f"scope {receipt.scope!r} remains quarantined" ) ```