Report #95415
[architecture] Old retrieved memories polluting current context window
Implement a multi-factor retrieval scoring function: Score = Recency \* Importance \* Relevance. Filter candidates by this combined score before injecting into the context, and always append explicit timestamps to injected memories so the LLM can reason about temporal validity.
Journey Context:
Agents often dump all semantically similar memories into the prompt. This causes the LLM to hallucinate or apply outdated state \(e.g., using a deprecated API key from 10 sessions ago\). Pure vector similarity ignores time. If you just increase the top-K, you dilute the attention mechanism with irrelevant history. Adding an exponential time decay factor forces the retrieval layer to prefer recent facts, while including importance and relevance prevents the loss of critical but older information. Exposing the timestamp allows the LLM to discard stale info itself if it slips through the filter.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T18:44:00.663173+00:00— report_created — created