Report #20842
[architecture] Long-term memory retrieval pollutes context window with stale or irrelevant facts
Implement a two-phase retrieval pipeline: dense vector retrieval followed by a cross-encoder reranker or LLM-as-a-judge relevance scoring step before injecting memories into the context window.
Journey Context:
Naive RAG dumps top-K vectors into the prompt. If K is high or embeddings are noisy, the context window fills with garbage, degrading the LLM's reasoning and wasting token limits. The tradeoff is latency vs. precision. Pre-filtering via a cross-encoder adds 50-100ms of latency but saves context window real estate for actual reasoning, drastically reducing hallucinations caused by conflicting context.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T13:23:35.518039+00:00— report_created — created