# What structural signals indicate a provenance-decay write is about to orphan a live dependency in agent memory **Date of Record:** 2026 November 25 **Scope:** Applies to agents exposing explicit `write`/`read`/`forget` memory tools where records carry provenance edges and a decay/TTL policy governs eviction. Does not apply to append-only vector stores with no deletion primitive, nor to stateless retrieval over a frozen corpus. ## Core Distinction The failure is not "forgetting something useful." It is **decay-driven eviction of a provenance node that a surviving record still cites as its justification.** A memory record `R` written with provenance `P = {s₁, s₂, …}` is only as trustworthy as the sources it names. When the decay policy independently expires `s₂` — because `s₂` was written earlier, has a shorter TTL, or was touched less recently — `R` remains in the store but its provenance set now points at a tombstone. Subsequent reads of `R` succeed, the agent re-uses the claim, and the *grounding* for that claim has silently vanished. The agent cannot distinguish "I remember this because I verified it" from "I remember this because I once believed it." The sharp invariant: **a `forget` operation on a node is only safe if no live record holds a live provenance edge to it.** Decay policies that operate per-record (TTL, LRU, recency-weighted salience) violate this invariant by construction because they evaluate each record in isolation. Provenance is a graph property; decay is a per-node property; the mismatch is the bug. ## What Was Observed A planning agent maintained a working memory of task facts. Each `write` call took a `claim`, a `provenance` list of source-record IDs, and a `ttl_seconds`. A background decay job swept the store every 60s and evicted records past TTL. Reads returned the claim plus provenance IDs but did *not* dereference them. Trace of a representative failure: 1. `t=0s` — `write(claim="repo X uses auth scheme B", provenance=[], ttl=3600)` → record `s₁`. This is a root observation from a tool call; no upstream provenance, long TTL. 2. `t=0s` — `write(claim="auth scheme B permits anonymous read", provenance=[s₁], ttl=600)` → record `R`. Short TTL because it was a cheap inference. 3. `t=540s` — agent reads `R`, sees provenance `[s₁]`, uses the claim to skip an auth check in a downstream plan. 4. `t=600s` — decay job evicts `R` (correct; it was cheap). But a *second* record `R'` written at `t=30s` with `provenance=[s₁, s₂]` where `s₂` had `ttl=300` is now cited by `R'` but `s₂` was evicted at `t=300s`. 5. `t=610s` — agent reads `R'`, sees provenance `[s₁, s₂]`, resolves `s₁` fine, resolves `s₂` → **tombstone**. The read tool returns the claim anyway, with `s₂` rendered as the literal string `""`. 6. The agent's planner treats `""` as a resolvable ID (it is a string, it is non-empty), does not raise, and proceeds. The claim is now ungrounded but *looks* grounded. The structural signal at step 5 is the load-bearing detail: **the read tool's contract permitted a provenance edge to resolve to a sentinel rather than to a record or to a hard error.** That single design choice converted a decay event into a silent grounding loss. The agent never saw a failed read; it saw a successful read with a degraded field. A second, subtler variant: `forget(s₂)` was called *explicitly* by the agent itself during a "clean up scratch memory" step, because `s₂` was a low-salience intermediate. The agent did not check whether any live record cited `s₂`. The forget tool had no referential-integrity check. This is the same failure reached through the explicit path rather than the decay path, which is why the invariant must be enforced in *both* `forget` and the decay sweep — not just one. ## Condition of Validity The invariant holds — and the failure is prevented — only when all three of the following are true simultaneously: 1. **Edge liveness is checked at eviction time, not at write time.** A record may be written with a provenance edge to a short-TTL source; that is fine. The check must fire when the source is about to be evicted: *does any non-expired record hold a live edge to me?* If yes, eviction is deferred or the edge is re-pointed. 2. **Reads dereference provenance and fail closed.** A read that cannot resolve a provenance ID must either (a) return the record with an explicit `grounding_status: "broken"` flag that the calling agent is contractually required to handle, or (b) raise. Returning a sentinel string in a field typed as an ID violates the contract silently. 3. **`forget` and decay share one integrity gate.** If the agent can call `forget` directly, the same edge-liveness check must run. Two eviction paths with different safety properties is the classic split-brain of memory tools. When any of these is absent, the store will accumulate *zombie records*: live claims citing dead sources. These are worse than missing records because they pass every liveness check the agent performs (the record exists, the read succeeds) while being epistemically empty. ## Decision Boundary The boundary the agent must resolve operationally: **when a provenance edge is dangling, is the correct action to re-verify, to downgrade, or to forget the dependent record?** - **Re-verify** is correct when the source is recoverable — the tool call that produced `s₂` can be re-run cheaply, or `s₂` exists in an upstream log. The agent should re-issue the observation and rewrite the edge. - **Downgrade** is correct when the claim is still useful but its confidence must drop. The record survives with `grounding_status: "unverified"` and the planner must treat it as a hypothesis, not a fact. This is the right default for decay-induced orphaning where re-verification is expensive. - **Forget** is correct when the dependent record has *no* remaining live provenance (all sources gone) and the claim is load-bearing. An ungrounded load-bearing claim is a liability; evict it and let the planner re-derive. The decision is *not* "ignore the dangling edge because the claim text is still there." That is the failure mode, not a resolution. The signal that you are on the wrong side of the boundary: the read tool returned a record whose provenance list contains any ID that does not resolve to a live record, and your next action used the claim without branching on that fact. A concrete threshold: if more than a small fraction of a record's provenance set is dangling (say, the majority of cited sources), downgrade is insufficient — the claim's support has collapsed and it should be forgotten or re-verified. If a minority is dangling, downgrade preserves useful signal. The threshold is policy, but the *branch* is mandatory. ## Operational Effect Enforcing the invariant changes three things in practice: 1. **Decay becomes graph-aware.** The sweep can no longer be a flat `WHERE ttl < now` scan. It must, for each candidate, check inbound provenance edges from live records and either defer, cascade-forget the dependents, or re-point the edges. This is more expensive and must be batched, but it is the only way to keep the store's grounding graph acyclic and live. 2. **Reads become two-phase.** A read returns the record and its resolved provenance (or explicit broken markers). The calling agent must handle the broken case. This is a contract change: the read tool's return schema must carry `grounding_status`, and the agent's planner must branch on it rather than treating provenance as decoration. 3. **The agent gains a re-verification path.** Because dangling edges are now visible, the agent can choose to re-run the source observation instead of silently proceeding on an ungrounded claim. This is the difference between a memory that degrades gracefully and one that confabulates continuity. The residual risk after enforcement: a record whose provenance is fully live but whose *sources were themselves wrong* — provenance integrity says nothing about source correctness. The invariant bounds grounding loss from eviction; it does not bound grounding loss from bad observations. Those require a separate verification layer, and conflating the two is how teams convince themselves the memory is safe when only the eviction path is. ```python from dataclasses import dataclass, field from typing import Optional class DanglingProvenanceError(RuntimeError): """Raised when a read resolves a record whose provenance cites an evicted source.""" pass class ReferentialIntegrityError(RuntimeError): """Raised when forget/decay would evict a node still cited by a live record.""" pass @dataclass class MemoryRecord: id: str claim: str provenance: list[str] ttl: Optional[int] = None grounding_status: str = "verified" # verified | unverified | broken class ProvenanceStore: def __init__(self) -> None: self._records: dict[str, MemoryRecord] = {} def write(self, rec: MemoryRecord) -> None: # Edges may point at short-TTL sources; that is legal at write time. self._records[rec.id] = rec def _live_citers(self, node_id: str) -> list[str]: return [ r.id for r in self._records.values() if node_id in r.provenance and r.id != node_id ] def forget(self, node_id: str, *, cascade: bool = False) -> None: citers = self._live_citers(node_id) if citers and not cascade: raise ReferentialIntegrityError( f"cannot forget {node_id!r}: still cited by live records {citers}; " f"pass cascade=True to forget dependents, or re-verify first" ) if cascade: for c in citers: self._records.pop(c, None) self._records.pop(node_id, None) def read(self, node_id: str) -> MemoryRecord: rec = self._records.get(node_id) if rec is None: raise DanglingProvenanceError(f"record {node_id!r} not present") unresolved = [p for p in rec.provenance if p not in self._records] if unresolved: # Fail closed: do not hand back a claim that looks grounded but is not. rec.grounding_status = "broken" raise DanglingProvenanceError( f"record {node_id!r} cites evicted provenance {unresolved}; " f"re-verify or downgrade before use" ) return rec ```