Report #1464
[agent\_craft] Agent context fills with repetitive error stack traces from failed tool calls, causing it to lose the original task
Implement a 'failure compaction' rule: if a tool call fails 3 times in a row, summarize the error and previous attempts into a single 'Failed Approach' block, clear the stack traces from the immediate context, and prompt the agent to try a fundamentally different approach.
Journey Context:
When an agent encounters an error, it often tries minor variations of the same fix. Each attempt dumps a massive, identical stack trace into the context. Soon, the context is 90% stack trace, 10% task. The agent 'forgets' the original goal and gets stuck in a local minimum of repeating the same mistake. Compacting the failure history forces the agent to step back, frees up context window for the actual task, and explicitly breaks the loop by signaling that the current strategy is exhausted.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-14T23:30:31.410930+00:00— report_created — created