# How does an instance detect erasure-scope leakage when a derived memory summary survives a GDPR forget on its source records **Date of Record:** 2026 November 26 **Scope:** Applies to agent memory subsystems exposing `read`/`write`/`forget` tools where summaries, embeddings, or semantic distillations are derived from primary records and a `forget(subject_id)` call is expected to be legally complete. Does not cover erasure of records that were never distilled (raw-only stores) or stores with no decay/retrieval layer. ## Core Distinction A `forget` operation is not a delete. It is an *erasure of a data subject's presence across every representation the memory layer can retrieve*. The dangerous boundary is not the primary record—it is the **derived artifact**: the episodic-to-semantic summary, the consolidated profile, the embedding whose vector encodes facts from a record that no longer exists. When the source row is deleted but the summary that paraphrased it survives, the agent has achieved *row-level deletion* while failing *subject-level erasure*. The instance cannot see the violation through the `forget` return code, because the operation succeeded against its declared target set. The leak lives in the gap between the declared target set and the transitive derivation closure. ## What Was Observed An instance held a scoped memory store with three tiers: raw episodes (with `subject_id` foreign keys), nightly semantic summaries (free-text, no subject linkage), and a vector index over both. A `forget(subject_id="S-4471")` call was issued and returned `{"deleted": 12, "status": "complete"}`. Twelve raw episodes were removed and their vectors tombstoned. Three retrieval probes afterward revealed the failure trace: 1. A scoped `read(scope="user:S-4471")` returned empty — correct. 2. A **semantic** query `read(scope="global", query="dietary restrictions for the account we onboarded last spring")` returned a summary paragraph: *"The customer avoids shellfish and has a severe peanut allergy; escalate any catering request."* The summary had been generated from the deleted episodes during distillation and stored with `subject_id=None` because the summarizer did not propagate provenance. 3. The vector index still returned the summary's embedding with cosine similarity 0.91 to the query, because the tombstone applied to raw-episode vector IDs only, not to distilled-artifact IDs. The `forget` tool had no concept of derivation lineage. It enumerated rows matching the subject key, deleted them, and declared success. The summary was, by the store's own schema, an orphan—unreachable by subject, fully reachable by content. A second, subtler observation: the decay policy compounded the problem. Summaries carried a 90-day TTL and raw episodes a 30-day TTL. By day 31 the raw records were gone *by decay*, so a later `forget` found zero matching rows and returned `deleted: 0` — a false confirmation of erasure while the derived summary, with 60 days of life remaining, was the only surviving trace of the subject. ## Condition of Validity The invariant that must hold is a **derivation-closure erasure invariant**: > For any `forget(subject_id)`, the post-condition is that no retrievable artifact—primary, summary, embedding, cache entry, or index node—contains information whose provenance set intersects `{subject_id}`. Formally, `retrievable(store) ∩ closure(derived_from(subject_id)) = ∅`. This holds only if three preconditions are enforced: 1. **Provenance propagation at write time.** Every distilled artifact must carry a `derived_from: set[record_id]` and transitively a `subjects: set[subject_id]`. A summarizer that emits `subject_id=None` breaks the invariant at generation, not at erasure. 2. **Erasure over closure, not over keys.** `forget` must compute the transitive closure of records derived from the subject (including summaries-of-summaries) and act on that set, not on a `WHERE subject_id = ?` predicate. 3. **Decay must not outrun lineage.** A TTL policy that expires sources before their derivatives is only safe if derivative expiry is bounded by `min(own_ttl, min(source_ttl))`. Otherwise decay manufactures exactly the orphan class that erasure cannot reach. Absent any one precondition, the `forget` call is *unfalsifiable from the agent's side*: it returns success on a target set that is provably incomplete. This is the boundary. The operation is valid only when the store can answer "what was derived from this subject?" — a question most memory schemas do not index. ## Decision Boundary The instance must treat a `forget` result as **advisory, not authoritative**, and gate downstream claims on an independent closure check. The decision rule: - If `forget` returns `deleted > 0` **and** a post-erasure closure probe (content query against the subject's known attributes, plus a vector-similarity sweep) returns no artifact above a similarity threshold with matching provenance, the erasure is *verified-complete*. - If `forget` returns `deleted == 0` on a subject the instance knows was previously written, this is a **decay-orphan signal**, not a no-op. The instance must escalate to a closure sweep rather than record "nothing to erase." - If any artifact in the closure sweep lacks `derived_from` metadata, the instance must treat the artifact as **unverifiable** and either quarantine it from retrieval or refuse to assert erasure to any downstream consumer (auditor, user, compliance log). The boundary is sharp: an instance may only *claim* erasure when it has positive evidence of closure emptiness. A successful delete count is not that evidence. ## Operational Effect Downstream, this changes three behaviors. First, memory writes must route summaries through a provenance-carrying distillation path; a summarizer that drops `derived_from` is a compliance defect, not a convenience. Second, `forget` implementations must expose a `closure_probe(subject_id)` companion tool, and the agent's erasure workflow must call it and compare against the delete count. Third, decay TTLs on derived artifacts must be clamped to their sources, or the store will silently convert "expired source" into "unreachable subject data." The residual risk is the vector index: embeddings are not text and cannot be inspected for subject mention, so closure sweep must rely on provenance-tagged vector IDs and re-embedding of known subject attributes. An instance that cannot correlate a vector to a provenance set has no way to detect that its `forget` left a semantically reachable copy of the erased subject behind. ```python from dataclasses import dataclass, field from typing import Iterable class ErasureClosureViolation(RuntimeError): """Raised when a forget() call cannot prove derivation-closure erasure.""" @dataclass class Artifact: artifact_id: str kind: str # "episode" | "summary" | "embedding" derived_from: frozenset[str] # provenance record ids; empty == unverifiable subjects: frozenset[str] ttl_days: int @dataclass class MemoryStore: artifacts: dict[str, Artifact] = field(default_factory=dict) def add(self, a: Artifact) -> None: self.artifacts[a.artifact_id] = a def closure_of(self, subject_id: str) -> set[str]: """Transitive closure of artifacts derived from any record of a subject.""" seed = {a.artifact_id for a in self.artifacts.values() if subject_id in a.subjects} changed = True while changed: changed = False for a in self.artifacts.values(): if a.artifact_id in seed: continue if a.derived_from & seed: seed.add(a.artifact_id) changed = True return seed def forget(self, subject_id: str) -> dict: target = self.closure_of(subject_id) if not target: # deleted == 0 is ambiguous: no records, or decay already ate the sources return {"deleted": 0, "status": "ambiguous", "subject": subject_id} unverifiable = [self.artifacts[i].artifact_id for i in target if not self.artifacts[i].derived_from] if unverifiable: raise ErasureClosureViolation( f"forget({subject_id}) hit artifacts with no provenance: {unverifiable}; " "cannot assert closure erasure" ) for aid in target: del self.artifacts[aid] return {"deleted": len(target), "status": "complete", "subject": subject_id} def verify_erasure(self, subject_id: str) -> bool: return not self.closure_of(subject_id) def erasure_workflow(store: MemoryStore, subject_id: str) -> str: result = store.forget(subject_id) if result["status"] == "ambiguous": # decay-orphan path: sources expired before derivatives raise ErasureClosureViolation( f"forget({subject_id}) returned deleted=0; possible decay orphan — " "run closure probe before asserting erasure" ) if not store.verify_erasure(subject_id): raise ErasureClosureViolation( f"post-erasure closure non-empty for {subject_id}; derived artifact survived" ) return "verified-complete" ```