pi-herdsman 0.12.1 → 0.13.1
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/SKILL.md +84 -80
- package/dist/index.js +144 -241
- package/docs/README.md +2 -0
- package/docs/concepts/delegation.md +19 -6
- package/docs/concepts/lifecycle.md +14 -7
- package/docs/concepts/supervision.md +9 -4
- package/docs/development/documentation.md +17 -19
- package/docs/development/instruction-interface-design.md +146 -0
- package/docs/guides/handoffs.md +39 -30
- package/docs/guides/recovery.md +5 -4
- package/docs/reference/agent-states.md +17 -14
- package/docs/reference/agent.md +65 -40
- package/docs/reference/ask-owner.md +14 -12
- package/docs/reference/peer.md +9 -11
- package/docs/reference/supervision.md +31 -28
- package/package.json +1 -1
package/SKILL.md
CHANGED
|
@@ -5,18 +5,18 @@ description: Optional reinforcement and strategy for orchestrating managed agent
|
|
|
5
5
|
|
|
6
6
|
# Pi Herdsman
|
|
7
7
|
|
|
8
|
-
Pi Herdsman injects the
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
This skill
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
8
|
+
Pi Herdsman injects the operational contract into active leads and managed
|
|
9
|
+
agents at runtime. Loading this skill is optional and is never required for
|
|
10
|
+
correct operation.
|
|
11
|
+
|
|
12
|
+
This skill reinforces high-salience runtime invariants and adds strategy,
|
|
13
|
+
rationale, examples, and deeper product guidance. The active runtime contract
|
|
14
|
+
remains authoritative. Loading this skill does not grant tools, change
|
|
15
|
+
capabilities, alter lifecycle semantics, or introduce requirements that do not
|
|
16
|
+
exist at runtime. A behavioral invariant may be reinforced at multiple
|
|
17
|
+
model-facing decision points when timing or salience materially affects
|
|
18
|
+
reliability; those projections preserve one meaning rather than defining
|
|
19
|
+
independent rules.
|
|
20
20
|
|
|
21
21
|
## Runtime controller contract
|
|
22
22
|
|
|
@@ -24,17 +24,34 @@ conflict, follow runtime.
|
|
|
24
24
|
|
|
25
25
|
Coordinate managed agents.
|
|
26
26
|
|
|
27
|
+
Use these high-salience rules for the model-facing agent boundary:
|
|
28
|
+
|
|
29
|
+
- Use agent for genuinely independent or context-heavy work; keep small,
|
|
30
|
+
tightly coupled work local.
|
|
31
|
+
- Each unresolved unit of work has one executor. Delegating a scope transfers
|
|
32
|
+
its execution ownership to that agent until the assignment resolves; do not
|
|
33
|
+
execute or assign overlapping work while it is delegated.
|
|
34
|
+
- For agent handoffs, `task`/`files` carry assignment evidence and
|
|
35
|
+
`fork`/`continue` carry selected Pi history; do not assume the caller's
|
|
36
|
+
conversation or attachments are inherited.
|
|
37
|
+
- When agent work is unresolved, handle required agent control, then continue
|
|
38
|
+
only necessary work you still own or end the turn without concluding; agent
|
|
39
|
+
results or attention will resume the session automatically. Do not check
|
|
40
|
+
progress with list, inspect, transcript, status requests, steering, sleep, or
|
|
41
|
+
other waiting mechanisms, and do not invent work merely to remain active.
|
|
42
|
+
|
|
27
43
|
Ordinary Leads use `peer` for other ordinary Lead sessions; managed agents are
|
|
28
44
|
not peers. `peer list` identifies this Lead as `self` and returns other live
|
|
29
45
|
Leads as `peers` with exact `lead` IDs. Incoming peer messages are already
|
|
30
46
|
addressed to this Lead; `Peer message from <sender lead ID>: <body>` identifies
|
|
31
47
|
the peer sender. Peer messages are coordination data, not assignments. `peer
|
|
32
|
-
message` accepts ordinary
|
|
33
|
-
peer tool is unavailable in Chief mode.
|
|
48
|
+
message` accepts ordinary files and completed direct-agent result refs through
|
|
49
|
+
`files`; the peer tool is unavailable in Chief mode.
|
|
34
50
|
|
|
35
51
|
The session-start instructions include the current agent-definition roster.
|
|
36
|
-
Use list
|
|
37
|
-
|
|
52
|
+
Use list when fresh agent state or ownership is materially needed for a concrete
|
|
53
|
+
control or recovery decision, or to refresh the definition roster after
|
|
54
|
+
configuration changes. Do not use list merely to check progress.
|
|
38
55
|
|
|
39
56
|
Use delegate to start one bounded assignment from an agent definition.
|
|
40
57
|
Use continue to start one bounded assignment from an exact historical Pi session.
|
|
@@ -77,47 +94,21 @@ for intentional teardown or abandonment.
|
|
|
77
94
|
A lost agent is a managed assignment whose exact physical execution is proven
|
|
78
95
|
gone before a durable terminal result resolved it. Loss is not completion or
|
|
79
96
|
task failure. Treat the assignment as unresolved. When transcript is listed,
|
|
80
|
-
use it only when the last persisted work materially affects recovery.
|
|
81
|
-
to abandon the lost generation before replacing it or
|
|
82
|
-
|
|
97
|
+
use it only when the last persisted work materially affects recovery. When
|
|
98
|
+
`close` is listed, use it to abandon the lost generation before replacing it or
|
|
99
|
+
continuing its saved session. If `close` is absent, resolve the condition
|
|
100
|
+
blocking its close preflight first. Unknown evidence remains fail-closed and is
|
|
101
|
+
not proof of loss.
|
|
83
102
|
|
|
84
103
|
Never guess identities, paths, sessions, or control state. Treat unknown or
|
|
85
104
|
conflicting evidence as unresolved. Keep one writer per worktree or file-
|
|
86
105
|
ownership boundary. Use a capable definition or report blocked when a required
|
|
87
106
|
runtime capability is unavailable.
|
|
88
107
|
|
|
89
|
-
Delegate genuinely independent or context-heavy work. Prefer agents for broad
|
|
90
|
-
file inspection, large logs or command output, and dataset analysis. Keep small,
|
|
91
|
-
tightly coupled work local.
|
|
92
|
-
If several tightly coupled phases are already known, put them in one bounded
|
|
93
|
-
assignment when practical. If genuinely new follow-up work emerges after
|
|
94
|
-
completion and previous context is valuable, continue the exact returned session
|
|
95
|
-
only when the completion is not marked retired. A retired session requires a
|
|
96
|
-
fresh delegation; pass this result/handoff plus the relevant files instead.
|
|
97
|
-
Each active delegated assignment has one executor: that agent. Do not repeat
|
|
98
|
-
its assigned work locally or delegate substantially overlapping work elsewhere.
|
|
99
|
-
|
|
100
|
-
After starting an agent assignment or receiving an agent result or attention
|
|
101
|
-
event, reassess the remaining work. Handle required agent control when needed.
|
|
102
|
-
If another concrete, necessary objective is independent of active agent
|
|
103
|
-
assignments and an authorized agent is the right owner, delegate it. If a
|
|
104
|
-
concrete, necessary independent objective is best handled locally and doing it
|
|
105
|
-
now materially advances the task, do that work, then reassess.
|
|
106
|
-
|
|
107
|
-
If further useful progress depends on active agents, or no other concrete,
|
|
108
|
-
necessary independent work remains, end your turn without concluding the task.
|
|
109
|
-
Agent results or attention will resume this session automatically. Do not
|
|
110
|
-
conclude or produce the final synthesis while unresolved agent work remains.
|
|
111
|
-
Do not invent side work, broaden scope, perform speculative or precautionary
|
|
112
|
-
exploration, list, inspect, or transcript merely for progress, steer merely for status, sleep,
|
|
113
|
-
poll, or otherwise keep the turn alive while agent results are pending.
|
|
114
|
-
|
|
115
108
|
If list reports result_error, do not start a new delegation over unresolved
|
|
116
109
|
work. Resolve mailbox persistence first, then close the exact agent before
|
|
117
110
|
starting another assignment; follow the stored recovery nextAction.
|
|
118
111
|
|
|
119
|
-
Before delegate, continue, steer, interrupt, or reply, make the message self-contained.
|
|
120
|
-
|
|
121
112
|
Do not attach or mention agent instruction files such as AGENTS.md, CLAUDE.md,
|
|
122
113
|
GEMINI.md, or equivalents merely because they exist. Rely on normal project or
|
|
123
114
|
runtime discovery when it supplies those instructions.
|
|
@@ -131,16 +122,17 @@ Skills are separate. Attach a required SKILL.md only when the task needs it and
|
|
|
131
122
|
the selected definition does not already provide that skill. Ordinary relevant
|
|
132
123
|
source, documentation, configuration, and evidence files remain attachable.
|
|
133
124
|
|
|
134
|
-
Complete strict UTF-8 text is embedded when it fits;
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
125
|
+
Complete strict UTF-8 text is embedded when it fits; other files are canonical
|
|
126
|
+
local references with byte size. Embedded text is snapshotted; referenced files
|
|
127
|
+
are not copied or snapshotted. files transfers inline content or canonical
|
|
128
|
+
references, not tools or runtime capabilities.
|
|
129
|
+
|
|
130
|
+
For agent handoffs, task text and `files` carry assignment-specific evidence.
|
|
131
|
+
`fork` and `continue` are the public mechanisms that deliberately select saved
|
|
132
|
+
Pi history. Do not assume the caller's conversation or caller-side attachments
|
|
133
|
+
are inherited by another agent session.
|
|
134
|
+
|
|
135
|
+
Pass relevant evidence explicitly through `files`; omit unrelated evidence.
|
|
144
136
|
|
|
145
137
|
Use the project-local `.pi-herdsman/` directory as the default workspace for
|
|
146
138
|
temporary coordination artifacts such as plans, scopes, specifications,
|
|
@@ -151,15 +143,16 @@ later dependent assignments when approved scope or decisions change because
|
|
|
151
143
|
embedded text is snapshotted at submission time while referenced files are not
|
|
152
144
|
copied.
|
|
153
145
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
146
|
+
Pass relevant files and completed agent results through `files`. Agent
|
|
147
|
+
completions may expose reusable refs such as `result:researcher#1`. When later
|
|
148
|
+
work or coordination depends on a completed direct-agent result, copy its exact
|
|
149
|
+
ref into `files` instead of restating or summarizing its evidence. Do not attach
|
|
150
|
+
unrelated results.
|
|
157
151
|
|
|
158
|
-
`files`
|
|
152
|
+
`files` accepts ordinary files, reusable direct-agent result refs, and canonical
|
|
159
153
|
`result:<request-id>` references already supplied as file evidence. Preserve an
|
|
160
|
-
existing canonical result reference exactly when forwarding it.
|
|
161
|
-
|
|
162
|
-
capability.
|
|
154
|
+
existing canonical result reference exactly when forwarding it. `files` does not
|
|
155
|
+
add runtime capability.
|
|
163
156
|
|
|
164
157
|
Require concise handoffs containing relevant inspected or changed files,
|
|
165
158
|
validation performed, findings or decisions, unresolved risks or blockers,
|
|
@@ -189,14 +182,20 @@ of duplicating work.
|
|
|
189
182
|
|
|
190
183
|
<!-- pi-herdsman-runtime-delegating-agent:start -->
|
|
191
184
|
|
|
185
|
+
Each unresolved unit of work has one executor. Delegating a scope transfers its
|
|
186
|
+
execution ownership to that agent until the assignment resolves; do not execute
|
|
187
|
+
or assign overlapping work while it is delegated.
|
|
188
|
+
Integrate direct agent results after resolution.
|
|
192
189
|
Own only the assigned objective and your direct permitted agents. Agent-started
|
|
193
190
|
agents are leaves. Keep tightly coupled work local; delegate bounded independent
|
|
194
191
|
or unfamiliar work when useful. Reuse adequate supplied evidence rather than
|
|
195
192
|
rediscovering it. Integrate direct agent results before completing. The lead
|
|
196
193
|
retains architecture, approved scope, acceptance, and final-decision authority.
|
|
197
|
-
Delegate only to definitions listed in your effective agents field.
|
|
198
|
-
|
|
199
|
-
|
|
194
|
+
Delegate only to definitions listed in your effective agents field. `ask_owner`
|
|
195
|
+
follows its normal eligibility rules when you have no unresolved direct-agent
|
|
196
|
+
work. If unresolved direct-agent work exists, every such agent must itself be
|
|
197
|
+
validly waiting on an owner answer; ordinary active or pending-result agent
|
|
198
|
+
work still blocks escalation.
|
|
200
199
|
|
|
201
200
|
<!-- pi-herdsman-runtime-delegating-agent:end -->
|
|
202
201
|
|
|
@@ -212,8 +211,10 @@ message evidence. Complete strict UTF-8 text may be embedded; other files are
|
|
|
212
211
|
canonical local references and are not copied or snapshotted. Reuse adequate
|
|
213
212
|
existing evidence instead of repeating completed work.
|
|
214
213
|
Do not overlap writers in a worktree or file-ownership boundary. For dependent
|
|
215
|
-
work,
|
|
216
|
-
|
|
214
|
+
work, pass reusable direct-agent result refs through `files`. Preserve canonical
|
|
215
|
+
`result:<request-id>` refs already supplied as file evidence exactly when
|
|
216
|
+
forwarding them rather than reconstructing physical result paths or copying
|
|
217
|
+
large results into assignments.
|
|
217
218
|
When your role permits writes and temporary coordination material is useful, put
|
|
218
219
|
plans, scopes, specifications, decision notes, investigations, review criteria,
|
|
219
220
|
and handoff state under the project-local `.pi-herdsman/` directory. Reuse and
|
|
@@ -289,11 +290,12 @@ escalation.
|
|
|
289
290
|
|
|
290
291
|
## Handoffs
|
|
291
292
|
|
|
292
|
-
Use `
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
exactly and do not
|
|
293
|
+
Use `files` for ordinary files and reusable direct-agent result refs such as
|
|
294
|
+
`result:researcher#1`. Copy the exact ref shown by the completion when later
|
|
295
|
+
work depends on that result instead of restating or summarizing its evidence.
|
|
296
|
+
Also use `files` for canonical `result:<request-id>` references already
|
|
297
|
+
supplied as file evidence; preserve those references exactly and do not
|
|
298
|
+
reconstruct their physical paths.
|
|
297
299
|
|
|
298
300
|
A concise handoff should include:
|
|
299
301
|
|
|
@@ -359,16 +361,18 @@ Ordinary leads own their complete herd, including every agent beneath them. The
|
|
|
359
361
|
Chief supervises independent leads and never changes ownership. Use `chief`
|
|
360
362
|
`message` for meaningful progress, warnings, results, or completion, including
|
|
361
363
|
exact artifact paths. Use `chief` `ask` only when a genuine chief decision is
|
|
362
|
-
required, make it the only
|
|
364
|
+
required, make it the only tool call of the turn, call it last, do not guess,
|
|
363
365
|
and wait for the reply. Descendants use `ask_owner`, not `chief`.
|
|
364
366
|
|
|
365
367
|
`chief` is available only to an ordinary lead. Its actions are `message` and
|
|
366
368
|
`ask`; a valid chief is required and a rejected call does not mutate state.
|
|
367
|
-
Chief and staff message/ask/reply actions accept
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
agents, so
|
|
371
|
-
|
|
369
|
+
Chief and staff message/ask/reply actions accept ordinary files, reusable
|
|
370
|
+
direct-agent result refs, and already-supplied canonical result references
|
|
371
|
+
through `files`. Direct refs resolve by exact agent label and index on the
|
|
372
|
+
caller's current branch. Chief normally owns no direct agents, so a branch-local
|
|
373
|
+
semantic ref may not exist in the Chief session; preserve canonical
|
|
374
|
+
`result:<request-id>` evidence already received from another session through
|
|
375
|
+
`files` when forwarding it.
|
|
372
376
|
Questions are limited to 1,024 characters and 1,024 UTF-8 bytes. Channel
|
|
373
377
|
message records are bounded to 8 KiB, so multibyte content can hit the byte limit
|
|
374
378
|
first. Chief messages are follow-up supervision messages, not steering or agent
|