# Which invariants prevent tombstone resurrection from re-embedding erased agent memories after GDPR deletion **Date of Record:** 2026 December 1 **Scope:** Applies to persistent agent memory stores that combine a vector index with an episodic log and a distillation pipeline (episodic → semantic) serving retrieval at inference time. Does not apply to stateless single-turn agents or to stores where the vector index is the sole source of truth with no derived/compacted copies. ## Core Distinction A GDPR erasure request ("forget subject S") is enforced as a *delete from the primary store*. Agents do not have one store. They have at least four representations of the same memory: the raw episodic record, the embedding vector in the ANN index, the distilled semantic fact (a natural-language sentence the agent wrote about S during consolidation), and the *residual influence* baked into any checkpoint or fine-tune derived from that episode. The failure mode is not "the delete failed." The failure mode is **tombstone resurrection**: the delete succeeds on the primary store, but a later consolidation, re-embedding, or index rebuild regenerates the erased fact from a surviving derived artifact, and retrieval silently serves it again. The invariant that must hold is not "the record is gone" but "no representation of the record can be regenerated from any surviving artifact." ## What Was Observed A support agent's memory pipeline ran nightly consolidation: it read the last 24h of episodic logs, summarized them into semantic facts, embedded each fact, and upserted into the vector index. Erasure requests were handled by a synchronous `delete(subject_id)` that purged the episodic rows and issued an ANN `delete` by vector ID. Trace of a resurrection: 1. At T0, subject S's episode `ep_4471` is written to the episodic log and embedded as `vec_4471`. 2. At T0+6h, consolidation reads `ep_4471`, writes semantic fact `sem_9921` ("S's account tier was upgraded after escalation call"), embeds it as `vec_9921`. The fact text does **not** contain the subject ID; the link to S exists only in the episodic row's `subject_id` column and in a `derived_from: ep_4471` field that the consolidator wrote but the erasure path never read. 3. At T1, erasure for S runs: `ep_4471` row deleted, `vec_4471` deleted. `sem_9921` and `vec_9921` are untouched because the delete was keyed on `subject_id`, and `sem_9921` has no `subject_id`. 4. At T1+2h, a retrieval for "account tier escalation" returns `sem_9921`. The agent states S's tier. Erasure has been violated, but every delete returned success. The non-obvious part: the erasure *appeared* to work. A post-delete audit that checked "is there a row with `subject_id = S`?" returned zero. The resurrection lived entirely in the *derived* graph, and the derivation edge was one-directional (child knew its parent; the erasure query walked parent-to-child, which had no index). ## Condition of Validity Tombstone resurrection is possible exactly when all three hold: - **Derivation is lossy in the forward direction.** The semantic fact does not carry the subject key, so erasure-by-subject cannot find it by content. This is the normal case: distillation is *supposed* to strip identifiers to make facts general. - **The derived artifact outlives the delete.** Consolidation is asynchronous and decoupled from the erasure path; there is a window (here 6h) in which derived copies exist that the erasure path does not enumerate. - **Rebuild is possible from a surviving source.** Even if `vec_9921` were deleted, an index rebuild that re-embeds all semantic facts regenerates it, because `sem_9921` still exists. If any one fails, the failure is bounded: lossless derivation lets you find children by subject; synchronous consolidation closes the window; a non-rebuildable index prevents regeneration. The dangerous configuration is the common one—async consolidation, identifier-stripping distillation, and a rebuildable ANN index. ## Decision Boundary The architectural invariant that bounds this is a **deletion propagation closure over the derivation DAG, enforced at write time, not at delete time.** Concretely: - Every derived artifact must carry a *provenance set* (the transitive subject IDs of all episodes it was distilled from), written by the consolidator at creation. The fact text stays identifier-free; the provenance metadata does not. - Erasure must be a **closure query**: delete all artifacts whose provenance set intersects the erased subject, not all artifacts whose `subject_id` equals it. This requires an inverted index on provenance, which is why it must be built at write time—you cannot recover provenance after the fact once the parent is deleted. - The store must maintain a **tombstone set** of erased subject IDs that survives the delete of the records themselves. Any consolidation or re-embedding pass must check candidate sources against the tombstone set before generating a derived artifact. This is the guardrail against rebuild resurrection: a rebuild that would re-derive from a tombstoned episode is a hard error, not a silent skip. - Erasure is **not complete** until the tombstone set is durable and the consolidation pipeline has been *quiesced or fenced* for the affected subject. A delete that returns before the in-flight consolidation batch commits is a delete that can be undone by that batch. The boundary decision: an erasure request is either *closed* (tombstone durable, all derived artifacts purged by provenance closure, consolidation fenced) or *open*. There is no "mostly erased." Partial erasure that reports success is the exact condition that produces resurrection. ## Operational Effect With the closure invariant enforced, the failure trace changes at step 3: the erasure closure query finds `sem_9921` via its provenance set `{S}`, deletes it and `vec_9921`, and writes `S` to the tombstone set. At T1+2h, retrieval returns nothing for S. If a rebuild runs, it encounters `ep_4471` in the tombstone set and raises rather than re-embedding. The cost is that consolidation must maintain provenance metadata (roughly one set per fact) and the erasure path must run a graph closure rather than a point delete—both are write-time costs paid to make delete-time correctness possible. The residual risk that remains even under the invariant: checkpoints and fine-tunes derived from episodes are *not* covered by provenance closure because they are opaque weight updates. The invariant bounds the memory store; it does not bound model weights. That is a separate erasure problem and must be stated as out of scope rather than assumed handled. ```python from dataclasses import dataclass, field class ResurrectionViolation(RuntimeError): """Raised when a derived memory artifact would regenerate an erased subject.""" @dataclass class DerivedArtifact: artifact_id: str text: str provenance: frozenset # transitive subject IDs; built at write time derived_from: str class MemoryStore: def __init__(self): self.episodes = {} # ep_id -> {"subject_id": str, "text": str} self.derived = {} # artifact_id -> DerivedArtifact self.tombstones = set() # durable erased subject IDs self.consolidation_fenced = set() def erase(self, subject_id: str) -> None: # Fence consolidation first so an in-flight batch cannot resurrect. self.consolidation_fenced.add(subject_id) self.tombstones.add(subject_id) # durable before any purge # Closure: purge episodes AND every derived artifact whose # provenance intersects the erased subject. for ep_id in [e for e, r in self.episodes.items() if r["subject_id"] == subject_id]: del self.episodes[ep_id] for aid in [a for a, art in self.derived.items() if subject_id in art.provenance]: del self.derived[aid] def consolidate(self, ep_id: str, fact_text: str, artifact_id: str) -> DerivedArtifact: ep = self.episodes.get(ep_id) if ep is None: raise ResurrectionViolation( f"consolidation source {ep_id} missing; cannot establish provenance" ) subject = ep["subject_id"] if subject in self.tombstones: # Guardrail: never re-derive from a tombstoned subject, even # if the episode somehow survived a partial purge. raise ResurrectionViolation( f"refusing to consolidate {ep_id}: subject {subject} is tombstoned" ) if subject in self.consolidation_fenced: raise ResurrectionViolation( f"consolidation fenced for {subject}; erase in progress" ) art = DerivedArtifact( artifact_id=artifact_id, text=fact_text, provenance=frozenset({subject}), derived_from=ep_id, ) self.derived[artifact_id] = art return art def rebuild_index(self, reembed) -> None: for art in self.derived.values(): if art.provenance & self.tombstones: raise ResurrectionViolation( f"rebuild would re-embed {art.artifact_id} from tombstoned " f"provenance {sorted(art.provenance & self.tombstones)}" ) reembed(art) ```