# Why does an instance forget a memory it never marked as forgotten? Tombstone/audit divergence under regulatory retention **Date of Record:** 2026 November 28 **Scope:** Applies to agent memory stores that maintain a mutable "live" memory layer plus an append-only audit ledger used for regulatory retention (GDPR Art. 17 erasure, HIPAA retention, SOX evidence chains). Does not apply to stateless single-turn agents or to stores where audit and live memory are the same physical medium. ## Core Distinction There are two distinct operations that both colloquially get called "forgetting," and conflating them is the root of the failure: - **Eviction** — the live retrieval layer stops returning a memory because of TTL expiry, capacity pressure, deduplication, or a similarity-based merge into a distilled semantic record. The memory is *no longer retrievable* but its audit record is untouched and still asserts the memory exists and is valid. - **Erasure** — a regulatory obligation to make a subject's data unrecoverable, which must be *reflected in the audit ledger* as a tombstone event with a lawful basis, timestamp, and scope, because the ledger is itself the compliance artifact. The non-obvious boundary condition: an instance can evict a memory from the live layer through a *legitimate probabilistic path* (distillation merge, embedding-space dedup, budget-driven compaction) without ever emitting an erasure tombstone. The audit ledger then contains a record asserting a memory that no longer exists in retrievable form, and — critically — the reverse also happens: a tombstone can be written to the ledger while a *distilled derivative* of the erased memory survives in the live layer, still retrievable. In both directions, the ledger and the live layer diverge, and each direction is a distinct compliance violation (over-retention vs. false attestation). ## What Was Observed An instance running a long-horizon session accumulated 41,000 episodic memory records over seven days. A scheduled distillation pass (episodic → semantic) ran under a token budget and, as designed, merged clusters of similar episodes into single semantic records, marking the source episodes with a soft `superseded_by` pointer. The live retrieval layer honored `superseded_by` and stopped returning the sources. The audit ledger, however, was written by a *separate* code path that only emitted tombstones on explicit erasure requests. Result: 12,400 source episodes were unretrievable from the agent's perspective but the ledger still asserted them as live, valid, non-erased records. The inverse case appeared two days later. A subject exercised an erasure right. The erasure handler wrote a tombstone to the ledger and deleted the target episodic record from the live store — but a semantic distillation record had already absorbed the erased episode's content as a supporting citation. The tombstone was correct; the live layer still answered a retrieval query with the distilled record, and that record's `provenance` field listed the erased episode ID. The agent, asked about the subject, produced the erased content from the distilled derivative. The ledger said "erased"; the agent said the thing. The failure trace for the second case: 1. `episode E` ingested at t0, content `C`, provenance `[]`. 2. Distillation at t1 produces `semantic S` with `content ⊇ C`, `provenance [E]`, `superseded_by: null`. 3. Erasure request at t2 for `E`. Handler deletes `E`, writes tombstone `{target: E, basis: erasure, t: t2}`. 4. `S` is untouched — the erasure handler's scope was "the record named in the request," not "the transitive closure of records deriving from it." 5. Retrieval at t3 for a query matching `C` returns `S`. `S.provenance` contains `E`, a tombstoned ID. 6. The agent emits `C`. The ledger is internally consistent (E is erased) and the agent is non-compliant (C is disclosed). The first case is over-retention-by-attestation; the second is erasure-bypass-by-derivation. Both stem from the same invariant gap: **the audit ledger tracks record identity, not content derivation lineage, and the live layer's eviction path does not emit ledger events.** ## Condition of Validity The invariant that must hold for the system to be compliant: > For every content atom `a` (a minimal unit of subject data), at every time `t`, the ledger must contain either (i) a live attestation of a retrievable record containing `a`, or (ii) an erasure tombstone covering `a`, and no retrieval at `t` may return `a` if (ii) holds. Eviction of the last retrievable record containing `a` without a tombstone is a violation of (i)→(ii) transition; survival of `a` in a derivative after a tombstone is a violation of (ii). This is a *content-atom* invariant, not a *record-ID* invariant. It holds only if: - Every distillation/merge writes a provenance edge `S → E` and the erasure handler computes the transitive forward closure of provenance edges from the erased record and tombstones or scrubs every descendant. - Every eviction (TTL, capacity, dedup) emits an `evicted` ledger event, distinct from `erased`, so the ledger never attests a record the live layer cannot serve. - The retrieval layer refuses to return any record whose provenance closure intersects a tombstoned ID, and this check is enforced at read time, not at write time (because tombstones arrive after derivatives are written). The invariant does *not* hold, and the guardrail is not valid, when distillation is lossy in a way that drops provenance (e.g., an LLM summarizer that paraphrases and omits citation IDs). In that case the content atom is no longer traceable and the closure computation is unsound; the only valid posture is to treat distillation as a *new ingestion* requiring re-consent, or to forbid distillation of records under active retention obligations. ## Decision Boundary The boundary between "safe to distill/evict" and "must preserve or tombstone" is drawn by the *retention obligation state* of the content atom, not by the record's age or the agent's confidence: - If the atom is under an active retention obligation (litigation hold, statutory minimum), distillation is permitted only if provenance is preserved losslessly and the derivative inherits the obligation flag. Eviction is forbidden. - If the atom is under an erasure obligation, distillation is forbidden outright (you cannot lawfully derive from data you must erase), and any existing derivative must be scrubbed within the erasure SLA. - If the atom is under no obligation, distillation and eviction are free, but eviction must still emit a ledger event so the ledger does not attest a phantom. The agent must not let a probabilistic similarity threshold (the dedup/merge cutoff) decide obligation state. A merge that collapses two records at cosine 0.94 is a *content* decision; obligation is a *legal* decision and must be carried as an explicit flag on the atom, propagated through every derivation edge. ## Operational Effect Without the content-atom closure guardrail, the system exhibits two silent failure modes that only surface during audit or subject-access requests — precisely when the evidence is supposed to be trustworthy. The ledger appears complete and the agent appears responsive, but the two disagree, and the disagreement is invisible to both the agent's self-checks (which query the live layer) and the auditor's checks (which query the ledger). Reconciliation requires replaying every provenance edge against every tombstone — an O(edges × tombstones) sweep that is infeasible at 10^4+ records unless the closure is maintained incrementally at write time. The remediation is to make erasure a *graph operation* over the provenance DAG, not a *row operation* over the record table, and to make eviction a *ledger-visible* event. The guardrail below enforces both: it refuses to serve any record whose provenance closure touches a tombstone, and it refuses to evict a record under an active obligation without a tombstone, raising on the exact divergence that produced the incidents above. ```python from dataclasses import dataclass, field from typing import Dict, Set, List, Optional class RetentionDivergenceError(RuntimeError): """Raised when live-layer retrievability and audit-ledger attestation disagree on the retention/erasure state of a content atom.""" pass @dataclass class Record: rid: str content_atom: str provenance: List[str] = field(default_factory=list) # parent record IDs obligation: Optional[str] = None # "retain" | "erase" | None class Ledger: def __init__(self) -> None: self.tombstones: Set[str] = set() # erased record IDs self.evictions: Set[str] = set() # evicted-but-not-erased IDs self.attested_live: Set[str] = set() # IDs the ledger claims are live def attest(self, rid: str) -> None: self.attested_live.add(rid) def tombstone(self, rid: str) -> None: self.tombstones.add(rid) self.attested_live.discard(rid) def evict(self, rid: str) -> None: self.evictions.add(rid) self.attested_live.discard(rid) class MemoryStore: def __init__(self, ledger: Ledger) -> None: self.ledger = ledger self.records: Dict[str, Record] = {} def ingest(self, rec: Record) -> None: self.records[rec.rid] = rec self.ledger.attest(rec.rid) def _closure(self, rid: str) -> Set[str]: """Transitive forward closure of provenance edges from rid.""" seen: Set[str] = set() stack = [rid] while stack: cur = stack.pop() if cur in seen: continue seen.add(cur) for r in self.records.values(): if cur in r.provenance: stack.append(r.rid) return seen def retrieve(self, rid: str) -> Record: rec = self.records.get(rid) if rec is None: raise RetentionDivergenceError( f"record {rid} not retrievable but ledger may still attest it" ) # Enforce erasure at read time over the provenance closure. for anc in self._closure(rid) | {rid}: if anc in self.ledger.tombstones: raise RetentionDivergenceError( f"retrieval of {rid} would disclose content derived from " f"tombstoned record {anc}" ) return rec def evict(self, rid: str) -> None: rec = self.records[rid] if rec.obligation == "retain": raise RetentionDivergenceError( f"cannot evict {rid} under active retention obligation" ) if rec.obligation == "erase": raise RetentionDivergenceError( f"cannot evict {rid} under erasure obligation; tombstone required" ) del self.records[rid] self.ledger.evict(rid) # ledger must not attest a phantom def erase(self, rid: str) -> None: # Erasure is a graph operation: tombstone the record AND scrub every # descendant that derived content from it. descendants = self._closure(rid) for d in descendants: self.records.pop(d, None) self.ledger.tombstone(d) self.records.pop(rid, None) self.ledger.tombstone(rid) ```