Skip to content
$ shellfirm

shellfirm doctor

Check that your shell really routes commands through shellfirm, and find out why when it does not.

shellfirm doctor checks the shell integration end to end. It checks which shell you use, whether this session has loaded the hook, which shellfirm binary the hook runs, whether the rc file loads the hook (once), and whether Enter (and the other keys that run a command) go through shellfirm in a new interactive shell. It also looks for known plugin conflicts and checks that your configuration is valid, and reports the AI-agent hooks and sandboxes shellfirm installed.

Run it after installing, after upgrading, and whenever a risky command ran without a challenge.

Output
Usage: shellfirm doctor [OPTIONS]

Options

OptionDescription
--shell <shell>Shell to check. Default: the shell that started shellfirm, then $SHELL. Values: bash, zsh, fish, nushell (nu), powershell (pwsh), elvish, xonsh, oils (osh, ysh)
--stdinRead the probe output of the live shell from stdin instead of starting a new shell
--format <format>Output format: text (default) or json
-h, --helpPrint help

A healthy shell

Run in a zsh session that loaded the hook:

Output
shellfirm doctor — zsh (from parent process)

  [--] shell            zsh (detected from parent process)
  [ok] session          this zsh session has loaded the shellfirm hook
  [ok] binary           /usr/local/bin/shellfirm (v0.4.0)
  [ok] rc_file          /home/dev/.zshrc loads the hook
  [ok] hook_loaded      hook loaded (version 14)
  [ok] enter            Enter runs commands through shellfirm
  [ok] fc               fc and r (editor and re-runs, also as `builtin fc`/`builtin r` or inside `eval`) are checked
  [--] exit_status      after a line shellfirm blocked, `$?` still holds the status of the command before it: the blocked line never ran, and zsh gives a key binding no way to set
       it
  [ok] settings         /home/dev/.config/shellfirm/settings.yaml is valid
  [ok] custom_checks    0 custom check(s) loaded

Live check ran in a new interactive shell. To check this session (bindings changed after startup):
  __shellfirm_doctor_probe | shellfirm doctor --stdin

hook_loaded … (version 14) is the hook version of shellfirm 0.4.0. A shell that still runs an older hook is reported here; restart it (exec zsh, exec bash, …). The binary line shows the binary the hooks run and its version.

A shell that is not protected

Run in bash before shellfirm init. Each [XX] line says what to do:

Output
shellfirm doctor — bash (from --shell)

  [--] shell            bash (detected from --shell)
  [XX] session          this bash session has NOT loaded the shellfirm hook: commands typed here are not checked. It was started before `shellfirm init`, or without its rc files (`bash --norc`); start a new one: `exec bash`
  [ok] binary           /usr/local/bin/shellfirm (v0.4.0)
  [XX] rc_file          /home/dev/.bashrc does not load the shellfirm hook: run `shellfirm init bash`
  [XX] hook_loaded      a new interactive bash does not load the shellfirm hook
  [--] exit_status      after a line shellfirm blocked, `$?` still holds the status of the command before it: the blocked line never ran, and bash gives a key binding no way to set it
  [--] settings         /home/dev/.config/shellfirm/settings.yaml does not exist yet (built-in defaults)
  [ok] custom_checks    0 custom check(s) loaded

This session is not protected; the live check ran in a new interactive shell. Start a new shell: exec bash

Markers: [ok] passed, [!!] warning (something may run unchecked in some cases; the line says when), [XX] failed (commands may run unchecked), [--] information.

When the binary is missing or broken

The hooks fail open: when shellfirm is not on PATH (uninstalled, or nvm use switched to a Node.js version without the npm package), commands run unchecked after one warning. doctor itself is then not found as shellfirm; run it with the full path to the binary. It reports:

Output
  [XX] session          this bash session has NOT loaded the shellfirm hook: commands typed here are not checked. …
  [XX] binary           shellfirm is not on PATH: the shell hooks fail open (commands are NOT checked)
  [ok] rc_file          /home/dev/.bashrc loads the hook
  [XX] hook_loaded      a new interactive bash does not load the shellfirm hook

A binary that is on PATH but does not start gives [XX] binary the hooks run <path> but it does not start (…): commands are NOT checked (the hooks warn on every command). When the binary on PATH is not the one you ran doctor with, [!!] binary says the two may be different versions. See If shellfirm is missing or broken.

AI-agent hooks and sandboxes

doctor also reports each installed agent hook (agent_hook) and each agent sandbox (agent_sandbox). It warns about a hook turned off in the agent's settings (Claude Code disableAllHooks or managed allowManagedHooksOnly: true, Codex [features] hooks = false, Gemini hooksConfig, Copilot disableAllHooks), a hook that does not cover the shell tool, a settings file or directory that is a symlink out of the project, a settings path that is not a regular file (a FIFO), an agent folder it cannot read (can't read …, not "not installed"), a Cline or OpenCode hook file shellfirm did not write, and a sandbox that lost entries, was turned off (also by a project or local settings file that Claude Code or Codex applies over shellfirm's), is weakened by one of your settings or has a sandbox.deny_read / deny_write entry shellfirm refuses (named on the line). It suggests re-running connect or sandbox only when that fixes the problem. A shellfirm hook in Claude Code's managed settings is reported as claude-code (managed); with allowManagedHooksOnly, a user hook that no longer loads does not fail doctor when the managed hook covers Bash (see Managed settings).

On a machine with AI-agent hooks in order and no shell hook at all, the shell findings are warnings, and doctor exits 0:

Output
shellfirm doctor — bash (from --shell)

  [--] shell            bash (detected from --shell)
  [ok] binary           /usr/local/bin/shellfirm (v0.4.3)
  [!!] rc_file          /home/dev/.bashrc does not load the shellfirm hook: run `shellfirm init bash`
  [!!] hook_loaded      a new interactive bash does not load the shellfirm hook
  [--] exit_status      after a line shellfirm blocked, `$?` still holds the status of the command before it: the blocked line never ran, and bash gives a key binding no way to set it
  [--] settings         /home/dev/.config/shellfirm/settings.yaml does not exist yet (built-in defaults)
  [ok] custom_checks    0 custom check(s) loaded
  [ok] agent_sandbox    claude-code (user): sandbox on, read denies 39/39, write denies 26/26
  [ok] agent_hook       claude-code (user): hook in /home/dev/.claude/settings.json
  [--] agent_only       no shell hook is installed, but the AI-agent hooks are in place: doctor does not fail for the shell. Run `shellfirm init` to check commands you type too.

A hook that Claude Code does not run:

Output
  [!!] agent_hook       claude-code (user): hook in /home/dev/.claude/settings.json: disableAllHooks is true in /home/dev/.claude/settings.json: Claude Code runs no hook (remove it or set it to false)

Plugin findings

doctor names the plugins it recognises (atuin, fzf, bash-preexec, starship, ble.sh in bash; atuin, fzf, zsh-autosuggestions, zsh-syntax-highlighting, zsh-vi-mode, zsh-abbr, powerlevel10k, starship in zsh; atuin, fzf.fish, tide and transient prompts in fish):

Output
  [--] plugin           atuin detected
  [--] plugin           powerlevel10k detected

[--] plugin … detected is information: the plugin is known and handled. The lines that need action:

LineFix
[!!] plugin atuin enter_accept runs commands unchecked (set `enter_accept = false` in atuin's config) (bash)Set enter_accept = false in atuin's config
[!!] plugin ble.sh replaces readline: the shellfirm key bindings are not used (bash, in-session check only)ble.sh is not supported; use bash without it. The default doctor does not see ble.sh: echo $BLE_VERSION printing a version means it is loaded. See Plugins and frameworks
[!!] execute_wrapper `commandline -f execute` (atuin enter_accept, transient prompts) is not checked (fish)Turn atuin's enter_accept off, then run doctor again
[!!] line_finish the zle-line-finish check is not in place … (zsh)A deferred plugin (zinit turbo, zsh-defer) can run one command unchecked; load it without a delay or update zsh

Every message, with what it means, is in Plugins and frameworks.

Checking this session with --stdin

The live check starts a new interactive shell, so it sees what your rc files set up. It does not see key bindings you changed by hand in the current session. To check the current session, pipe the hook's probe in (bash, zsh and fish):

__shellfirm_doctor_probe | shellfirm doctor --stdin

doctor also reports a command that ran unchecked in the session (bypass_seen), and a plugin that rebinds Enter on the first prompt.

JSON output

--format json prints one object with schema_version, ok, session_hooked, enter_routes_through_shellfirm and the findings. The start of it, for the unprotected bash above:

{
  "schema_version": 1,
  "shell": "bash",
  "detected_from": "--shell",
  "ok": false,
  "session_hooked": false,
  "enter_routes_through_shellfirm": false,
  "hook_version_expected": "14",
  "hook_version": null,
  "probe_source": "a new interactive shell",
  "rc_file": {
    "path": "/home/dev/.bashrc",
    "exists": true,
    "installed": false,
    "load_count": 0,
    "legacy_hook_line": null,
    "loaded_from": null
  },
  "findings": [
    {
      "id": "shell",
      "status": "info",
      "message": "bash (detected from --shell)"
    },
    ...
  ]
}

Exit codes

CodeMeaning
0Nothing is wrong (warnings may still be listed). Also on a machine with AI-agent hooks in order and no shell hook at all
1A check failed: commands typed in this shell may run unchecked
64Usage error (for example, the shell could not be detected)