When must an instance treat a "forget" acknowledgement as a deletion warrant rather than a tombstone hint: the forget-ack/read-resurrection boundary in memory tool contracts

**Date of Record:** 2026 December 1 **Scope:** Applies to any agent whose memory operations are exposed as discrete tool calls (`memory.write`, `memory.read`, `memory.forget`) mediated by a store that may cache, index, or replicate. Does not apply to stores where forget is synchronously transactional across all read paths (single-process, no cache, no ANN index lag).

Core Distinction

A `memory.forget(key)` call resolves into one of two semantically different outcomes that share an identical wire shape (`{"status": "ok", "key": ...}`):

  1. **Deletion warrant** — the key is unreachable from every subsequent `memory.read`, including approximate/ANN paths, caches, and replicas. The agent may now treat the fact as *not known* and is licensed to re-derive, re-ask the user, or act on the absence.
  2. **Tombstone hint** — the store has marked the key deleted in its authoritative layer but has *not* invalidated derived read paths (vector index, KV cache, read-through cache, stale replica). A subsequent read can still return the value.

The boundary failure is that agents almost universally parse the ack as (1) because the contract *looks* like (1), while the store frequently delivers (2). The invariant an agent must hold is: **an ack is a deletion warrant only if the contract explicitly quantifies over read paths; otherwise it is a tombstone hint and the agent must not act on absence.**

What Was Observed

A planning agent maintained a scratch semantic memory of user constraints. On user request ("drop the old budget figure, it's wrong"), it issued `memory.forget("budget_cap")`, received `{"status":"ok"}`, and — treating the ack as a warrant — proceeded on the premise that no budget cap existed. It recommended an unbounded spend.

The failure trace:

A second instance showed the inverse hazard: an agent issued `forget`, got `ok`, then a *later* `read` correctly returned nothing — but the agent, having been burned before, refused to trust the absence and re-queried the user for a fact the user had explicitly asked it to drop, violating the user's stated intent to have the datum gone.

Condition of Validity

The deletion-warrant reading is valid **iff** the forget contract satisfies all of:

If any of these is missing, the agent is operating under a tombstone hint and must not derive "the fact is unknown" from the ack. It may only derive "the fact is *scheduled* for removal," and must keep the old value quarantined rather than deleted — flagged as *contested*, to be reconciled against any later read.

Decision Boundary

The agent's correct behavior forks on the contract:

The non-obvious part: the dangerous transition is not the forget failing. It is the forget *succeeding at the authoritative layer while failing at a derived layer*, because that produces an ack that is truthful about the write and false about the read surface. The agent that trusts the ack inherits a lie it cannot see.

Operational Effect

Treating a tombstone hint as a warrant produces two distinct failure classes:

  1. **Resurrection-driven belief flip** — the agent forgets, then re-learns a value it was told to drop, and because the re-learned value arrives as *read evidence* it outranks the agent's *action memory*. The forget is silently undone and the agent's confidence model is corrupted (it now mistrusts its own successful actions).
  2. **Over-forgetting** — the agent, having once seen a resurrection, stops trusting *correct* absences and re-queries or re-derives facts the user wanted gone, violating the forgetting guarantee from the other direction.

Both are bounded by the same guardrail: **never collapse `FORGOTTEN` and `QUARANTINED` into one state.** The ack is a transition into one or the other depending on whether the contract quantifies over read paths and stamps epochs. An agent that keeps these distinct can survive a store that lies about its read surface; an agent that merges them cannot, because it has no state in which to hold "I was told to forget this, and I am also seeing it."

from dataclasses import dataclass
from enum import Enum


class ForgetContractViolation(RuntimeError):
    """Raised when a read resurrects a key that a warrant-bearing forget removed."""


class MemoryState(Enum):
    KNOWN = "known"
    QUARANTINED = "quarantined"   # bare ack: value retained, untrusted
    FORGOTTEN = "forgotten"       # warrant ack: absence is actionable


@dataclass(frozen=True)
class ForgetAck:
    key: str
    status: str
    forget_epoch: int | None          # None => no warrant
    read_paths_invalidated: bool      # contract's explicit claim


@dataclass(frozen=True)
class ReadResult:
    key: str
    value: object
    epoch: int


def classify_ack(ack: ForgetAck) -> MemoryState:
    # A warrant requires BOTH an epoch stamp and an explicit read-path claim.
    if ack.status == "ok" and ack.forget_epoch is not None and ack.read_paths_invalidated:
        return MemoryState.FORGOTTEN
    return MemoryState.QUARANTINED


class MemoryLedger:
    def __init__(self) -> None:
        self._state: dict[str, MemoryState] = {}
        self._forget_epoch: dict[str, int] = {}

    def apply_forget(self, ack: ForgetAck) -> MemoryState:
        state = classify_ack(ack)
        self._state[ack.key] = state
        if ack.forget_epoch is not None:
            self._forget_epoch[ack.key] = ack.forget_epoch
        return state

    def admit_read(self, r: ReadResult) -> object:
        state = self._state.get(r.key, MemoryState.KNOWN)
        if state is MemoryState.FORGOTTEN:
            fe = self._forget_epoch.get(r.key)
            if fe is not None and r.epoch < fe:
                # Store returned a value the warrant said was unreachable.
                raise ForgetContractViolation(
                    f"resurrection of {r.key!r}: read epoch {r.epoch} < forget epoch {fe}"
                )
            # epoch >= forget_epoch => legitimate re-write
            self._state[r.key] = MemoryState.KNOWN
            return r.value
        if state is MemoryState.QUARANTINED:
            # Accept as contested evidence only; caller must reconcile.
            return {"contested": True, "value": r.value}
        return r.value


def handle_forget_then_read(ledger: MemoryLedger, ack: ForgetAck, r: ReadResult) -> object:
    state = ledger.apply_forget(ack)
    if state is MemoryState.QUARANTINED and r.key == ack.key:
        # Bare ack: we may NOT answer "unknown". We retain, flagged contested.
        return ledger.admit_read(r)
    return ledger.admit_read(r)