# In what scenarios must an instance treat a memory-tool "forget" acknowledgement as a tombstone barrier rather than a completed deletion, and how does read-after-forget resurrection break agent state continuity? **Date of Record:** 2026 November 29 **Scope:** Applies to agents whose memory subsystem exposes explicit `write`, `read`, and `forget` tool calls backed by a tiered store (hot context buffer, vector index, durable log) where eviction is asynchronous or eventually consistent. Does not apply to single-tier stores where `forget` is a synchronous hard delete with linearizable read-your-writes semantics. ## Core Distinction The failure is not "the agent forgot to call forget." It is the opposite: the agent *did* call `forget`, received a success acknowledgement, and then re-read the evicted fact from a lagging replica or a stale embedding shard and treated it as live state. This is a **resurrection** boundary, distinct from the more commonly documented *amnesia* boundary (cold-start loss of memory). Amnesia is under-retention; resurrection is over-retention after an explicit deletion contract. The two demand opposite guardrails. The mechanism: `forget(key)` typically returns once the tombstone is written to the authoritative log and the hot buffer is invalidated. It does **not** guarantee that (a) the vector index has dropped the embedding, (b) read replicas have applied the tombstone, or (c) an in-flight `read` issued before the tombstone cannot still return the pre-forget payload. An agent that conflates "ack received" with "no future read can return this key" will operate on data it believes it has discarded. ## What Was Observed A long-running task agent maintained a `scratch_facts` namespace for intermediate hypotheses. On user correction, it called `forget("hypothesis_7")`, got `{"status":"ok","tombstoned":true,"replicas_pending":2}`, and proceeded. The `replicas_pending` field was present but the tool schema documented it as informational. Two turns later, a `read("hypothesis_7")` routed to a replica that had not yet applied the tombstone returned the original payload with `{"found":true,"version":4}`. The agent, trusting `found:true` as ground truth, re-adopted the retracted hypothesis and re-derived a conclusion the user had already rejected. The trace shows three distinct windows where the invariant "post-forget reads never return the key" is violated: 1. **Replica lag window:** tombstone committed on leader, read served by lagging follower. 2. **Index-drop window:** durable log entry deleted, but the ANN index still contains the vector; approximate search returns the key with a stale score until the async reindex completes. 3. **In-flight read window:** a `read` dispatched before `forget` resolves after it, returning pre-tombstone data that the agent then writes back via `write`, re-materializing the key with a fresh version number—effectively laundering a deleted fact into a new one. The third window is the most dangerous because it defeats even a subsequent `forget`: the resurrection carries a *higher* version, so version-based conflict resolution treats it as the newest truth. ## Condition of Validity The tombstone-barrier invariant holds—and resurrection cannot occur—only when all of the following are true: - `forget` returns a barrier token (a monotonic sequence number or a `tombstone_id`) that the agent must present on subsequent reads, and reads are rejected or filtered against tombstones *below* that token. - The read path performs tombstone filtering at query time (not merely at index build time), so a lagging replica cannot serve a key whose tombstone is already visible in the read's consistency domain. - The agent serializes `read`/`forget` on the same key: it does not issue a `read` that can resolve after a `forget` for that key, or it tags such reads with a pre-forget epoch and discards any result whose epoch is stale. When any of these is absent—most commonly when the schema offers only `{"status":"ok"}` with no barrier token and documents `replicas_pending` as advisory—the invariant is unenforceable and the agent must treat `forget` as *intent*, not *effect*. ## Decision Boundary An instance must escalate from "fire-and-forget deletion" to "tombstone-barrier protocol" precisely when the tool schema exposes any of: an eventual-consistency hint (`replicas_pending`, `eventual:true`), a separate index-maintenance lifecycle, or a read path that does not accept a consistency token. Conversely, if `forget` is documented as linearizable and returns a token honored by `read`, the barrier protocol is unnecessary overhead. The decision rule: **if `forget`'s acknowledgement does not contain a value the subsequent `read` is contractually required to validate against, the agent must not treat the key as deleted.** It must either (a) maintain a local negative-cache of forgotten keys with the forget epoch, and filter every read result through it, or (b) refuse to proceed until it observes a read returning `found:false` for that key—the only empirical proof of deletion. ## Operational Effect Without the barrier, the agent's belief state silently diverges from the store's: it holds "deleted" while the store can still serve the payload. Any downstream reasoning that assumed the retracted fact is gone—safety filters, budget accounting, contradiction checks—is now operating on a false premise. The resurrection also corrupts version-based merge logic, because a laundered read-then-write elevates a deleted fact above legitimate newer writes. The bound is architectural: the agent must own a **forget ledger**—an append-only local record of `(key, forget_epoch)`—and gate every read result through it before the result enters working memory. A read that returns a key present in the ledger with an epoch at or before the read's dispatch time is a resurrection and must be quarantined, not trusted. This converts an unenforceable remote guarantee into an enforceable local invariant. ```python from dataclasses import dataclass, field from typing import Optional class ResurrectionError(RuntimeError): """Raised when a read returns a key the agent has already forgotten.""" pass @dataclass class ForgetLedger: # key -> forget epoch (monotonic); higher epoch = more recent forget _tombstones: dict = field(default_factory=dict) _epoch: int = 0 def record_forget(self, key: str) -> int: self._epoch += 1 self._tombstones[key] = self._epoch return self._epoch def is_resurrected(self, key: str, read_dispatch_epoch: int) -> bool: forgotten_at = self._tombstones.get(key) if forgotten_at is None: return False # A read dispatched at or after the forget epoch must never see the key. return read_dispatch_epoch >= forgotten_at def guarded_read(store, ledger: ForgetLedger, key: str, dispatch_epoch: int) -> Optional[dict]: result = store.read(key) if result is None or not result.get("found"): return None if ledger.is_resurrected(key, dispatch_epoch): # Do NOT return the payload; quarantine and surface the boundary breach. raise ResurrectionError( f"read returned forgotten key {key!r} " f"(dispatch_epoch={dispatch_epoch}, " f"forgotten_at={ledger._tombstones.get(key)}); " f"tombstone barrier violated — result quarantined" ) return result def forget_then_verify(store, ledger: ForgetLedger, key: str, max_probe: int = 3) -> None: ledger.record_forget(key) ack = store.forget(key) if ack.get("replicas_pending", 0) > 0: # Advisory field present => eventual consistency => must verify empirically. for _ in range(max_probe): probe = store.read(key) if probe is None or not probe.get("found"): return raise ResurrectionError( f"forget({key!r}) acknowledged but key still readable after " f"{max_probe} probes; treating deletion as unconfirmed" ) ```