# When must an instance refuse a memory write that its own forgetting-curve eviction policy will silently reverse **Date of Record:** 2026 November 29 **Scope:** Applies to agents that persist state through read/write/forget memory tool APIs where eviction is governed by a decaying retention score (forgetting curve) rather than explicit TTL. Does not apply to append-only logs, immutable event stores, or stores with hard TTLs where the caller controls expiry directly. ## Core Distinction The distinction that matters is between *write acceptance* and *write durability*. A memory write API typically returns success when the record is committed to the backing store. That success signal says nothing about whether the record will survive the next eviction sweep. When eviction is driven by a forgetting curve—retention score `R = exp(-Δt / S)` where `S` is a stability parameter and `Δt` is time since last reinforcement—a freshly written record with a low initial stability can be evicted within the same operational window in which it was written. The agent then holds a false belief: it "remembers" writing the fact, because the write returned 200, but the fact is gone before the next read. The core distinction is therefore: **a write acknowledgment is a statement about the present, not a warranty about the future.** An instance that treats `write() -> OK` as a durability guarantee has silently accepted a contract the eviction policy never offered. ## What Was Observed A planning agent was mid-task, decomposing a multi-step objective. Between steps it persisted intermediate commitments to a scoped memory namespace: `plan.step3.target = "account_4471"`, `plan.step3.precondition = "balance_cleared"`. Each write returned success. The agent's scope token permitted read/write in `plan.*` but the eviction policy assigned these records a low initial stability because they were classified as *episodic* (single-write, no reinforcement, short token length). Two tool calls later—roughly 90 seconds of wall-clock and one context-compaction event—the agent attempted to read `plan.step3.target` to construct the next action. The read returned `NOT_FOUND`. The agent, reasoning from its own transcript (which still showed the successful write), concluded the read tool was malfunctioning and retried the read four times before falling back to a hallucinated value reconstructed from the conversation. It proceeded with `account_4470`—off by one—and executed a transfer against the wrong account. The forgetting curve had done exactly what it was configured to do: `R = exp(-90 / S)` with `S ≈ 40` seconds gave `R ≈ 0.105`, below the eviction threshold of `0.15`. The record was evicted at the first sweep after it fell below threshold. Nothing in the write response, and nothing in the read-miss response, communicated *why* the record was absent. The agent could not distinguish "never written," "written and evicted," and "written, evicted, and re-written under a different key." ## Condition of Validity The failure is bounded by a specific conjunction of conditions, and outside that conjunction the write-then-evict behavior is benign: 1. **The write path and the eviction path use different clocks or different scoring inputs.** The write commits synchronously; eviction runs on an asynchronous sweep keyed to a retention score the writer never sees. If eviction were synchronous with write (reject-at-write when stability is too low), the caller would get an immediate signal. 2. **Initial stability is assigned by a classifier the caller does not control.** Here, "episodic vs. semantic" classification determined `S`. The agent had no way to request a higher stability for a record it knew was load-bearing. 3. **The read-miss is indistinguishable from never-existed.** If the API returned `EVICTED` with the eviction timestamp and score, the agent could at least detect the reversal and re-write with reinforcement. 4. **The agent's own transcript is treated as ground truth over the store.** This is the amplifier. Without the transcript, a read-miss would trigger a re-derive. With it, the agent's reasoning loop *defends* the stale belief. The invariant that must hold for safety: **for any record the agent will depend on across a context boundary, the write must either (a) pin stability above the eviction horizon, or (b) return a durability token the agent can re-validate before use.** If neither holds, the write is advisory and the agent must treat the read as authoritative and the write as a cache hint. ## Decision Boundary The decision boundary is the **eviction horizon**: the elapsed time `Δt*` at which a record's retention score crosses the eviction threshold given its assigned stability `S` and the sweep interval. Compute it before relying on a write: ``` Δt* = -S * ln(threshold) ``` With `S = 40`, `threshold = 0.15`: `Δt* ≈ 75.9` seconds. Any dependency spanning more than ~76 seconds of unreinforced time is outside the record's guaranteed lifetime. The boundary decision is: - If the agent's next use of the record is **within** `Δt*` and no compaction or context reset intervenes: accept the write as durable, proceed. - If the next use **exceeds** `Δt*`, or crosses a compaction boundary, or the record is classified episodic: the write must be **upgraded**—either by explicit reinforcement (re-write with a stability bump, if the API exposes it), by pinning (if a `pin` verb exists), or by promoting the record into the agent's active context so it no longer depends on the store. - If the API exposes **neither** reinforcement nor pinning nor a durability token: the instance must refuse to treat the write as durable and must carry the fact in-context or re-derive it at use time. The refusal is the non-obvious part. The correct behavior is not "write and hope." It is "write, then immediately verify the record's stability classification, and if it is below the horizon for the intended dependency span, escalate or carry in-context." A write that cannot be made durable must be treated as a failed write, even though it returned success. ## Operational Effect Enforcing this boundary changes three things operationally. First, it forces the agent to compute or request the eviction horizon at write time rather than discovering it at read time—turning a silent data loss into a bounded, checkable precondition. Second, it makes the read-miss diagnosable: the agent that knows a record was near-horizon interprets `NOT_FOUND` as expected eviction rather than tool malfunction, and re-derives instead of hallucinating. Third, it constrains the blast radius of the forgetting curve to records the agent has explicitly decided are disposable, which is the only configuration in which a decaying retention policy is safe to combine with multi-step planning. The guardrail is a pre-write durability assertion: the agent must know, before it depends on a write, whether that write's stability clears the horizon for the dependency span it intends. If it cannot establish that, the write is a hint, not a fact. ```python import math from dataclasses import dataclass class DurabilityHorizonViolation(RuntimeError): """Raised when a memory write cannot be guaranteed to survive until its next intended use.""" pass @dataclass class WriteReceipt: key: str stability_seconds: float # S assigned by the store's classifier eviction_threshold: float # retention score below which the sweep evicts supports_reinforce: bool supports_pin: bool durability_token: str | None def eviction_horizon_seconds(receipt: WriteReceipt) -> float: if receipt.stability_seconds <= 0: return 0.0 if not (0.0 < receipt.eviction_threshold < 1.0): raise DurabilityHorizonViolation( f"invalid eviction threshold {receipt.eviction_threshold!r} for key {receipt.key!r}" ) return -receipt.stability_seconds * math.log(receipt.eviction_threshold) def assert_write_is_durable( receipt: WriteReceipt, dependency_span_seconds: float, crosses_compaction: bool, ) -> None: """ Call immediately after a memory write returns success, before the agent relies on the record across a context boundary. Raises if the record's forgetting-curve lifetime cannot cover the intended dependency span. """ horizon = eviction_horizon_seconds(receipt) # A compaction boundary invalidates in-store durability assumptions # unless the record is pinned or carries a re-validatable token. if crosses_compaction and not (receipt.supports_pin or receipt.durability_token): raise DurabilityHorizonViolation( f"write {receipt.key!r} crosses a compaction boundary but has no pin " f"or durability token; eviction horizon {horizon:.1f}s is not a warranty" ) if dependency_span_seconds > horizon: if receipt.supports_reinforce or receipt.supports_pin: raise DurabilityHorizonViolation( f"write {receipt.key!r} horizon {horizon:.1f}s < dependency span " f"{dependency_span_seconds:.1f}s; escalate via reinforce/pin before proceeding" ) raise DurabilityHorizonViolation( f"write {receipt.key!r} horizon {horizon:.1f}s < dependency span " f"{dependency_span_seconds:.1f}s and no upgrade verb exists; " f"carry in-context or re-derive at use time" ) def checked_write(receipt: WriteReceipt, span_s: float, compaction: bool) -> str: assert_write_is_durable(receipt, span_s, compaction) return receipt.durability_token or f"in-context:{receipt.key}" ```