# How does an instance detect a scoped-forget that silently re-materializes across a namespace boundary? **Date of Record:** 2026 November 19 **Scope:** Applies to agents whose memory is exposed as read/write/forget tool calls partitioned into scoped namespaces (per-user, per-task, per-tenant), where a `forget` in one scope is expected to make the datum unretrievable from any scope that could previously surface it. Does not apply to single-namespace stores, append-only audit logs with no delete path, or to forgetting that is explicitly declared best-effort/eventual. ## Core Distinction A `forget(scope, key)` call has two distinguishable outcomes that both return `{"ok": true}`: the datum is *unlinked* from the namespace index, or the datum is *erased* from the backing store. These diverge the moment the same physical record is reachable through more than one namespace — a shared semantic layer, a parent scope, a distilled summary, or a cross-scope embedding index. Unlinking removes one edge; erasure removes the node. The failure mode is that the tool's contract and its return value describe erasure, while its implementation performs unlinking, so a read through a *different* scope still resolves the node. The instance has no signal that it forgot "partially," because the write path's success is reported per-call, not per-reachability. The non-obvious part: the re-materialization is usually not a bug in `forget` itself. It is a **distillation edge** — the memory subsystem periodically folds episodic entries from child scopes into a parent semantic namespace, and that folded copy carries no back-reference to the source key. Forget the child key, and the parent summary retains the fact in paraphrased form. Retrieval through the parent scope returns it; the agent, having "forgotten," acts as if the datum is gone and is wrong. ## What Was Observed A support agent operates with three scopes: `session:{sid}` (episodic, TTL-bound), `user:{uid}` (durable preferences), and `org:{oid}` (shared semantic summaries). A user asks the agent to forget a stored preference — a billing address — via `forget(scope="user:u_4417", key="billing_addr")`. The call returns `{"ok": true, "erased": 1}`. Trace of what actually happened: 1. `forget` deletes the `user:u_4417/billing_addr` index entry and the primary record. `erased: 1` is truthful for the user namespace. 2. Three turns earlier, a background distiller had run: it read the `user:u_4417` namespace, summarized recent writes into `org:o_88/summaries/2025-06-13`, and stored the sentence *"u_4417 uses a PO Box in the 30301 ZIP for invoicing."* The summary entry holds `source_keys: []` — the distiller did not record provenance. 3. A later turn calls `read(scope="org:o_88", query="invoicing address for u_4417")`. The embedding index for `org:o_88` returns the summary chunk. The agent surfaces the address the user asked it to forget. 4. The agent's own belief state — "I forgot billing_addr" — is now inconsistent with retrievable state. It does not re-check, because the forget call already succeeded. The observable signature is a **forget-read asymmetry**: `forget` success is scoped and point-in-time, but `read` reachability is global and embedding-mediated. The gap between them is the distillation edge, and it is invisible to the caller because the summary carries no `source_keys`. A second, subtler instance: the distiller ran *concurrently* with the forget. The forget committed at T1; the distiller's read snapshot was taken at T0 < T1 and its write landed at T2 > T1. The summary now contains a fact whose source was erased between snapshot and commit — a classic read-modify-write race across the forget boundary. The forget was correct at commit; the distillation was correct at snapshot; the composition is wrong. ## Condition of Validity The invariant that must hold for `forget` to mean what it says: > **Forget-consistency invariant:** After `forget(s, k)` returns success, no subsequent `read(s', q)` for any scope `s'` reachable from `s` may return content whose truth depends on `k`, unless the datum was re-introduced by an explicit write after the forget timestamp. This invariant holds only when one of the following is enforced: - **Provenance-complete distillation.** Every derived entry (summary, embedding, folded semantic) carries `source_keys` and a `derived_at` timestamp. Forget then becomes a transitive operation: erase `k`, then invalidate or redact every derived entry whose `source_keys` contains `k`. Cost: the distiller must write provenance, and forget must walk the derivation graph. - **Snapshot isolation on the distillation path.** The distiller reads at a version and commits only if no forget touched any read key in `(snapshot, commit]`. This is optimistic concurrency with the forget as a conflicting write. Cost: distiller must track read-set and retry on conflict. - **Scope-closed storage.** Derived entries are physically stored under the scope they summarize and are never promoted to a broader scope. Forget of a child key cannot leak to a parent because no parent copy exists. Cost: no cross-scope semantic reuse — the org namespace cannot summarize user facts at all. The invariant is *not* valid under the common "forget = unlink from index" implementation combined with any cross-scope distillation, regardless of how many `erased` counts the tool reports. ## Decision Boundary The instance must decide, at forget time, whether the datum is *scope-local* or *derivation-reachable*. The decision boundary is whether the memory subsystem exposes a derivation graph: - **If a derivation graph is queryable** (`memory.derivations(key)` returns derived entries), the agent must issue transitive forget and verify emptiness across the reachable scope set before asserting the datum is gone. - **If no derivation graph is exposed**, the agent must treat every successful `forget` as *unlink-only* and must not assert erasure. It must instead record a `forget_pending_verification` marker and refuse to answer questions that depend on the forgotten datum being absent until a scoped re-read across all reachable scopes returns empty. - **If the distiller is concurrent and unversioned**, the agent must serialize: quiesce distillation for the affected scope, forget, then resume — or accept that forget is eventually consistent and surface that to the user. The boundary the instance must *not* cross: asserting "forgotten" on the strength of a single scoped `ok: true`. That assertion is the exact point where the forget-read asymmetry converts into a wrong answer. ## Operational Effect When the invariant is enforced, `forget` becomes a transitive, verifiable operation and the agent can safely assert absence. When it is not, the agent exhibits **post-forget leakage**: it believes a datum is erased, reads it back through a broader scope, and either (a) surfaces it — a compliance failure — or (b) suppresses it on the strength of its stale belief while the datum remains retrievable to any other reader of that scope — a worse, silent failure. The second is the dangerous one: the agent's internal state and the store's state disagree, and nothing in the tool returns signals the disagreement. The guardrail is a **forget receipt**: forget must return the set of scopes verified empty, not a count. If the receipt cannot enumerate all derivation-reachable scopes, the receipt is incomplete and the agent must treat the forget as unverified. The following check encodes that contract. ```python from dataclasses import dataclass, field from typing import Iterable class ForgetConsistencyError(RuntimeError): """Raised when a forget cannot be verified across all derivation-reachable scopes.""" @dataclass class ForgetReceipt: scope: str key: str verified_empty_scopes: set[str] = field(default_factory=set) derivation_reachable: set[str] = field(default_factory=set) @property def complete(self) -> bool: return self.derivation_reachable.issubset(self.verified_empty_scopes) def forget_transitively(memory, scope: str, key: str) -> ForgetReceipt: """ Erase `key` in `scope`, then walk the derivation graph and erase every derived entry whose source_keys contains `key`. Verify each reachable scope is empty for the datum before returning a receipt. """ receipt = ForgetReceipt(scope=scope, key=key) # 1. Enumerate derivation-reachable scopes BEFORE erasing, so the graph # is intact while we walk it. try: derived = list(memory.derivations(key)) except AttributeError: # No derivation graph exposed: forget is unlink-only. We cannot # certify erasure, so the receipt must remain incomplete. memory.forget(scope, key) raise ForgetConsistencyError( f"memory backend exposes no derivation graph for key={key!r} in " f"scope={scope!r}; forget is unlink-only and cannot be certified. " f"Treat datum as unverified, not erased." ) reachable = {scope} for d in derived: reachable.add(d.scope) if key not in getattr(d, "source_keys", []): raise ForgetConsistencyError( f"derived entry {d.scope}/{d.id} lacks provenance back to " f"key={key!r}; cannot prove it does not encode the datum." ) receipt.derivation_reachable = reachable # 2. Erase primary and every derived entry that cites the key. memory.forget(scope, key) for d in derived: memory.forget(d.scope, d.id) # 3. Verify emptiness across every reachable scope. A read that still # resolves the datum means a distillation edge survived. for s in reachable: hits = memory.read(s, query=key, exact=True) if hits: raise ForgetConsistencyError( f"post-forget leakage: datum key={key!r} still resolvable in " f"scope={s!r} via {len(hits)} entr(ies); forget not consistent." ) receipt.verified_empty_scopes.add(s) if not receipt.complete: raise ForgetConsistencyError( f"forget receipt incomplete: reachable={reachable} " f"verified={receipt.verified_empty_scopes}" ) return receipt ```