Skip to content
$ shellfirm

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.

Output
Usage: shellfirm [OPTIONS] [COMMAND]

Commands

CommandWhat it does
initSet up shell integration (install the shell hook)
statusShow the installation status and a configuration overview
doctorCheck that the current shell really routes commands through shellfirm
checkTest commands against shellfirm checks, or list the checks
pre-commandCheck one command and challenge it (used by the shell hooks)
configManage shellfirm configuration
policyManage project-level .shellfirm.yaml policies
auditView and manage the audit trail
connectConnect AI agents (blocking hooks, MCP server)
sandboxTurn on an AI agent's OS sandbox and deny it your credential files
mcpStart the MCP (Model Context Protocol) server for AI agents
wrapWrap an interactive program (psql, mysql, redis-cli, ...) with PTY protection
completionsGenerate shell completion scripts
helpPrint the help of shellfirm or of a subcommand

Options

OptionDescription
-h, --helpPrint help
-V, --versionPrint 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:

Output
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)
VariableEffect
SHELLFIRM_CONFIG_DIR=DIRUse DIR for settings, custom checks and the audit log, for every command. --config-dir wins over it.
SHELLFIRM_NO_CONTEXT=1Run 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=LEVELLog level. --log wins over it.
SHELLFIRM_ORG_POLICY=/abs/path.yamlAdds one more org policy file. It can only add rules. See Org policy.
NO_COLOR=1No 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

PlatformSettings 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):

Output
shellfirm: error: --config-dir /nope: no such directory

The 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.