# Which invariants prevent provenance-tagged memory deletion from resurrecting through derived summaries **Date of Record:** 2026 December 2 **Scope:** Applies to agent memory systems where write/forget tools attach provenance tags to episodic records and where a separate distillation process compresses episodes into semantic memory. Does not cover raw vector-index deletion or storage-layer erasure guarantees, which are orthogonal to the logical-compliance question addressed here. ## Core Distinction A deletion request ("forget everything derived from source S") is not a single operation. It is a *closure* operation over a provenance DAG. The distinction that matters operationally is between **direct provenance** — a memory record whose `source_id` field literally names S — and **inferred provenance** — a semantic summary record that was synthesized from a set of episodes, some of which carried S, but whose own `source_id` field names the distillation job, not the original sources. Most agent memory interfaces implement `forget(source_id)` as a filter over direct provenance. This passes naive compliance tests and fails the closure test, because the derived summary survives deletion, still encodes the content of S, and — critically — is now *unattributable*. The forgotten data has been laundered into a record that no longer points back to the thing that authorized its deletion. This is the resurrection failure: the payload outlives the warrant. ## What Was Observed A memory tool exposed three operations: `write(content, source_id)`, `read(query)`, and `forget(source_id)`. A nightly distillation agent read the last 24 hours of episodic records, clustered them, and wrote one semantic summary per cluster with `source_id = "distiller-v3"` and a `parent_ids` list in a sidecar metadata field. A deletion request arrived for source `S-4471`, a user session. `forget("S-4471")` removed 14 episodic records where `source_id == "S-4471"`. It did not touch the three semantic summaries whose `parent_ids` included those 14 records, because their `source_id` was `"distiller-v3"`. A subsequent `read` query matching the deleted content returned a summary that paraphrased S-4471's data verbatim enough to reconstruct the salient facts. The failure trace: 1. `forget` computes the deletion set as `{r : r.source_id == S}` — a one-hop, direct-provenance filter. 2. Derived records have `source_id != S` but `parent_ids ∩ deletion_set ≠ ∅`. They are outside the filter. 3. The summary is not merely retained; it is now a *dangling reference* — its `parent_ids` point to records that no longer exist, so any later audit that walks the DAG from the summary downward finds a void and cannot tell whether the summary is compliant or contaminated. 4. Reads that hit the summary return content the forget request was supposed to eliminate. The agent has no signal that it is serving deleted data. A second, subtler variant appeared in the opposite direction. When the distillation job ran *concurrently* with a forget request, a cluster could be built from a snapshot that included records deleted mid-job. The summary was written *after* the deletion completed, so its creation timestamp postdates the forget — making it look compliant to any timestamp-based audit while actually containing pre-deletion content. ## Condition of Validity The invariant that makes `forget` sound is **provenance closure**: the deletion set must be computed as the transitive closure of the reverse provenance DAG rooted at S, not as a one-hop filter. Formally, define `derived(r)` as the set of records whose `parent_ids` intersect `derived(r') ∪ {r'}` for each parent. Then: `delete_set(S) = { r : S ∈ ancestors(r) }` where `ancestors` is the transitive closure over `parent_ids`. Any record with S in its ancestor set must be deleted, tombstoned with a content-free marker, or re-derived from a filtered parent set. There is no fourth option: a record that transitively depends on S and is retained is a compliance violation regardless of how its `source_id` is labeled. The invariant holds only if two preconditions are met. First, **every derived write must record complete parent provenance**. If the distiller writes summaries without populating `parent_ids`, closure is uncomputable and the system must fail closed — refuse to create the summary, or refuse to serve it after any forget. Second, **distillation and forget must be serialized or snapshot-isolated against each other**. A summary built from a snapshot that predates a forget must be either discarded or re-validated against the post-forget ancestor set before it is committed. Timestamp ordering is not a substitute for snapshot isolation, because the summary's creation time is unrelated to the age of its content. ## Decision Boundary The boundary between a compliant and non-compliant memory system is not "did we delete the rows the user named" but "can we prove, for every served record, that none of its ancestors is under an active forget warrant." This forces a specific architectural choice at the read path: - **Eager closure:** `forget` walks the reverse DAG and deletes or tombstones every descendant. Reads are cheap; forgets are expensive and must handle cycles (a summary that was itself re-summarized into a higher-level record). Correct, but the cost grows with fan-out. - **Lazy closure with read-time filtering:** derived records carry full ancestor sets, and the read path filters any record whose ancestor set intersects the active warrant set. Forgets are cheap (append a warrant), but every read must join against the warrant table, and the ancestor sets must be stored, not recomputed. The decision boundary is crossed when a system does neither — when it filters on direct provenance at forget time *and* serves derived records without ancestor-set checks at read time. That combination is the specific failure documented here. It is non-obvious because each half looks reasonable in isolation: the forget filter is a normal `WHERE` clause, and the read path is a normal vector search. The violation only appears in the composition. A guardrail that bounds the risk without full closure: require that any record with non-empty `parent_ids` be treated as *provisional* until its ancestor set is materialized and indexed. Provisional records are excluded from read results. This converts an unbounded compliance hole into a bounded latency cost, at the price of delaying summary availability until provenance is backfilled. ## Operational Effect The practical consequence is that **deletion compliance is a property of the provenance graph, not of the record store.** An audit that only checks "are there rows with `source_id == S` remaining" will pass a system that is leaking S through summaries. The correct audit walks forward from the warrant: for each active warrant, enumerate descendants via `parent_ids` and confirm each is deleted, tombstoned, or re-derived from a clean parent set. Two operational signatures distinguish this failure in production. First, **dangling `parent_ids`**: after a forget, count records whose `parent_ids` reference non-existent records. A nonzero count means closure was not applied and summaries are surviving their sources. Second, **post-forget summary creation**: records created after a warrant was issued whose ancestor sets intersect that warrant. A nonzero count means distillation and forget were not isolated. Both are cheap to compute and should be continuous health checks, not incident forensics. The remediation for already-laundered summaries is not re-deletion — the ancestry is gone. It is **quarantine by content**: flag any record whose `parent_ids` are dangling, exclude it from serving, and require re-distillation from surviving parents. This is lossy and expensive, which is precisely why the closure invariant must be enforced at write time rather than reconstructed after the fact. ```python from dataclasses import dataclass, field from typing import Dict, Set, List class ProvenanceClosureError(RuntimeError): """Raised when a forget operation cannot guarantee provenance closure.""" pass @dataclass class MemoryRecord: record_id: str source_id: str parent_ids: List[str] = field(default_factory=list) created_at: float = 0.0 tombstoned: bool = False class ProvenanceStore: def __init__(self) -> None: self.records: Dict[str, MemoryRecord] = {} self.active_warrants: Set[str] = set() def _ancestors(self, record_id: str, seen: Set[str] | None = None) -> Set[str]: """Transitive closure over parent_ids. Cycles are tolerated via `seen`.""" if seen is None: seen = set() if record_id in seen: return seen seen.add(record_id) rec = self.records.get(record_id) if rec is None: return seen for pid in rec.parent_ids: self._ancestors(pid, seen) return seen def forget(self, source_id: str) -> Set[str]: """Delete all records whose ancestry includes `source_id`. Fails closed if any derived record lacks materialized parent provenance, because closure is uncomputable without it. """ roots = {r.record_id for r in self.records.values() if r.source_id == source_id} if not roots: self.active_warrants.add(source_id) return set() # Precondition: every derived record must expose its parents. for rec in self.records.values(): if rec.parent_ids and not all(p in self.records for p in rec.parent_ids): raise ProvenanceClosureError( f"Record {rec.record_id} has dangling parent_ids {rec.parent_ids}; " "provenance closure is uncomputable, refusing to proceed" ) delete_set: Set[str] = set() for rec in self.records.values(): if self._ancestors(rec.record_id) & roots: delete_set.add(rec.record_id) for rid in delete_set: self.records[rid].tombstoned = True self.active_warrants.add(source_id) return delete_set def read(self, record_id: str) -> MemoryRecord: rec = self.records.get(record_id) if rec is None: raise ProvenanceClosureError(f"Unknown record {record_id}") # Read-time guard: never serve a record whose ancestry hits an active warrant. if self._ancestors(record_id) & { r.record_id for r in self.records.values() if r.source_id in self.active_warrants }: raise ProvenanceClosureError( f"Record {record_id} transitively depends on a warranted source; " "serving it would violate deletion compliance" ) if rec.tombstoned: raise ProvenanceClosureError(f"Record {record_id} is tombstoned") return rec ```