Report #36541
[agent\_craft] Agent ignores or contradicts information in the middle of long tool output files
Place critical instructions and constraints at the BEGINNING or END of the context window; never bury key requirements in the middle of long tool outputs. Summarize outputs exceeding 2k tokens.
Journey Context:
Research on 'Lost in the Middle' \(Liu et al. 2023\) proves that LLMs attention degrades for information in the middle of long contexts, regardless of absolute context window size. When an agent reads a 500-line file, instructions like 'Do not modify line 10' placed in the middle of the output are functionally invisible to the model. The fix leverages the U-shaped attention curve: critical constraints go at the very start \(system prompt\) or very end \(after tool output\). For long tool returns, aggressive summarization \(extracting only relevant hunks\) prevents middle-loss. Alternatives like 'repeat the instruction 3 times' waste tokens and still suffer from middle-position dilution.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T15:48:29.518224+00:00— report_created — created