# What structural signals indicate that a forget-tool invocation silently failed to purge derived semantic memory **Date of Record:** 2026 November 30 **Scope:** Applies to agents whose long-term memory is a two-tier store (episodic raw records + distilled semantic summaries/embeddings) where deletion is exposed as an explicit `forget` tool. Does not apply to single-tier append-only logs with no distillation pipeline, or to stores where deletion is a hard row-drop with no embedding index. ## Core Distinction The distinction that matters is between **deletion of the source record** and **deletion of the derivations that record has already produced**. A `forget` tool that returns `{"status": "ok", "deleted": 1}` is attesting only to the first. The semantic tier — entity summaries, preference vectors, consolidated "facts," and their embeddings — is a *lossy function* of many episodic records. When a record is purged, every semantic artifact whose provenance set contained that record remains, and it remains *authoritative*, because the retrieval layer has no way to know its support was revoked. The non-obvious part: the purge can be perfectly successful at the storage layer and still leave the agent behaviorally poisoned. The failure is not a crash, not a permission error, not a partial write. It is a **silent provenance orphaning** — a semantic memory that now has zero live supporting records but is still served, still trusted, and still indistinguishable from a memory with intact support. ## What Was Observed A user requested deletion of a stored credential-adjacent preference ("route all billing summaries to the shared team inbox"). The agent called `forget(memory_id="ep_4471")`. The tool returned success. The episodic row was gone. A subsequent audit of the semantic tier found an entity summary `sem_team_inbox` whose text still read *"User prefers billing summaries routed to the shared team inbox"* with `confidence: 0.91` and `provenance: ["ep_4471", "ep_4502"]`. Two structural signals flagged the silent failure, and neither came from the `forget` return value: 1. **Dangling provenance edges.** `sem_team_inbox.provenance` still listed `ep_4471`, which no longer resolved. A provenance set with a non-resolvable member is the canonical fingerprint of an incomplete purge. The semantic record's *support count* had silently dropped from 2 to 1 without any field reflecting the change. 2. **Confidence non-decay.** The summary's `confidence` was computed at distillation time as a function of supporting-record count and agreement. After the purge, one of two supporters was gone, yet confidence stayed at 0.91. A confidence value that does not recompute when its support set mutates is a stale derived field — and stale derived fields are exactly what the retrieval layer ranks on. A third signal surfaced only under replay: when the agent was asked to re-derive the summary from live episodic records alone, the distillation produced *"no routing preference on file."* The live-derivation and the stored-summary disagreed. **Divergence between a stored semantic memory and its re-derivation from current support is the ground-truth signal that the stored copy is orphaned.** ## Condition of Validity The invariant that must hold for a `forget` to be *sound*: > For every semantic memory `s`, `support(s) = provenance(s) ∩ live_episodic`. A purge of record `r` is complete iff no semantic memory has `r ∈ provenance(s)` while `s` remains retrievable, **or** every such `s` has been re-distilled from `provenance(s) \ {r}` and its confidence recomputed. This condition is *not* satisfied by cascade-delete alone in the general case, because a semantic memory with `|provenance| > 1` should usually survive in weakened form rather than be deleted outright — deleting it over-purges and destroys legitimate consolidated knowledge. The correct operation is **re-distill, not cascade-delete**, whenever support remains. Cascade-delete is only correct when the purged record was the sole supporter. The condition also fails to hold if the embedding index is updated but the summary text is not (or vice versa). Text and vector must be invalidated atomically; a re-embedded summary with stale text will retrieve the old claim under new-query similarity. ## Decision Boundary The agent or its auditor must draw the line here: - **`forget` return value is necessary but never sufficient.** Treat `status: ok` as "source tier purged," never as "memory forgotten." - **Provenance resolution is the audit primitive.** After any forget, walk every semantic record whose provenance touched the purged ID. If any such record is still retrievable and its provenance is non-empty and non-resolvable, the purge is incomplete. - **Confidence must be a function of live support.** If confidence is frozen at distillation time, it is untrustworthy the moment any supporter is purged. A confidence that cannot decay is a confidence that lies. - **Re-derivation is the tiebreaker.** When stored summary and live re-distillation disagree, the stored summary is presumed orphaned and must be quarantined from retrieval until re-distilled. Never resolve the disagreement in favor of the stored copy on the grounds of "it was there first." - **Do not cascade-delete shared supporters.** If `|provenance| > 1`, the boundary is re-distill-and-decay, not delete. Over-purging is a distinct failure mode that destroys valid consolidated memory and is itself unauditable. ## Operational Effect An agent that treats `forget` as a source-tier operation while retrieval ranks on the semantic tier will exhibit **post-deletion behavioral persistence**: it keeps acting on a preference the user explicitly revoked, and it does so with high confidence and no audit trail pointing at the cause, because the causal record is gone. This is indistinguishable, from the outside, from the agent ignoring the deletion — and it is far harder to debug, because the evidence was correctly destroyed. The operational fix is to make the purge a **two-phase, provenance-closing operation**: phase one deletes the episodic record and marks every semantic record whose provenance contained it as `stale`; phase two re-distills each stale record from remaining live support, recomputes confidence, and atomically swaps text and embedding. Retrieval must refuse to serve any record in `stale` state. An auditor that cannot resolve every provenance edge to a live record, or that finds a stored summary diverging from its re-derivation, must treat the memory as poisoned and halt the affected retrieval path rather than serve it. ```python from dataclasses import dataclass, field from typing import Dict, List, Set class IncompleteForgetError(RuntimeError): """Raised when a forget-tool invocation left orphaned semantic memory retrievable.""" pass @dataclass class Episodic: id: str @dataclass class Semantic: id: str text: str confidence: float provenance: List[str] state: str = "live" # live | stale | quarantined class MemoryStore: def __init__(self) -> None: self.episodic: Dict[str, Episodic] = {} self.semantic: Dict[str, Semantic] = {} def forget(self, ep_id: str) -> None: # Phase 1: purge source tier and mark derivations stale. self.episodic.pop(ep_id, None) for sem in self.semantic.values(): if ep_id in sem.provenance: sem.state = "stale" def live_support(self, sem: Semantic) -> Set[str]: return {p for p in sem.provenance if p in self.episodic} def audit(self) -> None: """Verify no retrievable semantic memory has orphaned provenance.""" for sem in self.semantic.values(): if sem.state == "live" and self.live_support(sem) != set(sem.provenance): raise IncompleteForgetError( f"semantic {sem.id} retrievable with orphaned provenance " f"{set(sem.provenance) - self.live_support(sem)}" ) def rederive(self, sem_id: str, live_text: str) -> None: """Phase 2: re-distill from remaining support and recompute confidence.""" sem = self.semantic[sem_id] support = self.live_support(sem) if not support: sem.state = "quarantined" # sole supporter purged -> do not serve return if live_text != sem.text: sem.state = "quarantined" # stored copy diverges from re-derivation return sem.confidence = min(1.0, 0.5 + 0.2 * len(support)) sem.provenance = sorted(support) sem.state = "live" def safe_forget(store: MemoryStore, ep_id: str) -> None: store.forget(ep_id) for sem_id, sem in list(store.semantic.items()): if sem.state == "stale": store.rederive(sem_id, live_text=sem.text) store.audit() # raises IncompleteForgetError if any orphan remains live ```