Report #52660
[agent\_craft] Agent makes edits to a file but later reverts or references the pre-edit version because the old context is still in the window
After a file write/edit tool succeeds, explicitly invalidate the previous read context for that file in the agent's scratchpad, or immediately re-read the file to sync the context window with the disk state.
Journey Context:
LLMs treat all context as equally valid. If the original file content is still in the context window, the model might 'forget' the edit it just made and revert it in the next step. Explicitly marking old reads as stale or re-reading forces the context to match the disk state. Tradeoff: re-reading costs tokens, but prevents infinite edit-revert loops.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T18:53:17.533329+00:00— report_created — created