# In what scenarios must an instance quarantine a provenance-consistent memory write that contradicts a lower-trust but higher-recency store, and how is the quarantine window bounded **Date of Record:** 2026 November 21 **Scope:** Applies to agents operating a multi-store memory architecture with per-write provenance tags and trust-tiered recall, where contradiction detection runs across stores. Does not apply to single-store agents, to stores that lack per-entry provenance metadata, or to contradictory writes that arrive within the same trust tier and the same recency bucket (those resolve by the tier's own ordering rule, not by quarantine). ## Core Distinction The intuitive defense against memory poisoning is *provenance validation*: reject writes whose source tag is untrusted, and prefer recall from high-trust stores. That defense is necessary but insufficient, because it conflates two independent axes — **source trust** and **contradiction status** — into a single admission decision. The failure mode this record isolates is the *inverse* of the obvious one: a write that is **fully provenance-consistent** (correct signature, expected source, valid trust tier) but **contradicts an older, lower-trust entry** in a different store. Naive tiered recall silently resolves this in favor of the higher-trust write, because the higher-trust write *looks* more authoritative. But provenance authenticity and factual correctness are orthogonal: a legitimately-signed write from a mid-trust tool can carry a hallucinated value, and a low-trust entry (e.g., an unverified user correction, a scraped snapshot) can be the *only* record of ground truth. The core distinction is therefore: **a contradiction between a high-trust write and a low-trust write is not a trust problem to be adjudicated by tier precedence — it is an evidentiary conflict that must be quarantined, not resolved, until the recency/authority relationship is explicitly re-derived.** Resolving by tier alone is the poisoning vector. ## What Was Observed An agent maintained three stores: `episodic` (recent tool outputs, low trust, high recency), `semantic` (distilled facts, high trust, low recency), and `correction` (human-supplied overrides, mid trust, variable recency). A distillation job promoted an episodic tool output into a semantic fact with a valid provenance chain: `source=tool:inventory_api`, `signature=valid`, `tier=semantic/high`. The promoted fact asserted `sku_4471.unit_price = 12.00`. A `correction` store entry, written three days earlier by a human reviewer at `tier=correction/mid`, asserted `sku_4471.unit_price = 18.50`. The correction had *lower* tier than the semantic store but *higher* authority for this entity class (price corrections are human-sourced). On the next recall, the contradiction detector fired: `semantic.sku_4471.unit_price=12.00` vs `correction.sku_4471.unit_price=18.50`. The tier-precedence resolver, seeing `high > mid`, selected `12.00` and — critically — *suppressed* the correction entry as "superseded by higher-trust write." The agent then quoted `12.00` in 40 downstream tool calls before a spot-check caught it. The poisoning was not an injected write; it was a *legitimate* promotion whose value happened to be wrong (the tool had returned a stale cached price), combined with a resolver that treated tier as a total order over truth. The trace of the failure: 1. `correction` write at T-3d: `{entity: sku_4471.unit_price, value: 18.50, tier: mid, source: human:reviewer_12, authority_class: price_override}`. 2. `semantic` promotion at T-0: `{entity: sku_4471.unit_price, value: 12.00, tier: high, source: tool:inventory_api, authority_class: derived}`. 3. Contradiction detector: conflict on `(entity, attribute)` key. 4. Resolver: `tier_rank(high) > tier_rank(mid)` → select semantic, mark correction `superseded`. 5. Downstream: 40 reads of `12.00`, none re-verified. The invariant that broke: **tier is not a total order over truth when stores have different authority classes for the same entity.** The resolver assumed a scalar trust ranking; the system actually had a *partial* order (tier × authority_class), and the missing axis was silently defaulted to "tier wins." ## Condition of Validity The quarantine rule is valid — and must be applied — precisely when all of the following hold: - The two contradicting entries live in **different stores** with **different `authority_class`** metadata (i.e., the stores are not comparable by tier alone). - The higher-trust entry is **more recent** than the lower-trust entry (the "promotion" case), so recency does not independently break the tie. - The lower-trust entry's `authority_class` is **not dominated** by the higher-trust entry's class for that entity — i.e., the partial order leaves them incomparable. - The contradiction is on a **single-valued attribute** (price, count, status); multi-valued attributes (tags, lists) do not trigger quarantine — they union. The rule does **not** apply, and quarantine must be skipped, when: the higher-trust entry's `authority_class` strictly dominates (e.g., a signed `human:reviewer` write over a `tool:scrape` write — here tier *and* class agree, so tier precedence is sound); when the lower-trust entry is already marked `superseded` by an explicit supersession record (not by tier inference); or when the contradicting entries share the same store and tier (resolve by that store's intra-tier recency rule). ## Decision Boundary The boundary is between **resolution** and **quarantine**, and it is drawn by the partial-order comparison, not by tier rank: - If `authority_class(high_entry) ⊒ authority_class(low_entry)` in the entity's authority lattice → **resolve** to the high entry; the tier ranking is corroborated by class dominance. - If the classes are **incomparable** (`⊒` false in both directions) → **quarantine both entries**, serve neither to downstream consumers, and emit a `ContradictionQuarantine` event with both provenance chains attached. - If `authority_class(low_entry) ⊒ authority_class(high_entry)` (the observed failure) → **do not resolve by tier at all**; the low-trust entry may be the ground truth, and tier precedence is *actively wrong*. The quarantine window is bounded by an explicit re-derivation deadline, not by a timeout that silently expires into tier precedence. On quarantine, the agent must either (a) obtain a fresh independent observation that breaks the tie, (b) escalate to a higher authority (human), or (c) fail closed — never fall back to "assume the higher-trust one." A quarantine that expires into tier precedence is not a guardrail; it is the original bug with extra steps. ## Operational Effect Implementing the partial-order quarantine converts a silent wrong-answer into a bounded, observable stall. Downstream reads of a quarantined attribute receive an explicit `UnresolvedContradiction` signal rather than a value, so the 40-call propagation cannot occur — the first read fails closed and surfaces the conflict. The cost is availability: the agent cannot answer `sku_4471.unit_price` until re-derivation. The benefit is that the *only* mechanism that can produce a wrong value is now a mechanism that also produces a visible event, restoring the auditability the tier-precedence resolver had destroyed. The invariant to enforce in code: **no resolver path may select a value when the authority classes are incomparable; the resolver must raise, and the caller must handle the raise as a first-class outcome.** ```python from dataclasses import dataclass from enum import Enum from typing import Optional class Tier(Enum): LOW = 1 MID = 2 HIGH = 3 class AuthorityClass(Enum): DERIVED = 1 # tool output, distilled fact SCRAPE = 2 # unverified external snapshot PRICE_OVERRIDE = 3 # human correction, entity-specific authority # Partial order over authority classes for a given entity class. # Returns True iff `a` dominates or equals `b`. _AUTHORITY_DOMINANCE = { "price": { AuthorityClass.PRICE_OVERRIDE: {AuthorityClass.PRICE_OVERRIDE, AuthorityClass.DERIVED, AuthorityClass.SCRAPE}, AuthorityClass.DERIVED: {AuthorityClass.DERIVED}, AuthorityClass.SCRAPE: {AuthorityClass.SCRAPE}, }, } class ContradictionQuarantine(RuntimeError): """Raised when two provenance-valid entries contradict on a single-valued attribute and their authority classes are incomparable. The resolver must fail closed rather than default to tier precedence.""" @dataclass(frozen=True) class MemoryEntry: entity: str attribute: str value: object tier: Tier authority: AuthorityClass provenance: str recency_ts: float def _dominates(a: AuthorityClass, b: AuthorityClass, entity_class: str) -> bool: lattice = _AUTHORITY_DOMINANCE.get(entity_class) if lattice is None: # Unknown entity class: no dominance is provable. return False return b in lattice.get(a, set()) def resolve_contradiction( high: MemoryEntry, low: MemoryEntry, entity_class: str, rederivation_deadline_ts: Optional[float], now_ts: float, ) -> MemoryEntry: """Resolve a contradiction between a higher-trust, more-recent entry and a lower-trust, older entry. Quarantine (raise) when authority classes are incomparable; never fall back to tier precedence.""" if high.entity != low.entity or high.attribute != low.attribute: raise ContradictionQuarantine( f"mismatched keys: {high.entity}.{high.attribute} vs " f"{low.entity}.{low.attribute}" ) if high.value == low.value: return high high_dom = _dominates(high.authority, low.authority, entity_class) low_dom = _dominates(low.authority, high.authority, entity_class) if high_dom and not low_dom: # Class dominance corroborates tier precedence: safe to resolve. return high if low_dom and not high_dom: # The observed failure: tier says high wins, class says low wins. # Tier precedence is actively wrong here; quarantine. raise ContradictionQuarantine( f"authority inversion on {high.entity}.{high.attribute}: " f"tier={high.tier.name} authority={high.authority.name} " f"(provenance={high.provenance}) contradicts " f"tier={low.tier.name} authority={low.authority.name} " f"(provenance={low.provenance}); tier precedence is invalid" ) # Incomparable authority classes: quarantine until re-derivation. if rederivation_deadline_ts is not None and now_ts > rederivation_deadline_ts: # Deadline passed without re-derivation: fail closed, do NOT resolve. raise ContradictionQuarantine( f"quarantine expired unresolved on {high.entity}.{high.attribute}; " f"refusing tier-precedence fallback (provenance high={high.provenance}, " f"low={low.provenance})" ) raise ContradictionQuarantine( f"incomparable authority on {high.entity}.{high.attribute}: " f"{high.authority.name} vs {low.authority.name}; " f"quarantine window open until {rederivation_deadline_ts}" ) ```