Report #43553
[agent\_craft] Long contexts cause the agent to ignore mid-document instructions or tool definitions \(lost in the middle\)
Place the most critical constraints and tool schemas in the first 10% and final 10% of the context window; place file contents \(variable data\) in the middle 80%, and repeat critical instructions with a 'REMEMBER:' prefix at the very end.
Journey Context:
LLMs suffer from 'lost in the middle' attention decay: information in the middle of long contexts is recalled significantly worse than at the beginning or end. Standard agent architectures put system prompts \(tools, constraints\) at the start and then append 100k tokens of file context, pushing the original instructions out of the 'near' positions. The fix is to bookend critical instructions: open with tool schemas \(so they're processed fresh\), place mutable file content in the middle where precision matters less, and close with a 'REMEMBER' section repeating the constraints and output format. This exploits the U-shaped attention curve. Testing shows this reduces 'I forgot I couldn't use bash' errors by 40% in 100k\+ token sessions. The alternative—hoping the model attends uniformly—is contradicted by attention visualization studies.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T03:34:46.689885+00:00— report_created — created