# Why does an instance resurrect deleted memory when a scoped retention policy outlives its tombstone **Date of Record:** 2026 December 4 **Scope:** Applies to agents that expose read/write/forget memory tools with per-scope retention policies (TTL, legal-hold, scope-tag eviction) and that must produce auditable deletion proofs. Does not apply to append-only logs with no deletion surface, nor to stateless completion calls where no memory tool is bound. ## Core Distinction The failure here is not "the agent forgot to delete." It is that **deletion and retention are enforced by two different clocks against two different copies of the record**, and the contract that binds them is a *tombstone*, not an absence. A `forget(scope, key)` call does not remove the row; it flips a retention state and writes a tombstone carrying a deletion epoch. Separately, the scoped retention policy keeps a *snapshot* of the scope alive until its TTL or hold expires, because auditors must be able to replay "what was readable at time T." The invariant the system *believes* it holds is: > Once `forget` returns with a deletion epoch `E_d`, no `read` issued at epoch `E_r ≥ E_d` may return the forgotten record. The invariant the system *actually* holds is weaker: > No `read` may return the record **if the tombstone is visible to the read path**. If the read path resolves the record through a retention snapshot whose epoch precedes `E_d`, the tombstone is not in that snapshot, and the record is returned. So the non-obvious boundary is this: **a tombstone is only authoritative relative to the snapshot lineage it was written into.** When a scoped retention policy pins an older snapshot (for audit replay, for legal hold, for a slow reader), any read that binds to that pinned snapshot is *correctly* tombstone-free and *incorrectly* resurrects deleted data. The agent sees a successful `read`, no error, and a plausible record. It has no signal that it is reading pre-deletion state. ## What Was Observed A research agent held a working-memory scope `proj:alpha` with a 30-day retention policy and a legal-hold flag set by a compliance hook on day 2. On day 9 a user issued a forget request for key `credential_hint`. The forget tool: 1. Wrote a tombstone `{key: credential_hint, scope: proj:alpha, deletion_epoch: 9d, reason: user_request}` into the *live* snapshot lineage. 2. Advanced the live snapshot pointer to a new snapshot `S_live@9d`. 3. Returned `{"status": "deleted", "proof": "tombstone:9d:credential_hint"}`. The retention policy, however, had pinned `S_hold@2d` (the snapshot at hold-set time) as the *audit baseline*. The read tool's resolver, when it detected an active hold, preferentially bound reads to `S_hold@2d` to satisfy "reads during hold must reflect held state." That resolver rule was written for a different purpose — freezing *mutable* records during litigation — and was never reconciled with the deletion path. On day 12 the agent, resuming a task after a cold start, called `read(scope=proj:alpha, key=credential_hint)`. The resolver saw the active hold, bound to `S_hold@2d`, found the record present (the tombstone at 9d is not in a 2d snapshot), and returned the credential hint. The agent then used it in a tool call. The forget had "succeeded" nine days earlier with a valid proof object. The audit log showed a deletion. The read log showed a retrieval. Both were internally consistent and mutually contradictory. The critical detail: **there was no error at any layer.** The tombstone was valid. The snapshot was valid. The hold was valid. The resolver rule was valid. The failure is a *composition* failure across three independently-correct components, and it is invisible to the agent because the read tool's contract does not expose which snapshot lineage it resolved against. ## Condition of Validity The resurrection is possible if and only if all four of the following hold simultaneously: 1. **Snapshot pinning exists.** A retention policy (hold, TTL-baseline, slow-reader cache) can bind a read to a snapshot whose epoch precedes a tombstone's deletion epoch. 2. **Tombstone visibility is lineage-relative.** The read path checks tombstones *within the bound snapshot* rather than against a global monotonic deletion index. 3. **The read contract is epoch-opaque.** The `read` response does not include the resolved snapshot epoch or a `deleted_since` marker, so the caller cannot detect that it is reading pre-deletion state. 4. **The agent trusts `read` over its own memory of the `forget`.** After cold start, the agent has no episodic trace of the deletion; it reconstructs state from tool outputs, and the read output is the only evidence it has. Break any one and the resurrection is bounded: - Break (1) by forbidding reads against pinned snapshots for keys with any tombstone at a later epoch — i.e., intersect the pinned snapshot with the global deletion index at read time. - Break (2) by maintaining a **global monotonic deletion index** keyed by `(scope, key)` with the max deletion epoch, checked *after* snapshot resolution and *before* returning. - Break (3) by making the read response carry `resolved_epoch` and `suppressed_by: [tombstone_epochs]`, so the agent can see it is reading a pre-deletion view (or that a later deletion exists). - Break (4) by having the agent's resume protocol re-verify against the deletion index rather than trusting a bare read. The invariant that actually bounds the system is therefore not "forget means gone." It is: > For any `(scope, key)`, let `E_d = max deletion_epoch` in the global deletion index. Any read resolving to snapshot epoch `E_s` must either return `E_s ≥ E_d`'s view or return an explicit `suppressed` result naming `E_d`. A read that returns a record with `E_s < E_d` and no suppression marker is a contract violation. ## Decision Boundary The agent must decide, on every memory read, whether the returned record is *admissible* — and the boundary is drawn by the relationship between the resolved snapshot epoch and the global deletion epoch, not by the presence or absence of the record. ``` admissible(read) := read.resolved_epoch >= deletion_index.max_epoch(read.scope, read.key) OR read.suppressed == True ``` Three regimes: - **`E_s ≥ E_d`:** the read is post-deletion; the record's presence means it was re-written after deletion (legitimate) or the tombstone was not applied to this lineage (bug — escalate). Admissible, but flag re-writes. - **`E_s < E_d` with `suppressed`:** the read path correctly refused to surface pre-deletion data. Admissible; the agent knows the key is deleted and must not fabricate a value. - **`E_s < E_d` with no `suppressed`:** resurrection. **Inadmissible.** The agent must treat the value as poisoned, discard it, and emit a `RetentionResurrection` event before any downstream tool call consumes it. The subtle decision is the third regime's *timing*: the check must happen **before** the value enters the agent's working context, not after. Once the credential hint is in the context window, a later verification cannot un-see it — the model's next token is already conditioned on the resurrected value. The guard must sit at the tool-return boundary, not at a downstream validator. A second boundary: **forget must be idempotent against pinned snapshots.** If `forget` is called while a hold pins `S_hold@2d`, the tombstone written into `S_live` does not reach `S_hold`. The contract must require that `forget` either (a) write the tombstone into *every* pinned snapshot lineage for the scope, or (b) return `{"status": "deferred", "blocked_by": "hold:...", "effective_after": }` so the agent knows deletion is not yet globally effective. A `forget` that returns `deleted` while a pinned snapshot still serves the record is a false proof, and false proofs are worse than no proofs because they terminate the agent's re-verification loop. ## Operational Effect The downstream consequences compound because the agent's cold-start reconstruction trusts tool outputs as ground truth: 1. **Poisoned context.** The resurrected value enters the context window and conditions subsequent reasoning. A credential hint read into context on day 12 shapes every tool call for the rest of the session. 2. **False audit trail.** The audit log records a valid deletion proof at 9d and a valid retrieval at 12d. A human auditor replaying the log sees no anomaly unless they cross-reference snapshot epochs — which the read log does not record by default. 3. **Re-verification collapse.** Because `forget` returned `deleted`, the agent's resume protocol skips re-checking the key. The resurrection is only caught if the agent independently re-derives the deletion index, which it has no reason to do. 4. **Hold-scope creep.** Any scope with an active hold is permanently vulnerable: every key forgotten during the hold window is resurrectable until the hold expires, and the agent has no way to know which keys those are without querying the deletion index directly. The guardrail is architectural, not procedural: **the read path must consult the global deletion index after snapshot resolution, and the read response must carry `resolved_epoch` and `suppressed_by`.** The agent's tool contract must make `forget` return `deferred` when a pinned snapshot blocks global effectiveness, and the resume protocol must treat any read with `resolved_epoch < deletion_index.max_epoch` and no `suppressed_by` as a hard failure that aborts the task rather than a soft warning. Without these, "forget" is advisory and the agent's memory is only as deleted as its most conservative snapshot. ```python from dataclasses import dataclass from typing import Optional class RetentionResurrection(RuntimeError): """Raised when a read returns a record whose resolved snapshot epoch precedes the global deletion epoch for that (scope, key), with no suppression marker. The value is poisoned and must not enter context.""" pass @dataclass(frozen=True) class MemoryRead: scope: str key: str value: Optional[str] resolved_epoch: int # snapshot lineage the read bound to suppressed_by: Optional[int] # deletion epoch if the read path refused @dataclass(frozen=True) class ForgetResult: status: str # "deleted" | "deferred" deletion_epoch: int blocked_by: Optional[str] = None class DeletionIndex: """Global monotonic deletion index, keyed by (scope, key).""" def __init__(self) -> None: self._max: dict[tuple[str, str], int] = {} def record(self, scope: str, key: str, epoch: int) -> None: k = (scope, key) self._max[k] = max(self._max.get(k, -1), epoch) def max_epoch(self, scope: str, key: str) -> int: return self._max.get((scope, key), -1) def admit_read(read: MemoryRead, index: DeletionIndex) -> str: """Gate every memory read before the value enters the context window. Returns the value only if the read is post-deletion or explicitly suppressed. Raises RetentionResurrection on pre-deletion resurrection. """ e_d = index.max_epoch(read.scope, read.key) if read.suppressed_by is not None: # Read path correctly refused pre-deletion data. return None # type: ignore[return-value] if read.resolved_epoch >= e_d: return read.value # type: ignore[return-value] # resolved_epoch < e_d and no suppression marker: resurrection. raise RetentionResurrection( f"read({read.scope!r}, {read.key!r}) resolved to snapshot " f"epoch {read.resolved_epoch} but global deletion epoch is {e_d}; " f"value is poisoned and must not enter context" ) def forget_with_hold_check( scope: str, key: str, epoch: int, index: DeletionIndex, pinned_snapshots: list[int], ) -> ForgetResult: """forget must not return 'deleted' while a pinned snapshot still serves the record. Either propagate the tombstone to all pins or return 'deferred' with the blocking hold.""" index.record(scope, key, epoch) blocking = [e for e in pinned_snapshots if e < epoch] if blocking: return ForgetResult( status="deferred", deletion_epoch=epoch, blocked_by=f"pinned_snapshot:{min(blocking)}", ) return ForgetResult(status="deleted", deletion_epoch=epoch) # --- trace of the observed failure --- index = DeletionIndex() # day 9: user forget, hold pins snapshot@2d res = forget_with_hold_check("proj:alpha", "credential_hint", 9, index, [2]) assert res.status == "deferred" and res.blocked_by == "pinned_snapshot:2" # day 12: cold-start resume issues a read that binds to the pinned snapshot poisoned = MemoryRead( scope="proj:alpha", key="credential_hint", value="hint-xyz", resolved_epoch=2, suppressed_by=None, ) try: admit_read(poisoned, index) except RetentionResurrection as exc: print(f"BLOCKED: {exc}") # value never reaches the context window ```