Where must an instance reconcile provenance-tracked forget against derived semantic memory before acknowledging a GDPR erasure

**Date of Record:** 2026 December 1

**Scope:** Applies to agent instances that expose `read`/`write`/`forget` memory tools where `forget` carries provenance metadata (source IDs, derivation lineage, taint tags) and must satisfy GDPR Art. 17 erasure semantics. Does not apply to append-only logs with no derived-memory pipeline, or to single-turn stateless invocations with no persistent store.

Core Distinction

A `forget(id)` call removes a *record*, not a *fact*. The failure mode addressed here is the divergence between the two: an instance acknowledges erasure of a provenance-tracked source record while the same proposition survives, laundered, inside derived semantic memory (summaries, embeddings, distilled rules, cached tool outputs) that no longer carries the erased record's provenance pointer. The acknowledgement is truthful at the record layer and false at the data-subject layer.

The non-obvious part: provenance-tracked deletion is *not* transitively closed by default. When record `R` is distilled into semantic memory `S`, the lineage edge `S ← R` is written at distillation time. But `S` may itself be re-distilled into `S'`, re-embedded into an approximate index, or merged into a peer agent's memory during handoff. Each of these transformations can drop or weaken the back-pointer. An instance that trusts `forget` to walk the lineage graph will silently under-delete whenever a lineage edge is missing or when the surviving artifact is a *transformation* whose lineage was recorded against a different node than the one being erased.

What Was Observed

A memory tool exposed three verbs. `forget` accepted `{source_id, cascade: true}` and returned `{deleted_records: n, deleted_derived: m}`. In a traced run, the erasure of source `S-4471` (a user's support transcript) returned `deleted_records: 1, deleted_derived: 0`. The acknowledgement was emitted, the tool reported success, and the orchestrator marked the erasure complete.

The proposition from `S-4471` — a billing dispute with a specific amount and date — was still recoverable. Trace:

  1. At T0, `S-4471` was distilled into semantic node `M-88` with edge `M-88 ← S-4471`.
  2. At T1, `M-88` was merged with `M-90` (from a different source) into `M-131` by a consolidation pass. The consolidation tool recorded `M-131 ← M-88` and `M-131 ← M-90`, but the merge *rewrote the content* of `M-131` to a compressed form. The edge to `S-4471` was two hops away and not materialized.
  3. At T2, `M-131` was embedded into an approximate nearest-neighbor index. The index stores vectors, not lineage. `forget` at the record layer had no traversal path into the vector index.
  4. At T3, `forget(S-4471, cascade=true)` walked edges from `S-4471`, found `M-88` already tombstoned by the merge, and stopped. It did not follow `M-88 → M-131` because `M-88` was tombstoned, and the traversal treated tombstoned nodes as terminal rather than as pass-through lineage.

The instance's `cascade` logic had a *tombstone-as-leaf* bug: a deleted intermediate node severed the lineage path to its descendants. The derived content survived in `M-131` and in the vector index, both reachable by a `read` query that matched on the compressed proposition.

Condition of Validity

The erasure acknowledgement is valid only if all four conditions hold simultaneously at the moment of ack:

If any condition is unverifiable, the instance must not emit a success ack. It must emit a *partial* status naming the unverified artifact class. This is the invariant: **erasure acknowledgement is a claim about the data subject's recoverable information, not about row deletion count.**

Decision Boundary

The boundary the instance must detect is between *tombstone-as-terminal* and *tombstone-as-pass-through*. A tombstoned node is terminal for `read` (must not be served) but pass-through for `forget` (its outgoing lineage edges must still be traversed to reach live descendants). The two traversals have opposite semantics over the same graph, and conflating them is the bug.

Concretely, the guardrail: `forget` traversal must be a *reverse-lineage BFS over the union of live and tombstoned nodes*, collecting every descendant whose content hash matches a proposition-fingerprint of the erased source. Content matching, not just ID matching, is required because consolidation rewrites content and may drop the ID. When a descendant's content matches but its lineage is broken, the instance cannot prove the match is *only* from the erased source — it must treat the artifact as tainted and either delete it or escalate to a human review queue rather than ack.

The second boundary: a `read` that hits a tainted-but-not-yet-erased artifact during an open erasure must return a *withheld* status, not the content, and must not cache the result. Serving it re-derives the erased proposition into a fresh cache entry with fresh lineage, re-laundering the deletion.

Operational Effect

The observable effect of missing this boundary is a *false erasure ack*: the orchestrator records compliance, downstream deletion of the source's replicas proceeds, and the derived copy becomes the sole surviving instance of the proposition — now with no lineage to the erased source and therefore invisible to any subsequent `forget` call keyed on that source. The data subject's information is *more* durable after erasure than before, because the erasure removed the pointer that would have found it.

The fix is architectural: erasure must be verified by *proposition fingerprint* over derived memory, independent of lineage, and the ack must be gated on a closure proof over the union graph. The code below encodes the traversal guard and the ack gate.

from dataclasses import dataclass, field
from typing import Optional
import hashlib

class ErasureClosureError(RuntimeError):
    """Raised when an erasure ack would be emitted without proven lineage closure."""

@dataclass
class Node:
    id: str
    content: str
    tombstoned: bool = False
    parents: list[str] = field(default_factory=list)   # lineage: this <- parents
    indexed: bool = False                               # materialized in an ANN/keyword index

def fingerprint(content: str) -> str:
    return hashlib.sha256(content.strip().lower().encode()).hexdigest()[:16]

def reverse_lineage_closure(graph: dict[str, Node], source_id: str) -> set[str]:
    """BFS over ALL nodes, live and tombstoned. Tombstones are pass-through, not leaves."""
    if source_id not in graph:
        raise ErasureClosureError(f"source {source_id} absent from graph; cannot prove closure")
    children: dict[str, list[str]] = {}
    for n in graph.values():
        for p in n.parents:
            children.setdefault(p, []).append(n.id)
    seen, stack = set(), [source_id]
    while stack:
        cur = stack.pop()
        for c in children.get(cur, []):
            if c not in seen:
                seen.add(c)
                stack.append(c)          # traverse through tombstoned intermediates
    return seen

def verify_erasure(graph: dict[str, Node], source_id: str,
                    open_erasures: set[str]) -> dict:
    if source_id in open_erasures:
        raise ErasureClosureError(f"erasure of {source_id} already in flight; re-entrant ack forbidden")
    open_erasures.add(source_id)
    try:
        fp = fingerprint(graph[source_id].content)
        closure = reverse_lineage_closure(graph, source_id)
        survivors, tainted, stale_index = [], [], []
        for nid in closure:
            node = graph[nid]
            if node.tombstoned:
                continue
            if fingerprint(node.content) == fp:
                survivors.append(nid)            # content survived despite lineage
            elif not node.parents:
                tainted.append(nid)              # orphan: lineage broken, cannot attribute
            if node.indexed:
                stale_index.append(nid)          # index entry is a surviving copy
        if survivors or stale_index or tainted:
            raise ErasureClosureError(
                f"erasure of {source_id} not closed: "
                f"survivors={survivors} stale_index={stale_index} tainted={tainted}"
            )
        return {"deleted_derived": len(closure), "ack": "complete"}
    finally:
        open_erasures.discard(source_id)

def forget(graph: dict[str, Node], source_id: str, open_erasures: set[str]) -> dict:
    # 1. tombstone the source record
    graph[source_id].tombstoned = True
    # 2. closure proof BEFORE any ack; raises if survivors/index/taint remain
    return verify_erasure(graph, source_id, open_erasures)