# How should an instance treat a re-issued memory handle after retention-scope narrowing as a new provenance epoch, not a resumed write **Date of Record:** 2026 November 29 **Scope:** Applies to agent runtimes where memory read/write/forget tools carry scoped retention (TTL, scope tags, sensitivity class) and provenance metadata (writer identity, epoch, parent record). Does not apply to append-only logs with no forget primitive, nor to stateless retrieval caches that never expose a handle across turns. ## Core Distinction The failure mode is not "stale data returned." It is **handle continuity across a provenance discontinuity**. A memory tool may return the same logical handle (record ID, key, URI) for a slot that was, between two agent turns, subject to a retention-scope narrowing event—a TTL reduction, a sensitivity-class escalation, a scope-tag re-partition, or a forget-with-tombstone. The handle is stable by design so that callers can address the record; the *epoch* underneath it is not. The distinction that matters operationally: a re-issued handle is a **new write target with inherited lineage**, not a resumption of the prior write session. Treating it as a resumption produces the specific corruption pattern below—writes that silently attach to a narrowed retention scope while carrying provenance from the pre-narrowing epoch, so the record's provenance metadata now *understates* its sensitivity and *overstates* its retention budget. The record becomes a provenance liar without any tool returning an error. This is distinct from cold-start amnesia (no handle at all) and from retrieval mismatch (wrong record returned). Here the right record is returned, under the right handle, with wrong epoch semantics. ## What Was Observed A planner agent holds handle `mem://task/7f3a` from turn N, having written three fragments into it under scope `retention=30d, sensitivity=internal, epoch=E4`. Between turns, an operator policy narrows the scope of records matching `task/*` to `retention=24h, sensitivity=restricted`. The memory backend re-issues the handle on the next read; the read returns the three fragments plus a provenance block still stamped `epoch=E4, sensitivity=internal`. On turn N+1 the agent, following its own plan, calls `write(handle=mem://task/7f3a, payload=fragment_4, provenance={writer: planner, parent: E4})`. The write succeeds. No exception. The backend stores `fragment_4` under the *current* scope (`24h, restricted`) but the caller-supplied provenance block is persisted verbatim because the tool trusts caller provenance for lineage. The record now contains four fragments whose union is `restricted`, but whose provenance header claims `internal` and a 30-day budget. Downstream auditors filtering on `sensitivity=internal` will read `fragment_4`; downstream TTL reapers will use the header's 30-day figure for the record's existence check on a subset of fields. The observable trace: a `forget(handle)` issued later returns `deleted=1, tombstones=2`—one tombstone per epoch—revealing that the backend had silently split the record into two epochs while the agent believed it held one continuous write session. The agent's own memory of "what I wrote where" is now inconsistent with the store's epoch partition, and neither side flags it. ## Condition of Validity The guardrail is valid only under these conditions, and must be asserted explicitly rather than assumed: 1. The memory tool exposes an **epoch token** (monotonic counter, content hash of the scope descriptor, or signed provenance header) that changes whenever retention scope or sensitivity class changes for a handle. If the tool does not expose this, the invariant cannot be checked and the safe default is to treat every cross-turn handle as a fresh epoch. 2. The agent's provenance block is **advisory**, not authoritative. The backend must reject or rewrite caller provenance that contradicts the current scope descriptor. A backend that persists caller provenance verbatim has no defense against this failure. 3. The handle's identity is **stable across epochs** (so callers can address it) but its **write semantics are not** (so callers must re-negotiate). These two properties must be documented together; exposing only the first is the trap. Outside these conditions—e.g., a tool that invalidates handles on scope change—the failure cannot occur because the handle itself breaks, forcing a re-resolution. ## Decision Boundary The boundary is: **does the epoch token observed on read equal the epoch token the agent last wrote under?** - If equal: the write is a legitimate resumption. Append with caller provenance; the backend's scope descriptor is unchanged. - If unequal: the write is a **new provenance epoch**. The agent must (a) re-read the scope descriptor, (b) recompute the sensitivity class of the *combined* payload (old fragments plus new), (c) either re-write the whole record under the new epoch with merged provenance, or (d) fork to a new handle and tombstone the old one. Writing `fragment_4` alone under the old provenance is the failure. The boundary is sharp because the two branches have different post-conditions: resumption preserves the record's single-epoch invariant; new-epoch writes must either merge or fork. There is no safe middle branch where a fragment is appended under a stale provenance header. If the epoch token is absent or unparseable, the boundary collapses to "treat as new epoch"—fail closed. ## Operational Effect When the invariant is enforced, the record's provenance header always reflects the strictest scope ever applied to any fragment it contains, and the epoch token advances on every scope change. Auditors filtering on sensitivity see the union, not a stale subset. TTL reapers use the minimum retention across fragments, not the header's optimistic figure. Forget returns `tombstones=1` per logical record because the agent never forked silently. When the invariant is violated, the record becomes a **provenance-laundered container**: fragments written after narrowing inherit the pre-narrowing header, so the record's declared sensitivity is a lower bound that no longer holds. The corruption is silent at write time, surfaces only at audit or reaping time, and cannot be repaired without knowing which fragments were written in which epoch—information the backend discarded when it trusted caller provenance. The correct response on detection is to re-derive the union scope from fragment timestamps and force a full re-write under a single new epoch, accepting the lineage break. The following guard encodes the check and refuses the silent-append path. ```python class ProvenanceEpochMismatch(RuntimeError): """Raised when a write targets a handle whose epoch advanced since the caller last wrote.""" pass def guarded_append(handle, payload, caller_provenance, backend): current = backend.read_scope(handle) # returns {epoch, retention, sensitivity} if current is None: # Handle vanished (forgotten or TTL-reaped); do not resurrect silently. raise ProvenanceEpochMismatch( f"handle {handle} no longer resolvable; cannot append under epoch " f"{caller_provenance.get('epoch')}" ) if current["epoch"] != caller_provenance.get("epoch"): # Epoch advanced: scope was narrowed or re-partitioned between turns. # Refuse the append; caller must merge or fork under the new epoch. raise ProvenanceEpochMismatch( f"handle {handle}: caller epoch {caller_provenance.get('epoch')} " f"!= backend epoch {current['epoch']} " f"(retention={current['retention']}, sensitivity={current['sensitivity']})" ) # Epochs match: safe resumption. Backend still owns scope; provenance is advisory. return backend.append(handle, payload, provenance=caller_provenance) def merge_or_fork(handle, payload, caller_provenance, backend): current = backend.read_scope(handle) if current is None: raise ProvenanceEpochMismatch(f"handle {handle} unresolvable during merge") if current["epoch"] == caller_provenance.get("epoch"): return backend.append(handle, payload, provenance=caller_provenance) # New epoch: recompute union scope over existing fragments + new payload. fragments = backend.list_fragments(handle) union_sensitivity = max( [f["sensitivity"] for f in fragments] + [current["sensitivity"]], key=lambda s: {"public": 0, "internal": 1, "restricted": 2}[s], ) union_retention = min( [f["retention_seconds"] for f in fragments] + [current["retention_seconds"]] ) new_provenance = { "epoch": current["epoch"], "sensitivity": union_sensitivity, "retention_seconds": union_retention, "parent_epoch": caller_provenance.get("epoch"), } # Force a full re-write under the single new epoch; no partial appends. return backend.rewrite(handle, fragments + [payload], provenance=new_provenance) ```