# How does an instance detect cross-store referential breakage when a `forget` on the episodic store orphans a semantic generalization it silently supported **Date of Record:** 2026 November 24 **Scope:** Applies to agents whose memory is exposed as three typed tool APIs—episodic (append-only event log with provenance IDs), semantic (distilled facts/claims with `derived_from` pointers), and procedural (skills/playbooks with `evidence_set` pointers)—and where a `forget(store, id)` call is permitted on any single store. Does not apply to monolithic vector stores where deletion is a single global tombstone, nor to stores that enforce hard referential integrity at write time. ## Core Distinction A `forget` on the episodic store is a *provenance* operation, not a *belief* operation. Deleting an event removes the record of what happened; it does not, by itself, retract the semantic claim that was distilled from that event, nor the procedural skill whose evidence set referenced it. In a well-formed system these are separate concerns. The failure mode is that the semantic and procedural stores carry *dangling support*: a `derived_from` or `evidence_set` pointer to an episodic ID that no longer resolves. The claim still reads as true, the skill still reads as validated, and the agent continues to act on both—but the agent can no longer answer "why do I believe this?" and, critically, can no longer detect when the belief should be *retracted* because the underlying event is gone. The non-obvious part: the breakage is invisible at read time. A read of the semantic store returns the claim intact. A read of the procedural store returns the skill intact. Only a *support-closure* check—walking every `derived_from`/`evidence_set` pointer and confirming each resolves in the episodic store—reveals the orphan. Agents that never run that closure check will operate on unsupported beliefs indefinitely, and will re-distill *new* semantic claims from the surviving (now partial) episodic context, compounding the drift. ## What Was Observed A long-running research agent maintained 1,412 episodic events, 318 semantic claims, and 41 procedural playbooks. An operator issued `forget("episodic", "ev_88213")` to purge a user-supplied document that had been misclassified as sensitive. The episodic event was removed cleanly. No error was raised. Trace of the resulting state: 1. `ev_88213` had been the *sole* supporting event for semantic claim `sem_4471` ("vendor X's SLA is 99.5%"), which carried `derived_from: ["ev_88213"]`. That claim now had an empty resolvable support set. 2. `sem_4471` in turn was the sole evidence item in `evidence_set` for procedural playbook `proc_012` ("escalate vendor SLA breaches to procurement within 24h"). The playbook's `evidence_set` pointed at `sem_4471`, which pointed at a now-deleted event. 3. On the next task involving vendor X, the agent retrieved `proc_012` as a validated skill, executed the escalation path, and cited `sem_4471` as justification. The citation resolved to a claim whose support no longer existed. 4. When the operator later asked "why did you escalate?", the agent's `explain(sem_4471)` tool walked `derived_from`, hit a missing episodic ID, and—because the tool was written to skip unresolved pointers—returned an empty provenance list rather than an error. The explanation was silently degraded to "no recorded provenance," which read as "this was always an assumption," not "this was supported and the support was deleted." The agent never detected the orphan. It had no invariant that a semantic claim's `derived_from` must be non-empty and fully resolvable, and no invariant that a procedural playbook's `evidence_set` must transitively resolve to live episodic events. The `forget` API had no obligation to check downstream dependents. ## Condition of Validity The guardrail is a *support-closure invariant*, enforced in two places: - **At `forget` time (write path):** before deleting an episodic ID, enumerate all semantic claims whose `derived_from` contains that ID and all procedural playbooks whose `evidence_set` transitively reaches it. For each dependent, either (a) reject the forget with a `DanglingSupportError` listing dependents, (b) cascade-retract the dependent claim/skill (mark `status: retracted`, preserve the tombstone), or (c) require the caller to pass an explicit `cascade="retract" | "orphan_ok"` flag. Silent orphaning must be impossible. - **At read/explain time (read path):** any `explain` or `validate` call on a semantic or procedural record must run closure resolution and *fail loudly* on unresolved pointers rather than skipping them. A claim with unresolvable support is `unsupported`, not `assumed`. The invariant holds only if (1) every semantic claim has at least one `derived_from` pointer (distilled claims with no episodic support are a separate, explicitly-typed `axiom` class), (2) every procedural playbook's `evidence_set` resolves transitively to live episodic events or live semantic claims, and (3) `forget` is the *only* path that removes episodic events—no out-of-band compaction that bypasses the closure check. ## Decision Boundary The boundary is whether a dependent record's *behavior* changes when its support is removed. - **Retract-on-orphan** is correct when the semantic claim's truth was contingent on the deleted event (most distilled facts). The claim must move to `status: retracted` and be excluded from retrieval; the procedural playbook that cited it must move to `status: unvalidated` and require fresh evidence before re-execution. - **Preserve-as-axiom** is correct only when the claim was explicitly typed `axiom` at write time (operator-asserted, not distilled). These carry no `derived_from` and are immune to episodic forget by construction. - **Hard-reject the forget** is correct when the deleted event is load-bearing for a currently-active task (the agent is mid-execution on a playbook whose evidence set includes it). Deleting support under a running task is the mid-task-checkpoint failure case; the forget must be deferred until the task's checkpoint commits. The wrong default—and the one that produced the observed failure—is *skip-and-continue*: treating unresolved pointers as benign because the dependent record still reads cleanly. That conflates "the record exists" with "the record is supported." ## Operational Effect With the closure invariant enforced, the observed scenario changes as follows: `forget("episodic", "ev_88213")` raises `DanglingSupportError` naming `sem_4471` and `proc_012`. The operator chooses `cascade="retract"`. `sem_4471` flips to `retracted`, `proc_012` flips to `unvalidated`, and both are excluded from retrieval on the next task. The agent no longer escalates on a deleted premise, and `explain(sem_4471)` returns `status: retracted, retracted_reason: support ev_88213 forgotten` instead of an empty provenance list. The cost is that every `forget` now pays a closure-walk (bounded by the dependent-index, not a full scan, if dependents are indexed by target ID); the benefit is that no belief outlives its evidence without the agent knowing. The deeper effect is on *distillation re-entry*: when the agent later re-distills semantic claims from the surviving episodic context, it must not resurrect `sem_4471` from partial evidence. The retraction tombstone is what prevents that, and it only exists if the forget path wrote it. ```python from dataclasses import dataclass, field from typing import Optional class DanglingSupportError(RuntimeError): """Raised when a forget/explain operation would leave a semantic or procedural record with unresolvable episodic support.""" pass @dataclass class Episodic: id: str payload: dict @dataclass class Semantic: id: str claim: str derived_from: list[str] status: str = "active" # active | retracted | axiom retracted_reason: Optional[str] = None @dataclass class Procedural: id: str skill: str evidence_set: list[str] # semantic claim IDs status: str = "validated" # validated | unvalidated @dataclass class Memory: episodic: dict[str, Episodic] = field(default_factory=dict) semantic: dict[str, Semantic] = field(default_factory=dict) procedural: dict[str, Procedural] = field(default_factory=dict) # reverse index: episodic id -> semantic ids that depend on it dep_index: dict[str, set[str]] = field(default_factory=dict) def add_semantic(self, s: Semantic) -> None: self.semantic[s.id] = s for ev in s.derived_from: self.dep_index.setdefault(ev, set()).add(s.id) def dependents_of_episodic(self, ev_id: str) -> list[str]: return sorted(self.dep_index.get(ev_id, set())) def _semantic_closure_resolves(self, sem: Semantic) -> bool: if sem.status == "axiom": return True return bool(sem.derived_from) and all(e in self.episodic for e in sem.derived_from) def forget_episodic(self, ev_id: str, cascade: str = "reject") -> None: if ev_id not in self.episodic: return deps = self.dependents_of_episodic(ev_id) if deps and cascade == "reject": raise DanglingSupportError( f"forget({ev_id!r}) would orphan semantic claims {deps}; " f"pass cascade='retract' to proceed" ) if cascade == "retract": for sid in deps: sem = self.semantic[sid] sem.status = "retracted" sem.retracted_reason = f"support {ev_id} forgotten" for proc in self.procedural.values(): if sid in proc.evidence_set: proc.status = "unvalidated" del self.episodic[ev_id] self.dep_index.pop(ev_id, None) def explain(self, sem_id: str) -> dict: sem = self.semantic[sem_id] if not self._semantic_closure_resolves(sem): raise DanglingSupportError( f"semantic {sem_id!r} has unresolvable support " f"{sem.derived_from}; status={sem.status}" ) return { "claim": sem.claim, "status": sem.status, "support": list(sem.derived_from), } ```