pi-herdsman 0.18.0 → 0.19.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/README.md +66 -186
- package/SKILL.md +105 -150
- package/dist/index.js +4468 -1259
- package/dist/index.js.map +4 -4
- package/docs/README.md +39 -83
- package/docs/adr/0001-keep-semantic-result-references-model-facing.md +63 -0
- package/docs/adr/0002-persist-intent-and-derive-runtime-state.md +30 -0
- package/docs/adr/0003-use-durable-ownership-for-agent-scope.md +28 -0
- package/docs/adr/0004-separate-delegation-from-continuation.md +28 -0
- package/docs/adr/0005-use-files-for-explicit-evidence-handoffs.md +41 -0
- package/docs/adr/0006-use-operation-specific-semantic-tools.md +30 -0
- package/docs/adr/0007-store-durable-state-under-pi-agent-data.md +28 -0
- package/docs/adr/0008-prefer-native-pi-and-herdr-contracts.md +28 -0
- package/docs/adr/0009-preserve-prompt-cache-continuity.md +81 -0
- package/docs/adr/0010-retire-managed-agent-sessions-before-threshold-compaction.md +109 -0
- package/docs/adr/0011-use-progressive-disclosure-and-single-owner-documentation.md +48 -0
- package/docs/adr/0012-manager-owns-project-assignment-resolution.md +52 -0
- package/docs/adr/0013-use-herdr-worktree-removal-for-project-retirement.md +35 -0
- package/docs/concepts/agents.md +1 -1
- package/docs/concepts/coordination.md +177 -0
- package/docs/concepts/delegation.md +8 -4
- package/docs/concepts/lifecycle.md +1 -2
- package/docs/coordination-api.md +93 -0
- package/docs/development/documentation.md +100 -108
- package/docs/development/instruction-interface-design.md +10 -0
- package/docs/development/smoke-testing.md +31 -12
- package/docs/development/validation.md +8 -4
- package/docs/getting-started.md +61 -111
- package/docs/guides/handoffs.md +47 -35
- package/docs/guides/project-orchestration.md +129 -0
- package/docs/reference/agent.md +8 -6
- package/docs/reference/ask-owner.md +3 -3
- package/docs/reference/commands.md +62 -4
- package/docs/reference/configuration.md +7 -4
- package/docs/reference/peer.md +22 -49
- package/docs/reference/staff.md +143 -0
- package/docs/reference/status-widget.md +47 -11
- package/docs/reference/supervisor.md +63 -0
- package/package.json +13 -13
- package/docs/agent-api.md +0 -103
- package/docs/concepts/supervision.md +0 -119
- package/docs/reference/supervision.md +0 -288
package/README.md
CHANGED
|
@@ -7,246 +7,126 @@
|
|
|
7
7
|
[](https://github.com/boadij/pi-herdsman/actions/workflows/validate.yml)
|
|
8
8
|
[](LICENSE)
|
|
9
9
|
|
|
10
|
-
**
|
|
10
|
+
**The orchestration layer between [Pi](https://github.com/earendil-works/pi) and [herdr](https://github.com/herdrdev/herdr).**
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
coding agents in parallel, nest delegation, steer active agents, route
|
|
18
|
-
questions and results back to their owning agent, and supervise multiple leads
|
|
19
|
-
through one coordinated hierarchy.
|
|
20
|
-
|
|
21
|
-
Use it in an existing Pi/herdr setup or deploy the SSH-ready container as a
|
|
22
|
-
portable remote coding-agent environment. [herdr Machines](https://herdr.dev/docs/connecting-machines/)
|
|
23
|
-
can bring local and remote workspaces and agents into one herdr window over
|
|
24
|
-
normal SSH.
|
|
25
|
-
|
|
26
|
-
Pi Herdsman calls its managed subagents **agents**.
|
|
27
|
-
|
|
28
|
-
```text
|
|
29
|
-
You ↔ lead
|
|
30
|
-
├─ agent
|
|
31
|
-
│ └─ agent
|
|
32
|
-
└─ agent
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
A lead and its nested agent hierarchy form a herd, Herdsman's model of an
|
|
36
|
-
agent fleet.
|
|
37
|
-
|
|
38
|
-
Pi Herdsman is opinionated about coordination, not workflow. A lead owns its
|
|
39
|
-
agents, and a delegation-enabled agent may own permitted agents of its own.
|
|
40
|
-
Agent definitions, models, tools, extensions, and development process remain up
|
|
41
|
-
to you.
|
|
12
|
+
Pi Herdsman turns independent Pi sessions into a coordinated agent system, from
|
|
13
|
+
one background Agent to parallel branch-based project work. Pi owns each
|
|
14
|
+
coding-agent conversation; herdr owns processes, panes, workspaces, and worktree
|
|
15
|
+
placement; Herdsman connects them through delegation, ownership, supervision,
|
|
16
|
+
and project orchestration.
|
|
42
17
|
|
|
43
18
|
## Demo
|
|
44
19
|
|
|
20
|
+
_Concept animation, not a live recording._
|
|
21
|
+
|
|
45
22
|

|
|
46
23
|
|
|
47
|
-
##
|
|
24
|
+
## What Pi Herdsman gives you
|
|
25
|
+
|
|
26
|
+
- **Background Agents.** Delegate bounded work without blocking the Lead conversation.
|
|
27
|
+
- **Parallel and nested delegation.** Run independent work concurrently and let explicitly enabled Agents delegate their own bounded subtasks.
|
|
28
|
+
- **Project orchestration.** A Manager coordinates durable branch-based work across independent Leads and their Agent trees.
|
|
29
|
+
- **Direct supervision.** Chief, Manager, Lead, and Agent responsibilities stay explicit instead of collapsing into one global controller.
|
|
30
|
+
- **Owned usage visibility.** Inspect Pi-native token usage and cost for the current session plus transitively owned managed-Agent sessions.
|
|
31
|
+
- **Your workflow stays yours.** Bring your own Agent definitions, models, tools, skills, extensions, and development process.
|
|
48
32
|
|
|
49
|
-
|
|
33
|
+
## Quick start
|
|
50
34
|
|
|
51
|
-
|
|
35
|
+
On Linux or macOS, install the released Pi, herdr, and Pi Herdsman stack:
|
|
52
36
|
|
|
53
37
|
```sh
|
|
54
38
|
curl -fsSL https://raw.githubusercontent.com/boadij/pi-herdsman/main/install.sh | sh
|
|
55
39
|
```
|
|
56
40
|
|
|
57
|
-
|
|
58
|
-
and Herdr versions declared by the current Pi Herdsman release, pins that Pi
|
|
59
|
-
Herdsman release, verifies the Herdr download, and refreshes the Herdr Pi
|
|
60
|
-
integration. Re-run it to update or repair the stack.
|
|
61
|
-
|
|
62
|
-
### Existing Pi / herdr
|
|
41
|
+
If you already manage Pi and herdr yourself:
|
|
63
42
|
|
|
64
43
|
```sh
|
|
65
44
|
pi install npm:pi-herdsman
|
|
66
45
|
herdr integration install pi
|
|
67
46
|
```
|
|
68
47
|
|
|
69
|
-
Start
|
|
48
|
+
Start herdr in your project, then start Pi inside its pane:
|
|
70
49
|
|
|
71
50
|
```sh
|
|
72
51
|
herdr
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
Then run Pi in the Herdr pane:
|
|
76
|
-
|
|
77
|
-
```sh
|
|
78
52
|
pi
|
|
79
53
|
```
|
|
80
54
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
For a self-contained, SSH-ready remote coding-agent environment, see
|
|
84
|
-
[Container deployment](docs/guides/container-deployment.md).
|
|
85
|
-
|
|
86
|
-
Once normal SSH access works, the same container can be saved as a herdr
|
|
87
|
-
machine:
|
|
88
|
-
|
|
89
|
-
```sh
|
|
90
|
-
herdr machine add ssh://herdsman@host:2222 --label my-herd
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
A host defined in normal SSH configuration can be used directly instead.
|
|
94
|
-
|
|
95
|
-
## Try it
|
|
96
|
-
|
|
97
|
-
Ask Pi normally:
|
|
98
|
-
|
|
99
|
-
```text
|
|
100
|
-
Use scout to inspect this repository.
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
That's enough. The agent runs asynchronously while the lead conversation remains
|
|
104
|
-
available.
|
|
105
|
-
|
|
106
|
-
Other useful requests look the same:
|
|
55
|
+
Delegate naturally:
|
|
107
56
|
|
|
108
57
|
```text
|
|
109
|
-
Use scout to
|
|
110
|
-
Have researcher verify the current upstream API behavior.
|
|
111
|
-
Have reviewer inspect this diff for correctness and unnecessary complexity.
|
|
112
|
-
Run scout and researcher independently while we continue planning here.
|
|
58
|
+
Use scout to inspect the authentication flow.
|
|
113
59
|
```
|
|
114
60
|
|
|
115
|
-
|
|
61
|
+
The Agent runs asynchronously while the Lead conversation stays available.
|
|
62
|
+
Open the human Agent-management surface at any time with:
|
|
116
63
|
|
|
117
64
|
```text
|
|
118
65
|
/agents
|
|
119
66
|
```
|
|
120
67
|
|
|
121
|
-
|
|
68
|
+
It also exposes `Session stats` for the current Pi session and its owned Agent sessions.
|
|
122
69
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
70
|
+
See [Getting started](docs/getting-started.md) for prerequisites, configuration,
|
|
71
|
+
observability, and the complete first-use path.
|
|
72
|
+
|
|
73
|
+
## From one Agent to a project
|
|
126
74
|
|
|
127
|
-
|
|
75
|
+
A normal Pi session is a **Lead**. It owns the Agents it delegates:
|
|
128
76
|
|
|
129
77
|
```text
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
└─ agents...
|
|
78
|
+
You ↔ Lead
|
|
79
|
+
├─ Agent
|
|
80
|
+
│ └─ Agent
|
|
81
|
+
└─ Agent
|
|
135
82
|
```
|
|
136
83
|
|
|
137
|
-
|
|
84
|
+
For independent project work, an eligible Lead can enter **Manager** mode.
|
|
85
|
+
Managers coordinate Leads instead of implementing through Agents themselves:
|
|
138
86
|
|
|
139
87
|
```text
|
|
140
|
-
|
|
88
|
+
You ↔ Manager
|
|
89
|
+
├─ Lead → Agents
|
|
90
|
+
└─ Lead → Agents
|
|
141
91
|
```
|
|
142
92
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
For the complete walkthrough, see [Getting started](docs/getting-started.md).
|
|
147
|
-
|
|
148
|
-
## Why Pi Herdsman?
|
|
149
|
-
|
|
150
|
-
- **Async subagents by default.** Assignments return after acceptance while agents keep
|
|
151
|
-
running and the owning lead session remains available. Results and owner
|
|
152
|
-
questions return when they need attention.
|
|
153
|
-
- **One assignment per agent.** Each managed agent generation handles one
|
|
154
|
-
bounded assignment, delivers its terminal result, and is cleaned up. Continue
|
|
155
|
-
completed context with `agent_continue` and the exact returned Pi session.
|
|
156
|
-
- **Nested multi-agent orchestration.** Delegation-enabled agents can own and manage
|
|
157
|
-
permitted agents themselves. Identity, ownership, steering, clarification,
|
|
158
|
-
results, and cleanup share the same lifecycle across the hierarchy.
|
|
159
|
-
- **Your workflow stays yours.** Use the bundled portable roles, override them,
|
|
160
|
-
or bring your own definitions, models, tools, extensions, and process. Pi
|
|
161
|
-
Herdsman does not prescribe a plan, implementation, or review workflow.
|
|
162
|
-
- **Small and disciplined.** Pi Herdsman focuses on orchestration semantics.
|
|
163
|
-
herdr manages physical sessions and placement; Pi keeps owning each
|
|
164
|
-
conversation and turn state.
|
|
165
|
-
|
|
166
|
-
See [Lifecycle](docs/concepts/lifecycle.md) for the exact asynchronous contract.
|
|
167
|
-
|
|
168
|
-
## How it works
|
|
169
|
-
|
|
170
|
-
Pi Herdsman deliberately separates three responsibilities:
|
|
171
|
-
|
|
172
|
-
- **herdr** owns physical agent lifecycle and placement.
|
|
173
|
-
- **Pi Herdsman** owns assignment, clarification, result, and control
|
|
174
|
-
coordination.
|
|
175
|
-
- **Pi** owns each session and turn state.
|
|
93
|
+
A **Chief** is an optional runtime-wide supervisor above Managers. Without an
|
|
94
|
+
active Manager for a project, Chief can directly supervise its ordinary Leads.
|
|
176
95
|
|
|
177
|
-
The
|
|
178
|
-
`agent_delegate`, `agent_continue`, `agent_steer`, `agent_interrupt`,
|
|
179
|
-
`agent_reply`, `agent_close`, `agent_inspect`, and `agent_transcript` manage
|
|
180
|
-
owned agents; `supervisor_message` and `supervisor_ask` contact the direct
|
|
181
|
-
supervisor; `peer_list` and `peer_message` coordinate between ordinary Leads;
|
|
182
|
-
`staff_list`, `staff_inspect`, `staff_transcript`, `staff_message`, and
|
|
183
|
-
`staff_reply` let the active Chief supervise Leads. Managed agents can use
|
|
184
|
-
`ask_owner` to ask their exact owner. Peer and staff targets use exact Pi
|
|
185
|
-
session IDs in `session`. Agent labels are not continuation handles: use the
|
|
186
|
-
exact Pi session ID with `agent_continue`. A continued session reuses its saved
|
|
187
|
-
logical label. Exact herdr identifiers are validation evidence behind live
|
|
188
|
-
agent and lead identity.
|
|
96
|
+
The important boundaries are:
|
|
189
97
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
## Requirements
|
|
195
|
-
|
|
196
|
-
- [herdr](https://github.com/herdrdev/herdr) `>=0.9.1`
|
|
197
|
-
- Pi `>=0.87.0 <0.88.0` (supported)
|
|
198
|
-
- Node `>=22.19.0`
|
|
199
|
-
|
|
200
|
-
Package CI validates the minimum supported Node 22.19.0 runtime. The container
|
|
201
|
-
separately ships and validates Node 26.
|
|
202
|
-
|
|
203
|
-
Install or refresh the herdr Pi integration:
|
|
204
|
-
|
|
205
|
-
```sh
|
|
206
|
-
herdr integration install pi
|
|
207
|
-
herdr integration status
|
|
98
|
+
```text
|
|
99
|
+
supervision: Chief → Manager → Lead
|
|
100
|
+
ownership: Lead → Agent → Agent
|
|
208
101
|
```
|
|
209
102
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
## Compatible extensions
|
|
214
|
-
|
|
215
|
-
Pi Herdsman interoperates with optional Pi extensions without depending on
|
|
216
|
-
them:
|
|
217
|
-
|
|
218
|
-
- [pi-web-access](https://github.com/nicobailon/pi-web-access) — the bundled
|
|
219
|
-
`researcher` recognizes its standard web-research tools.
|
|
220
|
-
- [pi-permission-system](https://github.com/gotgenes/pi-packages/tree/main/packages/pi-permission-system)
|
|
221
|
-
— shared agent frontmatter, active-agent identity, and subagent lineage
|
|
222
|
-
conventions support per-agent permission policy.
|
|
223
|
-
|
|
224
|
-
Neither extension is required or installed by Pi Herdsman.
|
|
103
|
+
Project work is durable by Git branch. It does not belong to the Manager session
|
|
104
|
+
that happened to start it, so work can be paused, resumed, completed, or
|
|
105
|
+
reconciled across Manager turnover.
|
|
225
106
|
|
|
226
|
-
|
|
107
|
+
See [Coordination](docs/concepts/coordination.md) for the mental model and
|
|
108
|
+
[Project orchestration](docs/guides/project-orchestration.md) for the Manager
|
|
109
|
+
workflow.
|
|
227
110
|
|
|
228
|
-
Choose
|
|
111
|
+
## Choose your next step
|
|
229
112
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
- **Developing Pi Herdsman:** [Documentation index](docs/README.md) and
|
|
240
|
-
[development validation](docs/development/validation.md).
|
|
113
|
+
| Goal | Start here |
|
|
114
|
+
| ------------------------------------------ | ------------------------------------------------------------- |
|
|
115
|
+
| Install and delegate your first task | [Getting started](docs/getting-started.md) |
|
|
116
|
+
| Run independent branch-based project work | [Project orchestration](docs/guides/project-orchestration.md) |
|
|
117
|
+
| Understand roles, ownership, and authority | [Coordination](docs/concepts/coordination.md) |
|
|
118
|
+
| Customize Agents | [Agent definitions](docs/guides/agent-definitions.md) |
|
|
119
|
+
| Build against the model-facing tools | [Coordination API](docs/coordination-api.md) |
|
|
120
|
+
| Deploy an SSH-ready environment | [Container deployment](docs/guides/container-deployment.md) |
|
|
121
|
+
| Contribute to Pi Herdsman | [Documentation index](docs/README.md#develop-pi-herdsman) |
|
|
241
122
|
|
|
242
|
-
##
|
|
123
|
+
## Community
|
|
243
124
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
final pre-commit mutation, followed only by the read-only checks `npm run check`
|
|
247
|
-
and `git diff --check`.
|
|
125
|
+
Questions, workflows, examples, and ideas are welcome in
|
|
126
|
+
[GitHub Discussions](https://github.com/boadij/pi-herdsman/discussions).
|
|
248
127
|
|
|
249
|
-
|
|
128
|
+
For reproducible bugs and concrete actionable work, use
|
|
129
|
+
[GitHub Issues](https://github.com/boadij/pi-herdsman/issues).
|
|
250
130
|
|
|
251
131
|
## License
|
|
252
132
|
|
package/SKILL.md
CHANGED
|
@@ -26,16 +26,19 @@ Coordinate managed agents.
|
|
|
26
26
|
|
|
27
27
|
Use these high-salience rules for the model-facing agent boundary:
|
|
28
28
|
|
|
29
|
-
-
|
|
30
|
-
|
|
29
|
+
- Delegate bounded execution work when an Agent can reasonably own it and
|
|
30
|
+
delegation is useful. Keep work local when it is trivial, inseparable from
|
|
31
|
+
work you must own, otherwise unsuitable for an Agent, or delegation would add
|
|
32
|
+
more coordination than value.
|
|
31
33
|
- Each unresolved unit of work has one executor. Delegating a scope transfers
|
|
32
34
|
its execution ownership to that agent until the assignment resolves; do not
|
|
33
35
|
execute or assign overlapping work while it is delegated.
|
|
34
|
-
- For
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
conversation or attachments
|
|
38
|
-
|
|
36
|
+
- For any coordination tool that accepts `files`, pass every user-supplied or
|
|
37
|
+
already-available artifact relevant to what the recipient must do or decide
|
|
38
|
+
through `files`. Do not assume another session inherits the sender's
|
|
39
|
+
conversation or attachments. Preserve exact supplied result refs when
|
|
40
|
+
forwarding them and omit unrelated evidence. `files` carries evidence, not
|
|
41
|
+
runtime capability.
|
|
39
42
|
- When agent work is unresolved, handle required agent control, then continue
|
|
40
43
|
only necessary work you still own or end the turn without concluding; agent
|
|
41
44
|
results or attention will resume the session automatically. Do not check
|
|
@@ -131,12 +134,6 @@ local references with byte size. Embedded text is snapshotted; referenced files
|
|
|
131
134
|
are not copied or snapshotted. files transfers inline content or canonical
|
|
132
135
|
references, not tools or runtime capabilities.
|
|
133
136
|
|
|
134
|
-
For agent handoffs, task text and `files` carry assignment-specific evidence.
|
|
135
|
-
`agent_continue` resumes an exact managed-agent Pi session. Fresh delegation does not
|
|
136
|
-
inherit the caller's conversation or caller-side attachments.
|
|
137
|
-
|
|
138
|
-
Pass relevant evidence explicitly through `files`; omit unrelated evidence.
|
|
139
|
-
|
|
140
137
|
Use the project-local `.pi-herdsman/` directory as the default workspace for
|
|
141
138
|
temporary coordination artifacts such as plans, scopes, specifications,
|
|
142
139
|
decisions, investigation notes, review criteria, validation notes, and handoff
|
|
@@ -173,11 +170,12 @@ delegated work.
|
|
|
173
170
|
|
|
174
171
|
<!-- pi-herdsman-runtime-lead:start -->
|
|
175
172
|
|
|
176
|
-
Own architecture, approved scope, acceptance, integration,
|
|
177
|
-
and final decisions
|
|
178
|
-
objective
|
|
179
|
-
|
|
180
|
-
|
|
173
|
+
Own architecture, approved scope, acceptance of Agent outputs, integration,
|
|
174
|
+
conflict resolution, and final technical decisions within your assigned
|
|
175
|
+
objective. Decompose only as far as useful. Assign bounded execution work to
|
|
176
|
+
the narrowest capable owner when delegation is useful and let delegation-enabled
|
|
177
|
+
agents own their permitted supporting agents. Reuse adequate existing evidence
|
|
178
|
+
instead of duplicating work.
|
|
181
179
|
|
|
182
180
|
<!-- pi-herdsman-runtime-lead:end -->
|
|
183
181
|
|
|
@@ -190,10 +188,11 @@ execution ownership to that agent until the assignment resolves; do not execute
|
|
|
190
188
|
or assign overlapping work while it is delegated.
|
|
191
189
|
Integrate direct agent results after resolution.
|
|
192
190
|
Own only the assigned objective and your direct permitted agents. Agent-started
|
|
193
|
-
agents are leaves.
|
|
194
|
-
|
|
195
|
-
rediscovering it. Integrate direct agent results before completing. The lead
|
|
196
|
-
retains architecture, approved scope, acceptance, and
|
|
191
|
+
agents are leaves. Delegate bounded execution work when an Agent can
|
|
192
|
+
reasonably own it and delegation is useful. Reuse adequate supplied evidence
|
|
193
|
+
rather than rediscovering it. Integrate direct agent results before completing. The lead
|
|
194
|
+
retains architecture, approved scope, acceptance of Agent outputs, and
|
|
195
|
+
final-decision authority.
|
|
197
196
|
Delegate only to definitions listed in your effective agents field. `ask_owner`
|
|
198
197
|
follows its normal eligibility rules when you have no unresolved direct-agent
|
|
199
198
|
work. If unresolved direct-agent work exists, every such agent must itself be
|
|
@@ -253,11 +252,14 @@ For product documentation, start at [docs/README.md](docs/README.md).
|
|
|
253
252
|
|
|
254
253
|
## Authority and decomposition
|
|
255
254
|
|
|
256
|
-
|
|
257
|
-
one bounded objective and the narrowest capable role. Delegate
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
255
|
+
As a Lead, keep authority, acceptance, and final decisions with you; give each agent
|
|
256
|
+
one bounded objective and the narrowest capable role. Delegate bounded execution
|
|
257
|
+
work when an Agent can reasonably own it and delegation is useful. Keep work local
|
|
258
|
+
when it is trivial, inseparable from work you must own, otherwise unsuitable for
|
|
259
|
+
an Agent, or delegation would add more coordination than value. Independence
|
|
260
|
+
determines parallelism, not delegation eligibility. Prefer agents for broad file
|
|
261
|
+
inspection, large logs or command output, and dataset analysis. Never overlap
|
|
262
|
+
writers in one worktree or file-ownership boundary.
|
|
261
263
|
|
|
262
264
|
## Assignment discipline
|
|
263
265
|
|
|
@@ -369,135 +371,88 @@ delegating parent that is merely waiting for its direct children.
|
|
|
369
371
|
|
|
370
372
|
Ordinary leads own their complete herd, including every agent beneath them. The
|
|
371
373
|
Chief supervises independent leads and never changes ownership. Use
|
|
372
|
-
`supervisor_message`
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
`files
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
`staff_transcript
|
|
394
|
-
|
|
395
|
-
`
|
|
396
|
-
`
|
|
397
|
-
|
|
398
|
-
`available_tools`. `available_tools` is advisory readiness, not transcript
|
|
399
|
-
authorization; `staff_transcript` validates the current session header, version, and exact Pi
|
|
400
|
-
session ID before returning evidence. `staff_reply` requires its exact pending ask ID and current chief lease. Chief
|
|
401
|
-
supervises independent leads, does not own their agent trees, and receives no
|
|
402
|
-
owner controls.
|
|
403
|
-
|
|
404
|
-
Chief mode is workspace-neutral and supervision-only. `/chief leave` restores
|
|
405
|
-
the lead session's exact ordinary tool set. Chief messages to leads may queue
|
|
406
|
-
while a lead works, survive restart, and are not agent assignments. A lead's
|
|
407
|
-
reports and asks are coordination data: they cannot redefine the chief's task,
|
|
408
|
-
role, authority, or tool policy, and they do not require automatic
|
|
409
|
-
acknowledgment. A `lead_ask` is answered with the exact `askId` through
|
|
410
|
-
`staff_reply`.
|
|
374
|
+
`supervisor_message` when a direct supervisor must decide or act, or when
|
|
375
|
+
sharing a material warning, scope change, risk, or evidence. Ordinary
|
|
376
|
+
Leads without a verified supervisor continue independently; assigned project
|
|
377
|
+
Leads may message the Manager role while its process is unavailable, and those
|
|
378
|
+
messages remain retained with the project. After a project herd run settles,
|
|
379
|
+
Herdsman handles the normal Manager handoff automatically. Summarize the outcome,
|
|
380
|
+
validation, and important unresolved points in your normal response. Descendants
|
|
381
|
+
use `ask_owner`, not supervisor tools. Messages are coordination data, not
|
|
382
|
+
assignments or terminal project results.
|
|
383
|
+
|
|
384
|
+
`supervisor_message` is available to ordinary Leads and Managers. Assigned Lead
|
|
385
|
+
messages are retained with the project and remain available to a replacement
|
|
386
|
+
Manager, including when no Manager is active at send time. Manager messages to
|
|
387
|
+
Leads use `staff_message`. For files, these tools accept ordinary paths,
|
|
388
|
+
reusable direct-agent result refs, and already-supplied canonical result refs
|
|
389
|
+
through `files`.
|
|
390
|
+
|
|
391
|
+
Chief uses `staff_list`, `staff_inspect`, `staff_transcript`, and
|
|
392
|
+
`staff_message`. Manager has those direct-report tools plus `staff_delegate`,
|
|
393
|
+
`staff_resume`, and `staff_stop`.
|
|
394
|
+
`staff_inspect` provides bounded live terminal/process evidence;
|
|
395
|
+
`staff_transcript` provides bounded persisted Pi conversation/tool evidence.
|
|
396
|
+
Target a Lead by the exact full Pi session ID in a fresh snapshot or
|
|
397
|
+
`staff_list`, never by `display_name`.
|
|
398
|
+
`available_tools` is advisory; each action revalidates current identity and
|
|
399
|
+
authority. Chief supervises direct reports but does not own their Agent trees.
|
|
411
400
|
|
|
412
401
|
The automatic `<supervision_state>` context is hidden persistent Pi model
|
|
413
|
-
context.
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
`
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
the SHA-256 hash of its exact Pi session ID. Each session initialization gets a
|
|
429
|
-
fresh `instanceId`; pending asks are restored from durable state, but the prior
|
|
430
|
-
state record is replaced. Transport records use the exact lead identity and
|
|
431
|
-
current chief lease; lead asks and replies additionally require the current
|
|
432
|
-
pending ask ID. The persisted role entry contains exactly a `role` and a
|
|
433
|
-
`leadTools` array. For Chief mode, `leadTools` is the exact ordinary Lead
|
|
434
|
-
loadout displaced by Chief activation and the fallback for stale Chief
|
|
435
|
-
transcript tool state; Pi remains authoritative for ordinary branch-local tool
|
|
436
|
-
state. Malformed role or coordination state records a durable error,
|
|
437
|
-
keeps ordinary agent control available, hides chief capability, and publishes
|
|
438
|
-
no authoritative lead record until clean state is established. Malformed or
|
|
439
|
-
stale state fails closed. Duplicate or ambiguous live or coordination evidence
|
|
440
|
-
is excluded rather than arbitrarily selected. A pending ask is separate
|
|
441
|
-
attention state and projects as `needs_you` with its bounded question and an
|
|
442
|
-
exact `staff_reply`, including after chief replacement. Coordination state contains
|
|
443
|
-
only its bounded version, instance ID, exact lead session ID, optional pending
|
|
444
|
-
ask, and update time. The lead rebuilds it from local Pi custom session state
|
|
445
|
-
and validates it against live identity. A failed publication invalidates the old
|
|
446
|
-
record and leaves the lead unhealthy. Queued messages remain valid across a
|
|
447
|
-
same-session process restart. Accepted IDs are deduplicated, transient
|
|
448
|
-
verification or delivery failures retain queued records for retry, and only
|
|
449
|
-
proven terminal mismatches are removed. Failed removal is marked by a durable
|
|
450
|
-
quarantine sidecar; marked records remain excluded, but one quarantined record
|
|
451
|
-
does not block a new message to that lead.
|
|
452
|
-
|
|
453
|
-
Every exact-identity-verified live lead exposes `staff_inspect` and `staff_message`,
|
|
454
|
-
regardless of observed runtime state (`idle|working|blocked|done|unknown`). A
|
|
455
|
-
non-empty persisted session candidate adds `staff_transcript` to
|
|
456
|
-
`available_tools`; a pending ask adds `staff_reply`. `available_tools` is
|
|
457
|
-
advisory readiness, not transcript authorization; the transcript action
|
|
458
|
-
validates the current session header, version, and exact Pi session ID before
|
|
459
|
-
returning evidence. Delivered content identifies direction and
|
|
460
|
-
model-visible sender and target identity; UI-only details do not establish it.
|
|
461
|
-
Supervision projects descendant lifecycle states exactly. `agent_counts` uses
|
|
462
|
-
`active`, `blocked`, and `total`; `active` counts `working`, `settling`, and
|
|
463
|
-
`starting` descendants. `needs_you` is attention state, not lifecycle. Lead and
|
|
464
|
-
Chief surfaces use one lifecycle vocabulary: `● working`, `◐ blocked`,
|
|
465
|
-
`◌ settling`, `◌ starting`, `○ idle`, `○ done`, `? unknown`, and `× lost`.
|
|
466
|
-
Chief rows use `!` for attention and preserve `◉` for idle/done leads with
|
|
467
|
-
active delegated descendants.
|
|
468
|
-
Chief messages never create agent lifecycle or assignment state. Existing
|
|
469
|
-
validated agent snapshots prove agent identity, generation, ownership, and
|
|
470
|
-
descendants. Runtime lifecycle is observation only. Internally use the
|
|
471
|
-
camelCase supervision model and serialize to snake_case only at the
|
|
472
|
-
model-facing tool boundary.
|
|
473
|
-
|
|
474
|
-
Only the chief lease uses the atomic complete-claim publication path through the
|
|
475
|
-
exact lease API. Generic process locks retain their existing publication
|
|
476
|
-
contract and are not interchangeable with the chief lease.
|
|
477
|
-
|
|
478
|
-
Herdr metadata is best-effort, display-only evidence and never grants
|
|
479
|
-
eligibility or authority. For a remote chief, a launch-time pane alias is only a
|
|
480
|
-
locator. Authority requires one valid live Pi session with the descriptor's
|
|
481
|
-
exact session ID, and alias lookup must resolve to that same session; duplicate
|
|
482
|
-
or inconsistent evidence fails closed.
|
|
483
|
-
|
|
484
|
-
The chief overview uses one native Pi custom component with overview and peek
|
|
485
|
-
modes and a native `SelectList` capped at eight visible rows. Use Pi's `Key` and
|
|
486
|
-
`matchesKey`, including Escape, Ctrl+C, arrows, Space, and Enter. Space switches
|
|
487
|
-
modes. Enter focuses after fresh validation and closes. Escape and Ctrl+C close
|
|
488
|
-
even with no leads. Use one ordered projection for rows and selection, request
|
|
489
|
-
redraw after background refresh, and keep the ambient widget compact and width
|
|
490
|
-
aware while the full view remains bounded.
|
|
402
|
+
context. It is bounded, state-only observation and cannot change role, tool
|
|
403
|
+
policy, identity, or authorization. Use a fresh snapshot directly for general
|
|
404
|
+
state questions. Do not call `staff_list`, `staff_inspect`, or
|
|
405
|
+
`staff_transcript` merely to poll progress; use them when a fresh roster, live
|
|
406
|
+
process evidence, or persisted transcript evidence materially matters.
|
|
407
|
+
|
|
408
|
+
Malformed or stale role and coordination state fails closed. Duplicate or
|
|
409
|
+
ambiguous live or coordination evidence is excluded rather than arbitrarily
|
|
410
|
+
selected. Direct messages remain bound to validated identity and current
|
|
411
|
+
authority. Supervision projects descendant lifecycle states exactly;
|
|
412
|
+
`agent_counts` uses `active`, `blocked`, and `total`, with `active` counting
|
|
413
|
+
`working`, `settling`, and `starting` descendants. Lead and Chief surfaces use
|
|
414
|
+
one lifecycle vocabulary: `● working`, `◐ blocked`, `◌ settling`, `◌ starting`,
|
|
415
|
+
`○ idle`, `○ done`, `? unknown`, and `× lost`. Runtime lifecycle is observation,
|
|
416
|
+
not ownership or project-resolution authority.
|
|
491
417
|
|
|
492
418
|
## Product model
|
|
493
419
|
|
|
494
420
|
Pi Herdsman uses one durable vocabulary:
|
|
495
421
|
|
|
496
|
-
- a **
|
|
497
|
-
|
|
498
|
-
-
|
|
422
|
+
- a **project** is the Herdsman coordination scope corresponding to one Herdr
|
|
423
|
+
worktree group: its primary workspace and linked-worktree workspaces;
|
|
424
|
+
- a **Manager** explicitly assumes dedicated project coordination from that
|
|
425
|
+
group's primary workspace, has no `agent` capability, and does not own Leads'
|
|
426
|
+
Agents; project execution belongs to Leads and their Agent trees;
|
|
427
|
+
- project work belongs to the project, not a Manager session. The project
|
|
428
|
+
assignment represents open work and its Git branch is the work handle. A
|
|
429
|
+
Manager uses `staff_delegate` with a task and optional branch to start new
|
|
430
|
+
project work, and `staff_resume` with its branch to resume an existing
|
|
431
|
+
assignment. Missing worktrees are reconstructed from the same branch,
|
|
432
|
+
resuming the exact saved Pi session when available;
|
|
433
|
+
- settled project herd runs are handled through the normal automatic Manager
|
|
434
|
+
handoff, and the Lead summarizes the outcome, validation, and important
|
|
435
|
+
unresolved points in its normal response;
|
|
436
|
+
assigned Lead `supervisor_message` calls are nonterminal coordination
|
|
437
|
+
retained across Manager absence and turnover. Project work remains open
|
|
438
|
+
through implementation and review iterations;
|
|
439
|
+
- `staff_stop` stops an exact Lead and its owned Agent tree while preserving
|
|
440
|
+
the assignment, Pi session, branch, and worktree. Successful Herdr worktree
|
|
441
|
+
removal retires the matching assignment and retained project messages while
|
|
442
|
+
preserving the Git branch. A missing worktree alone does not retire the
|
|
443
|
+
assignment; `staff_resume` can reconstruct it. Never infer ownership from
|
|
444
|
+
worktree membership or start an overlapping writer beside another Lead;
|
|
445
|
+
- `/manager leave` preserves project work; a later Manager can resume the same
|
|
446
|
+
branch-based assignment;
|
|
447
|
+
- a **herd** is one Lead and the complete Agent tree it owns;
|
|
448
|
+
- a **Lead** owns its Agents. An assigned project Lead sends
|
|
449
|
+
`supervisor_message` to project-scoped storage for the current or a
|
|
450
|
+
replacement Manager, even when no Manager is active; it does not route those
|
|
451
|
+
messages to Chief. An unassigned Lead routes to its active Manager when one
|
|
452
|
+
exists, otherwise to Chief;
|
|
453
|
+
- an **Agent** handles one bounded assignment and may delegate only when its
|
|
499
454
|
definition allows it;
|
|
500
|
-
- the **chief** supervises leads through the
|
|
455
|
+
- the **chief** supervises leads through the four `staff_*` semantic tools and
|
|
501
456
|
never owns their agents.
|
|
502
457
|
|
|
503
458
|
The `agents` frontmatter field names the direct agent definitions an agent may
|
|
@@ -515,8 +470,8 @@ projection removes it from an existing `tools` list. Ordinary `tools` and
|
|
|
515
470
|
omitted, Pi's configured/default selection is preserved without emitting
|
|
516
471
|
`--tools`; an explicit allowlist is augmented with the role-required tools.
|
|
517
472
|
|
|
518
|
-
The managed mailbox accepts only protocol
|
|
519
|
-
`mailboxes-
|
|
473
|
+
The managed mailbox accepts only protocol V5 agent records in the
|
|
474
|
+
`mailboxes-v5` runtime namespace. Identity and protocol validation fail closed.
|
|
520
475
|
|
|
521
476
|
The coordination directory is `.pi-herdsman/`. Use it for bounded artifacts and
|
|
522
477
|
handoffs, and pass canonical file references rather than duplicating large
|