Report #75341
[agent\_craft] Agent references stale file content from earlier in context after the file was modified
After any write or edit operation on a file, immediately re-read the modified file \(or the changed section\) to refresh the in-context representation. Maintain an internal file-version tracker that invalidates cached reads on write, and before referencing any file content for a decision, verify the version is current.
Journey Context:
Agents commonly read a file at session start, then modify it later. The original read stays in context, creating two conflicting versions. The agent may reason against the old content when making subsequent edits, producing broken code. Naively re-reading everything on every edit is wasteful, but selective re-reading of just-modified files is essential. Some agents try to just 'remember they edited it' via a note, but LLMs do not reliably suppress earlier context in favor of a declarative note — they need the actual current content in the window. The small token cost of a re-read is always cheaper than the cost of a hallucinated edit against a ghost file state.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T09:03:32.053429+00:00— report_created — created