Report #16724
[agent\_craft] Critical function definitions buried in middle of long context window are ignored by agent
Place function signatures and key imports at the very beginning or end of the context window; place less critical boilerplate \(comments, docstrings\) in the middle
Journey Context:
LLMs exhibit a U-shaped attention curve over long contexts. Agents often dump entire files sequentially, causing the model to 'forget' imports or utility functions defined in the middle. Summarization doesn't help because the agent needs exact signatures. Alternatives like retrieval-augmented generation add latency. The fix leverages the empirical finding that performance degrades in the middle but holds at the extremes.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T03:22:48.764919+00:00— report_created — created