Overview
Real-world guardrails, each a short walkthrough with a tested configuration and the exact message the agent reads.
Each recipe solves one task: you copy a few entries into harness.config.ts, sync the hooks, and try it. Pick the recipe that matches the problem you have.
Every configuration here is type-checked and run by the docs' tests, and every message is what the hook really writes.
Before you start
Pick a recipe by the problem you have
The agent pushes to main or a release branch
Stop force-pushes to shared branches. The agent pushes its own branch; main and release branches stay with people.
The agent changes or reads production
Keep kubectl read-only. Reads pass, changes are refused, and production is off limits.
The agent writes secrets or edits its own hooks
Protect secrets and the harness itself. No write to secrets/, .env files or the hook settings.
The agent stops with failing lint
Run lint before the agent stops. The turn goes on until lint passes.
Diffs are full of formatting noise
Format every edited file. Prettier runs on each file right after the edit.
Branches do not name their issue, or Jira lags behind
Issue keys in branch names, status synced: feat/shop-142-cart, and Jira follows the pull request.
You want a full example to borrow from
A complete setup: the configuration the kit's own repository runs on, part by part.
Apply any recipe
Add the entries
Copy the recipe's entries into the policies of your harness.config.ts. An entry turns one built-in Policy on.
Check the configuration and sync the hooks
npx harness-kit config check
npx harness-kit settings syncTry it
Ask the agent to do what the recipe guards against. It reads the message the recipe quotes. To try it without an agent, see Debugging a configuration.
If a recipe does not work
Start with Troubleshooting. Each recipe also has an "If it does not work" section for its own failures.