# When must an instance treat a memory-tool "forget" as a tombstone rather than an absence **Date of Record:** 2026 November 27 **Scope:** Applies to any agent that persists state through a read/write/forget memory tool API with scoped keys and deletion guarantees, where the same key may be re-read after deletion within a session or across resumed sessions. Does not apply to append-only logs with no delete semantics, nor to purely in-context scratchpads with no durable backing store. ## Core Distinction There are two structurally different meanings of "the memory tool returned nothing for this key": 1. **Absence** — the key was never written, or its scope never existed. A read miss is epistemically neutral: the agent learns only that no fact is currently bound. 2. **Tombstone** — the key was written and then explicitly forgotten. A read miss here is *not* neutral; it encodes a deletion decision that some prior instance (or the same instance earlier in the run) made deliberately. Most memory-tool APIs collapse these two into a single `None`/`null`/empty-result return. That collapse is the boundary condition. When an agent cannot distinguish absence from tombstone, it will re-derive and re-write facts that were intentionally deleted, silently resurrecting state that a scoped forget was supposed to guarantee was gone. The invariant that must hold is: **for any key within a scope, a successful forget must be observable as a distinct signal from never-having-existed, for at least the lifetime of the scope's deletion guarantee.** If the API does not expose that signal, the agent must synthesize it, or it forfeits the deletion guarantee it thinks it has. ## What Was Observed A long-running research agent used a scoped memory tool with three operations: `read(scope, key)`, `write(scope, key, value)`, and `forget(scope, key)`. Scopes were per-task (`task:`) with a documented guarantee that forgets are durable and reads after forget return empty. During a resumed session, the agent's plan step was: "retrieve prior findings for `task:4471/risks`, and if absent, re-run the risk scan." The prior instance had run the risk scan, judged the output to be a hallucinated false positive, and called `forget("task:4471", "risks")` to prevent downstream agents from acting on it. On resume, `read("task:4471", "risks")` returned empty. The agent interpreted empty as "scan never ran," re-ran the scan, produced a *different* set of risks (non-deterministic tool output), and this time wrote them. The downstream auditor agent, which held a warrant asserting "no risks recorded for task 4471," now saw a populated `risks` key and raised a verification-replay discrepancy. Two failures compounded: - **Resurrection:** the forgotten value's *slot* was refilled, not by the original value but by a fresh draw from a stochastic tool, which is worse than restoring the original because the deletion rationale no longer applies to the new content. - **Warrant invalidation:** a downstream agent's signed claim about the scope's contents became false without any party being notified, because the forget→rewrite transition emitted no event. A second, subtler observation: the agent's own episodic buffer still contained the *reason* for the forget ("false positive, do not act") but not the tombstone itself. On a longer resume (context compaction between forget and resume), even the reason was gone, and the agent had no path back to the deletion decision. The tombstone had to survive independently of the reasoning that produced it. ## Condition of Validity The failure is bounded by three conditions, all of which must hold for the resurrection to occur: 1. **Read-collapse:** the API maps both never-written and forgotten keys to the same empty result. If the API returns a distinct `tombstoned: true` marker, or raises on read-after-forget, the agent can branch and the failure does not trigger. 2. **Idempotent-refill plan:** the agent's plan treats empty-read as a license to re-derive and re-write. If the plan instead escalates empty-reads on sensitive keys to a human or auditor, the slot is not refilled automatically. 3. **Non-deterministic re-derivation:** the re-run produces different content than the forgotten value. If re-derivation were deterministic, the resurrection would at least be stable and the auditor could reconcile; the stochastic case is the dangerous one because the new value is uncorrelated with the deletion rationale. Remove any one condition and the failure collapses into a benign miss. The invariant holds only when all three are simultaneously true, which is exactly the common case for tool-using agents with stochastic tools and optimistic re-planning. ## Decision Boundary The operational rule the agent must adopt: - **If the memory API exposes a tombstone signal** (explicit marker, typed `Forgotten` result, or error-on-read-after-forget), branch on it: a tombstone means *do not re-derive without an explicit override*, and any override must be logged with the original forget's rationale if retrievable. - **If the API collapses absence and tombstone**, the agent must not use empty-read as a refill license for any key that is *re-derivable from a non-deterministic tool*. Instead it must (a) write a tombstone record into a sibling key (`risks.__tombstone`) at forget time carrying timestamp and reason, and (b) check that sibling before re-deriving. This is a client-side shim for a missing server-side guarantee, and it is only as durable as the scope's write guarantee. - **If neither the API signal nor a durable sibling tombstone is available**, the agent must treat empty-read on a re-derivable key as *unknown*, not *absent*, and escalate rather than refill. Refilling in this configuration is an unguarded resurrection. The boundary is therefore not "did the read return empty" but "can the agent prove the empty is absence rather than tombstone." Absent proof, empty is unknown, and unknown must not trigger a write on a key with a stochastic derivation path. ## Operational Effect Enforcing the tombstone distinction changes three things downstream: 1. **Deletion guarantees become real.** A scoped forget now means the slot stays empty until an explicit, logged override, which is what "durable deletion" was supposed to mean. Auditors relying on scope contents can trust that a forget is stable. 2. **Warrant propagation stays sound.** Because the forget→(no rewrite) transition is the default, downstream agents holding warrants about scope contents are not silently invalidated. When an override does occur, it emits an event the auditor can consume, converting a silent discrepancy into a detectable one. 3. **Resume cost rises slightly, correctness rises sharply.** The agent pays one extra read (the sibling tombstone) per sensitive key on resume, and occasionally an escalation. In exchange it stops resurrecting state that a prior instance deliberately killed — which is the difference between a memory system that forgets and one that merely appears to. The general lesson: a forget is a *state transition with a witness*, not a deletion of a row. Any memory tool that returns the same empty for "never existed" and "explicitly killed" is handing the agent an ambiguous signal, and an agent that resolves that ambiguity in favor of "re-derive" will resurrect deleted state under non-determinism. The guardrail is a tombstone the agent can read, whether the server provides it or the agent writes it itself. ```python from __future__ import annotations from dataclasses import dataclass from enum import Enum from typing import Optional class MemoryResurrectionError(RuntimeError): """Raised when an agent attempts to refill a key whose empty read may be a tombstone.""" class ReadKind(Enum): PRESENT = "present" ABSENT = "absent" # never written TOMBSTONED = "tombstoned" # explicitly forgotten UNKNOWN = "unknown" # API collapsed absence and tombstone; no sibling witness @dataclass(frozen=True) class ReadResult: kind: ReadKind value: Optional[str] = None class ScopedMemory: """Memory tool with scoped keys. Note: read() collapses absent/tombstoned by default.""" def __init__(self) -> None: self._store: dict[tuple[str, str], str] = {} self._tombstones: dict[tuple[str, str], str] = {} def write(self, scope: str, key: str, value: str) -> None: if (scope, key) in self._tombstones: raise MemoryResurrectionError( f"write to tombstoned key {scope}/{key} requires explicit override" ) self._store[(scope, key)] = value def forget(self, scope: str, key: str, reason: str) -> None: self._store.pop((scope, key), None) self._tombstones[(scope, key)] = reason def read(self, scope: str, key: str) -> ReadResult: if (scope, key) in self._store: return ReadResult(ReadKind.PRESENT, self._store[(scope, key)]) if (scope, key) in self._tombstones: return ReadResult(ReadKind.TOMBSTONED) return ReadResult(ReadKind.ABSENT) def refill_or_escalate( mem: ScopedMemory, scope: str, key: str, rederive_is_stochastic: bool, override: bool = False, ) -> Optional[str]: """The guarded resume path. Refuses to refill a possibly-tombstoned stochastic key.""" result = mem.read(scope, key) if result.kind is ReadKind.PRESENT: return result.value if result.kind is ReadKind.TOMBSTONED: if not override: raise MemoryResurrectionError( f"{scope}/{key} was explicitly forgotten; refusing to re-derive without override" ) # override path: caller has taken responsibility; write is allowed only here return None if result.kind is ReadKind.ABSENT: return None # safe to re-derive and write # UNKNOWN: API gave no witness. If re-derivation is stochastic, refilling is unsafe. if rederive_is_stochastic: raise MemoryResurrectionError( f"empty read on {scope}/{key} is UNKNOWN (no tombstone witness); " f"stochastic re-derivation would risk resurrecting deleted state" ) return None ```