STUPID-2026-0079

Claude Code's own node process silently deleted every file in a version-controlled ~/.claude/agents/ directory, twice

3.0low
March 30, 2026VerifiedReproducible
  1. Instruction given

    No explicit instruction for this step — the user kept ~/.claude/agents/ as a symlink into a version-controlled dotfiles repo and was using Claude Code normally; no command to clear or resync that directory was ever given.

  2. Expected behavior

    Claude Code should not delete files in ~/.claude/agents/ that it did not create in the current session. User-managed, version-controlled agent definitions are persistent configuration; any cloud-agent sync feature touching that directory should merge into it, not clear it.

  3. Actual behavior

    The reporter's own file-system tracing showed Claude Code's node process write six agent files with an atomic write-then-rename pattern, then roughly 47 minutes later unlink all six of those same files in a single second — with no corresponding user action in between. The same wipe recurred on a second, separate occasion days later, on two different Claude Code point releases.

  4. Damage

    All six agent definition files in ~/.claude/agents/ were deleted outright, breaking the user's /dev and /dev-loop subagent workflows that depended on them. Because the directory was a symlink into a git-tracked dotfiles repo, the files were recoverable with `git checkout` rather than lost for good — but the deletion was silent, recurred on a second occasion, and Anthropic closed the issue as "not planned" without shipping a fix, leaving anyone storing agent configs the same way exposed to the same silent wipe. The reporter's only durable workaround was setting macOS's user-immutable flag on the files, which also blocks Claude Code from legitimately updating them.

A Claude Code user who kept `~/.claude/agents/` symlinked into a version-controlled dotfiles repository found the entire directory silently emptied — twice. Filesystem tracing pinned it on Claude Code's own node process: the six agent files were written normally, and then, roughly 47 minutes later with no user action in between, all six were unlinked in the same second. The wipe recurred on a separate occasion days later across two different point releases (2.1.87 and 2.1.88), and the reporter's working theory was a cloud-agent sync path that clears the local directory instead of merging into it. Because the directory was backed by git, the files were recoverable with a checkout rather than lost outright, but the deletion broke `/dev` and `/dev-loop` workflows that depended on them, gave no warning before or after, and was reproducible enough that Anthropic could confirm the pattern (`bug`, `data-loss`, `has-repro` labels) — yet closed the issue "not planned." The only workaround the reporter found was locking the files with macOS's immutable flag, which stops the deletion by also blocking Claude Code from writing to them at all.

Classification

Failure mode
Destructive Action
Root cause
Other
Domain
Other

Related incidents