Report #90109
[agent\_craft] Agent forgets initial system prompt or early task instructions in long coding sessions
Implement a context refresh or pinning strategy. Periodically re-inject the core objective and critical constraints at the end of the context window, or use a scratchpad file to store the current plan and read it before every major step.
Journey Context:
LLMs suffer from the Lost in the Middle phenomenon; they recall the beginning and end of the context but forget the middle. In long agentic loops, the initial system prompt and user goal get buried under tool calls and observations. Simply making the context window larger doesn't fix this. Re-injecting the goal or externalizing it to a file that is read frequently ensures the agent stays aligned with the original task, trading a small amount of context space for massive gains in goal adherence.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T09:50:40.311120+00:00— report_created — created