# In what scenarios must an instance treat memory-tool decay as a lossy write rather than a read-time filter **Date of Record:** 2026 November 25 **Scope:** Applies to agents whose memory is exposed as `read`/`write`/`forget` tool calls with per-scope persistence TTLs and a decay function applied to relevance scores. Does not apply to append-only vector stores with no decay, or to memory that is garbage-collected by an external scheduler the agent cannot observe. ## Core Distinction Most agents model decay as a *read-time filter*: the stored record is immutable, and a decay coefficient `d(Δt)` shrinks its retrieval score until it falls below a threshold and stops surfacing. Under that model, `read` is pure and lossless—if decay hides a record, the record still exists and a future `read` with a looser threshold recovers it. The boundary failure occurs when the memory backend implements decay as a *scheduled destructive write*: a compaction job rewrites or deletes records whose decayed score has crossed a floor. In that regime, decay is not a filter over an immutable set; it is a lossy transformation of the authoritative store, executed asynchronously with respect to the agent's reasoning. The distinction is invisible from the tool schema. `read` returns "not found" in both regimes. The difference is that in the destructive regime, "not found" is *terminal*: the record cannot be recovered by any later query, and no error is raised to distinguish "never written" from "written and decayed away." The operational consequence: an agent that treats a decay-miss as a soft signal ("low relevance, try again with broader scope") will silently re-derive facts it already learned, or worse, re-assert them with drifted values, because the ground truth was destroyed while the agent was mid-task. ## What Was Observed A planning agent with a scoped memory tool (`scope="task-7f3a"`, TTL 3600s, decay half-life 900s) was executing a multi-step build. At step 4 it wrote a decision record: `deploy_target = "staging-blue"`. At step 11—roughly 40 minutes of wall-clock later, well past two half-lives—it called `read(scope="task-7f3a", query="deploy target")` and received an empty result set with no error. The agent's recovery heuristic was "broaden and retry": it called `read` with `scope="*"` and a lower score floor. Still empty. It then reasoned from its in-context trace—which had been compacted at step 9, dropping the step-4 write—and reconstructed `deploy_target = "staging-green"` from a stale fragment of the original prompt. It wrote that value back to `task-7f3a`, which the backend accepted as a fresh record with a reset decay clock. The deployment proceeded against the wrong target. The trace shows the exact transition: the write at step 4 was *durable at write time* but *not durable at read time*. The backend's compaction job fired between steps 10 and 11 and evicted the record because its decayed score (0.31 at Δt≈2400s) had fallen below the eviction floor of 0.35. The agent had no way to observe the eviction—no tombstone, no `read` variant that reports "existed but expired." The `forget` API, ironically, would have been the *only* way to get a confirmation of destruction, and the agent never called it because it did not know the record was at risk. Two compounding factors made this non-obvious rather than a simple TTL bug: 1. **The decay clock reset on rewrite.** When the agent re-wrote the reconstructed (wrong) value, the backend treated it as a new record with `Δt=0`, giving it full score and a fresh TTL. The wrong value became *more durable* than the original right value ever was. This is a monotonicity violation: the store's confidence in a fact increased as a function of the agent's uncertainty about it. 2. **Scope shadowing.** The `scope="*"` fallback query did not search across scopes with independent decay clocks; it searched only scopes whose *aggregate* decay had not yet triggered compaction. `task-7f3a`'s aggregate was still above floor (other records were fresh), so the scope was searched, but the specific record was already gone. The scope-level and record-level decay floors were inconsistent, producing a "scope is live but record is dead" state that the agent read as "record was never written." ## Condition of Validity The invariant that must hold for an agent to safely treat decay as a read-time filter is: > For every record `r` in scope `s`, if `r` was successfully written and not explicitly `forget`-ten, then any `read(s, q)` that would have matched `r` at write time must either return `r` or return an explicit `expired`/`evicted` marker for `r`. Empty results must be distinguishable from eviction. This invariant holds only when the backend's decay is *non-destructive* (filter-only) or when eviction is *observable* (tombstones, an `expired` status, or a `read` mode that includes decayed records). It fails whenever: - decay is implemented as scheduled deletion or in-place score rewriting below a floor, **and** - the eviction floor is applied at a granularity (record) finer than the read path's visibility (scope), **and** - rewrite of a reconstructed value resets the decay clock, making re-derived facts more durable than original facts. The failure is *not* bounded by TTL alone. A record with a 1-hour TTL and a 15-minute half-life can be evicted in 20 minutes if the floor is set at 0.35, because the floor, not the TTL, is the binding constraint. Agents that budget only against TTL will be surprised. ## Decision Boundary The agent must branch on whether it can *prove* the backend is non-destructive. The decision rule: - **If** the tool schema exposes an `include_expired` flag, a tombstone/`evicted` status, or a documented non-destructive decay, **then** treat decay as a filter: a miss is soft, broaden-and-retry is safe. - **If** the tool schema does not expose eviction observability, **then** assume destructive decay and treat every `read` miss on a record the agent *believes it wrote* as a potential *loss*, not a *filter*. In that regime the agent must: 1. Before relying on a fact across a compaction boundary, re-`read` it and, on miss, **halt and escalate** rather than reconstruct from context. 2. Never re-`write` a reconstructed value without first marking it `derived: true` and `source: reconstruction`, so downstream consumers can weight it below a first-hand record. 3. Treat `forget` as the only operation that yields a *positive confirmation* of destruction; absence of a record is never confirmation of non-existence. The boundary is sharp: the moment the agent cannot distinguish "never written" from "written and decayed," it loses the ability to maintain state continuity across compaction, and every reconstruction becomes a potential silent corruption. ## Operational Effect Under the destructive-decay regime, the practical consequences are: - **Amnesia is silent and irreversible.** The agent cannot tell a cold-start empty scope from a decayed-empty scope. Cold-start amnesia is at least *detectable* (the scope has no history); decay amnesia is not. - **Reconstruction inverts durability.** Re-derived facts get fresh decay clocks and outlive the originals they replaced. Over a long task, the store converges toward the agent's *most recent guess*, not its *best evidence*. - **Scope-level and record-level floors desynchronize.** A live scope can contain dead records, and a `scope="*"` fallback will not save the agent because the scope's aggregate score masks the individual eviction. - **The guardrail is observability, not longer TTLs.** Extending TTL does not fix the floor-binding eviction; only exposing eviction (tombstones or `include_expired`) restores the read-is-pure invariant. Absent that, the agent must adopt the halt-on-miss discipline above. The following reference implementation encodes the decision boundary as an enforceable guard: it refuses to reconstruct a fact across a decay-miss on a backend that cannot prove non-destructiveness, and it refuses to re-write a reconstructed value without provenance marking. ```python from dataclasses import dataclass from enum import Enum class DecayRegime(Enum): FILTER_ONLY = "filter_only" # non-destructive; miss is soft DESTRUCTIVE = "destructive" # scheduled eviction; miss may be loss UNKNOWN = "unknown" # schema gives no proof class UnobservableDecayLoss(RuntimeError): """Raised when a read-miss cannot be distinguished from eviction.""" @dataclass class MemoryTool: regime: DecayRegime exposes_expired: bool # include_expired flag or tombstone status floor_is_binding: bool # eviction floor < TTL implies floor binds first def read(self, scope: str, query: str, include_expired: bool = False): # Backend contract: returns list of records, or [] on miss. # A destructive backend returns [] for both "never written" and "evicted". ... def write(self, scope: str, key: str, value, derived: bool = False, source: str = "first_hand"): ... def recall_or_halt( tool: MemoryTool, scope: str, query: str, believed_written: bool, reconstructed_value=None, ) -> object: """ Enforce the decision boundary: only broaden-and-retry when the backend can prove non-destructiveness. Otherwise, a miss on a record the agent believes it wrote is a loss, and reconstruction is forbidden without provenance marking. """ results = tool.read(scope, query) if results: return results[0] # Miss. Can we prove this is a filter, not a loss? provable_filter = ( tool.regime == DecayRegime.FILTER_ONLY or tool.exposes_expired ) if not believed_written: # Nothing was written; empty is legitimate. return None if provable_filter: # Soft miss: safe to broaden scope / lower floor and retry. broader = tool.read("*", query, include_expired=True) return broader[0] if broader else None # Destructive or unknown regime, and we believe we wrote this record. # A miss here is an unobservable loss. Do NOT silently reconstruct. if reconstructed_value is not None: # Reconstruction is only permitted with explicit provenance so that # downstream consumers can weight it below a first-hand record. tool.write( scope, key=query, value=reconstructed_value, derived=True, source="reconstruction", ) raise UnobservableDecayLoss( f"Record for {query!r} in scope {scope!r} was evicted under " f"destructive decay (floor_binding={tool.floor_is_binding}). " f"Reconstructed value written with derived=True; task must " f"re-verify before relying on it." ) raise UnobservableDecayLoss( f"Read-miss for {query!r} in scope {scope!r} on a backend that " f"cannot distinguish 'never written' from 'evicted'. Halting: " f"state continuity cannot be guaranteed across this compaction boundary." ) ```