Team policies
Commit a .shellfirm.yaml so everyone working in a repository gets the same enforced safety rules.
A .shellfirm.yaml committed to a repository is a project policy. Its rules
apply to everyone who works in that repository: on their shells, in their AI
agents, and in shellfirm check. An organisation can add an
org policy that applies on every directory of
a machine. To set shellfirm up for a whole team (install, hooks, policies, agents,
CI, health checks and audit collection), follow
Rolling out to a team.
version: 1
deny:
- git:force_push
overrides:
- id: git:reset
on_branches: [main, "release/*"]
challenge: YesGuarantees
- Enforced. Personal settings cannot weaken a policy. Checks named in
denyoroverrides, and the policy's ownchecks, stay active in the project even if a developer ignores them (ignores_patterns_ids), disables their group (disabled_groups), leaves the group out ofenabled_groups, or sets a highermin_severity. There is deliberately no flag or environment variable that switches a policy off: to change a rule, change the file, in code review. - Additive.
overridesonly make a challenge stricter.contextentries are added to each developer's own context settings. Nested policies add rules; they never remove a parent's. - Loud. A broken policy file is never ignored silently. Every command warns,
statusandpolicy showreport it, and agent hooks answeraskwhile a file is not applied. See CI validation.
What a developer sees
A command the policy denies is blocked, with no challenge, and the banner names the file:
================ COMMAND DENIED ================
Command: git push -f origin feature/login
Check: git:force_push
Severity: HIGH
Blast radius: [PROJECT] — Force-pushes to origin/feature/login
Context: branch=main, target=feature/login
Description: This force-pushes and can 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.)
Denied: `git:force_push` is denied by the project policy (/home/dev/projects/webapp/.shellfirm.yaml)
Only a change to that policy can allow it.
shellfirm: command denied, not run.
shellfirm: the line is kept for editing (Ctrl-U clears it).An AI agent gets deny with the same reason.
See the effective policy
shellfirm policy show prints the merged policy, the files it comes from, and
which of your settings it overrides. Here a developer ignored git:reset
in their personal settings:
Policy sources (outermost first):
/home/dev/projects/webapp/.shellfirm.yaml (valid)
Effective policy:
deny: git:force_push
overrides (strictest wins):
git:reset -> at least Yes on branches [main, release/*]
checks: (none)
Your personal settings that the policy overrides (the policy wins):
- `git:reset` is in your ignores_patterns_ids, but the project policy enforces itshellfirm check confirms the ignore does not apply here:
[git:reset] [HIGH] This discards all uncommitted changes in your working tree.
Blast radius: [PROJECT] — Discards changes in 1 modified file (README.md)
> Safe alternative: git stash (Saves your changes to the stash so you can recover them later with 'git stash pop'.)
Context: Normal (branch=main)
Shell (you, in a terminal): would challenge (Yes, escalated from Math: project policy (/home/dev/projects/webapp/.shellfirm.yaml) for `git:reset`)shellfirm status lists every policy file and what it enforces:
Project policy:
/etc/shellfirm/policy.yaml [org]: valid
/home/dev/projects/webapp/.shellfirm.yaml: valid
Enforced: 2 deny, 1 override(s), 0 check(s), context
Details: shellfirm policy showWhere policies apply
- In the repository and every directory below it (nested files merge; see Monorepos and nesting).
- When a command targets the repository from outside:
git -C ~/work/app …,cd ~/work/app && …,terraform -chdir=infra …, or path arguments. - For shell hooks, agent hooks, MCP and
shellfirm checkalike.
Upgrading from 0.3.10
In 0.3.10 personal ignores, disabled groups and min_severity could weaken a
policy. In 0.4.0 they cannot. Run shellfirm policy validate in each repository
that has a .shellfirm.yaml. See Upgrading from 0.3.10.
Next steps
Create a policy
policy init and the file format.
Deny lists
Block checks outright for everyone.
Challenge overrides
Stricter challenges, per branch.
Project checks
Checks only this repository needs.
Monorepos and nesting
How nested files merge.
Org policy
A machine-wide baseline.
CI validation
Fail a pull request on a broken policy.
Rolling out to a team
Install, policy, agents, CI, health checks and audit for a whole team, in order.
Custom tools
Wrap any interactive program, choose its delimiter and check groups, and set wrap-only challenge settings.
Rolling out to a team
One page, in order — install shellfirm on every machine, set up the hooks, ship an org policy, commit project policies and agent hooks, validate in CI, check fleet health and collect the audit log.