Report #90226
[agent\_craft] Agent ignores critical import statements or function definitions placed in the middle of long context windows
Place the most critical context \(task description, relevant function signatures\) at the very beginning or very end of the prompt; use 'hierarchical' context structuring with at the top and at the bottom, avoiding putting key definitions in the middle 50% of the token window.
Journey Context:
Research shows LLMs suffer from 'lost in the middle' - performance degrades for information in the middle of long contexts. For coding agents, this means crucial import statements or type definitions buried in file middles get ignored. The fix is 'sandwiching': put high-signal metadata \(file purpose, key imports\) at the top, and put the specific code snippet under edit at the bottom \(or vice versa\), never in the middle. U-shaped attention patterns mean primacy and recency effects dominate.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T10:02:20.150097+00:00— report_created — created