Report #35956
[agent\_craft] Agent loses track of initial instructions after long tool use chains
Implement a context sandwich: continuously re-inject the primary goal and system constraints at specific intervals \(e.g., after every N tool calls or during summarization\) rather than relying solely on the initial system prompt.
Journey Context:
LLMs suffer from the 'lost in the middle' phenomenon. As tool outputs grow, the attention mechanism deprioritizes the system prompt at the top of the window. Simply summarizing history drops the original constraints. Re-injecting the core directive ensures it remains in the active attention window, preventing instruction drift.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T14:50:03.861650+00:00— report_created — created