pi-herdsman 0.13.0 → 0.13.2

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.
@@ -89,8 +89,20 @@ Do not:
89
89
  - continue work that depends on an active agent result;
90
90
  - inspect, transcript, list, or steer active agents merely to check progress or completion.
91
91
 
92
- Direct ownership grants lifecycle and control authority. It does not make the
93
- owner a second executor of an active delegated assignment.
92
+ Each unresolved unit of work has exactly one executor.
93
+
94
+ Delegating a scope transfers execution ownership of that scope to the delegated
95
+ agent until the assignment resolves. The delegator retains responsibility for
96
+ coordination and may continue work it still owns, but it does not execute the
97
+ delegated scope or assign substantially overlapping work elsewhere.
98
+
99
+ After delegation succeeds, the delegated scope is no longer part of the
100
+ controller's execution scope. The controller may continue only concrete,
101
+ necessary work clearly outside that scope that it still owns; otherwise it ends
102
+ the turn and waits for automatic result or attention delivery.
103
+
104
+ After the assignment resolves, the delegator may integrate, validate,
105
+ synthesize, or assign follow-up work from the result.
94
106
 
95
107
  A useful parallel pattern is:
96
108
 
@@ -77,9 +77,16 @@ restart recovery. The agent then runs independently in its managed Pi session
77
77
  while the owner remains available for other useful work and, for a lead Pi
78
78
  session, continued user interaction.
79
79
 
80
- Each active delegated assignment has one executor: that agent. The owner retains
81
- lifecycle and control authority but does not repeat the delegated assignment
82
- locally or assign substantially overlapping work elsewhere.
80
+ During an active delegated assignment, the delegated agent is its executor. The
81
+ owner retains lifecycle and control authority; see [Delegation](delegation.md)
82
+ for the execution-ownership boundary.
83
+
84
+ Result delivery resolves that delegated execution ownership and enables the
85
+ owner to integrate the result before reassessing the remaining work.
86
+
87
+ After starting an assignment, remove its delegated scope from the controller's
88
+ execution scope immediately. Continue only necessary work the controller still
89
+ owns; otherwise end the turn.
83
90
 
84
91
  After starting an agent assignment or receiving an agent result or attention
85
92
  event, the owner reassesses the remaining work:
@@ -87,19 +94,24 @@ event, the owner reassesses the remaining work:
87
94
  1. Handle required agent control when needed.
88
95
  2. Delegate another concrete, necessary objective when it is independent of
89
96
  active assignments and an authorized agent is the right owner.
90
- 3. Continue concrete, necessary independent work locally when the owner is the
91
- right owner and doing it now materially advances the task.
97
+ 3. Continue only necessary work the controller still owns when the controller
98
+ is the right owner and doing it now materially advances the task.
92
99
  4. Otherwise end the turn.
93
100
 
94
101
  After control, delegation, or local parallel work, the owner reassesses again.
95
102
  Once further useful progress depends on active agents, or no other concrete,
96
- necessary independent work remains, it ends the turn. Agent results,
97
- clarifications, and recovery attention resume the session automatically.
103
+ necessary independent work remains, it ends the turn. Agent results or attention
104
+ will resume the session automatically.
98
105
 
99
106
  The owner does not invent side work merely because agents are running. It does
100
107
  not poll, sleep, inspect or transcript merely for progress, send status steering, or use
101
108
  another mechanism to keep the turn alive.
102
109
 
110
+ Routine progress checking remains prohibited. A stale health-attention event is
111
+ different: it is an unsolicited diagnostic boundary. Use its attached evidence
112
+ first; if that evidence is absent or insufficient, perform at most one bounded
113
+ diagnostic read before passive waiting.
114
+
103
115
  Health reconciliation follows the same boundary. It is event-driven, with a
104
116
  30-second fallback scan for durable and physical state that has not emitted a
105
117
  separate event. Each scan reconciles fresh mailbox and Herdr evidence for the
@@ -128,14 +140,25 @@ blocked while waiting for direct children is progress-capable and is not the
128
140
  same as Herdr reporting that the managed child runtime is blocked.
129
141
 
130
142
  When attention arrives, the owner handles a required action before ending the
131
- turn. For evidence, use `transcript` for persisted Pi conversation and tool
132
- history, and `inspect` for live terminal/process state. Leave healthy or
133
- legitimately long-running stale work alone. Use `steer` for a cooperative
134
- non-preemptive correction, `interrupt` to cancel the current operation,
135
- supersede earlier undelivered steering, and continue the same assignment,
136
- `close` to abandon an assignment, and
137
- `reply` only for the exact pending owner question. Do not poll or keep the turn
138
- alive solely to wait for agent progress.
143
+ turn. For stale attention:
144
+
145
+ 1. Read the bounded evidence supplied with the first stale attention.
146
+ 2. If that evidence is absent or insufficient, use one bounded diagnostic read:
147
+ `transcript` for persisted history or `inspect` for live terminal/process
148
+ state.
149
+ 3. If healthy or legitimately long-running, leave the agent alone.
150
+ 4. Use `steer` for a cooperative non-preemptive correction.
151
+ 5. Use `interrupt` only when the current operation must be abandoned; it cancels
152
+ the operation, supersedes earlier undelivered steering, and continues the
153
+ same assignment.
154
+ 6. Use `close` only when abandoning the assignment is intended.
155
+ 7. Do not repeat reads merely because the same stale episode was reminded
156
+ again.
157
+
158
+ For other attention, use `transcript` for persisted Pi conversation and tool
159
+ history and `inspect` for live terminal/process state as needed. Use `reply` only
160
+ for the exact pending owner question. Do not poll or keep the turn alive solely
161
+ to wait for agent progress.
139
162
 
140
163
  Conceptually:
141
164
 
@@ -85,34 +85,32 @@ Do not mix these procedures into normal user setup.
85
85
 
86
86
  ### `SKILL.md`
87
87
 
88
- Optional model-facing reinforcement of the self-contained runtime operational
89
- contract plus deeper strategy, rationale, examples, and recovery guidance.
88
+ Optional model-facing reinforcement of the runtime operational contract plus
89
+ deeper strategy, rationale, examples, and recovery guidance.
90
90
 
91
91
  It does not own product API schemas or runtime behavior.
92
92
 
93
- ## Runtime and skill synchronization
93
+ ## Runtime and skill authority
94
94
 
95
- Pi Herdsman has one deliberate instruction duplication.
95
+ Runtime behavior and runtime model contracts own operational semantics.
96
96
 
97
- The runtime controller and managed agent instructions are the authoritative,
98
- self-contained operational contract. Root `SKILL.md` intentionally mirrors
99
- those mandatory operational instructions so loading the skill can reinforce
100
- them in a long model context.
97
+ `SKILL.md` may reinforce high-salience runtime invariants and add strategy,
98
+ rationale, examples, and recovery detail, but it is not a second normative
99
+ owner.
101
100
 
102
- Therefore:
101
+ When runtime guidance changes:
103
102
 
104
- - every mandatory operational rule must exist at runtime;
105
- - corresponding operational guidance must remain represented in `SKILL.md`;
106
- - `SKILL.md` may add strategy, rationale, examples, and deeper explanation;
107
- - no capability or normal workflow may depend on loading `SKILL.md`;
108
- - runtime wins if the two surfaces conflict;
109
- - a change to either mirrored runtime or skill instructions requires checking
110
- the other side in the same change.
103
+ - update the authoritative runtime contract first;
104
+ - update affected skill or documentation projections;
105
+ - remove obsolete reinforcement rather than preserving historical wording;
106
+ - keep the runtime sufficient when `SKILL.md` is not loaded.
111
107
 
112
- This is intentional reinforcement, not competing authority.
108
+ A behavioral invariant may be reinforced at multiple model-facing decision
109
+ points when timing or salience materially affects reliability. Those projections
110
+ must preserve one meaning and must not evolve into independent rules.
113
111
 
114
- Do not replace it with runtime skill loading, generated prompt files, a prompt
115
- registry, or another synchronization subsystem.
112
+ Do not add runtime skill loading, prompt generation, or another synchronization
113
+ framework merely to keep prose copies aligned.
116
114
 
117
115
  ## Style
118
116
 
@@ -14,10 +14,19 @@ canonical local references and are not copied or snapshotted.
14
14
 
15
15
  ## Message `files`
16
16
 
17
- For `delegate`, `continue`, `steer`, `interrupt`, and
18
- `reply`, make the message self-contained. Do not attach or mention agent
19
- instruction files such as `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, or equivalents
20
- merely because they exist; rely on normal project or runtime discovery.
17
+ Agent-session context crosses boundaries explicitly.
18
+
19
+ - task or message text and `files` carry assignment-specific evidence;
20
+ - `fork` and `continue` deliberately select saved Pi history;
21
+ - the caller's conversation and caller-side attachments are not implicitly
22
+ copied into another agent session.
23
+
24
+ When a new or updated assignment depends on a caller-visible file, pass that
25
+ file through `files`.
26
+
27
+ Do not attach or mention agent instruction files such as `AGENTS.md`, `CLAUDE.md`,
28
+ `GEMINI.md`, or equivalents merely because they exist; rely on normal project
29
+ or runtime discovery.
21
30
 
22
31
  Attach an agent instruction file only when the task requires inspecting,
23
32
  modifying, comparing, or transmitting it, the user explicitly requests it, or
@@ -13,17 +13,20 @@ and it is published only when the owner is idle. Read the exact condition and
13
13
  the event's current `available_actions` before acting; the eventual action
14
14
  rechecks identity, ownership, mailbox state, and lifecycle.
15
15
 
16
- Use this decision sequence:
17
-
18
- 1. Need persisted conversation or tool history? Use `transcript`.
19
- 2. Need live terminal or process evidence? Use `inspect`.
20
- 3. Is the work healthy or legitimately long-running? Leave it alone.
21
- 4. Is a cooperative correction needed? Use `steer`.
22
- 5. Must the current operation itself be abandoned? Use `interrupt`; it cancels
16
+ For stale attention, use this decision sequence:
17
+
18
+ 1. Read the bounded evidence supplied with the first stale attention.
19
+ 2. If that evidence is absent or insufficient, use one bounded diagnostic read:
20
+ `transcript` for persisted history or `inspect` for live terminal/process
21
+ state.
22
+ 3. If healthy or legitimately long-running, leave the agent alone.
23
+ 4. Use `steer` for cooperative correction.
24
+ 5. Use `interrupt` only when the current operation must be abandoned; it cancels
23
25
  that operation, supersedes earlier undelivered steering, and continues the
24
26
  same assignment.
25
- 6. Is the assignment being abandoned? Use `close`.
26
- 7. Is an owner decision pending? Use `reply` for the exact pending question.
27
+ 6. Use `close` only when abandoning the assignment is intended.
28
+ 7. Do not repeat reads merely because the same stale episode was reminded
29
+ again.
27
30
 
28
31
  Persistent actionable conditions may repeat approximately `5m → 2m30s →
29
32
  1m15s → 1m`, with 30-second scan granularity. Reminder state is process-local
@@ -108,6 +108,9 @@ approximately `5m → 2m30s → 1m15s → 1m`, subject to the 30-second health s
108
108
  Leave healthy or legitimately long-running work alone. Use `transcript` for
109
109
  persisted evidence and `inspect` for live evidence; stale alone does not justify
110
110
  `interrupt` or `close`.
111
+ The stale episode is defined by its active request and last qualifying activity;
112
+ first-attention diagnosis is bounded, and repeated reminders do not automatically
113
+ repeat the live capture.
111
114
 
112
115
  ## See also
113
116
 
@@ -159,6 +159,12 @@ cadence is approximately `5m → 2m30s → 1m15s → 1m` with 30-second scan
159
159
  granularity. The first stale advisory remains eligible after ten minutes
160
160
  without qualifying execution progress.
161
161
 
162
+ The first stale attention for an episode attempts one bounded live inspect
163
+ capture when inspect is currently authorized. The automatic capture has a short
164
+ health-path deadline and does not change agent state. The stale message may
165
+ carry the same live evidence fields exposed by inspect. Repeated reminders for
166
+ the same episode do not automatically capture again.
167
+
162
168
  Generic attention reasons are:
163
169
 
164
170
  - `result_error`: a terminal result could not be durably persisted; follow the
@@ -185,11 +191,13 @@ first observes that the original ask was successfully delivered. The reminder
185
191
  path never duplicates first ask delivery. Unknown is the exception to repeated
186
192
  attention: it is one notification per unresolved physical-identity episode.
187
193
 
188
- For recovery evidence, use `transcript` for persisted Pi conversation and tool
189
- history, and `inspect` for live terminal/process evidence. Use `steer` for a
190
- cooperative correction. Use `interrupt` only to cancel the current operation;
191
- it supersedes earlier undelivered steering and continues the same durable
192
- assignment. Use `close` only when abandoning the
194
+ For stale recovery, use supplied evidence first. If it is absent or
195
+ insufficient, perform at most one bounded diagnostic read: `transcript` for
196
+ persisted conversation/tool history or `inspect` for live terminal/process
197
+ evidence. Do not repeat a read solely because the same stale episode was
198
+ reminded again. Use `steer` for a cooperative correction. Use `interrupt` only
199
+ to cancel the current operation; it supersedes earlier undelivered steering and
200
+ continues the same durable assignment. Use `close` only when abandoning the
193
201
  assignment is intended. Do not poll or create another delivery path for health
194
202
  attention.
195
203
 
@@ -257,6 +265,11 @@ limit permits. Otherwise they remain canonical references. Semantic direct refs
257
265
  are resolved on the current branch, while canonical `result:<request-id>` refs
258
266
  remain logical result references. `files` is a `string[]` for all three forms.
259
267
 
268
+ `files` is explicit per-message evidence. A fresh delegated session does not
269
+ implicitly receive the caller's conversation or caller-side attachments.
270
+ `fork` and `continue` are the mechanisms that deliberately reuse selected saved
271
+ Pi history.
272
+
260
273
  `timeoutMs` is valid on `delegate` and `continue` and must be an integer
261
274
  from `5001` through `300000`. The startup budget reserves one bounded diagnostic
262
275
  window; it is unrelated to managed-agent Pi shell execution. Direct calls from
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-herdsman",
3
- "version": "0.13.0",
3
+ "version": "0.13.2",
4
4
  "type": "module",
5
5
  "description": "Asynchronous Pi subagents and agent fleet orchestration with nested delegation, parallel execution, and supervision in herdr.",
6
6
  "license": "Apache-2.0",