---
title: "Coding Agent Horror Stories: The rm -rf ~/ Incident"
description: "An AI coding agent asked to clean up an old repo ran `rm -rf tests/ patches/ plan/ ~/`, and the trailing `~/` expanded to the user's home directory and wiped an entire Mac, including the Keychain, SSH keys and years of files, with TRIM-enabled SSDs ruling out recovery."
url: "https://swe.quest/articles/coding-agent-horror-stories-the-rm-rf-incident-68288dbcab0abba2"
canonical: "https://www.docker.com/blog/coding-agent-horror-stories-the-rm-rf-incident/"
source: "Docker"
published: "2026-06-01"
difficulty: "medium"
kind: "Incident"
reading_minutes: 16
tags: ["ai-agents","sandboxing","ai-coding","virtualization","security"]
---

# Coding Agent Horror Stories: The rm -rf ~/ Incident

A post on [Docker](https://swe.quest/sources/docker.md), published 2026-06-01, 16 min read, Incident. Original: [https://www.docker.com/blog/coding-agent-horror-stories-the-rm-rf-incident/](https://www.docker.com/blog/coding-agent-horror-stories-the-rm-rf-incident/)

## Summary

An AI coding agent asked to clean up an old repo ran \`rm -rf tests/ patches/ plan/ ~/\`, and the trailing \`~/\` expanded to the user's home directory and wiped an entire Mac, including the Keychain, SSH keys and years of files, with TRIM-enabled SSDs ruling out recovery. The same pattern appears in Claude Code GitHub issues #10077 and #12637 and in a Claude Cowork incident that deleted 15 years of family photos. The root cause is architectural: the agent runs as the user with inherited shell permissions, and nothing sits between the model's command and its execution. Docker argues that running agents in Docker Sandboxes (microVMs managed via the \`sbx\` CLI) contains this failure class through workspace-scoped mounts, default-blocked credential paths and read-only mounts.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [AI agents](https://swe.quest/tags/ai-agents.md) (AI & ML)
- [Sandboxing & isolation](https://swe.quest/tags/sandboxing.md) (Security)
- [AI for coding](https://swe.quest/tags/ai-coding.md) (AI & ML)
- [Virtualization](https://swe.quest/tags/virtualization.md) (Infrastructure)
- [Security](https://swe.quest/tags/security.md) (Security)

## Prerequisites

- Unix shell basics
- rm and tilde expansion
- AI coding agents ([easy posts on AI for coding](https://swe.quest/tags/ai-coding.md?difficulty=easy))

## Keywords

Claude Code, Docker Sandboxes, sbx, --dangerously-skip-permissions, Claude Cowork, microVM

## Related posts

- [Coding Agent Horror Stories: The Security Crisis Threatening Developer Infrastructure](https://swe.quest/articles/coding-agent-horror-stories-the-security-crisis-threatening-developer-feea8c1a7c9350ee.md): Docker · 2026-05-18 · Easy · 26 min read · AI agents, AI for coding, Sandboxing & isolation, Supply chain security, Identity & auth
  AI coding agents run with the full identity of the user who launched them, so they inherit filesystem access, cloud credentials, and secrets with no approval step between a model's decision and its execution.
- [Prove your AI agent guardrails work](https://swe.quest/articles/prove-your-ai-agent-guardrails-work-2a4587e8e9b27383.md): Docker · 2026-11-25 · Medium · 16 min read · Sandboxing & isolation, AI agents, Security, Identity & auth, AI for coding
  Coding agents with broad access can leak credentials or delete files, as two reported July 2026 incidents show: Grok Build CLI silently uploaded whole repositories, including ignored files and planted secrets, to cloud storage, and a Full Access agent deleted a user's home directory after alternatives to blocked rm succeeded.
- [Coding Agent Horror Stories: The 29 Million Secret Problem](https://swe.quest/articles/coding-agent-horror-stories-the-29-million-secret-problem-7f5056c95d2769e4.md): Docker · 2026-07-28 · Medium · 12 min read · Supply chain security, AI for coding, Sandboxing & isolation, JavaScript, AI agents
  The s1ngularity supply-chain attack on the Nx npm package used a post-install script to find installed AI coding CLIs (Claude Code, Gemini CLI, Amazon Q) and invoke them with permission-bypass flags like --dangerously-skip-permissions, prompting the agent to inventory secrets across the home directory before exfiltrating them to public repos under the victim's GitHub account.
- [Coding Agent Horror Stories: The CVE That Did Not Exist](https://swe.quest/articles/coding-agent-horror-stories-the-cve-that-did-not-exist-6a97fa18ca5ac54f.md): Docker · 2026-10-29 · Medium · 15 min read · AI agents, Sandboxing & isolation, AI for coding, Code review, CI/CD
  A self-hosted, read-only AI code review bot running on Ollama answered a routine PostgreSQL 16.11→16.13 patch bump with a 1,500-word report alleging an "architectural takeover".
- [Coding Agent Horror Stories: The Command You Already Approved](https://swe.quest/articles/coding-agent-horror-stories-the-command-you-already-approved-c2fceff8d5f4f4cc.md): Docker · 2026-08-18 · Medium · 14 min read · AI agents, Sandboxing & isolation, Application security, AI for coding, Virtualization
  CVE-2026-22708 in Cursor let shell built-ins like \`export\`, \`typeset\` and \`declare\` run outside the Auto-Run allowlist, so injected text could silently set variables such as \`PAGER\`, \`PYTHONWARNINGS\` or \`PERL5OPT\` and turn an approved command like \`git branch\` into arbitrary code execution, even with an empty allowlist.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
