# harness-kit - Guides: Learn harness-kit step by step - [Introduction](https://microeinhundert.com/harness-kit/markdown/docs.md): What harness-kit is, what it refuses, and where to start. - **Get started** - [Installation](https://microeinhundert.com/harness-kit/markdown/docs/getting-started/installation.md): Add harness-kit to a project from npm and check that it runs. - [Quick start](https://microeinhundert.com/harness-kit/markdown/docs/getting-started/quick-start.md): Write a first harness.config.ts, turn the hooks on, and watch a call being refused. - **Recipes** - [Overview](https://microeinhundert.com/harness-kit/markdown/docs/recipes.md): Real-world guardrails, each a short walkthrough with a tested configuration and the exact message the agent reads. - [Stop force-pushes to shared branches](https://microeinhundert.com/harness-kit/markdown/docs/recipes/stop-force-pushes.md): Refuse every push from the agent that writes main or a release branch, forced or not, and leave moving shared branches to people. - [Keep kubectl read-only](https://microeinhundert.com/harness-kit/markdown/docs/recipes/kubectl-read-only.md): Let the agent read the cluster but refuse every change, and keep it out of production contexts entirely. - [Protect secrets and the harness itself](https://microeinhundert.com/harness-kit/markdown/docs/recipes/protect-secrets.md): Refuse every write the agent makes to secrets/ and .env files, and keep it from editing the hooks that guard it. - [Run lint before the agent stops](https://microeinhundert.com/harness-kit/markdown/docs/recipes/lint-before-stop.md): Run the project's lint when the agent ends a turn that changed code, and keep the turn going until it passes. - [Format every edited file](https://microeinhundert.com/harness-kit/markdown/docs/recipes/format-edited-files.md): Run the project's own Prettier on each file the agent edits, right after the edit, without ever blocking it. - [Issue keys in branch names, status synced](https://microeinhundert.com/harness-kit/markdown/docs/recipes/issue-keys.md): Require every branch to name its Jira issue, refuse commits on main, and keep each issue's status in step with its pull request. - [A complete setup: this repository's own](https://microeinhundert.com/harness-kit/markdown/docs/recipes/this-repository.md): The configuration harness-kit's own repository runs on, part by part, from session-start checks to a read-only verifier subagent and a docs reminder at the stop. - **Built-in Policies** - [Overview](https://microeinhundert.com/harness-kit/markdown/docs/policies.md): Every built-in Policy by area, what it guards against, and whether it is on without an entry. - [Protection](https://microeinhundert.com/harness-kit/markdown/docs/policies/protection.md): self-protection and hook-bypass keep the agent from switching its own guardrails off. Both run in every configuration. - [Commands](https://microeinhundert.com/harness-kit/markdown/docs/policies/commands.md): command-policy screens every shell command line against a command table, from ready-made presets for kubectl and package managers to an allow-list for one subagent. - [Git and forge](https://microeinhundert.com/harness-kit/markdown/docs/policies/git-and-forge.md): Eight Policies that read the git and forge commands a Bash call would run, and refuse commits and pushes to shared branches, lost stashes, merges only people should make. - [Paths and new files](https://microeinhundert.com/harness-kit/markdown/docs/policies/paths.md): protected-paths, generated-paths, allowed-paths and new-file keep files where they belong and out of the agent's reach. - [Formatting](https://microeinhundert.com/harness-kit/markdown/docs/policies/formatting.md): format-on-edit formats each file the agent edits with the project's own formatter, and never blocks. - [Stop checks and hand-off](https://microeinhundert.com/harness-kit/markdown/docs/policies/stop-checks-and-hand-off.md): stop-command, work-saved and the hand-off checks keep the agent working until lint passes, the work is saved and the pull request and issue tell the truth. - [Gates](https://microeinhundert.com/harness-kit/markdown/docs/policies/gates.md): Name the checks a repository must pass, run them under a lock so two agents never run the test suite at once, and wait for one inside a tool call. - [Session start](https://microeinhundert.com/harness-kit/markdown/docs/policies/session-start.md): codegraph, workspace-links and worktree-health check the session's own checkout when it starts and tell the agent what to fix. - [Keep awake](https://microeinhundert.com/harness-kit/markdown/docs/policies/keep-awake.md): keep-awake holds the machine awake from a prompt to the stop that ends the turn, and never leaves a process behind. - [Toolchain and rules](https://microeinhundert.com/harness-kit/markdown/docs/policies/toolchain-and-rules.md): toolchain checks the tools and versions a session runs on; rules copies your team's rules into the session where Claude Code reads them. - **Concepts** - [Policies and Decisions](https://microeinhundert.com/harness-kit/markdown/docs/concepts/policies-and-decisions.md): A Policy is one guardrail; a Decision is what it answers for one hook call. - [How a hook call is decided](https://microeinhundert.com/harness-kit/markdown/docs/concepts/how-a-hook-call-is-decided.md): What happens between Claude Code calling a hook and the agent reading its answer, and why a hook never lets a call through by accident. - [The configuration](https://microeinhundert.com/harness-kit/markdown/docs/concepts/configuration.md): Where harness-kit finds its configuration, how entries are written, how a repository extends a central configuration, and how a person loosens one Policy on purpose. - [Sessions and stop checks](https://microeinhundert.com/harness-kit/markdown/docs/concepts/sessions-and-stop-checks.md): How harness-kit remembers what a session changed, and why a stop check never nags a session that touched nothing. - [Projects and stacks](https://microeinhundert.com/harness-kit/markdown/docs/concepts/projects-and-stacks.md): How harness-kit knows what a repository is (its project) and what a folder is (its stack), and how it names the package manager. - **Connect your tools** - [GitHub](https://microeinhundert.com/harness-kit/markdown/docs/adapters/github.md): Use GitHub as the forge and GitHub Issues as the tracker, through the GitHub CLI, for the hand-off checks and harness-kit tracker. - [Jira](https://microeinhundert.com/harness-kit/markdown/docs/adapters/jira.md): Use Jira Cloud as the tracker, over Jira's REST API with an API token, for the hand-off checks and harness-kit tracker. - **Extend** - [Writing a custom Policy](https://microeinhundert.com/harness-kit/markdown/docs/extend/custom-policy.md): Write a Policy in TypeScript beside the built-in ones, for a rule no built-in Policy covers. - [Writing an external Policy or adapter](https://microeinhundert.com/harness-kit/markdown/docs/extend/external-adapter.md): Decide hook calls, or stand in for an issue tracker, with an executable in any language that speaks harness-kit's protocol. - [External Policies and adapters](https://microeinhundert.com/harness-kit/markdown/docs/extend/protocol.md): The JSON protocol any executable speaks to decide hook calls or stand in for a forge, a tracker or a project catalog, in any language. - **Operate** - [Migrating hand-written hooks](https://microeinhundert.com/harness-kit/markdown/docs/operate/migrating.md): Replacing a project's hook scripts with harness-kit Policies, with this repository's own configuration as the worked example. - [Testing a configuration](https://microeinhundert.com/harness-kit/markdown/docs/operate/testing.md): Prove what your configuration refuses and lets through with runHook, in-process tests that answer calls exactly as the hook does. - [Debugging a configuration](https://microeinhundert.com/harness-kit/markdown/docs/operate/debugging.md): Find out why a call was refused or let through, with config check, explain and the debug log. - **Help** - [Troubleshooting](https://microeinhundert.com/harness-kit/markdown/docs/troubleshooting.md): What the most common messages mean and how to clear them. - [FAQ](https://microeinhundert.com/harness-kit/markdown/docs/faq.md): Short answers to what people ask before and after adopting harness-kit. - [Glossary](https://microeinhundert.com/harness-kit/markdown/docs/glossary.md): The words the docs use for what harness-kit is made of, each with what it means and the words the docs avoid for it. - API reference: Every command, key, Policy and message - [Command line](https://microeinhundert.com/harness-kit/markdown/docs/reference/cli.md): Every command of harness-kit, generated from the kit's effect/cli command tree. - [Configuration](https://microeinhundert.com/harness-kit/markdown/docs/reference/configuration.md): Every key of harness.config.ts, with an example of each option, generated from the configuration Schema the kit decodes it with. - [Presets](https://microeinhundert.com/harness-kit/markdown/docs/reference/presets.md): The kit's ready-made configuration values, generated from its code: command tables, formatters and the git conventions. - [Protocol](https://microeinhundert.com/harness-kit/markdown/docs/reference/protocol.md): The messages external Policies and adapters exchange with the kit, with an example of each field, generated from the JSON Schemas harness-kit protocol schema prints. - **Built-in Policies** - [All built-in Policies](https://microeinhundert.com/harness-kit/markdown/docs/reference/policies.md): Every constructor a configuration entry's use names, by area, each with a page of its defaults and options. - **Protection** - [self-protection](https://microeinhundert.com/harness-kit/markdown/docs/reference/policies/self-protection.md): The built-in Policy self-protection, against the agent switching its own guardrails off: its defaults, its options and a configuration that writes it. - [hook-bypass](https://microeinhundert.com/harness-kit/markdown/docs/reference/policies/hook-bypass.md): The built-in Policy hook-bypass, against the agent switching its own guardrails off: its defaults, its options and a configuration that writes it. - **Commands** - [command-policy](https://microeinhundert.com/harness-kit/markdown/docs/reference/policies/command-policy.md): The built-in Policy command-policy, against dangerous command lines: production kubectl, the wrong package manager, a subagent that should only read: its defaults, its options and a configuration that writes it. - **Git and forge** - [branch-name](https://microeinhundert.com/harness-kit/markdown/docs/reference/policies/branch-name.md): The built-in Policy branch-name, against commits and pushes to shared branches, lost stashes, merges only people should make: its defaults, its options and a configuration that writes it. - [push-target](https://microeinhundert.com/harness-kit/markdown/docs/reference/policies/push-target.md): The built-in Policy push-target, against commits and pushes to shared branches, lost stashes, merges only people should make: its defaults, its options and a configuration that writes it. - [stash-safety](https://microeinhundert.com/harness-kit/markdown/docs/reference/policies/stash-safety.md): The built-in Policy stash-safety, against commits and pushes to shared branches, lost stashes, merges only people should make: its defaults, its options and a configuration that writes it. - [commit-subject](https://microeinhundert.com/harness-kit/markdown/docs/reference/policies/commit-subject.md): The built-in Policy commit-subject, against commits and pushes to shared branches, lost stashes, merges only people should make: its defaults, its options and a configuration that writes it. - [merge-method](https://microeinhundert.com/harness-kit/markdown/docs/reference/policies/merge-method.md): The built-in Policy merge-method, against commits and pushes to shared branches, lost stashes, merges only people should make: its defaults, its options and a configuration that writes it. - [readonly-agents](https://microeinhundert.com/harness-kit/markdown/docs/reference/policies/readonly-agents.md): The built-in Policy readonly-agents, against commits and pushes to shared branches, lost stashes, merges only people should make: its defaults, its options and a configuration that writes it. - [branch-switch](https://microeinhundert.com/harness-kit/markdown/docs/reference/policies/branch-switch.md): The built-in Policy branch-switch, against commits and pushes to shared branches, lost stashes, merges only people should make: its defaults, its options and a configuration that writes it. - [forge-guard](https://microeinhundert.com/harness-kit/markdown/docs/reference/policies/forge-guard.md): The built-in Policy forge-guard, against commits and pushes to shared branches, lost stashes, merges only people should make: its defaults, its options and a configuration that writes it. - **Paths and new files** - [protected-paths](https://microeinhundert.com/harness-kit/markdown/docs/reference/policies/protected-paths.md): The built-in Policy protected-paths, against writes to files that must not be edited, or outside where they belong: its defaults, its options and a configuration that writes it. - [generated-paths](https://microeinhundert.com/harness-kit/markdown/docs/reference/policies/generated-paths.md): The built-in Policy generated-paths, against writes to files that must not be edited, or outside where they belong: its defaults, its options and a configuration that writes it. - [allowed-paths](https://microeinhundert.com/harness-kit/markdown/docs/reference/policies/allowed-paths.md): The built-in Policy allowed-paths, against writes to files that must not be edited, or outside where they belong: its defaults, its options and a configuration that writes it. - [new-file](https://microeinhundert.com/harness-kit/markdown/docs/reference/policies/new-file.md): The built-in Policy new-file, against writes to files that must not be edited, or outside where they belong: its defaults, its options and a configuration that writes it. - **Formatting** - [format-on-edit](https://microeinhundert.com/harness-kit/markdown/docs/reference/policies/format-on-edit.md): The built-in Policy format-on-edit, against edited files left unformatted: its defaults, its options and a configuration that writes it. - **Stop checks and hand-off** - [stop-command](https://microeinhundert.com/harness-kit/markdown/docs/reference/policies/stop-command.md): The built-in Policy stop-command, against a turn that ends with failing lint, unsaved work or an incomplete hand-off: its defaults, its options and a configuration that writes it. - [work-saved](https://microeinhundert.com/harness-kit/markdown/docs/reference/policies/work-saved.md): The built-in Policy work-saved, against a turn that ends with failing lint, unsaved work or an incomplete hand-off: its defaults, its options and a configuration that writes it. - [pull-request](https://microeinhundert.com/harness-kit/markdown/docs/reference/policies/pull-request.md): The built-in Policy pull-request, against a turn that ends with failing lint, unsaved work or an incomplete hand-off: its defaults, its options and a configuration that writes it. - [references](https://microeinhundert.com/harness-kit/markdown/docs/reference/policies/references.md): The built-in Policy references, against a turn that ends with failing lint, unsaved work or an incomplete hand-off: its defaults, its options and a configuration that writes it. - [status-sync](https://microeinhundert.com/harness-kit/markdown/docs/reference/policies/status-sync.md): The built-in Policy status-sync, against a turn that ends with failing lint, unsaved work or an incomplete hand-off: its defaults, its options and a configuration that writes it. - [tracker-fields](https://microeinhundert.com/harness-kit/markdown/docs/reference/policies/tracker-fields.md): The built-in Policy tracker-fields, against a turn that ends with failing lint, unsaved work or an incomplete hand-off: its defaults, its options and a configuration that writes it. - **Session start** - [codegraph](https://microeinhundert.com/harness-kit/markdown/docs/reference/policies/codegraph.md): The built-in Policy codegraph, against a checkout that loads another checkout’s packages, a stale worktree, a full disk: its defaults, its options and a configuration that writes it. - [workspace-links](https://microeinhundert.com/harness-kit/markdown/docs/reference/policies/workspace-links.md): The built-in Policy workspace-links, against a checkout that loads another checkout’s packages, a stale worktree, a full disk: its defaults, its options and a configuration that writes it. - [worktree-health](https://microeinhundert.com/harness-kit/markdown/docs/reference/policies/worktree-health.md): The built-in Policy worktree-health, against a checkout that loads another checkout’s packages, a stale worktree, a full disk: its defaults, its options and a configuration that writes it. - **Keep awake** - [keep-awake](https://microeinhundert.com/harness-kit/markdown/docs/reference/policies/keep-awake.md): The built-in Policy keep-awake, against the machine sleeping while the agent works: its defaults, its options and a configuration that writes it. - **Toolchain and rules** - [toolchain](https://microeinhundert.com/harness-kit/markdown/docs/reference/policies/toolchain.md): The built-in Policy toolchain, against a session on the wrong tool versions, rules missing from the agent’s context: its defaults, its options and a configuration that writes it. - [rules](https://microeinhundert.com/harness-kit/markdown/docs/reference/policies/rules.md): The built-in Policy rules, against a session on the wrong tool versions, rules missing from the agent’s context: its defaults, its options and a configuration that writes it. - **External** - [external](https://microeinhundert.com/harness-kit/markdown/docs/reference/policies/external.md): The built-in Policy external, against whatever an executable you write decides, in any language: its defaults, its options and a configuration that writes it.