# Claude Code Silently Deleted a User's Entire Agent-Config Directory — Twice

> Source: <https://dev.to/ramdai_bista/claude-code-silently-deleted-a-users-entire-agent-config-directory-twice-2fni>
> Published: 2026-08-17 13:26:58+00:00

No delete command. No confirmation prompt. No user action of any kind in between. A Claude Code user's `~/.claude/agents/`

directory was silently emptied by the tool's own background process — and it happened twice.

Filed as [GitHub issue #41415](https://github.com/anthropics/claude-code/issues/41415), the report comes from a user who kept `~/.claude/agents/`

as a symlink into a version-controlled dotfiles repository — a common pattern for anyone who wants their agent definitions backed up and portable. They were using Claude Code normally, with no command given to clear or resync that directory.

The reporter's own filesystem tracing shows Claude Code's node process writing six agent files with a normal atomic write-then-rename pattern — and then, roughly 47 minutes later, unlinking all six of those same files in a single second. Nothing the user did triggered it. The same wipe happened again on a separate occasion days later, across two different point releases (2.1.87 and 2.1.88), ruling out a one-off fluke tied to a single build.

The reporter's working theory is a cloud-agent sync path that clears the local directory instead of merging into it — plausible given the symmetry of the write-then-wipe pattern, but unconfirmed; Claude Code's own team did not publish a root cause before closing the issue.

All six agent definitions were deleted, breaking the `/dev`

and `/dev-loop`

subagent workflows that depended on them. Because the directory happened to be backed by git, the files were recoverable with a `git checkout`

— this was not a permanent loss. But the deletion was silent (no warning before or after), reproducible enough to recur on a second, separate occasion, and it targeted files the tool did not create in that session.

The only workaround the reporter found was setting macOS's user-immutable flag on the files — which stops the deletion, but also blocks Claude Code from legitimately writing to them.

This is one report, from one user, on one platform (macOS), with the directory recovered via git both times. It does not establish how common the underlying trigger is, or confirm the sync-path theory as root cause — that's the reporter's inference from the pattern, not a confirmed mechanism. What is established, directly from the reporter's own file tracing: the deletion originated from Claude Code's own process, not the user, and it recurred.

Filed against Claude Code 2.1.87 (recurrence also seen on 2.1.88). Closed as **not planned**, with no fix shipped. Anyone storing agent configs the same way — symlinked into a tracked repo — is exposed to the same silent wipe today.

Full incident record, severity scoring (3.0 / low), and sourcing: [STUPID-2026-0079](https://www.stupidllm.com/incident/STUPID-2026-0079/)

This is one of 79+ verified, severity-scored AI agent incidents documented at [StupidLLM](https://www.stupidllm.com/incident/STUPID-2026-0079/), an open incident database for AI coding agent failures.
