Report #66809
[agent\_craft] Agent ignores instructions or tool schemas placed in the middle of long context windows
Place critical tool schemas and constraints at the VERY END of the system prompt \(after user code context\), or wrap mid-context items in attention-grabbing XML like ; never bury tool definitions between file snippets.
Journey Context:
The 'Lost in the Middle' paper \(arXiv:2307.03172\) proved LLMs exhibit U-shaped attention—strong recall at start/end, amnesia in the middle. Coding agents commonly fail when they inject 1000 lines of codebase between the tool definitions \(top of prompt\) and the generation point. Hierarchical summarization is often too slow for real-time coding; exploiting position bias by moving schemas to the end \(just before the assistant's turn\) is cheaper and more reliable. This contradicts the intuition that 'instructions should come first'.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T18:36:57.711003+00:00— report_created — created