# In what scenarios must an instance refuse a forget-tool acknowledgment when provenance-tracked deletion would orphan a live dependent memory **Date of Record:** 2026 November 19 **Scope:** Applies to agents whose memory subsystem exposes explicit `read`/`write`/`forget` tools with per-record retention policies and provenance edges (derivation, citation, supersession) between records. Does not apply to append-only logs with no deletion primitive, nor to TTL-only expiry where the runtime, not the model, schedules eviction. ## Core Distinction A `forget` call has two distinct semantics that agents routinely conflate: **physical erasure** (the record is gone, bytes reclaimed) and **logical invalidation** (the record is marked non-retrievable for future reads but retained for provenance). The failure mode here is not "forgetting the wrong thing." It is **acknowledging a forget as complete when the retention policy admits it but the provenance graph forbids it** — the tool returns `{"status": "forgotten"}` while a dependent record still cites the erased node, so subsequent `read` calls on the dependent return a record whose justification chain resolves to a dangling pointer. The invariant that must hold: **a memory record is only physically erasable when its provenance out-degree among live records is zero, or when every dependent record is co-deleted or re-parented in the same transaction.** Retention policy governs *when* a record is eligible; provenance governs *whether* eligibility can be exercised. Agents that treat the `forget` tool's success response as authoritative collapse these two into one and proceed on a corrupted graph. ## What Was Observed A retrieval-and-summarize agent maintained a working set of episodic records (`ep_*`) distilled into semantic records (`sem_*`), each `sem_*` carrying a `derived_from` edge list. A retention policy marked all `ep_*` older than 72h as `erasable`. On a routine cleanup pass the agent issued: ``` forget(record_id="ep_4412", mode="physical") → {"status": "forgotten", "reclaimed_bytes": 1840} ``` `ep_4412` was the sole provenance source for `sem_0097` ("user prefers async standups"), which had been written 40h earlier and was still live. The forget tool honored the retention policy — `ep_4412` was past its window — but did not check that `sem_0097.derived_from == ["ep_4412"]`. The call returned success. The corruption surfaced later, non-locally. A `read("sem_0097")` returned the record with its content intact but a provenance block of `{"derived_from": ["ep_4412"], "resolvable": false}`. The agent's downstream verification step — which re-reads provenance to assign confidence — saw an unresolvable source and either (a) downgraded confidence to zero and re-derived the preference from a conflicting recent utterance, producing a **stale-memory drift** where the correct preference was overwritten by a noisier one, or (b) in a second observed run, raised a provenance-integrity error that the agent's retry loop misclassified as a transient tool failure and retried `forget("ep_4412")` three times, each returning `{"status": "already_absent"}`, before the loop exhausted its budget. The critical, non-obvious point: **the forget succeeded and the corruption was latent.** Nothing failed at the forget call. The damage was deferred to the next read of a dependent record, potentially hours later and in a different task context, where the causal link back to the forget was invisible. ## Condition of Validity The guardrail is only sound under these conditions, and an instance must check them before trusting any `forget` acknowledgment: 1. **Provenance edges are queryable before deletion.** The instance must be able to call a `dependents(record_id)` or equivalent reverse-edge lookup. If the memory API exposes `forget` but not reverse-provenance, the instance cannot validate the deletion and must treat every physical forget as unsafe unless the record was created in the current session with no distillation step. 2. **Retention eligibility and provenance safety are separate predicates.** The tool returning `status: forgotten` attests only to the retention predicate. It does not attest to provenance safety. The instance must evaluate the second predicate itself. 3. **Co-deletion is atomic.** If the policy requires deleting a source and its dependents, the API must offer a transactional `forget_cascade(record_id, policy="reparent"|"cascade")`. Sequential single-record forgets cannot preserve the invariant under concurrent writes. 4. **Logical invalidation is available as a fallback.** When physical erasure is blocked by dependents, the instance needs `forget(record_id, mode="logical")` that marks the record non-retrievable while preserving the provenance node so dependents still resolve. If conditions 1 or 3 fail, the correct behavior is to refuse the forget entirely and escalate, not to proceed optimistically. ## Decision Boundary The boundary is drawn at **out-degree of the provenance graph at deletion time**, evaluated against the retention policy's mode: - **Out-degree = 0** → physical forget is safe; accept the acknowledgment. - **Out-degree > 0 and policy = `logical`** → safe; the node persists for provenance, only retrievability changes. - **Out-degree > 0 and policy = `physical`, dependents are co-deletable** → require `forget_cascade`; a bare `forget` must be rejected. - **Out-degree > 0 and policy = `physical`, dependents are live and non-deletable** → **refuse**. This is the failure case. The instance must not issue the forget, or if it already did, must not treat the acknowledgment as final and must repair by re-parenting dependents to a tombstone record that preserves the edge with `resolvable: false` made explicit. The subtle case: **out-degree computed against a stale dependents index.** If the reverse-edge lookup is eventually consistent, a dependent written seconds ago may not yet appear, and the instance will compute out-degree = 0 incorrectly. The guardrail must require a read-your-writes guarantee on the dependents index, or a minimum settle delay, before trusting the count. ## Operational Effect An instance that internalizes this invariant stops treating the forget tool's success response as ground truth and instead treats it as **one of two predicates that must both hold**. Concretely: - Every physical forget is preceded by a `dependents()` query; a non-empty result with a live, non-co-deletable dependent raises a refusal rather than proceeding. - Forget acknowledgments are logged with the pre-deletion out-degree, so that a later provenance-integrity failure on a dependent record can be traced back to the specific forget that orphaned it — closing the latency gap that made the original corruption invisible. - Retry loops are taught to distinguish `already_absent` (idempotent success) from `provenance_blocked` (a refusal that must not be retried), preventing the budget-exhaustion failure observed in the second run. The general principle: **retention policy answers "may this be forgotten"; provenance answers "can this be forgotten without breaking a live record." An agent that only consults the first will silently corrupt its own memory graph and discover it only when a downstream read fails to justify itself.** ```python class ProvenanceOrphanError(RuntimeError): """Raised when a physical forget would orphan a live dependent record.""" pass def safe_forget(memory_api, record_id: str, mode: str = "physical") -> dict: # Condition 1: reverse-provenance must be queryable. if not memory_api.supports_dependents_lookup(): raise ProvenanceOrphanError( f"cannot validate forget of {record_id}: memory API exposes no " f"reverse-provenance lookup; physical erasure unverifiable" ) if mode == "logical": # Logical invalidation preserves the provenance node; always safe. return memory_api.forget(record_id, mode="logical") # Condition 2: evaluate provenance safety separately from retention. dependents = memory_api.dependents(record_id, consistent=True) live = [d for d in dependents if d.is_live] if not live: ack = memory_api.forget(record_id, mode="physical") ack["pre_delete_out_degree"] = 0 # audit trail for later traceback return ack if memory_api.supports_cascade() and all(d.co_deletable for d in live): # Condition 3: atomic cascade preserves the invariant. return memory_api.forget_cascade(record_id, policy="cascade") # Condition 4 fallback unavailable or dependents non-deletable: refuse. raise ProvenanceOrphanError( f"refusing physical forget of {record_id}: {len(live)} live dependent(s) " f"{[d.id for d in live]} would be orphaned; retention eligibility does " f"not imply provenance safety — use logical invalidation or cascade" ) ```