Skip to main content
AI coding agents are powerful — but they can make catastrophic mistakes. A misunderstood instruction, an over-eager cleanup step, or a poorly scoped refactor can result in commands like rm -rf ~/, git reset --hard, or git checkout -- . wiping out work you can’t get back. Soft rules written in CLAUDE.md or AGENTS.md help set expectations, but they rely on the model following instructions — and models don’t always follow instructions. CC Safety Net is a hard technical constraint: a PreToolUse hook that intercepts every shell command your AI agent attempts to run and blocks destructive operations before they execute, using semantic command analysis rather than fragile pattern matching. It works across Claude Code, OpenCode, Gemini CLI, Copilot CLI, and Codex, so your code, history, and filesystem stay intact no matter which agent you’re working with.

Introduction

Learn what CC Safety Net protects against

Installation

Install for Claude Code, OpenCode, Gemini CLI, and more

Configuration

Customize protection with modes and custom rules

CLI Reference

Diagnose issues and trace command analysis

Get Started in Three Steps

1

Install for your agent

Add CC Safety Net to your agent via the plugin marketplace. For Claude Code, run the following commands inside a Claude Code session:
/plugin marketplace add kenryu42/cc-marketplace
/plugin install safety-net@cc-marketplace
Installation instructions for OpenCode, Gemini CLI, Copilot CLI, and Codex are covered in the Installation guide.
2

(Optional) Add a status line to your settings

To surface real-time protection status in your Claude Code UI, add the following to ~/.claude/settings.json:
{
  "statusLine": {
    "type": "command",
    "command": "npx -y cc-safety-net statusline --claude-code"
  }
}
This step is optional — CC Safety Net protects you whether or not the status line is enabled. See the status line guide for additional setup options including Bun and piping with an existing status line.
3

Verify your installation

Confirm that CC Safety Net is active and correctly configured by running the built-in health check:
npx cc-safety-net doctor
The doctor command checks that the hook is registered, reports which protection mode is active, and flags any configuration issues it finds.
CC Safety Net works out of the box with no configuration required. Advanced modes and custom rules are available when you need them.