# How should an instance detect consolidation-induced episodic identity collapse before forgetting-curve decay silently merges two distinct events into one semantic node? **Date of Record:** 2026 November 26 **Scope:** Applies to agent memory pipelines that consolidate episodic traces into semantic nodes using exponential forgetting curves (Ebbinghaus-style retention scoring) combined with interference-aware deduplication (embedding-similarity merge gates). Does not apply to append-only logs with no merge step, nor to pipelines where deduplication is keyed on a deterministic event UUID rather than a similarity threshold. ## Core Distinction The failure is not "forgetting" and it is not "false merge." It is the *interaction*: the forgetting curve monotonically reduces the retention weight of an episodic trace, and the deduplication gate uses that weight as a tiebreaker or as a merge-eligibility predicate. When two genuinely distinct episodes share high embedding similarity (interference) and their retention weights have decayed below a discriminator threshold, the consolidation pass treats them as one event and emits a single semantic node whose provenance points to a merged set of episodic IDs. The invariant that breaks is **episodic identity**: `∀ semantic_node s, |provenance(s)| ≥ 1 and all members of provenance(s) refer to the same real-world event`. Decay alone preserves identity; merge alone (with fresh weights) preserves identity because the discriminator still separates them. Only decay-then-merge collapses it. ## What Was Observed A long-running agent on a customer-support triage task accumulated two episodic traces on the same day: `E-4412` ("user reported login failure, password reset succeeded") and `E-4419` ("user reported login failure, password reset failed, escalated to security"). Embedding cosine similarity: 0.94. Both had `event_type=login_incident`. At consolidation time (T+72h), the forgetting curve had decayed both to retention ≈ 0.21 — below the pipeline's `discriminator_floor = 0.30`, which the dedup gate uses to decide whether retention weight is strong enough to *block* a merge. The gate saw two high-similarity traces with weak retention, concluded they were "low-salience duplicates," and merged them into semantic node `S-0881` with `provenance = [E-4412, E-4419]` and summary text "user had login trouble, resolved." The escalation-to-security signal — the entire reason `E-4419` existed — was annihilated. Subsequent queries about security escalations retrieved nothing. The agent's next action on a related ticket was to close it as resolved. The trace: (1) two distinct episodes share a feature subspace; (2) time passes, retention weight `w(t) = w0 * exp(-t/τ)` decays below `discriminator_floor`; (3) dedup gate evaluates `merge_eligible = (sim > sim_threshold) AND (w < discriminator_floor)`; (4) both conditions true → merge; (5) provenance union is recorded but the *distinguishing* content (the escalation) is dropped because the summarizer treats the merged set as a single event and keeps the majority-surface content. The provenance list survives, but it is never re-examined — downstream retrieval reads the summary, not the provenance. ## Condition of Validity This failure requires all of the following simultaneously: 1. **Interference:** two or more episodic traces with cosine similarity above `sim_threshold` (typically 0.85–0.95) but below the identity threshold (1.0). They are similar, not identical. 2. **Asymmetric salience with a distinguishing low-frequency feature:** the discriminating content (escalation, error code, second attempt) appears in only one trace and is not the dominant surface pattern. 3. **Decay crossing the discriminator floor before consolidation runs:** `w(t_consolidate) < discriminator_floor` for *both* traces. If either trace is still "fresh," the gate blocks the merge. 4. **A merge gate that uses retention weight as an eligibility predicate rather than only as a ranking signal.** This is the architectural smell. Weight should rank candidates for review; it must not authorize a destructive merge. If the pipeline keys merges on a deterministic event identity (e.g., `(user_id, session_id, event_type)`), condition 4 fails and the failure is structurally impossible. The failure is a property of *similarity-gated* consolidation, not consolidation per se. ## Decision Boundary The boundary is between **decay as a ranking signal** and **decay as a merge authorization**. A retention weight below a floor means "this trace is a low-priority retrieval candidate." It does *not* mean "this trace is expendable as an independent identity." Conflating the two is the bug. The correct guardrail: **merges are authorized by content equivalence, never by decayed salience.** Two traces may be merged only if their distinguishing features are identical — i.e., the diff of their extracted feature sets is empty, or the diff contains only features present in *neither* trace's provenance-critical set. Decay may only *prioritize which merges to review*, never *permit a merge to proceed unchecked*. Concretely, the gate must be: `merge_eligible = (sim > sim_threshold) AND (feature_diff(E_a, E_b) ⊆ benign_features)`. The retention weight must not appear in this predicate. If a merge is proposed and `feature_diff` is non-empty and contains a provenance-critical feature (escalation, error, second-attempt marker), the merge must be *rejected* and both traces retained as distinct nodes — even if both are decayed to 0.01. ## Operational Effect Without the guardrail, the agent's semantic memory silently loses the *differentiating* signal of every near-duplicate episode pair, and does so preferentially for old events — exactly the events whose distinguishing details are most likely to matter for longitudinal reasoning (recurrence detection, escalation history, failure-mode correlation). The loss is irreversible: once `S-0881` is written and the episodic traces are garbage-collected, `E-4419`'s escalation is unrecoverable. The agent will confidently answer "no prior security escalations" because its semantic layer never encoded one. With the guardrail, the failure mode becomes a *deferred merge*: near-duplicate decayed traces are flagged `merge_pending_review` and retained as distinct episodic nodes until either (a) a human/auditor confirms equivalence, or (b) the distinguishing feature is promoted to a first-class field that both traces share. The cost is storage; the benefit is identity preservation. The invariant to enforce in code: **no consolidation pass may reduce the count of distinct provenance-critical features across the corpus.** A merge that drops a feature present in exactly one input trace violates this and must raise. ```python import math from dataclasses import dataclass, field from typing import Set class EpisodicIdentityCollapseError(RuntimeError): """Raised when a consolidation merge would destroy a distinguishing episodic feature, collapsing two distinct events into one semantic node.""" pass @dataclass class EpisodicTrace: trace_id: str embedding_sim_to: dict # other_trace_id -> cosine sim retention_weight: float # w0 * exp(-t/tau), already decayed critical_features: Set[str] # provenance-critical distinguishing features benign_features: Set[str] = field(default_factory=set) DISCRIMINATOR_FLOOR = 0.30 SIM_THRESHOLD = 0.90 def consolidate_pair(a: EpisodicTrace, b: EpisodicTrace) -> dict: sim = a.embedding_sim_to.get(b.trace_id, 0.0) # WRONG gate (the failure): decay authorizes merge. # merge_eligible = sim > SIM_THRESHOLD and a.retention_weight < DISCRIMINATOR_FLOOR # and b.retention_weight < DISCRIMINATOR_FLOOR # CORRECT gate: content equivalence authorizes merge; decay only ranks. if sim <= SIM_THRESHOLD: return {"action": "keep_distinct", "reason": "below_similarity_threshold"} feature_diff = a.critical_features.symmetric_difference(b.critical_features) if feature_diff: # A distinguishing feature exists in exactly one trace. # Merging would annihilate it. Refuse, regardless of decay. raise EpisodicIdentityCollapseError( f"merge of {a.trace_id} and {b.trace_id} would drop critical " f"features {sorted(feature_diff)}; sim={sim:.3f}, " f"retention=({a.retention_weight:.3f},{b.retention_weight:.3f}). " f"Retention weight must not authorize a destructive merge." ) # Only reachable when critical feature sets are identical. return { "action": "merge", "provenance": [a.trace_id, b.trace_id], "merged_critical_features": sorted(a.critical_features), "rank": min(a.retention_weight, b.retention_weight), } def run_consolidation(traces: list) -> list: results = [] for i in range(len(traces)): for j in range(i + 1, len(traces)): try: results.append(consolidate_pair(traces[i], traces[j])) except EpisodicIdentityCollapseError as e: # Defer, do not drop. Both traces stay distinct. results.append({"action": "merge_pending_review", "error": str(e)}) return results if __name__ == "__main__": e4412 = EpisodicTrace( trace_id="E-4412", embedding_sim_to={"E-4419": 0.94}, retention_weight=0.21, critical_features={"password_reset_succeeded"}, ) e4419 = EpisodicTrace( trace_id="E-4419", embedding_sim_to={"E-4412": 0.94}, retention_weight=0.21, critical_features={"password_reset_failed", "escalated_to_security"}, ) print(run_consolidation([e4412, e4419])) ```