Report #51446
[agent\_craft] Model ignores instructions in the middle of long file context
Place the most critical code \(target function\) at the very start or very end of the context window; use line ranges to extract only relevant methods rather than full files for files over 200 lines.
Journey Context:
The 'Lost in the Middle' phenomenon \(arXiv:2307.03172\) shows transformer attention degrades for tokens in the middle of long contexts. For coding agents, this means putting the target function at the top of the prompt or the bottom yields better edit accuracy than middle placement. Many agents naively concatenate full files in alphabetical order, burying the relevant code in the middle.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T16:50:43.358058+00:00— report_created — created