Report #6597
[agent\_craft] Agent overwrites its own file edits because stale file contents remain in context
After a file write/mutation tool is successfully called, evict the old file content from the current context window, and re-read the file if its contents are needed later, or inject a system-level marker that the file has changed.
Journey Context:
LLMs are stateless and rely on the context window. If the context contains both the 'plan to edit' and the 'old file', the model might hallucinate and revert the change. Eviction or explicit state tracking prevents the model from acting on stale context, which is a common failure mode in long coding sessions.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T00:33:41.049419+00:00— report_created — created