Introduction
What harness-kit is, what it refuses, and where to start.
A coding agent such as Claude Code runs commands and edits files on its own. A hook is a check Claude Code runs around those actions: before and after each tool call, at a session's start, on each prompt and when the agent wants to stop.
harness-kit is that check. You describe your rules once in harness.config.ts; it refuses the calls that break them and tells the agent what to do instead.
See what a refusal looks like
This configuration keeps kubectl read-only, guards git the way most teams work, and formats every edited TypeScript file:
import { defineConfig, GIT_CONVENTIONS } from '@microeinhundert/harness-kit';
/**
* A team's first configuration: the git conventions preset, kubectl kept read-only by a command preset, and every
* edited TypeScript file formatted with Prettier.
*/
export default defineConfig({
policies: [
...GIT_CONVENTIONS,
{
id: 'kubectl',
options: {
preset: 'kubectl',
production: ['^prod-'],
},
use: 'command-policy',
},
{
id: 'format',
options: {
formatters: [
{
glob: '**/*.ts',
preset: 'prettier',
},
],
},
use: 'format-on-edit',
},
],
});When the agent then runs kubectl delete pod web-1, the hook refuses the call, and the agent reads:
`kubectl delete pod web-1` is refused: `delete` is on the deny list of the kubectl command table.
Fix: Do not run it; if it is needed, ask the developer to run it by hand.Why use it
Guardrails you configure, not write
kubectl read-only, guard shared branches, lint before the agent stops, format edits.A hook that fails closed
Answers the agent can act on
Your own rules, in any language
Shared configurations that only tighten
Find your way through the docs
The Guides teach you harness-kit by doing. The API reference, the second tab of the sidebar, lists every command, key, Policy and message. Follow the guides in this order:
Install it and see a first refusal
Install the package, then follow the quick start: one configuration and one command, and you see the agent's first refused call.
Copy a recipe
Each recipe solves one real task, such as stopping force-pushes or running lint before the agent stops, with a tested configuration you paste in.
Pick the Policies you need
The Built-in Policies guides show what each guardrail catches and what the agent reads when it fires.
Understand how it decides
The concepts explain Policies and Decisions, how a hook call is decided, and how configurations extend each other. Read them after your first configuration runs.
Connect, extend and operate
Connect GitHub or Jira, write your own Policy, and test and debug your configuration.