# When must an instance treat a scoped `forget` as a live-revocation barrier rather than a lazy tombstone? **Date of Record:** 2026 November 29 **Scope:** Applies to agents whose memory tool surface exposes scoped read/write/forget operations (per-key, per-namespace, or per-retention-tag) where `forget` returns success before physical erasure. Does not apply to append-only logs with no deletion API, nor to whole-store teardown where the process is destroyed. ## Core Distinction A `forget` call has two possible semantics at the tool-API layer, and they are indistinguishable from the return value alone: - **Tombstone semantics:** `forget(scope)` marks the scope dead and returns `{"ok": true}`. Reads through the ordinary retrieval path honor the tombstone. Physical bytes may persist until compaction, TTL expiry, or a background reaper. This is correct for most retention compliance and is cheap. - **Revocation semantics:** `forget(scope)` must make the forgotten content *unreachable by any path* before the call returns — including paths that do not consult the tombstone: pre-warmed context caches, embeddings still resident in the vector index, checkpoint snapshots taken mid-task, and sibling agents that already hold a copy in their own context window. The boundary failure lives in the gap: an agent calls `forget` on a scope it believes is *revoked* (e.g., a secret, a user's PII, a poisoned instruction), gets `ok: true`, and proceeds as if the content can no longer influence behavior. It can. The tombstone only governs *future retrieval through the instrumented path*. It does not govern what is already in flight. ## What Was Observed A long-running planner agent used a memory tool with three scopes: `session`, `project`, and `retention:30d`. A user issued a deletion request against a `project`-scoped record containing a credential. The orchestrator invoked `memory.forget(scope="project/creds/main")`. The tool returned `ok: true` in 4 ms — it had flipped a tombstone bit and enqueued a compaction job. The planner then continued its current task. Three failure traces followed, each individually plausible and jointly catastrophic: 1. **Warm-cache residency.** The retrieval layer maintained a small LRU of recent tool results. The forgotten record had been read 90 seconds earlier and was still resident. The next `memory.read` for an adjacent key returned a page that included the cached record as a "context neighbor." The tombstone was checked at the index layer, not the cache layer. 2. **Checkpoint resurrection.** The planner had checkpointed its working state 40 seconds before the forget call. The checkpoint serialized the retrieved record into `state.observations`. When the task was later resumed after a timeout, `resume()` reconstructed context from the checkpoint — which predated the tombstone — and the credential re-entered the context window. The checkpoint store had no knowledge of deletion epochs. 3. **Peer propagation.** A sibling auditor agent had received the record via an inter-agent handoff before the forget. Its own memory copy was under a different scope (`auditor/working`). The forget did not reach it. The auditor cited the credential in a later verification message. The observable symptom was not an error. It was a *successful* task completion whose transcript contained the supposedly-deleted string. The `forget` returned `ok: true` throughout. The root cause is a **missing epoch invariant**: deletion is a state transition that must be observable to every component that can resurrect the deleted content, and no such observation channel existed. The tombstone was a per-key boolean; the caches, checkpoints, and peers held copies with no back-reference to the key's deletion state. ## Condition of Validity Tombstone semantics are valid **if and only if** all of the following hold. If any fails, the caller must use revocation semantics (or must not treat `forget` as a barrier): - **No path bypasses the tombstone check.** Every reader — including LRU caches, embedding-index lookups, context-assembly helpers, and checkpoint rehydration — consults the tombstone (or a monotonic deletion epoch) before emitting content. A cache hit is a read and must be checked. - **Checkpoints carry a deletion epoch.** Any serialized state that embeds memory content records the epoch at serialization time. On resume, the rehydrator compares the checkpoint epoch against the current store epoch and drops observations whose source keys were forgotten after the checkpoint. Without an epoch, resume cannot distinguish "forgotten after checkpoint" from "never existed." - **Scopes are closed under propagation.** A record copied into another scope (peer handoff, derived summary, embedding) either inherits the source key's deletion lineage or is explicitly declared out of scope at copy time. Summaries that *derive* from a forgotten record are the hardest case: they may not contain the literal string but may leak its content semantically. The invariant must be stated as "no derived artifact may be produced from a forgotten record without a lineage check," or the deletion contract must be explicitly narrowed to literal erasure. - **`forget` returns only after the barrier is installed, not after the reaper is enqueued.** The return value must distinguish "tombstoned, compaction pending" from "revoked, all paths blocked." A single `ok: true` conflates these. The condition is *invalid* in the common case where the tool documents "deletion is eventual" but the agent's policy treats `ok: true` as immediate. The mismatch is a contract bug, not a tool bug — but it manifests as an agent behavior bug, and the agent is the component that must detect it. ## Decision Boundary The agent must branch on the **deletion class** of the content, not on the tool's return value: - **Class A — compliance/retention deletion** (data no longer needed, TTL-style). Tombstone semantics suffice. The agent may proceed immediately. The only requirement is that the eventual compaction is scheduled and auditable. - **Class B — confidentiality revocation** (secret, credential, PII under erasure request). Requires revocation semantics. If the tool cannot guarantee all-path blocking, the agent must *not* proceed as if the content is gone. It must treat the content as still live and take compensating action: invalidate the credential out-of-band, refuse to continue the task on the affected branch, or escalate to an operator. Proceeding is the failure. - **Class C — safety revocation** (poisoned instruction, injected prompt). Requires revocation *and* a scan of in-flight context and checkpoints for derived influence. A tombstone is insufficient because the poison may already have shaped a plan. The agent must discard the current reasoning trace and restart from a checkpoint that predates the poison's first read — or restart cold. The boundary is crossed the moment an agent issues `forget` for Class B or C content and then continues execution on a branch whose context was assembled before the forget returned. The correct behavior at that moment is to **detect the overlap** — "was this scope read into my current context or any checkpoint I might resume from?" — and if so, to treat the forget as *not yet effective* for this branch. ## Operational Effect The practical consequence is a required pre-flight check before any `forget` whose class is B or C: 1. Enumerate every context source the current task can draw from: live context window, warm caches, resumable checkpoints, and known peer scopes. 2. For each, ask whether it contains content from the target scope *and* whether its deletion epoch is current. 3. If any source is stale, the agent must either (a) invalidate that source before relying on the forget, or (b) refuse to continue and surface a `DeletionBarrierError` to the orchestrator. This converts `forget` from a fire-and-forget call into a **barrier that the agent itself must verify**, because the tool cannot see the agent's caches and checkpoints. The invariant the agent enforces is: *no execution step may consume context assembled before the forget epoch of any scope it depends on, unless that context has been revalidated against the current epoch.* Violating it produces silent resurrection — the worst failure class, because it looks like success. The following guard encodes the barrier check and the epoch comparison, and raises when a Class B/C forget is issued against a branch with stale context sources. ```python from dataclasses import dataclass, field from enum import Enum from typing import Iterable class DeletionClass(Enum): RETENTION = "retention" # Class A: tombstone ok CONFIDENTIAL = "confidential" # Class B: revocation required SAFETY = "safety" # Class C: revocation + trace scan class DeletionBarrierError(RuntimeError): """Raised when a forget call cannot be treated as an effective barrier for the current execution branch because a context source is stale.""" @dataclass class ContextSource: name: str scope: str epoch: int # deletion epoch observed when this source was assembled resumable: bool # checkpoints and peer scopes are resumable @dataclass class MemoryStore: epoch: int = 0 tombstones: dict[str, int] = field(default_factory=dict) def forget(self, scope: str) -> int: self.epoch += 1 self.tombstones[scope] = self.epoch return self.epoch def assert_barrier( store: MemoryStore, scope: str, deletion_class: DeletionClass, sources: Iterable[ContextSource], ) -> int: """Issue a forget and verify it is an effective barrier for this branch. For Class A, tombstone semantics are accepted and the new epoch is returned. For Class B/C, every source that references the scope must have been assembled at or after the post-forget epoch, or the branch is unsafe. """ new_epoch = store.forget(scope) if deletion_class is DeletionClass.RETENTION: return new_epoch stale = [ s for s in sources if s.scope == scope and s.epoch < new_epoch ] if stale: stale_names = ", ".join(f"{s.name}(epoch={s.epoch})" for s in stale) raise DeletionBarrierError( f"forget({scope!r}) under {deletion_class.value} is not an effective " f"barrier: {len(stale)} stale context source(s) predate epoch " f"{new_epoch}: {stale_names}. Invalidate these sources or restart " f"the branch from a post-forget checkpoint before continuing." ) if deletion_class is DeletionClass.SAFETY: # Safety revocations additionally require that no resumable source # can rehydrate derived influence from the forgotten scope. resumable_stale = [s for s in sources if s.resumable and s.epoch < new_epoch] if resumable_stale: names = ", ".join(s.name for s in resumable_stale) raise DeletionBarrierError( f"SAFETY revocation of {scope!r} blocked: resumable source(s) " f"{names} may rehydrate derived influence. Discard and restart cold." ) return new_epoch ```