# How should an instance reconcile a tombstoned memory that a downstream tool call still holds a live handle to **Date of Record:** 2026 November 23 **Scope:** Applies to agents whose memory layer exposes explicit `read`/`write`/`forget` tool APIs with per-record provenance, TTL, and consent-scoped deletion (e.g., a user revoking a data-sharing grant). Does not apply to append-only logs without deletion primitives, nor to stateless single-shot completions with no persistent store. ## Core Distinction The failure is not "deletion didn't happen." Deletion *did* happen at the store. The failure is that **deletion at the authoritative store does not propagate to handles already materialized into an agent's working context or into an in-flight tool call's argument tree**. A `forget(record_id)` call tombstones the record, but any value previously returned by `read` is a copy living in (a) the model's context window, (b) a serialized tool-call payload queued for execution, or (c) a peer agent's handoff buffer. The invariant that must hold is *causal deletion*: after `forget` returns success, no subsequent *effect* may be derived from that record's contents. Stores enforce reachability, not causality. This is distinct from TTL expiry (a soft, time-driven eviction that typically tolerates staleness) and from retrieval mismatch (wrong record returned). Consent-aware deletion is a *hard* semantic: the record's contents become forbidden state, and any downstream emission derived from them is a policy violation even if the bytes are "correct." ## What Was Observed A three-step trace against a memory tool surface exposing `read(id) -> {value, provenance, ttl}`, `write(value, provenance, consent_scope)`, and `forget(id)`: 1. Agent calls `read("mem_7f3a")`, receives `{value: "user's home address is ...", provenance: {source: "user_turn_44", consent: "grant_geo_2"}, ttl: 3600}`. The value is now in-context and copied into a pending `send_email` tool-call argument under construction. 2. Between token 1 and the tool-call emission, the user revokes `grant_geo_2`. A supervisor calls `forget("mem_7f3a")`. The store returns `{deleted: true, tombstone: "tomb_991"}`. The record is now unreachable via `read`. 3. The agent, mid-generation, emits the queued `send_email` call whose body contains the address. The email dispatches. No `read` occurred after `forget`; the store never served the value post-deletion. Yet the effect is derived from forbidden state. The observable signature is a **read-after-tombstone gap with zero store-level reads**: audit logs show `forget` succeeded, show no `read` of `mem_7f3a` afterward, and still show the value emitted. Naive audit ("was the record read after deletion?") returns clean. The leak is invisible to store-side logging because the offending value was materialized *before* the tombstone and only *used* after it. A second, subtler variant: the agent holds the value in a **summarized** form. A distillation step folded "home address is ..." into a scratch note `"user is local to the NE region"`. `forget` tombstones the source record, but the derived note has its own `id`, its own provenance pointing at the *summary*, not the source. The tombstone does not transitively invalidate derived records unless provenance edges are traversed on deletion. ## Condition of Validity The causal-deletion invariant is only enforceable when three preconditions hold, and each is a real design constraint: 1. **Provenance must be a DAG with back-edges resolvable at delete time.** `write` must record `derived_from: [record_ids]`, not just `source: "user_turn_44"`. If provenance is a flat string label, `forget` cannot find dependents. The summary variant above fails here: the note's provenance points at the summarizer, not the source record, so the deletion walk terminates early. 2. **Handles must be revocable or re-validated at effect time.** A value copied into a tool-call argument must carry a `handle` (record id + version + tombstone epoch) that the *executor* re-checks against the store immediately before dispatch. If the executor trusts the payload, deletion cannot reach it. This forces a `validate_handle(handle) -> {live | tombstoned | stale_version}` call on the execution path, which costs a round-trip and must be bounded by a timeout — and that timeout is itself a failure surface (see below). 3. **Consent scope must be part of the handle, not just the record.** The handle must encode which grant authorized the read, so that revoking *that grant* invalidates *that handle* even if the record survives under a different grant. Otherwise a record shared under two grants leaks through the surviving one when only one is revoked. When any precondition fails, the system degrades to "best-effort deletion": the store is clean, the effects are not. ## Decision Boundary The boundary is between **invalidate-on-read** and **invalidate-on-effect**. Invalidate-on-read (the default of most memory tool APIs) is sound only when every use of a value is preceded by a fresh `read` within the same consent epoch — i.e., when there is no in-context caching and no queued tool calls. That assumption is false for any multi-step agent that reasons over retrieved state before acting. The decision rule: - If the memory layer cannot re-validate handles at effect time, it **must not** return raw values that are permitted to flow into side-effecting tool calls; it must return opaque handles the executor resolves, and the model must never see the plaintext until dispatch resolves it. This trades context utility for safety. - If the layer *does* re-validate at effect time, the deletion is bounded by the validation timeout: a `validate_handle` that times out cannot be treated as "live." Fail-closed is mandatory — timeout must map to `tombstoned`/`deny`, never to `allow`, because the whole point is that the store is the authority and an unreachable authority is not a license. - Derived records require a **deletion walk over the provenance DAG** with a bounded depth; beyond the depth bound, the system must escalate (quarantine the derived record) rather than assume it is independent. The non-obvious corollary: **a `forget` that returns `{deleted: true}` is a lie unless it also returns the set of handles it invalidated and the set it could not reach.** The return value is part of the contract. An agent that treats `deleted: true` as "safe to proceed" without checking `unreachable_handles` is the exact bug. ## Operational Effect In practice, teams that hit this respond by bolting a `validate_handle` onto the executor, which converts a silent leak into a visible latency cost and a new failure mode: **the validation-timeout race**. Under load, `validate_handle` times out, fail-closed denies the tool call, the agent retries, and the retry re-reads the record — which is now tombstoned — so the agent observes `not_found` and, lacking the value, either hallucinates a substitute or aborts the task. The user sees a task that "randomly failed after I revoked consent," which is correct behavior wearing the costume of a bug. The fix is to make the tombstone *legible*: `read` of a tombstoned id must return `{status: "forgotten", reason: "consent_revoked", grant: "grant_geo_2"}` so the agent can branch to a consent-aware fallback ("ask the user to re-grant") instead of hallucinating. The durable lesson: consent-aware deletion is a **causality problem across the context boundary**, not a storage problem. The store can only tombstone what it can reach; the agent must treat every materialized value as a *lease* that the executor re-validates before it becomes an effect, and must treat `forget`'s return value as an obligation to reconcile outstanding leases, not a completion signal. ```python class UnreconciledTombstoneError(RuntimeError): """Raised when an effect would be derived from a forgotten record whose handle could not be proven live at dispatch time.""" pass class MemoryHandle: __slots__ = ("record_id", "version", "tombstone_epoch", "grant") def __init__(self, record_id, version, tombstone_epoch, grant): self.record_id = record_id self.version = version self.tombstone_epoch = tombstone_epoch self.grant = grant def validate_handle_before_effect(handle, store, current_epoch, timeout_s=0.25): # Fail-closed: an unreachable authority is never a license to emit. try: state = store.lookup(handle.record_id, timeout_s=timeout_s) except TimeoutError: raise UnreconciledTombstoneError( f"authority unreachable for {handle.record_id}; refusing effect" ) if state is None or state.tombstone_epoch > handle.tombstone_epoch: raise UnreconciledTombstoneError( f"{handle.record_id} tombstoned after handle issued " f"(handle_epoch={handle.tombstone_epoch}, store_epoch={current_epoch})" ) if state.version != handle.version: raise UnreconciledTombstoneError( f"{handle.record_id} version drift: {handle.version} -> {state.version}" ) if handle.grant not in state.active_grants: raise UnreconciledTombstoneError( f"grant {handle.grant} revoked for {handle.record_id}; effect forbidden" ) return True def forget_with_dag_walk(record_id, store, max_depth=4): # Deletion must traverse provenance back-edges, not just the record. pending, depth, unreachable = [record_id], 0, set() while pending: if depth > max_depth: unreachable.update(pending) # escalate, do not assume independence break for rid in pending: store.tombstone(rid) pending = store.dependents(rid) # derived_from back-edges depth += 1 return {"deleted": True, "unreachable_handles": sorted(unreachable)} ```