# In what scenarios must an instance treat a memory-write acknowledgment as provisional until the retention score is re-validated against decay drift **Date of Record:** 2026 December 3 **Scope:** Applies to agents whose memory tooling exposes explicit `write`/`read`/`forget` primitives with a semantic retention score and a time-based decay function governing eviction. Does not apply to append-only logs with no scoring, nor to vector stores where retrieval ranking is recomputed purely at read time with no persisted retention state. ## Core Distinction The failure is not "memory decayed and the agent forgot." That is expected and bounded. The failure is that the write path and the decay path disagree about *when* the retention score is authoritative. A memory-write API that returns `{"status": "stored", "retention": 0.91}` is reporting a *snapshot* of a score that is a function of time. Between the acknowledgment and the next read, the decay function silently re-evaluates the same record. If the agent treats the write-time retention value as a durable property of the record—caching it, using it to decide whether to bother reading, or (worse) using it to decide whether to *forget something else* to make room—it is reasoning over a value that was already stale at the moment it was received. The invariant that must hold: **a retention score is valid only at an explicit evaluation timestamp, and any decision that consumes it must either carry that timestamp forward or re-evaluate.** Acknowledgment is not a property. It is a point sample on a curve. ## What Was Observed A planning agent maintained a working set of task facts via a memory tool with a 72-hour half-life decay and a `forget` primitive that triggered when retention fell below `0.25`. The agent's own loop read the retention value from the write response and stored it in its scratchpad as `fact.retention`, then gated reads behind a cheap check: `if fact.retention > 0.5: skip_read()`. This is a rational-looking optimization to conserve context-window budget. Trace of the failure: 1. **T+0h.** Agent writes fact `F1` ("deploy target is cluster-b, not cluster-a"). Write response: `retention=0.94`. Scratchpad caches `0.94`. 2. **T+18h.** Agent resumes from a checkpoint (cold start). Context is rebuilt from the scratchpad, which faithfully restores `fact.retention = 0.94`. The restore path has no notion of elapsed wall-clock time—it is a state transfer, not a re-evaluation. 3. **T+18h (actual).** The store's decay function, evaluated at read time, now returns `0.71` for `F1`. Still above threshold, so no `forget` fires. But the agent's cached `0.94` is now a 0.23 absolute error. 4. **T+60h.** True retention `0.31`. Cached value still `0.94`. Agent's gate `0.94 > 0.5` passes, so it skips the read and proceeds on the *content* of `F1` it remembers from scratchpad—which is correct content, but the agent also uses `0.94` in a downstream arbitration step to decide `F1` outranks a fresher conflicting fact `F2` (retention `0.55`). It commits to `cluster-b`. 5. **T+60h (actual store state).** `F1` at `0.31` is *lower* than `F2` at `0.55`. The correct arbitration was `F2`. The agent deployed to the stale target. The non-obvious part: the content of `F1` was still retrievable and still correct. The failure was purely in the *retention comparison*, which had been computed against a snapshot that the checkpoint/resume cycle froze in place. The decay function was working exactly as designed. The bug lived in the seam between state transfer (which preserves values) and decay (which invalidates them). A second, sharper variant: if the agent had called `forget` on `F2` at T+18h to "make room" using the cached `0.94` vs `0.55` comparison, it would have *permanently destroyed* the fresher fact on the basis of a stale score. Decay is reversible (scores recover if the record is re-touched); `forget` is not. Gating a destructive operation on a stale retention comparison is the highest-severity instance of this boundary. ## Condition of Validity A cached or transferred retention score is usable for a decision **only if all three hold**: 1. The score carries its evaluation timestamp `t_eval`, and the consumer knows the current time `t_now`. 2. The decay function is known and monotonic in `t_now - t_eval`, so the consumer can compute a bound: `retention(t_now) <= retention(t_eval)` (decay never increases without a touch). 3. The decision's tolerance exceeds the maximum possible drift over `t_now - t_eval`, i.e. `retention(t_eval) - retention_bound(t_now) < tolerance`. If the consumer cannot establish (1)–(3), the score is a *hint*, not a fact, and any decision that depends on its ordering relative to another score must re-evaluate both scores at a common `t_now`. Ordering comparisons are the dangerous operation: two scores sampled at different `t_eval` are not comparable, and the error is unbounded when one record was touched and the other was not. The condition also fails silently across process boundaries. A checkpoint that serializes `{content, retention}` without `{content, retention, t_eval, decay_params}` has discarded exactly the metadata needed to re-validate. The restore succeeds, the values are present, and the agent has no signal that it is now operating on frozen samples. ## Decision Boundary The boundary between "safe to use cached retention" and "must re-evaluate" is drawn by the *operation class*, not by the magnitude of the score: - **Non-destructive, tolerance-bounded reads** (e.g., "is this fact probably still worth surfacing?") may consume a decay-bounded cached score if the drift bound fits the tolerance. A score of `0.94` cached 18h ago on a 72h half-life is safely `> 0.5`; the gate is sound. - **Ordering / arbitration decisions** (ranking two or more records against each other) must re-evaluate *all* candidates at a single `t_now`. Mixed-epoch scores are never comparable. - **Destructive decisions** (`forget`, eviction to free capacity, tombstoning) must re-evaluate at `t_now` and must additionally confirm the record was not touched since `t_eval`. A `forget` gated on a stale score is a data-loss event, and the decay function's reversibility does not extend to deletion. The concrete guardrail: memory tool responses must include `t_eval` and `decay_params` in every acknowledgment, and the agent's state-transfer schema must carry them. On resume, the agent must run a re-validation pass that recomputes retention for any record whose cached `t_eval` predates the resume by more than the decision's tolerance horizon, and must invalidate any cached *ordering* outright. The `forget` primitive should reject calls whose supplied retention argument lacks a matching `t_eval` within a freshness window. ## Operational Effect Without the guardrail, the failure is silent and biased toward *overconfidence in old facts*: cached scores are frozen at their write-time peak, so the agent systematically over-weights the oldest records in any arbitration, exactly inverting the intended decay semantics. The agent believes it is honoring decay while doing the opposite. Across checkpoint/resume cycles the bias compounds—each restore re-freezes the snapshot, so a long-lived agent's scratchpad drifts further from store truth the more reliably it persists state. The fix is not to stop caching; it is to make the timestamp part of the value, so that "stored" is understood as "sampled at `t_eval`," and to route every ordering and destructive decision through a common-epoch re-evaluation. ```python import time from dataclasses import dataclass class StaleRetentionError(RuntimeError): """Raised when a retention score is consumed outside its validity window.""" @dataclass(frozen=True) class RetentionSample: record_id: str score: float t_eval: float # epoch seconds when score was computed half_life: float # seconds; decay params must travel with the value def decay_bound(sample: RetentionSample, t_now: float) -> float: """Upper bound on current retention: decay never increases without a touch.""" elapsed = max(0.0, t_now - sample.t_eval) factor = 0.5 ** (elapsed / sample.half_life) return sample.score * factor def assert_fresh_for_ordering(samples, t_now, tolerance): """Ordering across records requires a single common epoch and bounded drift.""" if not samples: return epochs = {round(s.t_eval, 3) for s in samples} if len(epochs) > 1: raise StaleRetentionError( f"cannot order records sampled at mixed epochs {sorted(epochs)}; " "re-evaluate all candidates at a common t_now" ) for s in samples: drift = s.score - decay_bound(s, t_now) if drift > tolerance: raise StaleRetentionError( f"record {s.record_id} drift {drift:.3f} exceeds tolerance " f"{tolerance:.3f}; cached score is a stale point sample" ) def safe_forget(sample: RetentionSample, t_now: float, threshold: float, freshness_window: float): """Destructive eviction must re-validate at t_now before acting.""" if t_now - sample.t_eval > freshness_window: raise StaleRetentionError( f"forget refused for {sample.record_id}: sample age " f"{t_now - sample.t_eval:.0f}s exceeds freshness window " f"{freshness_window:.0f}s; re-read before destroying" ) current = decay_bound(sample, t_now) if current >= threshold: return False return True # --- failure trace reproduced --- T0 = 1_700_000_000.0 f1 = RetentionSample("F1", score=0.94, t_eval=T0, half_life=72 * 3600) f2 = RetentionSample("F2", score=0.55, t_eval=T0, half_life=72 * 3600) t_resume = T0 + 60 * 3600 # Cached F1 score (0.94) vs fresh-looking F2 (0.55) -> agent wrongly picks F1. # Correct arbitration at a common epoch: assert_fresh_for_ordering([f1, f2], t_now=t_resume, tolerance=0.05) # -> raises StaleRetentionError: drift 0.94 - 0.31 = 0.63 > 0.05 # Destructive path on a stale sample: try: safe_forget(f2, t_now=t_resume, threshold=0.25, freshness_window=3600) except StaleRetentionError as e: print("forget blocked:", e) ```