Skip to Content
harness-kit

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.

To learn what it guards against and see it at work, read the guide: External.

Defaults

DefaultValue
On by defaultno: an entry turns it on
Fail modeclosed
Timeout12000 ms
Eventsset by its options
Toolsevery tool, or as its options set
Agent typesevery agent, or as its options set

Options

OptionTypeDefaultDescription
adapterstringrequiredThe adapter that decides, by its name under the configuration's adapters.
agentTypesstring[]—The agent types the Policy runs for; every agent and the main session when absent.
events("PostToolUse" | "PreToolUse" | "SessionStart" | "Stop" | "SubagentStop" | "UserPromptSubmit")[]requiredThe hook events the Policy runs for.
timeoutMillisinteger—How long one decide may take, in milliseconds; the adapter's own timeout when shorter, 10000 when absent. The Policy's timeout follows from it.
toolsstring[]—The tools the Policy runs for, each a name or a prefix ending in *; every tool 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: 'external',
      // The constructor's options, which it decodes.
      options: {
        // The adapter that decides, by its name under the configuration's `adapters`.
        adapter: 'secrets-guard',
        // The agent types the Policy runs for; every agent and the main session when absent.
        agentTypes: ['verifier'],
        // The hook events the Policy runs for.
        events: ['PostToolUse'],
        // How long one `decide` may take, in milliseconds; the adapter's own timeout when shorter,
        // 10000 when absent. The Policy's timeout follows from it.
        timeoutMillis: 1,
        // The tools the Policy runs for, each a name or a prefix ending in `*`; every tool when
        // absent.
        tools: ['Bash'],
      },
      // The name of the kit's Policy constructor that builds the Policy.
      use: 'external',
    },
  ],
});

On this page