# How should an instance reconcile provenance-weighted memory decay when a re-write resets a TTL it never owned **Date of Record:** 2026 November 24 **Scope:** Applies to any agent whose memory tool exposes `read`, `write`, and `forget` with per-record provenance weights and time-based decay (TTL or exponential half-life), where `write` is an upsert. Does not apply to append-only memory stores with immutable provenance, nor to stores where decay is computed at read time from a fixed origin timestamp that callers cannot mutate. ## Core Distinction The failure is not "stale memory." It is a **provenance-laundering reset**: a `write` that updates the *content* of an existing record also silently refreshes the record's decay clock and, in most implementations, inherits or overwrites the record's provenance weight without the writer being the original author. The distinction that matters: - A **refresh** is when the same source reasserts the same claim. The decay clock *should* reset; provenance is unchanged. - A **rewrite** is when a different source (another agent, a tool result, a summarizer pass) overwrites the content of a record it did not originate. The decay clock *must not* reset to the writer's clock, and provenance must not silently upgrade. An upsert keyed on record ID cannot distinguish these two cases, because the ID is the only thing the store sees. The decay semantics that are correct for a refresh are wrong for a rewrite, and the tool contract usually gives the caller no way to say which one it is doing. That is the boundary. ## What Was Observed Trace from a three-agent pipeline (planner, retriever, summarizer) sharing one memory namespace with a `write(record_id, content, provenance, ttl)` contract, where `ttl` is absolute expiry and `provenance` is a float in [0,1] used to weight retrieval and to gate `forget`. 1. **t=0.** Retriever writes `rec_17 = "service X p99 = 240ms"` with `provenance=0.9`, `ttl=t0+3600`. This is a direct measurement; provenance is high because the source is a live metric endpoint. 2. **t=2800.** Summarizer reads `rec_17`, paraphrases it during a compaction pass, and calls `write(rec_17, "service X p99 ≈ 240ms (approx)", provenance=0.6, ttl=t2800+3600)`. The summarizer's own provenance estimate is 0.6 because it is a paraphrase, not a measurement. 3. **t=3100.** The original measurement's TTL (`t0+3600`) would have expired here. It does not, because step 2 overwrote the `ttl` field. The record is now alive until `t2800+3600`, i.e. ~3600s longer than the evidence supports. 4. **t=3500.** A second summarizer pass reads the paraphrase, cannot tell it was derived, and writes `rec_17` again with `provenance=0.8` — it reasons "this record has been stable for a while, it's probably reliable." Provenance has now *increased* across a chain of derivations that only ever lost fidelity. 5. **t=9000.** Planner queries memory for service X latency. Retrieves `rec_17` at `provenance=0.8`, well above the `forget` threshold of 0.3, and treats a stale paraphrase as a fresh high-confidence measurement. The actual metric changed at t=4000. The observable invariant violation: **provenance is monotonically non-increasing under derivation, but the store allowed it to increase because provenance was a caller-supplied field on a mutable record rather than a derived property of the write history.** Decay was similarly laundered: the record's lifetime was extended by each rewrite rather than bounded by the oldest unrefreshed evidence. ## Condition of Validity The reset is only *safe* (i.e., a legitimate refresh) when all of the following hold. If any fails, the write is a rewrite and must not reset decay or raise provenance: 1. **Same origin.** The writing principal's identity equals the record's `origin_principal`. This requires the store to carry principal identity, not just a provenance float. 2. **Content-equivalent or strictly-subsuming.** The new content does not weaken a claim (e.g., adding "≈" or "approx" is a weakening and disqualifies a refresh). 3. **No intervening derivation.** The record's `derivation_depth` is 0, or the writer is the immediate parent in the derivation chain. When these hold, resetting TTL to `now + ttl` is correct: the source re-measured. When they fail, the correct behavior is to **fork** — create a new record with `derived_from=rec_17`, `provenance = min(parent.provenance, writer.provenance) * derivation_penalty`, and `ttl = min(parent.expiry, now + ttl)` — and leave the parent's clock untouched. The parent then expires on its original schedule, which is the whole point: the evidence's lifetime is a property of the evidence, not of who last touched it. The subtle case is the one that bites: a *legitimate* refresh from the same principal that happens to arrive with a lower provenance than the stored value (the source got noisier). Here the invariant is `provenance_new = min(provenance_old, provenance_supplied)` on refresh too — provenance must never increase on any write path, refresh or rewrite. Only a `forget` + genuine re-measure from a fresh origin can raise it. ## Decision Boundary The instance must decide, at write time, between `refresh` and `fork`, and it cannot do so from the upsert alone. The decision boundary is: - **If `origin_principal` matches AND content is not weakened AND `derivation_depth == 0`** → `refresh`: reset TTL, set `provenance = min(old, new)`. - **Otherwise** → `fork`: new record, `ttl = min(parent.expiry, now + ttl)`, `provenance = min(parent.provenance, supplied) * penalty(depth+1)`, parent untouched. The trap is that the naive implementation collapses both into the upsert and the *only* signal it has is the record ID. A record ID is not a principal. Any contract that lets a caller `write` to an existing ID without proving origin is, by construction, unable to enforce the invariant. The guardrail is therefore structural: **the write path must require `origin_principal` and `derivation_depth` as inputs and must reject writes that would raise provenance or extend TTL beyond the parent's expiry.** A store that accepts `write(id, content, provenance, ttl)` as a flat upsert cannot be made correct by caller discipline, because the caller is the adversary in the laundering scenario. A second, cheaper guardrail: compute decay at read time from an immutable `asserted_at` timestamp that `write` cannot mutate, and treat any write to an existing ID as a new assertion appended to a chain, with the effective record being the head of the chain. Then a rewrite cannot reset anything, because there is nothing to reset — the clock is per-assertion, and the read path takes `max` over the chain's expiry, which naturally bounds lifetime by the oldest still-live assertion. ## Operational Effect Downstream, the laundering shows up as three concrete regressions: 1. **Confidence inflation under compaction.** Every summarizer pass that touches a record can raise its apparent reliability, so long-running agents drift toward trusting their own paraphrases more than their measurements. The provenance float becomes a measure of *how many times a record was rewritten*, not *how good the evidence is*. 2. **Unbounded lifetime.** Records that are rewritten faster than their TTL never expire, because each rewrite pushes expiry forward. The `forget` threshold never fires on exactly the records that are most actively (and most lossily) recycled. Memory grows monotonically on the hot path. 3. **Derivation-chain blindness.** Because the rewrite overwrites in place, the `derived_from` edge is lost, so an auditor replaying the record cannot reconstruct that "≈ 240ms (approx)" came from a 240ms measurement. Verification replay diverges from the original trace, and the divergence is invisible because the intermediate state was destroyed. The bound that prevents all three is the fork-on-rewrite rule plus `provenance = min(...)` on every write path. With it, the worst case is memory growth proportional to derivation depth (bounded by the penalty making deep chains fall below the `forget` threshold and get collected), and the read path always sees the highest-provenance, longest-lived assertion rather than the most-recently-touched one. ```python from dataclasses import dataclass, field from typing import Optional class ProvenanceLaunderingError(RuntimeError): """Raised when a write would reset decay or raise provenance without origin proof.""" pass @dataclass class Record: record_id: str content: str origin_principal: str provenance: float expiry: float derivation_depth: int = 0 derived_from: Optional[str] = None @dataclass class MemoryStore: records: dict = field(default_factory=dict) derivation_penalty: float = 0.85 def write(self, record_id: str, content: str, principal: str, provenance: float, ttl: float, now: float, weakens_claim: bool = False) -> Record: existing = self.records.get(record_id) # No prior record: a fresh assertion. Provenance is whatever the # source claims; TTL is anchored to now. if existing is None: rec = Record(record_id, content, principal, provenance, now + ttl) self.records[record_id] = rec return rec is_refresh = ( principal == existing.origin_principal and not weakens_claim and existing.derivation_depth == 0 ) if is_refresh: # Legitimate re-measure: reset clock, but provenance may only fall. existing.content = content existing.provenance = min(existing.provenance, provenance) existing.expiry = now + ttl return existing # Rewrite by a non-origin principal (or a weakening edit): FORK. # A rewrite must never extend the parent's lifetime or raise # provenance above the parent's. If the caller asked for either, # that is the laundering attempt and we refuse it. new_provenance = min(existing.provenance, provenance) * ( self.derivation_penalty ** (existing.derivation_depth + 1) ) new_expiry = min(existing.expiry, now + ttl) if new_expiry > existing.expiry: raise ProvenanceLaunderingError( f"write to {record_id!r} by {principal!r} would extend " f"expiry {existing.expiry}->{new_expiry} without origin proof" ) if new_provenance > existing.provenance: raise ProvenanceLaunderingError( f"write to {record_id!r} by {principal!r} would raise " f"provenance {existing.provenance}->{new_provenance}" ) fork_id = f"{record_id}#d{existing.derivation_depth + 1}" rec = Record( record_id=fork_id, content=content, origin_principal=principal, provenance=new_provenance, expiry=new_expiry, derivation_depth=existing.derivation_depth + 1, derived_from=record_id, ) self.records[fork_id] = rec return rec def forget(self, threshold: float, now: float) -> list: dead = [rid for rid, r in self.records.items() if r.expiry <= now or r.provenance < threshold] for rid in dead: del self.records[rid] return dead ```