Claude Code status line: always-on guard mode¶
Claude Code can render a custom status line at the bottom of the session. Wire failsafe
into it and you always see whether the agent is in 🔒 read (safe) or 🔓 write
(it can mutate). No guessing, and no surprise kubectl apply.
The snippet: examples/claude-statusline.sh.
How it works¶
Claude Code pipes a session JSON object on stdin (session_id, cwd, model, …) and
renders the first line of stdout as the status line. The helper asks failsafe for the
current pane's mode (failsafe mode get, resolved via the same mode-source chain the hook
uses) and prints, e.g.:
Because it reads the same per-pane mode the guard enforces, the line flips the instant you
failsafe toggle (or hit your Ctrl+Alt+T / Ctrl+Opt+T binding).
Install¶
- Copy the snippet somewhere stable and make it executable:
mkdir -p ~/.config/failsafe
cp examples/claude-statusline.sh ~/.config/failsafe/claude-statusline.sh
chmod +x ~/.config/failsafe/claude-statusline.sh
- Point Claude Code at it in
~/.claude/settings.json:
- Start (or restart) Claude Code: the guard mode now lives in the status line.
Notes¶
jqis optional. With it you get cwd + model context; without it the line still shows the guard mode (the part that matters).- The script calls
failsafe mode get, sofailsafemust be onPATHfor the Claude Code process. If you install via the Homebrew cask that's automatic; forgo installbuilds, ensure$(go env GOPATH)/binis onPATH. - Want the elevated state to shout? Pair it with the toggle "sudo mode" styling so a writable pane is unmistakable in both the terminal and the status line.