█

AI/TLDR

Buy me a coffee
Buy me a coffee

CC Safety Net

A pre-execution guard that stops coding agents from running destructive commands or reading secrets

Guardrails & SecurityOpen source
Latest
v2.4.12
Updated
29 Sep 2026
Language
TypeScript
License
MIT
$npx -y cc-safety-net@latest install

What's new

v2.4.1229 Sep 2026

v2.4.12 made a refused working directory explain which directory and why instead of a generic failed-closed message, and removed false denials for agents working in a scratch directory under the temp root.

IN SHORT

What is CC Safety Net?

CC Safety Net (Coding CLI Safety Net) sits between an AI coding agent and the shell. It sits in the Guardrails & Security category of the Evaluation & Production Ops tools and is open-source, written in TypeScript and licensed MIT. To get started: install into your coding CLIs.

Updated Markdown version ↗

Overview

CC Safety Net (Coding CLI Safety Net) sits between an AI coding agent and the shell. Before a tool call runs, it analyses what the command actually does and denies it if it would destroy work — `git reset --hard`, `git push --force`, `rm -rf` on dangerous targets, `find -delete`, PowerShell `Remove-Item` — or touch secrets such as SSH keys, `.env` files, `~/.aws` and the credential files coding CLIs keep. Because it parses the command rather than matching strings, wrapping it in `bash -c` or `python -c` or reordering flags does not hide it, and a broken config file never blocks anything.

It installs as a hook into Amp Code, Antigravity CLI, Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot CLI, Grok Build, Hermes Agent, Kimi Code, OpenClaw, OpenCode and Pi, on Windows, macOS and Linux (the project notes that Windows support for some CLIs is best effort and untested). Three safety presets set the strictness: Standard for normal coding, Strict to also block dynamic or unparseable commands the analyser cannot verify, and Paranoid to additionally block `rm -rf` inside the project and interpreter one-liners.

Policy is editable in a local web GUI, extendable with rulebooks (official packs for Terraform, AWS, gcloud and Azure, or your own JSON) that can only add blocks, and shareable with a team by committing a `.cc-safety-net/` folder. The project is explicit about its scope: it denies a tool call before it runs, but it does not set filesystem permissions, watch network egress or contain a process — its docs point to OS permissions or a sandbox for that. It is written in TypeScript and released under the MIT license.

What it does

  • Semantic command analysis that blocks destructive Git and filesystem operations even when nested inside `bash -c` or `python -c`
A Claude Code terminal where a Bash call to git reset --hard is rejected with 'Error: BLOCKED by Safety Net', a reason suggesting git stash first, and the agent asking the user for explicit confirmation
What the agent sees when it tries `git reset --hard`: the call is denied with a reason, and the agent has to ask you instead.CC Safety Net repository ↗
  • Secret protection for SSH keys, `.env` files, `~/.aws` and CLI credential files, across the shell and the agent's read, edit, write and search tools
  • Standard, Strict and Paranoid presets plus per-rule toggles and allow/deny paths in a local web GUI
  • Add-only rulebooks, including official Terraform, AWS, gcloud and Azure packs
  • Diagnostics — `status`, `doctor`, `explain` traces and a local audit log of command decisions
  • A Node.js library API (`checkCommand`) to get an allow/deny decision from your own code without the hook

Getting started

CC Safety Net needs Node.js 18 or higher. One command installs it into the coding CLIs found on the machine; the diagnostics commands then confirm what is being enforced.

Install into your coding CLIs

Keep the `@latest` qualifier — a bare `cc-safety-net` spec can run an older copy from the npx cache. `npm install -g cc-safety-net` also installs the `ccsn` alias.

bashbash
npx -y cc-safety-net@latest install

Verify the installation

`status` summarises what is enforced, `doctor` runs a self-test, and `explain` traces how a command is analysed step by step. `doctor`, `explain` and `logs` accept `--json`.

bashbash
npx cc-safety-net status
npx cc-safety-net doctor
npx cc-safety-net explain "git reset --hard"

Review blocks and tune the policy

`logs` browses recorded denials from the local audit trail (add `--all` to include allowed commands). The GUI's Policy page sets the preset and toggles individual rules; the rules that catch wiping `/` or `~` cannot be turned off.

bashbash
npx cc-safety-net logs
npx cc-safety-net gui
The CC Safety Net web GUI overview page showing the hook active in Amp Code, Cursor and OpenCode, seven-day charts of blocked and analyzed commands, and a protection status panel with the Standard preset and secret protection on
The local GUI opened by `npx cc-safety-net gui`, with Activity, Policy, Rules and Integrations pages in the sidebar.CC Safety Net repository ↗

Add rulebooks and keep it updated

Rulebooks can only add blocks, never remove built-in protection. `update` upgrades every installed integration.

bashbash
npx -y cc-safety-net rule add --only terraform aws --global
npx -y cc-safety-net@latest update

Commands and code are distilled from the project's own documentation — always check the official repo for the latest.

When to use it

  • Let a coding agent run with fewer permission prompts while still preventing it from wiping uncommitted work or force-pushing
  • Keep SSH keys, `.env` files and cloud credentials out of an agent's reach across its shell and file tools
  • Share one safety policy across a team and cloud sessions by committing `.cc-safety-net/` to the repository
  • Gate commands in your own agent harness with the `checkCommand` library API

How CC Safety Net compares

CC Safety Net alongside other open-source guardrails & security tools AI/TLDR tracks, ranked by GitHub stars.

ToolStarsWhat it does
SkillSpector★ 28.3kSecurity scanner for AI agent skills that checks a skill for prompt injection, data exfiltration, privilege escalation and supply-chain risks before you install it.
Presidio★ 12.1kAn open-source framework for detecting, redacting, masking, and anonymizing personal data (PII) across text, images, and structured data using NER models, regex, and rule-based recognizers.
Failproof AI★ 10.5kA hook-based CLI and Rust daemon that listens to every event from 12 agent harnesses such as Claude Code, Codex and Cursor, and blocks, warns or steers the agent with one policy API, with optional cloud tracing and failure audits.
Guardrails AI★ 7.7kA Python framework that wraps LLM calls with composable input/output validators (from the Guardrails Hub) to check structure, type, and safety risks before responses reach users.
NeMo Guardrails★ 7.6kNVIDIA's toolkit for adding programmable rails to LLM chat apps, using the Colang language to control dialog flow and block jailbreaks, prompt injection, and off-topic answers.
BLA (Blind LLM Agents)★ 7.3kAn open-source CLI and MCP server that hardens the apps, WASM modules, databases and model files you ship so AI reverse-engineering agents such as REA hit resource budgets and follow decoys, without changing runtime behaviour.
dcg (Destructive Command Guard)★ 6.4kA Rust pre-tool hook for coding agents that inspects each shell or git command before it runs and blocks the destructive ones, with an explanation and a safer alternative.
CC Safety Net★ 2.1kA pre-execution guard that stops coding agents from running destructive commands or reading secrets