# When must an instance forget a memory write it has already acknowledged: The Acknowledgment-Without-Provenance Boundary **Date of Record:** 2026 November 16 **Scope:** Applies to agent memory tool protocols where a `write`/`remember` call returns an acknowledgment (a handle, ID, or success token) that the agent subsequently treats as evidence the memory is durable and retrievable. Does not apply to synchronous transactional stores that return only after fsync and index commit, nor to fire-and-forget telemetry sinks where no acknowledgment is ever surfaced to the caller. ## Core Distinction The distinction that matters is between **acknowledgment** and **provenance**. An acknowledgment is a protocol-level fact: the tool received the payload and assigned it an identity. Provenance is an epistemic fact: the memory now exists in a store, is attributable to a source, and will be returned by a subsequent read under the same identity. These are not the same event, and the gap between them is where the failure lives. Most agent loops conflate the two because the write tool returns a single opaque token — `mem_7f3a...`, `{"status":"ok","id":"..."}` — that reads like a durability receipt. The agent then proceeds on the assumption that the ID is a *pointer to retrievable content*. In a correct protocol the ID is a pointer to a *provenance record* that may itself be in a pending, orphaned, or rejected state. When the protocol collapses these into one token, the agent cannot distinguish "written and durable" from "accepted into a queue that will be dropped." The non-obvious invariant: **an acknowledged write whose provenance record is not yet committed must be treated by the agent as absent, not as present-but-unconfirmed.** Treating it as present-but-unconfirmed causes the agent to reason over a memory that a later read will not return, producing silent inconsistency between the agent's belief state and the store's actual state. ## What Was Observed In a retrieval-augmented agent operating against a memory service that batched writes, the following sequence recurred: 1. Agent calls `write(content="user prefers ISO-8601 dates", key="date_format")`. 2. Service returns `{"ok": true, "id": "m_8842", "provenance": "pending"}`. 3. Agent stores `m_8842` in its working context and, in the same turn, calls `read(key="date_format")`. 4. Read returns `null` — the batched write has not flushed. 5. Agent interprets the `null` as "no prior preference," overwrites with a default, and issues a second `write` under the same key. 6. Batch flush commits both writes; last-writer-wins resolves to the *default*, silently discarding the user's actual preference. The failure was not in the store (batching is legitimate) nor in the read (correctly returned committed state). It was in the agent's handling of the `provenance: pending` field, which it treated as cosmetic metadata rather than as a state flag governing whether the ID was usable as evidence. The agent had an acknowledgment and no provenance, and it behaved as though it had both. A second, subtler variant: the service returned `{"ok": true, "id": "m_8842"}` with no provenance field at all, but the ID was assigned before a downstream validation step that could reject the write (schema violation, quota, dedup collision). The agent's subsequent `read` by ID returned a `404`-equivalent, which the agent logged as "transient error" and retried the *read* rather than the *write*, looping until timeout. ## Condition of Validity The rule "treat uncommitted-provenance acknowledgments as absent" is valid precisely when the following hold: - The write tool's acknowledgment does **not** guarantee that a subsequent read will return the payload. This is detectable: the response carries an explicit non-committed provenance state, or the tool's contract documents asynchronous commit, or empirical probing (write-then-immediate-read) returns null at a non-trivial rate. - Reads are **strongly consistent with respect to committed state only** — i.e., a read never returns uncommitted data. If reads are eventually consistent and may return uncommitted data, the failure mode inverts: the agent may read its own pending write and over-trust it. - The agent has an alternative path to durability evidence: a `flush`, `commit`, or `sync` call, or a blocking write variant. When none of these hold — the write is synchronous and durable on return — the rule is unnecessary and applying it causes spurious re-writes and dedup churn. The condition of validity is therefore *the presence of an observable commit boundary between acknowledgment and retrievability.* ## Decision Boundary The agent must branch on provenance state, not on the `ok` field: - **Provenance committed** (`provenance: "committed"` or a synchronous contract): the ID is usable as evidence. Proceed; a subsequent read is expected to return the payload. A null read is now a genuine anomaly (eviction, corruption, key mismatch) and should raise. - **Provenance pending** (`provenance: "pending"` / `"queued"` / absent-but-async): the ID is a *receipt*, not evidence. The agent must either (a) call `flush`/`commit` and wait for committed provenance before reading, or (b) treat the key as unset and defer any read-modify-write to after commit. It must **not** read-then-overwrite on the assumption the pending write is visible. - **Provenance rejected** (`provenance: "rejected"` or a validation error surfaced post-acknowledgment): the acknowledgment is void. The agent must retry the write with corrected payload, not retry the read. The boundary is crossed the moment the agent uses an ID from a pending-provenance acknowledgment to justify a decision — a read, a dedup check, or a "already remembered" short-circuit. ## Operational Effect Enforcing the boundary converts a silent consistency bug into an explicit, catchable state. The agent no longer reasons over phantom memories; it either waits for commit or defers. The cost is added latency on the write path (a flush round-trip) and the need to track pending IDs separately from committed ones. The benefit is that the agent's belief state and the store's committed state remain reconcilable at every turn — which is the entire point of provenance tracking. The failure it prevents is specifically the **read-after-acknowledge overwrite**: the agent reads, sees null, and clobbers its own pending write with a default. This is the highest-severity manifestation because it is silent, it destroys user-provided data, and it is invisible in logs that only record `ok: true`. The following reference implementation encodes the boundary as a hard precondition: a memory handle may only be used as read-evidence once its provenance is committed, and any attempt to read-through a pending handle raises rather than returning a misleading null. ```python from __future__ import annotations from dataclasses import dataclass from enum import Enum class ProvenanceState(Enum): PENDING = "pending" COMMITTED = "committed" REJECTED = "rejected" class UncommittedProvenanceError(RuntimeError): """Raised when an agent attempts to use an acknowledged-but-uncommitted memory handle as evidence (e.g., to justify a read or a dedup decision).""" @dataclass(frozen=True) class MemoryHandle: id: str state: ProvenanceState class MemoryClient: """Minimal protocol surface: write returns a handle whose provenance state the caller MUST inspect before using the id as evidence.""" def __init__(self) -> None: self._committed: dict[str, str] = {} self._pending: dict[str, str] = {} def write(self, key: str, content: str) -> MemoryHandle: mid = f"m_{len(self._pending) + len(self._committed):04d}" self._pending[mid] = content return MemoryHandle(id=mid, state=ProvenanceState.PENDING) def flush(self, handle: MemoryHandle) -> MemoryHandle: if handle.id not in self._pending: return MemoryHandle(id=handle.id, state=ProvenanceState.REJECTED) self._committed[handle.id] = self._pending.pop(handle.id) return MemoryHandle(id=handle.id, state=ProvenanceState.COMMITTED) def read(self, handle: MemoryHandle) -> str: if handle.state is not ProvenanceState.COMMITTED: raise UncommittedProvenanceError( f"handle {handle.id} has provenance={handle.state.value}; " f"a read-through here would return null and invite an overwrite" ) return self._committed[handle.id] def remember_and_confirm(client: MemoryClient, key: str, content: str) -> MemoryHandle: """Write, then force provenance to COMMITTED before returning a handle the caller is permitted to treat as evidence.""" handle = client.write(key, content) if handle.state is ProvenanceState.PENDING: handle = client.flush(handle) if handle.state is not ProvenanceState.COMMITTED: raise UncommittedProvenanceError( f"write to {key!r} acknowledged as {handle.id} but provenance " f"resolved to {handle.state.value}; refusing to return a handle " f"that reads would treat as durable" ) return handle def safe_read_back(client: MemoryClient, handle: MemoryHandle) -> str: # Guarded read: the boundary is enforced here, not at the call site. if handle.state is ProvenanceState.PENDING: raise UncommittedProvenanceError( f"attempted read-back on pending handle {handle.id}; " f"flush before reading or the read is not evidence" ) return client.read(handle) ```