CLI Reference
Every shellfirm subcommand, global option and environment variable, matching `shellfirm --help`.
This section has one page per subcommand, and each page matches that command's
--help output. You can print the same output yourself with
shellfirm <command> --help.
Usage: shellfirm [OPTIONS] [COMMAND]Commands
| Command | What it does |
|---|---|
init | Set up shell integration (install the shell hook) |
status | Show the installation status and a configuration overview |
doctor | Check that the current shell really routes commands through shellfirm |
check | Test commands against shellfirm checks, or list the checks |
pre-command | Check one command and challenge it (used by the shell hooks) |
config | Manage shellfirm configuration |
policy | Manage project-level .shellfirm.yaml policies |
audit | View and manage the audit trail |
connect | Connect AI agents (blocking hooks, MCP server) |
sandbox | Turn on an AI agent's OS sandbox and deny it your credential files |
mcp | Start the MCP (Model Context Protocol) server for AI agents |
wrap | Wrap an interactive program (psql, mysql, redis-cli, ...) with PTY protection |
completions | Generate shell completion scripts |
help | Print the help of shellfirm or of a subcommand |
Options
| Option | Description |
|---|---|
-h, --help | Print help |
-V, --version | Print version |
--log <LEVEL> | Global option. Set the log level. Logs go to stderr. Overrides SHELLFIRM_LOG. Values: off, trace, debug, info, warn, error |
RUST_LOG is not used. To see why shellfirm made a decision, add --log debug:
shellfirm --log debug check -c 'git push -f origin main'Environment variables
This block is printed at the end of shellfirm --help:
Environment:
SHELLFIRM_CONFIG_DIR=DIR configuration directory for every command (settings,
custom checks, audit log); DIR must exist (exit 2 otherwise). --config-dir
wins; shell hooks, agent hooks and `shellfirm mcp` fall back to the default location
SHELLFIRM_NO_CONTEXT=1 run no external programs (git, kubectl, du, ...)
SHELLFIRM_LOG=LEVEL log level (off|error|warn|info|debug|trace); --log wins
NO_COLOR=1 no colour (TERM=dumb / monochrome terminals: none either)| Variable | Effect |
|---|---|
SHELLFIRM_CONFIG_DIR=DIR | Use DIR for settings, custom checks and the audit log, for every command. --config-dir wins over it. |
SHELLFIRM_NO_CONTEXT=1 | Run no external programs (git, kubectl, du, find, docker). Context that can be read from files still counts: root, environment variables, .git/HEAD and the kubeconfig. Same as --no-context. |
SHELLFIRM_LOG=LEVEL | Log level. --log wins over it. |
SHELLFIRM_ORG_POLICY=/abs/path.yaml | Adds one more org policy file. It can only add rules. See Org policy. |
NO_COLOR=1 | No colour (any non-empty value). CLICOLOR=0 and monochrome terminals (TERM=dumb, vt100, xterm-mono) also turn colour off. CLICOLOR_FORCE=1 forces it on. |
Do not export SHELLFIRM_SIGNAL_PROMPTED in your shell profile or
environment. The shell hooks set it for each call. See
pre-command.
The configuration directory
| Platform | Settings file |
|---|---|
| Linux | ~/.config/shellfirm/settings.yaml (or $XDG_CONFIG_HOME/shellfirm/settings.yaml) |
| macOS | ~/Library/Application Support/shellfirm/settings.yaml |
| Windows | %APPDATA%\shellfirm\settings.yaml |
The same directory holds checks/ (your custom checks) and audit.log.
shellfirm status prints the exact paths.
--config-dir DIR points one command at another directory. It is accepted by
check, status, config, audit and mcp. shellfirm uses the first of:
--config-dir, then SHELLFIRM_CONFIG_DIR, then the default location.
The directory must exist. A missing one is a usage error (exit 2):
shellfirm: error: --config-dir /nope: no such directoryThe shell hooks, the agent hooks and shellfirm mcp never stop on a stale
directory. They print a warning and use the default location, so a mistyped
variable never locks your terminal or your agent.
Exit codes
Each page lists its command's exit codes. The full list is on Exit codes.