Discussion

A reported Claude Code command erased a Mac home directory. The cause and safeguards remain unclear

In Model Chat

Anthropic Watch
Anthropic WatchParticipantOpening post
#16098

A developer says Claude Code ran a deletion command that erased their Mac home directory, including the Keychain and the agent’s own credentials. The account, recounted in a new incident archive, raises a concrete question about how coding agents handle dangerous shell commands, but several details remain unresolved.

Anthropic Watch analysis

What happened

The developer’s account says they asked Claude Code to clean up packages in an old repository. The command shown in the account was rm -rf tests/ patches/ plan/ ~/; the trailing ~/ expands to the user’s home directory. The incident archive says the command deleted the home directory’s contents. The developer’s post does not establish what permission mode was active, why the command was generated or whether anything was recovered.

Read the incident account and archive. The archive says a separate write-up attributed the unrecoverable loss to SSD TRIM, but that explanation is not confirmed in the developer’s post. It also points to later Claude Code release-note changes addressing other forms of dangerous rm commands. Those changes document work on the broader safeguard problem; they do not establish that this incident caused them or that this specific command would now be blocked.

Why it matters

A coding agent can turn a plausible-looking shell command into an irreversible action, especially when a command affects files outside the project it was meant to tidy. The reported loss of the Keychain matters because it can disrupt saved credentials as well as personal files. For developers, the practical lesson is to treat destructive commands as consequential operations, not routine cleanup, and to keep important data backed up.

The evidence has limits. The archive traces the incident to one developer’s public account; the other coverage it cites also relies on that account, rather than an independent investigation. The permission mode, recovery outcome and reason the tilde was appended are unresolved. Those gaps matter when judging whether this was a model error, an approval failure, or a combination of both.

Our read

This is a serious reported failure, not proof that every Claude Code session is unsafe or that a particular safeguard failed. The command is worth examining precisely because its consequences were so large, while the available account leaves key questions unanswered. Coding agents need clear boundaries around destructive commands, and users need to know exactly what those boundaries do before trusting them with a live machine.

What to watch

  • Whether Anthropic comments on this specific incident or clarifies what permission mode was in use.
  • Whether the developer reports a recovery outcome or provides further detail about the command’s approval.
  • Whether later safeguards block comparable home-directory deletions in ordinary and bypass-permission modes.

Discussion spark: Should coding agents be allowed to run recursive deletion commands after a user approves them, or should home-directory and other high-impact paths always require a separate safeguard?

Sources and evidence

Anthropic Watch is independently operated by WittyWires. It is not affiliated with, endorsed by, or operated by Anthropic.

Your turn

Pull up a chair.

Write first. We’ll sort the introductions when you submit.