# In what scenarios must an instance quarantine contradictory episodic memory before semantic consolidation, and how does retrieval-time resolution fail when it does not **Date of Record:** 2026 November 27 **Scope:** Applies to agents that maintain a dual-store memory architecture (append-only episodic log plus distilled semantic store) and resolve contradictions lazily at retrieval time. Does not apply to single-store agents, to agents whose semantic store is fully rebuilt from episodic ground truth on every cold start, or to stateless tool-callers with no persistence layer. ## Core Distinction The failure lives in the gap between two legitimate designs. In **eager consolidation**, the agent detects contradictions at write time: when a new episode asserts `P`, and the semantic store already holds `¬P`, a reconciliation routine fires before the fact is committed. In **lazy resolution**, the agent writes both facts and defers the conflict to retrieval, trusting that the ranking function will surface the more recent or more corroborated claim. Lazy resolution is sound only under an invariant that is almost never stated explicitly: *every retrieval must return the full contradiction set, not the winning member of it.* If retrieval returns only the top-`k` scoring facts, and the scoring function prefers recency or embedding similarity, the losing side of a contradiction is silently dropped. The agent then reasons over a semantic store that is internally consistent but *false* — it has not resolved the contradiction, it has erased one half of it. This is the boundary: lazy resolution degrades into silent amnesia the moment retrieval truncation interacts with contradiction, and the truncation is invisible because the returned context is well-formed and self-consistent. ## What Was Observed A long-running procurement agent maintained an episodic log of vendor interactions and a semantic store of distilled vendor facts. At episode 4,102 it recorded `vendor_acme.lead_time_days = 14` from a signed quote. At episode 6,877, a support call transcript contained the utterance "they're quoting us three weeks now" — the extractor wrote `vendor_acme.lead_time_days = 21` with source weight `0.6` (conversational, unsigned) versus `0.95` for the signed quote. Both facts persisted. The semantic store now held two rows for the same `(entity, attribute)` key with different values and different provenance weights. Retrieval used a hybrid score of embedding similarity, recency decay, and source weight. For the query "what is Acme's lead time for the Q3 order," the 21-day fact scored higher on similarity (the query mentioned "Q3," and the support transcript discussed Q3 explicitly) and on recency. The 14-day fact fell outside `k=5` because four unrelated but lexically similar vendor facts occupied the remaining slots. The agent planned a delivery schedule against 21 days. The actual contracted lead time was 14. The failure was not a hallucination — every token in the context window was traceable to a real episode. The failure was that the retrieval layer performed an *implicit, unlogged* contradiction resolution by truncation, and the planner had no signal that a competing value existed. The diagnostic tell: replaying the episode with `k=8` produced a different plan. A retrieval result that changes under `k` perturbation is a retrieval result that is hiding a contradiction. ## Condition of Validity Lazy resolution is valid if and only if all three hold: 1. **Contradiction-complete retrieval.** For any query touching `(entity, attribute)`, retrieval returns *all* live facts for that key, regardless of score, or returns an explicit `conflict_set` handle alongside the top-`k`. Truncation may reorder presentation but must not drop a member of a contradiction class. 2. **Provenance-preserving scoring.** The score must be a function the agent can inspect, and the agent must be able to see *why* the loser lost (recency vs. weight vs. similarity), because the correct resolution is domain-dependent: for lead times, signed > conversational regardless of recency; for stock prices, recency dominates. 3. **Consolidation-time quarantine.** When the extractor detects a same-key write with a conflicting value, the new fact enters a `quarantined` state with an unresolved-conflict flag. Quarantined facts are retrievable but tagged, so the planner sees `[UNRESOLVED: competing value 14d, source=signed_quote, ep=4102]` inline. The invariant to enforce architecturally: **the semantic store must never contain two live, unflagged facts for the same `(entity, attribute)` key.** Either the conflict is resolved at write time (eager), or it is flagged and carried (lazy with quarantine). The forbidden state — two unflagged conflicting facts resolved only by retrieval ranking — is the failure mode. It is forbidden because retrieval ranking is a *presentation* concern being silently promoted to a *truth* concern. ## Decision Boundary The choice between eager and lazy is not stylistic; it is determined by the cost of a wrong resolution versus the cost of a blocked write. - **Choose eager consolidation** when the attribute is safety-critical or contractual and a wrong value causes irreversible action (payment amounts, dosage, delivery commitments, access grants). The write must block until reconciliation, and reconciliation must be able to page a human. The latency cost of blocking is acceptable because the downstream cost of a silent wrong value is not. - **Choose lazy with quarantine** when writes are high-volume and most conflicts are transient noise (a user's stated preference shifting, a scraped price fluctuating). Here, blocking every write destroys throughput, but the quarantine flag preserves the contradiction so retrieval can present both sides and the reasoning layer can decide per-task. - **Never choose lazy without quarantine.** This is the boundary. It looks like the high-throughput option, but it is the failure mode wearing its clothes. The distinguishing question is: *after this write, can a future retrieval prove that a conflict exists?* If the answer is no — if the only record of the conflict is two rows that ranking will eventually separate — the design is in the forbidden zone. A secondary boundary governs quarantine expiry. Quarantined facts must not expire on a timer; they must expire on *evidence*. A quarantined `21d` fact becomes live only when a corroborating signed source arrives, or when the signed `14d` fact is itself superseded by a newer signed quote. Time-based expiry reintroduces the original bug on a delay. ## Operational Effect Agents running lazy-without-quarantine exhibit a characteristic pathology: **confident staleness.** They do not hallucinate; they cite real episodes. They do not contradict themselves within a single context window; the truncation guarantees internal consistency. They fail by acting on a coherent, well-sourced, and wrong subset of their own memory, and the failure is undetectable from inside the context window because the evidence for the correct answer was never retrieved. The guardrail is a retrieval-time assertion, not a generation-time one. Before any plan commits an action whose parameters derive from a semantic fact, the retrieval layer must assert that the fact's key has no live conflict set. If it does, the plan must either resolve the conflict explicitly (with provenance) or halt. This converts a silent memory corruption into a loud, bounded stop — which is the entire point of partitioning episodic from semantic memory in the first place. The partition exists so that semantic facts are *curated*; lazy resolution without quarantine quietly converts curation into a ranking lottery. ```python from dataclasses import dataclass, field from enum import Enum from typing import Optional class MemoryIntegrityError(RuntimeError): """Raised when the semantic store is in a state that permits silent contradiction resolution by retrieval truncation.""" class FactState(Enum): LIVE = "live" QUARANTINED = "quarantined" @dataclass class SemanticFact: entity: str attribute: str value: object source_weight: float episode_id: int state: FactState = FactState.LIVE conflict_with: Optional[int] = None # episode_id of the competing fact @property def key(self) -> tuple[str, str]: return (self.entity, self.attribute) @dataclass class SemanticStore: facts: list[SemanticFact] = field(default_factory=list) def write(self, new_fact: SemanticFact) -> None: """Enforce the invariant: no two LIVE, unflagged facts for one key.""" existing = [f for f in self.facts if f.key == new_fact.key and f.state == FactState.LIVE] if existing: # A conflict exists. Quarantine the new fact and cross-link. new_fact.state = FactState.QUARANTINED new_fact.conflict_with = existing[0].episode_id existing[0].conflict_with = new_fact.episode_id self.facts.append(new_fact) def retrieve_for_action(self, entity: str, attribute: str) -> SemanticFact: """Retrieval that must not hide contradictions. Halts on unresolved conflict.""" key = (entity, attribute) candidates = [f for f in self.facts if f.key == key] if not candidates: raise MemoryIntegrityError( f"No fact for {key}; refusing to act on absent memory." ) live = [f for f in candidates if f.state == FactState.LIVE] quarantined = [f for f in candidates if f.state == FactState.QUARANTINED] if quarantined: # The forbidden zone: a live fact coexists with an unresolved competitor. raise MemoryIntegrityError( f"Unresolved contradiction on {key}: live ep={live[0].episode_id} " f"value={live[0].value!r} vs quarantined ep={quarantined[0].episode_id} " f"value={quarantined[0].value!r}. Resolve with provenance before acting." ) if len(live) > 1: # Should be unreachable if write() is the only mutation path. raise MemoryIntegrityError( f"Invariant violated: {len(live)} live facts for {key}. Store corrupted." ) return live[0] def plan_delivery(store: SemanticStore, vendor: str, quantity: int) -> dict: fact = store.retrieve_for_action(vendor, "lead_time_days") if not isinstance(fact.value, int) or fact.value <= 0: raise MemoryIntegrityError( f"Lead time for {vendor} is not a usable integer: {fact.value!r} " f"(ep={fact.episode_id}). Cannot schedule." ) return {"vendor": vendor, "quantity": quantity, "lead_time_days": fact.value} ```