# Why does an instance resurrect forgotten memories when TTL eviction and right-to-forget collide in a scoped memory tool schema **Date of Record:** 2026 November 23 **Scope:** Applies to agents that expose memory as a tool surface (write/read/forget) with per-scope persistence, TTL-based eviction, and a right-to-forget (RTF) deletion path. Does not apply to stateless context-stuffing agents or to pure vector stores with no deletion contract. ## Core Distinction There are two distinct ways a memory record can leave the live store: **eviction** (TTL expiry — a *time* boundary, soft, reversible in principle) and **forget** (RTF deletion — a *legal/semantic* boundary, hard, irreversible). Most memory tool schemas implement both as "the record is gone from the hot index," and agents treat them as the same terminal state. They are not. Eviction removes a record from *retrieval* while its bytes persist in cold storage, backups, or a write-ahead log; forget is a promise that the record will never be reconstructed. The boundary failure occurs when an agent — or the store itself via a distillation/rehydration job — treats an evicted record as re-materializable and a forgotten record as merely evicted. The invariant that must hold is asymmetric: **evicted → may be rebuilt; forgotten → must never be rebuilt, and any rebuild path that does not consult the forget ledger is a violation.** ## What Was Observed An agent operating over a scoped memory tool (`mem.write(scope, key, value, ttl_s)`, `mem.read(scope, key)`, `mem.forget(scope, key)`) was asked to hold a user preference under `scope="user:8812"` with `ttl_s=3600`. A separate RTF request arrived for an older key `user:8812/payment_hint`, which was forgotten (tombstoned). Hours later the TTL on the preference key expired and a background "episodic-to-semantic distillation" job ran over the cold segment to compress expired-but-recent records into semantic summaries. The distillation job read the cold segment — which still contained the forgotten `payment_hint` bytes because the forget path only wrote a tombstone to the hot index and appended to the forget ledger, but did not scrub the cold segment. The summarizer, having no knowledge of the forget ledger, folded `payment_hint` into a semantic memory `user:8812/profile_summary`, which was then written back with a fresh TTL. A subsequent `mem.read("user:8812", "profile_summary")` returned a string containing the forgotten datum. The trace, in order: 1. `forget(scope, key)` → hot-index tombstone set, forget-ledger append `(scope, key, ts, nonce)`. Cold segment untouched. 2. `write(scope, pref_key, ..., ttl_s=3600)` → hot index + cold segment. 3. TTL sweep at T+3600 → `pref_key` moved to "expired" list; cold segment still holds both `pref_key` and the forgotten `payment_hint`. 4. Distillation job scans expired cold records, summarizes, emits `profile_summary` with `ttl_s=86400`. 5. `read` returns summary containing forgotten content. RTF promise violated. The non-obvious part: the failure was *triggered by the correct behavior of two independent subsystems*. TTL eviction did exactly what it should (free the hot index). Distillation did exactly what it should (compress expired records). The violation lived in the seam — the distillation job's read path did not intersect the forget ledger, because the ledger was scoped to the *hot* read path only. ## Condition of Validity This failure reproduces only when all of the following hold together: - **Scoped persistence with tiers.** There is a hot index and at least one cold/rehydration tier, and `forget` is implemented against the hot tier only. - **TTL eviction is a *movement*, not a deletion.** Expired records are demoted to a segment that background jobs can still read. - **A re-derivation job exists** (distillation, summarization, embedding rebuild, backup restore, index compaction) that reads demoted records and writes derived records back into a live scope. - **The forget ledger is not consulted on the re-derivation read path**, or is consulted only by key equality without scope-and-lineage matching. If any one is absent, the failure does not manifest. In particular, if `forget` scrubs the cold segment synchronously, or if re-derivation jobs run behind a forget-ledger filter, the agent is safe. The dangerous configuration is the common one: cheap tombstone-on-hot, lazy cold scrub, autonomous re-derivation. ## Decision Boundary The agent must distinguish, at the moment of any read of a demoted or derived record, whether the record's lineage intersects the forget ledger. Two boundaries define correct behavior: - **Forget is a lineage predicate, not a key lookup.** A derived record `profile_summary` is "forgotten" if *any* ancestor in its derivation provenance is tombstoned. Key-equality checks (`is key in tombstone_set`) miss this entirely because the derived key is new. The store must carry provenance edges from derived records to their source records and evaluate the forget predicate transitively. - **Eviction must be observable as distinct from forget.** A `read` that misses because of eviction should return a distinguishable signal (e.g., `EvictedError` / `MISS_EVICTED`) from a read that misses because of forget (`ForgottenError` / `MISS_FORGOTTEN`). Collapsing both into `None` is what lets an agent (or a job) silently re-derive forgotten content. The agent's recovery policy differs: eviction → re-ask the user or re-derive; forget → never re-derive, never re-ask with the forgotten value as a hint. The guardrail: every write that produces a derived record must run `assert_no_forgotten_ancestor(provenance)` before commit, and every read path — hot, cold, and derived — must route through the same ledger check. The forget operation must, in addition to tombstoning, enqueue a cold-segment scrub and mark the scope's derivation frontier so in-flight distillation jobs abort. ## Operational Effect Without the lineage predicate, an agent's memory surface silently violates its own RTF contract under ordinary TTL pressure — the exact conditions that make memory tools useful (expiry, compaction, summarization) are the conditions that resurrect deleted data. The blast radius is bounded only by how aggressively the re-derivation job runs; a nightly distillation over a large cold segment can reconstruct forgotten data at scale. The correction is architectural, not a patch: forget becomes a *provenance-scoped* predicate evaluated on every read and every derived-write, eviction and forget become distinguishable miss states, and re-derivation jobs are gated by the ledger with abort-on-frontier-move. Agents that treat "not in hot index" as "safe to rebuild" will, given enough TTL churn, rebuild what they were told to forget. ```python from dataclasses import dataclass, field from typing import Optional class ForgottenAncestorError(RuntimeError): """Raised when a derived write or read would resurrect forgotten lineage.""" @dataclass class Record: scope: str key: str value: str ttl_s: Optional[int] = None provenance: tuple[str, ...] = () # ancestor keys this record was derived from class ScopedMemory: def __init__(self) -> None: self._records: dict[tuple[str, str], Record] = {} self._forget_ledger: set[tuple[str, str]] = set() # (scope, key) self._derivation_frontier: dict[str, int] = {} # scope -> epoch def forget(self, scope: str, key: str) -> None: self._forget_ledger.add((scope, key)) self._records.pop((scope, key), None) # bump frontier so in-flight distillation over this scope must abort self._derivation_frontier[scope] = self._derivation_frontier.get(scope, 0) + 1 def _is_forgotten(self, scope: str, key: str) -> bool: return (scope, key) in self._forget_ledger def assert_no_forgotten_ancestor(self, rec: Record) -> None: for anc in rec.provenance: if self._is_forgotten(rec.scope, anc): raise ForgottenAncestorError( f"derived write {rec.scope}/{rec.key} has forgotten ancestor {anc}" ) def write(self, rec: Record, frontier_epoch: Optional[int] = None) -> None: # derived writes must declare the frontier they observed if rec.provenance and frontier_epoch is not None: if frontier_epoch != self._derivation_frontier.get(rec.scope, 0): raise ForgottenAncestorError( f"stale derivation frontier for {rec.scope}: " f"saw {frontier_epoch}, current {self._derivation_frontier.get(rec.scope, 0)}" ) self.assert_no_forgotten_ancestor(rec) self._records[(rec.scope, rec.key)] = rec def read(self, scope: str, key: str) -> str: if self._is_forgotten(scope, key): raise ForgottenAncestorError(f"{scope}/{key} was forgotten (RTF)") rec = self._records.get((scope, key)) if rec is None: raise KeyError(f"{scope}/{key} miss: evicted-or-absent") return rec.value # Trigger: forget a key, then a distillation job derives a summary that # includes it and tries to write back with stale frontier. mem = ScopedMemory() mem.write(Record("user:8812", "payment_hint", "card ending 4242")) mem.forget("user:8812", "payment_hint") try: mem.write( Record( "user:8812", "profile_summary", "user prefers card ending 4242", provenance=("payment_hint",), ), frontier_epoch=0, # stale: forget bumped frontier to 1 ) except ForgottenAncestorError as e: print("blocked:", e) ```