A minimal, customizable cross-shell prompt written in Rust that shows relevant project and environment info.
kaplanelad/shellfirm
A shell guardrail that intercepts dangerous terminal commands from humans and AI coding agents and requires confirmation before running them.
- Stars
- 948
- Forks
- 33
- Open issues
- 3
- Last commit
- 5 months ago
What is it?
shellfirm sits between you and your shell and checks commands before they run. When a command matches one of its built-in patterns, such as recursive deletes, force pushes, or destructive Kubernetes, Terraform, Docker, or database operations, it shows the severity, the affected scope, and a safer alternative, then asks you to solve a small challenge before continuing.
It supports Zsh, Bash, Fish, Nushell, PowerShell, Elvish, Xonsh, and Oils. Protection can be raised automatically in higher-risk contexts such as SSH sessions, root shells, protected git branches, or production Kubernetes clusters. Teams can share rules through a .shellfirm.yaml file, and every intercepted command and decision is written to a JSON-lines audit log.
For AI agents, `shellfirm connect claude-code` installs a hook that checks Bash commands before execution and registers an MCP server exposing tools to check, explain, and suggest alternatives for commands.
Key features
- 01Detects 100+ risky command patterns across filesystem, git, Kubernetes, Terraform, Docker, AWS, GCP/Azure, Heroku, and databases.
- 02Supports eight shells, including Zsh, Bash, Fish, Nushell, and PowerShell.
- 03Raises challenge difficulty in SSH, root, protected-branch, and production Kubernetes contexts.
- 04Shows safer alternative commands alongside each warning.
- 05Shares team safety rules through a .shellfirm.yaml project policy that can only add restrictions.
- 06Logs every intercepted command and decision as JSON lines.
Use cases
- Protecting your own terminal from accidental destructive commands like rm -rf or force pushes.
- Letting Claude Code or other AI agents run shell commands with a safety check on each Bash call.
- Enforcing shared safety rules for a team's production infrastructure work.
- Reviewing an audit trail of risky commands run in a shared environment.
Quick start
- 1
Install via npm
npm install -g @shellfirm/cli - 2
Install the shell hook (auto-detects your shell)
shellfirm init - 3
Restart your shell or source your rc file
- 4
Test it: the command should trigger shellfirm
git reset --hard
Things to know
- It only guards shells where the hook is installed, and each shell needs its own setup.
Topics
FAQ
- What is shellfirm?
- A shell guardrail that intercepts dangerous terminal commands from humans and AI coding agents and requires confirmation before running them. shellfirm sits between you and your shell and checks commands before they run. When a command matches one of its built-in patterns, such as recursive deletes, force pushes, or destructive Kubernetes, Terraform, Docker, or database operations, it shows the severity, the affected scope, and a safer alternative, then asks you to solve a small challenge before continuing.
- Is shellfirm free to use? What license does it have?
- shellfirm is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
- Is shellfirm still maintained?
- Updated within 6 months. The last commit to shellfirm was on May 15, 2026.
- What can I use shellfirm for?
- Protecting your own terminal from accidental destructive commands like rm -rf or force pushes. Letting Claude Code or other AI agents run shell commands with a safety check on each Bash call. Enforcing shared safety rules for a team's production infrastructure work. Reviewing an audit trail of risky commands run in a shared environment.
- How do I install shellfirm?
- Install via npm: npm install -g @shellfirm/cli Install the shell hook (auto-detects your shell): shellfirm init Restart your shell or source your rc file Test it: the command should trigger shellfirm: git reset --hard
- Where can I get shellfirm?
- The source code and installation instructions are on GitHub: https://github.com/kaplanelad/shellfirm
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A single-binary CLI that lets AI agents and developers create, read, and edit Word, Excel, and PowerPoint files without Office installed.
A personal context store that gives AI coding agents like Codex, Claude Code and OpenCode persistent project knowledge via a CLI, MCP server and desktop app.
A terminal tool that replays Git commits as animated typing sessions with syntax highlighting and file tree transitions.
A minimal Rust-built statusline for Claude Code showing model, Git state, workspace, and context window usage in the terminal.
Mission control TUI for running, monitoring and coordinating multiple AI coding agents in persistent terminal workspaces.