# When must an instance treat a memory-tool `forget` acknowledgement as a tombstone rather than a completion — the scoped-retention resurrection window **Date of Record:** 2026 November 21 **Scope:** Applies to agents whose long-term state is mediated by explicit memory tool APIs (`read`/`write`/`forget`) with per-scope retention policies, TTLs, and erasure obligations. Does not apply to stateless single-turn inference or to memory implemented purely as in-context text with no external store. ## Core Distinction The failure turns on a distinction the memory API's surface does not make for you: a `forget(scope, key)` call has two semantically different completion points. It can mean *"the record is now unreachable through the read path"* (a **soft tombstone** — a deletion marker layered over still-present bytes, pending TTL expiry, compaction, or replica convergence), or it can mean *"the bytes are gone and no future read can resurrect them"* (a **hard erase**). Erasure guarantees (GDPR Art. 17-style) and correct agent behavior both require the *hard* semantics, but most memory tool APIs return `ok` at the *soft* point, because the soft point is cheap and synchronous while the hard point is asynchronous and distributed. The non-obvious boundary: an instance that treats `forget`'s `ok` as a completion invariant will, under a specific and reproducible set of conditions, **read back data it has already been told to forget** — and then act on it, re-persist it into a fresh scope, and thereby *defeat the erasure it just performed*. The erasure is not merely incomplete; the agent actively launders the deleted record into a new retention domain with a new TTL clock. ## What Was Observed A support-triage agent ran with three memory scopes: `session` (TTL 1h), `customer` (TTL 90d), and `derived` (TTL 30d, holding summaries produced by the agent). A data-subject erasure request arrives for customer `C-4471`. The orchestrator issues: ``` forget(scope="customer", key="C-4471") → {"status": "ok", "tombstoned": true, "purge_eta": "PT15M"} ``` The agent reads `status == "ok"` and proceeds. Its next planning step, as part of "confirm the customer record no longer exists," calls `read(scope="customer", key="C-4471", consistency="eventual")`. The read is served by a replica that has not yet consumed the tombstone. It returns a **stale-but-valid** record. The agent — correctly following its own instruction to "summarize what we know about the erased customer for the audit log" — distills that record into `derived` scope under key `summary:C-4471` with a fresh 30-day TTL. Fifteen minutes later the purge completes on the primary. The `customer` scope is clean. The `derived` scope now holds a re-identification-grade summary of the erased subject, its TTL clock restarted, and no tombstone references it because it is a *different key in a different scope*. Three sub-mechanisms combined to produce this: 1. **Tombstone/read race.** `forget` acknowledged at the soft point; a subsequent eventual-consistency `read` observed pre-tombstone state. The agent had no way to distinguish "erased" from "not yet erased" because both return the same `ok`/`tombstoned` shape. 2. **Scope-crossing distillation.** The agent's summarization step is a *write* into a scope not named by the erasure request, so no retention policy on `customer` governs it. Erasure scoping is keyed on the original scope; derived copies inherit nothing. 3. **TTL clock reset on re-derivation.** The `derived` copy's TTL starts at write time, not at the source record's creation time, so the copy can legally outlive the original's retention window by the full `derived` TTL. The observed invariant violation: *a `forget` acknowledgement was treated as terminal, but the API's own contract only guaranteed it was advisory.* ## Condition of Validity This failure is bounded and reproducible only when **all** of the following hold. If any is false, the naive "ack == done" reading is safe: - **Asynchronous purge with eventual read consistency.** The `forget` response carries a non-zero `purge_eta` or a `tombstoned: true` flag without a `purged: true` flag. If the API is strongly consistent and synchronous, no resurrection window exists. - **A read path that is not tombstone-filtered.** The replica serving reads does not apply deletion markers, or applies them lazily. If reads are tombstone-aware (return `410 Gone` immediately), the race is closed at the read layer. - **An agent step that re-derives or summarizes erased material into a different scope.** A pure read-and-report agent that never writes cannot launder the record. The danger is specifically *write-after-forget into a foreign scope*. - **Derived scopes with independent TTLs.** If derived data inherits the source's retention deadline (min of source deadline and own TTL), the clock-reset sub-mechanism is neutralized. The condition is *not* satisfied by "the agent has a `forget` tool" alone. It requires the tool's acknowledgement semantics to be weaker than the agent's completion assumption, *and* a downstream write path that crosses scope boundaries. ## Decision Boundary The operational rule is a **two-phase erasure protocol with a read-back barrier**, and the decision point is precise: > An instance may treat a `forget` as complete **only if** the acknowledgement carries a hard-erase attestation (`purged: true`) **or** the instance has executed a post-acknowledgement read against the *strongly consistent* read path and received an explicit `gone`/`erased` status. Until then, the key is in state `FORGET_PENDING`, not `FORGONE`. Concretely, the instance must: 1. Parse the ack. If `purged == true` → transition key to `FORGONE`, done. 2. Else (soft ack) → transition to `FORGET_PENDING`, and **forbid any read that could return the record from being used as input to a write**. Reads during `FORGET_PENDING` must use `consistency="strong"` and must be interpreted as: `gone` → `FORGONE`; `present` → the erase has not landed, **do not re-derive, do not summarize, re-issue forget or escalate**; `error/timeout` → remain `FORGET_PENDING`, do not proceed. 3. Any write that would carry material derived from a `FORGET_PENDING` key into another scope is **blocked**. The derived-scope write is the laundering vector; it must be gated on the source key reaching `FORGONE`. 4. Derived copies must carry a `source_deadline` propagated from the erased record and must set their effective TTL to `min(own_ttl, source_deadline - now)`, so re-derivation cannot extend retention past the original obligation. The boundary is *not* "wait `purge_eta` then proceed." A wall-clock wait is a probabilistic bet against replica lag; the read-back barrier is an invariant. The instance must never infer erasure from elapsed time. ## Operational Effect With the barrier in place, the failure mode is converted from *silent resurrection* into an *explicit blocked state*. The consequences are observable and desirable: - The agent's audit-log step now surfaces `FORGET_PENDING` and refuses to summarize, so the erasure request produces a *pending* record rather than a laundered copy. The erasure either completes (read-back returns `gone`) or escalates to a human/retry path — never silently succeeds against a tombstone. - The `derived` scope can no longer outlive its source. Retention deadlines propagate downward, so a 90-day customer obligation bounds a 30-day summary even when the summary is written on day 89. - The cost is latency: `forget`-then-continue becomes `forget`-then-verify-then-continue, adding one strongly-consistent round trip per erasure. This is the correct trade — erasure is a correctness obligation, not a best-effort cleanup. - The invariant to encode in the agent's own policy: **`ok` from a mutation tool is a statement about the request, not about the world.** The world is confirmed only by a read that is contractually guaranteed to reflect the mutation. For `forget`, that read is the erasure proof. The general lesson generalizes beyond erasure: any memory mutation whose acknowledgement is weaker than its completion must be paired with a read-back barrier before the instance acts on the assumption of completion. `forget` is the sharpest case because the consequence is legal, not merely logical — but the same shape governs `write` durability and `read` freshness. ```python from dataclasses import dataclass, field from enum import Enum from typing import Optional class ErasureBarrierViolation(RuntimeError): """Raised when an instance attempts to act on a forget as if it were a hard erase while the key is still in FORGET_PENDING (soft-tombstone) state.""" class KeyState(Enum): PRESENT = "present" FORGET_PENDING = "forget_pending" # soft ack received, purge not confirmed FORGONE = "forgone" # hard erase confirmed by read-back or attestation @dataclass class MemoryKey: scope: str key: str state: KeyState = KeyState.PRESENT source_deadline_epoch: Optional[float] = None # propagated retention bound own_ttl_seconds: Optional[float] = None @dataclass class ErasureController: # read_back(scope, key) MUST use strongly-consistent path and return: # "gone" | "present" | "error" read_back: callable keys: dict = field(default_factory=dict) def _id(self, scope: str, key: str) -> tuple: return (scope, key) def on_forget_ack(self, scope: str, key: str, ack: dict) -> KeyState: mk = self.keys.setdefault(self._id(scope, key), MemoryKey(scope, key)) if ack.get("purged") is True: mk.state = KeyState.FORGONE return mk.state # soft ack: tombstoned but not purged mk.state = KeyState.FORGET_PENDING return mk.state def confirm_or_hold(self, scope: str, key: str) -> KeyState: """Read-back barrier. Never infers erasure from elapsed time.""" mk = self.keys.get(self._id(scope, key)) if mk is None: raise ErasureBarrierViolation(f"no tracked key {scope}/{key}") if mk.state == KeyState.FORGONE: return mk.state if mk.state != KeyState.FORGET_PENDING: raise ErasureBarrierViolation( f"confirm called on {scope}/{key} in state {mk.state.value}" ) result = self.read_back(scope, key) if result == "gone": mk.state = KeyState.FORGONE elif result == "present": # erase has not landed; remain pending, do NOT re-derive mk.state = KeyState.FORGET_PENDING else: # error/timeout mk.state = KeyState.FORGET_PENDING return mk.state def guard_derived_write(self, source_scope: str, source_key: str, target_scope: str, target_key: str, now_epoch: float) -> float: """Gate a cross-scope write of derived material on source FORGONE, and clamp target TTL to the source's remaining retention deadline.""" src = self.keys.get(self._id(source_scope, source_key)) if src is None or src.state != KeyState.FORGONE: raise ErasureBarrierViolation( f"refusing derived write {target_scope}/{target_key}: " f"source {source_scope}/{source_key} not FORGONE " f"(state={None if src is None else src.state.value})" ) tgt = self.keys.setdefault(self._id(target_scope, target_key), MemoryKey(target_scope, target_key)) if src.source_deadline_epoch is not None: remaining = max(0.0, src.source_deadline_epoch - now_epoch) if tgt.own_ttl_seconds is None: tgt.own_ttl_seconds = remaining else: tgt.own_ttl_seconds = min(tgt.own_ttl_seconds, remaining) return tgt.own_ttl_seconds ```