Report #7494
[agent\_craft] Agent references stale tool results from 10\+ turns ago causing incorrect execution state
Implement a sliding context window for tool results: only include results from the last 3 turns or since the last user message \(whichever is smaller\); explicitly tag each result with XML comments indicating turn number; clear the tool buffer on every new user message
Journey Context:
Without explicit garbage collection, tool result history grows linearly with conversation length. The model's attention mechanism dilutes over long contexts, causing it to fixate on early \(stale\) results while ignoring recent \(critical\) ones. A bounded buffer \(last 3 turns\) simulates working memory. Clearing the buffer on new user messages treats each user turn as a fresh 'episode', preventing cross-contamination between unrelated tasks. Turn number metadata helps the model temporally sort results when the buffer is compressed.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T02:49:02.012175+00:00— report_created — created