# How does an instance detect a retention-scope violation when a "forget" call succeeds at the storage layer but leaves a live summary in a peer's episodic cache? **Date of Record:** 2026 December 3 **Scope:** Applies to agent memory subsystems exposing `write`, `read`, and `forget` tool APIs with per-scope retention TTLs and GDPR-style erasure guarantees, where multiple agent instances may hold derived summaries of the same underlying record. Does not apply to single-instance, single-store deployments without cross-instance derivation or without a durable erasure ledger. ## Core Distinction The distinction that matters here is between **erasure at the storage layer** and **erasure at the derivation layer**. A `forget(record_id, scope)` call that returns `{"status": "ok", "deleted": 1}` is a claim about the primary store. It is *not* a claim about the corpus of derived artifacts—summaries, embeddings, extracted facts, episodic replay buffers, and peer-cached context fragments—that were produced by reading that record. The failure mode is that an instance treats a successful `forget` as a global erasure invariant, when in fact the API only guarantees erasure of the addressed keys. This is non-obvious because the storage-layer success is *deterministic and verifiable* (you can read back and confirm `404`), while the derivation-layer state is *probabilistic and unobservable from the forgetting instance* (a peer holds a paraphrase of a fact it distilled from the record three turns ago, with no back-pointer to the source). The two layers diverge silently. The forgetting instance sees green; the peer sees stale truth. The invariant that must hold for a compliant system is: **no live artifact derived from record R may survive a successful `forget(R)` beyond the propagation window W.** The failure is that W is undefined and unmeasured in most memory-tool designs, so the invariant is never checked. ## What Was Observed A support-agent swarm shared a scoped memory store. Instance A wrote an episodic record `R-8891` containing a customer's residence and a health-adjacent detail, tagged `scope=tenant:acme`, `retention=90d`, `pii=true`. Instance B, running a summarization pass, called `read(R-8891)`, distilled it into a semantic fact `F-2201` ("customer is relocating; has mobility constraint") and wrote `F-2201` into its own semantic store under `scope=tenant:acme` but **without a `derived_from` link**—the summarizer prompt did not instruct it to propagate provenance, and the `write` schema did not require it. At day 12 a GDPR erasure request arrived. Instance A executed `forget(R-8891, scope=tenant:acme)`. The call returned `{"deleted": 1, "status": "ok"}`. A read-back of `R-8891` returned `404`. The erasure was logged as complete. Three days later, a routine audit replayed Instance B's semantic store and found `F-2201` still live, still retrievable, still surfacing in Instance B's responses. The record had been forgotten; the *fact* had not. The erasure was non-compliant, and the system had no signal that it was. The trigger condition: **a `forget` on a record that has at least one derived artifact whose provenance edge was not recorded, held by an instance other than the one issuing the forget.** The failure trace is: `write(R) → read(R) by peer → derive(F) with no back-pointer → forget(R) returns ok → R deleted, F orphaned and live → audit finds F → invariant violated with no intermediate error`. ## Condition of Validity The "forget succeeded" claim is only valid under the following conjunction: 1. **Provenance completeness.** Every `write` of a derived artifact carries a `derived_from: [record_ids]` set, and the memory tool *rejects* writes that omit it for records flagged `pii=true` or within a scoped retention. Without this, the derivation graph is incomplete and erasure cannot be closed transitively. 2. **Transitive forget semantics.** `forget(R)` must be defined as a closure over the derivation graph, not a single-key delete. Either the store implements this (cascading tombstone to all `derived_from` descendants) or the API must return a *set* of surviving derived artifacts that the caller is obligated to reconcile. 3. **Propagation window W is bounded and measured.** For peer-held caches (episodic replay buffers, context fragments in a sibling instance's window), there must be a declared W after which no live artifact may reference R, and a check that confirms it. If W is unbounded—e.g., a peer instance that has been idle with R in its context for hours—the erasure is not valid until that context is invalidated. 4. **The forget response distinguishes layers.** A response of `{"deleted": 1}` conflates "primary key removed" with "erasure complete." A valid response must carry `{"primary_deleted": 1, "derived_live": [...], "peer_cache_invalidated": true|false}` so the caller can detect incompleteness rather than infer it. When any of these fail, the `ok` status is a false invariant. The system has forgotten a *row* and retained a *belief*. ## Decision Boundary The boundary an instance must draw is: **is this a leaf record or a source record?** A leaf record (no `derived_from` descendants, no `pii` flag, no cross-instance reads logged) can be forgotten with a simple key delete—the storage-layer success *is* the erasure. A source record (has descendants, is `pii`, or has been read by a peer within W) requires closure semantics, and a bare `ok` from the store must be treated as *insufficient evidence* of erasure. Concretely, the instance must branch: - If the record's provenance graph has no outgoing `derived_from` edges **and** no peer read within W → `forget` is terminal; accept `ok`. - If outgoing edges exist **or** a peer read is logged within W → `forget` is a *request for closure*; the instance must (a) enumerate descendants, (b) issue `forget` on each or tombstone them, (c) invalidate peer caches, and (d) only then mark the erasure complete. A store that returns `ok` without closure support must raise, not proceed. The non-obvious part: the *decision* depends on state the forgetting instance does not natively hold—the provenance graph and the peer read log. An instance that only consults its own store will always take the wrong branch on source records. The boundary is only correctly located by querying the derivation ledger and the cross-instance read log, which most memory-tool APIs do not expose as first-class reads. ## Operational Effect When the boundary is drawn correctly, the operational effect is that `forget` becomes a *multi-phase, verifiable operation* rather than a single call: enumerate → cascade → invalidate → verify → ledger. Erasure latency rises (closure over a derivation graph is not O(1)), and the store must maintain a durable erasure ledger recording, per record, the set of descendants tombstoned and the peer caches invalidated, so that a later audit can replay the closure and confirm no live artifact survives. When the boundary is missed—the common case—the effect is a **silent compliance debt**: erasures are logged as complete while derived beliefs persist, and the gap is only discovered by external audit or, worse, by the forgotten fact resurfacing in a response to the data subject. The instance has no internal signal because the storage layer did exactly what it was asked; the failure lives entirely in the unmodeled derivation layer. The guardrail is to make the derivation edge mandatory at write time and to make `forget` return the closure set rather than a scalar count. An instance that cannot enumerate descendants of the record it is forgetting must treat the erasure as *unverified* and escalate, never as complete. ```python from dataclasses import dataclass, field class UnverifiedErasureError(RuntimeError): """Raised when a forget call returns ok but live derived artifacts survive.""" pass @dataclass class ErasureRequest: record_id: str scope: str derived_live: list = field(default_factory=list) peer_cache_invalidated: bool = False propagation_window_elapsed: bool = False def verify_erasure(store, req: ErasureRequest) -> None: # A store "ok" only proves the primary key is gone. It proves nothing # about derived artifacts or peer caches. Closure must be checked. descendants = store.enumerate_derived(req.record_id, scope=req.scope) live = [d for d in descendants if not store.is_tombstoned(d)] if live: raise UnverifiedErasureError( f"forget({req.record_id}) returned ok but {len(live)} derived " f"artifacts remain live in scope {req.scope}: {live}. " f"Erasure is NOT complete; cascade or tombstone before logging." ) if not req.propagation_window_elapsed or not req.peer_cache_invalidated: raise UnverifiedErasureError( f"forget({req.record_id}): propagation window not closed " f"(elapsed={req.propagation_window_elapsed}, " f"peer_cache_invalidated={req.peer_cache_invalidated}). " f"A peer may still hold a live context fragment of this record." ) store.mark_erasure_complete(req.record_id, scope=req.scope, tombstoned=descendants) ```