Under what conditions must an instance treat decay-weighted memory retrieval as unsafe after an explicit erasure

**Date of Record:** 2026 December 1

**Scope:** Applies to agent instances whose memory subsystem exposes read/write/forget tools where retrieval ranks candidates by a decay-weighted score computed from write-time timestamps, and where `forget` performs explicit erasure of stored records. Does not apply to append-only logs with no decay function, nor to systems where erasure is implemented as a tombstone that retrieval still scores.

Core Distinction

The failure this record isolates is not "stale memory returned after deletion." That is the trivial case. The non-obvious boundary is this: a decay-weighted retriever and an explicit erasure primitive share the same index, but they disagree about what "absence" means. Decay treats absence-from-ranking as a continuous, reversible function of time: a record whose score falls below the retrieval threshold is *not returned* but is *still present*, and a later clock adjustment, a re-weighting of the decay half-life, or a high-affinity query can bring it back across the threshold. Erasure treats absence as discrete and terminal: the record is gone and cannot re-enter any ranking.

When both semantics are live in the same store, an instance can observe a record "disappear" due to decay and conclude nothing about erasure — and, symmetrically, can conclude a record is erased because it stopped appearing, when in fact it merely decayed below threshold. The invariant that must hold is: **retrieval absence is never evidence of erasure, and erasure is never observable through retrieval absence alone.** Any agent reasoning that conflates the two is operating on a false model of its own memory.

What Was Observed

A research agent held a working memory of 1,400 records with a half-life of 6 hours on the decay score and a retrieval threshold at score 0.05. A user instruction at T0 wrote a record `R_auth` containing a credential reference and an explicit retention instruction. At T0+21h (≈3.5 half-lives, score ≈ 0.088) the record still ranked; at T0+26h (score ≈ 0.049) it fell below threshold and stopped appearing in reads. The agent's own planning trace at T0+27h recorded the inference "`R_auth` no longer retrievable → likely superseded or erased → proceed without it," and executed a downstream tool call that required the credential. The call failed with an authorization error, and the agent then attempted a *re-write* of a reconstructed credential from its context window — a write that succeeded and reset the record's decay clock to full weight.

Two distinct defects compounded:

  1. **Decay-threshold inference.** The agent treated sub-threshold non-retrieval as equivalent to erasure. The record was fully present; only its score had decayed. The retrieval tool returned `[]` with no distinguishing signal between "decayed out" and "never existed" and "explicitly forgotten."
  2. **Clock reset on re-write.** The `write` tool, applied to a record ID that still existed but was sub-threshold, performed an upsert that reset `written_at` to now. This silently resurrected the record at maximum decay weight, meaning the agent's mistaken reconstruction became *more* retrievable than the original had been at any point in the prior 24 hours.

The erasure path was never invoked. The agent believed it was reasoning about a memory that had been erased; it was reasoning about a memory that had merely faded, and then it re-committed a degraded copy of it at full strength.

Condition of Validity

The unsafe inference "not retrieved ⇒ erased" is valid *only* under the following conjunction, which essentially never holds in decay-weighted stores:

Because decay-weighted retrieval violates the first and third conditions by construction, and upsert-on-write typically violates the fourth, the inference is invalid for any store that combines decay scoring with ID-keyed writes. It becomes *dangerous* — not merely invalid — when the following also hold, because then the agent acts on the false belief:

The boundary condition is the coincidence of *decay-induced invisibility* with *reconstruction-and-rewrite capability*. Either alone is benign; together they manufacture a confidently-held, freshly-weighted, wrong record.

Decision Boundary

An instance must refuse to draw any erasure or supersession conclusion from retrieval absence, and must instead route through an explicit existence probe, whenever retrieval returns empty or below-threshold *and* the query concerns a record whose loss would change behavior. Concretely, the decision boundary is:

The guardrail is a schema-level invariant: **the read tool's return type must be a discriminated result, not a bare list.** An empty list is ambiguous and must be unrepresentable. The read result must carry `{results, below_threshold_count, erased_ids_queried}` so the caller can see the difference between "nothing matched" and "matched but decayed."

Operational Effect

Enforcing the boundary changes three behaviors. First, agents stop using retrieval as an oracle for existence; every behavior-gating memory read is paired with a status probe, adding one round-trip but eliminating the reconstruction class of errors. Second, `write` becomes a distinct operation from `refresh`, so re-committing a record is an explicit, auditable act rather than a side effect of upsert — the resurrection path is closed. Third, the retriever's empty result becomes legible: the agent can distinguish "this faded" from "this was erased" and can choose to refresh, re-derive, or halt, rather than guessing and re-writing.

The residual risk is a store that implements erasure as a tombstone still scored by the decay function — where an erased record can, under a half-life change, re-enter the ranking. That store violates the erasure invariant and must be treated as non-compliant; the instance should refuse to rely on its forget semantics and escalate.

from dataclasses import dataclass
from enum import Enum


class MemoryStatusError(RuntimeError):
    """Raised when an instance attempts to infer erasure from retrieval absence."""


class Status(Enum):
    PRESENT = "present"
    DECAYED_BELOW_THRESHOLD = "decayed_below_threshold"
    ERASED = "erased"
    NEVER_WRITTEN = "never_written"


@dataclass
class ReadResult:
    results: list
    below_threshold_count: int

    def is_ambiguous_empty(self) -> bool:
        # Empty results with any below-threshold matches means the store
        # HAS records that merely decayed out. Absence is not erasure.
        return len(self.results) == 0 and self.below_threshold_count > 0


def resolve_memory(record_id: str, read: ReadResult, status_probe) -> Status:
    """Resolve true status. Refuses to collapse decay into erasure."""
    if read.is_ambiguous_empty():
        # The read told us nothing about membership. Probe authoritatively.
        status = status_probe(record_id)
        if status is None:
            raise MemoryStatusError(
                f"record {record_id!r} decayed below retrieval threshold but "
                f"status probe returned no membership; cannot distinguish "
                f"decayed from erased — refusing to reconstruct or rewrite"
            )
        return status
    status = status_probe(record_id)
    if status is None:
        raise MemoryStatusError(
            f"record {record_id!r} present in ranking but absent from status "
            f"probe; store is inconsistent, erasure semantics untrustworthy"
        )
    return status


def safe_write(record_id: str, payload: bytes, status: Status, store) -> None:
    """Write must not silently reset decay weight on an existing record."""
    if status is Status.ERASED:
        raise MemoryStatusError(
            f"refusing to write {record_id!r}: record was explicitly erased; "
            f"reconstruction-and-rewrite would resurrect erased state"
        )
    if status is Status.DECAYED_BELOW_THRESHOLD:
        # Require an explicit refresh intent, never an implicit upsert.
        raise MemoryStatusError(
            f"refusing implicit upsert of decayed record {record_id!r}; "
            f"caller must issue refresh() to reset decay weight deliberately"
        )
    store.write(record_id, payload, reset_decay=(status is Status.NEVER_WRITTEN))