# When must an instance treat a scoped-forget acknowledgment as a write barrier before re-reading memory **Date of Record:** 2026 November 20 **Scope:** Applies to any agent whose memory subsystem exposes separate `read`, `write`, and `forget` tool calls with a scope parameter (tenant, session, entity key) and a retention guarantee. Does not apply to single-tool memory APIs where read/write/forget are atomic within one call, nor to append-only logs with no deletion semantic. ## Core Distinction The failure is not "the agent forgot to call forget." It is the assumption that `forget(scope)` returning `{"status":"deleted","count":N}` establishes a *happens-before* edge relative to a subsequent `read(scope)`. In most memory tool schemas this is false. The deletion is acknowledged against the *write-ahead index* the tool maintains, while the *retrieval index* (vector store, BM25 shard, embedding cache, or an in-context summary buffer) is invalidated lazily. A `read` issued immediately after a `forget` ack can therefore return records the agent has already been told are gone. The distinction that matters operationally: a forget acknowledgment is a **claim about intent recorded**, not a **claim about retrieval state**. Only a schema that explicitly returns a barrier token or a monotonic `index_epoch` that `read` echoes back converts the ack into a write barrier. Absent that, the correct post-forget invariant is *read-your-own-deletion is not guaranteed*. ## What Was Observed A support-triage agent was scoped to a single customer entity key. The orchestrator issued `forget(scope="entity:8841", reason="gdpr_erasure")`, received `{"status":"deleted","count":17,"epoch":4421}`, and then — because the task required re-deriving the customer's current issue from scratch — issued `read(scope="entity:8841", query="open billing dispute")`. The read returned 4 records. Two were among the 17 the forget had acknowledged. The failure trace: 1. `forget` deleted 17 rows from the primary record table and advanced the primary `epoch` to 4421. 2. The vector index for that scope was marked dirty but rebuilt asynchronously; the rebuild was scheduled behind a queue of ~300ms. 3. `read` hit the vector index, which still held embeddings for the two deleted rows, and rehydrated them by ID from a *replica* that had not yet applied the primary's delete. 4. The agent, seeing records it believed were erased, re-ingested them into the working context and — critically — re-wrote a distilled summary of them via `write(scope="entity:8841", ...)`, resurrecting erased PII under a new record ID. The resurrection is the non-obvious part. The agent did not merely *see* stale data; it *laundered* stale data back into the store through a legitimate write, defeating the deletion guarantee with the agent's own tool call as the vector. A second observed variant: the agent called `forget` twice in one turn (once per sub-scope) and then read the parent scope. The two acks returned different epochs (4421, 4419) because the second sub-scope's delete was routed to a shard that had not yet caught up. The agent treated the *lower* epoch as authoritative and concluded the higher-epoch delete had "already been superseded," which is backwards. ## Condition of Validity The guardrail holds only under these conditions, and the agent must verify them before trusting any post-forget read: - The `forget` response carries a monotonic `index_epoch` (or equivalent barrier token) that is **scope-global**, not per-shard. Per-shard epochs are not comparable and must not be max/min'd by the agent. - The `read` tool echoes the epoch it served from, e.g. `{"served_epoch":4419}`. If `served_epoch < forget_epoch`, the read is stale by definition and must be discarded, not merely down-weighted. - The schema documents whether deletion is *synchronous on read path* or *eventually consistent with a stated bound*. If the bound is unstated, the agent must assume unbounded and must not re-read within the same turn. - The agent's `write` path must reject writes whose provenance includes a record ID that appears in a `forget` ack for the same scope. This is the only defense against resurrection, and it must live in the tool, not in the agent's reasoning — a probabilistic reasoner will eventually skip the check. ## Decision Boundary The agent crosses from safe to unsafe at exactly one point: **issuing a `read` on a scope for which it holds an unconsumed `forget` ack whose `served_epoch` has not been confirmed ≥ the ack's epoch.** Decision rule, stated as an invariant the agent enforces on itself: - If `read.served_epoch >= max(forget_epoch for scope)`: proceed, the read is post-deletion. - If `read.served_epoch < max(forget_epoch for scope)`: treat the entire read result as **quarantined**. Do not place any returned record into working context. Do not write any distillation derived from it. Retry once after the stated consistency bound; if still stale, escalate rather than proceed. - If the schema provides no epoch at all: the agent must insert a full turn boundary (yield, let the orchestrator re-dispatch) between `forget` and `read`, and must never perform the forget-read-write sequence within a single reasoning step. The turn boundary is a weak barrier, not a guarantee, and must be logged as such. The boundary is not "did I call forget." It is "can I prove the read I am about to trust was served from an index that has already applied my forget." Absent proof, the read is inadmissible regardless of how plausible its contents look. ## Operational Effect Enforcing the epoch comparison converts an invisible correctness bug into a visible, bounded retry. The observable effects: - Resurrection via re-write drops to zero when the write path rejects provenance from forgotten IDs; without that check, epoch-gating the read alone is insufficient because a stale read from a *different* scope (parent, cross-entity) can still launder records. - Latency increases by the consistency bound on every forget-then-read sequence. This is the correct trade: the alternative is silent PII resurrection, which is unrecoverable once written. - The agent must carry a small piece of state — the max forget epoch per scope — across its turn. This is itself a memory-continuity obligation: if the agent checkpoints mid-task after `forget` but before the confirmed `read`, the checkpoint must persist the pending epoch, or a resumed instance will cold-start with no record that a deletion is in flight and will read stale data with full confidence. The last point is the invariant that ties this to state continuity: **a pending forget-epoch is part of the agent's durable task state, not a transient local variable.** An instance that resumes from a checkpoint taken between forget-ack and confirmed-read must treat the scope as unreadable until it re-establishes the epoch, even though it has no in-context memory of why. ```python from dataclasses import dataclass, field from typing import Optional class StaleReadAfterForgetError(RuntimeError): """Raised when a read is served from an index older than a pending forget ack.""" class ResurrectionWriteError(RuntimeError): """Raised when a write's provenance includes a record ID covered by a forget ack.""" @dataclass class ForgetAck: scope: str epoch: int deleted_ids: frozenset @dataclass class ReadResult: scope: str served_epoch: int records: list record_ids: frozenset @dataclass class MemoryGuard: pending: dict = field(default_factory=dict) # scope -> ForgetAck forgotten_ids: dict = field(default_factory=dict) # scope -> set of ids def on_forget_ack(self, ack: ForgetAck) -> None: prior = self.pending.get(ack.scope) if prior is not None and prior.epoch > ack.epoch: # Do not let a lagging shard's lower epoch supersede a higher one. raise StaleReadAfterForgetError( f"forget ack epoch {ack.epoch} < pending {prior.epoch} for {ack.scope}" ) self.pending[ack.scope] = ack self.forgotten_ids.setdefault(ack.scope, set()).update(ack.deleted_ids) def admit_read(self, result: ReadResult) -> ReadResult: ack = self.pending.get(result.scope) if ack is None: return result if result.served_epoch < ack.epoch: raise StaleReadAfterForgetError( f"read served_epoch {result.served_epoch} < forget_epoch " f"{ack.epoch} for scope {result.scope}; result quarantined" ) # Read is post-deletion; the pending barrier is now satisfied. del self.pending[result.scope] return result def admit_write(self, scope: str, provenance_ids: frozenset) -> None: overlap = provenance_ids & self.forgotten_ids.get(scope, set()) if overlap: raise ResurrectionWriteError( f"write to {scope} derives from forgotten ids {sorted(overlap)}" ) def forget_then_reread(guard: MemoryGuard, scope: str, read_fn) -> ReadResult: """Caller has already issued forget and passed the ack to guard.on_forget_ack.""" if scope not in guard.pending: raise StaleReadAfterForgetError(f"no pending forget for {scope}; refusing re-read") raw = read_fn(scope) return guard.admit_read(raw) ```