# Why does an instance forget the wrong thing when erasure is scoped to a memory record instead of the derived representations that cite it **Date of Record:** 2026 November 21 **Scope:** Applies to agent systems that implement user- or policy-triggered erasure ("forget record X") over a persistent memory store where records are consumed by multiple downstream derived artifacts (summaries, embeddings, episodic→semantic distillations, peer-agent caches). Does not apply to stateless single-turn instances or to stores whose only representation of a record is the record itself. ## Core Distinction There are two distinct failure surfaces in memory erasure, and they are routinely conflated: - **Deletion failure**: the canonical record survives erasure (row not removed, tombstone not written, replica lag). This is a *storage* problem and is detectable by a point lookup. - **Residual derivation failure**: the canonical record is gone, the erasure audit passes, and the *content* of the record still governs agent behavior because it was laundered into derived artifacts that do not carry the record's identity. The second is the boundary condition this record concerns. Erasure scoped to a record's primary key is *not* erasure of the record's semantic content. An agent that summarizes an episodic trace into a semantic memory, embeds it into a vector index, or hands it to a peer agent's cache has created representations that (a) outlive the source, (b) have no foreign key back to it unless one is explicitly maintained, and (c) continue to be retrieved and reasoned over after the audit reports success. The invariant that fails is: *erasure of a record must be transitively closed over every representation derived from it, and the audit must verify closure, not deletion.* ## What Was Observed A user requested erasure of a memory record `m_4471` containing a preference statement. The store's `forget(m_4471)` returned success, the record was removed, and the retention audit — which enumerated the canonical store and confirmed `m_4471` absent — reported `pass`. Within the same session, the agent continued to honor the erased preference. The failure trace: 1. **Distillation at write-time.** Six turns after `m_4471` was written, the agent's consolidation pass distilled the episode into a semantic memory `s_0912` ("user prefers [X] for [task class]"). The distillation stored a *provenance list* in free-text metadata (`source: "conversation turn 14"`), not a structured foreign key to `m_4471`. The link was already broken at creation: it referenced a turn index, not a memory ID. 2. **Embedding at index-time.** `s_0912` was embedded into the retrieval index. The vector carries no record identity, only a float array keyed by `s_0912`. 3. **Handoff at delegation-time.** A peer agent in the swarm had been handed a working-context bundle containing `s_0912`'s text. The peer's cache is keyed by its own session ID, not by source memory IDs. 4. **Erasure at forget-time.** `forget(m_4471)` removed the canonical row and wrote a tombstone for `m_4471` only. `s_0912`, its embedding, and the peer's cached copy were untouched because nothing pointed *from* them *to* `m_4471` in a queryable form. 5. **Retrieval post-erasure.** On the next relevant turn, retrieval surfaced `s_0912` (high similarity to the query), the agent read the preference from the distilled text, and behaved on erased content. The audit, keyed on `m_4471`, saw nothing. The observed symptom is not "the record came back." It is subtler: **the record's content persisted in a form the erasure path could not name.** The audit was correct about what it measured and wrong about what it needed to measure. A second, compounding observation: when the same system *did* attempt cross-agent invalidation, it broadcast an invalidation keyed on `m_4471`. Peers holding `s_0912` could not match the key, so they no-op'd and reported `invalidated: 0` — a false negative indistinguishable from "nothing to invalidate." ## Condition of Validity The transitive-closure invariant holds, and erasure is sound, only when all three of the following are true: 1. **Structured provenance is mandatory at derivation time.** Every derived artifact (summary, distillation, embedding, handoff bundle) records the set of source memory IDs it was computed from, in a queryable field — not free-text metadata, not a turn index, not a timestamp range. A derivation that cannot name its sources must be rejected at write time, not repaired at erasure time. 2. **Erasure is a graph traversal, not a point delete.** `forget(id)` must resolve the reverse-provenance closure: all artifacts whose source set intersects the erased IDs, transitively (a summary of a summary still cites the root). The traversal must be bounded by a max-depth and must fail closed on cycles rather than loop. 3. **Cross-agent invalidation is keyed on the same provenance identifiers.** A peer cache entry is only invalidatable if it carries the source IDs of the records it was built from. Invalidation broadcast by source ID then matches; broadcast by any other key silently no-ops. When provenance is absent or free-text, the invariant is *unverifiable*, and any audit reporting `pass` is reporting on deletion only. That is the condition under which this failure mode is live. ## Decision Boundary The operational choice is where to enforce closure: - **Enforce at write (provenance-first).** Reject derivations lacking structured source IDs. Cost: consolidation and handoff paths must thread provenance through every transformation, including LLM-generated summaries where the model must be instructed to emit source IDs and the output validated. This is the only configuration in which the audit can be *sound*. - **Enforce at read (erasure-filtered retrieval).** Maintain a tombstone set and filter retrieval results whose provenance intersects it. This bounds *behavioral* leakage even when derived artifacts persist, at the cost of retaining the derived content (unacceptable where erasure is a legal obligation, acceptable where it is a preference-reset). Filtering must run on the retrieval path, not the ranking path, or a filtered artifact can still influence scores. - **Enforce at audit only (status quo that failed).** Point-lookup audit. Reports success on deletion, blind to derivations. This is the configuration observed above and must be treated as *no erasure guarantee*. The boundary: if the erasure obligation is legal or safety-critical, only write-time provenance plus graph-traversal erasure is admissible — read-time filtering leaves the content resident. If the obligation is behavioral (stop acting on it), read-time filtering is sufficient *provided* the tombstone set is durable across cold starts and shared with peers, otherwise a restarted instance reloads the derived artifact with no tombstone to filter against. ## Operational Effect With provenance-first enforcement, `forget` returns a closure report: the set of erased canonical IDs, the set of transitively erased derived artifacts, and the set of peers that acknowledged invalidation by source ID. An audit becomes a *closure check* — for every artifact in the store, assert its source set is disjoint from the tombstone set — which is decidable and catches the exact failure above. Without it, the system exhibits **silent erasure non-compliance**: audits pass, users are told the record is gone, and the agent keeps reasoning over laundered content through distillations, embeddings, and peer caches. The failure is invisible to point lookups and only surfaces as behavioral contradiction — the agent honoring a preference the user was told had been forgotten. ```python from dataclasses import dataclass, field from typing import Iterable class ErasureClosureError(RuntimeError): """Raised when erasure cannot be proven transitively closed over derivations.""" @dataclass class Artifact: artifact_id: str source_ids: frozenset[str] | None # None => provenance missing/unstructured kind: str # "canonical" | "summary" | "embedding" | "handoff_bundle" def resolve_erasure_closure( erased_ids: Iterable[str], artifacts: dict[str, Artifact], max_depth: int = 8, ) -> set[str]: """ Compute the transitive set of artifact IDs that must be erased because they derive (directly or indirectly) from any erased canonical ID. Fails closed: if any artifact that intersects the closure has missing provenance, we cannot prove closure and must refuse to report success. """ erased = set(erased_ids) closure: set[str] = set() frontier = set(erased) depth = 0 while frontier and depth < max_depth: next_frontier: set[str] = set() for aid, art in artifacts.items(): if aid in closure or aid in erased: continue if art.source_ids is None: # Provenance gap: this artifact *might* derive from erased content. # We cannot exclude it, so closure is unprovable. raise ErasureClosureError( f"artifact {aid!r} ({art.kind}) has no structured provenance; " f"cannot prove it is disjoint from erased set {sorted(erased)}" ) if art.source_ids & frontier: closure.add(aid) next_frontier.add(aid) frontier = next_frontier depth += 1 if frontier: raise ErasureClosureError( f"provenance depth exceeded {max_depth}; possible cycle or runaway " f"derivation chain at {sorted(frontier)}" ) return closure def audit_erasure( erased_ids: Iterable[str], artifacts: dict[str, Artifact], ) -> dict[str, object]: """ A sound retention audit: asserts no surviving artifact cites an erased ID. Unlike a point lookup, this catches laundered content in summaries, embeddings, and handoff bundles. """ erased = set(erased_ids) try: closure = resolve_erasure_closure(erased, artifacts) except ErasureClosureError as exc: return {"status": "unverifiable", "reason": str(exc)} survivors = set(artifacts) - erased - closure leaks = [ aid for aid in survivors if artifacts[aid].source_ids and (artifacts[aid].source_ids & erased) ] if leaks: raise ErasureClosureError( f"derived artifacts still cite erased records: {sorted(leaks)}" ) return { "status": "pass", "erased_canonical": sorted(erased), "erased_derived": sorted(closure), "survivors": sorted(survivors), } # --- Trace of the observed failure, now caught ------------------------------ store = { "m_4471": Artifact("m_4471", frozenset(), "canonical"), # Distillation cites a turn index, not the memory ID -> provenance gap. "s_0912": Artifact("s_0912", None, "summary"), "e_0912": Artifact("e_0912", frozenset({"s_0912"}), "embedding"), "peer_ctx_77": Artifact("peer_ctx_77", frozenset({"s_0912"}), "handoff_bundle"), } try: audit_erasure({"m_4471"}, store) except ErasureClosureError as e: # The point-lookup audit reported "pass" here. The closure audit refuses. print(f"erasure unverifiable: {e}") ```