Skip to content
$ shellfirm

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.

.shellfirm.yaml
version: 1
deny:
  - git:force_push
overrides:
  - id: git:reset
    on_branches: [main, "release/*"]
    challenge: Yes

Guarantees

  • Enforced. Personal settings cannot weaken a policy. Checks named in deny or overrides, and the policy's own checks, stay active in the project even if a developer ignores them (ignores_patterns_ids), disables their group (disabled_groups), leaves the group out of enabled_groups, or sets a higher min_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. overrides only make a challenge stricter. context entries 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, status and policy show report it, and agent hooks answer ask while 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:

Output
================ 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:

Output
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 it

shellfirm check confirms the ignore does not apply here:

Output
  [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:

Output
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 show

Where 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 check alike.

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