Edit/Write tool shows stale diff after case-only file rename on Windows
Description
The Edit and Write tools show stale file content in the diff preview after a case-only file rename on Windows (NTFS, case-insensitive). The Read tool and Bash commands return the correct current content, but the diff preview consistently shows the original file content from before the rename. This persists across multiple attempts, even after re-reading the file.
Steps to Reproduce
- Create a new file using the
Writetool (e.g.skill.md) with initial content - Make several edits to the file using
Edit, building up the content over multiple iterations - Rename the file using
Bashwith a case-only change:mv skill.md SKILL.md - Continue editing the file using
EditorWritetargetingSKILL.md - The diff preview shown to the user displays the original file content (from the first
Writecall), not the current content on disk - The user sees a diff that appears to revert all intermediate edits, even though
Readconfirms the file on disk is correct - This persists indefinitely within the session, regardless of how many times
Readis called beforeEdit
Expected Behavior
After re-reading the file, the Edit/Write tools should use the current file content for diff generation, not a cached version from a previous path.
Actual Behavior
The diff preview consistently uses stale content from the original Write call. The cache appears to be keyed by case-insensitive path, so the rename from skill.md to SKILL.md does not invalidate it.
Environment
- OS: Windows 11 Enterprise (NTFS, case-insensitive filesystem)
- Claude Code: VSCode extension
- Model: claude-opus-4-6 (1M context)
Impact
The user cannot approve any Edit/Write operations on the affected file for the remainder of the session, since every diff preview shows incorrect changes (appearing to revert the file to an earlier state). The only workaround is for the user to make the edit manually in their IDE.
Workaround
None found within the session. Manual editing in the IDE is required for the affected file.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗