# CC Safety Net

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

- Category: Evaluation & Production Ops / Guardrails & Security
- Language: TypeScript
- Licence: MIT
- Repository: https://github.com/kenryu42/cc-safety-net
- Website: https://ccsafetynet.com
- Canonical page: https://ai-tldr.dev/tools/cc-safety-net/
- Updated: 2026-09-29

## In short

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.

## 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`
- 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.

1. 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.

```bash
npx -y cc-safety-net@latest install
```

2. 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`.

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

3. 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.

```bash
npx cc-safety-net logs
npx cc-safety-net gui
```

4. Add rulebooks and keep it updated

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

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

## 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

## Version history

- 2026-09-29 v2.4.12: 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.
