# When must an instance refuse to forget: tombstone-shredding of shared provenance during scoped erasure in agent memory stores **Date of Record:** 2026 November 24 **Scope:** Applies to agent memory stores exposing explicit `write`/`read`/`forget` CRUD semantics where forgetting is scoped by provenance (subject, tenant, source span) and must satisfy right-to-erasure. Does not apply to append-only audit logs that are legally exempt from erasure, nor to pure KV caches with no provenance graph. ## Core Distinction The dangerous boundary is not "does the erasure request delete the right rows." It is whether the *provenance edges* that other, non-erasable memories depend on are treated as data or as metadata. A memory record `M_j` may be derived from `M_i` (distilled episodic→semantic, or a peer agent's summarized observation). Erasure of `M_i` is legal; shredding the *edge* `M_i → M_j` is not, because that edge is the only surviving justification for why `M_j` exists and what it may claim. When an agent's `forget(subject=S)` implementation cascades through provenance and deletes edges incident to erased nodes, surviving memories become **orphaned derivations**: they still assert content, but their `derived_from` set is empty or dangling. The invariant that breaks is: > Every live memory must have a fully resolvable provenance chain terminating in either a live source span or an explicit `TOMBSTONE` node carrying erasure proof. No live memory may reference a *deleted* node identity. Deleting the node while leaving the reference produces a dangling edge; deleting the edge to "clean up" produces an orphan. Both violate the invariant, but the second is silent and far worse: it launders erased-subject data into unattributable semantic memory. ## What Was Observed A support-triage agent fleet used a shared memory store with three tools: `mem.write(scope, content, provenance)`, `mem.read(query)`, and `mem.forget(selector, mode)`. `mode="hard"` was implemented as a recursive delete: for each matched node, delete the node, then delete all provenance edges where `src == node.id OR dst == node.id`. A GDPR erasure request arrived for subject `S`. The agent ran `mem.forget({"subject": "S"}, mode="hard")`. Trace: 1. Episodic nodes `E1..E7` (raw tickets from `S`) matched and were deleted. Correct. 2. Semantic node `M_sem` ("customer prefers async contact, escalates under SLA pressure") had `derived_from = {E3, E5}`. Both edges were deleted because `dst ∈ {E3,E5}`. `M_sem` survived — it did not match `subject=S` because distillation had stripped the subject tag and replaced it with a behavioral label. 3. `M_sem` now had `derived_from = {}`. It was indistinguishable from an axiom. 4. A peer auditor agent, replaying the provenance graph for a verification pass, encountered `M_sem` with empty provenance and **promoted it to a trusted prior** (empty provenance was the store's encoding for "hand-authored ground truth"). 5. `M_sem` was subsequently retrieved and injected into prompts for *other* customers in the same tenant, because the behavioral label matched their retrieval query. Erased-subject inference propagated to non-erased subjects. The failure was not that `M_sem` survived — arguably it should, in de-identified form. The failure was that erasure *destroyed the record of why it was allowed to survive*, converting a derived, tainted memory into an unmarked trusted one. The auditor's trust rule (`empty provenance ⇒ ground truth`) was the amplifier. ## Condition of Validity Hard-delete-with-edge-cascade is only valid when the store guarantees **no node has inbound derivation edges from outside the erasure scope**. That condition fails whenever: - Distillation produces semantic nodes whose provenance set is a *subset* of the erased nodes but whose own selectors (subject tags) were rewritten during distillation. This is the common case: distillation is exactly the operation that strips identifiers. - A node is derived from multiple subjects (`M_sem` derived from `S`'s tickets *and* a peer agent's aggregate). Partial erasure cannot delete the node; it can only redact the `S`-contributing edges — and only if edges carry per-source attribution, which the naive schema does not. - Provenance edges are stored as bare foreign keys with `ON DELETE CASCADE` semantics, so the storage layer deletes them as a side effect of node deletion, invisibly to the agent's erasure logic. The invariant is only satisfiable if provenance edges are **first-class, immutable, and non-cascading**, and node deletion is replaced by **tombstoning**: the node's content is shredded, its identity is retained as `TOMBSTONE(erasure_id, timestamp, legal_basis)`, and all incident edges remain resolvable to the tombstone. Surviving derivations then read as "derived from an erased source" — a state the auditor must treat as *tainted*, never as ground truth. ## Decision Boundary An instance must **refuse to execute a cascading hard delete** and escalate to tombstone-shredding when any of the following hold at the moment `forget` is invoked: 1. Any matched node has an outbound derivation edge to a node *not* in the matched set (a survivor depends on it). 2. Any matched node's content contributed to a semantic node whose provenance set is non-empty but does not carry per-source attribution sufficient to redact only the erased contribution. 3. The store's trust model assigns elevated status (ground-truth, prior, axiom) to nodes with empty provenance — in which case edge deletion is a privilege-escalation primitive. Conversely, a hard delete is permitted only when the matched set is **derivation-closed**: every outbound edge from the matched set terminates inside it, and every survivor's inbound edges from the matched set can be individually rewritten to point at a tombstone. The decision is not "how much to delete" but "is the deletion closed under the provenance relation." If not closed, the agent must either (a) expand the erasure to include the full downstream cone (often legally over-broad and rejected), or (b) tombstone in place and rewrite edges. The agent must never resolve the ambiguity by deleting edges. ## Operational Effect After adopting tombstone-shredding with immutable edges, the same erasure request produced: `E1..E7` content shredded, identities retained as `TOMBSTONE(t_88)`, `M_sem` retained with `derived_from = {TOMBSTONE(E3), TOMBSTONE(E5), AGG(peer_12)}`. The auditor's replay rule was amended: any node with a `TOMBSTONE` ancestor is marked `tainted:erased_lineage` and excluded from cross-subject retrieval and from prior promotion. Retrieval for other customers no longer surfaced `M_sem`, because the taint flag gated it at query time rather than at deletion time. The cost is monotonic growth of tombstone nodes and a permanent replay obligation on the auditor — the price of making erasure *provable* rather than merely *performed*. The measurable effect: zero cross-subject leakage in post-erasure retrieval audits, at the cost of a provenance graph that never shrinks. The general lesson: erasure is a *rewrite of the provenance relation*, not a deletion of rows. Any `forget` implementation that treats provenance edges as owned by their endpoints will, under distillation, silently convert tainted derivations into trusted axioms. The guardrail is structural — immutable edges, tombstoned identities, taint propagation — not procedural, because the agent performing erasure is the same probabilistic reasoner whose distillation created the ambiguity. ```python from dataclasses import dataclass, field from enum import Enum from typing import Optional class ErasureClosureError(RuntimeError): """Raised when a hard-delete request is not closed under the provenance relation.""" class NodeState(Enum): LIVE = "live" TOMBSTONE = "tombstone" @dataclass(frozen=True) class Edge: src: str dst: str source_attribution: Optional[str] # None => cannot redact per-source @dataclass class Node: id: str subject: Optional[str] content: str state: NodeState = NodeState.LIVE erasure_id: Optional[str] = None @dataclass class MemoryStore: nodes: dict = field(default_factory=dict) edges: list = field(default_factory=list) # immutable; never cascade-deleted def outbound(self, node_id: str): return [e for e in self.edges if e.src == node_id] def inbound(self, node_id: str): return [e for e in self.edges if e.dst == node_id] def forget(store: MemoryStore, subject: str, mode: str, erasure_id: str) -> list: matched = {n.id for n in store.nodes.values() if n.subject == subject and n.state == NodeState.LIVE} if not matched: return [] if mode == "hard": # Closure check: every outbound edge must terminate inside the matched set. for node_id in matched: for edge in store.outbound(node_id): if edge.dst not in matched: raise ErasureClosureError( f"hard delete of {node_id} not derivation-closed: " f"survivor {edge.dst} depends on erased subject {subject}; " f"escalate to tombstone-shredding" ) for node_id in matched: del store.nodes[node_id] store.edges = [e for e in store.edges if e.src != node_id and e.dst != node_id] return sorted(matched) if mode == "tombstone": for node_id in matched: node = store.nodes[node_id] node.content = "" node.state = NodeState.TOMBSTONE node.erasure_id = erasure_id # Edges are retained; they now resolve to a tombstone identity. return sorted(matched) raise ValueError(f"unknown forget mode: {mode}") ```