rules
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.
To learn what it guards against and see it at work, read the guide: Toolchain and rules.
Defaults
| Default | Value |
|---|---|
| On by default | no: an entry turns it on |
| Fail mode | open |
| Timeout | 9000 ms |
| Events | set by its options |
| Tools | every tool, or as its options set |
| Agent types | every agent, or as its options set |
Options
| Option | Type | Default | Description |
|---|---|---|---|
deadlineMillis | integer | — | How long the sync may take, in milliseconds, before it says why it could not finish (6000 when absent). |
ignore | "info-exclude" | "warn" | "none" | — | What it does when git does not ignore the target: info-exclude adds it to the repository's info/exclude and warns only if git still does not ignore it, warn only warns, none does neither; info-exclude when absent. |
sources | object[] | required | The folders to copy *.md rules from, each { from, scope, into? }, scope being always, stack ({stack} in the path) or group ({group}). |
target | string | — | The folder below .claude/rules/, relative to the session's folder, that the sync owns and refills at each start; .claude/rules/harness when absent. |
Example
A configuration that writes every option, a comment above each:
import { defineConfig } from '@microeinhundert/harness-kit';
export default defineConfig({
// The Policy entries, in the order their Decisions merge in.
policies: [
{
// The Policy's name, unique in the configuration; messages and logs name the Policy by it.
id: 'rules',
// The constructor's options, which it decodes.
options: {
// How long the sync may take, in milliseconds, before it says why it could not finish (6000
// when absent).
deadlineMillis: 1,
// What it does when git does not ignore the target: `info-exclude` adds it to the
// repository's `info/exclude` and warns only if git still does not ignore it, `warn` only
// warns, `none` does neither; `info-exclude` when absent.
ignore: 'info-exclude',
// The folders to copy `*.md` rules from, each `{ from, scope, into? }`, `scope` being
// `always`, `stack` (`{stack}` in the path) or `group` (`{group}`).
sources: [
{
// The folder of `*.md` rules to copy, absolute or relative to the folder of the
// configuration the hook loaded; it may name `{stack}` and `{group}`.
from: 'rules/{stack}',
// The folder below the target the rules are copied into; the target itself when absent.
// It may name `{stack}` and `{group}`.
into: '{stack}',
// Where the source applies: `always`, in a repository of any stack (`stack`), or in a
// repository of a project of any group (`group`).
scope: 'always',
},
],
// The folder below `.claude/rules/`, relative to the session's folder, that the sync owns
// and refills at each start; `.claude/rules/harness` when absent.
target: '.claude/rules/harness',
},
// The name of the kit's Policy constructor that builds the Policy.
use: 'rules',
},
],
});toolchain
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.
external
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.