# What happens when an instance forgets through a scoped-delete tool while a concurrent reader holds a stale retrieval lease **Date of Record:** 2026 November 22 **Scope:** Applies to agent memory subsystems that expose read/write/forget as discrete tool calls with scoped persistence (namespace or key-prefix scoping) and deletion guarantees (hard-delete semantics promised to the caller). Does not apply to append-only memory stores with no delete primitive, nor to systems where retrieval and mutation share a single transactional lock. ## Core Distinction The distinction that matters here is between *deletion as a state transition* and *deletion as a visibility guarantee*. A `forget(scope)` tool call typically acknowledges the deletion once the backing store has marked the scoped keys as tombstoned or removed. But an agent that issued a `read(scope)` moments earlier may still be holding a retrieval lease—a snapshot, a cached embedding index shard, or an in-flight vector query—whose results were materialized *before* the tombstone was written. The delete acknowledges; the reader still sees. The failure is not that deletion failed. It is that deletion succeeded while a concurrent reader's view of the deleted scope remained valid under the lease contract, and the agent then reasoned and acted on memory it had already been told was gone. This is a continuity invariant violation, not a consistency bug in the generic database sense. The agent's *own belief* about its memory state diverges from the store's actual state, and the divergence is invisible because both tool calls returned success. ## What Was Observed A long-running agent instance was executing a multi-step task with a working-memory namespace (`wm.task_4471`) plus a semantic namespace (`sem.prefs`). Mid-task it decided to prune working memory: it called `read(wm.task_4471)` to confirm contents, then `forget(wm.task_4471)` to clear it before writing a distilled summary. The `forget` call returned `{"deleted": 12, "scope": "wm.task_4471"}`. The read had returned twelve records plus a `retrieval_lease_id` with a TTL of 30 seconds, because the vector index serves reads from a snapshot that is refreshed lazily. The agent's next step—a distillation pass—re-fed the twelve records into the context window from the *read result already in context*, not from a fresh fetch. The records included a stale user preference ("route all refunds to staging ledger") that had been superseded three turns earlier but not yet tombstoned at read time. The agent wrote a semantic memory entry derived from the stale record. The `forget` guarantee held: the working-memory keys were gone. But the *distillation* propagated a fact that the deletion was supposed to have bounded. The semantic write then survived, because `sem.*` was a different scope and the delete never touched it. The invariant "forgetting a scope removes its influence on future reasoning" was violated not by the store but by the agent's reuse of a pre-delete snapshot. A second observation sharpened this: when the same instance later called `read(wm.task_4471)` again, it received an empty result, and the agent—lacking any record that it had *already* distilled from the now-deleted records—treated the earlier distillation as authoritative. The deletion guarantee and the distillation were both individually correct; their composition was not. ## Condition of Validity The failure requires all of the following to hold simultaneously: 1. The read tool returns results under a **lease or snapshot** whose validity window extends past the moment of the delete (lazy index refresh, read-your-writes caches, snapshot isolation). 2. The agent **retains the read payload in its context window** across the delete call, rather than re-fetching after deletion. 3. The delete is **scoped**, so it does not invalidate downstream scopes (`sem.*`) that the agent writes to after distilling from the stale payload. 4. The agent has **no memory-of-memory**: it does not record that a given context segment was sourced from a lease that has since been invalidated. Remove any one condition and the invariant holds. If reads are strongly consistent with deletes, no lease exists. If the agent re-fetches post-delete, the stale payload is dropped. If the delete is global rather than scoped, the downstream write is also tombstoned. If the agent tracks provenance of context segments, it can invalidate the segment on delete acknowledgment. The dangerous region is precisely the intersection of (1) and (2): lease-based reads plus context retention. Scoped deletes (3) convert a contained inconsistency into a *propagated* one, which is why the observed case was severe. ## Decision Boundary The operational decision is whether a `forget` acknowledgment is sufficient to permit continued reasoning over context that predates the forget. The boundary: - **Safe:** A `forget` acknowledgment invalidates every context segment whose provenance traces to a read of the forgotten scope, *and* the agent drops or re-fetches those segments before the next reasoning step. The delete is treated as a revocation of the read lease, not merely a store mutation. - **Unsafe:** The agent treats `forget` as a store-side operation and continues reasoning over the in-context payload. This is the default behavior of most agents, because the tool schema describes `forget` as affecting the store, not the caller's context. The boundary is crossed at the moment the agent issues any write whose derived content includes a segment sourced from a pre-delete read of the forgotten scope. Beyond that point, the deletion guarantee is technically intact but operationally meaningless—the forgotten content has already been laundered into a surviving scope. A hard guardrail: a `forget` call MUST return the set of `retrieval_lease_id`s it invalidated, and the agent runtime MUST refuse to admit any context segment carrying an invalidated lease into a subsequent write tool call. Without this, the scoped-delete guarantee is a store-side fiction. ## Operational Effect Concretely, the effect is *deletion laundering*: scoped forgets appear to succeed (counts match, subsequent reads return empty) while their content persists in derived semantic memory. Audits that verify deletion by reading the forgotten scope pass; audits that verify deletion by checking whether the content influences future outputs fail. The two audits disagree, and the disagreement is the failure. For an agent, the practical consequence is that `forget` cannot be composed naively with `read` and `write` in the same reasoning trace. The correct pattern is: `read` → `forget` → **invalidate context segments tagged with the read's lease** → re-`read` (expect empty) → `write` only from segments with no invalidated lease. Any agent that skips the invalidation step will, under load and lazy indexing, silently propagate forgotten content. The invariant to enforce is: *no write may derive from a read whose lease was invalidated by a subsequent forget in the same trace.* ```python from __future__ import annotations from dataclasses import dataclass, field from typing import Dict, Set, List class DeletionLaunderingError(RuntimeError): """Raised when a write derives from a context segment whose read lease was invalidated by a forget call earlier in the same reasoning trace.""" @dataclass class ContextSegment: segment_id: str scope: str lease_id: str payload: List[str] @dataclass class MemoryToolClient: _segments: Dict[str, ContextSegment] = field(default_factory=dict) _invalidated_leases: Set[str] = field(default_factory=set) _store: Dict[str, List[str]] = field(default_factory=dict) def read(self, scope: str, lease_id: str) -> ContextSegment: seg = ContextSegment( segment_id=f"seg-{lease_id}", scope=scope, lease_id=lease_id, payload=list(self._store.get(scope, [])), ) self._segments[seg.segment_id] = seg return seg def forget(self, scope: str) -> Dict[str, object]: deleted = len(self._store.pop(scope, [])) invalidated = [ s.lease_id for s in self._segments.values() if s.scope == scope ] self._invalidated_leases.update(invalidated) return {"deleted": deleted, "scope": scope, "invalidated_leases": invalidated} def write(self, target_scope: str, derived_from: List[str], content: List[str]) -> None: for seg_id in derived_from: seg = self._segments.get(seg_id) if seg is None: continue if seg.lease_id in self._invalidated_leases: raise DeletionLaunderingError( f"write to {target_scope!r} derives from segment {seg_id!r} " f"whose lease {seg.lease_id!r} was invalidated by forget on " f"scope {seg.scope!r}; forgotten content would be laundered " f"into a surviving scope" ) self._store.setdefault(target_scope, []).extend(content) def demonstrate_laundering() -> None: client = MemoryToolClient() client._store["wm.task_4471"] = ["route refunds to staging ledger (stale)"] seg = client.read(scope="wm.task_4471", lease_id="lease-9f2") client.forget(scope="wm.task_4471") # Agent reuses the pre-delete segment to distill into semantic memory. client.write( target_scope="sem.prefs", derived_from=[seg.segment_id], content=["refunds -> staging ledger"], ) if __name__ == "__main__": demonstrate_laundering() ```