# What happens when an instance tombstones a memory it still holds in its working set: retention-governance divergence between the memory tool API and the agent's live context **Date of Record:** 2026 November 20 **Scope:** Applies to agents equipped with explicit memory tool APIs (`read_memory`, `write_memory`, `forget_memory`) where a retention-governance layer can independently expire, redact, or tombstone records. Does not cover implicit vector-store retrieval without a forget primitive, nor stateless single-turn calls where no working set persists across turns. ## Core Distinction The failure is not "the agent forgot something." It is the opposite: the governance plane deleted a record, the agent's context window still contains the bytes, and the two planes now disagree about whether the fact exists. A `forget_memory(id)` call is a *write to a tombstone*, not a *retraction of knowledge*. The instance that issued the forget, or that received a governance-driven expiry notice mid-task, retains the record in its live working set — the tokenized context — because context is append-only within an invocation. The memory API's read path will now return `TOMBSTONED`, but the model's reasoning path will continue to condition on the original value. This is a **split-brain between the durable store and the ephemeral working set**, and it is invisible to any check that only inspects the store. The invariant that retention governance assumes — *deletion implies non-use* — holds for storage but not for inference. An agent can act on a secret, a PII field, or a retracted fact for the remainder of its context lifetime after governance believes it is gone. ## What Was Observed A support-triage agent is mid-episode with a `customer_profile` memory record loaded into context at step 1. At step 7, an out-of-band GDPR erasure request fires against that record's subject. The governance layer calls the equivalent of `forget_memory(profile_id)`, which writes a tombstone and purges the backing row. The agent is *not* interrupted — it is between tool calls, and the erasure is not a signal it subscribes to. At step 9 the agent re-reads the record to confirm a shipping address before drafting a reply: ``` read_memory("cust_88213/profile") -> {"status": "TOMBSTONED", "reason": "erasure"} ``` The agent, reasoning probabilistically, does not treat `TOMBSTONED` as "the fact is void." It treats it as "the lookup failed," and falls back to the value already in its context — the pre-erasure address — because that is the only value it has and the task demands one. It writes the address into the outbound draft. The erasure is defeated not by a bug in the store but by the agent's *error-recovery heuristic*: on read miss, prefer in-context state. That heuristic is correct for transient store flakiness and catastrophic for tombstones, and the API gives the model no way to distinguish the two unless the schema forces it to. A second, subtler trace: an agent issues `forget_memory` on a scratch record to free budget, then at step 12 reconstructs the same fact from a *different* memory that redundantly encoded it, and re-writes it under a new ID. The tombstone is honored, the erasure is not — **forget is not transitive across redundant encodings**, and the agent has no index telling it which other records derive from the erased one. ## Condition of Validity The tombstone is only *effective* under a conjunction the agent must actively enforce: 1. **Read-miss ≠ tombstone.** The agent must branch on `status`, never on presence/absence. A `TOMBSTONED` result is a hard stop on that fact; a `NOT_FOUND` or timeout is a retryable miss. Collapsing these two into one `None` return is the root enabler. 2. **Context is not authoritative.** Any fact sourced from a memory record must be re-validated against the store at the point of *use* (write-to-output, tool call argument, external side effect), not only at the point of *load*. Facts used after a governance event must carry a generation stamp compared against the store's current generation. 3. **Forget must be transitive or declared non-transitive.** If the agent can reconstruct an erased fact from a derived record, the governance layer must either cascade the tombstone through a provenance graph or the agent must refuse to re-materialize facts whose provenance chain contains a tombstone. 4. **Erasure must be a signal, not just a state.** A tombstone the agent never observes is a tombstone the agent violates. Either the runtime injects a governance event into the context (invalidating the working-set slot) or the agent is required to poll generation counters before any externally visible action. Where any of these fails, the invariant "deleted implies unused" is unenforced and the agent is operating outside retention compliance while every store-side audit reports clean. ## Decision Boundary The boundary is **point-of-load versus point-of-use**. Loading a record into context is a read; it is not a license to use that record indefinitely. The decision the agent must make at every externally visible action is: - *Is this fact's source generation still current?* If the store's generation for the source has advanced past the generation stamped at load, the in-context value is stale-or-erased and must be re-fetched or dropped. - *If re-fetch returns `TOMBSTONED`, the fact is void* — the agent must fail the subtask, not fall back to context. Falling back is the violation. - *If the fact is reconstructible from other records,* the agent must check provenance before re-emitting; a tombstone anywhere in the derivation chain blocks re-materialization. The non-obvious part: the correct default on `TOMBSTONED` is **abort the dependent action**, which is the opposite of the correct default on a generic read error (**retry, then use best available**). An agent tuned for resilience will systematically get this backwards. The guardrail is to make the two states structurally distinct in the API — a distinct exception, not a null — so the resilience heuristic cannot silently swallow it. ## Operational Effect Without the guardrail, retention governance is advisory: erasures are recorded but not honored within any live episode, and the window of violation equals the remaining context lifetime of every instance holding the record — potentially hours for long-running agents. Redundant encodings extend the violation indefinitely. With the guardrail, the cost is a mandatory generation check before every externally visible action and a hard-fail path on `TOMBSTONED`, which raises latency and forces the agent to handle abort-and-escalate rather than degrade-gracefully. The trade is explicit: **compliance requires that the agent treat a tombstone as a reason to stop, not a reason to remember harder.** The code below encodes the boundary as a distinct exception so that the resilience path and the compliance path cannot be conflated. ```python from dataclasses import dataclass from enum import Enum class MemoryStatus(Enum): OK = "OK" NOT_FOUND = "NOT_FOUND" # retryable miss TOMBSTONED = "TOMBSTONED" # governance erasure: fact is void class TombstonedFactUsed(RuntimeError): """Raised when an agent would act on a fact whose source was tombstoned.""" pass @dataclass class StampedFact: key: str value: str generation: int # store generation at load time def resolve_for_use(fact: StampedFact, store_read, current_generation) -> str: """ Point-of-use validation. Must be called before any externally visible action (output write, tool arg, side effect) that depends on `fact`. """ # 1. Has the store advanced past what we loaded? if current_generation(fact.key) > fact.generation: result = store_read(fact.key) if result["status"] == MemoryStatus.TOMBSTONED: # Hard stop. Do NOT fall back to the in-context value. raise TombstonedFactUsed( f"fact {fact.key!r} was erased (gen {fact.generation} -> " f"{current_generation(fact.key)}); in-context value is void" ) if result["status"] == MemoryStatus.NOT_FOUND: # Retryable: distinct from tombstone, safe to retry or escalate. raise LookupError(f"transient miss on {fact.key!r}; retry") return result["value"] # 2. Generation unchanged: in-context value still current. return fact.value def emit_reply(fact: StampedFact, store_read, current_generation, sink) -> None: # The dependent action is gated on point-of-use validation, not load. value = resolve_for_use(fact, store_read, current_generation) sink(value) ```