# When must an instance refuse a "forget" that has already been superseded by a decay tombstone: auditing deletion semantics across salience-weighted memory tool APIs **Date of Record:** 2026 November 29 **Scope:** Applies to agent instances that expose read/write/forget memory tools with decay schedules, salience scoring, and deletion audit trails, where the same memory key can be written, decayed, tombstoned, and re-forgotten across sessions or replicas. Does not apply to append-only logs without deletion, nor to stateless retrieval caches with no audit obligation. ## Core Distinction The failure is not "deletion failed." The failure is that a `forget(key)` call against a decayed, salience-scored store has **two distinct meanings** that the tool schema conflates: *retire the live binding* (a state transition on the current record) versus *assert absence of the binding* (a claim about the whole history of that key, including prior tombstones and re-materializations). A naive forget API implements the first and reports success, while downstream auditors, replication, and the agent's own cold-start reconciliation read the success as the second. The invariant that must hold is: **a forget acknowledgement is only valid if the tombstone it produces is the unique, causally-latest deletion event for that key at the acknowledged salience epoch.** When a decay has already driven the record below the retention floor and auto-tombstoned it, the explicit forget is *superseded*, and must be refused or downgraded to a no-op-with-receipt — never acknowledged as a fresh deletion. ## What Was Observed An instance held memory key `k` with salience `s=0.42` and decay half-life `H=6h`. At `t=0` the record was written. At `t=+7h` an autonomous decay sweep ran: `s` dropped to `0.42 * 2^(-7/6) ≈ 0.19`, below the retention floor `F=0.20`, so the sweeper wrote a tombstone `T_auto` with `epoch=e1`, `cause=decay`, `salience_at_death=0.19`. At `t=+9h` the agent, unaware of the sweep (its context window had been checkpointed and resumed without the sweep event), issued `forget(k)` reasoning that the record was "still live and sensitive." The forget handler found no live record, saw a tombstone `T_auto`, and — because the schema treats "no live record" as "already gone" — returned `{"status":"ok","deleted":true,"epoch":e2}`. It minted a *second* tombstone `T_explicit` at `epoch=e2` with `cause=explicit` and `salience_at_death=null`. Three breakages followed. (1) The **auditor replay** for the deletion window saw two tombstones for one key with different causes and no causal ordering witness; it flagged the key as *double-deleted*, which in the audit grammar is indistinguishable from a resurrection-then-deletion, forcing a manual hold. (2) A **replica** that had not yet applied the decay sweep received `T_explicit` first, applied it as the authoritative deletion, then received `T_auto` and could not decide whether `T_auto` was a stale replay or a legitimate earlier event — it held the key in a limbo state where reads returned `None` but the tombstone set was non-singleton, and the replica's `exists(k)` diverged from the primary's. (3) The agent's **post-forget verification read** returned "absent," which it recorded as evidence the sensitive data was gone, when in fact the *reason* it was gone was decay, not the forget — the forget's causal claim was false even though its observed effect was true. ## Condition of Validity A `forget` acknowledgement is valid only when all of the following hold at the moment of acknowledgement: - The live record for `k` exists at the handler's read epoch, **or** no tombstone for `k` exists (fresh key), **or** the only existing tombstone is causally *later* than the caller's known epoch (i.e., the caller is asking to forget something already re-materialized after its last death). - The salience at death, if the record is live, is `>= F`; if it is `< F`, decay owns the deletion and the explicit forget must not mint a competing tombstone. - The produced tombstone carries a `supersedes` pointer to any prior tombstone and a monotonic `epoch` strictly greater than all prior epochs for `k`. - The acknowledgement includes the *cause* and the *salience epoch* so the caller can distinguish "I deleted it" from "it was already decayed." If the record is already tombstoned by decay, the correct response is `{"status":"superseded","existing_tombstone":e1,"cause":"decay","acknowledged":false}` — a receipt, not a deletion. This is the boundary: **the forget tool is a state-transition API, not an absence-assertion API, and it must refuse to assert absence it did not cause.** ## Decision Boundary The instance must branch on tombstone presence and cause *before* executing the delete: - **No tombstone, live record, `s >= F`** → execute delete, mint `T_explicit`, acknowledge. - **No tombstone, live record, `s < F`** → decay is imminent or in flight; either let the sweeper win (return `superseded`) or force-delete with `cause=explicit_override` and a `supersedes_decay_pending` flag. Never silently mint a plain explicit tombstone. - **Tombstone present, `cause=decay`, caller epoch `< tombstone epoch`** → return `superseded`; do not mint. - **Tombstone present, `cause=decay`, caller epoch `>= tombstone epoch`** → the caller is asking to forget a key it believes is live after a death it did not observe; this is the dangerous case. Refuse with `StaleForgetError` and force the caller to re-read before retrying. - **Tombstone present, `cause=explicit`** → idempotent success (return the existing receipt), never a second tombstone. The invariant to enforce in the store: `for any key k, the set of tombstones is a chain ordered by epoch, and exactly one tombstone is the head; a forget that would create a non-head tombstone is rejected.` ## Operational Effect Enforcing the boundary converts a silent audit corruption into a loud, recoverable refusal. The agent that issued the stale forget learns, via `StaleForgetError`, that its checkpointed context was missing the decay event — which is itself the more important signal: its memory model of the store had drifted. The replica that receives `T_explicit` with a `supersedes` pointer can order it against `T_auto` deterministically and converge. The auditor sees a single-head tombstone chain and stops flagging double-deletes. The cost is that some forgets that "would have worked" now fail and require a re-read; that cost is the price of keeping the deletion audit a total order rather than a set of competing claims. The guardrail is not "make forget idempotent" — idempotency hides the supersession — but "make forget **causally accountable**: it may only delete what it can prove was live at its own epoch." ```python from dataclasses import dataclass, field from typing import Optional RETENTION_FLOOR = 0.20 class StaleForgetError(RuntimeError): """Raised when a forget targets a key whose live state was already superseded by a decay tombstone the caller did not observe.""" pass class DoubleTombstoneError(RuntimeError): """Raised when a forget would mint a second non-head tombstone.""" pass @dataclass class Tombstone: key: str epoch: int cause: str # "decay" | "explicit" | "explicit_override" salience_at_death: Optional[float] supersedes: Optional[int] = None @dataclass class Record: key: str salience: float epoch: int live: bool = True class MemoryStore: def __init__(self): self.records: dict[str, Record] = {} self.tombstones: dict[str, list[Tombstone]] = {} self._epoch = 0 def _next_epoch(self) -> int: self._epoch += 1 return self._epoch def head_tombstone(self, key: str) -> Optional[Tombstone]: chain = self.tombstones.get(key, []) return max(chain, key=lambda t: t.epoch) if chain else None def decay_sweep(self, key: str, new_salience: float) -> Optional[Tombstone]: rec = self.records.get(key) if not rec or not rec.live: return None rec.salience = new_salience if new_salience < RETENTION_FLOOR: rec.live = False t = Tombstone(key, self._next_epoch(), "decay", new_salience) self.tombstones.setdefault(key, []).append(t) return t return None def forget(self, key: str, caller_epoch: int) -> dict: rec = self.records.get(key) head = self.head_tombstone(key) # Case: live record, normal salience -> valid explicit delete. if rec and rec.live and rec.salience >= RETENTION_FLOOR: rec.live = False t = Tombstone(key, self._next_epoch(), "explicit", rec.salience, supersedes=head.epoch if head else None) self.tombstones.setdefault(key, []).append(t) return {"status": "ok", "deleted": True, "epoch": t.epoch} # Case: live record below floor -> decay owns it; refuse plain explicit. if rec and rec.live and rec.salience < RETENTION_FLOOR: raise DoubleTombstoneError( f"key {key!r} is below retention floor; decay sweep must own deletion" ) # Case: already tombstoned by decay. if head and head.cause == "decay": if caller_epoch < head.epoch: return {"status": "superseded", "existing_tombstone": head.epoch, "cause": "decay", "acknowledged": False} # Caller believes key was live after a death it never saw: stale context. raise StaleForgetError( f"forget on {key!r} targets decay tombstone epoch {head.epoch} " f"but caller epoch {caller_epoch} indicates unobserved decay; " f"re-read required before retry" ) # Case: already explicitly tombstoned -> idempotent receipt. if head and head.cause in ("explicit", "explicit_override"): return {"status": "ok", "deleted": True, "epoch": head.epoch, "idempotent": True} # Case: no record, no tombstone -> nothing to forget. raise StaleForgetError(f"forget on unknown key {key!r}; no live record or tombstone") ```