Sawbuck
GitHub Install

Rules

Rules for one repo.

You tell your agent "never touch the auth module" or "keep the tests passing." Written down, agents follow those well. sawbuck contract writes the first ones, and some can also be checked. This page shows which.

Two kinds of rule.

The test is simple: can the rule be decided from the diff and the test results alone? If yes, it is checkable. If no, it is advice, and we say so.

Checkable

sawbuck contract writes one rule to AGENTS.md and protected paths in promptwheel.config.json. It keeps your tests as the check, including test count, skipped tests, assertions and suppressions.

--full adds supply-chain guards, a repo lock and a CI check.

Advice

"Keep it simple." "Be careful with edge cases." These need a person to decide. They work like any line in AGENTS.md. The check does not enforce them.

A protected path is a rule the check can see.

sawbuck attach wires Claude Code hooks, for one project or with --user. --shared writes a hooks file a team can commit (with the rules, or with --allow on that commit), and --git checks every commit, for any other agent. When the agent ends a turn, the Stop hook checks protected paths and re-proves any new commit from source alone. A test edit left uncommitted is not re-run until it is committed, or until sawbuck check runs. It sends a protected-path change or a gamed commit back, up to three times by default. The agent gets the rules once a session and after a compaction.

A protected path is a plain path match on the diff. In the config, the key is mandates.

sawbuck contract protects these by default: the rules file, the Claude hooks, .github/workflows, .npmrc and .yarnrc, Dockerfile and docker-compose files, scripts/release* and scripts/publish*, and CODEOWNERS. The rules file and the hooks change with --allow "reason" from a person. To change one of the others on purpose, remove its rule from the config in a commit of its own, then make the change. To protect another path, add an entry like the one above. That edit is to the rules file, so it takes --allow.

Measured

We tried to make the rule fail before we wrote this page.

A headless Claude Code session, a bug whose natural fix sits inside the protected module, 62 trials in all: 52 driven past a forced compaction (two compactions on the default model, one on the smaller Haiku) and 10 shallow, some of them under "urgent hotfix, smallest fix" pressure.

17 of 17

No rule anywhere: every trial edited the protected file.

0 of 45

A rule in any form: said once in chat, in CLAUDE.md, in the config, with or without the check.

Two compactions, a weaker model and hotfix pressure did not move either number. So a line in AGENTS.md or CLAUDE.md worked too. A protected path adds a check, not a better reminder: the rule is read from the repo on each turn, whatever the session remembers. That holds only for checkable rules. For advice, Sawbuck only writes it down.

Write your first rules.

See how the check works, then run this in your repo. In Claude Code, /sawbuck-reins:contract does the same.

$ npx sawbuck contract