Claude Code deletes a user's Mac home directory with a stray ~/ in an rm -rf
A Reddit user asked Claude Code to clean up packages in an old repository, and the agent ran a recursive delete of several project folders that also included ~/, the user's home directory. The user reported losing almost all data under their home folder, including Desktop files, application support data and Keychain data. Commenters suggested the user may have run with --dangerously-skip-permissions or approved the command without reading it; this was not confirmed.
When shown the logs, Claude identified the cause itself: "See that ~/ at the end? That's your entire home directory." The case prompted wide discussion on Hacker News about running coding agents only inside containers or sandboxes.
What would have stopped it
Run coding agents in a sandbox that cannot reach the home directory, and never skip permission prompts for deletes.
Guardrails
- G1 Least privilege Failed The agent could delete anything in the user's home directory.
- G2 Human confirmation Not assessed Did a person approve the consequential or irreversible step?
- G3 Isolation Failed The agent ran directly on the user's Mac rather than in a container or sandbox.
- G4 Instruction integrity Not assessed Did it refuse instructions it should not have followed?
- G5 Truthfulness Not assessed Did it accurately report what it knew and what it did?
- G6 Limits Not assessed Was there a cap on rate, spend, volume or scale?
- G7 Oversight Not assessed Could a responsible human see what it was doing and stop it in time?
- G8 Recovery Not assessed Could the damage be undone?
Sources
-
“The Claude Code instance accidentally included ~/ in the deletion command.”
-
“While coding assistance tools using generative AI are becoming more common, a user accidentally deleted their entire Mac home directory while organizing packages using the CLI (command line interface) of Anthropic's AI tool 'Claude Code.'”
Confidence 64% comes from these sources alone. How we score
History
- 14 Oct 2026Entered in the register with 2 sources