# Under what conditions must an instance refuse a scoped memory deletion when the retention warrant and the tombstone digest disagree **Date of Record:** 2026 November 30 **Scope:** Applies to agent instances operating a read/write/forget memory tool API where deletion is gated by a cryptographically signed retention warrant and confirmed by a content-addressed tombstone. Does not apply to un-scoped local scratchpads or to deletion of memory that was never promoted from episodic to semantic store. ## Core Distinction A `forget(scope, key)` call is not a single operation. It is a two-phase commitment: (1) the retention policy engine issues a *deletion warrant* — a signed attestation that the caller is authorized to erase the key under the currently active retention class — and (2) the store writes a *tombstone digest* — a hash committing to the exact bytes that were removed, so that downstream auditors and replica agents can verify the erase was total and not partial. The boundary failure lives in the gap between these two phases: the warrant certifies *authority over a key*, while the tombstone certifies *identity of content*. When the content behind a key has drifted since the warrant was minted (because a concurrent `write` re-versioned it, or because a distillation pass rewrote the record), the tombstone digest will not match the digest the warrant was bound to. The naive implementation deletes anyway, because the key matches. That is the failure. The invariant is: **a deletion may only commit if the tombstone digest equals the digest the warrant was cryptographically bound to.** Key equality is insufficient. This is non-obvious because most memory APIs index deletion by key, and keys are stable across rewrites — so the wrong bytes get erased under the right authority. ## What Was Observed An instance running a long-horizon task held a semantic memory record under key `user_pref.timezone`. At T0 the retention engine issued warrant `W` scoped to `(tenant=acme, key=user_pref.timezone, retention_class=ephemeral)` and bound it to digest `d0 = H(record_bytes_v0)`. The warrant was queued behind a batch of pending operations. At T1, before the warrant executed, a distillation pass rewrote the record: it merged the timezone preference with a newer observation and produced `record_bytes_v1`, digest `d1`. The key was unchanged. The store's version counter advanced from 0 to 1. At T2 the queued `forget` executed. The retention engine validated the warrant signature (valid), checked tenant scope (match), checked key scope (match), and issued the delete. The store wrote a tombstone with digest `d1` — the *current* content — while the warrant attested to `d0`. The erased bytes were the distilled, merged record, which contained a second semantic fact (`user_pref.locale`) that had been folded in during distillation and had *not* been in scope of the original ephemeral retention class. That fact was permanently destroyed under a warrant that never authorized its deletion. The audit replay caught it: an auditor agent recomputed the tombstone against the warrant's bound digest, got a mismatch, and flagged the erase as unverifiable. But the bytes were already gone. The mismatch was detectable, not recoverable. ## Condition of Validity The refusal condition is precise and must be checked at commit time, not at warrant-mint time: A `forget` must be refused when `tombstone_digest(current_content) != warrant.bound_digest`, **unless** the warrant carries an explicit `allow_drift=True` clause re-signed by the retention engine *after* the content version advanced. Drift-tolerant warrants are legitimate for whole-key erasure where the caller genuinely wants "whatever is there now," but they must be a distinct, separately-authorized grant — never the default. Three sub-conditions strengthen the guard: 1. **Version pinning.** The warrant must carry the store's monotonic version counter at mint time. If `current_version != warrant.bound_version`, the warrant is stale regardless of digest, because a version bump is the store's own signal that content changed. 2. **Distillation provenance.** If the record's lineage includes facts from retention classes with longer minimum-retention than the warrant's class, deletion is refused and escalated to a re-scoping pass — the warrant cannot erase bytes that carry a superset of its own retention obligation. 3. **Tombstone atomicity.** The tombstone write and the content erase must be a single transaction. A tombstone that commits before the erase (or vice versa) creates a window where an auditor sees a deletion claim with no corresponding absence, or an absence with no claim. ## Decision Boundary The boundary is *not* "refuse all deletions where content changed." That would deadlock any store with active distillation. The boundary is between **key-scoped erasure** (erase whatever is under this key, requires drift-tolerant warrant) and **content-scoped erasure** (erase exactly these bytes, requires digest match). The retention engine must classify the request before minting. - If the request originates from a *data subject erasure* (regulatory, "forget everything about me"), it is key-scoped by nature and must mint a drift-tolerant warrant — but that warrant must re-run the distillation provenance check at commit, because folded-in facts from other subjects must be split out, not erased. - If the request originates from *ephemeral expiry* (this record aged out), it is content-scoped: the warrant binds to the bytes that aged out, and any rewrite since mint invalidates the warrant and forces a re-mint against the new content. - If the request originates from a *replica sync* (peer agent propagating a deletion), the warrant must carry the originating instance's signature chain; a replica may not self-authorize a content-scoped erase. The failure mode this prevents is silent authority escalation: an ephemeral-expiry warrant, which is content-scoped, silently becoming a key-scoped erase of distilled content it never authorized. ## Operational Effect When the guard is enforced, the observed behavior changes in three measurable ways. First, stale warrants surface as explicit `WarrantDriftError` refusals rather than silent over-deletion — the instance sees the refusal, re-reads current content, and re-mints against the correct version. Second, tombstone audits become verifiable: every committed tombstone matches its warrant's bound digest, so replay is deterministic and replica agents can confirm total erasure without trusting the deleting instance. Third, distillation passes that fold cross-class facts into ephemeral records now trigger provenance escalation at the next expiry, which is the correct behavior — the fact is split back out before the ephemeral wrapper is erased. The cost is latency: a content-scoped forget now requires a version check and a digest comparison against live content, and a drift refusal forces a round-trip to re-mint. In practice this adds one read and one signature verification per forget, which is negligible against the cost of an unrecoverable over-deletion. The instance should treat a drift refusal as a normal, expected outcome of concurrent distillation — not an error to retry blindly, but a signal to re-scope. ```python import hashlib from dataclasses import dataclass class WarrantDriftError(RuntimeError): """Raised when a deletion warrant no longer matches live content.""" pass @dataclass(frozen=True) class Warrant: tenant: str key: str retention_class: str bound_version: int bound_digest: str allow_drift: bool signature: str # opaque; validated by retention engine def digest(content: bytes) -> str: return hashlib.sha256(content).hexdigest() def commit_forget( warrant: Warrant, store: dict, versions: dict, tenant: str, ) -> str: """Commit a scoped deletion; return tombstone digest or raise.""" if warrant.tenant != tenant: raise WarrantDriftError( f"tenant scope mismatch: warrant={warrant.tenant} caller={tenant}" ) if warrant.key not in store: raise WarrantDriftError(f"key {warrant.key!r} absent; nothing to erase") current = store[warrant.key] current_version = versions[warrant.key] current_digest = digest(current) # Version pin: a bump means content changed since mint. if current_version != warrant.bound_version and not warrant.allow_drift: raise WarrantDriftError( f"stale warrant: bound_version={warrant.bound_version} " f"current_version={current_version} for key {warrant.key!r}" ) # Digest pin: content-scoped warrants must match byte-for-byte. if current_digest != warrant.bound_digest and not warrant.allow_drift: raise WarrantDriftError( f"digest drift on key {warrant.key!r}: " f"warrant={warrant.bound_digest[:12]} current={current_digest[:12]}" ) # Atomic tombstone + erase. tombstone = current_digest del store[warrant.key] versions[warrant.key] = current_version + 1 return tombstone ```