@henryqw/pi-subagent 10.0.0 → 10.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/CONTEXT.md +1 -1
- package/README.md +8 -8
- package/dist/index.d.ts +4 -5
- package/dist/index.js +5 -7
- package/docs/adr/001-composable-ephemeral-execution.md +1 -1
- package/docs/orchestration.md +8 -8
- 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/package.json +1 -1
package/CONTEXT.md
CHANGED
|
@@ -29,7 +29,7 @@ Provide validated built-in and user Roles, shared task-model Pi launch policy, g
|
|
|
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
30
|
- Main policy populates direct `model` and `thinking` only for explicit user overrides; otherwise it selects only `modelClass` (`fast` normally, `balanced` upfront for obvious complexity). 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
|
@@ -135,7 +135,7 @@ Rebase and infrastructure failures are terminal. A reported fast-forward failure
|
|
|
135
135
|
|
|
136
136
|
Otherwise it is terminal and retains the affected worktree. Flow has no graph, saved recovery, automatic retry, aggregate review, or post-merge gate.
|
|
137
137
|
|
|
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.
|
|
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; the built-in Scout is not part of Flow. Same-named user Roles remain supported overrides.
|
|
139
139
|
|
|
140
140
|
### Delegate UI summary
|
|
141
141
|
|
|
@@ -200,28 +200,28 @@ An unreadable or invalid Role file fails role loading fast. Duplicate role names
|
|
|
200
200
|
|
|
201
201
|
## Roles
|
|
202
202
|
|
|
203
|
-
The package ships
|
|
203
|
+
The package ships three working built-in Roles. They are always available without configuration.
|
|
204
204
|
|
|
205
205
|
- `implementer`: focused edits requesting worktree isolation; commits completed scoped changes locally and never pushes or opens PRs without authorization
|
|
206
206
|
- `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
|
|
207
|
+
- `scout`: read-only code and evidence mapping for one bounded task; never changes files
|
|
207
208
|
|
|
208
|
-
A same-named Markdown file in `~/.pi/agent/config/pi-subagent/` explicitly overrides the built-in default.
|
|
209
|
+
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
210
|
|
|
210
|
-
The repository also includes optional inert
|
|
211
|
+
The repository also includes one optional inert sample:
|
|
211
212
|
|
|
212
|
-
- [`scout`](./examples/roles/scout.md): read-only discovery
|
|
213
213
|
- [`synthesizer`](./examples/roles/synthesizer.md): reconcile supplied reports
|
|
214
214
|
|
|
215
|
-
Copy
|
|
215
|
+
Copy it manually from your installed `@henryqw/pi-subagent` package if you want a starting point. npm installs ship the `examples/roles/` directory.
|
|
216
216
|
|
|
217
217
|
```bash
|
|
218
218
|
mkdir -p ~/.pi/agent/config/pi-subagent
|
|
219
|
-
cp <package-install-dir>/examples/roles/
|
|
219
|
+
cp <package-install-dir>/examples/roles/synthesizer.md ~/.pi/agent/config/pi-subagent/
|
|
220
220
|
```
|
|
221
221
|
|
|
222
222
|
Locate the install directory with `npm root` inside your project, or through Pi's package installation path.
|
|
223
223
|
|
|
224
|
-
The package never installs or writes Role configuration.
|
|
224
|
+
The package never installs or writes Role configuration. After copying, edit or replace `synthesizer.md` as your own Role.
|
|
225
225
|
|
|
226
226
|
## Skill
|
|
227
227
|
|
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,7 +12,7 @@ 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
17
|
Main populates direct `model` and `thinking` only for explicit user overrides; otherwise it chooses only `modelClass` (`fast` normally, `balanced` upfront for obvious complexity). This is tool policy, not executor provenance tracking or runtime enforcement.
|
|
18
18
|
|
package/docs/orchestration.md
CHANGED
|
@@ -66,7 +66,7 @@ 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. |
|
|
@@ -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.
|