Incident series
Stop Your Agent From…
Every post in this series starts from an incident that actually happened to someone — a wiped home directory, a dropped production database, secrets in a commit, an $18,000 surprise bill — and ends with the exact configuration that stops it. Three steps each, a few minutes of work, no smarter prompting required.
Wondering what your agent could do beyond these? The Tool Surface Index lists every tool Claude Code and Codex declare, grouped by blast radius.
Posts in this series
Each post covers one incident class: what happened, why it's one tool call away in your setup, and the three steps that close it.
-
1.
How to block rm -rf in Claude Code, Codex and CursorCursor and Claude Code agents have wiped directories mid-session. Prompting won't prevent it. A check that runs before every shell command will. Here is the setup, and what it does and doesn't catch.
-
2.
How to stop a coding agent from dropping your production databaseIf your agent can reach a destructive credential, it can use it. Here is how to hold destructive commands for approval, shut them off for unattended runs, and keep production tokens out of the agent's reach.
-
3.
Stop your AI agent from deleting files outside your projectAgents in Cursor and Copilot have been reported deleting folders outside the project they were working on. What ACP's safety floor holds or blocks when a delete leaves the project, what it does not cover, and the rules to add.
-
4.
How to stop Claude Code, Codex and Cursor from force-pushingClaude Code and Cline agents have force-pushed over their own remote work, reset uncommitted changes, and stripped files from every commit. The model can't see what you'd lose. Here is how to put a hold between the agent and git.
-
5.
AI coding agents leaking .env secrets: stop it in 3 stepsAI coding agents read .env by default and quote keys into commits, chats and tool output. Block the read in unattended runs, mask key patterns in tool output, log every read.
-
6.
Stop your AI agent from leaking PII through tool callsYour agent runs SELECT email FROM users and gets back a list of customer emails. Now those emails sit in the model's context, your logs and any tool the agent calls next. Scan and redact tool output before the model reads it, on the harnesses that allow it.
-
7.
Stop your AI agent from burning through your API budgetCursor agents loop when context is summarized. Codex sub-agents have run $350 over plan in a week. A forgotten key produced an $18,000 bill. Here is how to set a spend cap and per-tier rate limits on your coding agents.
-
10.
Stop an AI agent from escalating IAM permissions on AWS, GCP and AzureIf your coding agent can run aws iam, gcloud add-iam-policy-binding or az role assignment, it can grant itself anything the credential allows. Here is how to put a check in front of those commands, and why the cloud credential itself is the real boundary.
-
12.
Make Your AI Coding Agent Ask Before It Runs Commands Over sshGive a coding agent an ssh key to your homelab or a jump host and the harness can't see what runs on the other side. Here is how to hold those calls for your approval, however the agent spells the command.
All eleven fixes ride the same install — see getting started, or the one-command setup for coding agents specifically.