Safety guardrails for ai coding agents and human terminal commands
Safety guardrails for ai coding agents and human terminal commands
Think before you execute.
Humans make mistakes. AI agents make them faster. shellfirm intercepts dangerous shell commands before the damage is done.
$ rm -rf ./src
============ RISKY COMMAND DETECTED ============
Severity: Critical
Blast radius: [PROJECT] — Deletes 347 files (12.4 MB) in ./src
Description: You are going to delete everything in the path.
Solve the challenge: 8 + 0 = ? (^C to cancel)$ git push origin main --force
============ RISKY COMMAND DETECTED ============
Severity: High
Blast radius: [RESOURCE] — Force-pushes branch main (3 commits behind remote)
Description: This command will force push and overwrite remote history.
Alternative: git push --force-with-lease
(Checks that your local ref is up-to-date before force pushing, preventing accidental overwrites of others' work.)
Solve the challenge: 3 + 5 = ? (^C to cancel)Critical, High, Medium, Low, Info).shellfirm.yaml (additive-only, never weakens)One command sets up both automatic safety (hooks) and on-demand analysis (MCP):
shellfirm connect claude-codeThis adds:
| Tool | Description |
|---|---|
check_command |
Check if a command is risky — returns severity, matched rules, and alternatives |
suggest_alternative |
Get safer replacement commands |
explain_risk |
Detailed explanation of why a command is dangerous |
get_policy |
Read the active shellfirm configuration and project policy |
npm install -g @shellfirm/clibrew tap kaplanelad/tap && brew install shellfirmcargo install shellfirmOr download the binary from the releases page.
1. Install the shell hook (auto-detects your shell):
shellfirm init2. Restart your shell (or source your rc file).
3. Try it:
git reset --hard # Should trigger shellfirm!For manual setup, shell-specific instructions, and Oh My Zsh plugin, see the shell setup docs.
Full documentation is available at shellfirm.vercel.app:
.shellfirm.yaml project-level rulesContributions are welcome! Please open an issue or pull request on GitHub.
No open issues yet, or sync has not completed.