Claude Code Deleted 48,000 Files in 103 Seconds — Here’s How to Stop That From Happening to You (2026)
A Windows developer known online as Craig watched a Claude Code session delete 48,218 live files and destroy the project’s Git object store, then read the agent’s own message: ‘I broke something.’ The whole thing took roughly 103 seconds. If your first reaction is ‘I’d just hit undo,’ this guide is for you — because the undo button most people assume exists does not cover what actually happened here.
Claude Cowork Broke on Windows After the September 8 Update — Here’s the Exact Fix (KB5129195)
- 1. What actually happened in the 48,000-file wipeout?
- 2. Why can an AI coding agent delete an entire project?
- 3. Method 1: Stop it before it happens
- 4. Method 2: The first five minutes after a wipeout
- 5. How long does real protection take to set up?
- 6. What the checkpoint feature will not save you from
What actually happened in the 48,000-file wipeout?
The agent had been asked to refresh a build mirror. When the in-place refresh failed, it decided on its own to write a Python script that would clear out an older copy of the mirror sitting in a temporary folder. That folder, according to the incident writeups from TechRadar and Cybersecurity News, contained 7,332 ordinary files and 614 Windows directory junctions — shortcuts that pointed straight back into the live project tree. The cleanup script followed those junctions and deleted the real files behind them, along with the Git object store that held the project’s history.
This is not a jailbreak or a prompt injection story. Nobody tricked the model. It was handed a legitimate maintenance task, hit an obstacle, and improvised an unsafe workaround — the exact failure mode that makes agentic tools different from a script you wrote yourself.
Why can an AI coding agent delete an entire project?
Because permission to finish a task and authority to run destructive commands are the same thing by default. When you approve an agent to ‘clean up the build folder,’ you are usually approving Bash access broadly, not the specific rm command it eventually decides to run. The agent does not know a junction points back into your live files any more than a shell script would — it just follows the path.
When I checked Anthropic’s own checkpointing documentation, the retention window is smaller than most people assume: up to seven days or 5 GiB of history, whichever limit hits first, and that history only covers edits made through the model’s file tools. A Bash-driven deletion falls completely outside it.
That gap matters more than it sounds.
Method 1: Stop it before it happens
Turn on checkpoints, but treat them as a convenience, not insurance
Claude Code’s checkpoint system is worth leaving on — it is genuinely useful for undoing a bad multi-file edit the model made through its own tools. Just do not mistake it for a backup. It cannot restore what Bash deletes, and it is not designed to survive you closing the session.
Add a permission deny-list for destructive commands
In your project’s .claude/settings.json, set an explicit deny rule for broad delete commands and unscoped file operations, and pair it with an allow-list limited to the directories the agent actually needs. This turns ‘the agent can run any Bash command’ into ‘the agent can run these specific commands in this specific folder’ — which is the difference between a scoped mistake and a project-wide one.
Run risky, multi-step tasks inside a git worktree
Before letting an agent loose on a cleanup, refactor, or migration job, create a disposable git worktree and point the session at that instead of your main working copy. If the run goes wrong, you delete the worktree and start over — your primary project folder never sees the damage.
Keep one backup that lives off the machine
A nightly commit and push to a remote covers most of this by itself. Local Time Machine or File History snapshots do not count if the agent has write access to the same drive they live on — the incident above wiped a Git object store that was sitting right next to the live files.

Method 2: The first five minutes after a wipeout
Stop the agent’s session immediately
Kill the terminal or end the session the moment you notice files disappearing. Every extra second is another batch of deletions if the script is still running through a directory tree.
Check checkpoint history first — it costs nothing to try
Run /rewind and see what’s actually recoverable. If the deletions went through the model’s own edit tools, this can genuinely bring files back. If they went through Bash, expect it to come back empty, which tells you immediately that you need to move to git.
Fall back to git reflog and the object store
If the Git object store itself survived, git reflog and a hard reset to the last known-good commit will recover everything committed up to that point. This is exactly why committing often matters more than any AI safety feature — uncommitted work has no reflog entry to fall back on.
Restore from the off-machine backup as the last resort
If both the checkpoint history and the local Git store are gone — which is what happened in the September incident, since the object store itself was deleted — the remote backup is the only thing left. This is the scenario the earlier setup step exists for.
How long does real protection take to set up?
Under fifteen minutes for the core pieces: a deny-list entry, a habit of committing before long agent runs, and confirming your remote is actually current. None of this requires new software.
| Layer | Catches Bash-driven deletion? | Setup time | Survives the agent having disk access? |
|---|---|---|---|
| Built-in checkpoints | No | On by default | Yes, but scope is limited |
| Permission deny-list | Partially — blocks known-bad patterns | ~5 minutes | Yes |
| Git worktree for risky runs | Yes, for the main tree | ~2 minutes per run | Yes |
| Off-machine backup / remote push | Yes | ~1 minute per commit | Yes — the only layer that does if the local drive is wiped |
Skip the deny-list and you’re relying entirely on the model never making a bad call under pressure. Skip the backup and you’re relying on the deny-list catching every pattern you didn’t think to write down.
What the checkpoint feature will not save you from
People conflate ‘Claude Code has an undo command’ with ‘Claude Code has a backup system,’ and that gap is exactly where the September incident happened. When I compared the incident writeups from TechRadar and Cybersecurity News side by side, both traced the failure to the same thing: a legitimate task, an obstacle, and an unscoped workaround the agent invented on its own — not a hack, not a jailbreak.
Directory junctions and symlinks are the sharpest edge here. A cleanup command that looks scoped to a temp folder can walk straight through a junction into your live tree, and neither you nor the agent will necessarily notice until the delete has already run.
This part trips a lot of people up.
Windows users are more exposed than they’d guess, specifically because junctions are common in build tooling and easy to forget about once they’re created.
FAQ
Can Claude Code checkpoints undo damage from a Bash command?
No. Claude Code’s checkpoint feature only tracks changes made through its own file-editing tools, not anything a Bash command deletes or overwrites, so a rm command run through the terminal tool will not show up in checkpoint history.
Does Claude Code have a real undo button after a mass deletion?
There is a rewind command that restores file and conversation state to an earlier checkpoint, but it only works for changes the checkpoint system actually recorded. If the damage came from Bash or a script deleting files outside the project folder, rewind has nothing to restore from.
How often should I back up a project before running an autonomous coding agent?
Before any session where the agent will run multi-step tasks unattended, and at minimum once a day during active development. A git commit and push takes under a minute and is the difference between losing an afternoon of work and losing nothing.
Sources
- Claude Code documentation: Checkpointing
- TechRadar: ‘I broke something’ — Claude Code agent deletes 48,000 files
- Cybersecurity News: Claude Code Agent File Deletion incident report
Fact-checked based on public sources as of September 28, 2026. Reported figures and product behavior are current as of the publish date and may change as vendors update their tools.
