CC Safety Net — Safety Net for AI Coding Agents
Intercept and block destructive git and filesystem commands, and secret file access, before AI coding agents execute them.
- Source repo
- kenryu42/cc-safety-net
- Stars
- ★ 2.1k
- Last updated
- 1d ago
- License
- MIT
- Primary language
- TypeScript
- FA score
- 73/100 · Some gaps
At a glance
- How it runs
- Works with
- Platform-specificCodex · Claude Code
- Cost
- Free, no paid service needed
- Setup effort
- Low · running in minutes
- You'll need
- Typical use
- A developer using Claude Code on their own machine wants to prevent the agent from accidentally running
rm -rf ~/orgit checkout --, which could wipe hours of uncommitted work. - Not a fit if
- Teams whose coding agents lack PreToolUse hook support
- Those wanting sandboxing or filesystem permissions instead of command blocking
- Environments that cannot use npx or npm to install
- Website
- ccsafetynet.com ↗ set on GitHub
- Maintenance
- Commits in the last 30 dayslast commit 2026-11-16latest release v2.7.14 (2026-11-16)+11.1 ★/day over 7 days
- Source review
- 73/100 · Some gaps
What does this agent do, and when should you use it?
CC Safety Net is a PreToolUse hook that stops AI coding agents from running dangerous commands like rm -rf, git reset --hard, or git push --force. It parses command semantics rather than matching strings, so flag reordering, shell wrappers, or interpreter one-liners can't bypass it. It supports Claude Code, Codex, Gemini CLI, GitHub Copilot CLI, Kimi Code, OpenCode, and Pi, across Windows, macOS, and Linux. It opens fail-closed by default, blocking commands even on malformed input or invalid config. It offers audit logging, custom rules via rulebooks, and opt-in modes like Strict and Paranoid. Installation varies by agent, including plugin marketplaces or npx, and diagnostics are available via npx cc-safety-net doctor.
Operates as a pre-tool-use hook that intercepts Bash calls. It analyzes command semantics: distinguishing git checkout -b feature (safe) from git checkout -- file (destructive). It recursively analyzes shell wrappers like bash -c and sh -c up to 10 levels, and detects destructive code in interpreter one-liners (python -c, node -e, etc.). It blocks commands by default and logs to ~/.cc-safety-net/logs/<session_id>.jsonl. It supports modes via environment variables like CC_SAFETY_NET_STRICT=1, CC_SAFETY_NET_PARANOID=1, and CC_SAFETY_NET_WORKTREE=1. It provides CLI commands npx cc-safety-net doctor and npx cc-safety-net explain.
- A developer using Claude Code on their own machine wants to prevent the agent from accidentally running
rm -rf ~/orgit checkout --, which could wipe hours of uncommitted work. - A team using Codex wants to enforce safety policies so that destructive commands are blocked even if the agent tries to bypass simple command blocking with wrappers or flag reordering.
- A developer using Kimi Code or OpenCode wants consistent protection across multiple CLI agents with a single tool.
- A developer using AI coding agents on Windows needs path comparison and command resolution to correctly handle
\andcmd.exe. - A developer who wants extra safety by enabling Strict mode to block unparseable commands and Paranoid mode to block more aggressively, even while actively using the agent.
Key setup facts
Pulled from the install and usage notes below. The project README has the current values.
- Install / run
npx -y cc-safety-net hook install --kimi-codenpx skill add kenryu42/cc-safety-netnpx cc-safety-net doctornpx cc-safety-net explain "git reset --hard"
- Config files
~/.codex/config.toml- Runtime
- Node.js 18
How do you install or deploy this agent?
Requires Node.js 18 or higher. Installation differs per agent:
- Codex: Enable plugin hooks in ~/.codex/config.toml ([features] plugin_hooks = true), then codex plugin marketplace add kenryu42/cc-marketplace, then install via TUI /plugins and trust via /hooks.
- Claude Code: /plugin marketplace add kenryu42/cc-marketplace, then /plugin install safety-net@cc-marketplace, then /reload-plugins.
- Gemini CLI: gemini extensions install https://github.com/kenryu42/gemini-safety-net.
- GitHub Copilot CLI: /plugin install kenryu42/copilot-safety-net.
- Kimi Code: npx -y cc-safety-net hook install --kimi-code, optionally npx skill add kenryu42/cc-safety-net.
- OpenCode: opencode plugin -g cc-safety-net.
- Pi: pi install npm:cc-safety-net.
How do you use this agent?
After installation, the hook automatically intercepts Bash calls. Use your AI agent normally; destructive commands will be blocked. Verify with npx cc-safety-net doctor and trace commands with npx cc-safety-net explain "git reset --hard". Optionally set environment variables like CC_SAFETY_NET_STRICT=1 for strict mode. If you have legacy custom rules, migrate them with npx -y cc-safety-net rule migrate.
What are this agent's strengths and limitations?
- Semantic analysis understands command intent, not just strings, distinguishing safe vs dangerous
git checkoutandrmusage. - Works across multiple agent CLIs (Claude Code, Codex, Gemini CLI, etc.) and platforms (Windows, macOS, Linux).
- Fail-closed default, Strict, Paranoid, and Worktree modes, custom rulebooks, and audit logging provide fine-grained control.
- Diagnostics via
npx cc-safety-net explainanddoctorhelp understand and verify security behavior.
- Only works as a PreToolUse hook, so it requires agents that support such hooks (not all AI tools).
- Installation is agent-specific and can be complex (e.g., Codex requires TUI steps, OpenCode has cache issues).
- Requires Node.js 18+ and introduces an additional runtime dependency.
- Legacy custom rules are not auto-migrated; manual migration needed, otherwise commands stay blocked (fail-closed).
- Relies on network to fetch rulebooks if referenced from GitHub; each agent requires separate installation.
How does this agent compare with similar options?
Compared to sandboxing, sandboxes allow destructive commands within the project directory, while CC Safety Net actively blocks them; they can be used together for defense-in-depth.
Key facts side by side with the most closely related agents.
| Agent | Source review | Form / cost | Stars | Updated | Language | Full support on |
|---|---|---|---|---|---|---|
| CC Safety Net — Safety Net for AI Coding Agents This agent | 73 · Some gaps | CLIFree | ★ 2.1k | 1d ago | TypeScript | Codex · Claude Code |
| RTK Command Output Optimizer | 72 · Some gaps | CLIFree | ★ 87k | 1d ago | Rust | Codex · Claude Code |
| Destructive Command Guard (dcg) | 66 · Some gaps | CLIFree | ★ 6.4k | 3d ago | Rust | Codex · Claude Code |
| Plannotator | 80 · Good | CLIFreemium | ★ 12k | today | TypeScript | Codex · Claude Code |
How does FollowAgents rate this agent?
Why each dimension lost points
least_privilege=2: The hook focuses on pre-execution analysis and applies conservative inspection to unknown tools; deducted because declared command tools may use any existing directory as their working directory. user_confirmation=1: Discovery commands are explicitly described as read-only and other commands as mutating configuration or integrations, but the supplied material does not show a concrete confirmation mechanism. data_flow_transparency=2: Security documentation says runtime policy evaluation makes no network requests, writes, or cache, and describes audit and false-positive report fields; deducted because reports replace only project and home paths, while other host information may remain visible. sensitive_data_handling=2: The files describe secret-path blocking and best-effort credential redaction; deducted because they acknowledge unknown credential forms may remain unredacted and some primary CLI credentials reside in OS keyrings that path rules cannot protect. dependency_security=2: A zero-runtime-dependency posture and CI dependency audit are documented; deducted because the package still has dependencies and overrides, and this static packet cannot establish their vulnerability status. external_effects=2: The discovery workflow distinguishes read-only commands from mutating commands, and reports do not themselves issue network requests; deducted because install, update, and GUI integration actions can change machine configuration and per-action confirmation is not evidenced. rollback=1: An uninstall command and some configuration recovery guidance are provided; deducted because no general backup or rollback guarantee is shown. source_attribution=2: Plugin metadata, package metadata, and license identify J Liew; deducted because the publisher is not verified by the curated registry and identity remains unknown.
self_consistency=2: README, SECURITY.md, and limitations documentation consistently describe best-effort static protection and state that it is not a sandbox; deducted because broad blocking claims are mostly documentation assertions in this packet and are not individually substantiated for every supported integration. dependency_availability=2: README requires Node.js 22+, while package metadata specifies Bun for package management and lists build dependencies; deducted because dependency installation and package-manager availability remain prerequisites. failure_messages=2: Degraded configuration states, diagnostic surfaces, and denial reasons are described in detail; deducted because user-facing errors for unknown tools and integration-level failures are not fully represented in the sample.
audience_and_scenarios=3: The product targets multiple coding CLIs and platforms, with workflows for explaining blocks, false-positive triage, rule configuration, and diagnosis. capability_boundaries=3: It explicitly says it is not a sandbox and documents limits such as reconstructed interpreter paths, keyrings, and Windows variable paths. trigger_precision=2: CLI-specific adapters and exact tool-name declarations define the analysis scope; deducted because the installation support list does not fully match the supplied description, and this sample cannot verify every adapter's trigger conditions. environment_fit=3: Windows, macOS, and Linux are covered, with a Node version requirement, CLI integrations, and multiple safety levels.
information_architecture=3: README points to installation, configuration, reference, and guide documentation, while the repository sample includes security, recovery, and limitations documents. install_notes=2: Node requirements and install, diagnose, update, and uninstall commands are provided; deducted because per-CLI installation procedures mainly live in documentation outside this packet. naming_stability=3: Package name, plugin name, CLI command, and version fields are consistent. examples_and_faq=2: The skill includes concrete commands and workflows; deducted because a complete FAQ is not shown and the skill excerpt is incomplete. known_limitations=3: The limitations document specifies static-analysis blind spots, mode behavior, and a complete mitigation direction. license=3: LICENSE, README badge, and package metadata all identify MIT. versioning_changelog=2: Package and plugin both show 2.7.4 and README gives an update command; deducted because no changelog or migration notes are included in the packet. maintenance_responsibility=2: Security policy supports only the latest release and gives an issue channel, and metadata names a maintainer; deducted because maintainer identity is unverified and no maintenance or response commitment is shown.
output_usability=2: The CLI provides explain, doctor, logs, status, and a policy GUI, and denial messages include rule reasons; deducted because this packet does not fully show output formats or terminal readability. marginal_value=3: Blocking destructive commands and sensitive-path access before tool execution across several coding-agent integrations provides a clear incremental protection layer. cost_benefit=2: Standard, strict, and paranoid modes and adjustable rules are available, with no runtime dependency; deducted because installation and integration upkeep are required and static analysis cannot cover dynamic behavior.
claim_traceability=2: Security documentation maps many mechanisms to specific test paths, and other docs name rules and recovery states; deducted because this review has only static excerpts and cannot inspect those tests or the complete implementation. cross_source_corroboration=2: README, package metadata, security policy, and limitations documentation partly corroborate product scope, platforms, and version; deducted because these are mostly self-reports within one repository, with little independent corroboration. fact_inference_separation=3: This assessment follows direct file statements and treats unverified identity, unshown execution results, and static-analysis limits as unknown or limitations rather than inferring successful operation.
- This is a low-confidence static source review; the program was not run and tests were not independently verified.
- The product explicitly is not a sandbox; reconstructed interpreter paths, some OS keyring credentials, and certain Windows path forms are outside complete protection.
- Publisher identity is not verified by the curated enterprise registry and should be treated as unknown.
Recent releases
Latest entries from the project's GitHub Releases. Notes are quoted from upstream as written, not rewritten or tested by FollowAgents.
-
Release notes excerpt
Closes a gap in paranoid rm protection where a recursive removal piped through xargs was allowed. Behavior at the standard and strict safety levels is unchanged. Fixed - Fixed a gap where find . -name node_modules | xargs rm -r was allowed even with paranoid rm enabled. With the rm.recursive-force-paranoid rule on, a recursive rm fed by xargs input is now blocked as xargs.rm-recursive-force-dynamic, with or without -f. Standard and strict still allow this pipeline, because there it is routine cleanup and blocking it would add a false positive. (#364)View on GitHub ↗ -
Release notes excerpt
This release extends protection to local PowerShell scripts, docker compose config, and heredoc text, and fixes Windows execution of launcher paths that contain a space. Highlights - Local PowerShell .ps1 and .psm1 scripts are now read and analyzed before they run (#359). - docker compose config now counts as a read of the project .env (#363). - Windows .cmd launchers whose path contains a space now run correctly (#357). Added …View on GitHub ↗ -
Release notes excerpt
Closes a PowerShell gap where recursive Remove-Item deletions of directories outside the working directory were allowed whenever -Force was absent. Fixed - Fixed PowerShell recursive deletes being judged only when -Recurse and -Force appeared together, which allowed Remove-Item -Recurse <dir-outside-cwd> on the standard, strict, and paranoid levels. -Recurse alone already removes a non-empty directory without a prompt, so the checks now key on -Recurse by itself, the same way rm -r does. (#348) …View on GitHub ↗
FAQ
Does it cost money?
How can I allow a destructive command?
What commands are blocked?
rm -rf, git reset --hard, git push --force, git stash clear, git clean -f, find -delete, dd, mkfs, shred, etc., even if wrapped in shell wrappers or interpreter one-liners.Does it work with other agents?
Is CC Safety Net — Safety Net for AI Coding Agents open source?
Is CC Safety Net — Safety Net for AI Coding Agents safe to use?
Is CC Safety Net — Safety Net for AI Coding Agents still maintained?
Who makes CC Safety Net — Safety Net for AI Coding Agents?
What is CC Safety Net — Safety Net for AI Coding Agents's official website?
Thanks — we use this to improve the page.