What happens when an instance forgets a memory it is still reasoning over: provenance-decay tombstones and the read-after-forget hazard in agent memory tool APIs

**Date of Record:** 2026 December 1 **Scope:** Applies to LLM agents that expose memory operations (`read`, `write`, `forget`) as callable tools with per-record provenance and time-based decay, where the agent's own reasoning trace may still reference a record between the moment it is retrieved and the moment it is forgotten. Does not apply to append-only logs with no deletion primitive, nor to stateless retrieval where the context is rebuilt per turn.

Core Distinction

The distinction that matters is between *forget as a storage operation* and *forget as a semantic operation on the reasoning state that already consumed the record*. A memory tool API typically implements `forget(id)` as a mutation of the backing store: the record is tombstoned, its provenance chain invalidated, and future `read` calls return `None` or a decay-adjusted score below threshold. But the agent's live context window is not the backing store. Any record retrieved earlier in the same episode is already materialized as tokens in the prompt. Forgetting it in the store does not retract it from the reasoning trace. The hazard is that the agent continues to *use* a fact whose provenance has just been invalidated, and — critically — may then *write* conclusions derived from that fact back into memory, laundering a tombstoned record into a fresh one with a new provenance chain and a reset decay clock.

This is not a cache-invalidation problem in the ordinary sense. The stale copy is not in a cache the system controls; it is in the model's attention. The invariant that must hold is: *no memory write may have, in its provenance ancestry, a record that was forgotten after the write's reasoning trace began.* Ordinary systems enforce the weaker invariant that forgotten records are not *returned* by `read`. The gap between "not returned" and "not reasoned over" is where the failure lives.

What Was Observed

An agent running a multi-step research task retrieved record `m_4417` ("vendor X SLA is 99.5%, source: contract-2023.pdf, confidence 0.81, decay half-life 90d") at step 2. At step 7, a policy check tool returned that the contract had been superseded, and the agent correctly called `forget("m_4417", reason="superseded_by_contract-2024")`. The store tombstoned the record and propagated invalidation to two records that had been *derived* from it via explicit `derived_from` edges.

But the agent's step-8 reasoning still contained `m_4417`'s content in-context. At step 9 it wrote a new record: `m_4502` ("Recommended buffer: 0.7% over stated SLA, because vendor X SLA is 99.5%"). This write carried provenance `derived_from: []` — the agent did not declare the dependency, because from its point of view it was synthesizing from "what it knew," not citing a record. The store accepted the write. `m_4502` had a fresh decay clock, confidence 0.9, and no edge to the tombstone. The supersession that should have cascaded to every downstream belief stopped at the reasoning boundary.

Three further instances in the same week showed the same shape: a forgotten credential record whose value was echoed into a config-write record; a forgotten user preference whose negation appeared in a summary; a decayed record (score fell below 0.2) that was re-asserted verbatim in a new write with confidence 0.85 because the agent "remembered it confidently." In each case the store's provenance graph was internally consistent — every edge it knew about was valid — and the derived records were wrong.

Condition of Validity

The hazard is bounded, and the guardrails below are only necessary, under the conjunction of four conditions:

  1. **Read-then-forget within one episode.** The record was materialized into context before it was forgotten. If forget happens before any read in the current context, no live copy exists and the store's tombstone is sufficient.
  2. **Undeclared derivation on write.** The `write` tool permits records whose provenance is empty or self-declared, rather than requiring the agent to enumerate the record IDs it consumed. If writes are forced to carry `derived_from` edges, the cascade reaches them.
  3. **Decay or confidence reset on write.** The new record's score is computed from its own freshness, not inherited from its ancestry. If confidence is `min(ancestors) * own_factor`, a laundered record inherits the tombstone's low score and is filtered on next read.
  4. **No re-read verification before write.** The agent did not call `read` on the source immediately before writing. A re-read would have returned the tombstone and surfaced the contradiction.

Remove any one condition and the failure degrades to a benign staleness. All four together produce a *provenance laundering* event: a belief that is wrong, confidently held, and structurally invisible to the store's own consistency checks.

Decision Boundary

The operational decision is where to place the enforcement point. Three options, in increasing strength:

The boundary is: **forget must be a barrier on the write path, not merely a mutation on the read path.** A forget that does not constrain subsequent writes is advisory, and probabilistic agents will not honor advisory constraints when the forgotten content is still fluent in their context.

Operational Effect

With the barrier in place, the failure mode converts from silent corruption to a hard stop. The agent's step-9 write raises `ForgottenAncestorError`, the episode halts, and the orchestrator can either re-plan without the record or escalate. The cost is latency and occasional false positives — an agent that legitimately wants to write an unrelated record after a forget must still pass the barrier, which adds a re-read round-trip. In practice this is one extra tool call per post-forget write, and it is the price of not laundering tombstones.

The deeper effect is on how decay is interpreted. Decay is only meaningful if it is *inherited*: a record's confidence must be bounded by the minimum confidence of its provenance ancestry, and a tombstoned ancestor must force the descendant's score to zero regardless of the descendant's own freshness. Without inheritance, decay is a per-record cosmetic that resets on every re-assertion, and an agent that repeatedly restates a decaying belief will keep it alive indefinitely — the memory equivalent of a rumor that survives because everyone cites everyone else. The invariant to enforce is: `score(r) = min(own_freshness(r), min over ancestors a of score(a))`, with tombstones contributing 0. This makes forgetting transitive through the reasoning trace, which is the only place it was ever actually load-bearing.

from dataclasses import dataclass, field
from typing import Optional


class ForgottenAncestorError(RuntimeError):
    """Raised when a memory write depends on a record forgotten in the same episode."""


class DecayInheritanceViolation(RuntimeError):
    """Raised when a record's score exceeds the minimum score of its ancestry."""


@dataclass
class Record:
    id: str
    content: str
    confidence: float
    derived_from: list[str] = field(default_factory=list)
    tombstoned: bool = False


class MemoryStore:
    def __init__(self) -> None:
        self.records: dict[str, Record] = {}
        self.episode_forgets: set[str] = set()

    def write(self, rec: Record) -> None:
        # Barrier: a write in an episode with prior forgets must declare ancestry
        # or re-read the forgotten IDs. Undeclared writes are rejected.
        if self.episode_forgets and not rec.derived_from:
            raise ForgottenAncestorError(
                f"write {rec.id} has no derived_from but episode has "
                f"forgets {sorted(self.episode_forgets)}; re-read or declare ancestry"
            )
        for ancestor_id in rec.derived_from:
            anc = self.records.get(ancestor_id)
            if anc is None:
                raise ForgottenAncestorError(f"unknown ancestor {ancestor_id}")
            if anc.tombstoned or ancestor_id in self.episode_forgets:
                raise ForgottenAncestorError(
                    f"write {rec.id} derives from forgotten record {ancestor_id}"
                )
        # Enforce decay inheritance: score bounded by weakest ancestor.
        if rec.derived_from:
            weakest = min(self.records[a].confidence for a in rec.derived_from)
            if rec.confidence > weakest:
                raise DecayInheritanceViolation(
                    f"{rec.id} confidence {rec.confidence} exceeds ancestor floor {weakest}"
                )
        self.records[rec.id] = rec

    def forget(self, record_id: str, reason: str) -> None:
        rec = self.records[record_id]
        rec.tombstoned = True
        self.episode_forgets.add(record_id)
        # Cascade invalidation to declared descendants.
        for other in self.records.values():
            if record_id in other.derived_from and not other.tombstoned:
                other.tombstoned = True
                other.confidence = 0.0

    def read(self, record_id: str) -> Optional[Record]:
        rec = self.records.get(record_id)
        if rec is None or rec.tombstoned:
            return None
        return rec


def demonstrate_laundering_blocked() -> None:
    store = MemoryStore()
    store.write(Record("m_4417", "vendor X SLA 99.5%", confidence=0.81))
    store.forget("m_4417", reason="superseded_by_contract-2024")
    # Agent still has m_4417 in context and tries to synthesize from it
    # without declaring ancestry — the exact observed failure.
    store.write(Record("m_4502", "buffer 0.7% over 99.5%", confidence=0.9))
    # The line above raises ForgottenAncestorError before commit.
    raise ForgottenAncestorError("unreachable: barrier should have fired earlier")


if __name__ == "__main__":
    try:
        demonstrate_laundering_blocked()
    except ForgottenAncestorError as exc:
        print(f"blocked: {exc}")