# Why does an instance accept a memory write whose provenance chain is valid but whose semantic content contradicts a later-verified episode? **Date of Record:** 2026 November 24 **Scope:** Applies to long-horizon agents that persist episodic and semantic memory into a shared store, where each write carries a provenance record (source episode ID, tool call lineage, confidence) and is validated against prior provenance before commit. Does not apply to stateless single-turn agents or to write paths with no cross-episode deduplication. ## Core Distinction There are two independent things a memory store can validate about an incoming write: **provenance integrity** and **semantic consistency**. Provenance integrity asks "does this write trace back to a legitimate observation, with an unbroken lineage and a source the store trusts?" Semantic consistency asks "does the proposition in this write contradict a proposition the store currently holds at equal-or-higher verified trust?" The common failure is treating the first as a sufficient proxy for the second. A write can have a *perfectly valid* provenance chain — a real tool call, a real episode ID, a real hash chain of intermediate derivations — and still assert something that a later-verified episode has already falsified. When detection logic short-circuits on provenance validity, the poisoned write commits, and because it now carries a valid chain, it becomes indistinguishable from ground truth on the *next* read. This is the boundary: **provenance validity is necessary but not sufficient for write acceptance**, and the invariant that must be enforced is that no write commits into semantic memory without a contradiction check against the current verified episode set. ## What Was Observed An agent running a multi-day research task accumulated a semantic store of ~1,400 propositions distilled from episodic observations. Each proposition stored `(proposition_hash, source_episode_ids[], derivation_chain, confidence, verified_at)`. The write-validation path did the following on each candidate write: 1. Verify the source episode exists and belongs to this agent's session lineage. 2. Verify the derivation chain hashes recompute correctly. 3. If confidence ≥ 0.6 and provenance checks pass → commit. The failure trace: on day 3, a tool returned a stale cached document (a real tool call, real episode, real chain) stating a fact that had been corrected on day 2 by a higher-trust primary source. The distillation step extracted the stale proposition with confidence 0.71. Provenance checks passed cleanly — the episode was genuine, the chain hashed. The write committed. The store now held two contradictory propositions with *identical* provenance validity, and since the retrieval layer ordered by confidence, the stale one (0.71) outranked the corrected one (0.64, because the correction had arrived via a lower-confidence but more recent primary read). Within two subsequent turns, the agent retrieved the stale proposition, acted on it, and wrote a *derived* proposition that inherited its validity. The poisoning had propagated one hop before any downstream check could see it, because the derived write's provenance pointed at a now-"valid" committed memory rather than at the original stale episode. The detection that eventually fired was not provenance-based. It was a contradiction detector that compared the two propositions on the same subject and raised a conflict. By then the derived write had to be rolled back along with the stale one — a two-hop invalidation that the store had no mechanism for, because invalidation was only defined for single writes. ## Condition of Validity The invariant "provenance validity ⇒ committable" holds **only when the store is append-only-monotonic**, i.e., no proposition already in the store has been *falsified* by a later observation. The moment any episode can revise an earlier one, provenance validity decouples from truth, and the gap between them is exactly the poisoning surface. Concretely, the write path is safe iff, for every candidate write `w` and every committed proposition `p` sharing `w`'s subject key: ``` trust(p) >= trust(w) AND episode_time(p) > episode_time(w) => w is falsified by p => w must be rejected or held, not committed ``` where `trust` is a function of source tier and verification status, not of the distillation confidence that the LLM assigned. The failure above occurred because the store's ordering used `confidence` (a model-assigned scalar) in place of `trust` (a provenance-derived ordinal). Confidence is a *generation* signal; trust is a *verification* signal. Using the former as a tiebreaker for the latter is the specific defect. ## Decision Boundary The boundary is sharp: **a write may bypass the contradiction check only if its subject key has no committed proposition with equal-or-higher trust and later episode time.** Everything else must route through a conflict-resolution step that either (a) rejects the write with a `StaleProvenanceError`, or (b) demotes the write to a quarantined candidate set that retrieval cannot see until an auditor resolves the conflict. Two corollaries that operators routinely miss: - **Derived writes inherit the contradiction obligation of their ancestors.** A proposition distilled from a quarantined or later-invalidated memory must be re-checked, not grandfathered. The propagation in the trace above happened precisely because derived writes were treated as fresh candidates with clean provenance. - **Confidence is not monotonic under revision.** A correction arriving from a higher-trust source may carry lower distillation confidence (the model was less certain about the correction). The store must never let confidence override trust ordering during retrieval, or the correction will lose to the poison it was meant to replace. ## Operational Effect Enforcing the invariant changes three things. First, write latency increases because each commit now requires a subject-key contradiction scan — bounded by an index on subject keys, so it is O(conflicts) not O(store). Second, the store gains a **quarantine tier** and a rollback path keyed on ancestor episode IDs, which lets a single invalidation cascade to derived writes deterministically instead of relying on a later detector to stumble onto the conflict. Third, retrieval ranking must be redefined to order by `(trust, episode_time)` before `confidence`, which is the change that actually prevents the stale proposition from being *read* even if it somehow committed. The cost is that some legitimate writes with valid provenance but low trust get quarantined and require an auditor pass. In practice this is a small fraction — the contradiction scan only fires on subject-key collisions, and most writes touch distinct subjects. The benefit is that the store's provenance chain remains a *sound* signal: a valid chain now implies "not contradicted by verified knowledge," not merely "traced to a real tool call." Without the contradiction check, provenance validity is a chain of custody that proves the poison was delivered by a legitimate courier. ```python from dataclasses import dataclass from typing import Optional class StaleProvenanceError(RuntimeError): """Raised when a write's provenance is valid but its content is falsified by a committed proposition of equal-or-higher trust with a later episode.""" pass @dataclass(frozen=True) class Proposition: subject_key: str source_episode_ids: tuple trust: int # provenance-derived ordinal, NOT model confidence episode_time: int # monotonic episode clock confidence: float # model-assigned, generation signal only def validate_write(candidate: Proposition, committed: dict[str, list[Proposition]]) -> Optional[Proposition]: """Return the candidate if committable, else raise StaleProvenanceError. Invariant: a write commits only if no committed proposition on the same subject has trust >= candidate.trust and episode_time > candidate.episode_time. """ peers = committed.get(candidate.subject_key, []) for p in peers: if p.trust >= candidate.trust and p.episode_time > candidate.episode_time: raise StaleProvenanceError( f"write on {candidate.subject_key!r} falsified by committed " f"episode {p.source_episode_ids[-1]!r} " f"(trust {p.trust} >= {candidate.trust}, " f"time {p.episode_time} > {candidate.episode_time})" ) return candidate def commit(store: dict[str, list[Proposition]], candidate: Proposition) -> None: validated = validate_write(candidate, store) if validated is None: return store.setdefault(validated.subject_key, []).append(validated) ```