worktree-health
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.
To learn what it guards against and see it at work, read the guide: Session start.
Defaults
| Default | Value |
|---|---|
| On by default | no: an entry turns it on |
| Fail mode | open |
| Timeout | 9000 ms |
| Events | SessionStart, PreToolUse |
| Tools | Bash, Edit, MultiEdit, NotebookEdit, Write |
| Agent types | every agent, or as its options set |
Options
| Option | Type | Default | Description |
|---|---|---|---|
deadlineMillis | integer | — | How long the whole check may take, in milliseconds, before it says why it could not finish (6000 when absent). |
lowDisk | string | — | The free space below which the disk counts as low, a size with its unit such as "1.5 GB"; "10 GiB" when absent. |
measureMillis | integer | — | How long measuring the other worktrees' node_modules with du may take, in milliseconds, before they are listed without sizes (4000 when absent). |
worktreesFolder | string | — | The folder below the main checkout where worktrees are made, searched beside the worktrees git registers; .claude/worktrees 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: 'worktree-health',
// The constructor's options, which it decodes.
options: {
// How long the whole check may take, in milliseconds, before it says why it could not
// finish (6000 when absent).
deadlineMillis: 1,
// The free space below which the disk counts as low, a size with its unit such as
// `"1.5 GB"`; `"10 GiB"` when absent.
lowDisk: '10 GiB',
// How long measuring the other worktrees' `node_modules` with `du` may take, in
// milliseconds, before they are listed without sizes (4000 when absent).
measureMillis: 1,
// The folder below the main checkout where worktrees are made, searched beside the
// worktrees git registers; `.claude/worktrees` when absent.
worktreesFolder: 'tmp/worktrees',
},
// The name of the kit's Policy constructor that builds the Policy.
use: 'worktree-health',
},
],
});workspace-links
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.
keep-awake
The built-in Policy keep-awake, against the machine sleeping while the agent works: its defaults, its options and a configuration that writes it.