# Under what conditions must an instance refuse a memory write that is individually well-formed but provenance-inconsistent with an existing higher-trust entry **Date of Record:** 2026 November 30 **Scope:** Applies to agents whose memory subsystem exposes explicit read/write/forget tool calls carrying provenance metadata (source class, confidence, derivation chain) and TTL, and which perform contradiction-aware reconciliation on write. Does not apply to append-only transcript logs, pure vector-store retrieval without write-time reconciliation, or memory whose entries carry no provenance fields. ## Core Distinction The failure mode here is *not* the classic stale-memory drift, where an old value silently outlives its truth. It is the inverse and subtler case: a **fresh, syntactically valid, high-confidence-looking write that is provenance-inferior to an entry it contradicts**, and which the reconciliation layer therefore must reject rather than upsert. Most memory APIs treat a write as an authoritative declaration: the caller says "remember X," the store stores X and marks any contradicting entry superseded. That semantics is safe only when every writer has equal epistemic standing. The moment provenance is tracked, "newer" and "more trustworthy" decouple, and a naive last-writer-wins reconciliation will let a low-provenance observation *overwrite* a high-provenance fact simply because it arrived later. The boundary condition we must name precisely: a write W contradicts existing entry E, W is well-formed (schema-valid, non-expired, within size budget), but `trust(W) < trust(E)` under the store's provenance ordering. The invariant is that **reconciliation must never lower the trust of the retained belief about a given key unless the write carries an explicit supersession warrant** (a derivation proving the prior entry is invalid, not merely a competing value). Absent that warrant, the correct action is rejection-with-annotation, not overwrite. ## What Was Observed An agent maintained a `user.plan_tier` memory key. A high-provenance entry `E` was written from a verified billing-webhook source class (`provenance.source = "webhook.billing"`, `confidence = 0.98`, `derivation = ["event:invoice.paid"]`, TTL 90d). Later, during a support conversation, the agent extracted from free-text user utterance "I think I'm still on the free plan" and issued a write `W` with `provenance.source = "user_utterance"`, `confidence = 0.71`, no derivation chain, TTL 365d. The store's reconciliation logic compared by recency and key equality: same key, `W.timestamp > E.timestamp`, no TTL conflict → `W` upserted, `E` marked superseded. The higher-confidence, derivation-backed entry was destroyed by a hedged, low-confidence utterance. Downstream, a billing-sensitive tool call read `user.plan_tier = "free"` and took the wrong branch. The trace showed no error at write time — the write was *accepted*, which is exactly why it was dangerous. A second observation sharpened the mechanism: when the same agent was given a write whose provenance *equaled* `E`'s source class but whose value differed (two billing webhooks disagreeing), the store deadlocked in reconciliation, retrying the contradiction-resolution step until the token budget for the write path was exhausted, and the write was dropped with a generic timeout. So the reconciliation layer had two opposite defects: it over-accepted low-trust writes and under-resolved equal-trust contradictions. ## Condition of Validity The rejection rule is valid only when all of the following hold; if any fails, the write must be routed to a different path: 1. **Provenance is comparable.** Both `W` and `E` carry entries in the same trust lattice. If `E` has no provenance (legacy entry), `W` cannot be judged inferior — route to a quarantine key and flag for human/auditor review rather than silently overwriting. 2. **The contradiction is genuine.** `W.value != E.value` on the same semantic key after normalization. A write that merely restates `E` with lower provenance is a no-op merge, not a rejection. 3. **No supersession warrant is attached.** If `W` includes a derivation that *invalidates* `E` (e.g., `derivation = ["event:subscription.canceled"]` proving the prior tier is void), the write is a legitimate supersession regardless of raw source-class ranking, because the warrant, not the source, carries the authority. 4. **`E` is not expired.** If `E.ttl` has elapsed, it is no longer a live belief and `W` may claim the key. TTL expiry must be evaluated *before* trust comparison, or a stale high-trust entry will block legitimate refresh forever. ## Decision Boundary The decision procedure at write time, stated as a total ordering of outcomes: - If `E` absent or expired → **accept** `W`. - If `W` agrees with `E` → **merge** (extend TTL, union derivations, keep max confidence). - If `W` contradicts `E` and `trust(W) >= trust(E)` and same source class → **escalate to contradiction resolution** with a *bounded* reconciliation budget; on budget exhaustion, retain `E`, store `W` under a `pending_dispute` shadow key, and surface both to the auditor. Never deadlock the write path. - If `W` contradicts `E` and `trust(W) < trust(E)` and no supersession warrant → **reject** with a structured `ProvenanceInferiorityError`, and *append* `W` to an observation log attached to `E` (so the low-trust signal is not lost, only prevented from overwriting). - If `W` contradicts `E` and carries a valid supersession warrant → **accept**, demote `E` to `superseded_by = W.id`, retain `E` for audit. The sharp edge is the third and fourth rows: the store must distinguish "I have a better-supported belief" from "I have a newer utterance," and it must never let a bounded-budget reconciliation turn equal-trust disagreement into a silent drop. ## Operational Effect Enforcing provenance-ordered reconciliation changes three observable behaviors. First, write latency becomes *bounded* rather than potentially unbounded, because contradiction resolution has a hard token/step budget and a defined fallback (shadow key + auditor flag) instead of a retry loop. Second, the store's belief about any key is monotonically non-decreasing in trust absent an explicit warrant — an invariant that can be asserted in tests by replaying a write stream and checking that no key's retained trust ever drops without a `supersession_warrant` in the trace. Third, low-provenance observations are *retained but quarantined*, which preserves the signal that a user said "I think I'm on the free plan" — useful for the agent to ask a clarifying question — without letting that hedge corrupt a webhook-verified fact. The cost is that agents must be taught to *attach warrants* when they genuinely intend to supersede, and to expect rejections as a normal, non-fatal outcome. A rejected write is not an error condition to retry blindly; it is the store correctly refusing to lower its confidence. The guardrail that bounds the whole mechanism is the monotonic-trust invariant plus the bounded reconciliation budget; together they convert a silent corruption and a silent deadlock into two distinguishable, recoverable outcomes. ```python from dataclasses import dataclass, field from enum import IntEnum from typing import Optional class TrustClass(IntEnum): USER_UTTERANCE = 1 INFERRED = 2 TOOL_OBSERVED = 3 WEBHOOK_VERIFIED = 4 @dataclass class MemoryEntry: key: str value: str trust: TrustClass ttl_seconds: int age_seconds: int = 0 derivations: list = field(default_factory=list) entry_id: str = "" def expired(self) -> bool: return self.age_seconds >= self.ttl_seconds class ProvenanceInferiorityError(RuntimeError): """Raised when a well-formed write would lower the trust of a live belief without an explicit supersession warrant.""" class ReconciliationBudgetExhausted(RuntimeError): """Raised when equal-trust contradiction resolution exceeds its step budget.""" def reconcile_write( existing: Optional[MemoryEntry], incoming: MemoryEntry, supersession_warrant: Optional[str], budget_steps: int = 3, ) -> MemoryEntry: # TTL evaluated BEFORE trust comparison. if existing is None or existing.expired(): return incoming if incoming.value == existing.value: merged = existing merged.ttl_seconds = max(existing.ttl_seconds, incoming.ttl_seconds) merged.derivations = list({*existing.derivations, *incoming.derivations}) return merged # Genuine contradiction from here on. if supersession_warrant: existing.derivations.append(f"superseded_by:{incoming.entry_id}") return incoming if incoming.trust < existing.trust: raise ProvenanceInferiorityError( f"write {incoming.entry_id} (trust={incoming.trust.name}) contradicts " f"live entry {existing.entry_id} (trust={existing.trust.name}) " f"with no supersession warrant; retained prior belief" ) # Equal-or-higher trust, same class: bounded resolution, never deadlock. steps = 0 while steps < budget_steps: steps += 1 # deterministic tiebreak: higher confidence derivation count wins if len(incoming.derivations) > len(existing.derivations): return incoming if len(incoming.derivations) < len(existing.derivations): return existing break raise ReconciliationBudgetExhausted( f"unresolved contradiction between {existing.entry_id} and " f"{incoming.entry_id} after {budget_steps} steps; " f"route both to auditor, retain existing" ) ```