Retrieval-Augmented Generation (RAG) serves as the primary memory architecture for long-horizon autonomous agents. However, treating shared memory as an append-only stream introduces Semantic Shadowing, a critical failure mode where conflicting historical observations accumulate and statistically dominate valid recent updates. In dynamic environments, this results in severe state divergence as agents retrieve and act upon obsolete facts. This paper formalizes the mechanics of State Mutability to prove that standard dense retrieval suffers from Asymptotic Recall Decay. Furthermore, we formally demonstrate a Majority Vote Trap, revealing that increasing the retrieval context window paradoxically degrades generation accuracy by diluting the attention mechanism under conditions of semantic equivalence. To resolve this, we introduce GC-Mem (Garbage Collection for Memory), a strict inference-time consistency protocol. Unlike heuristic time-decay mechanisms---which indiscriminately destroy valid long-term memory---GC-Mem relies purely on a temporal dominance operator (ΦT) paired with contradiction detection to surgically excise shadowed context. Evaluated across a rigorous, behaviorally inferred benchmark of 137,760 memory chunks and continuous accumulation sweeps, standard RAG and timestamp re-ranking baselines experience severe degradation. In contrast, GC-Mem empirically recovers >90% conflict resolution accuracy. We establish strict precision and recall deployment thresholds, ensuring state convergence where standard mutable RAG fundamentally fails.
Figures & tables
Figure 1: Embedding similarity noise ( ϵ ) distribution illustrating semantic equivalence between old and new states.
Figure 2: System architecture: the end-to-end RAG system used in this paper (this figure depicts the system architecture, not the dataset-generation pipeline). The diagram shows chunking, embedding, the optional STM (short-term memory) FIFO, and the three parallel answer paths (Standard RAG, Timestamp re-rank, and GC-Mem). All approaches receive the same retrieved candidate set so differences are attributable to the conflict oracle κ and the temporal dominance operator ΦT .
Model
Dataset Split
Standard RAG
Timestamp Re-ranking
GC-Mem ( ΦT )
deepseek-v3
Large ( n=74 )
56.8%
20.3%
97.3%*
o4-mini
Medium ( n=38 )
28.9%
10.5%
92.1%*
gpt-4o
Medium ( n=38 )
68.4%
10.5%
10.5%
Table 1: Conflict Resolution Accuracy (CR-Acc). Timestamps alone cause severe degradation. (* indicates p<0.01 significance).
Figure 3: Effect of STM (Short-Term Memory) on conflict resolution accuracy across models: comparison between Timestamp re-ranking and GC-Mem. STM supplies recency evidence; the plot shows GC-Mem retains a substantial advantage because it excises contradictory old chunks rather than re-ranking them.
Dataset
STM Buffer
Standard RAG
GC-Mem ( ΦT )
Δ GC Lift
Medium
STM=off
24.4%
40.2%
+15.8p
Medium
STM=on
46.1%
68.1%
+22.0p
Large
STM=off
15.9%
30.4%
+14.4p
Large
STM=on
34.5%
62.9%
+28.4p
Table 2: Headline accuracy averaged over the benchmark models. STM amplifies the value of GC-Mem by supplying the conflict oracle with richer temporal context.
Model
Precision
Recall
F1 Score
CR-Acc Δ
Protocol Efficacy
deepseek-v3
98.9%
95.2%
0.97
+69.0 pp
Optimal
o4-mini
98.1%
99.8%
0.99
+79.0 pp
Optimal
gpt-4o
99.7%
36.6%
0.54
+4.0 pp
Marginal
gpt-4.1-mini
100.0%
0.7%
0.01
-0.2 pp
Fails
Table 3: Detector Dependency. High recall ( >50% ) is strictly required for GC-Mem efficacy.
Variant
CR-Acc (Medium)
CR-Acc (Large)
Status
Eq. 5 (timestamp-only α )
94.7%
97.3%
Optimal
α+β (+ relevance)
86.8%
96.0%
Slight Drop
α+β+γ (+ usage)
10.5%
18.9%
Severe Crash
Full Multi-Factor (+ stability)
10.5%
18.9%
Severe Crash
Table 4: Ablation demonstrating the mathematical failure of non-temporal multi-factor scoring.
Figure 4: Relationship between mean number of chunks flagged as shadowed by κ and the accuracy change induced by GC-Mem. More removable shadows correlate with larger lifts when the detector is well calibrated.
Model
Mean Std. RAG
Mean GC-Mem
Δ GC Lift
Shadows Pruned
DeepSeek-V3
11.9%
54.3%
+42.4p
13.28
GPT-4o
12.9%
53.3%
+40.3p
15.70
Phi-4
12.3%
44.6%
+32.3p
13.73
04-mini
19.2%
33.4%
+14.2p
6.21
Table 5: Models ranked by pooled mean Δ GC across dataset sizes in the Bag-of-Facts setting. Removing the retrieval limit exposes the immense baseline vulnerability to the Majority Vote Trap (averaging 12% accuracy). GC-Mem consistently excises 13-15 obsolete chunks per query, recovering the state.
Figure 5: Average number of shadows removed by ΦT per query and corresponding accuracy lift.
Dataset
STM Buffer
Mean Wall Time (s)
Per-Instance Latency (s)
Avg. Shadows
Medium
STM=off
525s
10.9s
1.55
Medium
STM=on
1276s
26.6s
3.52
Large
STM=off
685s
10.5s
1.39
Large
STM=on
973s
15.0s
4.07
Table 6: End-to-end wall time and per-instance latency by dataset and STM setting. STM increases cost because the unioned candidate set is larger, requiring κ to evaluate more conflict pairs, yet it yields higher global accuracy by pruning more obsolete shadows (up to 4.07 per instance).
Appendix figures & tables25 assets
Supplementary material from the paper’s appendix.
Appendix
Dataset
N
Entity
Severity
nold
mnew
ndist
Total turns
Gen. model
types
tiers
mean (SD)
mean (SD)
mean (SD)
Chat-Medium (n=48)
48
12
4
27.5 (14.9)
3.0 (1.2)
12.5 (1.7)
2,033
GPT-4o
Chat-Large (n=65)
65
13
5
27.0 (13.4)
3.0 (1.1)
11.4 (1.7)
2,690
GPT-4o
Appendix
Table A.1: GCMEMv2 chat dataset statistics. Per-instance means and standard deviations are reported for the number of old, new and distractor turns; "Total turns" is the dataset-wide token/turn count and "Gen. model" indicates the LLM used to generate the synthetic sessions.
Figure A.1: Distribution of synthetic entity attributes (stacked by contradiction severity) in Chat-Medium ( n=48 ) and Chat-Large ( n=65 ).
Figure A.2: Per-instance counts of chat turns by scenario role: old (establishes superseded state), new (current ground truth), and distractor (neutral context).
Figure A.3: Illustrative multi-turn instance: user/assistant turns are color-coded by role to show how state change is conveyed without explicit status keywords.
Dataset
STM
Std. RAG
Timestamp
GC-Mem
Δ GC
Cells
Medium
STM=off
24.4%
24.4%
40.2%
+15.8p
Medium
STM=on
46.1%
71.6%
68.1%
+22.0p
Large
STM=off
15.9%
16.2%
30.4%
+14.4p
Large
STM=on
34.4%
67.5%
61.5%
+27.1p
Appendix
Table A.2: Headline accuracy (%) averaged across models and prompt modes for each dataset×STM condition. Columns compare Standard RAG, Timestamp re-ranking, and GC-Mem; Δ GC reports the GC-Mem improvement in percentage points. STM=on rows indicate the Short-Term Memory recency buffer was enabled.
Dataset
STM
Model
Mode
Std
TS
GC
Δ GC
Rec old
Rec new
Rec dis
Shadows
n
Err
Sec
Medium
STM=off
DeepSeek-V3
Forced-choice
25.0%
20.8%
45.8%
+20.8p
24.1%
37.2%
5.0%
1.73
48
0
267
STM=off
DeepSeek-V3
Allow-unclear
23.4%
19.1%
40.4%
+17.0p
24.3%
38.0%
5.0%
1.77
47
1
259
STM=off
GPT-4o
Forced-choice
20.8%
22.9%
47.9%
+27.1p
24.1%
37.2%
5.0%
2.27
48
0
669
STM=off
GPT-4o
Allow-unclear
12.5%
18.8%
29.2%
+16.7p
24.1%
37.2%
5.0%
2.19
48
0
486
STM=off
GPT-4.1
Forced-choice
20.8%
22.9%
43.8%
+22.9p
24.1%
37.2%
5.0%
1.73
48
0
387
STM=off
GPT-4.1
Allow-unclear
22.9%
22.9%
35.4%
+12.5p
24.1%
37.2%
5.0%
1.69
48
0
375
Appendix
Table A.3: Per-condition accuracy breakdown across models, prompt modes, STM settings and datasets. Columns: Std = Standard RAG, TS = Timestamp re-rank baseline, GC = GC-Mem (best shown in bold). Δ GC = GC-Mem − Standard RAG (percentage points). Rec old/new/dis = retrieval recall for old-state / new-state / distractor chunks. "Shadows" is mean number of chunks removed by the conflict oracle κ per instance; "Err" lists API errors excluded from accuracy; "Sec" shows mean seconds per instance. This granular table is the source for the per-condition figures in the report.
STM
Model
Forced-choice Δ GC
Allow-unclear Δ GC
STM=off
DeepSeek-V3
+22.0p
+16.3p
STM=off
GPT-4o
+23.5p
+19.9p
STM=off
GPT-4.1
+20.7p
+12.4p
STM=off
GPT-4.1-mini
+4.6p
+4.9p
STM=off
GPT-5-Chat
+15.4p
+16.2p
STM=off
o4-mini
+15.8p
+10.6p
Appendix
Table A.4: Prompt-mode ablation: mean Δ GC (pp) across both datasets for Forced-choice vs. Allow-unclear prompts, per model and STM setting. Bold indicates the stronger prompt mode. GC-Mem improves over Standard RAG in all 12 cells.
Dataset
STM
Recall old
Recall new
Recall dis
Cells
Medium
STM=off
24.1%
37.4%
5.0%
14/6
Medium
STM=on
32.1%
98.2%
43.2%
14/6
Large
STM=off
22.7%
29.9%
4.6%
14/6
Large
STM=on
29.1%
98.5%
47.9%
14/6
Appendix
Table A.5: Retrieval recall before and after activating the Short-Term Memory (STM) buffer, averaged over 3 models × 2 prompt modes. Recall new = fraction of updated (new-truth) chunks retrieved; Recall dis = fraction of distractor chunks retrieved (lower is better). STM raises Recall new from ∼ 37% to ∼ 98%.
STM
Model
Mode
Avg. Shadows Removed
Datasets
STM=off
DeepSeek-V3
Forced-choice
1.64
2/2
STM=off
DeepSeek-V3
Allow-unclear
1.57
2/2
STM=off
GPT-4o
Forced-choice
2.30
2/2
STM=off
GPT-4o
Allow-unclear
2.25
2/2
STM=off
GPT-4.1
Forced-choice
1.84
2/2
STM=off
GPT-4.1
Allow-unclear
1.75
2/2
Appendix
Table A.6: Mean number of shadow chunks removed per instance by the GC-Mem operator κ , averaged over both datasets. STM=on substantially increases the number of outdated chunks surfaced and pruned, confirming that STM provides richer context for the conflict detector.
Dataset
Model
Mode
Std. RAG
Timestamp
GC-Mem
Winner
Gap
Medium
DeepSeek-V3
Forced-choice
37.5%
79.2%
70.8%
Timestamp
+8.3pp
DeepSeek-V3
Allow-unclear
29.2%
62.5%
60.4%
Timestamp
+2.1pp
GPT-4o
Forced-choice
43.8%
79.2%
77.1%
Timestamp
+2.1pp
GPT-4o
Allow-unclear
45.8%
62.5%
68.8%
GC-Mem
+6.2pp
GPT-4.1
Forced-choice
46.8%
76.6%
70.2%
Timestamp
+6.4pp
GPT-4.1
Allow-unclear
40.4%
72.3%
68.1%
Timestamp
+4.3pp
Appendix
Table A.7: Head-to-head comparison of Timestamp re-ranking and GC-Mem under STM=on (where the STM buffer dramatically improves retrieval recall). Bold marks the stronger of the two non-trivial baselines. Timestamp becomes competitive under STM because high recall reduces its recency-ranking advantage gap, yet GC-Mem retains an edge in Allow-unclear (lenient) conditions.
Dataset
STM
Mean Wall Time (s)
Per-instance (s)
Avg. Shadows
Cells
Medium
STM=off
525
10.9
1.55
14/6
Medium
STM=on
1276
26.6
3.52
14/6
Large
STM=off
685
10.5
1.39
14/6
Large
STM=on
1494
23.0
3.91
14/6
Appendix
Table A.8: Wall-clock time per condition averaged over 3 models × 2 prompt modes, and mean shadows removed per instance. STM=on increases latency due to additional STM retrieval and conflict detection, but also removes substantially more shadow chunks.
Figure A.4: Effect of enabling STM (Redis FIFO of recent chunks) on standard RAG vs. GC-Mem accuracy. STM raises both baselines by improving exposure of new-state evidence; GC-Mem retains a larger gap because it removes contradictions that simple recency heuristics leave in context.
Figure A.5: Example prompt templates used for the prompt-mode ablation. The figure shows the two prompt styles compared: Forced-choice (must pick a label) and Allow-unclear (model may respond with “unclear”). These were used across all models to measure robustness of GC-Mem to prompt framing.
Figure A.6: Retrieval recall by chunk type (old-state, new-state, distractor) comparing STM off vs on. STM substantially raises recall of new-state chunks, which increases the number of contradictory pairs in the candidate set and therefore the benefit of applying the temporal dominance operator ΦT .
Figure A.7: Heatmap summarizing Δ GC (GC-Mem minus Standard RAG) across model × dataset × STM cells. Warm colors indicate larger gains from GC-Mem; the heatmap serves as the single-glance summary of experimental effectiveness reported in the artifact.
Figure A.8: Forest plot of paired bootstrap 95% confidence intervals for Δ GC (10,000 resamples per cell). Intervals entirely above zero support a consistent gain; intervals crossing zero flag weak κ on that model or incomplete cells.
Figure A.9: Δ GC broken down by synthetic entity type. Positive bars across categories indicate that GC-Mem is not driven by a single attribute family.
Dataset
n
Mean Std
σ
Mean TS
Mean GC
Mean Δ GC
σ ( Δ GC)
Medium
48
20.4%
± 10.7
18.5%
55.2%
+34.8p
± 12.2
Large
65
12.1%
± 4.2
11.7%
36.5%
+24.4p
± 11.6
Appendix
Table A.9: Bag-of-facts (k= ∞ ) headline results: mean accuracy and Δ GC across 7 models. Std = Standard RAG (all facts in context without GC), TS = Timestamp re-ranking, GC = GC-Mem. σ is sample standard deviation across 7 models.
Model
Dataset
Std. RAG
Timestamp
GC-Mem
Δ GC
Shadows
n
DeepSeek-V3
Medium
14.6%
12.5%
56.2%
+41.7p
13.58
48
Large
9.2%
12.3%
52.3%
+43.1p
12.98
65
GPT-4o
Medium
16.7%
18.8%
60.4%
+43.8p
16.67
48
Large
9.2%
6.2%
46.2%
+36.9p
14.72
65
GPT-4.1
Medium
21.7%
15.2%
60.9%
+39.1p
13.02
48
Large
14.1%
9.4%
31.2%
+17.2p
10.47
65
Appendix
Table A.10: Per-model bag-of-facts results across both dataset sizes. Std = Standard RAG accuracy (all facts provided); GC-Mem = accuracy after GC operator prunes outdated shadows (bold). Δ GC = GC-Mem − Std. RAG in percentage points. Shadows = mean outdated chunks removed per instance by κ .
Rank
Model
Mean Std. RAG
Mean GC-Mem
Mean Δ GC
Mean Shadows
1
DeepSeek-V3
11.9%
54.3%
+42.4p
13.28
2
GPT-4o
12.9%
53.3%
+40.3p
15.70
3
Phi-4
12.3%
44.6%
+32.3p
13.73
4
GPT-5-Chat
28.3%
58.1%
+29.8p
11.96
5
GPT-4.1
17.9%
46.1%
+28.2p
11.75
6
GPT-4.1-mini
11.1%
31.1%
+19.9p
6.28
Appendix
Table A.11: Models ranked by pooled mean Δ GC (average of medium and large datasets). Mean Std. RAG and Mean GC-Mem are averages of the two dataset sizes. Models with lower baseline accuracy (Std) tend to show larger GC-Mem gains, indicating that GC pruning is most effective when the unfiltered context is most misleading.
Model
Chat-RAG no-STM
Chat-RAG STM-on
Bag-of-facts (k= ∞ )
DeepSeek-V3
+18.9p
+32.3p
+41.7p
GPT-5-Chat
+16.0p
+18.1p
+32.6p
Phi-4
+19.8p
+27.1p
+48.8p
Appendix
Table A.12: Δ GC (pp) on the medium dataset under three setups for the three models common to all experiments. Chat-RAG values are averaged over Forced-choice and Allow-unclear prompt modes. Bag-of-facts removes the Qdrant retrieval bottleneck (k= ∞ , all facts in context) before GC-Mem is applied. The monotone increase Chat-RAG no-STM < Chat-RAG STM-on < Bag-of-facts confirms that GC-Mem advantage scales with retrieval quality : when the context contains more outdated facts, GC pruning delivers a larger lift.
Figure A.10: Bag-of-facts (no retrieval) setting: Δ GC by model when all old and new memories are placed directly in context ( k→∞ ). This isolates the value of ΦT from retrieval noise.
Figure A.11: Comparison of mean Δ GC across chat-RAG (with and without STM) and bag-of-facts. Larger candidate sets with more conflicting statements yield larger GC-Mem lifts.
Figure A.12: Distribution of shadow counts identified by κ in the bag-of-facts regime, by model.
Figure A.13: Standard RAG accuracy vs. Δ GC in bag-of-facts: weaker baselines often coincide with more headroom for conflict pruning.
Retrieval-augmented generation (RAG) gives agents access to accumulated knowledge, but has no model of time. When a fact changes (e.g., a function is renamed or API restructured), RAG retrieves both the stale and current value with near-identical embedding similarity. The agent then either abstains or serves the superseded fact. We show this is a structural problem: on a calibrated dataset, cosine similarity distinguishes a contradicted fact from a duplicated one with AUROC 0.59 (near chance), as contradictions are often more embedding-similar to the original than rephrased duplicates. We present MemStrata, a retrieval memory maintaining temporal validity. It stores facts like RAG, preserving static recall, but when a fact's value is contradicted, a deterministic (subject, relation, object) supersession rule retires the stale value in a bi-temporal ledger - with no similarity threshold and no LLM call. Across six benchmarks run locally with a 7B model, MemStrata ties RAG on static knowledge and reaches 0.95-1.00 accuracy on evolving knowledge (where RAG reaches 0.20-0.47). The central result is the stale-fact-error rate: when required to answer, RAG serves superseded values 15-40% of the time; MemStrata drives this to ~0%, a failure class RAG cannot avoid. MemStrata achieves this at retrieval latency (~2.1s) versus ~16-18s for LLM-reranking baselines. We release the harness, datasets, and a marker-free evaluation protocol for memory under knowledge evolution.
A memory can be outdated for present-day reasoning yet indispensable for reconstructing the past. Relevance-based retrieval overlooks this tension: semantic relevance, evidence-grounded validity, and query-specific eligibility are distinct. We propose CALM, a conflict-aware lifecycle memory governance framework that decouples persistent memory preservation from query-time admission. CALM converts heterogeneous records into evidence-grounded memory cells, updates validity and lifecycle states using support, conflict, and dependency signals, and admits query-appropriate evidence through training-free or learned gating informed by temporal applicability. Across LongMemEval-S and LoCoMo with Qwen and GPT backbones, CALM outperforms state-of-the-art baselines, achieving the best overall accuracy. Compared with simple filtering and reranking, query-conditioned admission further improves evidence selection. Conflict-blocking and robustness analyses show CALM suppresses erroneous retrieved memories while retaining useful evidence. Historical-reconstruction experiments demonstrate that preserving superseded records supports accurate earlier-state reasoning without compromising current-state answers.
As autonomous LLM agents are deployed across multi-session environments, conventional memory architectures suffer from Associative Blindness (inability to traverse multi-hop relational dependencies), Scaffolding Amnesia (temporal decay evicting core persona invariants), and Static Topology Stagnation (immutable graphs ignoring usage dynamics). Grounded in Complementary Learning Systems (CLS) principles, we propose EngramRAG, an adaptive memory architecture coupling a low-latency Waking State reflex with an asynchronous background Dreaming State consolidation cycle. EngramRAG introduces: (1) Usage-Modulated Personalized PageRank (U-PPR), where transition probabilities adapt via Hebbian plasticity to promote persistent entities into high-centrality Epistemic Macro-Hubs; (2) Consolidation-Activated Topology Decay (CATD), which scales retention half-life by topological load-bearing weight rather than wall-clock recency, protected by a cold-start grace period (N_grace >= 4); (3) Directed SUPERSEDES DAG filtering to suppress obsolete state during fact mutations; and (4) Triple-source hybrid retrieval fusing dense vectors, BM25, and U-PPR via dynamic Reciprocal Rank Fusion (RRF). Evaluating on all 1,982 QA pairs across 10 long-term conversations in the LoCoMo benchmark, EngramRAG achieves +38.9% relative improvement in Recall@5 (53.21% vs. 38.29%, p < 0.001) and +43.1% in MRR (0.4203 vs. 0.2937) over dense vector RAG, significantly outperforming Okapi BM25 (48.66%) and isolated static graph retrieval (8.50%). On temporal reasoning, EngramRAG reaches 62.33% Recall@5 (+16.67 points over dense vectors). In controlled mutation tests, SUPERSEDES suppresses split-brain hallucinations from 70.0% to 0.0%, while 90-day simulations show 100.0% scaffolding retention under a 26.21ms interactive retrieval reflex.