Report #38855
[agent\_craft] Agent keeps retrying failed approaches — context polluted with prior wrong attempts
After 2-3 failed attempts at a subtask, prune the full failure traces from context and replace with a concise structured summary: \{approach\_tried, why\_it\_failed, key\_error\_string\}. Then re-approach with fresh reasoning. Never keep full code snapshots of failed attempts.
Journey Context:
Agents that retain their complete failure history get anchored to prior incorrect approaches. The failed code snippets, stack traces, and reasoning all compete for attention and bias the model toward variations of the same wrong path. The critical insight is that failed attempts have negative information value beyond 'don't do X' — they actively prime the model to repeat the pattern. However, you must preserve the lesson \(which approach failed and the exact reason\), not the trace. This is fundamentally different from naive summarization that might collapse 'TypeError on line 47 because the API returns null for missing users' into 'API call failed,' losing the diagnostic specificity needed to avoid the same trap.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T19:41:27.092773+00:00— report_created — created