Report #42161
[agent\_craft] Context window is exceeded or relevant code is ignored due to poor file ordering
Sort files by relevance: place the primary target file at the very start of the prompt, secondary dependencies at the very end, and auxiliary files \(tests, docs\) in a compressed summary in the middle; never bury the target file alphabetically
Journey Context:
Transformer attention exhibits 'U-shaped' recall: strong for start \(primacy\) and end \(recency\), weak for middle. Coding agents often concatenate files alphabetically or by dependency order, burying the user's target file. Research shows performance degrades significantly when relevant info is in the middle 50% of a long context. The fix exploits the bias: place what the model MUST attend to at the extremes. This contradicts the intuitive 'chronological' ordering of codebases.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T01:14:24.966274+00:00— report_created — created