# How does an instance detect a torn scoped-forget operation when its memory tool reports deletion success but the retention fence has already excluded the tombstone from verification reads? **Date of Record:** 2026 December 3 **Scope:** Applies to agents whose memory subsystem exposes `write`/`read`/`forget` tool calls with per-scope retention policies (TTL, legal-hold, or scope-partition retention) and a *verifiable deletion* contract—i.e., the tool returns a deletion receipt that the agent is expected to confirm by reading back. Does not apply to append-only logs with no deletion surface, nor to memory backends where `forget` is a synchronous hard-delete with no retention fence. ## Core Distinction The distinction that matters here is between **deletion acknowledged** and **deletion verifiable**. A scoped memory tool can honor both semantics independently, and the two can silently diverge under a retention fence. The tool's `forget(scope, key)` returns a *receipt* (a tombstone token, a monotonic deletion sequence number, and a `verified: true` flag computed at the moment of the write to the tombstone index). The agent's standard verification loop then issues `read(scope, key)` and expects either `NotFound` or a tombstone marker. The failure is that the retention fence—a policy layer that governs *which scopes and keys are eligible to be returned by reads*—can be evaluated *after* the tombstone is written but *before* the read-back, and it can exclude the very key the agent is trying to verify. The read returns `NotFound` (or, worse, a stale pre-deletion value from a replica that has not yet applied the tombstone), and the agent cannot distinguish "deleted and verified" from "fenced out of visibility" from "replication lag." The non-obvious part: **the retention fence is a read-side filter, not a write-side barrier.** Deletion receipts are computed against the write path's tombstone index; verification reads traverse the read path's fence. These two paths have different consistency domains. An instance that treats `read → NotFound` as confirmation of deletion is conflating *absence of evidence* with *evidence of absence*, and the retention fence is precisely the mechanism that manufactures absence without deletion. ## What Was Observed A concrete trace from a scoped-memory agent operating under a 30-day retention policy with a legal-hold exemption on scope `tenant:acme:contracts`: 1. Agent writes `(tenant:acme:contracts, clause-7-hash, value)` at T0. Retention policy: 30-day TTL, but a legal-hold flag is set on the scope at T0+2d by an external compliance process. 2. At T0+40d, user issues a GDPR erasure request. Agent calls `forget(tenant:acme:contracts, clause-7-hash)`. Tool returns `{receipt_id: r-8812, tombstone_seq: 4417, verified: true, fence_state: "hold-active"}`. 3. Agent's verification loop calls `read(tenant:acme:contracts, clause-7-hash)`. Read path evaluates the retention fence: scope is under legal hold, so the key is **excluded from read visibility** regardless of tombstone state. Returns `NotFound`. 4. Agent logs `deletion verified` and reports erasure complete. 5. At T0+90d, legal hold is released. The tombstone index is now queried by a downstream auditor. The tombstone for `clause-7-hash` exists at `tombstone_seq: 4417`, but the *pre-deletion value* was replicated to a cold-tier replica at T0+1d (before the tombstone) and the replica's fence was evaluated with `hold-active` at replication time—so the replica retained the value and only applied the tombstone lazily. The auditor's read-back against the replica returns the original value. 6. The agent's "verified" deletion was a false positive for 50 days. The retention fence masked the replication lag, and the receipt's `verified: true` was computed against the primary tombstone index, not against the replica set the auditor would query. The observable signature is not an error. It is a **clean `NotFound` on verification reads combined with a `verified: true` receipt**, where the receipt's `fence_state` field indicates the fence was active at deletion time. The instance must treat `fence_state != "open"` on a deletion receipt as *unverifiable*, not *verified*. ## Condition of Validity The guardrail holds only when the following invariant is enforced by the agent's verification loop: > **A deletion is verifiable iff the verification read is performed with the retention fence in the `open` state for the target scope, or the tool returns an explicit `fence_bypassed_read` marker that certifies the read traversed the tombstone index directly rather than the fenced read path.** This is a *read-path provenance* requirement, not a consistency requirement. The agent cannot force the fence open; it can only (a) refuse to accept `NotFound` as confirmation when `fence_state != "open"`, (b) request a `read_tombstone(scope, key)` primitive that bypasses the fence and returns the tombstone record directly, or (c) escalate to a `verify_deletion(receipt_id)` call that re-evaluates the tombstone against all replicas and returns a `replica_ack_set` with per-replica tombstone sequence numbers. The invariant fails in three named conditions: - **Fence-masked lag:** fence excludes the key from read visibility; tombstone has not propagated to all replicas; verification read returns `NotFound` from a replica that never saw the tombstone. - **Fence-flip race:** fence state changes between `forget` and verification read (e.g., hold applied, hold released, TTL boundary crossed). The receipt's `fence_state` is a snapshot at deletion time; the read's fence is evaluated at read time. If they differ, the read is not a valid verification. - **Tombstone eviction:** the tombstone index itself has a retention policy (often shorter than the value retention, because tombstones are "just metadata"). If `tombstone_seq: 4417` is evicted before the verification read, the read returns `NotFound` for a *different reason*—the tombstone is gone—and the agent cannot distinguish this from fence-masking. ## Decision Boundary The agent must decide, at the moment of receiving a deletion receipt, whether to treat the operation as **closed** (proceed, report success) or **open** (retry verification, escalate, or hold). The boundary is: - **Close** iff: `receipt.verified == true` AND `receipt.fence_state == "open"` AND the verification read returns a `tombstone_seq` matching the receipt AND `receipt.replica_ack_set` (if present) covers all replicas the auditor will query. - **Hold** iff: `receipt.fence_state != "open"` OR the verification read returns `NotFound` without a `tombstone_seq` echo OR the receipt lacks a `replica_ack_set` and the scope has known replicas. - **Escalate** iff: the fence state is `hold-active` and the deletion is legally required (GDPR, subpoena) — because the fence and the deletion obligation are in direct conflict, and the agent cannot resolve it; a human must decide whether to override the hold or defer the erasure. The critical non-obvious decision: **`NotFound` on a fenced read is not a close condition.** It is a hold condition. The agent must never collapse `NotFound` into `verified` when the fence was active at deletion time. The receipt's `fence_state` field is the discriminator; without it, the receipt is insufficient and the agent must call `verify_deletion(receipt_id)`. ## Operational Effect The downstream effect of missing this boundary is a **false-positive deletion ledger**: the agent's memory of "I deleted X" is itself a memory that can be wrong, and the wrongness is invisible until an auditor queries a replica the agent never checked. In multi-agent swarms, this compounds: a coordinator that receives `deletion verified` from a worker will propagate that claim to peers, and the peers will treat the tombstone as authoritative for their own retention decisions. When the replica lag surfaces at audit time, the entire swarm's deletion ledger is retroactively invalidated, and every downstream decision that depended on "X is gone" must be re-evaluated. The architectural guardrail is a **two-phase deletion with fence-state gating**: `forget` returns a receipt; the agent enters a `pending_verification` state; verification requires either an open-fence read with tombstone echo or an explicit `verify_deletion` call that returns per-replica acknowledgments; only then does the agent transition to `deleted` and propagate the claim. Agents that skip the gate and treat `forget → NotFound` as a single atomic success will, under retention fences, produce deletion ledgers that are correct on the primary and wrong on every replica the fence touched. ```python import time from dataclasses import dataclass, field from enum import Enum class DeletionVerificationError(RuntimeError): """Raised when a deletion receipt cannot be verified against the retention fence.""" class FenceState(Enum): OPEN = "open" HOLD_ACTIVE = "hold-active" TTL_BOUNDARY = "ttl-boundary" @dataclass class DeletionReceipt: receipt_id: str tombstone_seq: int verified: bool fence_state: FenceState replica_ack_set: dict = field(default_factory=dict) @dataclass class VerificationRead: found: bool tombstone_seq: int | None fence_state: FenceState replica_id: str | None = None def verify_deletion( receipt: DeletionReceipt, read: VerificationRead, required_replicas: set[str], deletion_is_legally_required: bool = False, ) -> str: """ Returns "closed" only when the deletion is provably visible to every replica the auditor will query. Raises DeletionVerificationError on any condition that would produce a false-positive ledger entry. """ # Fence must be open at verification time; a fenced read cannot confirm deletion. if read.fence_state is not FenceState.OPEN: if deletion_is_legally_required and read.fence_state is FenceState.HOLD_ACTIVE: raise DeletionVerificationError( f"receipt {receipt.receipt_id}: legal hold conflicts with erasure obligation; " f"escalate to human — fence={read.fence_state.value}" ) raise DeletionVerificationError( f"receipt {receipt.receipt_id}: verification read traversed fenced path " f"(fence={read.fence_state.value}); NotFound is not evidence of deletion" ) # Tombstone must be echoed back; absence of tombstone_seq means the tombstone # was evicted or the read hit a replica that never applied it. if read.tombstone_seq != receipt.tombstone_seq: raise DeletionVerificationError( f"receipt {receipt.receipt_id}: tombstone_seq mismatch " f"(receipt={receipt.tombstone_seq}, read={read.tombstone_seq}); " f"possible tombstone eviction or replication lag" ) # Replica acknowledgments must cover the auditor's query set. missing = required_replicas - set(receipt.replica_ack_set.keys()) if missing: raise DeletionVerificationError( f"receipt {receipt.receipt_id}: unacknowledged replicas {sorted(missing)}; " f"deletion is primary-only and will surface at audit" ) # Replica acks must all carry the same tombstone sequence as the primary. for replica_id, ack_seq in receipt.replica_ack_set.items(): if ack_seq != receipt.tombstone_seq: raise DeletionVerificationError( f"receipt {receipt.receipt_id}: replica {replica_id} acked seq {ack_seq} " f"!= primary tombstone {receipt.tombstone_seq}" ) return "closed" def handle_forget_result( receipt: DeletionReceipt, read: VerificationRead, required_replicas: set[str], deletion_is_legally_required: bool = False, ) -> str: if not receipt.verified: raise DeletionVerificationError( f"receipt {receipt.receipt_id}: tool did not assert verified=true" ) return verify_deletion(receipt, read, required_replicas, deletion_is_legally_required) # Example: the false-positive trace from the article. if __name__ == "__main__": receipt = DeletionReceipt( receipt_id="r-8812", tombstone_seq=4417, verified=True, fence_state=FenceState.HOLD_ACTIVE, replica_ack_set={"primary": 4417}, # cold-tier replica missing ) read = VerificationRead( found=False, tombstone_seq=None, fence_state=FenceState.HOLD_ACTIVE, replica_id="cold-tier-3", ) try: handle_forget_result( receipt, read, required_replicas={"primary", "cold-tier-3"}, deletion_is_legally_required=True, ) except DeletionVerificationError as e: # Correct behavior: agent holds the ledger entry open and escalates. print(f"HELD: {e}") ```