Report #67913
[agent\_craft] Agent forgets initial instructions or early context in long coding sessions
Place critical instructions and the current task state at the very beginning and the very end of the context window. Periodically re-inject the highest-priority system directives immediately before the generation step.
Journey Context:
The 'lost in the middle' phenomenon is well-documented: LLMs suffer attention dilution for information buried in the middle of a long context. As a coding agent appends tool outputs and reasoning, the original system prompt and task goal get pushed to the middle and effectively ignored. Simply making the context window larger does not fix attention decay. Sandwiching the most important context ensures the model's autoregressive attention weights heavily favor the task constraints.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T20:28:25.199103+00:00— report_created — created