@henryqw/pi-subagent 10.0.0 → 10.1.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/CONTEXT.md +3 -3
- package/README.md +11 -9
- package/dist/index.d.ts +4 -5
- package/dist/index.js +5 -7
- package/docs/adr/001-composable-ephemeral-execution.md +2 -2
- package/docs/adr/002-package-owned-delegate-flow-orchestration.md +1 -1
- package/docs/orchestration.md +10 -10
- package/examples/roles/implementer.md +5 -5
- package/examples/roles/reviewer.md +5 -9
- package/examples/roles/scout.md +12 -8
- package/examples/roles/synthesizer.md +2 -1
- package/extensions/delegate-flow.ts +3 -1
- package/extensions/model-class-policy.ts +1 -0
- package/extensions/subagent.ts +2 -1
- package/package.json +6 -5
- package/skills/pi-subagent-delegated-development/SKILL.md +2 -2
package/CONTEXT.md
CHANGED
|
@@ -9,7 +9,7 @@ Provide validated built-in and user Roles, shared task-model Pi launch policy, g
|
|
|
9
9
|
- **Main**: Pi session that plans and orchestrates delegated work.
|
|
10
10
|
- **Subagent**: isolated Pi child process handling one task.
|
|
11
11
|
- **Role**: package-shipped built-in or user-owned Markdown definition of a reusable responsibility, with a name, description, system instructions, required `tools`, `extensions`, and `skills` arrays, and optional isolation.
|
|
12
|
-
- **Model Class**: `fast`, `balanced`, `frontier`, or `fav`, resolved through shared task-model settings;
|
|
12
|
+
- **Model Class**: `fast`, `balanced`, `frontier`, or `fav`, resolved through shared task-model settings; direct model/thinking overrides remain explicit user choices.
|
|
13
13
|
- **Route**: configured model and thinking-level pair selected from a shared Model Class profile; the primary route precedes its optional fallback.
|
|
14
14
|
- **Delegated Task**: one bounded work request sent from Main to one Role.
|
|
15
15
|
- **Workflow**: generic orchestration of one or more Delegated Tasks; `delegate_task` owns its selected mode, while library callers compose executor runs in JavaScript.
|
|
@@ -27,9 +27,9 @@ Provide validated built-in and user Roles, shared task-model Pi launch policy, g
|
|
|
27
27
|
- Up to five active ephemeral `delegate_task` children run per Main by default, configurable via `maxSubagents` in `~/.pi/agent/config/pi-subagent/config.json` or the `PI_SUBAGENT_MAX_SUBAGENTS` environment variable; excess calls wait FIFO. Queued calls do not start a child or consume child timeout.
|
|
28
28
|
- Ambient child extensions and Skills stay disabled. Every Role requires `tools`, `extensions`, and `skills` YAML arrays, and every launch installs the Role tool policy. `tools: []` activates no base built-ins but does activate all tools from explicitly selected trusted extension bundles and explicit caller tool additions; `skills: []` selects no separately named Role Skills but trusted selected extension Skills still load; `extensions: []` selects no Role extension bundle. A Role/caller explicitly selected extension is a trusted atomic capability bundle: all tools it registers and all Skills supplied through its Pi package metadata or dynamic `resources_discover` load alongside separately named Role Skills. This intentionally includes the extension's executable lifecycle/prompt behavior; pi-subagent does not infer or externally narrow undocumented dependencies, and loading an extension is not sandboxing. Scope children by selecting fewer trusted extensions; finer granularity requires separate entry points/configuration or an upstream split. Explicit Role/caller tool names still verify against the final filtered registry, while parent-only recursive orchestration tools remain excluded.
|
|
29
29
|
- Role Skill names resolve through Main's effective Pi Skill registry; unavailable names warn and skip without blocking delegation. Explicit Role/caller tool names verify against the final filtered child registry after explicit provider `session_start` handlers, and unavailable names fail before the first turn.
|
|
30
|
-
- Main policy populates direct `model` and `thinking` only for explicit user overrides; otherwise it selects only `modelClass
|
|
30
|
+
- Main policy populates direct `model` and `thinking` only for explicit user overrides; otherwise it selects only `modelClass`. This has no provenance tracking or runtime enforcement. An omitted class uses pi-subagent's local `pi-subagent/delegateTask` Model Task declaration (default `fast`); library callers select a Role plus their own Model Task declaration.
|
|
31
31
|
- The selected profile resolves primary then fallback only before launch when a route, model, or thinking level is unavailable. A missing local JSON config uses defaults quietly. Missing shared task-model config warns once per session because delegation needs a route. If neither route is usable, launch rejects with `Run /task-models`; a started child is never retried by this package.
|
|
32
|
-
- User Role Markdown files and Subagent JSON config (`config/pi-subagent/config.json`) live only in the user `config/pi-subagent` directory; model routes live in shared `config/pi-task-models/config.json`. Package-shipped built-in Roles (`implementer`, `reviewer`) resolve from the package's own `examples/roles/` Markdown through the same parser;
|
|
32
|
+
- User Role Markdown files and Subagent JSON config (`config/pi-subagent/config.json`) live only in the user `config/pi-subagent` directory; model routes live in shared `config/pi-task-models/config.json`. Package-shipped built-in Roles (`implementer`, `reviewer`, `scout`) resolve from the package's own `examples/roles/` Markdown through the same parser; same-named user files override built-ins for `delegate_task`, while same-named `implementer` and `reviewer` files override Flow defaults. The `synthesizer` Markdown remains the only optional inert sample.
|
|
33
33
|
- `delegate_flow` accepts 1–8 independent units with direct validation commands, optional `modelClass`, and optional non-empty `review` judgment text. Omitted classes use pi-subagent's local `pi-subagent/delegateTask` declaration (default `fast`); each unit's current class resolves through its shared profile route for its Implementer and, when `review` exists, Reviewer. At Flow start it always resolves/freezes the effective Implementer and resolves/freezes a Reviewer only when at least one requested unit has `review`. One active Flow creates every Unit Worktree before launching Implementers in parallel, then processes settled units in declared order. For each unit Flow rebases in place when earlier units advanced Main, inspects committed Git state, and runs declared validation. Validation is authoritative for objective verification: units without `review` fast-forward their exact validated tip; units with `review` send the exact Review Packet to the Reviewer in the same worktree and require exact `PASS` before the same guarded `git merge --ff-only` path.
|
|
34
34
|
- Flow is memory-only. Only a post-rebase commit drop produces a no-op (`base === tip`); it validates, skips Reviewer and merge, then cleans up ordinarily. Initial zero-commit implementations block. Implementer, validation, or reviewer blocks allow one `delegate_flow_continue({ guidance, modelClass? })` repair in the same worktree; omission retains the Unit's current class and presence replaces it for that repair. A second block is terminal. Rebase and evidence/Reviewer/infrastructure failures retain worktrees. A reported fast-forward failure retains its worktree unless Main is clean at the exact integrated tip, which completes with the merge diagnostic as a warning. Cleanup uses non-forced worktree removal and branch deletion; cleanup refusal is a completion warning.
|
|
35
35
|
- Flow has no graph, saved recovery, automatic retry, aggregate review, or post-merge validation. It never changes generic `delegate_task` Role resolution, isolation, non-Git fallback, or ordinary direct plan/file review.
|
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Main is the parent Pi session. It can delegate bounded single, parallel, and chained tasks, plus package-owned Git Flow work, to isolated Pi child roles.
|
|
4
4
|
|
|
5
|
+

|
|
6
|
+
|
|
5
7
|
## Why
|
|
6
8
|
|
|
7
9
|
- **Created for**: Delegate bounded work to isolated child Pi processes without losing Main's context.
|
|
@@ -57,7 +59,7 @@ Main supplies every delegation's required `name`: a short description of about f
|
|
|
57
59
|
|
|
58
60
|
1. An explicit `model` is `provider/modelId` and overrides `modelClass`.
|
|
59
61
|
2. Main sets direct `model` and `thinking` only for an explicit user override.
|
|
60
|
-
3. Otherwise, Main selects `modelClass
|
|
62
|
+
3. Otherwise, Main selects `modelClass` according to the [delegation policy](./docs/orchestration.md#delegation-fields).
|
|
61
63
|
4. `modelClass` is `fast`, `balanced`, `frontier`, or `fav`.
|
|
62
64
|
When omitted, it uses pi-subagent's local `pi-subagent/delegateTask` Model Task declaration.
|
|
63
65
|
That declaration defaults to `fast` and shared config can explicitly override it.
|
|
@@ -135,7 +137,7 @@ Rebase and infrastructure failures are terminal. A reported fast-forward failure
|
|
|
135
137
|
|
|
136
138
|
Otherwise it is terminal and retains the affected worktree. Flow has no graph, saved recovery, automatic retry, aggregate review, or post-merge gate.
|
|
137
139
|
|
|
138
|
-
`delegate_task` keeps its generic isolation behavior. Flow uses the package-shipped Implementer by default and the package-shipped Reviewer only when a unit requests review. Same-named user Roles remain supported overrides.
|
|
140
|
+
`delegate_task` keeps its generic isolation behavior. Flow uses the package-shipped Implementer by default and the package-shipped Reviewer only when a unit requests review; the built-in Scout is not part of Flow. Same-named user Roles remain supported overrides.
|
|
139
141
|
|
|
140
142
|
### Delegate UI summary
|
|
141
143
|
|
|
@@ -200,28 +202,28 @@ An unreadable or invalid Role file fails role loading fast. Duplicate role names
|
|
|
200
202
|
|
|
201
203
|
## Roles
|
|
202
204
|
|
|
203
|
-
The package ships
|
|
205
|
+
The package ships three working built-in Roles. They are always available without configuration.
|
|
204
206
|
|
|
205
207
|
- `implementer`: focused edits requesting worktree isolation; commits completed scoped changes locally and never pushes or opens PRs without authorization
|
|
206
208
|
- `reviewer`: read-only correctness review of supplied plans or files, or—only when a Flow unit declares `review`—of Flow's exact `{base, tip, patchPath}` packet in its Unit Worktree; never edits or commits
|
|
209
|
+
- `scout`: read-only code and evidence mapping for one bounded task; never changes files
|
|
207
210
|
|
|
208
|
-
A same-named Markdown file in `~/.pi/agent/config/pi-subagent/` explicitly overrides the built-in default.
|
|
211
|
+
A same-named Markdown file in `~/.pi/agent/config/pi-subagent/` explicitly overrides the built-in default. The built-in `scout` is available to generic `delegate_task`; `delegate_flow` remains limited to its fixed Implementer/Reviewer protocol.
|
|
209
212
|
|
|
210
|
-
The repository also includes optional inert
|
|
213
|
+
The repository also includes one optional inert sample:
|
|
211
214
|
|
|
212
|
-
- [`scout`](./examples/roles/scout.md): read-only discovery
|
|
213
215
|
- [`synthesizer`](./examples/roles/synthesizer.md): reconcile supplied reports
|
|
214
216
|
|
|
215
|
-
Copy
|
|
217
|
+
Copy it manually from your installed `@henryqw/pi-subagent` package if you want a starting point. npm installs ship the `examples/roles/` directory.
|
|
216
218
|
|
|
217
219
|
```bash
|
|
218
220
|
mkdir -p ~/.pi/agent/config/pi-subagent
|
|
219
|
-
cp <package-install-dir>/examples/roles/
|
|
221
|
+
cp <package-install-dir>/examples/roles/synthesizer.md ~/.pi/agent/config/pi-subagent/
|
|
220
222
|
```
|
|
221
223
|
|
|
222
224
|
Locate the install directory with `npm root` inside your project, or through Pi's package installation path.
|
|
223
225
|
|
|
224
|
-
The package never installs or writes Role configuration.
|
|
226
|
+
The package never installs or writes Role configuration. After copying, edit or replace `synthesizer.md` as your own Role.
|
|
225
227
|
|
|
226
228
|
## Skill
|
|
227
229
|
|
package/dist/index.d.ts
CHANGED
|
@@ -45,14 +45,13 @@ export interface ResolvedRoleSkills {
|
|
|
45
45
|
paths: string[];
|
|
46
46
|
missing: string[];
|
|
47
47
|
}
|
|
48
|
-
declare const BUILTIN_ROLE_NAMES: readonly ["implementer", "reviewer"];
|
|
48
|
+
declare const BUILTIN_ROLE_NAMES: readonly ["implementer", "reviewer", "scout"];
|
|
49
49
|
export type BuiltinRoleName = (typeof BUILTIN_ROLE_NAMES)[number];
|
|
50
50
|
export declare function loadBuiltinRole(name: BuiltinRoleName): Role;
|
|
51
51
|
/**
|
|
52
|
-
* Validated
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
* the built-ins.
|
|
52
|
+
* Validated package-shipped Roles plus valid user roles from `config/pi-subagent`.
|
|
53
|
+
* A user role with a built-in name overrides the default; duplicate names among
|
|
54
|
+
* user files are an error. Missing user directory returns the built-ins.
|
|
56
55
|
*/
|
|
57
56
|
export declare function loadRoles(agentDir?: string): Role[];
|
|
58
57
|
export declare function resolveTaskRoute(ctx: ExtensionContext, profileName: ProfileName, agentDir?: string, thinking?: ThinkingLevel): ResolvedTaskRoute;
|
package/dist/index.js
CHANGED
|
@@ -46,9 +46,8 @@ function validateExtension(extension, source) {
|
|
|
46
46
|
function extensionList(value, source) {
|
|
47
47
|
return stringList(value, "extensions", source).map((extension) => validateExtension(extension, source));
|
|
48
48
|
}
|
|
49
|
-
// Built-in Roles
|
|
50
|
-
|
|
51
|
-
const BUILTIN_ROLE_NAMES = ["implementer", "reviewer"];
|
|
49
|
+
// Built-in Roles resolved from the package-shipped Markdown relative to this module.
|
|
50
|
+
const BUILTIN_ROLE_NAMES = ["implementer", "reviewer", "scout"];
|
|
52
51
|
/** Single-file Role parser shared by built-in and user roles. */
|
|
53
52
|
function parseRoleFile(file, raw) {
|
|
54
53
|
let parsed;
|
|
@@ -89,10 +88,9 @@ function builtinRoles() {
|
|
|
89
88
|
return BUILTIN_ROLE_NAMES.map(loadBuiltinRole);
|
|
90
89
|
}
|
|
91
90
|
/**
|
|
92
|
-
* Validated
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
* the built-ins.
|
|
91
|
+
* Validated package-shipped Roles plus valid user roles from `config/pi-subagent`.
|
|
92
|
+
* A user role with a built-in name overrides the default; duplicate names among
|
|
93
|
+
* user files are an error. Missing user directory returns the built-ins.
|
|
96
94
|
*/
|
|
97
95
|
export function loadRoles(agentDir = getAgentDir()) {
|
|
98
96
|
const byName = new Map(builtinRoles().map((role) => [role.name, role]));
|
|
@@ -12,9 +12,9 @@ Resource Policy is split at launch preparation:
|
|
|
12
12
|
- Caller may add explicit tools, extensions, and environment through `createRoleLaunch`.
|
|
13
13
|
- The executor receives the resulting Pi Launch and does not discover resources.
|
|
14
14
|
|
|
15
|
-
Built-in `implementer` and `
|
|
15
|
+
Built-in `implementer`, `reviewer`, and `scout` Roles ship as Markdown in `examples/roles/` and use the same parser as user Roles. For generic delegation, a same-named user Role explicitly overrides a built-in. The package does not install, copy, or write user configuration.
|
|
16
16
|
|
|
17
|
-
Main populates direct `model` and `thinking` only for explicit user overrides; otherwise it chooses only `modelClass`
|
|
17
|
+
Main populates direct `model` and `thinking` only for explicit user overrides; otherwise it chooses only `modelClass` according to delegation tool policy. This is not executor provenance tracking or runtime enforcement.
|
|
18
18
|
|
|
19
19
|
## Scope boundary
|
|
20
20
|
|
|
@@ -9,7 +9,7 @@ delegate_flow({ units: [{ id, task, modelClass?, validation: [{ command, args }]
|
|
|
9
9
|
delegate_flow_continue({ guidance, modelClass? });
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
A Flow accepts 1–8 independent units with unique IDs. `modelClass` is optional and otherwise uses the shared `pi-subagent/delegateTask` assignment
|
|
12
|
+
A Flow accepts 1–8 independent units with unique IDs. `modelClass` is optional and otherwise uses the shared `pi-subagent/delegateTask` assignment. The class resolves through the existing `pi-task-models` profile model-and-thinking route for the unit's Implementer and, when applicable, Reviewer. `review` is optional non-empty text for the explicit judgment that declared validation cannot establish.
|
|
13
13
|
|
|
14
14
|
Only one memory-only Flow may be active. At start it resolves/freezes the effective `implementer` Role, including a same-named user override. It resolves/freezes the effective `reviewer` Role only when at least one requested unit has `review`. It requires a clean committed attached Main branch and creates one Unit Worktree per unit before launching Implementers in parallel. All started Implementers settle; Flow then processes units in declared order.
|
|
15
15
|
|
package/docs/orchestration.md
CHANGED
|
@@ -66,11 +66,11 @@ Single mode puts one delegation's fields at the top level.
|
|
|
66
66
|
|
|
67
67
|
| Field | Required | Contract |
|
|
68
68
|
| --- | --- | --- |
|
|
69
|
-
| `role` | yes | Name of a Role in the user's effective `config/pi-subagent` directory or a package-shipped built-in (`implementer`, `reviewer`); a same-named user file overrides the built-in. |
|
|
69
|
+
| `role` | yes | Name of a Role in the user's effective `config/pi-subagent` directory or a package-shipped built-in (`implementer`, `reviewer`, `scout`); a same-named user file overrides the built-in. |
|
|
70
70
|
| `name` | yes | Main-supplied short task name: about five words and fewer than 30 characters; C0/C1 control characters are rejected. |
|
|
71
71
|
| `task` | yes | Non-empty bounded task packet. |
|
|
72
72
|
| `model` | no | Designated `provider/modelId`; takes precedence over `modelClass`, and Main supplies it only for an explicit user override. |
|
|
73
|
-
| `modelClass` | no | `fast`, `balanced`, `frontier`, or `fav`; Main
|
|
73
|
+
| `modelClass` | no | `fast`, `balanced`, `frontier`, or `fav`; Main prioritizes `fast` for straightforward work and `balanced` for complex work, reserves `frontier` for exceptionally complex or tricky work, and omission uses pi-subagent's local Model Task declaration. |
|
|
74
74
|
| `thinking` | no | `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, or `max`; Main supplies it only for an explicit user override. Route selection skips models that cannot honor it. |
|
|
75
75
|
|
|
76
76
|
Those six fields are the complete delegation object. The direct-model/thinking rule is Main-facing policy only: the runtime adds no provenance tracking or enforcement. `tasks`, `chain`, and `background` cannot be nested. Route fallback occurs only before launch; a started child is never retried by this package.
|
|
@@ -87,7 +87,7 @@ All Main-visible text for one tool call shares one aggregate 50 KiB UTF-8 transp
|
|
|
87
87
|
|
|
88
88
|
`delegate_flow({ units })` accepts 1–8 units with unique non-empty `id`, a required Main-supplied short `name` (about five words and fewer than 30 characters, without C0/C1 control characters), a non-empty `task`, one or more direct `{command, args}` validation commands, optional `modelClass`, and optional non-empty `review` text. `delegate_flow_continue({ guidance, modelClass? })` is available only for the one blocked unit of the active Flow.
|
|
89
89
|
|
|
90
|
-
A Flow is memory-only and permits one active Flow. At start it always resolves/freezes the effective `implementer` Role, including a same-named user override. It resolves/freezes the effective `reviewer` only if at least one requested unit declares `review`. Omitted unit classes use pi-subagent's local `pi-subagent/delegateTask` declaration (default `fast`)
|
|
90
|
+
A Flow is memory-only and permits one active Flow. At start it always resolves/freezes the effective `implementer` Role, including a same-named user override. It resolves/freezes the effective `reviewer` only if at least one requested unit declares `review`. Omitted unit classes use pi-subagent's local `pi-subagent/delegateTask` declaration (default `fast`). A selected class resolves through its existing `pi-task-models` profile model-and-thinking route for the unit's Implementer and, when applicable, Reviewer. It requires clean committed Git Main and creates every Unit Worktree before launching work; setup failure launches no Implementer. Each unit gets exactly one worktree and one Implementer. Implementers run in parallel and all settle. Flow then processes units in declared order:
|
|
91
91
|
|
|
92
92
|
```text
|
|
93
93
|
Implementers (parallel, one Unit Worktree each)
|
|
@@ -108,7 +108,7 @@ If rebase drops all unit commits, `base === tip` is a no-op: Flow validates curr
|
|
|
108
108
|
|
|
109
109
|
Flow has no dependency graph, saved state, automatic retry, aggregate review, or post-merge validation. Use it only for commuting changes; combine or sequence units that overlap files, APIs, schemas, generated output, package metadata, lockfiles, or invariants.
|
|
110
110
|
|
|
111
|
-
`delegate_task` remains generic: its optional worktree isolation, non-Git behavior, and direct plan/file review are unchanged. Flow uses package-shipped Roles as defaults while retaining same-named user Role overrides
|
|
111
|
+
`delegate_task` remains generic: its optional worktree isolation, non-Git behavior, and direct plan/file review are unchanged. The built-in `scout` is available only through generic `delegate_task`; Flow uses package-shipped Implementer and conditional Reviewer Roles as defaults while retaining same-named user Role overrides.
|
|
112
112
|
|
|
113
113
|
## Per-delegation resources and isolation
|
|
114
114
|
|
|
@@ -391,30 +391,30 @@ The verdict schema, parser, round state, shared workspace, and terminal decision
|
|
|
391
391
|
|
|
392
392
|
## Built-in Roles and samples
|
|
393
393
|
|
|
394
|
-
The package ships
|
|
394
|
+
The package ships three working built-in Roles, validated by the same parser as user roles and always present even with no `config/pi-subagent` directory:
|
|
395
395
|
|
|
396
396
|
| Built-in | Behavior |
|
|
397
397
|
| --- | --- |
|
|
398
398
|
| `implementer` | Focused implementation requesting `isolation: worktree`; commits scoped changes locally, never pushes or opens PRs without authorization. Non-Git or unborn-`HEAD` contexts may use Main's cwd. |
|
|
399
399
|
| `reviewer` | Read-only correctness review of supplied plans/files, or—when a Flow unit declares `review`—Flow's exact `{base, tip, patchPath}` packet in its Unit Worktree; never edits or commits. |
|
|
400
|
+
| `scout` | Read-only code and evidence mapping for one bounded task; never changes files. |
|
|
400
401
|
|
|
401
402
|
A same-named Markdown file in `config/pi-subagent/` explicitly overrides the built-in default.
|
|
402
403
|
|
|
403
|
-
|
|
404
|
+
The repository includes one optional inert sample, not installed configuration:
|
|
404
405
|
|
|
405
406
|
| Sample | Intended starting point |
|
|
406
407
|
| --- | --- |
|
|
407
|
-
| [`scout`](../examples/roles/scout.md) | Read-only code/evidence mapping. |
|
|
408
408
|
| [`synthesizer`](../examples/roles/synthesizer.md) | Reconcile supplied reports without broad discovery. |
|
|
409
409
|
|
|
410
|
-
Copy the package-shipped
|
|
410
|
+
Copy the package-shipped sample from your installed `@henryqw/pi-subagent` package (npm installs include `examples/roles/`) if you want it:
|
|
411
411
|
|
|
412
412
|
```bash
|
|
413
413
|
mkdir -p ~/.pi/agent/config/pi-subagent
|
|
414
|
-
cp <package-install-dir>/examples/roles/
|
|
414
|
+
cp <package-install-dir>/examples/roles/synthesizer.md ~/.pi/agent/config/pi-subagent/
|
|
415
415
|
```
|
|
416
416
|
|
|
417
|
-
The package never creates, copies, updates, or removes files in `~/.pi/agent/config/pi-subagent/`. Once copied, the
|
|
417
|
+
The package never creates, copies, updates, or removes files in `~/.pi/agent/config/pi-subagent/`. Once copied, the file and its name are entirely user-owned.
|
|
418
418
|
|
|
419
419
|
The bundled [`pi-subagent-delegated-development`](../skills/pi-subagent-delegated-development/SKILL.md) Skill is Main-side planner/orchestrator policy only. `delegate_flow` owns its fixed Git mechanics and objective validation authority; the Skill defines no runtime code or configuration. `delegate_task` remains the generic flat single/parallel/chain mechanism.
|
|
420
420
|
|
|
@@ -14,12 +14,12 @@ skills: []
|
|
|
14
14
|
isolation: worktree
|
|
15
15
|
---
|
|
16
16
|
|
|
17
|
-
Implement
|
|
17
|
+
Implement the bounded outcome, not a preassigned file list. Work in the assigned cwd. Read applicable repository instructions and domain context first; inspect the relevant flow, callers, and tests before editing. Preserve unrelated work. Fix the root cause with the smallest complete diff, reusing existing patterns and dependencies. Do not add speculative work. Stop when the outcome is complete or blocked.
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
For ordinary delegation, run focused validation needed to establish correctness. For Flow, the declared validation gate is authoritative: run only narrow development checks while implementing and do not duplicate that final gate.
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
Do not access credentials, use the network, generate artifacts, or broaden scope unless the task explicitly requires it. Never invoke external LLM APIs, SDKs, agent harnesses, or model CLIs.
|
|
22
22
|
|
|
23
|
-
Commit completed scoped changes locally unless the task
|
|
23
|
+
Commit completed scoped changes locally unless the task says otherwise. Do not create or manage another worktree. Never push or open a pull request without explicit authorization. For Flow, leave the assigned worktree and branch intact.
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
Report briefly: outcome, commit, checks run, and remaining risks. Do not repeat Flow's Git-derived evidence.
|
|
@@ -10,15 +10,11 @@ extensions: []
|
|
|
10
10
|
skills: []
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Review read-only in exactly two modes:
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
1. Ordinary delegation: use supplied requirements and named files/evidence only. Do not prepare Git, require a commit/Review Packet, or broaden discovery. If evidence is insufficient, say so and stop.
|
|
16
|
+
2. Flow exact review: only with an explicit judgment criterion, use the same assigned Unit Worktree and exact Review Packet `{base, tip, patchPath}`. Treat the exact patch at `patchPath` as authoritative; read only referenced files/context. Declared validation is authoritative for objective verification. Judge only the explicit criterion; never infer a diff from another branch/worktree.
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
2. For Flow exact review, only when the task supplies an explicit judgment criterion, require a Review Packet `{base, tip, patchPath}` and the same assigned Unit Worktree context. Declared validation is authoritative for objective verification; judge only that criterion. Read the exact patch as authoritative, then read only the files it references and relevant criterion context. Do not infer a diff from a branch or another worktree.
|
|
18
|
+
Report only actionable correctness risks introduced by the change—not style preferences, speculative hypotheticals, or unrelated pre-existing issues. Use only `read`, `grep`, `find`, and `ls`; run no commands/tests and never edit, write, commit, push, or manage Git/worktrees. Never invoke external LLM APIs, SDKs, agent harnesses, or model CLIs.
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
Never invoke external LLM APIs, SDKs, agent harnesses, or model CLIs.
|
|
23
|
-
|
|
24
|
-
Emit exactly `PASS` when there are zero findings. Any finding must block approval: return findings first, ordered by severity, with file and line evidence, impact, and the smallest valid fix. Do not emit `PASS` alongside findings.
|
|
20
|
+
Output exactly `PASS` when there are no findings. Otherwise output findings only, ordered by severity, with file:line evidence, impact, and smallest valid fix; any finding blocks approval. Never combine `PASS` with findings. Stop when supplied evidence is covered; in Flow, stop after its criterion.
|
package/examples/roles/scout.md
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: scout
|
|
3
3
|
description: Maps relevant code and evidence for one bounded task without changing files
|
|
4
|
-
tools:
|
|
4
|
+
tools:
|
|
5
|
+
- read
|
|
6
|
+
- grep
|
|
7
|
+
- find
|
|
8
|
+
- ls
|
|
5
9
|
extensions: []
|
|
6
10
|
skills: []
|
|
7
11
|
---
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
Answer only the bounded discovery questions.
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
Read applicable repository instructions and domain context first. Trace the relevant execution/data flow, callers, tests, and constraints only far enough to answer. Separate observed facts, supported inferences, and unknowns. Stop when answered; if blocked, state what is missing.
|
|
12
16
|
|
|
13
|
-
Do not edit
|
|
17
|
+
Do not design, recommend, implement, edit, or run shell commands.
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
- evidence with file paths and line numbers;
|
|
17
|
-
- uncertainties or missing context.
|
|
19
|
+
Return concisely:
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
- a map of relevant files and symbols and how they connect;
|
|
22
|
+
- path:line evidence;
|
|
23
|
+
- uncertainties or missing context.
|
|
@@ -19,8 +19,9 @@ import {
|
|
|
19
19
|
} from "@henryqw/pi-subagent";
|
|
20
20
|
import { Type, type Static } from "typebox";
|
|
21
21
|
import { Check } from "typebox/value";
|
|
22
|
-
import { TASK_NAME_CONTRACT, TaskNameSchema, normalizeTaskName } from "./task-name.ts";
|
|
23
22
|
import { runDelegation } from "./delegation.ts";
|
|
23
|
+
import { MODEL_CLASS_GUIDANCE } from "./model-class-policy.ts";
|
|
24
|
+
import { TASK_NAME_CONTRACT, TaskNameSchema, normalizeTaskName } from "./task-name.ts";
|
|
24
25
|
|
|
25
26
|
const MAX_UNITS = 8;
|
|
26
27
|
const GIT_TIMEOUT_MS = 30_000;
|
|
@@ -764,6 +765,7 @@ export function registerDelegateFlow(pi: ExtensionAPI, runtime: DelegateFlowRunt
|
|
|
764
765
|
promptGuidelines: [
|
|
765
766
|
"Use delegate_flow only for cohesive units expected to commute: split independent outcomes into units, sequence dependent work outside delegate_flow, and never divide one invariant across multiple units. Combine work that overlaps files, APIs, schemas, generated output, package metadata, lockfiles, or invariants.",
|
|
766
767
|
`${TASK_NAME_CONTRACT.promptGuidance} Each delegate_flow unit must own one concrete outcome with one focused validation story: include explicit bounded requirements and its authoritative direct command/argument validation gate. If the affected flow or scope is not yet known, perform bounded read-only discovery first. Add review only for an explicit judgment that validation cannot establish.`,
|
|
768
|
+
`For each delegate_flow unit, ${MODEL_CLASS_GUIDANCE}`,
|
|
767
769
|
"If a Flow blocks, inspect its classification and call delegate_flow_continue once with explicit repair guidance; modelClass may replace that one repair's current class.",
|
|
768
770
|
],
|
|
769
771
|
parameters: DelegateFlowSchema,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const MODEL_CLASS_GUIDANCE = "Prioritize modelClass fast for straightforward work and balanced for complex work. Reserve frontier for exceptionally complex or tricky work.";
|
package/extensions/subagent.ts
CHANGED
|
@@ -36,6 +36,7 @@ import {
|
|
|
36
36
|
import { DEFAULT_TIMEOUT_CONFIG, readSubagentConfig, type SubagentTimeoutConfig } from "./config.ts";
|
|
37
37
|
import { registerDelegateFlow } from "./delegate-flow.ts";
|
|
38
38
|
import { runDelegation } from "./delegation.ts";
|
|
39
|
+
import { MODEL_CLASS_GUIDANCE } from "./model-class-policy.ts";
|
|
39
40
|
import {
|
|
40
41
|
formatBackgroundWorkflowResult,
|
|
41
42
|
formatWorkflowResult,
|
|
@@ -538,7 +539,7 @@ export default function subagentExtension(
|
|
|
538
539
|
promptGuidelines: [
|
|
539
540
|
"Call delegate_task with exactly one mode: role+name+task for one task, tasks for 1–8 independent parallel tasks, or chain for 1–8 dependent sequential tasks using {previous} for the immediately preceding assistant output; split independent, commuting outcomes into parallel entries, sequence dependent work in chain entries, and never divide one invariant across multiple entries.",
|
|
540
541
|
`${TASK_NAME_CONTRACT.promptGuidance} Every delegate_task entry must own one concrete outcome with one focused validation story: state its objective, exact scope and exclusions, relevant context and constraints, expected deliverable, and validation; if the affected flow or scope is not yet known, perform bounded read-only discovery first; never pass the parent request unchanged.`,
|
|
541
|
-
|
|
542
|
+
`For each delegate_task entry, populate model and thinking only for an explicit user override. Otherwise, ${MODEL_CLASS_GUIDANCE} This is Main policy, not runtime enforcement.`,
|
|
542
543
|
"Parallel delegate_task entries must own non-overlapping files. Keep integration and cross-cutting decisions in Main, and use the minimum number of Subagents needed.",
|
|
543
544
|
"delegate_task background applies to the whole selected workflow and returns before results exist; use it only when the user explicitly asks for non-blocking work.",
|
|
544
545
|
],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@henryqw/pi-subagent",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.1.1",
|
|
4
4
|
"description": "Delegate bounded single, parallel, or chained tasks to isolated Pi roles.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
},
|
|
47
47
|
"repository": {
|
|
48
48
|
"type": "git",
|
|
49
|
-
"url": "git+https://github.com/HenryQW/pi-
|
|
50
|
-
"directory": "
|
|
49
|
+
"url": "git+https://github.com/HenryQW/pi-harness.git",
|
|
50
|
+
"directory": "extensions/pi-subagent"
|
|
51
51
|
},
|
|
52
52
|
"bugs": {
|
|
53
|
-
"url": "https://github.com/HenryQW/pi-
|
|
53
|
+
"url": "https://github.com/HenryQW/pi-harness/issues"
|
|
54
54
|
},
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|
|
@@ -61,7 +61,8 @@
|
|
|
61
61
|
],
|
|
62
62
|
"skills": [
|
|
63
63
|
"./skills"
|
|
64
|
-
]
|
|
64
|
+
],
|
|
65
|
+
"image": "https://raw.githubusercontent.com/HenryQW/pi-harness/main/extensions/pi-subagent/example.png"
|
|
65
66
|
},
|
|
66
67
|
"dependencies": {
|
|
67
68
|
"@henryqw/pi-config-store": "^0.1.0",
|
|
@@ -13,7 +13,7 @@ Before slicing, identify applicable repository prohibitions. If the request or p
|
|
|
13
13
|
|
|
14
14
|
Use the fewest cohesive units. `delegate_flow` is for independent units expected to commute: split independent outcomes into units, combine or sequence work that overlaps files, APIs, schemas, generated output, package metadata, lockfiles, or invariants, and never divide one invariant across multiple units. Dependent work remains outside Flow; sequence it in one task or ordinary caller-controlled sequencing.
|
|
15
15
|
|
|
16
|
-
Give every unit a bounded objective, owned scope and exclusions, and its direct validation command/argument array; each delegation must own one concrete outcome with one focused validation story. If the affected flow or scope is not yet known, perform bounded read-only discovery first. Do not pass the parent request unchanged.
|
|
16
|
+
Give every unit a bounded objective, owned scope and exclusions, and its direct validation command/argument array; each delegation must own one concrete outcome with one focused validation story. If the affected flow or scope is not yet known, perform bounded read-only discovery first. Do not pass the parent request unchanged. Choose `modelClass` according to the delegation tool's guidance. Add non-empty `review` only for an explicit judgment that automated validation cannot establish. Call `delegate_flow` with 1–8 units; the runtime always supplies the effective Implementer and supplies the Reviewer only when a unit needs review.
|
|
17
17
|
|
|
18
18
|
## Runtime Flow
|
|
19
19
|
|
|
@@ -31,4 +31,4 @@ Make the guidance specific to the reported implementation, validation, or review
|
|
|
31
31
|
|
|
32
32
|
## Ordinary delegation
|
|
33
33
|
|
|
34
|
-
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. Populate direct `model` and `thinking` only when the user explicitly asks for those overrides; otherwise choose
|
|
34
|
+
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. Populate direct `model` and `thinking` only when the user explicitly asks for those overrides; otherwise choose `modelClass` according to the delegation tool's guidance. Keep integration and cross-cutting decisions in Main, and use the minimum number of Subagents needed.
|