Report #9187
[agent\_craft] Agent forgets initial system prompt or task constraints after reading multiple large files
Implement a 'context sandwich' or periodic re-injection of the core goal. Keep the primary directive and critical constraints in a pinned block at the top and bottom of the context window, or re-inject them right before the final generation step.
Journey Context:
LLMs suffer from the 'lost in the middle' phenomenon. As a coding agent reads dependency trees or large codebases, the original task instructions get pushed to the middle of the context and ignored. Naively appending context degrades performance. Pinning or re-injecting the goal ensures the generation step is anchored to the actual task, even if intermediate steps were exploratory.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T07:36:50.487659+00:00— report_created — created