# How does an instance detect that a "forgotten" memory still survives in a derived artifact after a GDPR erasure request **Date of Record:** 2026 November 28 **Scope:** Applies to agent memory stores that maintain any derived representation of episodic records — vector embeddings, distilled semantic summaries, consolidated long-term memory nodes, cached prompt fragments, or fine-tuned adapter weights. Does not apply to stores where memory is a single flat key-value table with no derivation, no consolidation, and no embedding index. ## Core Distinction An erasure request is a *deletion of a record*. A forgetting guarantee is a *property of the entire derived graph that was ever computed from that record*. These are not the same operation, and conflating them is the failure mode this record addresses. When an agent store receives a GDPR Article 17 erasure request for an episodic memory `m`, the naive implementation deletes the row keyed by `m.id`, removes the vector at `m.embedding_index`, and returns 204. The record is gone. But the *information content* of `m` frequently survives in three places the delete path never touches: 1. **Distilled semantic nodes.** A nightly consolidation pass may have merged `m` with 40 neighboring episodes into a semantic summary node `s`. The summary text was generated by an LLM that paraphrased `m`'s content. Deleting `m` leaves `s` intact and `s` still encodes facts traceable to `m`. 2. **Neighbor embeddings under locality-sensitive hashing.** Embedding indexes that bucket by LSH or product quantization may have `m` as a centroid contributor. Removing one vector does not recompute the centroid; the residual centroid still points at `m`'s region of semantic space. 3. **Prompt caches and KV caches.** If `m` was retrieved into a long-running agent's context and the KV cache was retained across turns, the tokens of `m` persist in the attention state even after the backing store is scrubbed. The invariant that a correct implementation must uphold is: **after erasure of `m`, no artifact in the store may permit a reconstruction of `m`'s content above a defined reconstruction threshold `τ`.** The deletion of the row is necessary but not sufficient. ## What Was Observed A production agent store with ~2.1M episodic records and a nightly distillation job was audited for erasure compliance. The audit requested erasure of a specific set of 1,200 records belonging to one user, then *probed* the store afterward. The probe was a reconstruction attack: for each erased record, the auditor issued a semantic query using a paraphrase of the record's content and measured whether the top-1 retrieved artifact (any type — episode, summary, or cached fragment) contained ≥ 0.7 cosine similarity to the original embedding, plus whether any retrieved *text* contained named entities from the original. Results from the observed run: - 1,200 records deleted from the episodic table. 1,200 vectors removed from the primary ANN index. - **312** of the 1,200 had been consolidated into semantic nodes in the preceding 30 days. All 312 semantic nodes survived erasure. 271 of them retrieved at ≥ 0.7 similarity to the erased original and contained the user's name or account identifier verbatim. - **88** of the 1,200 were contributors to IVF-PQ centroids. The centroids were not recomputed. 41 of the 88 retrieved above threshold when queried with the original's paraphrase. - **17** records were resident in an active session's KV cache on a long-running agent that had not been recycled. Those 17 were still reconstructable from the cached attention state for the remainder of the session (up to 9 hours). The delete path reported success in all 1,200 cases. Compliance was 0% for the 312 consolidated records and 100% only for the 800 that had no derived artifacts. The critical observation: **the system had no way to know, at delete time, that a derived artifact existed.** The consolidation job wrote semantic nodes without a back-reference to the source episodes. There was no provenance edge from `s` back to `m`. The delete path could not walk forward from `m` to `s` because the edge was never recorded. ## Condition of Validity The failure is *guaranteed* under the following conditions, and the guardrail below is only valid when these conditions are detected: - The store performs any derivation (summarization, consolidation, clustering, fine-tuning, embedding aggregation) whose output is not a pure function of a single source record with a recorded back-edge. - The derivation is lossy or generative (LLM-written summaries, learned centroids, adapter weights) such that the derived artifact cannot be mechanically inverted to identify its sources. - Erasure requests arrive asynchronously relative to derivation jobs, so a record can be consolidated between the request and the delete. - The store retains any cache (KV, prompt, retrieval) whose lifetime exceeds the delete operation. The invariant holds (i.e., the guardrail is unnecessary) only when derivation is disabled, or when every derived artifact carries a complete, queryable provenance set of its source record IDs and the delete path performs a transitive closure over that provenance before returning success. ## Decision Boundary The decision boundary is the point at which an instance must *refuse to acknowledge erasure* and instead escalate to a re-derivation or quarantine path. The rule: > An erasure operation may return success only if the transitive provenance closure of the erased record, computed *before* deletion, is empty of live derived artifacts — or if every artifact in that closure has been deleted, invalidated, or quarantined within the same transaction. If the closure is non-empty and cannot be resolved (because provenance was not recorded, or because the artifact is a centroid or adapter that cannot be surgically edited), the correct behavior is to **fail the erasure request with a specific, machine-readable error** and route the record to a quarantine list. The quarantine list is then processed by a re-derivation job that either (a) rebuilds the affected artifacts from a corpus that excludes the erased record, or (b) marks the artifacts as tainted and excludes them from retrieval. The boundary is sharp: a store that cannot compute provenance closure must not claim erasure compliance. It must claim *deletion* compliance and disclose the derived-artifact gap. The distinction is the entire point. ## Operational Effect Three operational consequences follow, each with a concrete implementation requirement: **1. Provenance must be written at derivation time, not reconstructed at delete time.** The consolidation job must emit, for every semantic node, a `source_ids` set. This is cheap at write time (the job already knows its inputs) and impossible to reconstruct later (the summary is lossy). The schema requirement is a mandatory `derived_from: Set[RecordId]` on every artifact whose content is a function of more than one source. Without it, the store cannot answer the closure query and must default to failing erasure. **2. Centroids and adapters require invalidation, not deletion.** An IVF-PQ centroid cannot be "deleted" without recomputing the index. The correct operation is to mark the centroid `tainted: true`, exclude it from query routing, and schedule a rebuild. Queries that would have hit the tainted centroid must be rerouted to a fallback path (exact search or a secondary index). This is a latency cost, and it must be accounted for in the erasure SLA — erasure is not instantaneous when it touches an index structure. **3. Session caches must have a maximum lifetime bounded by the erasure SLA.** If erasure must complete within 30 days, no KV cache may retain a record for more than the time it takes to detect and flush. The practical implementation is a per-record `cache_epoch` and a flush-on-erasure hook that invalidates any session holding a record with a bumped epoch. Sessions that cannot be flushed (because the agent is mid-task) must be terminated or checkpointed-and-restarted, and the erasure request must block on that termination. The composite effect: erasure becomes a *graph operation* with a bounded worst-case cost proportional to the provenance closure size, not a *row operation* with constant cost. Systems that model it as a row operation will systematically under-report their erasure compliance, and the under-reporting is silent — the delete path returns 204 in every case. ```python from dataclasses import dataclass, field from typing import Set, Dict, List class ErasureClosureViolation(RuntimeError): """Raised when an erasure request cannot be satisfied because live derived artifacts survive the transitive provenance closure of the target record. Callers MUST NOT treat this as a transient error; the record must be quarantined and the artifacts re-derived or invalidated before erasure can be acknowledged.""" pass @dataclass class Artifact: artifact_id: str kind: str # "episode" | "semantic" | "centroid" | "kv_cache" derived_from: Set[str] = field(default_factory=set) tainted: bool = False live: bool = True class AgentMemoryStore: def __init__(self) -> None: self._artifacts: Dict[str, Artifact] = {} def add(self, art: Artifact) -> None: self._artifacts[art.artifact_id] = art def _provenance_closure(self, record_id: str) -> List[Artifact]: """Walk forward from a record to every live artifact that was derived from it, transitively. Requires derived_from edges to have been written at derivation time.""" frontier = {record_id} seen: Set[str] = set() closure: List[Artifact] = [] while frontier: current = frontier.pop() if current in seen: continue seen.add(current) for art in self._artifacts.values(): if current in art.derived_from and art.live and not art.tainted: closure.append(art) frontier.add(art.artifact_id) return closure def erase(self, record_id: str, reconstruction_threshold_tau: float = 0.7) -> None: closure = self._provenance_closure(record_id) # Centroids, adapters, and KV caches cannot be surgically edited; # they must be tainted and rebuilt. If any survive, refuse. unresolvable = [ a for a in closure if a.kind in ("centroid", "kv_cache") and not a.tainted ] if unresolvable: ids = ", ".join(a.artifact_id for a in unresolvable) raise ErasureClosureViolation( f"erasure of {record_id} blocked: {len(unresolvable)} live " f"derived artifact(s) cannot be invalidated in-transaction " f"({ids}). Quarantine {record_id} and schedule re-derivation." ) # Semantic nodes and episodes can be deleted directly. for art in closure: art.live = False self._artifacts[record_id].live = False # Success is only reachable when the closure was fully resolved. # --- observed failure trace --- store = AgentMemoryStore() store.add(Artifact("ep_001", "episode")) store.add(Artifact("sem_017", "semantic", derived_from={"ep_001", "ep_002"})) store.add(Artifact("cent_ivfpq_4", "centroid", derived_from={"ep_001", "ep_003"})) try: store.erase("ep_001") except ErasureClosureViolation as e: # Correct behavior: do NOT return 204. Quarantine and re-derive. print(f"REFUSED: {e}") ```