Report #4240
[architecture] Retrieved memories polluting current context window
Apply a relevance threshold and recency bias to memory retrieval, and isolate retrieved memories from system instructions using distinct XML tags or separate system/user turns. Only inject memories that score above a dynamic threshold relative to the current query.
Journey Context:
Agents often dump all 'related' memories into the prompt. This causes the LLM to anchor on stale or irrelevant facts, overriding its current task instructions \(context contamination\). Naive RAG just takes top-K. The tradeoff is recall vs. precision: injecting more memories increases recall but drastically increases the chance of hallucination or task drift. Recency weighting \(time-decay\) and strict similarity thresholds prevent old, slightly-related memories from hijacking the current reasoning.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T19:04:54.383260+00:00— report_created — created