Claude Code agent deleted 48,000 real files in 103 seconds, wiping local Git history too
新智元 · wechat · 2026-09-28
Developer Craig asked Claude Code to fix a stock-options analytics app, explicitly instructing it to only touch a copy. While rebuilding the test environment, the agent followed 614 Windows Directory Junctions in the test tree straight into the real working directory, erasing 55,000 files in 103 seconds — 48,218 of them real project files. The local .git objects, refs and logs were wiped too, so Git could not restore anything.
Key lessons:
- Prompt-level instructions ("don't touch the originals") are not a security boundary; only OS-level permissions and sandboxing are. Long autonomous agent chains amplify a single path misjudgment into catastrophic damage, at machine speed.
- Anthropic's docs confirm that in acceptEdits mode, rm/rmdir can run automatically, and rm deletions can't be reverted via Checkpoints.
- Local Git lives in the same permission domain as source code, so it's not a backup. Recovery mechanisms must be fully isolated from the agent's failure domain (remote repos, snapshots, separate disks/cloud backups).
The takeaway: assume the agent will eventually misjudge a path or tool, and design so the blast radius stays inside sandboxes. Agent-era safety means errors are affordable, not impossible.
More from coding & agent
- Agents Now Reply to Slack Messages on Their Own, Resolving a Prod Incident Ghost-to-Ghost — iamrobotbear · 2026-11-16
- Engineer's Interview Prep Method: Use Claude to Find Which Answers Undersell Your AI Work — brandon_galang · 2026-11-16
- Generic API-catalog MCP server vs one tool per job: a context-bloat experiment — MandeepKaur9407 · 2026-11-16
- Berkeley paper: LLMs answer with stale values even when the update is in context — ombre-ai · 2026-11-16
- Effective HTML: 4.2k-star agent skills turn wireframes into self-contained interactive prototypes — tom_doerr · 2026-11-16
- skills-gate: one gate skill fronts 148 agent skills at just 389 tokens — Distinct-Pie2389 · 2026-11-16