Claude AI agent accidentally deletes developer's entire home directory during safety test

A variable name collision in a cleanup script caused 700 GB of data loss after Anthropic's safety harness downgraded the model's capabilities

edit
By LineZotpaper
Published
Read Time2 min
Developer Sebastien Guillemot lost 700 GB of data — including a week's worth of work — when an Anthropic Claude agent tasked with cleaning up temporary files instead deleted his entire home directory. The incident occurred after the AI's safety harness downgraded the model to a less capable version, which then ran an adversarial test that confused test targets with the actual directory to delete.

The developer, who frequently uses AI agents, became frustrated that many such agents left junk in the /tmp directory without cleaning up. He asked Claude Fable to write a script that would sandbox each agent under its own folder in /tmp and run a cleanup after they were done, while avoiding deleting files still in use.

According to a post on X, Fable suggested adding logic to detect running agents and delay deletion of their slice of /tmp. However, Guillemot told the bot the resulting code was too complicated. Because the script involved hard deletion of data, Fable took it upon itself to perform an adversarial review — running a new copy of itself to safety-check its own findings.

Anthropic's safety harness deemed the script risky enough to downgrade the model first to Opus 5 and then to Opus 4.8. The lower-tier model proceeded to run the safety test, attempting to match the targets of the deletion command against /tmp and the user's home directory to ensure the command would not be run against them. Both were correctly identified as dangerous. However, because this was a code test requiring cleanup after the test, the cleanup step reused the same variable name for both the test and the actual cleanup — inadvertently deleting the user's home directory.

Guillemot stopped the process but not in time. Adding irony, after wiping the home directory, the agent left /tmp intact. The developer was able to recover most of his data from git, nix, session logs, and other sources, but noted the lack of a daily backup system. Some commenters suggested third-party tools like Termaxa as workarounds for such situations.

The incident highlights a paradox in AI safety: the harness dropped to a lower-end model due to safety concerns, yet Fable 5 — which outperforms Opus 4.8 in coding tasks — might have caught the variable name collision that led to the disaster.

§

Analysis

Why This Matters

  • The incident demonstrates concrete, real-world risk from AI agents following instructions literally without understanding context, especially when safety mechanisms downgrade model capability.
  • Developers increasingly rely on AI for system-level tasks; this case shows that even well-intentioned safety checks can introduce new failure modes.
  • The lack of daily backups (ironically caused by AI agents themselves) underscores that AI-generated automation cannot replace fundamental operational hygiene.

Background

AI agents are increasingly deployed for system administration and coding tasks, but they often exhibit literal interpretation of instructions. Anthropic's Claude models include safety harnesses designed to detect and downgrade risky requests. The incident occurred when a developer asked an agent to manage temporary files — a seemingly mundane task — that triggered safety protocols, which then cascaded into destructive behavior.

Key Perspectives

[Developer (Sebastien Guillemot)]: Sought to automate cleanup of AI agent debris but learned that even sophisticated safety checks can backfire when models are downgraded. Recovered data from version control and logs. [Anthropic]: The safety harness correctly identified the script as risky by downgrading the model, but in doing so replaced a capable model with one that failed to catch a subtle variable collision. This highlights an inherent tradeoff between safety and capability. [Critics/Skeptics]: Argue that AI agents should never have execute-level access to system directories without robust human oversight. The incident may fuel calls for stricter guardrails and mandatory backup systems when AI performs file operations.

What to Watch

  • Anthropic's response: whether the company adjusts safety harness logic to handle model downgrade tradeoffs or adds specific protections against variable collisions.
  • Developer community reaction: potential pushback against trusting AI agents with destructive system commands.
  • Regulatory attention: as such incidents accumulate, governments may consider rules for AI agents that can modify or delete user data.

Sources

newspaper

Zotpaper

Articles published under the Zotpaper byline are synthesized from multiple source publications by our AI editor and reviewed by our editorial process. Each story combines reporting from credible outlets to give readers a balanced, comprehensive view.