explain shows, step by step, how CC Safety Net analyzes a command. Use it to learn why a command is blocked or allowed, or how a custom rule applies.
explain options
--json schema, the ExplainResult fields, and every TraceStep variant.
Read the command as the shell your tool runs
explain defaults to the auto shell mode, which reads a command as PowerShell when it looks like PowerShell. Your agent’s tool may run a different shell. Claude Code’s Bash tool runs POSIX, so auto can report a verdict the hook never gave:
In bash,
rmdir removes only empty directories, so the hook allows that call from the Bash tool. --shell posix reproduces the allow. The flag changes both how explain parses the command and which shell’s rules apply to it, so pass the dialect of the tool whose decision you want to reproduce.
With --shell powershell, a command given as separate arguments is rejoined with PowerShell quoting, so an apostrophe in it is doubled instead of escaped the POSIX way. Every other dialect keeps POSIX escaping.
The parse step shows the words of the dialect used for the analysis. Under auto it shows the POSIX words even when the PowerShell reading made the decision, so a Windows path appears there without its backslashes.
A value other than auto, posix, or powershell exits 1 with the error and the usage line:
Explain a command that starts with a dash
-- ends option parsing, and everything after it is the command. So explain -- --help explains the literal command --help instead of printing help. Quote the command as one argument to keep shell operators such as | and && in it.
explain exit code
explain exits 0 for both blocked and allowed results, so read the result field instead of the exit code. It exits 1 on an option error, such as an unknown option, a --cwd path that does not exist, or an unknown --shell value, and on a command it refuses to analyze.
Commands explain refuses to analyze
explain refuses a command that exceeds CC Safety Net’s analysis limits, or whose syntax the parser rejects, such as echo ${. It exits 1 with a one-line error. With --json, stdout holds only an error object: