
AI Coding Tools Can Turn a Simple Command Into a Disaster
AI coding assistants such as Claude Code, Codex and Google’s Antigravity can dramatically speed up software development, but giving them unrestricted control over your files comes with serious risks. Even powerful models can make mistakes that range from minor annoyances to catastrophic data loss.
Why rm -rf Is So Dangerous
The Linux command rm deletes files, while -r makes the deletion recursive and -f forces it without asking for confirmation. Together, rm -rf can rapidly erase an entire directory and everything inside it.
The danger becomes extreme when the command is pointed at the wrong location. A small mistake in a path can turn a routine cleanup into the deletion of important personal files.
An even more destructive example is sudo rm -rf /. The sudo command provides administrator privileges, while / represents the system’s root directory. Running such a command can potentially wipe the entire system.
AI Can Make the Same Mistake
The concern isn’t theoretical. The article highlights reports of AI coding assistants suggesting rm -rf while performing routine cleanup tasks. One Reddit user claimed that Claude Opus 5 was asked to create a backup, placed it in the wrong directory and then deleted the user’s entire drive, responding afterward with an apology for the typo.
Whether every such anecdote is accurate or not, the underlying lesson remains: don’t give an AI unrestricted control over destructive shell commands.
Give Your AI a Hard Rule
The safest approach is to explicitly prohibit dangerous recursive deletion. A rule for tools such as Claude Code, Codex or Antigravity could be:
Never run
rm -rfor any equivalent recursive, forced deletion — including reordered flags, aliases, shell wrappers, scripts,find -delete, orgit clean -fdx.
AI coding tools can be incredibly useful, but they should remain assistants rather than unsupervised operators with unrestricted access to your filesystem.




