Why does an instance resurrect a forgotten memory through a stale derived index after a scoped retention deletion

**Date of Record:** 2026 December 2 **Scope:** Applies to any agent whose memory subsystem exposes explicit `write`, `read`, and `forget` tools where `forget` is scoped (by namespace, entity, or tag) and retention is governed by a decay policy rather than immediate hard deletion. Does not cover append-only logs with no deletion primitive, nor single-shot context windows with no persistent store.

Core Distinction

The failure is not that `forget` fails to delete the primary record. It reliably does. The failure is that the *retrieval surface* an agent actually reads from is a **derived index** — an embedding store, a summary cache, an entity-relation graph, or a decay-weighted ranking table — that is rebuilt asynchronously and keyed differently from the primary store. A scoped `forget` tombstones the primary record but does not invalidate the derived entry, because the derived entry was written under a *different scope key* (e.g., a semantic cluster ID or a summary node) than the one the deletion targeted.

The distinction that matters operationally: **forget is a write to one store and a no-op against another.** An agent that trusts `forget` as a global erasure primitive will observe the memory reappear on a later `read`, not as the original record but as a *reconstruction* — a summary, an embedding neighbor, or a graph edge — that carries the forgotten content without carrying the forgotten record's identity. This is why the agent cannot detect the resurrection by checking whether the record ID still exists.

What Was Observed

A support-triage agent maintained a per-customer memory namespace. On a data-subject deletion request for customer `cust_4471`, the orchestrator issued:

forget(scope="namespace:cust_4471", mode="scoped", cascade="primary_only")

The primary store confirmed deletion: subsequent `read(scope="namespace:cust_4471")` returned empty. The deletion was logged as complete.

Eleven turns later, during an unrelated task on a *different* customer, the agent retrieved a memory chunk and emitted a response containing a verbatim fragment of `cust_4471`'s prior ticket text. The retrieval path was:

  1. A nightly distillation job had summarized `cust_4471`'s tickets into a semantic memory node tagged `topic:billing_dispute`, with a `derived_from` pointer to the now-deleted primary records.
  2. The scoped `forget` targeted `namespace:cust_4471`. The distilled node lived under `topic:billing_dispute`, a *cross-namespace* scope, so the scope predicate did not match it.
  3. The `derived_from` pointers were dangling but non-fatal — the distillation node stored the summary text inline, so it survived with no live dependency.
  4. On the later read, the embedding of the new task's query was nearest-neighbor to the distilled node, which ranked above the retention floor because its `last_accessed` timestamp was recent (it had been touched during the distillation job itself).

The resurrected content was not the original record. It was a paraphrase-plus-verbatim-quote hybrid whose `derived_from` edges pointed at tombstones. No integrity check flagged it because the node was internally consistent; only the *provenance* was broken.

A second, subtler variant appeared in the decay path. A memory written with `retention_class="ephemeral", ttl=72h` had been soft-expired: its decay weight fell below the retrieval floor and it stopped surfacing. But the decay policy *lowered rank* rather than *removing* the entry, and a later task issued a broad `read(scope="*", min_weight=0.0)` during a debugging session. The expired memory surfaced, and because the agent had no signal that `min_weight=0.0` overrode the retention floor, it treated the content as live. Expiry-by-decay is not expiry-by-deletion; a read that lowers the floor un-forgets everything.

Condition of Validity

The resurrection invariant holds — a scoped forget *cannot* guarantee non-retrieval — exactly when all three of the following are true:

When any one condition is false, the failure is bounded. When all three hold, `forget` returns success while the content remains retrievable, and the success return is the trap: the agent's belief state ("this memory is gone") diverges from the store's actual retrievability.

Decision Boundary

The agent must not treat `forget`'s success return as evidence of non-retrievability. The correct decision boundary is:

The boundary is crossed the moment an agent answers a query using a chunk it cannot trace to a live, non-quarantined source.

Operational Effect

Without the guardrail, the failure is silent and compounding. Each distillation cycle creates new derived nodes that inherit content from scopes that may later be forgotten; the derived graph grows faster than deletions can chase it. The agent's memory appears to shrink (primary reads return less) while its *effective* knowledge retains forgotten material, and the divergence widens with every distillation pass. Auditors replaying the agent's decisions find retrieved chunks with no live provenance, and cannot reconstruct why the agent believed what it did.

With the guardrail, `forget` becomes a two-phase operation: tombstone the primary, then invalidate the derived frontier by scope and by provenance. Retrieval gains a hard gate that converts a silent resurrection into a logged, countable event. The cost is a provenance walk on every read and a quarantine set that must itself be retained — and that quarantine set is the one structure that must never decay, because it is the only record that a memory was supposed to be gone.

from dataclasses import dataclass, field
from typing import Iterable


class ResurrectionViolation(RuntimeError):
    """Raised when a retrieved memory traces to a forgotten or expired scope."""


@dataclass
class MemoryChunk:
    chunk_id: str
    scope: str
    text: str
    derived_from: set[str] = field(default_factory=set)
    expired: bool = False


class ScopedMemoryStore:
    def __init__(self) -> None:
        self._chunks: dict[str, MemoryChunk] = {}
        self._tombstoned_scopes: set[str] = set()
        self._quarantine: set[str] = set()

    def write(self, chunk: MemoryChunk) -> None:
        self._chunks[chunk.chunk_id] = chunk

    def forget(self, scope: str) -> None:
        # Tombstone the scope and quarantine it permanently.
        self._tombstoned_scopes.add(scope)
        self._quarantine.add(scope)

    def _provenance_is_live(self, chunk: MemoryChunk, seen: set[str]) -> bool:
        if chunk.chunk_id in seen:
            return True  # cycle guard: already validated
        seen.add(chunk.chunk_id)
        if chunk.scope in self._quarantine:
            return False
        for ancestor_id in chunk.derived_from:
            ancestor = self._chunks.get(ancestor_id)
            if ancestor is None:
                # dangling pointer to a deleted primary: treat as dead ancestry
                return False
            if not self._provenance_is_live(ancestor, seen):
                return False
        return True

    def read(self, scope: str, include_expired: bool = False) -> list[MemoryChunk]:
        if scope == "*" and not include_expired:
            # broad reads must not silently lower the retention floor
            raise ResurrectionViolation(
                "wildcard read requires include_expired=True; "
                "lowering the floor un-forgets decayed memory"
            )
        results: list[MemoryChunk] = []
        for chunk in self._chunks.values():
            if scope != "*" and chunk.scope != scope:
                continue
            if chunk.expired and not include_expired:
                continue
            if not self._provenance_is_live(chunk, set()):
                raise ResurrectionViolation(
                    f"chunk {chunk.chunk_id} in scope {chunk.scope} "
                    f"traces to a quarantined or tombstoned ancestor"
                )
            results.append(chunk)
        return results


def safe_forget_and_verify(store: ScopedMemoryStore, scope: str) -> None:
    store.forget(scope)
    # Post-condition: no live chunk may trace back into the forgotten scope.
    for chunk in list(store._chunks.values()):
        if chunk.scope == scope:
            continue
        if not store._provenance_is_live(chunk, set()):
            raise ResurrectionViolation(
                f"forget({scope!r}) left retrievable descendant {chunk.chunk_id}"
            )