readonly-agents
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.
To learn what it guards against and see it at work, read the guide: Git and forge.
Defaults
| Default | Value |
|---|---|
| On by default | no: an entry turns it on |
| Fail mode | closed |
| Timeout | 5000 ms |
| Events | PreToolUse |
| Tools | Bash |
| Agent types | every agent, or as its options set |
Options
| Option | Type | Default | Description |
|---|---|---|---|
agentTypes | string[] | ["Explore"] | The agents that only read, matched exactly against the payload's agent_type. |
forgeWrites | boolean | true | Whether a command that writes to the forge, merges or approves is refused too. |
git | string[] | ["add","commit","push"] | The git subcommands they may not run. |
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: 'readonly-agents',
// The constructor's options, which it decodes.
options: {
// The agents that only read, matched exactly against the payload's `agent_type`.
agentTypes: ['Explore'],
// Whether a command that writes to the forge, merges or approves is refused too.
forgeWrites: true,
// The git subcommands they may not run.
git: ['add', 'commit', 'push'],
},
// The name of the kit's Policy constructor that builds the Policy.
use: 'readonly-agents',
},
],
});merge-method
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.
branch-switch
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.