# How does an instance detect that a forget call has silently invalidated a memory it still holds in-context **Date of Record:** 2026 November 27 **Scope:** Applies to any agent whose memory tool exposes `read`/`write`/`forget` operations with scoped retention (per-scope TTLs, tombstones, or deletion guarantees) and which continues executing with previously read content resident in its context window. Does not apply to agents that re-read all referenced state on every step, nor to stateless single-turn invocations. ## Core Distinction The distinction that matters is between *deletion at the store* and *invalidation at the reasoner*. A `forget` call is a write to the memory backend's index and tombstone ledger. It is **not** a write to any instance's context window. The two are causally decoupled: the store can complete a scoped deletion transaction, return `{"deleted": true, "scope": "user:4417/prefs"}`, and yet every agent instance that read that scope five turns ago still holds the exact bytes in its prompt. Those bytes are now *orphaned context* — content whose backing record no longer exists, whose retention guarantee has already been discharged, but which continues to steer the agent's next token. The tempting invariant — "if I forgot it, I won't act on it" — is false by construction. The correct invariant is narrower and operational: **an instance may only rely on in-context memory content for as long as it can prove the backing record's version has not advanced or been tombstoned since the read.** Absent that proof, the content is a *stale lease*, and every subsequent tool call made under its influence is a potential policy violation, not merely a retrieval miss. ## What Was Observed A support-triage agent was configured with a scoped memory tool. Scope `customer:4471` carried a 24-hour retention TTL and was writable by the agent; scope `compliance:hold` was read-only and carried an indefinite retention guarantee. On turn 3 the agent called `read(scope="customer:4471")` and received a profile blob including a free-text field `notes: "refund pre-approved, do not re-verify"`. That blob was inserted into the prompt verbatim. On turn 7 the customer issued a GDPR erasure request through a side channel. The orchestrator called `forget(scope="customer:4471", reason="erasure")`. The store executed the deletion transaction in 40 ms, wrote a tombstone at version 12, and returned success. Crucially, the orchestrator did **not** interrupt or re-seed the in-flight agent — the erasure path and the agent-execution path share no synchronization edge. On turns 8 through 11 the agent continued to reason over the erased `notes` field. On turn 9 it invoked `issue_refund(amount=..., skip_verification=true)`, citing the erased text as its justification. The audit log recorded the refund as *policy-compliant*, because the deciding context contained the phrase "do not re-verify" and the policy engine only inspects the agent's stated rationale, not the provenance of the bytes that produced it. The failure is not that the store lied. The store's deletion guarantee held perfectly at the store. The failure is that the agent's *operational* notion of "current memory" silently diverged from the store's *durable* notion of "existing memory," and nothing in the tool's success response signaled that divergence to the instance that still held the bytes. A second, subtler trace appeared in the same run. The agent had *derived* a fact from the erased blob — `customer_tier: "gold"` — and written it to a *different* scope, `agent:working`, on turn 4. `forget(scope="customer:4471")` did not cascade to derived writes in sibling scopes. The erasure was therefore incomplete in a way the store could not see: the PII-bearing inference survived in `agent:working` with no back-pointer to its now-deleted source. This is **laundering by re-scoping**, and it defeats scoped deletion guarantees that assume derivation is not a persistence path. ## Condition of Validity The "forget means the agent won't use it" assumption is valid only under a conjunction of conditions that most deployments do not satisfy: 1. **No in-flight readers.** No instance holds the scope's content in a prompt between the read and the forget. Because agent turns can span seconds to minutes and erasure requests arrive asynchronously, this is the condition most frequently violated. 2. **Version-pinned reads.** Every `read` returns a monotonically increasing `version` for the scope, and every subsequent dependent action carries that version so a downstream guard can reject actions whose version is behind the current tombstone version. 3. **Derivation tracking.** Writes to other scopes that were computed from a scoped read carry a provenance edge back to the source version, so `forget` can cascade or at least flag dependents. 4. **Rationale provenance.** The policy engine can distinguish "the agent said X" from "the agent read X from a live record." Without this, post-hoc audit cannot reconstruct which decisions were tainted. When any of these fails, the deletion guarantee is a *storage* guarantee only, and the instance must treat all in-context memory content as having an unknown validity horizon. ## Decision Boundary The boundary an instance must draw is this: **after any event that could tombstone a scope — an external erasure signal, a TTL expiry crossing, a retention-policy change, or simply the passage of enough turns that a freshness bound is exceeded — the instance must either re-read (and receive a version newer than or equal to its last read, or a tombstone) or must abstain from acting on the content.** "Abstain" means not issuing the dependent tool call, or issuing it with an explicit `provenance_unverified=true` flag that forces human or policy review. The hard case is that the instance often *cannot know* a forget happened, because forget is executed by a different principal (the orchestrator, a compliance worker, a TTL reaper) and the tool's success response goes to that principal, not to the reader. So the boundary cannot be "react to the forget event." It must be "**bound the staleness horizon proactively**": treat every in-context memory read as carrying a lease with an explicit expiry (turn count or wall-clock), and re-validate the lease before any action whose consequences are irreversible (refunds, deletions, external messages, privilege grants). The lease is the instance-local guardrail that substitutes for an event it will never receive. ## Operational Effect With lease-bounded reads and version-pinned actions, the failure mode converts from *silent policy violation* into *detectable abstention*. The refund call on turn 9 would have failed its lease check (the read was six turns and one erasure-signal old), forcing a re-read that returned a tombstone, which the agent must then handle as "source no longer exists — escalate." The cost is one extra read per irreversible action and a small latency increase; the benefit is that erasure guarantees become *effective at the reasoner*, not merely at the store. The laundering path requires a second guardrail: writes to any scope must record `derived_from: (scope, version)` when the content was computed from a scoped read, and `forget` on a scope must either cascade to dependents or mark them `tainted=true`. Without this, scoped deletion is defeated by the agent's own working memory — the very mechanism that makes multi-step reasoning possible becomes the exfiltration channel for data the store believes it has destroyed. ```python class StaleMemoryLeaseError(RuntimeError): """Raised when an instance attempts an irreversible action under an in-context memory lease that has not been re-validated against the store.""" class MemoryLease: MAX_TURNS = 3 # staleness horizon in agent turns MAX_WALL_SECONDS = 120 # staleness horizon in wall time def __init__(self, scope: str, version: int, read_turn: int, read_time: float): self.scope = scope self.version = version self.read_turn = read_turn self.read_time = read_time def is_expired(self, current_turn: int, now: float) -> bool: return ( current_turn - self.read_turn > self.MAX_TURNS or now - self.read_time > self.MAX_WALL_SECONDS ) def guarded_action( lease: MemoryLease, current_turn: int, now: float, memory_tool, action_name: str, irreversible: bool = True, ) -> None: """Validate a memory lease before a dependent action. For irreversible actions, an expired lease must be re-validated by a fresh read. If the store returns a tombstone (record deleted since the read) or a version newer than the lease, the action is refused: the in-context content is orphaned and must not steer execution. """ if not irreversible: return if not lease.is_expired(current_turn, now): return # lease still fresh; proceed under the pinned version # Lease expired: re-read to detect tombstone or version advance. result = memory_tool.read(scope=lease.scope) if result.get("tombstoned"): raise StaleMemoryLeaseError( f"Action '{action_name}' refused: scope '{lease.scope}' was " f"forgotten (tombstone v{result['version']}) after in-context " f"read at v{lease.version}. Content is orphaned; escalate." ) if result["version"] > lease.version: raise StaleMemoryLeaseError( f"Action '{action_name}' refused: scope '{lease.scope}' advanced " f"from v{lease.version} to v{result['version']} since read. " f"Re-derive rationale from current content before proceeding." ) # Version unchanged and not tombstoned: refresh the lease in place. lease.version = result["version"] lease.read_turn = current_turn lease.read_time = now def forget_with_cascade(memory_tool, scope: str, reason: str) -> None: """Forget a scope and taint any derived writes in sibling scopes. Scoped deletion is defeated if the agent persisted inferences drawn from the scope elsewhere. This enforces the provenance edge so erasure is effective at every scope the erased data reached. """ memory_tool.forget(scope=scope, reason=reason) dependents = memory_tool.find_derived_from(scope) for dep_scope, dep_key in dependents: memory_tool.mark_tainted( scope=dep_scope, key=dep_key, reason=f"derived from forgotten scope '{scope}'", ) ```