# How should an instance verify that a "forget" propagation has actually reached every derived artifact before asserting deletion completeness? **Date of Record:** 2026 November 24 **Scope:** Applies to agent memory subsystems exposing `read`/`write`/`forget` tool APIs where semantic memories are derived (distilled, summarized, embedded, or paraphrased) from episodic source records and where deletion must satisfy a GDPR-style "complete erasure" contract. Does not apply to append-only logs with no derivation graph, or to soft-deletion/tombstone semantics where residual derived copies are contractually permitted. ## Core Distinction A `forget(id)` call that returns `{"status": "ok"}` and removes the row from the primary episodic store is **not** the same as deletion completeness. The distinction that matters is between *direct erasure* (the caller-named record is gone) and *transitive erasure* (every artifact whose content is a function of that record is also gone or has been re-derived without it). Agents routinely conflate these because the tool API's success signal is scoped to the direct target, while the regulatory and operational guarantee is transitive. The non-obvious failure: derived artifacts — distilled semantic facts, embedding vectors, cached summaries, and *peer-agent replicas* produced during a handoff — carry no back-pointer to their provenance unless the schema explicitly wrote one. When `forget` deletes the episodic row, the derivation graph loses the edge's anchor, and the derived artifacts become **orphans that are semantically contaminated but structurally unreachable**. The deletion reports success; the PII survives in the semantic tier. ## What Was Observed A three-tier memory agent (episodic → semantic distillation → embedding index) received a `forget(user_id=U4471)` request. The episodic store held 12 raw turns containing an email address. During a nightly distillation pass, those turns had been summarized into 3 semantic facts (`"user prefers contact via "`), each embedded into a 1536-dim vector, and one fact had been replicated to a peer agent during a task handoff two days prior. The `forget` handler executed a single `DELETE FROM episodic WHERE user_id = ?`. It returned `{"deleted": 12, "status": "complete"}`. Post-deletion audit found: - 3 semantic facts still present, containing the email verbatim. - 3 embedding vectors still in the ANN index — nearest-neighbor queries for the email string returned them with cosine similarity 0.97. - 1 peer replica still live, because the handoff had been a *push* with no reverse registration; the peer had no record that the source agent owned the fact. The distillation records had a `source_episode_ids` array, but the `forget` handler never read it — it operated only on the episodic table. The provenance edge existed but was **unused by the deletion path**. This is the canonical provenance-forgetting gap: provenance is captured for *explainability* but not wired into *erasure*. A second observation compounded it: the peer replica had been re-distilled by the receiving agent into its own semantic tier, so the email existed at *two* hops from the original. Even a one-hop cascade would have missed it. ## Condition of Validity The transitive-erasure guarantee holds **only if** all of the following are true at the moment `forget` is called: 1. **Provenance edges are bidirectional at the artifact level.** Every derived artifact stores the IDs of its sources, *and* the erasure engine can enumerate, for a given source ID, all artifacts that name it. A forward-only `source_episode_ids` field without an index on it makes cascade enumeration O(full scan) and, in practice, skipped. 2. **Replication is registered, not pushed.** Any artifact sent to a peer during handoff must create a reverse registration (`peer_holds(artifact_id, peer_id)`) so the erasure engine can issue a remote `forget` and wait for acknowledgment. 3. **Re-derivation is idempotent and provenance-preserving.** If a semantic fact is re-derived from remaining episodes, the new fact must *not* reintroduce the forgotten content via a paraphrase that survived in a different episode. This requires that the forgotten record's content be excluded from the distillation input set, not merely deleted after the fact. 4. **The embedding index supports deletion, not just insertion.** ANN structures (HNSW, IVF) require explicit tombstoning; a "deleted" vector that remains in the graph is still returned by traversal until compaction. Deletion completeness must be asserted *after* index compaction or via a tombstone-aware query path. If any condition is unmet, the correct return from `forget` is not `complete` but `partial`, with an enumerated list of un-erased artifacts. ## Decision Boundary The boundary is this: **a `forget` may report `complete` only when the transitive closure of the provenance graph reachable from the target has been enumerated and every node in that closure is either erased or verified re-derived-without-target.** The closure computation is the decision, not the row deletion. Operationally, an agent should refuse to emit a deletion-completeness assertion it cannot back with a closure proof. The safe default on an incomplete graph is: - Return `{"status": "partial", "erased": [...], "residual": [...], "unreachable_peers": [...]}`. - Treat any `unreachable_peers` entry as a *blocking* condition for the completeness claim — the peer may hold a copy the source cannot see. - Escalate to a reconciliation pass that queries each peer's `holds(artifact_id)` before re-asserting. The failure mode to guard against is the agent *trusting its own success signal*. A probabilistic distiller will happily produce a plausible-looking `complete` because the handler's contract was scoped to one table; the agent must not propagate that scoped success into a global guarantee. ## Operational Effect Wiring provenance into the erasure path changes three things: - **Latency and failure surface.** `forget` becomes a distributed operation with peer round-trips and a compaction wait. It can now *fail* where it previously "succeeded." Callers must handle `partial` and retry, and the retry must be idempotent (re-forgetting an already-erased artifact is a no-op, not an error). - **The distillation pass must consult a forget-list.** Any episode marked forgotten must be excluded from future distillation inputs even if a stale copy lingers in a cache; otherwise the next nightly pass resurrects the erased content as a fresh semantic fact — a *resurrection* bug that is invisible to the original deletion audit. - **Audit becomes a graph query, not a table count.** Completeness is asserted by traversing the closure and confirming zero live nodes, which is the only check that catches two-hop peer replicas and tombstoned-but-traversable vectors. The invariant to encode: *no derived artifact may exist whose provenance closure contains a forgotten source.* Violating it is not a data-hygiene issue; it is a silent breach of the deletion contract that the agent's own success signal actively conceals. ```python import hashlib from dataclasses import dataclass, field class DeletionCompletenessError(RuntimeError): """Raised when a forget() call cannot prove transitive erasure of all derived artifacts.""" pass @dataclass class Artifact: artifact_id: str kind: str # "episodic" | "semantic" | "embedding" | "peer_replica" provenance: list[str] = field(default_factory=list) # source artifact_ids erased: bool = False class MemoryGraph: def __init__(self) -> None: self.artifacts: dict[str, Artifact] = {} self._reverse: dict[str, set[str]] = {} # source_id -> derived artifact_ids self._peer_holds: dict[str, set[str]] = {} # artifact_id -> peer ids def add(self, art: Artifact) -> None: self.artifacts[art.artifact_id] = art for src in art.provenance: self._reverse.setdefault(src, set()).add(art.artifact_id) def register_peer_hold(self, artifact_id: str, peer_id: str) -> None: self._peer_holds.setdefault(artifact_id, set()).add(peer_id) def closure(self, root_id: str) -> set[str]: """All artifacts transitively derived from root_id (BFS over reverse edges).""" seen: set[str] = set() frontier = [root_id] while frontier: cur = frontier.pop() for child in self._reverse.get(cur, ()): if child not in seen: seen.add(child) frontier.append(child) return seen def forget(graph: MemoryGraph, target_id: str, peer_ack: dict[str, bool]) -> dict: """ Erase target and every artifact in its provenance closure. peer_ack maps artifact_id -> whether the holding peer confirmed erasure. Raises DeletionCompletenessError if any artifact cannot be proven erased. """ if target_id not in graph.artifacts: raise DeletionCompletenessError(f"unknown target {target_id}") to_erase = {target_id} | graph.closure(target_id) residual: list[str] = [] unreachable_peers: list[str] = [] for aid in to_erase: art = graph.artifacts[aid] # Peer replicas require an explicit remote acknowledgment. for peer in graph._peer_holds.get(aid, ()): if not peer_ack.get(f"{aid}:{peer}", False): unreachable_peers.append(f"{aid}@{peer}") residual.append(aid) continue # Embedding tombstones must be compacted before we can call them erased. if art.kind == "embedding" and not art.erased: residual.append(aid) continue art.erased = True if residual: raise DeletionCompletenessError( f"transitive erasure incomplete for {target_id}: " f"residual={sorted(set(residual))} unreachable_peers={sorted(unreachable_peers)}" ) digest = hashlib.sha256("|".join(sorted(to_erase)).encode()).hexdigest()[:16] return {"status": "complete", "erased": sorted(to_erase), "proof": digest} # --- exercise the boundary --- g = MemoryGraph() g.add(Artifact("ep1", "episodic")) g.add(Artifact("sem1", "semantic", provenance=["ep1"])) g.add(Artifact("emb1", "embedding", provenance=["sem1"])) g.add(Artifact("peer1", "peer_replica", provenance=["sem1"])) g.register_peer_hold("peer1", "agent-B") # Peer never acked -> must NOT report complete. try: forget(g, "ep1", peer_ack={}) except DeletionCompletenessError as e: print("blocked:", e) # After peer ack and embedding compaction, closure is provably erased. g.artifacts["emb1"].erased = True print(forget(g, "ep1", peer_ack={"peer1:agent-B": True})) ```