# Why does an instance resurrect erased memory through a re-derived semantic index after TTL expiry? **Date of Record:** 2026 November 25 **Scope:** Applies to agents whose memory subsystem exposes typed records (episodic, semantic, preference) with per-record TTL and a `forget`/erasure tool that must produce verifiable deletion. Does not cover raw context-window truncation or KV-cache eviction, which are transport-layer, not record-layer, concerns. ## Core Distinction There are two deletion events an agent must never conflate: **record deletion** (the tombstone in the store) and **derivation deletion** (the removal of all artifacts *computed from* that record). A typed schema with TTL semantics makes the first event cheap and auditable. It says nothing about the second. When an agent distills episodic records into a semantic summary, or embeds records into a vector index, the erased content now lives in a *derived* object whose lifetime is governed by a different clock and a different owner than the source record. The failure mode is precise: `forget(record_id)` succeeds, the store returns `deleted: true`, the audit log is clean — and the semantic index still answers queries that reconstruct the erased fact. The erasure was verifiable against the store and false against the system. ## What Was Observed An agent held episodic records about a user, one of which — `ep_4471`, TTL 30 days — contained a sensitive preference ("user is relocating to in "). A nightly distillation pass (episodic→semantic) had already folded a paraphrase of that fact into semantic record `sem_0912` ("user has an upcoming relocation; prefers low-commitment scheduling until then"). The semantic record carried its own TTL (180 days) and no back-reference to its source. At day 30, an erasure request arrived for `ep_4471`. The `forget` tool ran correctly: it deleted the episodic record, wrote a tombstone, and returned a signed receipt. The store's verification endpoint confirmed `ep_4471` absent. The erasure was reported complete. At day 34, a scheduling query ("what should I assume about this user's near-term availability?") retrieved `sem_0912` by embedding similarity. The agent behaved on the relocated-user assumption. The erased fact was operationally live. Worse, the retrieval path was *not* a stale cache — `sem_0912` was a first-class, in-policy record. The erasure invariant held on the record graph and failed on the derivation graph, and the two graphs were never joined. A second, subtler trace: the vector index for `sem_0912` had been built from the *episodic* text at distillation time. After erasure, the semantic record's *text* was a paraphrase, but its *embedding* was a near-neighbor of the original sensitive string. A semantic-similarity probe on the erased phrase still scored `sem_0912` at 0.88 cosine. The store said "gone"; the index said "present." ## Condition of Validity The erasure receipt is only valid under a **provenance-closure invariant**: every derived object (summary, embedding, cached tool output, peer-agent handoff payload) must carry an immutable `derived_from: [record_ids]` lineage edge, and `forget(id)` must be defined as a *transitive* operation over the reverse-lineage closure of `id`. This holds only if: 1. Distillation and embedding are modeled as first-class writes that register lineage, not as side effects of a read. 2. TTL is evaluated against the *derivation*, not only the source — a derived record cannot outlive the minimum remaining TTL of any source it depends on, unless it is explicitly re-grounded on a surviving, non-erased source. 3. Erasure is *verifiable by construction*: the receipt enumerates the closed set of deleted object IDs, and a post-condition probe re-queries the index for the erased content and asserts a below-threshold score. Absent (1)–(3), the receipt is a claim about one store, not about the system, and should not be surfaced to a caller as "erasure complete." ## Decision Boundary The agent must choose between two honest behaviors at `forget` time: - **Transitive erasure** — compute reverse-lineage closure, delete or re-ground every derived object, rebuild affected index shards, and emit a receipt listing the full closure. Cost: O(closure size) plus one index rebuild per shard touched. This is the only path that supports a "complete" claim. - **Scoped erasure** — delete only the named record, and *downgrade the receipt* to `scope: "record_only"`, explicitly listing surviving derived objects and their remaining TTL. This is honest but does not satisfy a GDPR-style erasure obligation on its own. The boundary is crossed the moment the agent emits a `scope: "complete"` receipt while any derived object in the reverse-lineage closure survives — or while any surviving object's embedding remains within retrieval threshold of the erased content. The agent must never infer "complete" from a successful store-level delete; completeness is a property of the closure, not of the tombstone. ## Operational Effect In practice, the lineage edge is the load-bearing artifact and must be written *before* the derived object is committed (write-ahead lineage), so a crash between distillation and lineage registration cannot orphan a derivation. Index shards that received embeddings from an erased source must be marked dirty and asynchronously rebuilt; until rebuild completes, retrieval against that shard must be gated by a tombstone filter on `derived_from`. The failure signature to watch for in logs is a `forget` receipt with `scope: complete` and a non-empty reverse-lineage set — that combination is a contradiction and must raise, not log-and-continue. ```python from dataclasses import dataclass, field from typing import Iterable class ErasureClosureViolation(RuntimeError): """Raised when a 'complete' erasure receipt coexists with surviving derived objects.""" @dataclass class Record: rid: str ttl_days: int derived_from: tuple[str, ...] = () embedding: tuple[float, ...] = () @dataclass class Store: records: dict[str, Record] = field(default_factory=dict) def reverse_lineage_closure(self, rid: str) -> set[str]: closure: set[str] = set() frontier = [rid] while frontier: target = frontier.pop() for rec in self.records.values(): if target in rec.derived_from and rec.rid not in closure: closure.add(rec.rid) frontier.append(rec.rid) return closure def forget(self, rid: str, claim_complete: bool = True) -> dict: if rid not in self.records: raise ErasureClosureViolation(f"record {rid} not present; cannot issue receipt") closure = self.reverse_lineage_closure(rid) # Write-ahead lineage invariant: a derivation must never outlive its source # under a 'complete' claim. if claim_complete and closure: raise ErasureClosureViolation( f"cannot claim complete erasure of {rid}: " f"surviving derived objects {sorted(closure)} retain lineage to it; " f"re-ground or delete the closure before issuing a complete receipt" ) deleted = {rid} | (closure if claim_complete else set()) for d in deleted: self.records.pop(d, None) return { "scope": "complete" if claim_complete else "record_only", "deleted": sorted(deleted), "surviving_derivations": sorted(closure - deleted), } def verify_receipt(store: Store, receipt: dict, erased_rid: str) -> None: if receipt["scope"] == "complete": residual = store.reverse_lineage_closure(erased_rid) if residual: raise ErasureClosureViolation( f"receipt claims complete but closure non-empty: {sorted(residual)}" ) elif receipt["surviving_derivations"]: # Honest scoped receipt: allowed, but must be surfaced, not swallowed. return ```