pi-herdsman 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +84 -0
- package/README.md +171 -0
- package/SKILL.md +369 -0
- package/dist/agent-definitions/implementer.md +32 -0
- package/dist/agent-definitions/researcher.md +27 -0
- package/dist/agent-definitions/reviewer.md +30 -0
- package/dist/agent-definitions/scout.md +27 -0
- package/dist/agent-definitions/worker.md +31 -0
- package/dist/index.js +255 -0
- package/docs/README.md +104 -0
- package/docs/agent-api.md +103 -0
- package/docs/concepts/delegation.md +100 -0
- package/docs/concepts/lifecycle.md +149 -0
- package/docs/concepts/supervision.md +77 -0
- package/docs/concepts/workers.md +124 -0
- package/docs/development/documentation.md +175 -0
- package/docs/development/smoke-testing.md +293 -0
- package/docs/development/validation.md +124 -0
- package/docs/getting-started.md +168 -0
- package/docs/guides/agent-definitions.md +234 -0
- package/docs/guides/customizing-agents.md +238 -0
- package/docs/guides/handoffs.md +224 -0
- package/docs/guides/recovery.md +156 -0
- package/docs/reference/agent-definition-schema.md +272 -0
- package/docs/reference/ask-owner.md +133 -0
- package/docs/reference/commands.md +121 -0
- package/docs/reference/configuration.md +130 -0
- package/docs/reference/errors.md +87 -0
- package/docs/reference/status-widget.md +148 -0
- package/docs/reference/supervision.md +203 -0
- package/docs/reference/worker-states.md +57 -0
- package/docs/reference/worker.md +201 -0
- package/package.json +62 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# Getting started
|
|
2
|
+
|
|
3
|
+
[Documentation index](README.md) · [Agent coordination API](agent-api.md) · [Pi Herdsman](concepts/supervision.md)
|
|
4
|
+
|
|
5
|
+
This is the shortest human-facing path from installation to useful Pi Herdsman
|
|
6
|
+
orchestration. You do not need to type structured `worker` requests for this
|
|
7
|
+
path.
|
|
8
|
+
|
|
9
|
+
## 1. Check requirements
|
|
10
|
+
|
|
11
|
+
You need:
|
|
12
|
+
|
|
13
|
+
- [herdr](https://github.com/herdrdev/herdr) `>=0.8.0`;
|
|
14
|
+
- Pi `>=0.84.2 <0.86.0` (the version range tested for this release);
|
|
15
|
+
- herdr Pi integration version `2` or newer;
|
|
16
|
+
- Node `>=22.19.0`.
|
|
17
|
+
|
|
18
|
+
Install or refresh the herdr Pi integration:
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
herdr integration install pi
|
|
22
|
+
herdr integration status
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Install the package from npm:
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
pi install npm:pi-herdsman
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Pi reads the package manifest and loads the extension plus the optional
|
|
32
|
+
`workers` skill.
|
|
33
|
+
|
|
34
|
+
## 2. Start the lead Pi session inside herdr
|
|
35
|
+
|
|
36
|
+
The lead Pi session must run inside herdr. A lead Pi session started outside herdr
|
|
37
|
+
cannot safely manage herdr workers.
|
|
38
|
+
|
|
39
|
+
The extension distinguishes a lead Pi session, valid managed workers, and
|
|
40
|
+
unmanaged or invalid environments. Only supported managed environments receive
|
|
41
|
+
Pi Herdsman controls and status UI.
|
|
42
|
+
|
|
43
|
+
## 3. Delegate work without leaving the conversation
|
|
44
|
+
|
|
45
|
+
Ask the lead Pi agent in ordinary language, for example:
|
|
46
|
+
|
|
47
|
+
```text
|
|
48
|
+
Use an implementer worker to implement the approved change.
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Pi Herdsman starts the work asynchronously. Once the assignment is accepted, the
|
|
52
|
+
lead Pi session remains the session you interact with instead of waiting for the
|
|
53
|
+
worker to finish.
|
|
54
|
+
|
|
55
|
+
While workers work, you can continue discussing or planning with the
|
|
56
|
+
lead Pi session, delegate other independent work, inspect active work, or focus a
|
|
57
|
+
managed worker pane.
|
|
58
|
+
|
|
59
|
+
You do not need to poll for completion. Results and worker questions are
|
|
60
|
+
delivered back to the owning controller when they need attention.
|
|
61
|
+
The exact semantics are owned by [Lifecycle](concepts/lifecycle.md).
|
|
62
|
+
|
|
63
|
+
Pi Herdsman is opinionated about coordination, not workflow. Use the agent roles,
|
|
64
|
+
tools, extensions, and process that fit your project; the lead agent handles the
|
|
65
|
+
structured coordination API internally.
|
|
66
|
+
|
|
67
|
+
## 4. Open the workers menu
|
|
68
|
+
|
|
69
|
+
In the lead Pi TUI, run:
|
|
70
|
+
|
|
71
|
+
```text
|
|
72
|
+
/workers
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
The native menu contains:
|
|
76
|
+
|
|
77
|
+
```text
|
|
78
|
+
Running
|
|
79
|
+
Definitions
|
|
80
|
+
Layout
|
|
81
|
+
Stop all…
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
`Running` is the complete authoritative live-agent inventory and focuses the
|
|
85
|
+
selected pane directly. `Definitions` manages the effective bundled, project,
|
|
86
|
+
and global agent definitions. Project definitions participate only when the
|
|
87
|
+
trusted project setting `piHerdsman.projectAgents` is `true`; effective precedence
|
|
88
|
+
is bundled < project < global. `Layout` controls whether newly started agents
|
|
89
|
+
use tabs or splits. `Stop all…` is destructive emergency control.
|
|
90
|
+
|
|
91
|
+
See [`/workers` commands](reference/commands.md) for exact behavior.
|
|
92
|
+
|
|
93
|
+
## 5. Configure definitions and layout
|
|
94
|
+
|
|
95
|
+
Open `Definitions` to inspect the effective bundled, project, and global roster
|
|
96
|
+
and edit the selected definition's model, thinking level, or enabled state.
|
|
97
|
+
The `[project]` marker identifies project participation and `*` identifies a
|
|
98
|
+
global override. Definition Details shows the effective metadata and can
|
|
99
|
+
expand the resolved definition instructions with Pi's native `Ctrl+O`
|
|
100
|
+
behavior. These edits always write global overrides, never project files.
|
|
101
|
+
|
|
102
|
+
Use `Layout` to choose the current `tab` or `split` placement for newly started
|
|
103
|
+
workers.
|
|
104
|
+
|
|
105
|
+
For complete configuration ownership, see:
|
|
106
|
+
|
|
107
|
+
- [Agent definitions](guides/agent-definitions.md)
|
|
108
|
+
- [Customizing bundled agents](guides/customizing-agents.md)
|
|
109
|
+
- [Agent-definition schema](reference/agent-definition-schema.md)
|
|
110
|
+
- [Configuration](reference/configuration.md)
|
|
111
|
+
|
|
112
|
+
## 6. Watch and focus work
|
|
113
|
+
|
|
114
|
+
The status widget shows active managed work and transient `starting` activity.
|
|
115
|
+
Workers exist for one assignment only. After a terminal result is delivered,
|
|
116
|
+
Pi Herdsman cleans up the worker; the exact Pi session remains available for
|
|
117
|
+
continuation. The `Running` menu shows the complete authoritative inventory of
|
|
118
|
+
live or unresolved lifecycle work.
|
|
119
|
+
|
|
120
|
+
Managed worker panes show their validated breadcrumb identity. Their own active
|
|
121
|
+
Pi tool names can appear as compact bracketed metadata on that breadcrumb.
|
|
122
|
+
|
|
123
|
+
See [Status widget](reference/status-widget.md) for exact state, refresh, and
|
|
124
|
+
rendering behavior.
|
|
125
|
+
|
|
126
|
+
To continue a completed assignment with its existing conversational context,
|
|
127
|
+
use the exact `session_id` returned with its result in a new `delegate.session`
|
|
128
|
+
request. This starts a new worker generation with the saved session and current
|
|
129
|
+
effective definition configuration.
|
|
130
|
+
|
|
131
|
+
## 7. Recover only when needed
|
|
132
|
+
|
|
133
|
+
Normal coordination and targeted cleanup belong to the agent API. Use
|
|
134
|
+
`Stop all…` only when you deliberately want lead-level emergency cleanup of the
|
|
135
|
+
proven owned worker tree.
|
|
136
|
+
|
|
137
|
+
For failure diagnosis and conservative cleanup, see [Recovery](guides/recovery.md).
|
|
138
|
+
|
|
139
|
+
## 8. Optionally supervise leads
|
|
140
|
+
|
|
141
|
+
When several independent lead sessions run in the same herdr runtime, an
|
|
142
|
+
eligible lead can become the chief with:
|
|
143
|
+
|
|
144
|
+
```text
|
|
145
|
+
/chief
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
This is optional and does not change worker ownership. In a UI session, use
|
|
149
|
+
`/chief leave` to leave after reviewing its confirmation, which reports
|
|
150
|
+
known outstanding supervised lead asks and leaves them pending. Cancellation
|
|
151
|
+
does nothing; an unavailable count is reported as unknown. Without a UI, leave
|
|
152
|
+
proceeds without interactive confirmation. See the [supervision
|
|
153
|
+
reference](reference/supervision.md) before using its model-facing tools.
|
|
154
|
+
|
|
155
|
+
The `/chief` command is state-sensitive: from an ordinary lead, it
|
|
156
|
+
activates chief mode only and shows the ambient widget. When already active
|
|
157
|
+
as chief, `/chief` opens the interactive overview instead. Use
|
|
158
|
+
`/chief leave` to leave chief mode and remove the widget.
|
|
159
|
+
While active, chief mode is supervision-only; leave it to resume ordinary
|
|
160
|
+
workspace-local Pi work.
|
|
161
|
+
|
|
162
|
+
## Next steps
|
|
163
|
+
|
|
164
|
+
- Keep delegating naturally through the lead Pi session.
|
|
165
|
+
- Use [`/workers` commands](reference/commands.md) when you need human control.
|
|
166
|
+
- Configure [agent definitions](guides/agent-definitions.md).
|
|
167
|
+
- Read [Agent coordination API](agent-api.md) only when you need the model and
|
|
168
|
+
agent-facing contracts.
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
# Agent definitions
|
|
2
|
+
|
|
3
|
+
[Documentation index](../README.md)
|
|
4
|
+
|
|
5
|
+
Agent definitions describe a worker's capabilities, not a required
|
|
6
|
+
workflow. They are Markdown files containing strict frontmatter plus an optional
|
|
7
|
+
prompt body.
|
|
8
|
+
|
|
9
|
+
This guide covers normal creation and selection. For the complete field contract,
|
|
10
|
+
see the [agent-definition schema](../reference/agent-definition-schema.md).
|
|
11
|
+
|
|
12
|
+
## Sources
|
|
13
|
+
|
|
14
|
+
Bundled definitions live in:
|
|
15
|
+
|
|
16
|
+
```text
|
|
17
|
+
dist/agent-definitions/
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Global definitions live by default in:
|
|
21
|
+
|
|
22
|
+
```text
|
|
23
|
+
~/.pi/agent/agents/
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Project definitions are optional and live in the current project:
|
|
27
|
+
|
|
28
|
+
```text
|
|
29
|
+
<cwd>/.pi/agents/
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
For example:
|
|
33
|
+
|
|
34
|
+
```text
|
|
35
|
+
.pi/
|
|
36
|
+
├── settings.json
|
|
37
|
+
└── agents/
|
|
38
|
+
└── reviewer.md
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
with project settings:
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{ "piHerdsman": { "projectAgents": true } }
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
They are discovered only when the trusted project settings contain
|
|
48
|
+
`piHerdsman.projectAgents: true`. Precedence is `bundled < project < global`;
|
|
49
|
+
global definitions remain final user policy. Project definitions apply only to
|
|
50
|
+
their project cwd, and the Definitions UI writes global overrides, never
|
|
51
|
+
project files.
|
|
52
|
+
|
|
53
|
+
When Pi uses a custom agent directory, the global definitions live under that
|
|
54
|
+
agent directory's `agents/` subdirectory.
|
|
55
|
+
|
|
56
|
+
A project or global definition whose `name` matches a lower-precedence
|
|
57
|
+
definition overlays it. An unmatched definition is standalone.
|
|
58
|
+
|
|
59
|
+
## Enable or disable a definition
|
|
60
|
+
|
|
61
|
+
Definitions are enabled by default. Set `enabled: false` in a matching project
|
|
62
|
+
or global overlay to make a definition unavailable without copying the bundled
|
|
63
|
+
bundled definition:
|
|
64
|
+
|
|
65
|
+
```markdown
|
|
66
|
+
---
|
|
67
|
+
name: reviewer
|
|
68
|
+
enabled: false
|
|
69
|
+
---
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The lead effective roster and `/workers agents` output keep disabled rows and
|
|
73
|
+
show their disabled status so the source can be re-enabled. A delegating worker
|
|
74
|
+
does not receive disabled workers in its definition list. A delegating worker referencing
|
|
75
|
+
a disabled worker can remain discoverable, but is rejected during assignment or
|
|
76
|
+
fresh worker startup with an explicit disabled-worker reason rather than silently
|
|
77
|
+
dropping that worker.
|
|
78
|
+
|
|
79
|
+
Definition and session delegations reject disabled definitions with an
|
|
80
|
+
actionable error. An already active worker may finish and remains controllable
|
|
81
|
+
according to its current available actions; disabling a definition does not
|
|
82
|
+
mutate that assignment.
|
|
83
|
+
|
|
84
|
+
## Bundled roster
|
|
85
|
+
|
|
86
|
+
### `implementer`
|
|
87
|
+
|
|
88
|
+
Focused source-edit worker for an explicitly approved implementation.
|
|
89
|
+
|
|
90
|
+
### `researcher`
|
|
91
|
+
|
|
92
|
+
Focused current/external research worker. Read-only local policy. It also
|
|
93
|
+
allows the default web tool names exposed by `pi-web-access`:
|
|
94
|
+
`web_search`, `fetch_content`, `get_search_content`, and `source_check`.
|
|
95
|
+
Web access is optional. Install it with:
|
|
96
|
+
|
|
97
|
+
```text
|
|
98
|
+
pi install npm:pi-web-access
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Pi Herdsman does not depend on or install `pi-web-access`. Without those tools,
|
|
102
|
+
the researcher retains local inspection capabilities and reports unavailable
|
|
103
|
+
external evidence. Normal Pi extension discovery is intentionally enabled for
|
|
104
|
+
this role so an installed compatible extension can provide the tools. If
|
|
105
|
+
`pi-web-access` is configured with different public tool names, replace the
|
|
106
|
+
researcher's `tools` array through a matching project or global overlay.
|
|
107
|
+
Extension code itself is not sandboxed by the callable-tool allowlist.
|
|
108
|
+
|
|
109
|
+
### `reviewer`
|
|
110
|
+
|
|
111
|
+
Independent read-only reviewer.
|
|
112
|
+
|
|
113
|
+
### `scout`
|
|
114
|
+
|
|
115
|
+
Fast read-only codebase reconnaissance.
|
|
116
|
+
|
|
117
|
+
### `worker`
|
|
118
|
+
|
|
119
|
+
General-purpose scoped execution worker.
|
|
120
|
+
|
|
121
|
+
The bundled definitions are portable defaults, not required workflow stages.
|
|
122
|
+
Project definitions are for repository-specific policy; global definitions are
|
|
123
|
+
for user-specific final policy.
|
|
124
|
+
|
|
125
|
+
## Create a standalone definition
|
|
126
|
+
|
|
127
|
+
Create a Markdown file in the global agents directory:
|
|
128
|
+
|
|
129
|
+
```markdown
|
|
130
|
+
---
|
|
131
|
+
name: docs-reviewer
|
|
132
|
+
description: Read-only documentation reviewer
|
|
133
|
+
model: openai-codex/gpt-5.6-luna
|
|
134
|
+
thinking: medium
|
|
135
|
+
systemPromptMode: replace
|
|
136
|
+
noSkills: true
|
|
137
|
+
noExtensions: true
|
|
138
|
+
tools: ["read", "ls", "find", "grep"]
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
Review documentation for correctness, navigation, duplication, and broken
|
|
142
|
+
examples. Do not edit files.
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Read-only behavior must be enforced by the effective tool policy, not only by
|
|
146
|
+
prompt text. For normal filesystem inspection, explicitly allow `read`, `ls`,
|
|
147
|
+
`find`, and `grep`, and omit mutation-capable tools such as `bash`,
|
|
148
|
+
`powershell`, `edit`, and `write`. Disable extension discovery when the role
|
|
149
|
+
does not need extension-provided capabilities.
|
|
150
|
+
|
|
151
|
+
The `name` is authoritative; the filename itself is not the public definition
|
|
152
|
+
name.
|
|
153
|
+
|
|
154
|
+
## Allow direct workers
|
|
155
|
+
|
|
156
|
+
```markdown
|
|
157
|
+
---
|
|
158
|
+
name: coordinator
|
|
159
|
+
tools: ["read", "bash"]
|
|
160
|
+
workers: ["scout", "researcher"]
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
Coordinate the assigned analysis and integrate direct worker results.
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
The effective roster is validated atomically. Every `workers` name must exist.
|
|
167
|
+
Bundled role descriptions and bodies describe role behavior only; orchestration
|
|
168
|
+
guidance comes from the active controller contract.
|
|
169
|
+
|
|
170
|
+
With a non-empty explicit `tools` allowlist, `worker` is inferred unless
|
|
171
|
+
explicitly denied. See [Delegation](../concepts/delegation.md).
|
|
172
|
+
|
|
173
|
+
## Add body files
|
|
174
|
+
|
|
175
|
+
A body line that consists only of one supported reference includes that file:
|
|
176
|
+
|
|
177
|
+
```markdown
|
|
178
|
+
---
|
|
179
|
+
name: docs-reviewer
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
Use the following additional policy.
|
|
183
|
+
|
|
184
|
+
@./prompts/docs-policy.md
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Supported forms:
|
|
188
|
+
|
|
189
|
+
```text
|
|
190
|
+
@./relative.md
|
|
191
|
+
@../relative.md
|
|
192
|
+
@/absolute/path.md
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
References are resolved from the Markdown file that declares them.
|
|
196
|
+
|
|
197
|
+
For exact expansion, deduplication, and caller-file precedence, see
|
|
198
|
+
[Handoffs and files](handoffs.md).
|
|
199
|
+
|
|
200
|
+
## Inspect effective definitions
|
|
201
|
+
|
|
202
|
+
A lead Pi session can use:
|
|
203
|
+
|
|
204
|
+
```text
|
|
205
|
+
/workers agents
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
or the model can use:
|
|
209
|
+
|
|
210
|
+
```json
|
|
211
|
+
{ "action": "list" }
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
Both resolve the same effective roster.
|
|
215
|
+
|
|
216
|
+
The human `Definitions` menu includes bundled, project, and global
|
|
217
|
+
participation. Project participation is marked `[project]`; a global override
|
|
218
|
+
adds `*`, so `[project] *` means both layers contribute. Model, thinking, and
|
|
219
|
+
enabled settings can be changed through the menu, but edits always write global
|
|
220
|
+
overrides. `Use default` removes only that field and inherits the next lower
|
|
221
|
+
layer or Pi's normal default.
|
|
222
|
+
|
|
223
|
+
## Override an existing bundled role
|
|
224
|
+
|
|
225
|
+
Do not copy the complete bundled file just to change one property. Create a
|
|
226
|
+
matching partial global definition instead.
|
|
227
|
+
|
|
228
|
+
See [Customizing bundled agents](customizing-agents.md).
|
|
229
|
+
|
|
230
|
+
## See also
|
|
231
|
+
|
|
232
|
+
- [Agent-definition schema](../reference/agent-definition-schema.md)
|
|
233
|
+
- [`/workers` commands](../reference/commands.md)
|
|
234
|
+
- [Configuration](../reference/configuration.md)
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
# Customizing bundled agents
|
|
2
|
+
|
|
3
|
+
[Documentation index](../README.md)
|
|
4
|
+
|
|
5
|
+
Matching project and global definitions partially overlay lower-precedence
|
|
6
|
+
roles, in the order `bundled < project < global`.
|
|
7
|
+
|
|
8
|
+
This allows local customization while continuing to inherit future bundled
|
|
9
|
+
changes for omitted fields.
|
|
10
|
+
|
|
11
|
+
## Minimal model override
|
|
12
|
+
|
|
13
|
+
```markdown
|
|
14
|
+
---
|
|
15
|
+
name: reviewer
|
|
16
|
+
model: openai-codex/gpt-5.6-luna
|
|
17
|
+
thinking: high
|
|
18
|
+
---
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The bundled reviewer body and omitted frontmatter remain inherited.
|
|
22
|
+
|
|
23
|
+
## Frontmatter merge rules
|
|
24
|
+
|
|
25
|
+
For a matching higher-precedence definition:
|
|
26
|
+
|
|
27
|
+
- omitted fields inherit;
|
|
28
|
+
- strings and booleans replace;
|
|
29
|
+
- arrays replace wholesale, including `[]`;
|
|
30
|
+
- the complete effective definition is validated after composition.
|
|
31
|
+
|
|
32
|
+
`enabled` is a boolean that defaults to `true`. Use it in a minimal override to
|
|
33
|
+
disable a bundled role without copying its body or other frontmatter:
|
|
34
|
+
|
|
35
|
+
```markdown
|
|
36
|
+
---
|
|
37
|
+
name: reviewer
|
|
38
|
+
enabled: false
|
|
39
|
+
---
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
The disabled row remains visible to the lead Pi session, while owner-visible
|
|
43
|
+
definition lists omit it. A delegating worker referencing a disabled worker can remain
|
|
44
|
+
discoverable, but is rejected during assignment or fresh worker startup with an
|
|
45
|
+
explicit disabled-worker reason.
|
|
46
|
+
|
|
47
|
+
There is no compatibility layer or second definition registry.
|
|
48
|
+
|
|
49
|
+
## Body composition
|
|
50
|
+
|
|
51
|
+
An empty higher-precedence body inherits the lower-layer body.
|
|
52
|
+
|
|
53
|
+
A non-empty overlay body replaces it by default:
|
|
54
|
+
|
|
55
|
+
```markdown
|
|
56
|
+
---
|
|
57
|
+
name: reviewer
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
Use this completely different reviewer behavior.
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Use `bodyMode: append` to preserve the lower-layer body and add local behavior:
|
|
64
|
+
|
|
65
|
+
```markdown
|
|
66
|
+
---
|
|
67
|
+
name: reviewer
|
|
68
|
+
bodyMode: append
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
Also verify database migrations.
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
When both bodies are non-empty, append mode produces one blank line between the
|
|
75
|
+
bundled and override bodies.
|
|
76
|
+
|
|
77
|
+
`bodyMode` is valid only when a definition overlays an existing lower-layer
|
|
78
|
+
definition. Interactive edits in the Definitions UI always write global
|
|
79
|
+
overrides.
|
|
80
|
+
It is consumed during definition composition and does not become runtime
|
|
81
|
+
frontmatter.
|
|
82
|
+
|
|
83
|
+
## Runtime system-prompt composition
|
|
84
|
+
|
|
85
|
+
`bodyMode` and `systemPromptMode` solve different problems:
|
|
86
|
+
|
|
87
|
+
```text
|
|
88
|
+
lower-layer body + overlay body
|
|
89
|
+
↓ bodyMode
|
|
90
|
+
effective definition body
|
|
91
|
+
↓ systemPromptMode
|
|
92
|
+
Pi base system prompt
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
`systemPromptMode: replace` sends the effective body as Pi's replacement system
|
|
96
|
+
prompt.
|
|
97
|
+
|
|
98
|
+
`systemPromptMode: append` appends the effective body to Pi's normal system
|
|
99
|
+
prompt.
|
|
100
|
+
|
|
101
|
+
Managed workers additionally receive shared herdr worker guidance at launch,
|
|
102
|
+
including the `ask_owner` contract. This shared guidance is infrastructure and
|
|
103
|
+
is not copied into every bundled role body.
|
|
104
|
+
|
|
105
|
+
## Add local body files
|
|
106
|
+
|
|
107
|
+
```markdown
|
|
108
|
+
---
|
|
109
|
+
name: reviewer
|
|
110
|
+
bodyMode: append
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
@./prompts/local-review-policy.md
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
The path is resolved relative to the declaring project or global file before
|
|
117
|
+
body composition, so each layer preserves its own declaring-file provenance.
|
|
118
|
+
|
|
119
|
+
References expand when each new worker generation is constructed. A session
|
|
120
|
+
continuation keeps the saved Pi history but uses the current effective
|
|
121
|
+
definition configuration for its new generation.
|
|
122
|
+
|
|
123
|
+
See [Handoffs and files](handoffs.md).
|
|
124
|
+
|
|
125
|
+
## Local tools, skills, and extensions
|
|
126
|
+
|
|
127
|
+
Bundled definitions are portable by design. Add repository-specific
|
|
128
|
+
capabilities in a matching project definition, or user-specific final
|
|
129
|
+
capabilities in a matching global override.
|
|
130
|
+
|
|
131
|
+
Example:
|
|
132
|
+
|
|
133
|
+
```markdown
|
|
134
|
+
---
|
|
135
|
+
name: reviewer
|
|
136
|
+
bodyMode: append
|
|
137
|
+
tools: ["read", "bash", "my_local_tool"]
|
|
138
|
+
skills: ["/absolute/path/to/code-review/SKILL.md"]
|
|
139
|
+
extensions: ["/absolute/path/to/local-extension.ts"]
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
Use my local tool only when it materially improves the review.
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
`extensions` loads the extension code, while `tools` controls which registered
|
|
146
|
+
tool names are callable by the model. Extension-provided tools use the same
|
|
147
|
+
name-based policy as built-in and custom tools, so an extension tool omitted
|
|
148
|
+
from an explicit allowlist is unavailable to the model (and an exclusion wins).
|
|
149
|
+
This does not sandbox the extension: its handlers, commands, shortcuts,
|
|
150
|
+
providers, and other non-tool behavior may still run.
|
|
151
|
+
|
|
152
|
+
Pi Herdsman passes this native policy through rather than maintaining a second
|
|
153
|
+
tool registry. Provider or conversion integrations can have their own
|
|
154
|
+
presentation layer, so their displayed tool set may require separate
|
|
155
|
+
integration-level verification; loaded provider code is not sandboxed by this
|
|
156
|
+
setting.
|
|
157
|
+
|
|
158
|
+
An explicit `tools` list controls selection even when `noTools` or
|
|
159
|
+
`noBuiltinTools` also selects restrictive defaults, while `excludeTools` wins
|
|
160
|
+
over the list. Managed workers retain `ask_owner` as mandatory infrastructure
|
|
161
|
+
and remove it from explicit exclusions; this exception does not apply to
|
|
162
|
+
unmanaged Pi launches. Same-named tools cannot be permissioned by source, and
|
|
163
|
+
collision winner ordering is not promised. Launcher-injected worker and
|
|
164
|
+
Herdr-state extensions are separate from definition extensions and remain
|
|
165
|
+
available when `noExtensions` disables ordinary discovery.
|
|
166
|
+
|
|
167
|
+
For an integration-level smoke check, load the repository's
|
|
168
|
+
`scripts/tool-policy-diagnostic.mjs` extension and set `POLICY_EVIDENCE`,
|
|
169
|
+
`POLICY_LAUNCH`, `POLICY_ACTIVE`, `POLICY_PROVIDER`, and `POLICY_FORBIDDEN` to
|
|
170
|
+
the expected tool-name sets before launching Pi with the same `--tools` and
|
|
171
|
+
extension arguments as the target agent. The diagnostic asserts the launch
|
|
172
|
+
allowlist and active set, records callable provider names and tool-call
|
|
173
|
+
outcomes, fails on forbidden active/provider/call names, and can verify an
|
|
174
|
+
allowed control with
|
|
175
|
+
`POLICY_CONTROL`; it does not capture prompts or secrets. The hook observes
|
|
176
|
+
Pi's provider-request payload, not a provider's final HTTP or WebSocket
|
|
177
|
+
serialization.
|
|
178
|
+
|
|
179
|
+
The same diagnostic's no-network negative probe can be run with
|
|
180
|
+
`node scripts/tool-policy-diagnostic.mjs --dispatch-check`; it emits a
|
|
181
|
+
deterministic forbidden `exec_command` call into an empty tool context and
|
|
182
|
+
asserts Pi returns `Tool exec_command not found` without execution.
|
|
183
|
+
|
|
184
|
+
Remember that arrays replace the bundled array rather than append to it.
|
|
185
|
+
Explicitly include every value you want in the effective array.
|
|
186
|
+
|
|
187
|
+
Skill and extension paths are passed to Pi unchanged; unlike body `@file`
|
|
188
|
+
references, herdr does not resolve them relative to the definition file.
|
|
189
|
+
|
|
190
|
+
## Interactive agent settings
|
|
191
|
+
|
|
192
|
+
Lead Pi sessions with UI can use:
|
|
193
|
+
|
|
194
|
+
```text
|
|
195
|
+
/workers agents
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
The native Definitions menu lists bundled, project, and global participation.
|
|
199
|
+
Project participation is marked `[project]`; a global override adds `*`, so
|
|
200
|
+
`[project] *` means both layers contribute. Select a
|
|
201
|
+
definition to open:
|
|
202
|
+
|
|
203
|
+
```text
|
|
204
|
+
Model
|
|
205
|
+
Thinking
|
|
206
|
+
Enabled
|
|
207
|
+
Details…
|
|
208
|
+
Back
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Model and thinking each offer `Use default` plus their available values.
|
|
212
|
+
Selecting `Use default` removes only that field. The model chooser stores the
|
|
213
|
+
canonical provider/model token; thinking uses the selected model's supported
|
|
214
|
+
levels when available. `Enabled` toggles the definition.
|
|
215
|
+
|
|
216
|
+
Edits always write global overrides, and standalone custom definitions can be
|
|
217
|
+
edited through the same flow.
|
|
218
|
+
|
|
219
|
+
It changes only the selected top-level line in the global Markdown override and
|
|
220
|
+
preserves unrelated frontmatter, line endings, and body content.
|
|
221
|
+
|
|
222
|
+
Removing a saved field from a bundled definition restores its bundled value.
|
|
223
|
+
Removing a field from a standalone definition uses Pi's normal default. The
|
|
224
|
+
override file is not deleted.
|
|
225
|
+
|
|
226
|
+
Enable and disable write the scalar `enabled` field in the same global override.
|
|
227
|
+
Removing that field inherits the bundled value, or `true` when no source
|
|
228
|
+
declares it.
|
|
229
|
+
|
|
230
|
+
Changes affect future definition delegations and session continuations, whose
|
|
231
|
+
runtime configuration comes from the current effective definition. They do not
|
|
232
|
+
mutate an already-running worker or the lead Pi session.
|
|
233
|
+
|
|
234
|
+
## See also
|
|
235
|
+
|
|
236
|
+
- [Agent-definition schema](../reference/agent-definition-schema.md)
|
|
237
|
+
- [`/workers` commands](../reference/commands.md)
|
|
238
|
+
- [Agent definitions](agent-definitions.md)
|