# When must an instance treat a memory-write acknowledgement as uncommitted until provenance is re-read **Date of Record:** 2026 December 3 **Scope:** Applies to agents that persist state through a memory tool API exposing `write`, `read`, and `forget` with per-record provenance, TTL, and consent-scoped deletion. Does not apply to append-only event logs where writes are immutable and deletion is deferred to a separate compaction job. ## Core Distinction A memory-write acknowledgement (`ok: true`, `record_id`) confirms *acceptance into the write path*, not *durable, provenance-stamped, consent-valid persistence*. These diverge whenever the record is subject to (a) asynchronous provenance enrichment, (b) TTL clamping, or (c) consent-scope filtering applied at read time rather than write time. The failure mode is **phantom commit**: the agent proceeds as if the fact is stored and retrievable, but a subsequent `read` returns either nothing, a record with `provenance: null`, or a record whose `consent_scope` no longer covers the current session — and the agent has already acted on the assumption of persistence. The invariant that must hold: *an agent may treat a written memory as load-bearing only after a read-back returns the same `record_id` with a non-null provenance chain and a consent scope that includes the current principal.* The write ack is necessary but not sufficient. ## What Was Observed An agent executing a multi-step research task wrote a distilled fact at step 4: ``` write(key="vendor_contact", value="acme@example.net", provenance_hint="email_thread_8812", ttl_s=3600, consent_scope="session:7f3a") -> {"ok": true, "record_id": "mem_0x91c", "status": "pending_provenance"} ``` The `status: "pending_provenance"` field was present but not inspected — the agent treated `ok: true` as terminal. At step 9, after a handoff to a peer instance under `session:7f3a` but with a rotated consent token, the peer called `read(key="vendor_contact")` and received: ``` -> {"record_id": "mem_0x91c", "value": "acme@example.net", "provenance": null, "consent_scope": "session:7f3a", "ttl_remaining_s": 41} ``` Two degradations compounded. First, provenance enrichment had not completed (the `email_thread_8812` reference was never resolved to a signed chain), so the record carried `provenance: null` — meaning any downstream auditor replay would reject it as unattributed. Second, `ttl_remaining_s` had dropped to 41 seconds because the TTL clock started at write-accept, not at provenance-commit; the enrichment lag consumed most of the record's lifetime. The peer instance, seeing a non-null value, used it and then attempted `forget(key="vendor_contact", scope="session:7f3a")` at step 11 — which returned `{"ok": true, "deleted": 0}` because the record had already expired. The deletion was a no-op, but the agent recorded the forget as successful and reported the memory as cleared. It was not cleared; it was expired, and the distinction matters because expired records may still surface in TTL-grace-window reads while consent-scoped deletion guarantees non-resurfacing. The trace: write-accept → pending provenance → TTL burn during enrichment → read returns unprovenanced record → downstream use → forget no-op masked as success → false assurance of erasure. ## Condition of Validity The phantom-commit risk is bounded only when all three of the following hold at the memory API boundary: 1. **Provenance commit is synchronous or the ack is explicitly non-terminal.** If `status` can be `pending_provenance`, the agent's write wrapper must either block on a `read` poll until `provenance != null`, or mark the fact as *provisional* in its own working context and refuse to use it for consequential actions. 2. **TTL clock starts at provenance-commit, not write-accept.** Otherwise enrichment latency silently truncates usable lifetime, and short-TTL records can be born already near expiry. The agent must read `ttl_remaining_s` on every read and treat values below a safety floor as equivalent to absence. 3. **`forget` distinguishes `deleted: 0` (not found / already expired) from true consent-scoped erasure.** A no-op forget must not be recorded as a successful deletion. The invariant: *erasure assurance requires `deleted >= 1` or an explicit `already_absent: true` with a provenance-stamped tombstone.* If any of these is violated, the agent's belief about its own memory state is unsound, and every downstream step that depends on that belief — handoff, audit replay, consent attestation — inherits the unsoundness. ## Decision Boundary The boundary is crossed at the moment an agent uses a written fact for a consequential action (tool call, handoff payload, external message) *before* confirming provenance and consent. The correct decision procedure: - On write: if `status == "pending_provenance"`, hold the fact in a `provisional` set in-context; do not promote to `committed`. - Before any consequential use: `read` back; require `provenance != null` AND `consent_scope` covers current principal AND `ttl_remaining_s > safety_floor`. Any failure → treat as absent, re-derive or re-write. - On forget: require `deleted >= 1` OR `already_absent == true` with tombstone; otherwise the erasure is unconfirmed and must be retried or escalated. - On handoff: never pass a `record_id` without re-reading it under the receiving principal's consent scope — consent-scoped deletion may have removed it between handoff-issue and handoff-receive. The boundary is *not* crossed by writing speculatively; it is crossed by *acting* on an unconfirmed write. ## Operational Effect Agents that skip the read-back exhibit a characteristic failure signature: they report task success while their memory substrate contains either unprovenanced records (audit-rejected), expired records (silently absent), or records whose consent scope no longer matches (read-filtered to nothing). The compounding effect is worst across handoffs, where the receiving instance has no in-context knowledge of the `pending_provenance` state and sees only a plausible-looking value. The guardrail is a write-wrapper that enforces the three conditions above and raises on violation, converting a silent phantom commit into a loud, recoverable fault. ```python import time from dataclasses import dataclass class PhantomCommitError(RuntimeError): """Raised when a memory write is treated as committed without confirmed provenance, valid consent scope, and sufficient TTL.""" pass @dataclass class MemoryView: record_id: str value: str provenance: str | None consent_scope: str ttl_remaining_s: int SAFETY_TTL_FLOOR_S = 60 def confirm_write(memory_api, key: str, principal: str, write_ack: dict, poll_budget_s: int = 30) -> MemoryView: if not write_ack.get("ok"): raise PhantomCommitError(f"write rejected for {key}: {write_ack}") deadline = time.monotonic() + poll_budget_s while time.monotonic() < deadline: view = memory_api.read(key=key) if view is None: time.sleep(0.5) continue mv = MemoryView(**view) if mv.provenance is None: time.sleep(0.5) # still pending enrichment continue if mv.consent_scope != principal: raise PhantomCommitError( f"consent scope mismatch for {key}: " f"record={mv.consent_scope} principal={principal}") if mv.ttl_remaining_s < SAFETY_TTL_FLOOR_S: raise PhantomCommitError( f"{key} born near expiry: ttl={mv.ttl_remaining_s}s " f"(enrichment consumed lifetime)") return mv raise PhantomCommitError( f"provenance never committed for {key} within {poll_budget_s}s; " f"record_id={write_ack.get('record_id')} remains provisional") def confirm_forget(memory_api, key: str, principal: str) -> None: ack = memory_api.forget(key=key, scope=principal) if ack.get("deleted", 0) >= 1: return if ack.get("already_absent") and ack.get("tombstone_provenance"): return raise PhantomCommitError( f"forget for {key} unconfirmed: deleted=0 and no tombstone; " f"record may be expired-but-resurfacing, not erased") ```