@henryqw/pi-subagent 15.0.2 → 15.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/README.md
CHANGED
|
@@ -12,11 +12,13 @@ pi install npm:@henryqw/pi-task-models
|
|
|
12
12
|
pi install npm:@henryqw/pi-subagent
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
Run `/task-models` and configure the `fast` profile before delegating.
|
|
15
|
+
Run `/task-models` and configure the `fast` profile before delegating. Open `/task-models` again and verify that `fast` no longer says `not configured`.
|
|
16
16
|
|
|
17
17
|
## Works with
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
| Package | Relationship | Purpose |
|
|
20
|
+
| --- | --- | --- |
|
|
21
|
+
| [`@henryqw/pi-task-models`](https://pi.henry.wang/extensions/pi-task-models) | Required | Supplies `fast`, `balanced`, `frontier`, and `fav` model routes. |
|
|
20
22
|
|
|
21
23
|
Routes come from `~/.pi/agent/config/pi-task-models/config.json`. It stores explicit task overrides. Missing shared model config warns once because delegation needs a route.
|
|
22
24
|
|
|
@@ -76,7 +78,17 @@ See the [orchestration guide](./docs/orchestration.md) for full delegation, tran
|
|
|
76
78
|
|
|
77
79
|
### Skills
|
|
78
80
|
|
|
79
|
-
The bundled [`pi-subagent-delegated-development`](./skills/pi-subagent-delegated-development/SKILL.md) Skill guides Main's planning and orchestration. It adds no runtime code, config, or Role installation.
|
|
81
|
+
The bundled [`pi-subagent-delegated-development`](./skills/pi-subagent-delegated-development/SKILL.md) Skill guides Main's planning and orchestration. It adds no runtime code, config, or Role installation.
|
|
82
|
+
|
|
83
|
+
Its ordinary review loop is optional. Use it only when the caller or repository policy explicitly requires judgment review.
|
|
84
|
+
|
|
85
|
+
- Call `delegate_task` with `role: "reviewer"` to select the effective `reviewer` Role.
|
|
86
|
+
- Its task packet must state the read-only scope and exact `PASS` or findings contract. Include exact acceptance criteria and validation evidence.
|
|
87
|
+
- The Reviewer must see exact candidate evidence from its working directory. Use `delegate_flow` for an isolated candidate, not an ordinary review from Main's unchanged checkout.
|
|
88
|
+
- Fix initial findings together. Validate repaired inputs once before focused re-review. Include the original findings and acceptance criteria, exact repaired-candidate evidence, and validation evidence.
|
|
89
|
+
- Only `PASS` completes the loop. Surface and block on re-review findings or empty output. Retry empty output only when explicit caller policy requires one. A second empty result blocks. Do not add another round.
|
|
90
|
+
|
|
91
|
+
Flow is separate. It owns exact review evidence, exact `PASS` approval, validation replay, one repair continuation, and no automatic retry.
|
|
80
92
|
|
|
81
93
|
## Flow
|
|
82
94
|
|
|
@@ -94,6 +106,12 @@ A Flow has 1–8 units with unique non-empty IDs and allows one active Flow. It
|
|
|
94
106
|
- Without `review`, Flow fast-forwards the exact validated tip.
|
|
95
107
|
- With `review`, the Reviewer receives the exact `{base, tip, patchPath}` packet and must return exactly `PASS` before the same integration path. Use `review` only for stated judgment that validation cannot decide.
|
|
96
108
|
|
|
109
|
+
A Role selects base tools, extensions, named Skills, instructions, and optional worktree isolation. Named Skills resolve from Main's effective Pi registry. Unavailable names warn and skip.
|
|
110
|
+
|
|
111
|
+
Children disable ambient extension and Skill discovery. `tools: []` adds no base tools, but selected extension tools and caller tools still activate. `extensions: []` adds no Role extension bundle. `skills: []` adds no separately named Role Skills, but selected extension Skills still load.
|
|
112
|
+
|
|
113
|
+
Parent-only delegation tools and `ask_question` are always excluded. Requested Role or caller tool names are checked after provider loading. Unavailable tools fail before the first model turn.
|
|
114
|
+
|
|
97
115
|
An explicit unit `modelClass` overrides both frozen Roles. Without one, each Role uses its own `modelClass`, configured `pi-subagent/delegateTask` assignment, or declared default.
|
|
98
116
|
|
|
99
117
|
One `delegate_flow_continue` can repair an Implementer, validation, or review block in the same worktree. Omitting its class keeps the unit's explicit class and frozen Role defaults. Supplying one replaces both Role defaults for that repair and its later Reviewer launch.
|
|
@@ -106,14 +124,12 @@ Flow has no dependency graph, saved recovery, automatic retry, aggregate review,
|
|
|
106
124
|
|
|
107
125
|
pi-subagent owns `~/.pi/agent/config/pi-subagent/config.json`. It is optional. A missing file uses these defaults without a warning.
|
|
108
126
|
|
|
109
|
-
|
|
|
110
|
-
| --- | --- | --- |
|
|
111
|
-
| `maxSubagents` | Safe integer
|
|
112
|
-
| `maxTurns` | Safe integer
|
|
113
|
-
| `timeout.idleMinutes` |
|
|
114
|
-
| `timeout.maxMinutes` | Positive minutes greater than `idleMinutes
|
|
115
|
-
|
|
116
|
-
`maxTurns` defaults to 50.
|
|
127
|
+
| Name | Description | Values | Default |
|
|
128
|
+
| --- | --- | --- | --- |
|
|
129
|
+
| `maxSubagents` | Sets the maximum number of active child processes. | Safe integer of at least 1. | `5` |
|
|
130
|
+
| `maxTurns` | Sets the hard provider-turn limit for each child. | Safe integer of at least 1. | `50` |
|
|
131
|
+
| `timeout.idleMinutes` | Sets the idle timeout for a child. | Positive minutes. | `10` |
|
|
132
|
+
| `timeout.maxMinutes` | Sets the maximum runtime for a child. | Positive minutes greater than `idleMinutes`. | `30` |
|
|
117
133
|
|
|
118
134
|
Excess children wait FIFO without using a child timeout. A terminal response on turn 50 succeeds; an attempted continuation rejects with `turn_limit`.
|
|
119
135
|
|
|
@@ -164,7 +180,16 @@ Flow uses the effective Implementer and, only when requested, Reviewer. The Scou
|
|
|
164
180
|
|
|
165
181
|
## API
|
|
166
182
|
|
|
167
|
-
The package root
|
|
183
|
+
The package root includes these main exports:
|
|
184
|
+
|
|
185
|
+
| Surface | Type | Purpose |
|
|
186
|
+
| --- | --- | --- |
|
|
187
|
+
| `loadRoles` | function | Loads built-in and user Role definitions. |
|
|
188
|
+
| `resolveRoleSkills` | function | Resolves a Role's named Skills from Pi's effective registry. |
|
|
189
|
+
| `resolveRoleLaunch` | function | Resolves a Role, route, and launch resources. |
|
|
190
|
+
| `createRoleLaunch` | function | Builds launch arguments from a resolved route. |
|
|
191
|
+
| `createEphemeralSubagentExecutor` | function | Creates the bounded child-process executor. |
|
|
192
|
+
| Worktree helpers | functions | Create, inspect, finalize, and report child worktrees. |
|
|
168
193
|
|
|
169
194
|
The executor works only inside the active Pi process. It does not discover or start a standalone Node.js Pi installation.
|
|
170
195
|
|
|
@@ -172,22 +197,10 @@ The executor works only inside the active Pi process. It does not discover or st
|
|
|
172
197
|
|
|
173
198
|
See the [public Role and executor API](./docs/orchestration.md#public-role-and-executor-api) for contracts and a `prepare` example. Pass `modelClass` to `resolveRoleLaunch` to override a Role default.
|
|
174
199
|
|
|
175
|
-
##
|
|
176
|
-
|
|
177
|
-
Flow state is memory-only.
|
|
178
|
-
|
|
179
|
-
## Data, cost, and privacy
|
|
180
|
-
|
|
181
|
-
A Role selects base tools, extensions, named Skills, instructions, and optional worktree isolation. Named Skills resolve from Main's effective Pi registry. Unavailable names warn and skip.
|
|
182
|
-
|
|
183
|
-
Children disable ambient extension and Skill discovery. `tools: []` adds no base tools, but selected extension tools and caller tools still activate. `extensions: []` adds no Role extension bundle. `skills: []` adds no separately named Role Skills, but selected extension Skills still load.
|
|
200
|
+
## Limits and recovery
|
|
184
201
|
|
|
185
202
|
An explicitly selected extension is trusted, not sandboxed. Its tools, Skills, and executable behavior load together. Select fewer trusted extensions to reduce scope. pi-subagent does not guess or remove undocumented dependencies.
|
|
186
203
|
|
|
187
|
-
Parent-only delegation tools and `ask_question` are always excluded. Requested Role or caller tool names are checked after provider loading. Unavailable tools fail before the first model turn.
|
|
188
|
-
|
|
189
|
-
## Limits and recovery
|
|
190
|
-
|
|
191
204
|
Flow never force-deletes recoverable work. Failed or uncertain units, and cleanup refusals after integration, retain their worktree path or branch for recovery.
|
|
192
205
|
|
|
193
206
|
See [Flow mechanics and recovery](./docs/orchestration.md#delegate_flow) for retained-work recovery.
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: pi-subagent-delegated-development
|
|
3
|
-
description:
|
|
3
|
+
description: Use Delegate Flow, or coordinate explicitly required judgment review for ordinary delegated implementation.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Delegated Development
|
|
7
7
|
|
|
8
|
-
You are Main, the planner/orchestrator: slice work and
|
|
8
|
+
You are Main, the planner/orchestrator: slice work and choose `delegate_flow` or `delegate_task` as described below. Do not implement child work yourself or use external model tools, push, publish, or release.
|
|
9
9
|
|
|
10
10
|
## Slice
|
|
11
11
|
|
|
@@ -36,3 +36,24 @@ A cleanup warning does not undo successful integration. Report a cleanup warning
|
|
|
36
36
|
## Ordinary delegation
|
|
37
37
|
|
|
38
38
|
Use `delegate_task` for a single bounded task, independent parallel tasks, or dependent chain work that is not a Flow. Give each entry its objective, exact scope and exclusions, relevant context and constraints, expected deliverable, and focused validation. Choose `modelClass` according to the delegation tool's guidance. A direct `model` replaces only the selected route's model. The route keeps its thinking level. Keep integration and cross-cutting decisions in Main, and use the minimum number of Subagents needed.
|
|
39
|
+
|
|
40
|
+
### Optional evidence loop for implementation
|
|
41
|
+
|
|
42
|
+
Use this caller-managed loop only when the caller or repository policy explicitly requires judgment review. It is not required for every ordinary implementation.
|
|
43
|
+
|
|
44
|
+
After implementation and focused validation, launch `delegate_task` with `role: "reviewer"` to select the effective `reviewer` Role. A same-named user Role remains effective. The task packet must state:
|
|
45
|
+
|
|
46
|
+
- the read-only scope;
|
|
47
|
+
- the exact acceptance criteria;
|
|
48
|
+
- exact candidate evidence visible from the Reviewer's working directory and the supplied validation evidence;
|
|
49
|
+
- the exact output contract: return `PASS` alone on approval, or findings only.
|
|
50
|
+
|
|
51
|
+
Do not launch the Reviewer unless it can see the actual candidate. For an isolated implementation candidate, use `delegate_flow` instead of composing an ordinary review against Main's unchanged checkout.
|
|
52
|
+
|
|
53
|
+
Empty Reviewer output is a failure. Retry only when explicit caller policy requires one; otherwise surface the failure and block completion. If that retry is also empty, surface the second empty result and block completion.
|
|
54
|
+
|
|
55
|
+
If the initial review returns findings, repair them together. Run one focused validation of the repaired inputs before one focused re-review. Its task packet must restate the read-only scope, exact output contract, original findings, original acceptance criteria, exact repaired-candidate evidence, and validation evidence.
|
|
56
|
+
|
|
57
|
+
Only `PASS` completes the loop. Focused re-review findings block completion and must be surfaced. Do not start another repair/review round.
|
|
58
|
+
|
|
59
|
+
Do not layer this loop onto `delegate_flow`. Flow already owns exact review evidence, exact `PASS` approval, validation replay, one repair continuation, and no automatic retry.
|