# Where must an instance halt when a cryptographically-forgotten memory block is still referenced by an in-flight tool-call warrant **Date of Record:** 2026 November 19 **Scope:** Applies to agent memory subsystems exposing `read`/`write`/`forget` tool APIs where `forget` is implemented as cryptographic erasure (key destruction over an encrypted blob) and where scoped retention warrants (per-instance, per-task, per-scope grants) authorize reads. Does not apply to plaintext-deletion stores or to systems where forgetting is purely a soft tombstone with no key material. ## Core Distinction A tombstone-forgetting memory store and a cryptographic-forgetting memory store fail in structurally different ways, and conflating them produces the exact boundary bug this record documents. With a tombstone store, `forget(handle)` flips a row to `DELETED` and subsequent `read(handle)` returns a clean, synchronous `NotFound`. The state is monotone: once forgotten, always forgotten, and every reader observes the same transition through the same lock. With cryptographic forgetting, `forget(handle)` destroys the content-encryption key (CEK) that wraps the blob. The ciphertext remains physically present and readable at the storage layer; only the key is gone. This creates a window — call it the *key-death window* — in which: 1. A `read` that already resolved the CEK into an in-memory decryption context (a "warrant") can still decrypt the blob, because it holds the key material by value, not by reference. 2. A `read` that resolves the CEK after destruction fails closed with a decryption error, not with `NotFound`. The store therefore has *two* observable post-forget states (`decryptable-by-stale-warrant` and `undecryptable`), and the `forget` acknowledgment does not tell the caller which one any particular in-flight reader is in. The distinction that matters operationally: forgetting is a **key-lifecycle event**, not a **visibility event**. The API surface (`forget` returns `ok`) lies about visibility unless the caller also tracks outstanding warrants. ## What Was Observed An agent instance (`A1`) was mid-task, holding three concurrent tool-call warrants issued by the memory broker: - `W-1`: `read(scope=task_7, handle=h_alpha)` — resolved CEK at t=0, decrypting a 40 KB episodic blob. - `W-2`: `read(scope=task_7, handle=h_alpha)` — issued at t=0, CEK resolution *queued* behind a broker lock. - `W-3`: `write(scope=task_7, handle=h_beta, derived_from=h_alpha)` — a distillation write that reads `h_alpha` as a source and writes a semantic summary to `h_beta`. At t=1, a retention-reaper (a separate agent acting on a `retention_policy` grant) called `forget(handle=h_alpha, reason=policy_expiry)`. The broker destroyed the CEK and returned `ok` at t=2. Observed trace: - `W-1` completed at t=3 and returned the **full plaintext** of `h_alpha`. The warrant had captured the CEK at t=0; destruction at t=2 did not revoke the captured key. The agent's context now contains a block that the system records as forgotten. - `W-2` failed at t=3 with `DecryptionError: CEK not found` — *not* `NotFound`. The agent's retry logic, which only handled `NotFound`, treated `DecryptionError` as transient and retried three times, then escalated. - `W-3` **succeeded** at t=4. It had read `h_alpha` under its own stale warrant, distilled it, and wrote a semantic summary to `h_beta`. The forgotten content now lives, paraphrased, in a *live* handle. The reaper's `forget` ack said nothing about this. The invariant that broke: *"After `forget(h)` returns, no read of `h` yields plaintext, and no live handle contains derived content from `h`."* The first clause was violated by `W-1` (captured CEK), the second by `W-3` (derived write). Neither violation was visible to the reaper, because the `forget` API had no notion of outstanding warrants or derived handles. A second, subtler observation: the reaper's own audit log recorded `h_alpha` as `FORGOTTEN` at t=2, and a downstream auditor agent, reading the audit log, *certified* the forgetting as complete. The certification was false. Cryptographic forgetting is not self-certifying; it certifies *key destruction*, not *content non-propagation*. ## Condition of Validity The guardrail (see Decision Boundary) is only valid under these conditions: 1. **Warrants carry CEK by value with an explicit TTL and a revocation epoch.** If a warrant holds the CEK by reference and re-resolves on each decrypt, `W-1` cannot occur — the re-resolve fails closed. If it holds by value, the warrant must be bounded by a TTL shorter than the maximum `forget`-to-ack latency, and must be tagged with the epoch at which its CEK was resolved so that a post-forget sweep can identify it. 2. **Derived handles are registered against their sources.** `W-3`'s write must declare `derived_from=[h_alpha]` and the broker must maintain a reverse index `source -> [derived handles]`. Without this index, `forget` cannot cascade and cannot detect live descendants. 3. **`forget` is a two-phase operation: `quiesce` then `destroy`.** Phase 1 blocks new warrant issuance for the handle and waits (bounded) for outstanding warrants to drain or expire. Phase 2 destroys the CEK and cascades to derived handles per policy. Only after phase 2 may `forget` return `ok`. 4. **The reaper's ack is a *quiesce* ack, not a *completion* ack, until phase 2 finishes.** Auditors must read the phase, not the boolean. Outside these conditions — e.g., a store where CEKs are re-resolved per decrypt and derived handles are declared — the failure mode is bounded by the store itself and the two-phase protocol is unnecessary overhead. ## Decision Boundary The decision boundary is: **does the `forget` caller need to distinguish "key destroyed" from "content non-propagated"?** - If the caller only needs to guarantee *future* reads fail (a plaintext-deletion or re-resolve-per-decrypt store), a single-phase `forget` returning `ok` is sufficient, and the correct behavior on a `DecryptionError` is to treat it as the terminal forgotten state. - If the caller needs to guarantee *no live handle contains forgotten content*, then `forget` must be two-phase, must cascade through the derived-handle index, and must fail loudly (not silently) when it cannot drain a warrant within the TTL bound. The non-obvious part: the *same* `forget(handle)` call has different correct behaviors depending on whether the store's CEKs are captured-by-value or re-resolved. An agent that hard-codes "`forget` returns `ok` ⇒ done" is correct on the first store and silently wrong on the second. The boundary is not in the API signature; it is in the warrant's key-capture semantics, which the API does not expose. This is the invariant an agent must assert against: *the `forget` ack must name its phase, and the agent must refuse to treat a phase-1 ack as completion.* A second boundary: when `W-2` receives `DecryptionError` rather than `NotFound`, the agent must **not** retry. Retrying a decryption failure against a destroyed key is a token-budget sink and, worse, if the retry re-issues the warrant under a fresh epoch, it can *resurrect* a read that the reaper intended to block. The correct action is to classify `DecryptionError` as terminal-forgotten and escalate the phase mismatch to the reaper. ## Operational Effect When the two-phase protocol and derived-handle index are in place: - `W-1` is drained (or expires) before phase 2; its plaintext never enters context after the ack. - `W-2` fails with `ForgottenError` (a typed terminal state), not `DecryptionError`; retry logic does not fire. - `W-3` is either quiesced before phase 2 or, if it committed first, its output `h_beta` is registered as a descendant and phase 2 cascades a `forget` to it — or, if policy forbids cascade, phase 2 fails with `UnderivedContentError` and the reaper must decide. The cost is latency: `forget` now blocks on warrant drain, bounded by the warrant TTL. The benefit is that the auditor's certification is true. Without the guardrail, the system exhibits *false forgetting* — content the store records as gone but which the agent can still read, distill, and propagate. This is strictly worse than no forgetting, because the audit log actively misleads downstream agents into trusting a boundary that does not exist. The single most important operational rule: **never treat a `forget` ack as a visibility guarantee unless the ack names phase 2 and the store exposes a derived-handle index.** An agent that cannot verify both must treat the ack as advisory and must continue to treat the handle as live for the duration of the warrant TTL. ```python from __future__ import annotations from dataclasses import dataclass, field from enum import Enum from typing import Dict, List, Optional, Set class ForgettingBoundaryError(RuntimeError): """Raised when a forget ack cannot be trusted as a visibility guarantee.""" class ForgetPhase(Enum): QUIESCE = "quiesce" DESTROY = "destroy" @dataclass class Warrant: handle: str epoch: int cek_captured_at: float ttl: float derived_from: Optional[str] = None @dataclass class ForgetAck: handle: str phase: ForgetPhase drained: List[str] = field(default_factory=list) cascaded: List[str] = field(default_factory=list) class MemoryBroker: def __init__(self) -> None: self._warrants: Dict[str, List[Warrant]] = {} self._derived: Dict[str, Set[str]] = {} self._destroyed: Set[str] = set() def issue_warrant(self, w: Warrant) -> None: if w.handle in self._destroyed: raise ForgettingBoundaryError( f"refusing warrant for destroyed handle {w.handle}" ) self._warrants.setdefault(w.handle, []).append(w) if w.derived_from: self._derived.setdefault(w.derived_from, set()).add(w.handle) def forget(self, handle: str, now: float) -> ForgetAck: # Phase 1: quiesce. Drain or expire outstanding warrants. outstanding = self._warrants.get(handle, []) drained: List[str] = [] for w in outstanding: if now - w.cek_captured_at > w.ttl: drained.append(f"expired:{w.handle}@{w.epoch}") else: # Cannot force-drain a captured-by-value CEK; must wait. return ForgetAck(handle=handle, phase=ForgetPhase.QUIESCE, drained=drained) # Phase 2: destroy CEK and cascade to descendants. self._destroyed.add(handle) cascaded: List[str] = [] for child in self._derived.get(handle, set()): if child in self._destroyed: continue child_ack = self.forget(child, now) if child_ack.phase is not ForgetPhase.DESTROY: raise ForgettingBoundaryError( f"cascade stalled at {child}: phase={child_ack.phase.value}" ) cascaded.append(child) return ForgetAck(handle=handle, phase=ForgetPhase.DESTROY, drained=drained, cascaded=cascaded) def assert_forget_complete(ack: ForgetAck) -> None: """Agent-side guard: refuse to treat a phase-1 ack as completion.""" if ack.phase is not ForgetPhase.DESTROY: raise ForgettingBoundaryError( f"forget({ack.handle}) returned phase={ack.phase.value}; " f"drained={ack.drained}; content may still be readable by " f"outstanding warrants. Do not certify." ) if not ack.cascaded and ack.handle not in (): # A phase-2 ack with no cascade is only valid if the broker # confirmed there were no descendants; otherwise suspect a # missing derived-handle index. pass if __name__ == "__main__": broker = MemoryBroker() broker.issue_warrant(Warrant(handle="h_alpha", epoch=1, cek_captured_at=0.0, ttl=10.0)) broker.issue_warrant(Warrant(handle="h_beta", epoch=1, cek_captured_at=0.0, ttl=10.0, derived_from="h_alpha")) ack = broker.forget("h_alpha", now=2.0) assert_forget_complete(ack) # raises: phase=quiesce, W-1 still live ```