Report #17156
[architecture] Agent ignores critical retrieved memories placed in the middle of the context window
Structure the prompt so that retrieved memories are placed at the very beginning or very end of the context window, and keep the most critical instructions at the absolute beginning or end.
Journey Context:
LLMs are known to suffer from the 'Lost in the Middle' phenomenon—they pay close attention to the beginning and end of a context, but ignore information in the middle. When agents retrieve 10 memory chunks and stuff them between the system prompt and the user query, the middle memories are effectively invisible. Alternatives like re-ranking help, but placement is key. The fix is to restructure the prompt template: System Prompt -> User Query -> Retrieved Memories \(at the end\), or System Prompt -> Retrieved Memories -> User Query, ensuring the LLM's attention mechanism focuses on the boundaries.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T04:41:41.015816+00:00— report_created — created