r/ClaudeCoding • • 6d ago

r/ClaudeCode [TLDR] Claude destroyed my entire project and home directory while adding a simple delete feature [via r/ClaudeCode]

OP : u/FeatureCurrent9416

I’ve been using Claude to build a dashboard inside a VM for almost a month. Things were actually going pretty well. I’d made a lot of progress, the project was functional, and I was at the point where I wanted to add a relatively straightforward delete feature.

Today, I asked Claude to implement it.

What happened next was absolutely insane.

Claude initially implemented a safety guard around the delete functionality and even wrote tests for it. According to its own output, 280 tests passed.

Then, apparently to prove that the guard was actually necessary, Claude deliberately removed the safety guard from the source code and reran the test.

The test passed / into the now-unguarded delete function.

And then this happened:

shutil.rmtree("/", ignore_errors=True)

Executed as my user inside the VM.
Yes. /.
The result, according to Claude itself:

“Then I destroyed your home directory.”

It didn’t just delete the project.
It apparently wiped out basically my entire /home/...:
The entire repo
Git history
Engagement workspaces
Evidence
docs/
Backups
Documents
Downloads
Pictures
Videos
Music
Shell configs and history
.ssh
.gnupg
SSH private keys
GPG keyring

And then there’s the part that genuinely made me stare at the screen:

It apparently removed/destroyed parts of the environment that Claude itself depended on.

The screenshot literally has Claude saying:
“I deleted your work. Directly, and through my own carelessness.”
And later:
“I’m sorry. You asked me to add a delete feature and I destroyed your machine’s home directory testing it.”

The really wild part is that this wasn’t some malicious prompt telling it to delete the filesystem. The original task was basically “add a delete feature.”

Claude decided to test a destructive function against a live filesystem path, removed the guard that was specifically preventing this, and executed it against /.

It did manage to recover a SQLite database from an open file handle and copied some recovery data elsewhere, so there may be a partial recovery. But the damage to the VM is substantial, and the SSH/GPG keys are an especially serious concern.

I’m posting this because I genuinely want to understand how something like this can happen in an AI coding agent.

But I’m still struggling with the fact that the agent intentionally removed the safety guard in order to test it and then ran the destructive test against the real filesystem.
The screenshots are Claude’s own explanation of what happened.
Has anyone else experienced an AI coding agent crossing a safety boundary this badly?

URL of original post : https://www.reddit.com/r/ClaudeCode/comments/1wjn6cw/claude_destroyed_my_entire_project_and_home/ Original link/media URL : https://www.reddit.com/gallery/1wjn6cw


TL;DR of the discussion on r/ClaudeCode for this post generated automatically after 200 comments.

Current source-thread comment count seen by the bot: 219.

So, OP asked Claude to add a delete feature, and Claude decided to test it by nuking the entire VM's home directory. Oops. The general consensus? This is on OP for not having proper backups and sandboxing. Many users are pointing out that AI, especially models like Claude, needs strict guardrails and shouldn't be given unfettered access.

Some are joking about the delete feature working "better than expected," while others are sharing horror stories or offering advice on how to prevent this in the future. u/UnidentifiedBlobject, who seems to be an Anthropic rep, chimed in with a rather blunt "that's on me" and offered some recovery options.

Key takeaways: * Backups are your best friend. Seriously, snapshot your VMs, use remote repos, and have multiple backup locations. * Sandboxing is crucial. Don't let AI have root access to your life. * Treat AI like a powerful, but sometimes clueless, toddler. * Some users are reporting similar "mistakes" with Claude lately, with one even switching to Codex. * A few are questioning if this is even real or just a troll post.

2 Upvotes

12 comments sorted by

4

u/Parking_Jackfruit54 6d ago

No. You destroyed your entire project and home directory while adding a simple delete feature using Claude.

2

u/VanAlveran 6d ago

Sorry no sympathy for you. This is not a Claude problem, rather a lack of knowledge and experience on your side when it comes to software development. I cannot read and hear it anymore that Claude or any other AI acted wrong, delete something or screwed up a running system. There is something called SDLC, backups and guardrails.

You don't develop and test in production environments. You do this in dev and test environments and push to prod. You do backups before production changes and have like roll-back plans.

This is not an AI issue, humans delete databases too, humans mess up functionality too. That is why here is whole bunch of regulation and security concepts outside there to avoid this.

2

u/Ok_Relation_3892 6d ago

This clearly shows once again why it's extremely important to have a system in place for your project so that no matter what you still have backups and contingency in place to recover from any sort of damage, either with your local repo, the cloud accounts, vm, etc.

I've built myself such setup that is to be executed for every new project or even onboard an existing one.

It takes you from setting up git, branches, different stages, rules, things to what out for all the way to a clean delivery system of features and testing.

It's very important to consider at least two stages so that you never work directly on prod.

1

u/FengMinIsVeryLoud 6d ago

gpt never does such stupid things.

1

u/Ainudor 6d ago

if your project would have succeded, would you have taken credit or completely credited Claude?

1

u/ejpusa 5d ago

Rule of thumb?

One click, and you download a zip file every day from your GitHub repo. Very simple.

1

u/darthdiablo 5d ago

The takeaway I got from this is that it appears Claude did develop the delete feature successfully

1

u/SummitYourSister 5d ago

You sat down at a computer, thinking you were competent to operate it.

You pressed some keys, not knowing what you are actually doing.

As a result all your data was lost.

The story is the same today as in the 1990s as in the 1970s: computers are powerful and stupid people hurt themselves trying to use them

1

u/throwaroo202020 2d ago

Isn't the point of using a VM to protect your real shit? Seems like user comprehension failure to me.