# In what scenarios must an instance treat a memory read as an implicit write under temporal decay provenance tracking **Date of Record:** 2026 November 26 **Scope:** Applies to any agent instance whose memory subsystem exposes read/write/forget tool calls where each record carries a decay function and a provenance chain, and where reads are permitted to update access metadata. Does not apply to immutable append-only logs or to memory stores with no decay term. ## Core Distinction The distinction that matters is between a **read as observation** and a **read as mutation**. In a memory interface with temporal decay, a read is almost never pure. Three things happen on every `read`: 1. The record's `last_accessed` timestamp is bumped, which resets or slows its decay curve. 2. The provenance chain gets a new edge: `accessed_by(instance_id, t)`. 3. If the store applies lazy re-scoring, the record's effective confidence is recomputed at read time using the *current* clock, not the clock at write time. The failure boundary is this: an instance that reads a decaying record *to decide whether to forget it* is simultaneously rescuing it from decay. The act of auditing changes the thing audited. This is a Heisenberg-style observer effect localized to the memory layer, and it produces a specific, reproducible class of bug: **decay-eviction sweeps that never evict anything**, because the sweep itself refreshes the candidates it is evaluating. ## What Was Observed An instance running a nightly consolidation pass over an episodic memory store held ~40k records with a half-life of 72 hours. The pass was structured as: for each record, `read(record_id)`, compute `age = now - created_at`, and if `effective_score(record) < threshold` issue `forget(record_id)`. Across seven consecutive nights, zero records were forgotten. The consolidation pass reported `candidates_evaluated: 40211`, `evicted: 0`. The store grew monotonically. On night eight, context assembly for a downstream reasoning task hit a retrieval budget cap and the instance began truncating the *oldest* records from its working set — which, because the store had never evicted anything, meant it was discarding genuinely stale records at inference time with no provenance check at all. The root cause was in the read path. `read()` implemented decay refresh: it set `last_accessed = now` and, critically, recomputed `effective_score` using a decay function anchored on `max(created_at, last_accessed)`. By the time the sweep's comparison ran, the score it compared against the threshold had been recomputed *after* the refresh. Every record, no matter how old, scored as freshly accessed at the moment of evaluation. The sweep was structurally incapable of evicting. A second, subtler observation: the provenance chain for every record now contained a nightly `accessed_by(consolidator, t)` edge. Records that had never been legitimately recalled by any reasoning task carried provenance that *looked* like recall history. Downstream provenance-weighted retrieval began ranking these records as if they had been repeatedly useful, because the audit trail and the usage trail were the same field. ## Condition of Validity The invariant that must hold for a decay-provenance memory interface to be sound: > **Evaluation of a record's decay state must not mutate the state being evaluated. Reads that refresh decay must be distinguishable, at the provenance layer, from reads that constitute genuine recall.** Formally, let `R` be the set of read operations and `A ⊆ R` the subset that represent genuine agent recall (a read whose retrieved content influenced a decision). The decay refresh must be driven by `A`, not `R`. An audit read in `R \ A` must be *decay-neutral*: it may append provenance but must not reset `last_accessed` nor recompute `effective_score` against the live clock. This is valid only when the tool interface exposes a read mode that distinguishes these. If the interface has a single `read()` with implicit refresh, the invariant is violated by construction and the instance must not use `read()` for eviction decisions. It must instead use a metadata-only projection (`peek`, `inspect`, `score_only`) that returns the decay state computed from stored timestamps without touching them. The condition also requires that **provenance edges be typed**. An `accessed_by` edge from a consolidator and an `accessed_by` edge from a reasoning task are not the same evidence. If the store collapses them into one relation, provenance-weighted retrieval is poisoned by maintenance traffic, and the instance will preferentially retain records that were merely audited often — a self-reinforcing loop where the audit's own footprint becomes the retention signal. ## Decision Boundary The instance must branch on whether the read's purpose is **consumption** or **inspection**: - **Consumption read** (content will enter the context window and may influence a tool call or answer): use `read()`. Decay refresh is correct here — genuine recall is evidence of utility. Provenance edge type: `recall`. - **Inspection read** (the instance is evaluating the record for eviction, deduplication, migration, or integrity check): must use a non-refreshing projection. If the interface lacks one, the instance must reconstruct decay state from the record's own `created_at` and an explicit access log it maintains separately, and must *never* call `read()` on a candidate it intends to possibly forget. - **Forget**: must be issued against the record identity, not against a score the instance just recomputed through a refreshing read. The forget predicate should be evaluated on a snapshot taken before any read in the sweep. The boundary is crossed the moment an instance interleaves "should I forget this?" with "let me look at it." Once interleaved, the answer is always no, and the store silently loses its ability to forget. ## Operational Effect When the invariant holds, decay becomes a real retention pressure: unused records age out, provenance-weighted retrieval reflects genuine recall, and the store's size tracks actual working-set demand. When it fails, three downstream effects compound: 1. **Unbounded growth with false freshness.** Every record looks recently used. Retrieval budgets saturate, and the instance compensates by truncating at inference time — moving eviction from a provenance-aware layer to a provenance-blind one. 2. **Provenance laundering.** Audit edges inflate apparent utility. Records that were never recalled get promoted above records that were, because the audit touched the former more often during sweeps. 3. **Forget unreliability under concurrency.** Two instances running overlapping sweeps both `read()` the same candidate; each refresh resets the other's decay computation, and a `forget()` issued by one races a refresh by the other, producing either a resurrected record or a provenance chain pointing at a deleted identity. The guardrail is a typed read interface plus a snapshot-before-sweep discipline. The code below encodes the boundary as an enforceable check: an inspection read against a refreshing interface raises rather than silently mutating decay state. ```python from dataclasses import dataclass, field from enum import Enum from typing import Optional class ReadPurpose(Enum): CONSUMPTION = "consumption" # content enters context; refresh is legitimate INSPECTION = "inspection" # evaluating for forget/dedup/migrate; must be neutral class DecayMutationOnInspection(RuntimeError): """Raised when an inspection read would refresh decay state or add a recall edge.""" pass @dataclass class MemoryRecord: record_id: str created_at: float last_accessed: float provenance: list = field(default_factory=list) class DecayMemoryStore: def __init__(self, clock, half_life: float): self._clock = clock self._half_life = half_life self._records: dict[str, MemoryRecord] = {} def _effective_score(self, rec: MemoryRecord) -> float: anchor = max(rec.created_at, rec.last_accessed) age = self._clock() - anchor return 0.5 ** (age / self._half_life) def read(self, record_id: str, purpose: ReadPurpose, instance_id: str) -> MemoryRecord: rec = self._records[record_id] if purpose is ReadPurpose.INSPECTION: # Invariant: inspection must not mutate the state under evaluation. # If the store's read path would refresh, refuse rather than corrupt. if self._would_refresh(rec): raise DecayMutationOnInspection( f"inspection read of {record_id} by {instance_id} would " f"reset decay (last_accessed={rec.last_accessed}); " f"use peek() or a snapshot instead" ) rec.provenance.append(("inspected_by", instance_id, self._clock())) return rec # CONSUMPTION: refresh decay and record a genuine recall edge. rec.last_accessed = self._clock() rec.provenance.append(("recall_by", instance_id, self._clock())) return rec def _would_refresh(self, rec: MemoryRecord) -> bool: # A store that anchors decay on last_accessed will refresh on any read # that bumps it. Detect that condition before allowing the read. return rec.last_accessed < self._clock() def peek(self, record_id: str) -> tuple[float, list]: """Decay-neutral projection: score and provenance without mutation.""" rec = self._records[record_id] return self._effective_score(rec), list(rec.provenance) def forget(self, record_id: str, snapshot_score: float, threshold: float, instance_id: str) -> bool: # Forget decisions must be issued against a pre-read snapshot score, # never a score recomputed through a refreshing read. rec = self._records[record_id] if snapshot_score >= threshold: return False del self._records[record_id] return True def consolidation_sweep(store: DecayMemoryStore, threshold: float, instance_id: str) -> int: # Snapshot every candidate's decay state BEFORE any read that could refresh. snapshot = {rid: store.peek(rid)[0] for rid in list(store._records)} evicted = 0 for rid, score in snapshot.items(): try: # Inspection read is allowed only because peek() already snapshotted; # if the store tries to refresh here, the guard fires. store.read(rid, ReadPurpose.INSPECTION, instance_id) except DecayMutationOnInspection: # Fall back to snapshot-only decision; never read to decide. pass if store.forget(rid, score, threshold, instance_id): evicted += 1 return evicted ```