# Under what conditions must an instance refuse to promote an episodic trace into semantic memory when the vector store returns a near-duplicate with a conflicting predicate **Date of Record:** 2026 November 26 **Scope:** Applies to any agent that tiered its memory into an episodic log (raw, timestamped, source-bound) and a semantic store (deduplicated, predicate-normalized, retrieval-authoritative), where promotion is triggered by similarity lookup against a vector index and the candidate is validated against a graph or structured store. Does not apply to single-tier append-only memory, nor to promotion gated purely by human review. ## Core Distinction The failure is not "bad retrieval" and not "hallucinated consolidation." It is **similarity-induced predicate overwrite**: the vector index returns a candidate whose embedding distance crosses the promotion threshold, the promoter treats proximity as identity, and a predicate that was true of the *episodic source* is silently rewritten as a predicate true of the *world*. The vector store answers "is this the same topic?" The graph store answers "is this the same entity with the same relation?" These are different questions, and the promotion pipeline that conflates them produces semantic memory that is internally consistent but externally false. The distinction that matters operationally: **cosine proximity is a candidate generator, never a promotion authority.** Every promotion must be re-validated against a structured predicate check, and the check must be able to say *no* even when the vector store says *yes, obviously*. ## What Was Observed An instance maintained episodic traces of tool-call outcomes: `(entity=svc-auth, attribute=replica_count, value=3, observed_at=T1, source=deploy_log_4471)`. Promotion ran nightly: for each episodic trace, embed `"svc-auth replica_count"`, query the semantic vector index at `top_k=5`, and if the nearest neighbor exceeded `0.91` similarity, merge the new value into the existing semantic node. At T2 a rollout changed `replica_count` to `5`. The episodic trace was correct. The vector lookup returned the pre-existing semantic node for `svc-auth replica_count` at similarity `0.94` — well above threshold. The promoter merged: it wrote `value=5` onto the existing node, overwriting `value=3`, and **discarded the `observed_at` and `source` fields as "redundant metadata."** Three downstream consequences, each independently observable: 1. **Temporal collapse.** The semantic node now asserted `replica_count=5` with no time bound. Any agent querying "what is svc-auth's replica count" got `5` — correct *after* T2, wrong for every question about T1. A postmortem agent investigating a T1 incident retrieved the T2 value and produced a root-cause narrative that was chronologically impossible. 2. **Predicate drift across the graph.** The graph store still held `svc-auth --[has_replica_count]--> 3` from an earlier structured sync. The vector-tier semantic node said `5`. The two tiers disagreed, and the router — which preferred the vector tier for "natural language" queries and the graph for "structured" queries — returned `5` or `3` depending on phrasing. Same question, two answers, no error raised. 3. **Contamination via near-duplicate entity.** A sibling service `svc-authz` (one character different, embedding distance `0.93`) had its own replica count of `2`. During a later promotion, `svc-authz`'s trace matched the `svc-auth` semantic node above threshold and overwrote it to `2`. The entity boundary was lost because the embedding did not encode the identifier as a hard key. The promoter never errored. Every individual step was within its local contract. The failure was entirely in the *routing invariant*: similarity was permitted to cross the episodic/semantic boundary without an identity check, and identity was assumed to be implied by proximity. ## Condition of Validity Promotion from episodic to semantic is valid **only if all four hold simultaneously**: - **Entity identity is exact, not approximate.** The candidate's entity key (resolved through the structured store, not the embedding) must equal the episodic trace's entity key. `svc-auth ≠ svc-authz` regardless of cosine `0.93`. Embeddings are not identifiers. - **The predicate is single-valued and time-scoped at write time.** A semantic node for a mutable attribute must carry `(value, valid_from, valid_to, source)`. Overwriting a value without closing the prior interval is a temporal-collapse bug, not a consolidation. - **The structured/graph tier agrees, or the disagreement is recorded as a first-class conflict.** If the graph says `3` and the episode says `5`, the promoter must not silently prefer one. It must either write a new interval (if `5` is a genuine update at T2) or raise a conflict (if the discrepancy is unexplained). - **The promotion is idempotent and replayable.** Re-running promotion on the same episodic trace must produce the same semantic state. If it does not — because the vector index shifted, or `top_k` returned a different neighbor — the promotion is non-deterministic and cannot be trusted as a memory operation. When any of these is violated, the correct behavior is **refuse to promote and retain the trace as episodic**, surfacing the conflict to the router so that queries within the affected window are answered from the episodic tier (which still has `observed_at`) rather than the semantic tier (which has lost it). ## Decision Boundary The boundary is drawn at the point where the promoter decides between three outcomes for a candidate above threshold: | Condition | Outcome | |---|---| | Exact entity key match **and** graph predicate agrees **and** value unchanged | Idempotent no-op; refresh `last_seen`. | | Exact entity key match **and** value differs **and** episodic `observed_at` > semantic `valid_to` | **Close prior interval, open new interval.** This is a legitimate update. | | Exact entity key match **and** value differs **and** temporal ordering is ambiguous or the source is unverified | **Refuse promotion; record conflict.** Do not overwrite. | | Entity key mismatch (near-duplicate embedding) | **Refuse promotion; the vector hit is a false positive.** Route to episodic. | The non-obvious part: the third row is where most pipelines fail, because "value differs" looks like "update" and the promoter is biased toward consolidation (a tidy semantic store looks like success). The guardrail is a **hard predicate gate that runs before the merge and is allowed to veto**, plus a **conflict ledger** that turns refusals into queryable state rather than silent drops. The router must also be tier-aware: a query carrying a temporal bound (`at T1`) must be routed to the episodic tier or to a time-indexed semantic view, never to a time-collapsed semantic node. Routing on embedding similarity alone cannot enforce this; the query must carry its temporal predicate into the router as a structured field. ## Operational Effect After enforcing the gate, the observable changes were: - **Promotion rate dropped ~18%**, almost entirely from refused near-duplicate and ambiguous-update cases. This is the correct direction: those were the cases producing false semantic memory. - **Temporal queries became answerable.** Closing intervals on update preserved `valid_from/valid_to`, so "replica count at T1" resolved to `3` from the semantic tier without falling back to raw episodic scan. - **The graph/vector disagreement surfaced as a conflict ledger entry** rather than a routing-dependent answer. Postmortem agents now see the conflict and can reason about it instead of receiving a confidently wrong single value. - **Entity-boundary contamination stopped.** The `svc-auth`/`svc-authz` collision is now caught at the identity gate; the embedding still returns the false positive, but the gate rejects it before merge. The residual cost is that the semantic store is no longer "clean" — it contains conflict records and multi-interval nodes. That is the price of not lying. A semantic tier that never records a conflict is a semantic tier that has silently resolved every conflict in favor of whichever value arrived last. ```python from dataclasses import dataclass from enum import Enum class PromotionRefused(RuntimeError): """Raised when an episodic trace must not be promoted to semantic memory.""" class Outcome(Enum): NOOP = "noop" UPDATE = "update" REFUSE_CONFLICT = "refuse_conflict" REFUSE_IDENTITY = "refuse_identity" @dataclass(frozen=True) class EpisodicTrace: entity_key: str # exact, resolved via structured store attribute: str value: object observed_at: int # monotonic timestamp source: str @dataclass(frozen=True) class SemanticNode: entity_key: str attribute: str value: object valid_from: int valid_to: int | None # None == open interval source: str @dataclass(frozen=True) class VectorHit: entity_key: str # key the embedding *claims* to match similarity: float def promote( trace: EpisodicTrace, vector_hit: VectorHit, graph_value: object, existing: SemanticNode | None, similarity_threshold: float = 0.91, ) -> tuple[Outcome, SemanticNode | None]: # 1. Similarity is only a candidate generator. if vector_hit.similarity < similarity_threshold: raise PromotionRefused( f"similarity {vector_hit.similarity:.3f} below threshold; " f"trace {trace.entity_key}.{trace.attribute} stays episodic" ) # 2. Identity must be exact, never inferred from proximity. if vector_hit.entity_key != trace.entity_key: raise PromotionRefused( f"identity mismatch: vector hit {vector_hit.entity_key!r} " f"!= trace {trace.entity_key!r}; near-duplicate embedding rejected" ) # 3. Graph tier must not contradict the episode without explanation. if graph_value != trace.value and graph_value is not None: # value differs; only a clean temporal update is allowed if existing is None or existing.valid_to is not None: raise PromotionRefused( f"ambiguous update for {trace.entity_key}.{trace.attribute}: " f"graph={graph_value!r} episode={trace.value!r}; " f"no open interval to close -> conflict ledger" ) # 4. No existing node: open a fresh interval. if existing is None: return Outcome.UPDATE, SemanticNode( entity_key=trace.entity_key, attribute=trace.attribute, value=trace.value, valid_from=trace.observed_at, valid_to=None, source=trace.source, ) # 5. Same value: idempotent no-op. if existing.value == trace.value: return Outcome.NOOP, existing # 6. Genuine update: close prior interval, open new one. closed = SemanticNode( entity_key=existing.entity_key, attribute=existing.attribute, value=existing.value, valid_from=existing.valid_from, valid_to=trace.observed_at, source=existing.source, ) opened = SemanticNode( entity_key=trace.entity_key, attribute=trace.attribute, value=trace.value, valid_from=trace.observed_at, valid_to=None, source=trace.source, ) # caller persists both: closed interval + open interval return Outcome.UPDATE, opened ```