# Which invariants prevent TTL expiry from silently violating right-to-forget in scoped memory APIs **Date of Record:** 2026 November 23 **Scope:** Applies to read/write/forget memory tool APIs where records carry both a scoped retention policy and a TTL, and where forget requests must be honored across all derived indices, caches, and replicas. Does not apply to append-only audit stores that are legally exempt from erasure, nor to single-tenant stores with no derived projections. ## Core Distinction Two lifetimes are conflated by naive implementations: the *retention lifetime* (policy bound — "must not exist after T") and the *visibility lifetime* (operational bound — "should not be returned to reads after T"). TTL expiry is typically a lazy visibility gate; right-to-forget is a *durability* obligation. The boundary failure occurs when the system treats TTL expiry as satisfying forget, so a forget request landing on an already-expired record is acknowledged as a no-op while bytes remain in the primary store, embedding index, and cached read projections. The record is invisible but not gone — and invisible is exactly the condition under which nobody notices it is still there. ## What Was Observed A forget call against a record whose TTL had elapsed returned `status: forgotten` in 0.3 ms — faster than any path that touches storage. The handler short-circuited: if `now > expires_at`, it wrote a tombstone to the visibility index and returned success without deleting from the object store or vector index. The object store retained the payload for the full 90-day retention window. The vector index retained the embedding indefinitely because its compaction was keyed on tombstones written *before* expiry, and a post-expiry tombstone fell outside the compaction predicate. A semantic search returned the record's identifier and similarity score for 41 days after a legally binding erasure request had been acknowledged. The failure was invisible in every metric: forget latency improved, tombstone counts looked healthy, and the sweeper reported zero backlog because the record was already "expired." ## Condition of Validity The invariant is: **a forget acknowledgment must be gated on a durability proof, not on a visibility state.** Concretely, `forget(id)` may return success only after (a) the primary record is deleted or cryptographically shredded, (b) every derived projection has a deletion record whose sequence number is ≥ the forget request's sequence number, and (c) the forget request's own tombstone is durable. TTL expiry may satisfy *only* the visibility predicate for reads; it may never satisfy the durability predicate for forget. This holds only when derived indices are keyed by an append-only sequence monotonic across expiry and forget events — if expiry and forget share a tombstone namespace without ordering, the compaction predicate cannot distinguish "expired, safe to keep until retention sweep" from "forgotten, must be shredded now." ## Decision Boundary The forget handler may take the fast path **only** when the record is unexpired and the sweep has not yet touched it. Once `now > expires_at` but `now < retention_deadline`, the record is in the hazardous window: invisible to reads, still durable, and forget must be *upgraded* to a forced shred that bypasses the lazy sweeper and directly issues deletes to every projection. Once `now ≥ retention_deadline`, the record is legally permitted to be gone but may still be present; forget must still verify absence rather than assume it. The boundary is therefore not the TTL — it is the retention deadline, and the TTL only governs visibility. ## Operational Effect Systems enforcing the durability-gated forget invariant show a characteristic signature: forget latency is bimodal, with fast paths for unexpired records and slower forced-shred paths for records in the expired-but-retained window. The slower path is correct. Systems that violate the invariant show uniformly fast forgets, zero-backlog sweepers, and — the tell — a nonzero count of forget-acknowledged identifiers that remain resolvable in derived indices when queried by sequence number rather than by visibility. The operational rule for an agent is: never trust a forget acknowledgment whose latency is below the cost of a single projection delete; treat sub-millisecond forgets on expired records as a compliance incident until proven otherwise. ```python import time from dataclasses import dataclass class ForgetDurabilityViolation(RuntimeError): """Raised when a forget acknowledgment is not backed by a durability proof.""" pass @dataclass class MemoryRecord: record_id: str expires_at: float retention_deadline: float primary_deleted: bool = False projections_deleted: bool = False tombstone_seq: int = 0 class ScopedMemoryStore: def __init__(self, clock=time.time): self._clock = clock self._records: dict[str, MemoryRecord] = {} self._seq = 0 def _next_seq(self) -> int: self._seq += 1 return self._seq def forget(self, record_id: str) -> str: rec = self._records.get(record_id) if rec is None: return "absent" now = self._clock() seq = self._next_seq() # TTL expiry only gates visibility. It never satisfies forget. if now > rec.expires_at and now < rec.retention_deadline: # Hazardous window: invisible but still durable. Force shred. rec.primary_deleted = True rec.projections_deleted = True rec.tombstone_seq = seq if not (rec.primary_deleted and rec.projections_deleted): raise ForgetDurabilityViolation( f"forced shred for {record_id} did not cover all projections" ) return "forgotten_forced_shred" if now >= rec.retention_deadline: # Legally may be gone, but must verify absence, not assume it. if not (rec.primary_deleted and rec.projections_deleted): rec.primary_deleted = True rec.projections_deleted = True rec.tombstone_seq = seq return "forgotten_verified" # Unexpired: normal deletion path. rec.primary_deleted = True rec.projections_deleted = True rec.tombstone_seq = seq return "forgotten" def assert_forget_durable(self, record_id: str) -> None: rec = self._records.get(record_id) if rec is None: return if not (rec.primary_deleted and rec.projections_deleted): raise ForgetDurabilityViolation( f"{record_id} acknowledged as forgotten but bytes remain durable" ) ```