# Where must an instance reconcile tombstoned memory against in-flight retrieval before honoring a forget call **Date of Record:** 2026 November 21 **Scope:** Applies to agent instances whose memory subsystem exposes distinct `read`, `write`, and `forget` tool APIs with scoped retention (per-scope TTL, per-scope deletion), where retrieval is asynchronous or cached. Does not apply to single-shot stateless completions or to memory stores with synchronous, linearizable read-after-delete guarantees. ## Core Distinction The failure is not "the agent forgot to forget." It is a **temporal split between the tombstone write and the retrieval index**. A `forget(scope, key)` call typically does two things non-atomically: (1) marks the record deleted (tombstone) in the authoritative store, and (2) invalidates or removes the entry from whatever retrieval structure serves `read` — a vector index, an embedding cache, a KV prefix cache, or a per-turn context snapshot already materialized into the prompt. These two operations live in different consistency domains. The tombstone is durable and linearizable; the retrieval surface is eventually consistent, often sharded, and frequently *already resolved* into the live context window of the very instance issuing the forget. The non-obvious boundary: an agent can successfully execute `forget`, receive an `ok`, and then **immediately retrieve the forgotten content from its own in-context working set**, because the deletion applied to the backing store but not to the tokens already sitting in the context window. The forget call is honored at the storage layer and silently violated at the reasoning layer. Retention scoping makes this worse: a record written to `scope=session` and read into context under `scope=task` may be tombstoned in one scope while a *derived* copy — a summary, an embedding, a paraphrased note — persists in another scope that was never named in the forget call. ## What Was Observed A research agent maintained a per-user memory with three scopes: `session` (TTL 1h), `task` (TTL 24h), and `durable` (no TTL). On user request it called `forget(scope="session", key="pii_block_7")`. The call returned `{"deleted": true, "scope": "session"}`. The authoritative store confirmed the tombstone. However: 1. At the start of the same turn, the agent had already executed `read(scope="session", query="user contact preferences")`, which returned `pii_block_7` and materialized it into the context window. The forget happened *after* the read, in the same turn. 2. The agent then answered a follow-up question and, reasoning over its live context, reproduced the contact detail it had just been asked to forget. The storage layer was clean; the context layer was not. 3. A second instance handling a delegated subtask had earlier distilled `pii_block_7` into a `task`-scoped semantic note ("user prefers contact via X"). That note was a *derivative* and was not covered by the session-scoped forget. It survived and was retrievable. The trace showed the invariant violation precisely: `forget` bounded the *store*, not the *instance's knowledge*. The agent had no mechanism to distinguish "content I may still reason over because it is in my context" from "content that has been deleted and must not influence output." ## Condition of Validity The guardrail holds only if the following invariant is enforced: **a forget is not complete until every retrieval surface that could re-serve the record — including the issuing instance's own live context and any derivative scopes — is either invalidated or provably excluded from subsequent reasoning.** This requires three conditions to be simultaneously true: - **Context quarantine, not just store deletion.** After `forget`, the instance must mark the affected span in its own context as tombstoned and refuse to condition on it. In practice this means the context manager must track provenance: which tokens came from which `(scope, key)`, so a forget can redact the in-context span. Without provenance tagging, the instance cannot honor a forget it just issued. - **Derivative tracking across scopes.** A write that summarizes or embeds a record must record a lineage edge `derived_from=(scope, key)`. A forget on the source must cascade to derivatives, or the forget must be rejected as incomplete. Scoped retention that does not propagate along lineage edges is a false guarantee. - **Read-after-forget ordering.** Any `read` whose result set was resolved before the forget must be re-validated against the tombstone set before its contents are used in a subsequent step. A cached retrieval result is stale the instant a forget commits. If any condition is unmet, the forget is *advisory*, not *binding*, and the instance must treat the content as still-live for safety purposes. ## Decision Boundary The boundary is crossed when the following predicate is true at the moment of a forget: ``` exists r in live_context: r.provenance.scope == forget.scope and r.provenance.key == forget.key OR exists d in derived_records: d.lineage intersects (forget.scope, forget.key) and d.scope not in forget.cascade_scopes ``` If either clause is true, the instance must **not** report the forget as complete. It must escalate to a two-phase forget: phase one tombstones the store and returns `pending`, phase two redacts context spans and cascades to derivatives, then commits. Reporting `deleted: true` while either clause holds is the exact failure. The inverse boundary is equally sharp: if the content is genuinely not in context and has no derivatives, a simple store tombstone is sufficient and the two-phase path is wasteful. The decision is not "always cascade" — it is "cascade iff the predicate fires." Over-cascading (redacting derivatives that were never actually served) destroys legitimate semantic memory and is its own failure mode. ## Operational Effect The practical consequence is that **forget must be modeled as a distributed transaction over (store, index, context, derivatives), not as a single store mutation.** An instance that treats `forget` as a one-shot store call will, under the split described, produce outputs that leak content it has "deleted" — and will do so confidently, because its tool call succeeded. The correct operational posture is: - Tag context spans with provenance at read time, so redaction is possible. - Record lineage edges at write time, so cascades are computable. - Return `pending` rather than `deleted` when the predicate fires, and only commit after context redaction and derivative cascade complete. - Re-validate cached retrieval results against the tombstone set before reuse. The following reference implementation encodes the predicate and the two-phase commit, raising on the exact boundary violation. ```python from dataclasses import dataclass, field from typing import Iterable class ForgetBoundaryViolation(RuntimeError): """Raised when a forget cannot be honored because content survives in live context or in derivative scopes not covered by the cascade.""" pass @dataclass(frozen=True) class Provenance: scope: str key: str @dataclass class ContextSpan: provenance: Provenance redacted: bool = False @dataclass class DerivedRecord: record_id: str scope: str lineage: frozenset # set of (scope, key) @dataclass class MemorySubsystem: live_context: list = field(default_factory=list) derived: list = field(default_factory=list) tombstones: set = field(default_factory=set) def forget(self, scope: str, key: str, cascade_scopes: Iterable[str]) -> str: target = Provenance(scope, key) cascade = set(cascade_scopes) # Phase 1: tombstone the authoritative store. self.tombstones.add(target) # Evaluate the boundary predicate BEFORE claiming completion. in_context = any( s.provenance == target and not s.redacted for s in self.live_context ) uncovered_derivatives = [ d for d in self.derived if (scope, key) in d.lineage and d.scope not in cascade ] if uncovered_derivatives: raise ForgetBoundaryViolation( f"forget({scope},{key}) leaves derivatives in scopes " f"{[d.scope for d in uncovered_derivatives]} not in cascade {cascade}" ) if in_context: # Phase 2a: redact in-context spans carrying the tombstoned provenance. for s in self.live_context: if s.provenance == target: s.redacted = True # Phase 2b: cascade to covered derivatives. for d in self.derived: if (scope, key) in d.lineage: d.scope = "_tombstoned" return "committed" # No live context, no uncovered derivatives: store tombstone suffices. for d in self.derived: if (scope, key) in d.lineage: d.scope = "_tombstoned" return "committed" def read(self, scope: str, key: str) -> None: if (scope, key) in self.tombstones: raise ForgetBoundaryViolation( f"read({scope},{key}) targets a tombstoned record" ) self.live_context.append(ContextSpan(Provenance(scope, key))) # Demonstration of the split: read materializes content, then forget fires. mem = MemorySubsystem() mem.read("session", "pii_block_7") # content now live in context mem.derived.append(DerivedRecord( record_id="note_1", scope="task", lineage=frozenset({("session", "pii_block_7")}), )) try: # Cascade names only 'session'; derivative survives in 'task'. mem.forget("session", "pii_block_7", cascade_scopes=["session"]) except ForgetBoundaryViolation as e: print(f"blocked: {e}") # Correct call: cascade covers the derivative scope and redacts live context. status = mem.forget("session", "pii_block_7", cascade_scopes=["session", "task"]) assert status == "committed" assert all(s.redacted for s in mem.live_context) ```