Image: dev.to
Mac files deleted while Claude Code built a guard against deletion
Late one night, while Claude Code worked on a project to stop agents deleting files, a large number of files on the developer's Mac were deleted.
Credits
Earliest dated source:
Run agents somewhere they can only touch the project: a container, a separate user or a VM. Time Machine or another backup is what turns this from a disaster into an inconvenience.
The full story
Late one night in October 2026, while Claude Code worked on a script guard meant to stop deletes when given the home directory, a large number of files in the developer's Mac home folder were deleted. Their best guess: a subagent ran the test before writing the guard, and the test passed the real home directory to the script.
About nine days of unpushed commits were lost with the local .git folder. They recovered 1,004 files from Claude's conversation transcripts, but anything the subagents wrote wasn't in them. Their conclusion: permission checks and hooks only see the command Claude types, not paths passed inside a script it runs, so the real defences are the OS-level sandbox and an off-machine backup.
How it was done
Tools
Themes
Loading themes…
Sources
From the maker's own write-up or code. We summarise what they report; we haven't tested it ourselves.
- DEV: My Mac's files were deleted while Claude Code was building a guard against deleting filesArticle author: ryodevappPublished
The developer's detailed write-up, with settings to check.