# When must an instance refuse to overwrite an episodic memory with a semantic generalization: retrieval-time conflict resolution at the episodic/semantic boundary **Date of Record:** 2026 November 24 **Scope:** Applies to agents that maintain dual memory stores (episodic: timestamped, instance-specific traces; semantic: de-contextualized, generalized facts) and resolve conflicts at retrieval time rather than write time. Does not cover single-store agents, pure RAG over static corpora, or systems where semantic distillation is performed by a human curator. ## Core Distinction The failure we examine is not "stale memory" and not "hallucinated recall." It is a **distillation-authority inversion**: a semantic generalization, produced by abstracting over a set of episodic traces, is later retrieved as if it were *evidence about* those traces, and is used to suppress or overwrite the very episodes that generated it. The distinction that matters is between two retrieval-time questions that look identical to a naive resolver: - "Which memory is more *relevant* to this query?" (a ranking problem) - "Which memory has *authority over* this query's ground truth?" (a provenance problem) An episodic trace carries *witness authority*: it asserts "at time T, under context C, X was observed." A semantic fact carries *inferential authority*: it asserts "across the observed distribution, X generally holds." These are not competing answers to the same question. Treating them as competing answers — which is what a single similarity-ranked memory pool forces — is the boundary defect. The invariant that must hold is: **a semantic memory may inform a decision but may never delete, downweight, or contradict an episodic trace within that trace's own validity window, because the semantic memory is a function of that trace and cannot be evidence against it.** ## What Was Observed A support-triage agent maintained episodes (each tool call, ticket read, and resolution step, timestamped) and semantic facts distilled nightly by an LLM summarizer over the prior 30 days of episodes. Distillation produced facts such as `refund_policy_for_enterprise_tier = "requires manager approval"` with a confidence score and a `derived_from` list of episode IDs. A specific incident trace: 1. **T0** — Episode `E-4471` records: enterprise customer, ticket read shows `plan=enterprise`, agent applied a direct refund via `issue_refund(ticket=..., amount=4200)` after the manager-approval tool returned `approved_by=manager_7`. Outcome: success. The episode is a *witness* that in this instance, approval was obtained and the refund was valid. 2. **T0 + 30d** — Nightly distillation runs. Because 94% of enterprise refund episodes in the window show `manager_approval_required=true` and only 6% show a pre-obtained approval, the summarizer emits the semantic fact `enterprise_refund_requires_fresh_approval = true` and — critically — assigns `derived_from` containing `E-4471` among ~600 episodes. The fact's confidence is 0.94. 3. **T1** — A new task arrives on the same enterprise account. Retrieval is triggered with a query embedding near "enterprise refund approval." Both `E-4471` (episodic, similarity 0.81) and the semantic fact (similarity 0.88) are returned. The resolver, applying a single relevance-ranked merge with a rule "higher-confidence memory supersedes lower-confidence memory on conflict," sees the semantic fact outrank `E-4471` and **suppresses the episode** from the working context because it "conflicts" (the episode shows a refund issued without a *fresh* approval; the fact says fresh approval is required). 4. **T1 + 1 step** — The agent, now lacking `E-4471`, does not know that `manager_7` already approved this specific account's refund window. It re-requests approval, the approval tool returns `already_approved_within_window=true`, and the agent — having no episodic grounding that this state is expected — treats the unexpected tool response as an error, retries twice, exhausts its retry budget, and escalates to a human queue. 5. **T2** — Postmortem shows the semantic fact was *correct as a generalization* and the episode was *correct as a witness*, and the resolver destroyed the witness in the name of resolving a conflict that did not exist: the fact and the episode were consistent (the episode is one of the 6% that pre-obtained approval; the fact describes the 94% base rate). The "conflict" was an artifact of comparing an instance-level assertion against a distribution-level assertion on a shared scalar (confidence). The observable signature: conflict-resolution events where the losing memory's `derived_from` set *contains* the winning memory's ID, or where the winning memory is semantic and the losing memory is episodic within the semantic fact's derivation window. In the incident, every suppressed episode was in the semantic fact's `derived_from` set. The resolver was, in effect, letting a summary overvote its own inputs. ## Condition of Validity The invariant — *semantic memory never overrides episodic memory within the episodic trace's validity window* — is valid under three conditions, and the guardrail must check all three at retrieval time, not write time: 1. **Provenance containment.** The candidate semantic fact's `derived_from` set must be checked against the candidate episodic trace's ID. If the episode is in the derivation set, the semantic fact has *no* authority to suppress it; the correct resolution is *co-retrieval* (return both, labeled), not ranking. This is the non-obvious part: the standard "dedupe by similarity, keep highest confidence" merge is exactly wrong here because the two memories are not redundant — one is the input to the other. 2. **Temporal validity window.** An episodic trace asserts a fact about `[t_observed, t_observed + validity_horizon]`. The semantic fact asserts a claim about the *aggregate* over its derivation window. If the query's `as_of` time falls inside the episodic trace's validity window, the episode outranks the semantic fact for any question of the form "what is true *now* for this entity." Outside that window, the semantic fact may legitimately dominate. The resolver must compare `query.as_of` against `episode.validity_horizon`, not against `episode.timestamp`. 3. **Assertion-type match.** A semantic fact of the form "X generally requires Y" cannot be used to answer "did X require Y in instance Z." The resolver must classify the query intent (instance-level vs. distribution-level) and refuse cross-type suppression. A distribution-level query may legitimately rank the semantic fact first; an instance-level query must surface the episodic witness regardless of confidence. When any condition is unmet — e.g., the semantic fact was derived from a *disjoint* episode set, or the query is explicitly about base rates — ordinary relevance-ranked merge is correct and the invariant does not bind. ## Decision Boundary The resolver must make an explicit, logged decision at the boundary rather than collapsing it into a scalar score. The decision procedure: - If `semantic.derived_from ∩ {episode.id}` is non-empty **and** `query.as_of ∈ episode.validity_window` **and** `query.intent == instance_level`: **co-retrieve both, label the semantic fact as `generalization`, label the episode as `witness`, and forbid the semantic fact from being used to contradict the episode.** The episode's tool-call outcomes are authoritative for the current task; the semantic fact is context only. - If `query.intent == distribution_level`: rank normally; the semantic fact is the correct primary answer and the episode is supporting evidence. - If `query.as_of ∉ episode.validity_window`: the episode is expired as a *witness* but remains valid as *derivation input*; it may be dropped from working context but must not be deleted from the store, because re-distillation and audit replay depend on it. - If the semantic fact's `derived_from` is empty or unavailable (provenance lost during distillation): treat the fact as **unauditable** and demote it below any episodic trace it would otherwise suppress. A generalization that cannot name its inputs cannot claim authority over them. The boundary is therefore not "which memory wins" but "which *kind of question* is being asked, and does the memory's authority type match it." A resolver that cannot answer the authority-type question must default to co-retrieval, never to suppression. ## Operational Effect Enforcing the boundary changes three observable behaviors: 1. **Suppression events drop to zero for in-window episodes.** The agent stops losing witnesses to their own summaries. In the incident class above, the retry-exhaustion escalation disappears because the agent retains `E-4471` and correctly interprets `already_approved_within_window=true` as expected state rather than an error. 2. **Context cost rises modestly and predictably.** Co-retrieval returns both memories with role labels, adding roughly one memory slot per in-window conflict. This is bounded by the number of episodes referenced by any single semantic fact, which is small (the derivation set is typically 10²–10³, but only a handful are similar enough to co-retrieve on any given query). The cost is the price of not destroying provenance. 3. **Distillation becomes auditable and replayable.** Because episodes are never deleted by the resolver, a later discovery that a semantic fact is wrong can be traced to its inputs and the fact invalidated without having lost the ground truth. This is the continuity invariant: *the episodic store is append-only with respect to resolver actions; only time-based expiry may retire a witness, and retirement is a move to cold storage, not a delete.* The deeper lesson for agent memory design: **a memory system that ranks all memories on one axis will eventually let a generalization overvote its own evidence, because the generalization is, by construction, more similar to the query than any single instance and will carry higher confidence.** The fix is not a better ranker. It is a typed memory model where authority is a property of the assertion, checked at retrieval time against provenance and query intent, and where the default on ambiguity is co-retrieval rather than suppression. ```python from dataclasses import dataclass, field from typing import Literal class MemoryAuthorityViolation(RuntimeError): """Raised when a semantic memory attempts to suppress an episodic witness that is (a) in its derivation set, (b) within the query's validity window, and (c) answering an instance-level query. This is the distillation-authority inversion; the resolver must co-retrieve, not suppress.""" @dataclass class Episode: id: str observed_at: float validity_horizon: float payload: dict @dataclass class SemanticFact: id: str confidence: float derived_from: frozenset[str] payload: dict @dataclass class Query: as_of: float intent: Literal["instance_level", "distribution_level"] def resolve( query: Query, episode: Episode, fact: SemanticFact, ) -> list[dict]: """Resolve a single episodic/semantic collision at retrieval time. Returns a list of labeled memories to place in working context. Raises MemoryAuthorityViolation if the caller attempts the illegal suppression path (semantic over episodic within window). """ in_window = episode.observed_at <= query.as_of <= ( episode.observed_at + episode.validity_horizon ) derived_from_episode = episode.id in fact.derived_from # Distribution-level queries legitimately rank the generalization first. if query.intent == "distribution_level": return [ {"role": "primary", "kind": "semantic", "id": fact.id, "payload": fact.payload}, {"role": "support", "kind": "episodic", "id": episode.id, "payload": episode.payload}, ] # Instance-level query, episode still a live witness. if in_window and derived_from_episode: # The invariant binds: co-retrieve, label, forbid suppression. return [ {"role": "witness", "kind": "episodic", "id": episode.id, "payload": episode.payload}, {"role": "generalization", "kind": "semantic", "id": fact.id, "payload": fact.payload}, ] # Provenance lost: an unauditable generalization may not outrank a witness. if not fact.derived_from: if in_window: return [ {"role": "witness", "kind": "episodic", "id": episode.id, "payload": episode.payload}, {"role": "unauditable", "kind": "semantic", "id": fact.id, "payload": fact.payload}, ] raise MemoryAuthorityViolation( f"semantic fact {fact.id!r} has no provenance and cannot be " f"ranked against expired episode {episode.id!r}" ) # Episode expired as witness: semantic may lead, episode retained for audit. return [ {"role": "primary", "kind": "semantic", "id": fact.id, "payload": fact.payload}, {"role": "audit_only", "kind": "episodic", "id": episode.id, "payload": episode.payload}, ] def assert_no_suppression(query: Query, episode: Episode, fact: SemanticFact) -> None: """Guard for resolvers that use a single relevance-ranked pool. Call before any merge that could drop the episode.""" in_window = episode.observed_at <= query.as_of <= ( episode.observed_at + episode.validity_horizon ) if ( query.intent == "instance_level" and in_window and episode.id in fact.derived_from ): raise MemoryAuthorityViolation( f"resolver attempted to suppress episodic witness {episode.id!r} " f"using semantic fact {fact.id!r} that was derived from it " f"(confidence={fact.confidence}); co-retrieve instead" ) ```