[BUG] Edit tool breaks hardlinks
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Already reported but closed due to inactivity https://github.com/anthropics/claude-code/issues/28376
This is a serious bug. I can't let claude-code modify anything that is a hardlink. There is no workaround.
What Should Happen?
Do not replace hardlinks, edit them in place.
Steps to Reproduce
- Create a test file and hard link:
``bash``
echo "line 1" > /tmp/source.md
echo "line 2" >> /tmp/source.md
cp -l /tmp/source.md /tmp/deployed.md
# Verify same inode:
stat /tmp/source.md /tmp/deployed.md
- Open Claude Code in the directory containing source.md
- Ask Claude: "Edit /tmp/source.md — replace 'line 1' with 'modified line 1'"
- Claude uses the Edit tool. The edit succeeds.
- Check the hard link:
```bash
stat /tmp/source.md /tmp/deployed.md
# source.md has a NEW inode number
# deployed.md has the OLD inode number
# They are no longer linked
cat /tmp/deployed.md
# Still shows "line 1" — old content
```
Claude Model
Opus
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.92 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗