.cc-safety-net/ to standardize a preset, add custom rules, or protect extra paths for every clone.
Make sure every member installs it
Each member installs the hook once per machine, per agent CLI. They do not repeat it per repository:--claude-code, --codex, or --cursor installs one non-interactively. npx -y cc-safety-net install --help lists all of them.
Automate the install
Attach the install to the setup step your project already runs, such as an npmpostinstall script, a Makefile or justfile bootstrap target, a dev container’s postCreateCommand, or a mise task. A project with no setup step puts the one-liner in its onboarding docs instead.
For example, in an npm project:
process.env.CI guard skips the install in CI, where an agent hook is wasted work. Pick the target flag your team uses. For a team on several agent CLIs, document the interactive one-liner instead.
Standardize the repository (optional)
Members’ own policies already block destructive commands and secret access at the standard preset. Commit configuration under.cc-safety-net/ only when the team wants a specific preset, custom blocking rules, or extra protected paths. You can commit two pieces:
.cc-safety-net/policy.json. A sparse project policy that layers over each member’s user policy: safety preset, built-in protection toggles, per-rule overrides, extra protected paths. Policy documents the merge contract..cc-safety-net/rules/rule.jsonand the rulebooks beside it. They hold the project’s custom rules. Rulebook files are ordinary committed files, so teammates get them without running anything. Custom rules documents the format.
1
Commit a project policy
Write the policy fields the team should share into a proposal file, validate it, and apply it:
policy apply writes .cc-safety-net/policy.json after you confirm the diff in a terminal. See policy. The Protections view of npx -y cc-safety-net gui can also draft a project policy. Set only what the team standardizes on. Every other field keeps inheriting from each member’s user policy.2
Add project rules
Install official rulebooks into the project scope and author any project-specific rules:Without
--global, rule add writes the rulebook files under .cc-safety-net/rules/ in the repository.3
Commit and verify
Commit the
.cc-safety-net/ directory. Before you push, confirm that this checkout blocks what you expect:What members see
CC Safety Net applies the project policy as written and reports every field it relaxes compared with a member’s user policy. See Reported weakenings. Members keep these boundaries:- A member’s user policy stays theirs. The project file only layers over it. Unset fields inherit, and members can run a stricter user policy than the project baseline.
- A member can refuse weakenings. A member who sets
CC_SAFETY_NET_PROJECT_TIGHTEN_ONLY=1gets only the project file’s tightenings.statusanddoctorstill list each weakening, marked as ignored. See Ignore project weakenings. - Audit stays user-scope. CC Safety Net ignores and reports an
auditsection in a project policy. The project cannot change what members record locally. - Project rules cannot touch user rules. CC Safety Net ignores a project override that names a user-scoped rule and reports a warning.
Policy changes stay human
An agent can draft a policy proposal and runpolicy check, but only a person can run policy apply. See Agents cannot run policy apply. A committed policy change therefore passes through a person, normally as a reviewed pull request that touches .cc-safety-net/.
Keep it verified
rule verify validates the committed rule configuration and every rulebook directory offline, so it can run as a CI step:
npx -y cc-safety-net status for the effective policy and npx -y cc-safety-net doctor for a full installation check.