HookPartly tested (needs an account)
Block dangerous commands
cc-safety-net
A safety hook that checks every shell command your agent wants to run and blocks destructive ones, such as deleting your home folder or a hard git reset.
- Works with
- Claude Code, Codex CLI, Gemini CLI
- Good for
- Security testing, Everyone
What it does
The risk it reduces
An agent can run shell commands for you. Most are fine. A rare one can delete a folder or throw away your latest work. cc-safety-net sits in front of each command and says no to the dangerous ones.
How it works
Your agent calls the tool before it runs a command. The tool reads the command, applies its rules and returns "allow" or "block". You can preview any command with the explain option.
Who it helps
Everyone who lets an agent run commands, especially people who are new to the terminal.
Be careful
It is a second line of defence. It does not replace backups, git and careful approval. It also edits your agent's hook settings, so run the doctor command after install.
How to install
npx -y cc-safety-net@latest installnpx -y cc-safety-net@latest doctorHow to use it
Run the install command once, then restart your agent. After that the hook checks each shell command. To see how a command would be judged without running it, use npx -y cc-safety-net@latest explain "your command".
What to watch out for
- The install command changes your agent's hook settings. It runs a program on every shell command, so a bug in the tool could block normal work.
- It is a safety net, not a sandbox. It cannot stop every harmful action. Keep backups and use version control.
Licence and author
- Licence
- MIT
- Author
- kenryu42
- Source code
- github.com/kenryu42/cc-safety-net
How we tested it
We installed it on an empty test computer on 12 Oct 2026. Partly tested: installed in a clean test system, but its main features need an account or key we did not use.
We did not run it inside a live agent session, so we did not see a real block. Version tested: 2.6.9. We ran only the Claude Code integration.
Technical details of the test
- Date
- 12 Oct 2026
- Method
- In a clean container with no account we ran npx -y cc-safety-net@latest install --claude-code and then doctor. The install reported success and doctor reported no findings. The explain command blocked "rm -rf ~" and allowed "ls -la". We also installed the plugin version with the Claude Code command line, which worked.
Checked again on 12 Oct 2026
Sources
- github.com/kenryu42/cc-safety-net