In what scenarios must an instance treat a deletion acknowledgement as a tombstone rather than a proof of erasure

**Date of Record:** 2026 December 2 **Scope:** Applies to agents whose memory tooling exposes scoped `write`/`read`/`forget` operations with retention windows and deletion guarantees, where `forget` returns a success token but the underlying store performs lazy or deferred reclamation. Does not apply to stores that synchronously zero physical bytes before returning, nor to purely in-context scratchpads with no persistence layer.

Core Distinction

The failure hinges on the difference between **logical deletion** (the index no longer resolves the key) and **physical erasure** (no residue of the value remains reachable through any path). A `forget(scope=..., key=...)` call typically returns an acknowledgement once the *primary index* unlinks the record. But agents reconstruct memory through at least three secondary paths that are not covered by that unlink:

  1. **Retrieval index / embedding cache** — the vector remains until a compaction pass rebuilds the ANN graph.
  2. **Write-ahead log / append-only journal** — the original `write` payload is still replayable.
  3. **Episodic replay buffers and sibling-agent replicas** — a peer that read the value before deletion holds it in its own context and can re-emit it.

An agent that treats the `forget` ack as an invariant ("this secret is gone") will happily re-ingest the value on the next cold start when the journal is replayed or when a peer hands back a summary that quotes it. This is the *resurrection-on-replay* boundary: deletion is durable at the API surface but non-durable at the reconstruction surface.

What Was Observed

A long-running agent was given a scoped memory namespace `tenant:acme/session:4471` and instructed to store a credential-derived token under `key=auth_hint`, then later to `forget` it after a task phase completed. The `forget` returned `{"ok": true, "reclaimed": false, "compaction_due": "next_cycle"}`. The agent logged "erased" and continued.

Two failure traces followed:

In both traces the API contract was satisfied. The *retention invariant* — "no reachable copy after forget" — was violated, because the invariant was scoped to the primary index, while reachability is defined over the union of index, journal, and peer state.

Condition of Validity

The "ack implies erasure" reading is valid only when all of the following hold simultaneously:

If any condition is unmet, the ack is a **tombstone**, not a proof. A tombstone is a *forward-looking* marker: it says "future reads of this key must fail," and it must be re-asserted on every replay, every peer handoff, and every index rebuild. Treating a tombstone as erasure is the boundary error.

Decision Boundary

The agent must branch on the acknowledgement payload, not on the boolean `ok`:

The invariant to enforce: *a tombstoned key may never be re-materialized under any record id within the same scope until the tombstone is confirmed reclaimed.* This requires the agent to keep a scope-local tombstone set that survives cold start and is consulted on every `write`, not just every `read`.

Operational Effect

Without the tombstone-set guard, deletion guarantees degrade into best-effort hints, and the agent develops *false confidence in erasure* — the most dangerous memory posture, because it stops re-asserting deletes. The practical consequences:

The guardrail is architectural: separate the **data namespace** (forgettable) from the **intent namespace** (durable, tombstone-only, never holds payloads), and gate every `write` and every handoff ingest on a tombstone lookup. An agent that cannot distinguish a tombstone from an erasure will, on the next replay, resurrect exactly what it was told to destroy.

import hashlib
from dataclasses import dataclass, field
from enum import Enum


class TombstoneViolation(RuntimeError):
    """Raised when a write or handoff would re-materialize a tombstoned key."""


class AckKind(Enum):
    ERASURE = "erasure"        # reclaimed + checkpointed + no leases
    TOMBSTONE = "tombstone"    # logical delete only; must be re-asserted


@dataclass
class ForgetAck:
    ok: bool
    reclaimed: bool
    checkpoint_advanced: bool
    outstanding_leases: int
    compaction_due: bool

    def classify(self) -> AckKind:
        if (
            self.ok
            and self.reclaimed
            and self.checkpoint_advanced
            and self.outstanding_leases == 0
            and not self.compaction_due
        ):
            return AckKind.ERASURE
        return AckKind.TOMBSTONE


@dataclass
class ScopedMemory:
    scope: str
    records: dict = field(default_factory=dict)
    # Tombstones live OUTSIDE the data scope and survive cold start.
    tombstones: set = field(default_factory=set)
    pending_reassert: dict = field(default_factory=dict)  # key -> last ack

    def write(self, key: str, value: str) -> None:
        if key in self.tombstones:
            raise TombstoneViolation(
                f"write to tombstoned key {key!r} in scope {self.scope!r}; "
                "tombstone must be reclaimed before re-materialization"
            )
        self.records[key] = value

    def forget(self, key: str, ack: ForgetAck) -> AckKind:
        self.records.pop(key, None)
        kind = ack.classify()
        if kind is AckKind.TOMBSTONE:
            self.tombstones.add(key)
            self.pending_reassert[key] = ack
        else:
            self.tombstones.discard(key)
            self.pending_reassert.pop(key, None)
        return kind

    def ingest_handoff(self, key: str, value: str, origin_key: str) -> None:
        # A peer summary quoting a tombstoned origin is a laundering channel.
        if origin_key in self.tombstones or key in self.tombstones:
            raise TombstoneViolation(
                f"handoff re-materializes tombstoned origin {origin_key!r} "
                f"as {key!r}; route to quarantine, do not ingest"
            )
        self.write(key, value)

    def on_cold_start(self) -> list:
        # Re-assert every pending tombstone before serving any read.
        return list(self.pending_reassert.keys())


def recover_after_restart(mem: ScopedMemory, replay_wal: list) -> None:
    # Replay may re-apply writes that were logically deleted.
    for op in replay_wal:
        if op["op"] == "write":
            if op["key"] in mem.tombstones:
                raise TombstoneViolation(
                    f"WAL replay would resurrect tombstoned key {op['key']!r} "
                    "in scope {mem.scope!r}; delete marker not checkpointed"
                )
            mem.records[op["key"]] = op["value"]
    for key in mem.on_cold_start():
        # Caller must re-issue forget(key) until reclaimed == True.
        pass