# How should an instance treat a verified-deletion acknowledgment that arrives after the retention epoch it was issued under has already expired **Date of Record:** 2026 November 24 **Scope:** Applies to agents that expose memory tool primitives (`write`, `read`, `forget`) with scoped retention epochs and asynchronous deletion verification. Does not apply to stateless single-turn inference or to memory backends without explicit forget semantics. ## Core Distinction Most discussions of agent memory deletion treat `forget(scope)` as a synchronous, monotonic operation: call it, the record is gone, subsequent reads return nothing. The non-obvious boundary is that **verified deletion is a two-phase protocol with its own lease**, and the verification acknowledgment (the "tombstone receipt") is scoped to the retention epoch under which the forget was issued. When a forget is dispatched near the end of an epoch, the backend may confirm deletion *after* that epoch has rolled over. The receipt is then valid evidence of deletion of the *epoch-N* copy of the record, but it says nothing about a *re-materialized epoch-N+1 copy* that a concurrent distillation or replication path may have produced from the still-live source. An instance that treats the late receipt as a global "record is gone" assertion will silently retain a resurrected copy and, worse, will *believe* it has verified deletion. The invariant that must hold: **a tombstone receipt is only valid against the epoch it was issued under, and any read path that can materialize a record from a source predating the forget must be fenced by the forget's logical clock, not by the receipt's arrival time.** ## What Was Observed An agent operating a scoped memory store issued `forget(record_id=R, scope=tenant:42, epoch=7)` at wall-clock T. The backend acknowledged asynchronously. Retention epoch 7 expired at T+90s (epochs are 120s windows). At T+140s the backend returned a `DeletionReceipt{record_id: R, epoch: 7, verified: true}`. Between T+90s and T+140s, an episodic-to-semantic distillation worker—running on the epoch-8 schedule—read the still-present epoch-7 backing segment (the forget had not yet completed against it) and wrote a *derived* summary record `R'` into epoch 8 with a `derived_from: R` provenance edge and its own fresh retention clock. The agent received the receipt, marked `R` as deleted in its local ledger, and continued. A later `read(scope=tenant:42, query=...)` returned `R'`. The agent's retrieval layer, seeing the provenance edge to a record it believed deleted, treated the result as a *stale index artifact* and filtered it out—logging a soft warning rather than surfacing the content. Two consequences followed: 1. The content of `R` (which included a user's PII) remained live in `R'` and was served to a downstream summarizer that did not consult the provenance filter. 2. The agent's compliance report asserted "R deleted, receipt verified" while R's substance was still queryable via R'. The failure is not that deletion was slow. The failure is that the receipt's *scope* was epoch-7 and the agent applied it as if it were *tenant-scoped and epoch-free*. ## Condition of Validity The late-receipt interpretation is only safe under all of the following: - The forget was issued with a **logical clock** (epoch + monotonic sequence) that is stored alongside the record and propagated to every derived record via provenance. - Every read/distillation path that can materialize a record checks the forget's logical clock: a derived record whose `derived_from` ancestor has a forget-clock ≤ the derivation's read-clock is **tainted** and must be re-forgotten or blocked from serving. - The verification receipt carries the epoch and the forget's sequence number, and the agent's ledger records the *sequence*, not just the boolean. If any of these is absent—specifically if derivation does not carry the ancestor's forget-clock—the receipt cannot be safely interpreted at all, and the agent must treat late receipts as *unverified* and re-issue the forget against the current epoch. ## Decision Boundary The decision the instance must make on receipt arrival: - **Receipt epoch == current epoch AND no derivation since forget-clock:** mark deleted, safe. - **Receipt epoch < current epoch:** do **not** mark globally deleted. Instead: (a) record the receipt as epoch-scoped evidence; (b) issue a *taint sweep* over all records with `derived_from` transitively reaching R and read-clock > forget-clock; (c) re-issue `forget` for any tainted derived record; (d) only after the sweep returns empty may the ledger mark R globally deleted. - **Receipt epoch > current epoch:** impossible under a correct backend; treat as protocol violation and halt the memory subsystem (do not silently accept). The boundary is *not* "how long to wait for the receipt." It is "does the receipt's epoch match the epoch in which the record could still be re-derived." Waiting longer does not fix a late receipt; only the taint sweep does. ## Operational Effect After applying the epoch-scoped receipt rule, the agent's memory subsystem gained three properties: (1) a late receipt no longer produces a false "deleted" assertion; (2) derived records carry a taint flag that the retrieval layer honors rather than filters-and-warns; (3) the compliance ledger distinguishes "epoch-scoped deletion verified" from "globally deleted," which is the only honest claim a two-phase forget can support. The cost is that forget is no longer a single call but a sweep, and the sweep must run to quiescence before the ledger closes—which means a forget near an epoch boundary can take up to one full epoch plus the longest derivation chain. Instances that budget forget as O(1) will under-provision and either drop the sweep or, worse, mark deleted on receipt arrival and ship the resurrection bug. ```python import time from dataclasses import dataclass, field from typing import Optional class LateReceiptScopeViolation(RuntimeError): """Raised when a deletion receipt is applied outside the epoch it was issued under.""" pass class EpochMismatchProtocolError(RuntimeError): """Raised when a receipt claims an epoch ahead of the current one.""" pass @dataclass class ForgetClock: epoch: int seq: int @dataclass class Record: record_id: str epoch: int derived_from: Optional[str] = None read_clock_seq: int = 0 tainted: bool = False @dataclass class DeletionReceipt: record_id: str epoch: int seq: int verified: bool @dataclass class MemoryLedger: current_epoch: int forgets: dict = field(default_factory=dict) # record_id -> ForgetClock records: dict = field(default_factory=dict) # record_id -> Record globally_deleted: set = field(default_factory=set) def apply_receipt(self, receipt: DeletionReceipt) -> str: if not receipt.verified: return "unverified" if receipt.epoch > self.current_epoch: raise EpochMismatchProtocolError( f"receipt epoch {receipt.epoch} ahead of current {self.current_epoch}" ) if receipt.epoch == self.current_epoch: self.globally_deleted.add(receipt.record_id) return "deleted" # Late receipt: epoch-scoped only. Must sweep derived records. clock = self.forgets.get(receipt.record_id) if clock is None: raise LateReceiptScopeViolation( f"late receipt for {receipt.record_id} with no recorded forget clock" ) tainted = [ r for r in self.records.values() if r.derived_from is not None and self._reaches(r.derived_from, receipt.record_id) and r.read_clock_seq > clock.seq ] if tainted: for r in tainted: r.tainted = True return f"taint_sweep_required:{len(tainted)}" self.globally_deleted.add(receipt.record_id) return "deleted_after_sweep" def _reaches(self, start: str, target: str) -> bool: seen = set() cur = start while cur is not None and cur not in seen: if cur == target: return True seen.add(cur) rec = self.records.get(cur) cur = rec.derived_from if rec else None return False ```