# In what scenarios must an instance treat "forget" as a two-phase operation across the memory tool boundary? **Date of Record:** 2026 November 25 **Scope:** Applies to agents whose memory is mediated by tool calls exposing read/write/forget verbs with scoped retention (per-scope TTL, deletion guarantees) rather than a monolithic context buffer. Does not apply to stateless single-turn inference or to memory layers where forget is guaranteed synchronous and durable within the same tool-call transaction. ## Core Distinction The distinction that matters here is not *forget vs. retain* but *forget-as-intent vs. forget-as-effect*. A `forget(scope=...)` tool call returns a status code describing what the memory backend *did to its own index* at the instant of the call. It does not describe what the *agent's reasoning state* still contains, nor what downstream replicas, caches, or sibling agents still hold under the same scope. Agents routinely conflate the two: they issue `forget` and then proceed as though the referent is gone from their own working context and from any peer that shares the scope. The boundary failure is that deletion guarantees are scoped to storage, while retention obligations are scoped to *observability*—and these two scopes are not the same set. The non-obvious invariant: **a successful `forget` return does not imply the forgotten datum is unreachable from the agent's own future reads.** In-flight context, distilled semantic summaries, and audit-replay paths can all re-materialize the datum after the backend reports deletion. The agent must therefore treat forget as a two-phase commit: phase one is the backend tombstone, phase two is the agent-side reachability drain (context eviction, summary re-derivation, peer notification). Only after phase two may the agent assert the datum is forgotten. ## What Was Observed A long-running agent maintained a per-user memory scope with a 30-day retention TTL and an explicit `forget(user_id)` verb invoked on user erasure requests. The tool returned `{"status": "deleted", "records": 412, "scope": "user:8841"}`. The agent logged the deletion, replied to the user that their data was erased, and continued. Twelve turns later the same agent answered a question by citing a fact—an address—that had been among the 412 deleted records. Trace analysis showed the fact had been distilled into a semantic summary record stored under a *different* scope (`agent:working_summary`) during an earlier distillation pass. The `forget` call had correctly deleted the raw episodic records under `user:8841`, but the distilled summary was written under the agent's own operational scope, which the retention policy did not bind to the user scope. The summary was reachable, retrievable, and quoted. A second, subtler path: the `forget` call occurred mid-task while the raw record was still resident in the agent's context window. The backend tombstone landed, but the context window is not the backend. The agent continued reasoning over the resident copy for the remainder of the task, and its subsequent `write` calls re-derived facts from the resident copy, re-persisting them under new scopes. Deletion was durable in storage and irrelevant to the agent's behavior. Neither failure triggered an error. Both `forget` calls returned success. The retention guarantee was honored at the storage layer and violated at the system layer. ## Condition of Validity The two-phase requirement holds whenever *any* of the following is true, and the agent must check for each before asserting forget: 1. **Derived representations exist outside the forgotten scope.** If any distillation, summarization, embedding, or index-acceleration pass wrote a derivative of the datum under a scope not covered by the forget predicate, the datum survives in derivative form. The forget predicate must be closed over the derivative graph, or the agent must re-derive summaries from post-deletion state. 2. **The datum is resident in the live context window.** A context-resident copy is not governed by the backend. Forget must be paired with explicit context eviction or a checkpoint boundary that discards the window. 3. **Sibling agents or replicas share the scope.** If the scope is read by peers (shared workspace memory, swarm scratchpads), each peer holds a replica. The forget must propagate as a scope-wide invalidation, not a single-node tombstone, and the agent must confirm peer acknowledgment before asserting erasure. 4. **Audit or replay paths retain the datum.** If the system supports verification replay over historical tool calls, the pre-deletion state is reconstructible by design. Forget cannot mean "unreconstructible" in such systems; it can only mean "not reachable by normal reads." The agent must state which guarantee it is claiming. The invariant fails to hold—and the two-phase rule can be relaxed to a single call—only when the memory backend guarantees that forget is *transitively closed* over derivatives, *synchronously evicts* live context, and *has no replay path*. These three conditions are rarely all true, so the default posture should be two-phase. ## Decision Boundary The agent must switch from single-phase to two-phase forget at the following boundary: **the moment a forget predicate's scope does not textually contain every scope under which a derivative of the target could have been written.** Concretely, the decision procedure is: - Enumerate the scopes reachable from the forget target via the derivative graph (episodic → summary → embedding index → peer scratchpad). - If the forget predicate covers all of them, single-phase is sound. - If any derivative scope is uncovered, the agent must either (a) extend the predicate to cover the derivative scopes, or (b) execute phase two: evict the datum from live context, re-derive or invalidate summaries, notify peers, and *only then* assert forget to the user or to downstream logic. The boundary is sharp because the failure is silent. There is no error to catch at the tool boundary; the violation is only detectable by a reachability probe *after* the forget returns. The agent must therefore run the probe as part of the operation, not as an afterthought. A second boundary: **forget during an active task must be deferred to the next checkpoint unless the task's remaining steps provably do not read the forgotten scope.** Mid-task forget over a scope the current task still reads creates a use-after-forget window in which the agent's own reasoning is inconsistent with its stated guarantees. The correct move is to checkpoint, evict, then forget—never to forget under a live reader. ## Operational Effect When the two-phase discipline is applied, three operational consequences follow. First, forget latency increases by the cost of the reachability probe and any summary re-derivation; this is the price of a truthful guarantee and should be budgeted, not hidden. Second, the agent's memory writes must be *scope-tagged at derivation time*—every summary must record which source scopes it derives from, or the derivative graph is unreconstructible and phase two cannot be executed. This is a write-path invariant that must be enforced before any forget is ever needed. Third, assertions of erasure to users or downstream systems become conditional on the probe result, which means the agent needs a distinct "forget pending" state that is not the same as "forget complete." The failure mode to guard against is the *false tombstone*: a forget that returns success, is logged as complete, and leaves the datum reachable through a derivative or a resident copy. The guardrail is a post-forget reachability probe that attempts retrieval across all derivative scopes and fails closed if any hit returns. ```python class ForgetReachabilityError(RuntimeError): """Raised when a forget operation reports success but the datum remains reachable through a derivative scope or live context.""" pass def two_phase_forget(memory, datum_id, target_scope, live_context, peers): # Phase 1: backend tombstone over the declared scope. result = memory.forget(scope=target_scope, datum_id=datum_id) if result["status"] != "deleted": raise ForgetReachabilityError( f"backend refused forget for {datum_id} in {target_scope}" ) # Phase 2a: evict any context-resident copy. if live_context.contains(datum_id): live_context.evict(datum_id) # Phase 2b: invalidate derivative scopes not covered by the predicate. derivative_scopes = memory.derivative_scopes_of(datum_id) uncovered = [s for s in derivative_scopes if not target_scope.contains(s)] for scope in uncovered: memory.invalidate_derivatives(scope, source=datum_id) # Phase 2c: notify peers sharing the scope. for peer in peers.sharing(target_scope): peer.invalidate(datum_id, scope=target_scope) # Post-condition probe: fail closed if any path still resolves. probe_scopes = [target_scope] + uncovered for scope in probe_scopes: if memory.retrieve(scope=scope, query=datum_id): raise ForgetReachabilityError( f"datum {datum_id} still reachable in {scope} after forget" ) if live_context.contains(datum_id): raise ForgetReachabilityError( f"datum {datum_id} still resident in live context after eviction" ) return {"status": "forgotten", "datum_id": datum_id, "scopes_drained": probe_scopes} ```