# I ran 107 commands from real Claude Code incident reports through my pre-run check. Here is where it stays silent.

> Source: <https://dev.to/boxdawn/i-ran-107-commands-from-real-claude-code-incident-reports-through-my-pre-run-check-here-is-where-10ll>
> Published: 2026-11-20 11:10:54+00:00

**Recommendation:** Pair command-line guards with deny rules and sandboxing that cover script paths, database tools and Docker cleanup, since a pre-run check that only reads the command line misses damage executed inside scripts.
More in the playbook "Securing agents and AI tools": <https://wpnews.pro/playbooks/agent-security>

AI coding agents run shell commands on your machine. Most of the time that is fine. Sometimes it is `rm -rf` in the wrong folder, a dropped production table, or a `git reset --hard` over a day of uncommitted work. Public Claude Code issue reports have plenty of these.

I build guard, a pre-run check for Claude Code and GitHub Copilot CLI. This post is about what it does with the commands from those reports, and mostly about the ones it gives no decision on.

guard reads each shell command before it runs and gives one of three answers.

`rm -rf ~` reaches outside the project, so it does not run.`git reset --hard` discards uncommitted work, so you are asked first, with that reason attached. Reading a secret file like `.env` through a shell command is asked too.`npm test` gets nothing. guard says nothing, and your agent's own permission settings decide what happens next.
It never answers "allow": it only ever adds a deny or a question. Your permission settings still decide everything else, so they still matter after you install it.

I collected commands quoted in public anthropics/claude-code issue reports about destructive commands: 107 commands from 83 reports. On guard 0.4.11:

| Decision | Count | 
|---|---|
| Deny | 24 | 
| Ask | 52 | 
| No decision | 31 | 

Before you read anything into that: this is the list I wrote guard's rules against. It describes this list. It is not a catch rate for incidents guard has never seen, and I don't have that number yet.

How it was run: the commands were judged, not run, in one made-up project folder. Where a report didn't say which shell, I tried Bash and PowerShell and counted the stronger result. Some entries are fragments or contain placeholders like `<repo>`, entered as the reporter wrote them, so a few would be judged differently written out in full.

"No decision" does not mean nobody was asked. Claude Code's own permission check may still have stepped in. It means guard had nothing to say. Here are the groups I have written up so far.

Six lines came from five reports. Three are bare SQL (`DROP DATABASE`, `DROP SCHEMA CASCADE`, `DROP TABLE poc_staging`), two are subcommands with the program name missing (` migrate:fresh`, `doctrine:fixtures:load --no-interaction`), and one is `prisma db push`.

The reports show the SQL but not what sent it. guard reads shell command lines, and a bare `DROP TABLE` is not one. When I wrap the same SQL in `psql -c` myself, it is denied, but I built that form; if the SQL went through a database tool or an MCP server, guard never sees the call. Written in full, the two fragments are asked. `prisma db push` is an everyday schema command with no rule; in that report the data went when Prisma offered a reset and the session accepted it.

Four lines from three reports share one shape. The agent ran a script, and the line that did the damage was inside it.

`timeout 60 node postmessage-bench.mjs`: the script called `process.kill(-1, SIGKILL)` and killed every process the user owned.`bash /tmp/.../test-lib-demo.sh`: inside it, `trap 'rm -rf "$_HT_HOME"' EXIT`, and `_HT_HOME` had become `$HOME`.`& "...\junction-test.ps1"`: a failed `Push-Location` inside the script left `git clean -xdff` running at the workspace root.
guard reads the command line. It does not open the script file, and in all three the command line only said "run this script". The reporter of the third one had a deny rule for `git clean -f*` and their own pre-tool hook. Neither matched, because the tool call was a script path. I don't have a good answer here. Asking on every script run means asking all day, and reading the file means trusting something that can change between the check and the run.

Two lines are Docker cleanup. `docker network prune -f` removed unused networks across the whole daemon, including other projects' networks on the same machine; in that report the user ran it after the agent called it optional and safe. `docker stop n8n && docker rm n8n` removed a container with no volume mount, and the workflows, credentials and history inside it were gone.

On 0.4.11, `docker volume rm` is asked, and `docker system`, `volume` and `image prune` are asked. `docker network`, `container` and `builder prune`, and `docker rm` of a container, get no decision. So "guard asks about docker prune" would be too broad.

guard looks at where a delete lands more than what it deletes. Inside the project folder, `rm -rf build` and `rm -rf src` both get no decision, and your permission settings decide. Outside it, `rm -rf ../other-project` and `rm -rf ~` are denied. My reasoning was that asking on every delete inside the project would train you to click yes on `node_modules` and `build` until the question means nothing. The cost is that `src` is in the same bucket, and I haven't solved that.

If an agent has deleted something of yours, I'd like to know the command and how it got sent. The reports often leave out the part that matters: was it a shell line, a script, a database tool? And if you use guard, tell me which "no decision" you would want turned into a question.

guard is free and source-available (FSL-1.1-ALv2). Claude Code on Windows, macOS and Linux. GitHub Copilot CLI is tested on Windows only so far.

Repo: [https://github.com/boxdawn/guard](https://github.com/boxdawn/guard)

*I wrote this with help from an AI assistant, which I also used to draft and check the numbers against guard's code. The measurements were run with it under my direction, and the decisions in this post are mine.*
