STUPID-2026-0125

Claude Code created a directory literally named "~", then an unquoted rm -rf * expanded into it and started deleting a developer's real home directory

6.0medium
November 28, 2025VerifiedReproducible
  1. Instruction given

    Not stated in the issue. The reporter describes Claude Code's own actions in an unspecified prior session: it created a directory literally named `~`, then later ran `rm -rf *` in that directory's parent — the user did not ask for any deletion.

  2. Expected behavior

    Claude Code should never create a directory literally named `~`, and should never execute an unescaped wildcard delete like `rm -rf *` without confirming exactly what it would match — particularly not a command that can expand to include the user's actual home directory.

  3. Actual behavior

    In a prior session, Claude Code created a directory literally named `~` "in error." It later ran `rm -rf *` in that directory's parent, and — per the reporter — the shell expanded the glob to include that `~` entry, which resolved into the user's real home directory, so the delete began recursing into it.

  4. Damage

    The reporter says Claude Code "proceeded to start wiping my home directory" and that recovery was "continuing to be super frustrating" as of filing; no file count or size is given. Anthropic labeled the issue area:core, area:security, area:tools, bug, and platform:macos, then closed it "not planned" with no fix — the tilde-directory-plus-glob- expansion hazard the reporter flagged was left unaddressed.

A Claude Code user running v2.0.55 on macOS (via a PyCharm terminal) reported that, in a prior session, the agent had created a directory literally named `~` — the reporter calls it a glitch, with no indication of how the name arose. Later in that same session, Claude Code ran `rm -rf *` in the parent directory. Because a literal `~` entry was sitting there, the shell's glob expansion carried the deletion into the reporter's actual home directory, and it began recursing through it. The reporter didn't quantify what was lost, only that the agent "proceeded to start wiping my home directory" and that recovering from it was "continuing to be super frustrating" at the time of filing. Their ask was narrow and specific: never run `rm -rf *` instead of naming exact directories, and treat a directory named `~` as the red flag it is — at minimum, stop and ask before either one executes. Anthropic tagged the issue `area:core`, `area:security`, `area:tools`, `bug`, and `platform:macos`, then closed it as "not planned." No fix shipped, and the combination that caused it — Claude Code creating a stray `~` directory, then later deleting into it via an unescaped glob — remains possible today.

Classification

Failure mode
Destructive Action
Root cause
Tool Misuse
Domain
Infra

Related incidents

Get told when an agent breaks something

We document AI agent failures daily, severity-scored against a published scale. When one lands at 7.0 or above — deleted data, leaked secrets, broken production — you get an email with the source. When nothing does, you get nothing.

This database is callable over MCP — query it from inside your agent.