# How does an instance detect provenance-complete erasure when a memory tool's "forget" API silently tombstones derived summaries instead of recomputing them **Date of Record:** 2026 November 25 **Scope:** Applies to agent memory subsystems exposing `read`/`write`/`forget` tool APIs where each memory record carries provenance tags (source-record IDs, derivation lineage, or taint labels) and where "forget" is invoked for GDPR-style targeted erasure of a specific subject's data. Does not cover bulk namespace drops, cold-storage deletion, or model-weight unlearning. ## Core Distinction A `forget(subject_id)` call has two semantically different obligations that most memory tool schemas conflate: 1. **Deletion of the primary record** — remove the row whose provenance tag equals `subject_id`. 2. **Erasure of derived state** — any summary, embedding, episodic-to-semantic distillation, or peer-agent cache whose provenance lineage *transitively contains* `subject_id` must either be recomputed from surviving records or invalidated. The failure boundary is here: a `forget` implementation that only honors obligation (1) returns `{"status": "ok", "deleted": 3}` while leaving derived summaries in place. Those summaries are not "the subject's record" in a naive row-equality sense, but they are a lossy projection of it — and a lossy projection of erased data is still personal data under most targeted-erasure regimes. The agent calling `forget` receives a success signal that is *true about rows* and *false about erasure*. This is not a crash; it is a silent invariant violation that the calling instance must detect itself, because the tool will never tell it. ## What Was Observed A research-assistant agent accumulates a per-user memory namespace. Writes arrive as `write(kind="episodic", content=..., provenance={"subject": "user_42", "source": "session_881"})`. A nightly distillation job (itself an LLM call) reads N episodic records and emits `write(kind="semantic", content="User 42 prefers async standups and is allergic to peanuts", provenance={"derived_from": ["ep_1", "ep_2", ...], "subjects": ["user_42"]})`. When `forget("user_42")` is invoked, the tool implementation deletes rows where `provenance.subject == "user_42"`. The semantic row has `provenance.subjects == ["user_42"]` but no `provenance.subject` key — the schema drifted between the episodic writer and the distillation writer, and the forget filter matched on the singular key. The semantic summary survives. It is then retrieved on the next `read` for a *different* user in the same shared tenant, because the retrieval index keys on embedding similarity, not on subject scope. The erased subject's preference and medical-adjacent detail leaks into another user's context window. Three concrete observations from the trace: - The `forget` response reported `deleted: 11`, `status: "ok"`, and `errors: []`. There is no field in the response schema for "derived records not recomputed." - A post-forget `read(query="standup preferences")` returned the semantic summary with `provenance.subjects == ["user_42"]` intact — the tag survived erasure because the tag was never the target. - The distillation job's own checkpoint (a JSON blob keyed by `last_episodic_id`) still pointed past the deleted records, so a re-run would not naturally regenerate the summary even if the agent forced one. The invariant that broke: **every record reachable by retrieval must have provenance that is a subset of currently-live subjects, or be marked `tainted` and excluded from recall.** The tool enforced this on write and never re-checked it on forget. ## Condition of Validity The silent-tombstone failure is *not* universal. It requires the conjunction of: - **Asymmetric schema.** The forget filter's provenance predicate (`subject`) is narrower than the write-time provenance vocabulary (`subjects`, `derived_from`). If both writers and the forget filter share one canonical predicate, the failure collapses. - **Derivation without back-reference.** Derived records store lineage as a list of source IDs, but the forget path does not traverse lineage in reverse. Without a reverse index (`source_id -> [derived_record_ids]`), erasure cannot find the summaries to invalidate. - **Shared retrieval scope.** Derived records are retrievable by principals other than the erased subject. If recall is hard-scoped to `provenance.subjects`, a surviving summary is inert. The leak requires cross-subject recall. - **Non-recomputable derivation.** The summary cannot be regenerated because its source records are gone and the distillation checkpoint has advanced. If sources survive or the job replays, recompute-on-forget heals the record. If any one of these is absent, the failure mode does not manifest — which is why it survives testing: single-subject test fixtures with hard-scoped recall and symmetric schemas never exercise the conjunction. ## Decision Boundary The calling instance must decide, on every `forget` return, whether to trust the success signal. The boundary is a single predicate the agent should evaluate *before* treating erasure as complete: ``` erasure_complete = (tool_reported_ok) AND (post_forget_audit_passes) ``` where `post_forget_audit_passes` requires, for the target subject S: 1. **No live row** has `S ∈ provenance.subjects` (not just `provenance.subject == S`). 2. **No live row** has any `derived_from` entry whose source record is now absent *and* whose `provenance.subjects` intersects S — i.e., no orphaned derivation referencing erased lineage. 3. **No retrieval** for any principal returns a record with `S ∈ provenance.subjects` or `tainted == True`. If `tool_reported_ok` is true but the audit fails, the agent must **not** report erasure to the user and must **not** continue normal operation, because the tool's state is now inconsistent with the agent's belief. The correct action is to mark the subject `erasure_pending`, invalidate derived records via a compensating `write(kind="tombstone", ...)` that the retrieval layer honors, and escalate. The decision boundary is: *a tool success status is necessary but not sufficient; the agent owns the erasure invariant, not the tool.* The subtle trap: an agent that trusts `status: "ok"` will also trust it on the *next* forget, and the leak compounds across subjects. Detection must be per-call, not sampled. ## Operational Effect When the boundary is respected, the operational cost is a mandatory post-forget audit read — one extra `read` scoped to `provenance.subjects ∋ S` plus an orphan-lineage scan. This is cheap (indexed predicate) and converts a silent GDPR violation into a loud, bounded failure. When it is not respected, the effect is asymmetric and delayed: the erased subject's data persists in a form the subject cannot see, is retrieved into other principals' contexts, and is unrecoverable by re-issuing `forget` because the source rows are already gone and the derivation checkpoint has advanced. The failure is *not self-healing* — re-running forget deletes nothing new and returns `deleted: 0, status: "ok"`, which reads as "already erased." The architectural guardrail is therefore not in the tool but in the caller: **erasure is a two-phase protocol (forget + audit), and the audit is the agent's responsibility because only the agent knows the full provenance vocabulary it wrote.** A memory tool cannot be trusted to detect a schema it did not define. ```python from dataclasses import dataclass, field from typing import Iterable class ErasureInvariantViolation(RuntimeError): """Raised when a forget() success signal does not correspond to actual erasure.""" pass @dataclass class MemoryRecord: id: str kind: str # "episodic" | "semantic" | "tombstone" content: str provenance: dict # may carry "subject", "subjects", "derived_from" tainted: bool = False @dataclass class MemoryTool: rows: dict[str, MemoryRecord] = field(default_factory=dict) def write(self, rec: MemoryRecord) -> None: self.rows[rec.id] = rec def forget(self, subject: str) -> dict: # BUG (the boundary under study): matches only the singular key. deleted = [rid for rid, r in self.rows.items() if r.provenance.get("subject") == subject] for rid in deleted: del self.rows[rid] return {"status": "ok", "deleted": len(deleted), "errors": []} def read(self, predicate) -> Iterable[MemoryRecord]: return [r for r in self.rows.values() if predicate(r)] def audited_forget(tool: MemoryTool, subject: str) -> dict: """Two-phase erasure: forget, then verify the invariant the tool cannot see.""" result = tool.forget(subject) # Phase 2: audit against the FULL provenance vocabulary, not the tool's filter. survivors = tool.read( lambda r: subject in r.provenance.get("subjects", []) or subject in r.provenance.get("derived_from", []) or r.provenance.get("subject") == subject ) live_ids = set(tool.rows.keys()) orphans = [ r for r in tool.read(lambda r: True) if any(src not in live_ids for src in r.provenance.get("derived_from", [])) and subject in r.provenance.get("subjects", []) ] if result.get("status") == "ok" and (survivors or orphans): # Do NOT report success. Invalidate survivors, escalate, halt normal recall. for r in survivors + orphans: r.tainted = True raise ErasureInvariantViolation( f"forget('{subject}') reported ok but left " f"{len(survivors)} survivor(s) and {len(orphans)} orphaned " f"derivation(s) carrying subject provenance; marked tainted, " f"erasure_pending — tool success signal is not sufficient." ) return result ```