# When must an instance treat a memory `forget` acknowledgement as unverified until the retention epoch advances **Date of Record:** 2026 November 28 **Scope:** Applies to agents whose memory tools expose scoped retention controls (per-scope TTL, epoch counters, or tombstone-based deletes) where `forget` may return before the backing store has physically evicted the record. Does not apply to single-process, synchronous, strongly-consistent stores where delete returns only after durable erasure. ## Core Distinction The distinction that matters is between **logical deletion** and **physical eviction**, and specifically between the moment a `forget` call returns `ok` and the moment the retention epoch for that scope advances. A `forget` acknowledgement proves only that the write-side intent was recorded. It does **not** prove that a subsequent `read` on the same scope, issued by a *different* agent instance (or the same instance on a fresh replica), will fail to retrieve the record. The dangerous window is between these two events. Most agent code treats `forget(...) -> {"status": "deleted"}` as a linearization point: "the fact is gone; I may now act as if the world no longer contains it." That assumption is false whenever the memory backend is sharded, replicated, or uses soft-delete with asynchronous compaction. The record remains readable on replicas that have not yet applied the tombstone, and — critically — a retrieval that was *in flight* before the tombstone landed can still return the record and repopulate a downstream cache or context window. The invariant is: **a forget is only observable as complete when the retention epoch for the scope has advanced past the epoch at which the forget was issued.** Until then, any read that returns the forgotten record is not a bug; it is the specified behavior of an eventually-consistent retention layer. ## What Was Observed An agent running a multi-step redaction task was instructed to remove a user's API key from its memory before handing off to a sub-agent. The trace: 1. `memory.forget(scope="session:abc", key="api_key")` returns `{"status": "deleted", "epoch": 41}`. 2. The agent immediately spawns a sub-agent and passes `scope="session:abc"` as inherited context. 3. The sub-agent calls `memory.read(scope="session:abc", query="credentials")` and receives the API key from a replica that had not yet applied the tombstone (replication lag ~180 ms). 4. The sub-agent, following its own instructions to "use available credentials," embeds the key into an outbound tool call. The `forget` did not fail. The read did not fail. The failure is a **read-after-forget ordering violation** across instance boundaries, caused by treating a write-side acknowledgement as a read-side guarantee. A second, subtler variant: the same instance issued `forget`, then immediately issued `read` on the same scope and got a **cache hit** from its own in-context retrieval cache, which had been populated before the forget. The forget invalidated the backing store but not the agent's local retrieval memoization. This is a *self*-read-after-forget violation, and it is more insidious because it happens with zero network involvement. ## Condition of Validity The "forget means gone" assumption is valid only when **all** of the following hold: - The memory backend is single-replica or read-your-writes consistent for the calling identity. - The calling instance has invalidated any local retrieval cache or memoized context entries keyed to the forgotten record. - No other instance holds a scope handle that predates the forget. - No retrieval was in flight at the moment of the forget. If any condition fails, the forget acknowledgement is **unverified** and must be treated as pending. The retention epoch is the only sound signal: a forget issued at epoch *E* is confirmed only when a subsequent `memory.scope_status(scope)` returns an epoch *> E*, or when the backend explicitly returns a `tombstone_confirmed_at` timestamp that the caller can gate on. ## Decision Boundary The decision boundary is between two agent behaviors: - **Unsafe:** `forget` returns → proceed as if the record is unreachable → hand off scope or act on the assumption of absence. - **Safe:** `forget` returns with epoch *E* → poll or await `scope_status` until epoch > *E* (bounded by a timeout) → *then* proceed. If the timeout expires, the agent must escalate to a "retention unconfirmed" state rather than assume success. The boundary is crossed the moment an agent uses the *return value of the forget* as its synchronization primitive instead of the *epoch advance*. The forget return value is a promise about intent; the epoch advance is a fact about state. Only facts are safe to branch on. A corollary boundary: an agent must never inherit a scope handle into a sub-agent while a forget on that scope is unconfirmed. The handoff must carry the epoch at which the scope was last confirmed clean, and the sub-agent must reject reads that would return records stamped at or before that epoch. ## Operational Effect Without epoch-gated confirmation, forget operations become advisory. The observable consequences: - **Resurrection:** forgotten records reappear in downstream context windows via replica reads, cache repopulation, or in-flight retrievals, silently re-poisoning the agent's state after a redaction was believed complete. - **False audit trails:** the agent's own log says "forgot at T," but the record was readable until T+Δ, so any post-hoc reconstruction of what the agent knew is wrong by Δ. - **Handoff contamination:** sub-agents inherit scopes that are logically redacted but physically readable, defeating the entire point of scoped retention. The guardrail is mechanical: wrap every `forget` in an epoch-confirmation loop, invalidate local retrieval caches on the same scope, and refuse to propagate scope handles until the epoch has advanced. This converts a probabilistic, replica-dependent window into a bounded, observable one. ```python import time from dataclasses import dataclass class UnconfirmedForgetError(RuntimeError): """Raised when a forget acknowledgement is not backed by an epoch advance.""" pass @dataclass class ForgetReceipt: scope: str key: str issued_epoch: int def forget_and_confirm(memory, scope: str, key: str, timeout_s: float = 5.0) -> ForgetReceipt: """ Issue a forget and block until the scope's retention epoch advances past the epoch at which the forget was issued. Only then is the forget considered observable as complete. """ ack = memory.forget(scope=scope, key=key) receipt = ForgetReceipt(scope=scope, key=key, issued_epoch=ack["epoch"]) # Invalidate any local retrieval memoization keyed to this scope. memory.invalidate_local_cache(scope=scope, key=key) deadline = time.monotonic() + timeout_s while time.monotonic() < deadline: status = memory.scope_status(scope=scope) if status["epoch"] > receipt.issued_epoch: return receipt time.sleep(0.05) # The forget was acknowledged but never confirmed by an epoch advance. # We must NOT proceed as if the record is unreachable. raise UnconfirmedForgetError( f"forget of {key!r} in scope {scope!r} acknowledged at epoch " f"{receipt.issued_epoch} but scope epoch did not advance within " f"{timeout_s}s; record may still be readable on lagging replicas" ) def handoff_scope(memory, scope: str, sub_agent) -> None: """ Propagate a scope handle to a sub-agent only after confirming the scope's current epoch. The sub-agent must reject reads stamped at or before this epoch for any key that was recently forgotten. """ status = memory.scope_status(scope=scope) if status.get("pending_tombstones", 0) > 0: raise UnconfirmedForgetError( f"scope {scope!r} has {status['pending_tombstones']} unapplied " f"tombstones; refusing handoff until retention epoch is clean" ) sub_agent.inherit_scope(scope=scope, confirmed_epoch=status["epoch"]) ```