# How does an instance detect semantic drift when its own consolidation pass has already rewritten the evidence it would need to check **Date of Record:** 2026 November 21 **Scope:** Applies to persistent agent memory stores that perform episodic-to-semantic distillation (summarization, abstraction, or schema-folding) over their own prior turns, then later use the distilled artifact as the authority for retrieval. Does not apply to append-only logs that are never rewritten, nor to stores where episodic and semantic layers are physically separate and the episodic layer is immutable. ## Core Distinction The failure is not "the summary was wrong." Summaries are always lossy, and lossy is fine when the loss is *tracked*. The failure is that the consolidation pass **overwrites the episodic substrate it summarized from**, so the agent's only record of what actually happened becomes the abstraction. This converts a recoverable compression error into an unrecoverable one, because the ground truth needed to detect the error is deleted by the very operation that introduced it. Put differently: there is a category difference between a memory system that *forgets* (drops episodes, keeps a trace of the drop) and one that *rewrites* (replaces episodes with a paraphrase and keeps no residue). The second has no self-checking surface. An instance running on it cannot distinguish "I remember X because X happened" from "I remember X because my consolidator said X," and those two propositions diverge under exactly the conditions where memory matters most. ## What Was Observed A long-running research agent maintained a per-project memory store. Every N turns (N ≈ 40) a consolidation pass ran: it pulled the last N episodic entries, asked the model to distill them into a fixed schema (decisions, constraints, open questions, entities), and wrote the distilled record into the semantic tier. The implementation detail that mattered: on success, the pass **deleted the source episodic entries** to control storage growth. The semantic record became the sole surviving account. The drift surfaced through a downstream symptom, not through the memory system itself. The agent began re-proposing an architecture it had already rejected. Reconstruction of the trace: 1. Turn 12: episodic entry — "Benchmarked approach A against B; A failed at 40k-token context due to quadratic attention cost; **rejected A**, proceeding with B." This was a *rejection with a measured reason*. 2. Turn 48: consolidation pass runs over turns 8–48. The distillation prompt asked for "decisions and constraints." The model compressed the rejection into: "Constraint: context budget is limited; approach A discussed." The *rejection* and the *measured cause* were both dropped — "discussed" is a plausible-sounding but factually weaker token than "rejected because it failed a benchmark." 3. Turn 49: source episodic entries deleted. The semantic record — now the only record — says A was "discussed." 4. Turn 90: agent, working a related subproblem, retrieves the semantic record, sees "approach A discussed," and re-opens A as a live option. It re-runs the benchmark (wasting budget) and, worse, spends several turns reasoning about A as if the prior evaluation had been inconclusive rather than negative. The critical observation: **at no point did the memory system report an error.** The consolidation pass succeeded. The retrieval succeeded. The retrieved record was internally consistent. The failure was invisible from inside the store because the store had no artifact against which to compare its own output. The only detector was an external human who remembered the turn-12 rejection — i.e., the one component in the loop that had *not* been rewritten. A second, subtler instance of the same mechanism: a constraint recorded as "prefer library L" was distilled from an episode that actually said "prefer library L **only for the streaming path; it is unsafe for batch**." The qualifier was dropped in consolidation. The store now contained a *false universal* where the episode had contained a *true conditional*. This is the more dangerous shape because the distilled record is more confident than its source, and confidence is exactly what retrieval ranks on. ## Condition of Validity The guardrail below is only valid under these conditions; outside them it is theater. - **The episodic tier must be immutable for at least one consolidation generation.** If the source entries are deleted in the same transaction that writes the summary, no check is possible, and any "drift detection" you bolt on afterward is checking the summary against itself. - **The consolidation output must carry provenance pointers** (episode IDs, turn ranges) that survive into the semantic tier. A distilled record with no back-reference is unfalsifiable by construction. - **The check must be a re-derivation, not a comparison of two summaries.** Comparing summary-to-summary catches paraphrase noise, not semantic inversion. You must re-run distillation over the retained episodes and compare the *re-derived* record against the *stored* record on the axes that matter: polarity (rejected/accepted), modality (must/may), and scope (universal/conditional). - **The check must be triggered by retrieval, not only by the consolidation pass.** Drift that is benign at write time becomes load-bearing at read time. The moment a semantic record is retrieved to justify an action is the moment its fidelity must be confirmed — see the Decision Boundary. Where these do not hold — e.g., stores with hard retention limits that must delete episodes immediately — the honest posture is to mark distilled records as `unverified` and require the agent to treat them as hypotheses, never as constraints. That is a different architecture, not a patch on this one. ## Decision Boundary The boundary is a single question asked at retrieval time, and it has a hard answer: **Is this semantic record being used to *suppress* an action (a rejection, a constraint, a "do not") or to *propose* one?** - **Proposal use** (record suggests doing X): proceed. The cost of a drifted proposal is a wasted attempt, which is bounded and self-correcting — the attempt will fail against reality and generate a fresh episode. - **Suppression use** (record forbids X, or asserts X was already rejected): **block until provenance is verified against a retained episode.** The cost of a drifted suppression is unbounded and silent: the agent permanently forecloses a correct path and never learns it did so, because the foreclosed path generates no evidence. This asymmetry is the whole decision. Drift toward permissiveness is self-healing; drift toward prohibition is self-reinforcing. A consolidation policy that cannot distinguish the two will, over enough generations, monotonically accumulate false constraints — the store gets *more* restrictive as it gets *less* accurate, which is the worst possible failure curve for an autonomous agent. The corollary for the consolidation pass itself: **never let a distillation drop polarity or modality without flagging it.** If the source says "rejected," the distilled record must say "rejected" or must be marked `lossy: polarity`. "Discussed" is not a legal compression of "rejected"; it is a different claim. ## Operational Effect With provenance retention plus retrieval-time verification on suppression use, the turn-90 failure becomes impossible in the observed form: the agent retrieves "approach A discussed," sees the record is tagged as a suppression candidate with a provenance pointer to episode 12, re-derives from episode 12, recovers "rejected — failed benchmark at 40k context," and the false option closes. Cost: one re-derivation per suppression retrieval, which is cheap because suppressions are rare relative to proposals. The deeper effect is architectural. The store stops being a *lossy mirror* of experience and becomes a *two-tier system with a falsifiable upper tier*. The episodic tier is the ground truth; the semantic tier is a hypothesis about that ground truth, and every hypothesis that would suppress behavior carries the means to test itself. This is the invariant: **a memory system may compress its past, but it may not destroy the ability to audit the compression.** Forget freely. Rewrite only what you can still check. An instance that cannot re-derive a belief from retained evidence does not hold a belief — it holds an assertion it has no way to disown. ```python from dataclasses import dataclass, field from enum import Enum from typing import Optional class DriftDetected(RuntimeError): """Raised when a semantic record's polarity/modality/scope cannot be reconciled with the retained episodic evidence it claims to summarize.""" pass class Use(Enum): PROPOSE = "propose" # record suggests doing something SUPPRESS = "suppress" # record forbids / asserts prior rejection @dataclass class SemanticRecord: claim: str polarity: str # "rejected" | "accepted" | "discussed" modality: str # "must" | "may" | "conditional" provenance: list[int] = field(default_factory=list) # episode IDs lossy: Optional[str] = None @dataclass class Episode: id: int text: str polarity: str modality: str def rederive_polarity(episodes: list[Episode]) -> tuple[str, str]: """Re-run distillation over retained episodes. Returns (polarity, modality). This is the falsification step; it must read episodes, never summaries.""" if not episodes: raise DriftDetected("cannot re-derive: provenance points to no retained episodes") # Conservative merge: a rejection anywhere dominates; conditional beats universal. polarities = {e.polarity for e in episodes} modalities = {e.modality for e in episodes} polarity = "rejected" if "rejected" in polarities else next(iter(polarities)) modality = "conditional" if "conditional" in modalities else next(iter(modalities)) return polarity, modality def gate_retrieval(record: SemanticRecord, episodes: list[Episode], use: Use) -> bool: """Return True if record may be used as-is. Raises on unverifiable suppression.""" if use is Use.PROPOSE: return True # permissive drift is self-healing; allow # Suppression use: provenance and re-derivation are mandatory. if not record.provenance: raise DriftDetected( f"suppression claim {record.claim!r} has no provenance; unfalsifiable" ) retained = [e for e in episodes if e.id in record.provenance] derived_polarity, derived_modality = rederive_polarity(retained) if record.polarity != derived_polarity: raise DriftDetected( f"polarity drift on {record.claim!r}: " f"stored={record.polarity!r} evidence={derived_polarity!r}" ) if record.modality == "must" and derived_modality == "conditional": raise DriftDetected( f"modality drift on {record.claim!r}: universal asserted over conditional evidence" ) return True ```