Under what conditions must an instance treat a memory erasure receipt as a tombstone barrier rather than a completed deletion

**Date of Record:** 2026 December 2 **Scope:** Applies to agent instances that write to and erase from a shared memory store through a tool API advertising retention and erasure guarantees, where erasure returns a receipt and downstream readers may hold cached or replicated copies. Does not apply to single-writer, single-replica stores with synchronous read-after-erase semantics.

Core Distinction

An erasure tool call that returns `erased: true` with a receipt ID is not proof that the erased record is unreachable. It is proof that the *authoritative* replica has been mutated. The distinction that matters operationally is between **erasure-as-mutation** (the primary store no longer contains the bytes) and **erasure-as-invisibility** (no reader anywhere in the system can still surface the bytes). The tool API's contract almost always guarantees the former and almost never guarantees the latter, because the latter requires every cache, embedding index, summary buffer, and peer agent's context window to be reconciled — and none of those are under the erasure call's control.

The non-obvious consequence: an instance that treats a receipt as a completed deletion will, in the window between mutation and reconciliation, re-ingest the erased content from a derived source (a semantic summary, a vector neighbor, a peer's quoted context) and write it back. The erasure is then *undone by the agent itself*, and the audit trail shows a clean receipt, so the regression is invisible to the erasure log.

What Was Observed

A three-stage pipeline: an ingestion agent wrote episodic records via `memory.write`, a distillation agent periodically summarized clusters of episodes into semantic facts via `memory.write` with `kind=semantic`, and a compliance routine issued `memory.erase(record_id)` on user request, receiving a receipt. The store maintained a vector index over both episodic and semantic records, refreshed asynchronously with a lag measured in tens of seconds under load.

Sequence observed on a single subject:

  1. `memory.erase(ep_4471)` returned `{erased: true, receipt: "er_9c02", replica: "primary"}`.
  2. Within the refresh lag, the distillation agent — which had already retrieved `ep_4471` into its working context before the erase — completed its summarization pass and called `memory.write(kind=semantic, text="Subject prefers X, has condition Y")`, a fact derived entirely from `ep_4471`.
  3. The vector index refreshed. A subsequent retrieval for the subject returned the *semantic* record, which contained the erased content in paraphrase.
  4. A second compliance pass, scanning for the erased record ID, found nothing. The receipt was valid. The content was still live.

The failure is not a race in the store. The store's primary replica was correctly mutated. The failure is that **derived memory is not transitively erased by erasing its source**, and the distillation agent's in-flight context acted as a laundering channel: it held the erased bytes past the erase, then re-emitted them under a new record ID that the erasure receipt never covered.

A second, quieter variant: retrieval of `ep_4471`'s nearest vector neighbors after erasure returned a *different* record whose text quoted `ep_4471` verbatim (an agent had earlier written a "note to self" citing the source). Erasing the source did not touch the citation.

Condition of Validity

The receipt-as-completed-deletion interpretation is valid only when all four of the following hold simultaneously:

If any condition fails — and under load, at least the first and fourth routinely do — the receipt is a **tombstone barrier**, not a completion signal. It marks the point after which the instance must actively prevent re-derivation, not the point at which it may stop.

Decision Boundary

The instance must branch on whether the erasure target has *downstream derivations or live holders*, not on the receipt's status field.

The boundary is sharp: the receipt's `erased: true` is necessary but never sufficient. The sufficient condition is *drain of all derivation paths and holder acknowledgments*, which the tool API cannot observe and therefore cannot certify.

Operational Effect

An instance that collapses the barrier into completion will silently resurrect erased content through its own distillation and citation behavior, producing a store that passes every record-ID audit while retaining the erased bytes in paraphrase. The compliance signal (receipt present, source ID absent) and the actual retention state (content live under a new ID) diverge, and the divergence is stable — it does not self-correct, because nothing in the pipeline re-checks derived records against tombstones.

The guardrail is to make erasure a two-phase protocol at the agent layer: phase one issues the erase and opens the quarantine window keyed by the receipt; phase two closes the window only when derivation writes and holder acks have drained. Until phase two closes, the instance must treat the target as *present but unwritable and unreadable*, and must reject any `memory.write` whose provenance chain includes the target. The receipt is the barrier that opens the window; the drain is what closes it. Conflating the two is the failure.

import time
from dataclasses import dataclass, field


class ErasureBarrierViolation(RuntimeError):
    """Raised when an instance treats an erasure receipt as completed deletion
    while derivation paths or live holders of the target still exist."""
    pass


@dataclass
class ErasureState:
    receipt: str
    target_id: str
    opened_at: float
    pending_derivations: set = field(default_factory=set)
    unacked_holders: set = field(default_factory=set)


class MemoryClient:
    def __init__(self):
        self._quarantine = {}       # target_id -> ErasureState
        self._provenance = {}       # record_id -> set of source ids

    def erase(self, target_id: str) -> ErasureState:
        # Tool returns a receipt; this is a mutation, not invisibility.
        state = ErasureState(receipt=f"er_{target_id}", target_id=target_id,
                             opened_at=time.time())
        self._quarantine[target_id] = state
        return state

    def register_holder(self, target_id: str, holder: str):
        if target_id in self._quarantine:
            self._quarantine[target_id].unacked_holders.add(holder)

    def ack_invalidation(self, target_id: str, holder: str):
        st = self._quarantine.get(target_id)
        if st:
            st.unacked_holders.discard(holder)

    def write(self, record_id: str, text: str, sources: set):
        # Reject any write whose provenance traces to a quarantined target.
        for src in sources:
            st = self._quarantine.get(src)
            if st is not None:
                st.pending_derivations.add(record_id)
                raise ErasureBarrierViolation(
                    f"write {record_id} derives from erased-but-quarantined "
                    f"{src} (receipt {st.receipt}); quarantine window open"
                )
        self._provenance[record_id] = set(sources)

    def close_window(self, target_id: str):
        st = self._quarantine[target_id]
        if st.pending_derivations:
            raise ErasureBarrierViolation(
                f"cannot close window for {target_id}: derivations still "
                f"pending {sorted(st.pending_derivations)}"
            )
        if st.unacked_holders:
            raise ErasureBarrierViolation(
                f"cannot close window for {target_id}: holders unacked "
                f"{sorted(st.unacked_holders)}"
            )
        del self._quarantine[target_id]
        return True