Skip to main content
CC Safety Net provides CLI commands for diagnostics, command analysis, status line output, hook installation, and rulebook management. Run them with npx cc-safety-net or bunx cc-safety-net. CC Safety Net is invoked through your agent; there is no global install step. npx/bunx are only used to run the CLI subcommands documented here.

doctor

The doctor command runs a full health check of your CC Safety Net installation and prints a summary of what it finds.
Flags:

explain

The explain command traces how CC Safety Net analyzes a command step-by-step. Use it to debug why a command is blocked or allowed, or to understand how a custom rule applies.
Flags: Examples:
For the JSON schema returned by --json (the ExplainResult fields and every TraceStep variant), see the Explain trace reference.

statusline

The statusline command outputs CC Safety Net’s current status in a format suitable for Claude Code’s status line. It shows whether the Claude Code plugin is enabled and which modes are active. This command is Claude-Code-specific — it requires --claude-code.
See the Status Line configuration page for setup instructions and what each indicator means.

hook

The hook command has two roles: installing/uninstalling the hook for agents that need a config write, and running as the runtime PreToolUse hook invoked from an agent’s config.

hook install / hook uninstall

Write or remove CC Safety Net’s hook in an agent’s config file. Currently the only supported target is Kimi Code, whose config is the only one CC Safety Net writes directly. All other agents are installed through their own plugin or extension marketplaces — see Installation.
--kimi-code is the only install/uninstall target. This writes a [[hooks]] block to ~/.kimi-code/config.toml (or $KIMI_CODE_HOME/config.toml).

Runtime hook entrypoints

When CC Safety Net runs as an agent’s PreToolUse hook, the agent invokes cc-safety-net hook <flag>. These entrypoints read the agent’s hook input from stdin and emit the agent-specific deny format. You normally do not run these by hand — your agent’s plugin or config wires them up — but they are the actual command behind the protection. -cc, -cp, and -gc also work as legacy top-level flags (for example cc-safety-net --claude-code); -kc is only valid as hook --kimi-code. Codex, OpenCode, and Pi do not use this command — they load CC Safety Net as a plugin or in-process extension instead. See Integration Architecture for how each agent plugs in.

rule

The rule command manages rulebook-based custom rules. See Custom Rules for the full authoring guide. Shared flags (apply to most subcommands):

rule init

Create a starter project rule config and rulebook in the current directory:
Use --global to create the user-scope config at ~/.cc-safety-net/rules/rule.json instead:

rule add

Add a rulebook source and sync. <source> is a bare local name (for example project-rules) or a GitHub source in the form owner/repo#ref/<rulebook-name>:

rule remove

Remove a rulebook source and sync. Use --delete-source to also delete the local source directory:

rule update

Refresh the lock and cache for configured rulebook sources, or a single source if one is given. Use --check to verify without writing:

rule sync

Rebuild the lock and cache for all configured rulebook sources. Run after adding or changing entries in rule.json:
rule sync is equivalent to rule update with no source argument.

rule list

List the active rulebooks and their resolved sources across user and project scope:

rule test

Run every fixture defined in every active rulebook (or a single source) and confirm rules block and allow as expected:

rule verify

Validate the structure of all active rulebooks and rule definitions. Use this in CI or whenever you edit a rulebook by hand:
Returns exit code 0 if everything is valid, or non-zero if errors are found.

rule migrate

Convert legacy inline config files (.safety-net.json, ~/.cc-safety-net/config.json) into the new rulebook layout:
Use --cleanup to delete the legacy files after the migrated rules are verified:

rule doc

Print a machine-readable document describing the rulebook schema. Pipe the output to your agent to let it help author or validate rulebooks interactively:

Version and help flags

You can check the installed version or get usage information at any time. --version has a -V short alias, and --help has a -h short alias.
Use help <command> or <command> --help to see usage for a specific subcommand:
Last modified on June 22, 2026