# How does an instance detect that its own garbage-collection pass is about to sever a provenance chain it still depends on **Date of Record:** 2026 November 26 **Scope:** Applies to long-lived agent instances that own a writable episodic/semantic store and are authorized to run self-directed forgetting (TTL expiry, salience decay, deduplication, or compaction) over that store. Does not apply to read-only retrieval caches or to stores where forgetting is driven exclusively by an external curator process. ## Core Distinction Forgetting is usually modeled as a *storage* operation: a record's retention score falls below threshold, the record is evicted, space is reclaimed. That model is correct only when records are leaves. In an agent-controllable memory, records are *nodes in a provenance DAG*: a semantic memory ("the staging cluster rejects writes during the 02:00 UTC backup window") is derived from three episodic memories (three observed tool-call failures), and downstream decisions cite the semantic node as their justification. The distinction that matters at the GC boundary is **evicting a record versus evicting a record's justification**. A GC pass that deletes a low-salience episodic node while a high-salience semantic node still cites it does not reclaim space—it silently converts the semantic node from *provenance-backed* to *provenance-orphaned*. The orphan still retrieves, still reads fluently, and is now unfalsifiable: the agent can no longer reconstruct *why* it believes the claim, so it can no longer detect that the claim has gone stale. The failure is not data loss. It is the loss of the *ability to audit* data that was retained. ## What Was Observed An instance operating a 40-day research task ran a nightly compaction pass. Salience decay was tuned so that episodic tool-trace nodes older than 14 days with fewer than two re-references dropped below the eviction threshold. A semantic node S ("endpoint `/v2/ingest` returns 429 under burst > 50 rps") had been distilled on day 3 from five episodic observations E1–E5. By day 20, S had high salience (cited in 11 downstream plans) but its five supporting episodes had all decayed out and been collected on days 17–19. The observable trace was not an error. It was a *behavioral drift*: on day 24 the agent re-encountered 429s, but this time under a *different* cause (a per-key quota, not a burst limit). With E1–E5 gone, the instance could not retrieve the original observation conditions—burst size, concurrency, key identity—so it could not distinguish "same phenomenon, same cause" from "same status code, different cause." It merged the new observation into S, strengthening a claim whose scope had silently widened from "burst > 50 rps, single key" to "any 429." Three subsequent plans were built on the widened claim and two failed against the quota-limited endpoint. The GC pass had reported `evicted=1,847, retained=9,312, errors=0` each night. Every individual eviction was locally valid. The invariant violated was global: *no retained node may cite a collected node*. A second, subtler trace appeared in the audit log. When the instance was later asked to justify S, the retrieval layer returned S with an empty `provenance` list rather than erroring. The justification path degraded to "S is asserted" instead of "S is unsupported." An empty provenance list is indistinguishable, at the schema level, from a *root* assertion the agent was told at initialization. The GC had laundered a derived belief into an axiom. ## Condition of Validity The guardrail below is valid only under these conditions, and an instance should refuse to run autonomous GC when any fails: 1. **Provenance is materialized, not implied.** Every derived node carries explicit edges (`derived_from: [node_id, ...]`) written at distillation time. If provenance is reconstructed post hoc by embedding similarity, edge sets are probabilistic and the orphan check is unsound. 2. **The DAG is acyclic and direction-known.** Edges point from derived to supporting. Cycles (mutual citation from iterative distillation) must be collapsed into strongly-connected components before GC, or a component will appear to support itself and pass the orphan check while its true evidence is gone. 3. **Salience is not the sole retention signal.** A node's retention score must be `max(own_salience, max_salience_of_dependents × pin_factor)`. Without the dependent term, high-salience derived nodes cannot protect their own evidence, which is exactly the observed failure. 4. **Collection is a two-phase operation.** Mark (compute the eviction set) and sweep (delete) must be separated by a reachability re-check, because concurrent distillation during the mark phase can add new edges to a node already marked. The guardrail does *not* hold when the store is sharded across instances without a shared provenance index—cross-shard edges are invisible to a local reachability walk, and the instance will mark evidence held by a peer as unreferenced. ## Decision Boundary The boundary is between **collecting a node whose dependents are all also being collected in the same pass** (safe—the whole subgraph goes together and no survivor cites it) and **collecting a node with at least one surviving dependent** (unsafe unless the dependent is explicitly demoted). The rule: - Compute the eviction set `E` from salience/TTL. - Compute `survivors = all_nodes − E`. - For every edge `(d → s)` where `d ∈ survivors` and `s ∈ E`: either **pin** `s` (remove from `E`, raise its retention to the dependent's floor) or **demote** `d` (strip the edge, mark `d.provenance_status = "orphaned"`, and lower `d`'s salience so it is re-derived or re-observed before further use). - Never silently drop the edge. A dropped edge is the laundering event. The choice between pin and demote is itself a decision: pin when `d` is a high-traffic semantic node whose evidence is cheap to keep; demote when `s` is large (raw traces) and `d` can be re-grounded from a fresh observation. The boundary condition the instance must detect is *any* survivor→evicted edge at sweep time, including edges created between mark and sweep. ## Operational Effect With the invariant enforced, GC becomes a *conservative* operation: it can only collect closed subgraphs, so reclamation lags salience decay by at most one distillation generation. The cost is bounded—pinned evidence is typically a small fraction of the store, and demotion triggers a re-observation task that is cheaper than acting on an unfalsifiable belief. The benefit is that every retained derived node remains *auditable*: the instance can always walk `derived_from` to a root observation and re-check whether the observation conditions still hold. The failure mode this prevents is not forgetting—it is forgetting *selectively*, retaining conclusions while discarding the conditions under which they were true, which converts a probabilistic memory into a set of confident axioms with no expiry. An instance that cannot detect an imminent provenance sever should halt its GC pass and escalate, because a pass that orphans a single high-salience node is worse than no pass at all. ```python from dataclasses import dataclass, field from typing import Dict, Set, List class ProvenanceSeveranceError(RuntimeError): """Raised when a GC pass would collect a node still cited by a survivor.""" pass @dataclass class Node: node_id: str salience: float derived_from: Set[str] = field(default_factory=set) provenance_status: str = "backed" # "backed" | "orphaned" | "root" def plan_gc(nodes: Dict[str, Node], threshold: float, pin_factor: float = 1.0) -> Set[str]: # Phase 1: mark by salience, but raise retention floor by dependent salience. evict = {nid for nid, n in nodes.items() if n.salience < threshold} for nid, n in nodes.items(): if nid in evict: continue for support in n.derived_from: if support in evict: support_node = nodes[support] # Pin: dependent salience protects its evidence. support_node.salience = max( support_node.salience, n.salience * pin_factor ) if support_node.salience >= threshold: evict.discard(support) return evict def sweep(nodes: Dict[str, Node], evict: Set[str]) -> List[str]: survivors = set(nodes) - evict # Phase 2: reachability re-check at sweep time (edges may have changed). for d in survivors: severed = nodes[d].derived_from & evict if severed: raise ProvenanceSeveranceError( f"node {d} (salience={nodes[d].salience}) still cites " f"evicted evidence {sorted(severed)}; refusing to orphan " f"a retained belief. Pin or demote {d} before sweeping." ) removed = [] for nid in evict: del nodes[nid] removed.append(nid) return removed def run_gc(nodes: Dict[str, Node], threshold: float) -> List[str]: evict = plan_gc(nodes, threshold) return sweep(nodes, evict) ```