@henryqw/pi-subagent 27.3.0 → 27.3.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/README.md +230 -58
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
# `@henryqw/pi-subagent`
|
|
2
2
|
|
|
3
|
-
Delegate work to configured Pi Roles with [Herdr](https://herdr.dev/). Authorized direct tasks
|
|
3
|
+
Delegate work to configured Pi Roles with [Herdr](https://herdr.dev/). Authorized direct tasks use Herdr tabs in your current workspace. Checked implementation uses isolated Herdr worktrees. Both modes return a handle, so Main can continue while the work runs.
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Pi Subagent requires Pi 1.1.0 or later in the 1.x series. Development and automated checks use Pi 1.1.0. Pi Subagent no longer supports older Pi releases.
|
|
10
|
+
|
|
11
|
+
Isolated work requires Herdr 0.9.3 or later. It also requires a running Herdr server on API protocol 22 or later. Pi Subagent checks both before it starts.
|
|
10
12
|
|
|
11
13
|
```bash
|
|
12
14
|
pi install npm:@henryqw/pi-task-models
|
|
13
15
|
pi install npm:@henryqw/pi-subagent
|
|
14
16
|
```
|
|
15
17
|
|
|
16
|
-
Run `/task-models
|
|
18
|
+
Run `/task-models`. Configure the `fast`, `balanced`, `frontier`, and `fav` routes you use.
|
|
17
19
|
|
|
18
20
|
### Upgrade from 26.x
|
|
19
21
|
|
|
20
|
-
Version 27.0.0 has breaking changes. Each direct task must declare `access`. Role files with unknown frontmatter keys
|
|
22
|
+
Version 27.0.0 has breaking changes. Each direct task must declare `access`. The extension rejects Role files with unknown frontmatter keys. The library replaces `loadRoles` with `loadRoleCatalog` and `findRole`. Read [Migrate from 26.x to 27.0.0](./docs/migration.md) before you upgrade.
|
|
21
23
|
|
|
22
24
|
## Works with
|
|
23
25
|
|
|
@@ -27,38 +29,56 @@ Version 27.0.0 has breaking changes. Each direct task must declare `access`. Rol
|
|
|
27
29
|
|
|
28
30
|
## Use
|
|
29
31
|
|
|
30
|
-
Ask Main to delegate a bounded task, such as “Have a scout trace sign-in without editing files.” Main uses `delegate_task`.
|
|
32
|
+
Ask Main to delegate a bounded task, such as “Have a scout trace sign-in without editing files.” Main uses `delegate_task`. Main stays available while you receive progress and a result or a failure with recovery steps.
|
|
33
|
+
|
|
34
|
+
Commands are for you. Delegation and state tools and the packaged skill are for Main. `git_read` is only for children whose Role declares it. Main cannot use it. You do not need to call agent tools or manage candidate identities.
|
|
31
35
|
|
|
32
|
-
|
|
36
|
+
Delegation and continuation tools use plain-object parameter schemas. So providers that omit root-union tools can expose them. Each mode and action still requires its exact arguments.
|
|
33
37
|
|
|
34
38
|
| Surface | Type | Purpose |
|
|
35
39
|
| --- | --- | --- |
|
|
36
|
-
| `/subagent` | command | Browse work
|
|
37
|
-
| `/subagent roles` | command | List each Role with its source
|
|
38
|
-
| `/subagent prune` | command | Review
|
|
39
|
-
| `/subagent recover` | command | Classify orphaned isolated work in the current canonical repository
|
|
40
|
+
| `/subagent` | command | Browse work. Close/cancel-and-release locally owned direct workers. Stop one running worker of a read workflow. Inspect isolated status in a separate Herdr tab with the `fast` model. Send or edit pending instructions. These actions require interactive TUI or RPC. Inspection also requires a pane that Herdr manages and a configured `scout` Role. |
|
|
41
|
+
| `/subagent roles` | command | List each Role with its source: built-in, user override, or user. Show its resolved route model and thinking level, or its route error. Show tools, extensions, Skills, MCP servers, and load errors for each file. This command is read-only and requires no Herdr pane. |
|
|
42
|
+
| `/subagent prune` | command | Review remaining worker and integration worktrees and branches in the current canonical repository. After your confirmation, remove those that are already merged. Without interactive UI, the command only reports. It requires a running Herdr server to prove that no pane uses a checkout. |
|
|
43
|
+
| `/subagent recover` | command | Classify orphaned isolated work in the current canonical repository. Send Main one follow-up with request IDs, blockers, and reported next actions. This command requires no UI or Herdr pane. |
|
|
40
44
|
| `delegate_task` | tool | Start authorized shared-checkout work or a durable isolated checked graph. |
|
|
41
|
-
| `subagent_status` | tool | Read durable isolated state and the exact allowed continuation without replaying work.
|
|
42
|
-
| `subagent_resume` | tool | Perform the reported `retry`, `verify`, or `finalize` continuation
|
|
43
|
-
| `subagent_stage` | tool | Stage or
|
|
44
|
-
| `subagent_integrate` | tool | Advance staged dependents
|
|
45
|
-
| `subagent_abort` | tool | Abort an isolated request when no retained candidates or integration worktrees with work remain
|
|
45
|
+
| `subagent_status` | tool | Read durable isolated state and the exact allowed continuation without replaying work. The tool declares an output schema. So `codemode` scripts receive the same bounded public projection as structured content. Its text shows failed review verdicts from tasks, the final gate, and integration generations. This includes tasks whose siblings still run. The text has one shared 32 KiB budget and counts omitted verdicts. The structured projection carries each verdict up to 32 KiB. It sets `verdictTruncated` when it cuts a verdict. |
|
|
46
|
+
| `subagent_resume` | tool | Perform the reported `retry`, `verify`, or `finalize` continuation. This does not replace staging or integration. A `retry` that sends a correction to the same worker accepts an optional `instruction` of at most 32000 characters. It adds this text to that prompt as Main's instruction after the saved failure. Other actions reject it. |
|
|
47
|
+
| `subagent_stage` | tool | Stage, resolve, reject, or revise an exact candidate. Rejection of a staged candidate freezes that generation. |
|
|
48
|
+
| `subagent_integrate` | tool | Advance staged dependents. Refresh after Main changes cleanly or validation fails without evidence. Validate in the background. Record one correction. Promote. Reconcile interrupted promotion. Clean up proven promotion. Explicitly release rejected or superseded resources. |
|
|
49
|
+
| `subagent_abort` | tool | Abort an isolated request when no retained candidates or integration worktrees with work remain. Abort also works when their checkouts and branches are proved absent. This tool cannot discard them. |
|
|
46
50
|
| `git_read` | tool | For Role-declared children (not Main): inspect bounded local Git evidence without Bash, tests, network access, or writes. |
|
|
47
51
|
| `pi-subagent` | skill | Guide Main through delegation, authorization, checks, integration, and recovery. |
|
|
48
|
-
| Direct status widget (`D`) | ui | For you in the TUI: show direct worker references (such as `D7.1`), status, Role badges, names, route
|
|
49
|
-
| Isolated status widget (`I`) | ui | For you in the TUI: show recorded task state, Role/model-class badges, and retained workspaces
|
|
52
|
+
| Direct status widget (`D`) | ui | For you in the TUI: show direct worker references (such as `D7.1`), status, Role badges, names, and route. Show task elapsed time, measured task tokens, pending tools, and the latest tool's recorded time. |
|
|
53
|
+
| Isolated status widget (`I`) | ui | For you in the TUI: show recorded task state, Role/model-class badges, and retained workspaces. Readiness does not mean promotion. |
|
|
50
54
|
|
|
51
55
|

|
|
52
56
|
|
|
53
|
-
`delegate_task`, `subagent_resume`, `subagent_stage`, `subagent_integrate`, and `subagent_abort` are model-only. Pi's `codemode` scripts cannot call them, because delegation and guarded state transitions need Main's visible reasoning. Scripts can still call `subagent_status`.
|
|
57
|
+
`delegate_task`, `subagent_resume`, `subagent_stage`, `subagent_integrate`, and `subagent_abort` are model-only. Pi's `codemode` scripts cannot call them, because delegation and guarded state transitions need Main's visible reasoning. Scripts can still call `subagent_status`.
|
|
58
|
+
|
|
59
|
+
Main's calls that can write can run together without writer ownership. This includes all Bash calls and nested `codemode` writes. Only a direct request with a task that declares `access: "write"` reserves the checkout. Such a request cannot start while a direct writer owns the checkout. It also cannot start while a Main call that can write is in progress there.
|
|
60
|
+
|
|
61
|
+
The extension tracks each Main call separately until its result or execution end. The result of a script does not release its active nested writes. Reads never wait. To keep Main free to write, use `mode: isolated`. This mode adds worktree checks and explicit integration.
|
|
62
|
+
|
|
63
|
+
The coordinator is extension code that runs in Main's Pi process. It is not another agent. It saves the request, launches the Herdr subagent, checks its committed work, and reports saved results. Main chooses what to stage and promote.
|
|
64
|
+
|
|
65
|
+
If a worker fails, the coordinator reports attention after the wave settles. It does not always report immediately while siblings work. If Main's Pi process stops, a follow-up is not guaranteed. Restart Pi. Then run `/subagent recover` in the canonical repository.
|
|
54
66
|
|
|
55
|
-
|
|
67
|
+
This command classifies orphaned interruptions and sends Main one recovery report. Main then uses `subagent_status` for exact evidence and deliberate next actions. A stale `running` state does not prove that a worker is still active. The extension never replays interrupted actions or actions with unclear outcomes automatically.
|
|
56
68
|
|
|
57
69
|
The TUI has two separate compact status widgets. Each widget has one row for each visible worker or task. `D` marks direct work, and `I` marks isolated work. Badges such as `[S]` and `[I3]` identify the Role initial. Isolated badges also include the model class: `1` fast, `2` balanced, `3` frontier, `*` fav.
|
|
58
70
|
|
|
59
|
-
Each direct row starts with a saved direct reference such as `D7.1`. `D7` is the workflow number in this Pi session, and `.1` is the position of the worker in the original request. `/subagent` uses the same reference and name. The Herdr tab label shows them at launch. Numbers continue after reload, and the session never uses a number again.
|
|
71
|
+
Each direct row starts with a saved direct reference such as `D7.1`. `D7` is the workflow number in this Pi session, and `.1` is the position of the worker in the original request. `/subagent` uses the same reference and name. The Herdr tab label shows them at launch. Numbers continue after reload, and the session never uses a number again.
|
|
60
72
|
|
|
61
|
-
|
|
73
|
+
A session switch can move a workflow into a session that already uses its number. In that case, the workflow gets a new number there. An existing Herdr tab keeps its original launch label.
|
|
74
|
+
|
|
75
|
+
The direct widget shows the launched model, thinking level, elapsed time, and measured task tokens (`— tok` until usage is available). Failed rows show before working and completed rows. When rows overflow, `… N more` includes counts by status.
|
|
76
|
+
|
|
77
|
+
The isolated widget shows the recorded task state and any retained workspace. It does not show reliable live model, thinking, or token readings from Herdr. Attention shows before ordinary work, and overflow uses `+N more · /subagent`. An aborted request with visible tasks has its own `request aborted` row. This row does not change the recorded statuses of the tasks.
|
|
78
|
+
|
|
79
|
+
A committed worker without a checked candidate can show attention, not readiness. Status glyphs use the active TUI theme. The text also names the status without color.
|
|
80
|
+
|
|
81
|
+
The direct widget and result summaries show measured tokens for the current task turn. This count adds input and output tokens from completed assistant usage records. It excludes cache-read and cache-write tokens. A continued worker counts only its new task turn. Missing usage stays unknown. This display count does not change token-limit accounting.
|
|
62
82
|
|
|
63
83
|
A ready isolated candidate is **not promoted** to Main. To reload the menu and the isolated widget from saved state, choose **Refresh** in `/subagent`. Refresh does not recover or change a request. Use `/subagent` or `subagent_status` for exact identities, failures, and recovery.
|
|
64
84
|
|
|
@@ -76,8 +96,8 @@ Main chooses the mode from your request. You do not need to select one. Words su
|
|
|
76
96
|
|
|
77
97
|
| Mode | Request that triggers it | Checkout behavior |
|
|
78
98
|
| --- | --- | --- |
|
|
79
|
-
| `direct` | Bounded research, review, or explicitly authorized
|
|
80
|
-
| `isolated` | Implementation or a checked task graph | Runs changesets in owned Herdr worktrees
|
|
99
|
+
| `direct` | Bounded research, review, or explicitly authorized writes and commits in the shared checkout | Opens Herdr tabs without focus in Main's current workspace. Creates no worktree. |
|
|
100
|
+
| `isolated` | Implementation or a checked task graph | Runs changesets in owned Herdr worktrees. Main selects, validates, and promotes exact candidates. |
|
|
81
101
|
|
|
82
102
|
Keep trivial mechanically verifiable work in Main. Keep tightly coupled changes under one owner. Do not split them by file count.
|
|
83
103
|
|
|
@@ -103,25 +123,69 @@ Parallel: { mode: "direct", tasks: [{ role, name, task, access, ... }] }
|
|
|
103
123
|
Chain: { mode: "direct", chain: [{ role, name, task, access, ... }] }
|
|
104
124
|
```
|
|
105
125
|
|
|
106
|
-
Every direct task declares `access: "read"` or `access: "write"`. A missing or other value fails before launch. Main declares `write` when the task can change files, Git state, or external resources. The extension does not enforce `read`. There is no sandbox, and a read task keeps all the tools of its Role.
|
|
126
|
+
Every direct task declares `access: "read"` or `access: "write"`. A missing or other value fails before launch. Main declares `write` when the task can change files, Git state, or external resources. The extension does not enforce `read`. There is no sandbox, and a read task keeps all the tools of its Role.
|
|
127
|
+
|
|
128
|
+
A request is a write request when any task declares `write`. Read requests skip checkout admission and return plain-text answers. Their parallel `tasks` run concurrently up to `maxSubagents`, but a `chain` still runs in order. Use isolated mode for checked writes.
|
|
129
|
+
|
|
130
|
+
Direct tasks use the declared tools, extensions, Skills, and MCP servers of the selected Role, including resources that can write. Authorization comes from your request and Main's bounded task packet, not from the capabilities of the Role. Name the permitted paths, actions, and exclusions. Preserve unrelated edits and staged changes. Authorize commits or external actions explicitly.
|
|
131
|
+
|
|
132
|
+
For example, a configured Git operator with `bash` can stage named pending files and commit them on the `fast` route. Use isolated mode for a checked changeset.
|
|
133
|
+
|
|
134
|
+
Direct writes change Main's checkout immediately. They require no clean checkout. They give no automatic checks, rollback, or isolated integration guarantee. A write request cannot start while a direct writer owns the checkout. It also cannot start while a Main call that can write is in progress there.
|
|
135
|
+
|
|
136
|
+
A write request runs its tasks in sequence. It holds checkout admission after the initial handle returns. Competing direct writers and Main writes fail until the extension proves that all owned workers stopped. To keep Main free to write, use `mode: isolated`. This mode gives worktree checks and explicit integration, not immediate changes to the shared checkout. Parallel read requests still run concurrently.
|
|
137
|
+
|
|
138
|
+
A failure in a write request stops further dispatch, but a worker with an uncertain state can still run. Chains replace each literal `{previous}` with the preceding successful answer and stop on failure. Task outcome and worker termination are separate.
|
|
139
|
+
|
|
140
|
+
After settlement, the coordinator closes exact owned writer panes. It releases admission only after pane absence and two empty private process-lease scans. This proof requires native `lsof`. The coordinator removes no Git files, commits, or saved sessions. A failure stays a failure even when the coordinator releases admission.
|
|
141
|
+
|
|
142
|
+
Admission stays held if the close fails, identity changes, a leased child survives, or inspection is uncertain. In that case, open `/subagent`. Select the exact direct workflow. Then choose **Close/cancel-and-release ALL owned workers in this workflow** to cancel dispatch and try termination again. This action stops every owned worker of that workflow, not one selected worker.
|
|
143
|
+
|
|
144
|
+
The action checks session, branch, epoch, and live ownership. Recorded-only tasks cannot unlock anything. Resolve the reported blocker, including any surviving owned process. Then do the same action again. A restart of Pi is not termination proof.
|
|
145
|
+
|
|
146
|
+
Inspect partial changes before new writes. To recover, never retry a commit or delete work without inspection.
|
|
147
|
+
|
|
148
|
+
Tab creation can time out or return an incomplete or mismatched identity. In that case, `/subagent` retains the allocation intent. This includes the workspace, checkout, label, private lease and session paths, and any returned tab and pane IDs. No worker starts until the extension verifies the creation identity. These records are evidence, not ownership.
|
|
107
149
|
|
|
108
|
-
|
|
150
|
+
Close is not available for an unverified allocation. Admission stays held until you reconcile it manually against Herdr. Do not create the tab again. Do not guess missing IDs or restart to bypass this blocker.
|
|
109
151
|
|
|
110
|
-
|
|
152
|
+
A Close that starts while a worker is active keeps its branch, session, and epoch guards until the cancellation settles. Stale dialogs cannot close panes or release admission.
|
|
111
153
|
|
|
112
|
-
|
|
154
|
+
Tasks in a write request must return one JSON completion object, such as `{"outcome":"succeeded","answer":"Scoped commit completed."}`. `outcome` must be `succeeded`, `failed`, or `blocked`, and `answer` must be non-empty. A normal final Pi turn is not sufficient. Failure, blocked work, plain text, or a malformed completion stops later dispatch.
|
|
113
155
|
|
|
114
|
-
|
|
156
|
+
But admission depends on proved termination, not on the reported outcome. Success is the explicit report of the worker. It is not an independent validation of its changes.
|
|
115
157
|
|
|
116
|
-
The tool returns a task ID and the first Herdr tab after launch, not the answer. The extension observes each worker and sends one result to Main when the workflow finishes. If Main is busy, Pi queues the result after the current turn. If Main is idle, the result starts a turn. The extension does not report a blocked, stalled, unknown, or truncated result as success.
|
|
158
|
+
The tool returns a task ID and the first Herdr tab after launch, not the answer. The extension observes each worker and sends one result to Main when the workflow finishes. If Main is busy, Pi queues the result after the current turn. If Main is idle, the result starts a turn. The extension does not report a blocked, stalled, unknown, or truncated result as success.
|
|
159
|
+
|
|
160
|
+
In the result, each launched worker has a line with its model, thinking level, measured task tokens, and elapsed time. For example: `✓ [1/2] Check · worker · provider/model · thinking high · 1.5k tok · 42s`. If Pi recorded no usage, the line shows `tokens unknown`. Failed and stopped workers show the usage that the extension measured until they ended. A worker that the extension skipped before launch shows no usage.
|
|
161
|
+
|
|
162
|
+
The result details contain the same values in each entry as `model`, `thinkingLevel`, `tokens`, and `elapsedMs`. When the token count is unknown, `tokens` is absent. If a task fails after its worker produced text, the result keeps a bounded excerpt marked as partial output. This excerpt is never success.
|
|
163
|
+
|
|
164
|
+
Every worker result delivered to Main starts with a header. The header states that the text is the output of the worker and carries no user authority. The extension inserts a backslash in text that imitates harness framing. Examples are `<system-reminder>`-style tags and lines that start with `Human:` or `Assistant:`. Nothing else changes. Isolated status and follow-up answer previews use the same header.
|
|
165
|
+
|
|
166
|
+
A session switch or shutdown stops observation and preserves tab identities for recovery. To inspect exact tabs, agents, and Pi session files, open `/subagent` on the session branch. This includes tabs launched after the first. The menu has one row for each workflow.
|
|
167
|
+
|
|
168
|
+
A single worker shows its reference, Role, and name (`D7.1 · worker · Search audit`). A multi-worker workflow shows its reference and worker count (`D8 · 3 workers`). When you select it, the menu lists each recorded worker by reference, Role, and name with its exact IDs. References and names help you match rows. The extension never uses them to decide ownership.
|
|
169
|
+
|
|
170
|
+
Older records without saved references show their saved allocation label or exact task ID. A `recorded only` row does not prove that its workers run or finished. The menu labels locally observed work separately.
|
|
117
171
|
|
|
118
172
|
### Continue or stop one direct worker
|
|
119
173
|
|
|
120
|
-
Main can continue a finished direct worker, so it does not have to start a
|
|
174
|
+
Main can continue a finished direct worker, so it does not have to start a new one. It adds `continueFrom` with the reference of the worker, such as `"continueFrom": "D7.1"`, to any single, parallel, or chain task. It uses the same `role` that the worker ran with. The worker resumes its saved Pi session in a new Herdr tab without focus, so it keeps its earlier context.
|
|
175
|
+
|
|
176
|
+
The new tab gets a new agent name and reference. Its record points to the same session and private lease file. The launch handle and the result say `continued from D7.1`. Access, admission, write rules, and model routes are the same as for a new task.
|
|
177
|
+
|
|
178
|
+
A request can continue each worker only one time, and only from the checkout and Herdr workspace where the worker ran. After a continuation, continue the newest reference. The extension refuses an older reference to the same session, because a later turn follows its own turn.
|
|
179
|
+
|
|
180
|
+
Before launch, the request fails if the reference is unknown or matches more than one record on this session branch. It also fails if the Role is different or a locally active task still owns the session of the worker. A missing session file or a session file larger than 16 MiB also causes failure. The last session turn for the recorded prompt must be finished.
|
|
181
|
+
|
|
182
|
+
If Herdr still lists the old agent, the agent must match the recorded name, pane, tab, workspace, and checkout. It must also be idle or done. The extension never closes a working or blocked agent. The extension closes the old pane, then proves pane absence and two empty lease scans.
|
|
183
|
+
|
|
184
|
+
Records saved before 27.0.0 have no turn identity. The extension cannot continue them. For these records, start a new task.
|
|
121
185
|
|
|
122
|
-
|
|
186
|
+
In a running workflow that has only `read` tasks, `/subagent` shows **Stop this worker** for each running worker. It aborts only that worker, sends Ctrl-C, closes its exact pane, and proves pane absence and two empty lease scans. The result of the worker becomes a failure, `Stopped by user from /subagent`, and keeps any partial output. Other workers continue, but a chain stops its later steps.
|
|
123
187
|
|
|
124
|
-
|
|
188
|
+
If the extension cannot prove termination of the stopped worker, the workflow keeps local ownership. So **Close/cancel-and-release** stays available. Main receives one result when the workflow finishes. A workflow with a `write` task offers only **Close/cancel-and-release ALL owned workers in this workflow**. Both actions check session, branch, and epoch, so a stale dialog cannot act.
|
|
125
189
|
|
|
126
190
|
### Isolated checked graphs
|
|
127
191
|
|
|
@@ -168,27 +232,65 @@ An isolated request has one durable ID, one goal, and 1 to 8 typed tasks:
|
|
|
168
232
|
}
|
|
169
233
|
```
|
|
170
234
|
|
|
171
|
-
`dependsOn` controls scheduling. `contextFrom` also schedules dependencies and carries completed text outputs in the declared order. Do not repeat the same task in both fields. Changesets require focused task checks. A graph with changesets requires final checks.
|
|
235
|
+
`dependsOn` controls scheduling. `contextFrom` also schedules dependencies and carries completed text outputs in the declared order. Do not repeat the same task in both fields. Changesets require focused task checks. A graph with changesets requires final checks.
|
|
236
|
+
|
|
237
|
+
The canonical root `package.json` must have a test script. If `pnpm test` is not in the final checks, the runner adds it. Main runs it on the combined integration checkout before promotion. Checks and judgments bind to exact Git identities. Changes to the candidate or Main, changes during validation, unclear outcomes, or conflicts stop promotion. The extension retains evidence.
|
|
238
|
+
|
|
239
|
+
`delegate_task`, `subagent_resume`, and `subagent_integrate advance` return a durable request ID after the extension saves the wave. Productive work continues while Main is free. Main can do other work or end its turn. It does not need to sleep or poll. Pi sends a follow-up in the launching session when a checked worker becomes ready or a worker needs attention. Pi sends another follow-up when the wave finishes.
|
|
240
|
+
|
|
241
|
+
A worker can end its exact turn without a changed clean commit, for example after a failed or aborted turn. That worker needs attention, and the extension does not infer a candidate. Use `subagent_status` for its saved evidence.
|
|
242
|
+
|
|
243
|
+
A turn can end with tracked or untracked changes in the worktree. The coordinator then first sends the same worker one saved reminder for each dispatch try. The reminder tells the worker to commit the changes or explain why not. The reminder does not use a correction or a dispatch try. The coordinator never commits, stages, stashes, or discards the changes itself. If the worktree is still dirty after the reminder, the task needs attention, and the changes stay in place.
|
|
244
|
+
|
|
245
|
+
Follow-ups show only a short preview of a failed review verdict. They tell Main to run `subagent_status` for the full text. Session replacement or shutdown suppresses stale delivery. The extension then logs the request ID and reason, without prompts or credentials.
|
|
246
|
+
|
|
247
|
+
The extension reports synchronous delivery failures and does not replay them automatically. Pi reports asynchronous `send_message` failures through its native runtime. If delivery fails, inspect `subagent_status`.
|
|
248
|
+
|
|
249
|
+
The extension saves completed text answers independently of cleanup. Status and terminal follow-ups include a bounded preview of the accepted answer and cleanup evidence. Ignored automatic artifacts can retain a checkout, and this does not violate the read-only contract. The extension deletes no ignored files to make cleanup pass.
|
|
250
|
+
|
|
251
|
+
Tracked or untracked changes, a changed checkout identity, or unproved inspection still require attention. The completed answer stays saved. But the extension does not accept it as dependency context or retry it automatically. Retained text checkouts require deliberate manual inspection and cleanup. A retained checkout alone is not evidence that the Role edited source.
|
|
252
|
+
|
|
253
|
+
Isolated workers can start while Main has staged, unstaged, or untracked changes. They use only Main's pinned committed branch, HEAD, and tree. The extension does not copy those local edits into worker worktrees. It also does not stash, stage, reset, or merge them automatically. Main must stay at that committed identity while workers run. Changes to the branch or HEAD block new waves.
|
|
254
|
+
|
|
255
|
+
The worker produces a committed candidate without tracked or untracked changes. Then it runs focused preliminary checks and optional judgment. Ignored generated files do not block candidacy, but they prevent automatic worktree cleanup. Inspect them before you delete retained work. The runner records each ready candidate immediately but **does not integrate it automatically**. Main can inspect `subagent_status`.
|
|
172
256
|
|
|
173
|
-
|
|
257
|
+
While siblings still work, Main can use `subagent_stage` to select the exact candidate in an owned integration worktree. Main resolves conflicts there. Stage and resolve are available during an active wave, but rejection and revision wait until the wave settles. `subagent_integrate` can advance dependent tasks from a staged snapshot.
|
|
174
258
|
|
|
175
|
-
|
|
259
|
+
After the wave settles, it can validate the combined tip with full root checks and optional final judgment. It promotes the tip to Main only after exact validation. A definitive failed combined check or review permits one committed correction in the integration checkout, followed by another validation. Main must explicitly promote. Promotion and cleanup never silently discard retained work.
|
|
176
260
|
|
|
177
|
-
|
|
261
|
+
To select work by label, open `/subagent` without arguments. The menu shows direct records on this session branch and isolated requests in the current canonical Git checkout. This includes requests launched in other sessions. Select an isolated request. Then select **Inspect status and recovery**.
|
|
178
262
|
|
|
179
|
-
|
|
263
|
+
This launches a Herdr tab without focus, with the configured `scout` Role on the configured `fast` route. The tab runs a read-access task with the resources of the Role. Its prompt contains bounded saved status, including retained paths, but not the raw launch environment or session transcripts. The analysis stays in that tab and does not queue a Main turn. The tab shows in the direct list with its own reference and name, such as `D9.1 · scout · Inspect <request ID>`. The extension records the tab and session file for recovery, even if the launch becomes uncertain.
|
|
180
264
|
|
|
181
|
-
|
|
265
|
+
Before any stage or recovery action, the read-only `subagent_status` tool stays Main's authority for exact identities. If Herdr, the `scout` Role, or the fast route is not available, inspection fails and does not change the request. Main can then use `subagent_status`.
|
|
266
|
+
|
|
267
|
+
For older work, choose Refresh or completed/history. The extension shows a warning for invalid state IDs and preserves them. Direct recovery still works outside Git or when isolated inventory is not available. The browse action does not resume work or change resources. Direct **Close/cancel-and-release** is an explicit termination action.
|
|
268
|
+
|
|
269
|
+
For a locally active unsealed isolated changeset, choose **Send follow-up instructions** to open a native multiline editor. A submission queues the instruction, not a completed revision. Choose **Edit queued instructions** to withdraw *all still-pending* instructions for that selected task before the editor opens. Their full text shows in FIFO order, with blank lines between them. An explicit submission queues **one replacement** at the end. If you cancel, the withdrawn instructions stay removed.
|
|
270
|
+
|
|
271
|
+
You cannot recall already-claimed instructions, initial prompts, or automatic corrections. A worker can seal while you edit. If the submission fails, the editor opens again with the full submitted text. You can then edit or copy it deliberately. The extension never queues it again automatically.
|
|
272
|
+
|
|
273
|
+
The editor preserves combined text above the single-instruction limit, but rejects it until you make it shorter. A cancel before withdrawal makes no change. Neither action touches Main's editor or Pi's global Option+Up queue shortcut. Sessions without a UI can run `/subagent recover` or use agent tools for individual inspection and recovery.
|
|
182
274
|
|
|
183
275
|
A queued follow-up runs after the current turn settles. It must produce a new clean commit that passes preliminary checks again. When no queued revision remains, the checked candidate seals immediately. There is no guaranteed time to edit after completion. Late follow-ups fail visibly.
|
|
184
276
|
|
|
185
277
|
### Isolated recovery
|
|
186
278
|
|
|
187
|
-
`subagent_integrate validate` acknowledges only after it saves the validation intent of the exact generation. Then it runs checks and any final judgment in the background. A later turn cancellation does not cancel acknowledged validation. Session replacement or shutdown still stops it.
|
|
279
|
+
`subagent_integrate validate` acknowledges only after it saves the validation intent of the exact generation. Then it runs checks and any final judgment in the background. A later turn cancellation does not cancel acknowledged validation. Session replacement or shutdown still stops it.
|
|
280
|
+
|
|
281
|
+
Completion sends a follow-up to the launching session. If delivery fails, use `subagent_status`. An acknowledgement is not passing evidence.
|
|
282
|
+
|
|
283
|
+
After an interruption to validation, first prove that the old coordinator and check processes stopped. Never take over a live productive lease. Use guarded `reconcile` on the saved generation and `combinedTip`. Missing checks or review never authorize `correct` or `promote`.
|
|
188
284
|
|
|
189
|
-
|
|
285
|
+
For a `validation_failed` generation with **no recorded checks, review, or prior combined correction**, `refresh` also accepts identical `expectedMain` and `newMain`. Supply the exact old combined `expectedTip` and the next generation number. Both Main and the retained integration tip must stay exact and clean. This action explicitly allocates a new checkout. It does not resume old checks.
|
|
190
286
|
|
|
191
|
-
|
|
287
|
+
Before promotion, restage the selected immutable candidates. Then run new full-suite checks and the required final judgment. The old generation stays retained, and the two-checkout limit still applies. Correction allowances do not reset. Other failures keep their existing recovery requirements.
|
|
288
|
+
|
|
289
|
+
After a coordinator interruption, run `/subagent recover` one time. It gets the repository productive lease before it changes any orphaned `pending` or `running` state. It preserves unreadable state files and retained candidates. It reports blockers and existing continuations to Main. It does not replay prompts, merges, promotion, or cleanup.
|
|
290
|
+
|
|
291
|
+
If another productive run holds the lease, the command only reads status and reports the live owner. Wait. Do not take over. You can safely run the command again.
|
|
292
|
+
|
|
293
|
+
Main uses `subagent_status` for exact identities. Main uses the recovery tools in the interface table above for deliberate decisions. The command never stages or promotes. Direct Herdr tab recovery stays in `/subagent`.
|
|
192
294
|
|
|
193
295
|
### Prune leftover worktrees
|
|
194
296
|
|
|
@@ -200,15 +302,49 @@ Run `/subagent prune` to clean up leftover worker and integration checkouts unde
|
|
|
200
302
|
- No productive run holds a repository lease.
|
|
201
303
|
- No Herdr pane works inside the checkout. If the command cannot inspect Herdr, it refuses every checkout.
|
|
202
304
|
|
|
203
|
-
One confirmation removes every listed removable item. When the command removes a checkout, it also deletes the ignored files of the checkout, such as `node_modules` or `dist`.
|
|
305
|
+
One confirmation removes every listed removable item. When the command removes a checkout, it also deletes the ignored files of the checkout, such as `node_modules` or `dist`. So the command includes a checkout with ignored files only after a second confirmation. That confirmation names each ignored entry, and its approval covers all contents of each named entry.
|
|
306
|
+
|
|
307
|
+
If a top-level ignored entry is new or changed, the command skips the checkout. If the full list of ignored entries of a checkout does not fit in that dialog, the command excludes the checkout. The command blocks checkouts with initialized submodules. It also blocks owned checkouts that are detached or on another branch. Remove them manually.
|
|
308
|
+
|
|
309
|
+
The list shows removable items first. The command never cuts a long list silently. The list ends with `+N more not shown`, and the command does not remove the items that it did not show in that run. Run `/subagent prune` again to review them.
|
|
204
310
|
|
|
205
|
-
|
|
311
|
+
The command checks each item again immediately before removal and skips an item that changed. If the session or branch changes during removal, the command skips the remaining steps. The command deletes a branch only if the branch still points at the reviewed tip. Then the command reconciles each aborted request that recorded a removed resource. It uses the same guarded path as a repeated `subagent_abort`, so the cleanup of that request no longer shows as pending.
|
|
206
312
|
|
|
207
|
-
|
|
313
|
+
The report lists removed, skipped, and failed items, and each request that the command could not reconcile. Without interactive UI, the command only reports.
|
|
314
|
+
|
|
315
|
+
If an isolated worker produced no candidate, `subagent_abort` terminates it. It removes only owned resources that it proves are unchanged and clean. Cleanup includes ignored-file checks and never discards unique commits. The request stays aborted with retained-resource evidence if productive work has not settled, termination is uncertain, or cleanup fails.
|
|
316
|
+
|
|
317
|
+
Inspect `subagent_status`. Resolve the reported blocker. Then run `subagent_abort` again to reconcile cleanup. This does not replay worker prompts. Dirty work, unique commits, and uncertain allocations stay for deliberate manual recovery.
|
|
318
|
+
|
|
319
|
+
If you removed the checkouts, branches, and Herdr workspaces of a request outside Pi Subagent, `subagent_abort` can close the request. Abort examines each retained candidate and each integration generation with stages. It proves that the checkout is not registered, its path does not exist, and its branch does not exist.
|
|
320
|
+
|
|
321
|
+
Abort also proves worker absence with the same pane and lease checks. Then it records the candidates as rejected and released, and it completes the cleanup records. If one of these resources still exists, abort fails and does not change the request. In that case, release the resources first.
|
|
208
322
|
|
|
209
323
|
The following details describe exact identity and retained-work requirements.
|
|
210
324
|
|
|
211
|
-
A checked candidate stays retained if Main is dirty. Staging, combined validation, and promotion require Main to be clean at the pinned committed identity. Clean your local edits deliberately before you use those actions. The extension does not replay or merge dirty work automatically.
|
|
325
|
+
A checked candidate stays retained if Main is dirty. Staging, combined validation, and promotion require Main to be clean at the pinned committed identity. Clean your local edits deliberately before you use those actions. The extension does not replay or merge dirty work automatically.
|
|
326
|
+
|
|
327
|
+
To stage, pass the exact `generation`, candidate (`taskId`, `attempt`, `candidate`), and `expectedTip` identities that status reports. To integrate, pass the generation and the combined `expectedTip`. If Main advances cleanly before promotion, call `subagent_integrate refresh` with the recorded `expectedMain`, the old `expectedTip`, and the new clean `newMain`. Main must restage selected immutable candidates into the new generation. Then Main must run combined checks again. Dirty or divergent Main blocks refresh.
|
|
328
|
+
|
|
329
|
+
Stale identities fail. If integration allocation was uncertain, `subagent_stage resolve` first proves that the owned checkout is still at its base. Then it starts the selected merge. Otherwise, it retains the intent.
|
|
330
|
+
|
|
331
|
+
Each request can keep at most two unreleased integration worktrees. A superseded generation is read-only.
|
|
332
|
+
|
|
333
|
+
To release a superseded *clean* integration checkout, call `subagent_integrate` with `{ id, action: "release", generation, expectedTip }`. As `expectedTip`, use the recorded tip of that generation. After `correct`, this is the correction tip. Otherwise, it is the last staged tip, or the integration base when no stage completed. A superseded generation keeps its correction record for this purpose.
|
|
334
|
+
|
|
335
|
+
You can release a rejected candidate after release of all generations that use it. This includes a dependent candidate that a refresh or a rejection made invalid.
|
|
336
|
+
|
|
337
|
+
Release first proves that the exact worker stopped. If the worker is already gone, release records the proof of absence. If the idle worker still runs, release closes its exact pane. Then it proves pane absence and two empty lease scans. Release never tries again to close a worker after an uncertain termination.
|
|
338
|
+
|
|
339
|
+
To release the candidate, pass `{ id, action: "release", generation: <latest generation number, or 1>, taskId, attempt, expectedTip: <candidate tip> }`. Release saves each host, checkout, and branch step. It verifies ownership and cleanliness, including ignored files. It deletes the branch only if its ref still names the exact tip.
|
|
340
|
+
|
|
341
|
+
Dirty, conflicted, changed, or uncertain resources stay for manual inspection. After you resolve the obstacle, do the same release again. Each released checkout frees a retained slot. Abort is available after release of every retained resource. Abort also removes an empty integration generation that a refresh created, if its checkout is clean at its base.
|
|
342
|
+
|
|
343
|
+
Rejection can invalidate dependent work. A rejection does not fail because of dependent work that a refresh or an earlier rejection already made invalid. If new dependent execution is not possible, start a new request. Do not force promotion.
|
|
344
|
+
|
|
345
|
+
Productive requests have no whole-run wall-clock deadline. Resume does not reset the recorded policy or correction count. Text tasks have two dispatch tries. Inspection failures before dispatch do not use a try. Verification requires passing preliminary checks and any required judgment. It cannot override a failed review.
|
|
346
|
+
|
|
347
|
+
Child limits, abort signals, process I/O, status inspection, exact termination, and cleanup keep finite safety bounds.
|
|
212
348
|
|
|
213
349
|
The extension never pushes, opens a pull request, publishes, deploys, force-cleans recoverable work, or silently falls back to Main.
|
|
214
350
|
|
|
@@ -226,15 +362,19 @@ pi-subagent owns `~/.pi/agent/config/pi-subagent/config.json`. If the file is mi
|
|
|
226
362
|
| `timeout.maxMinutes` | Ephemeral child hard runtime | Greater than idle and within Node's timer range | `30` |
|
|
227
363
|
| `roleDefaults` | Optional `extensions`, `tools`, and `skills` arrays merged into every built-in and user Role, with the same validation as Role fields | Object with `extensions`, `tools`, or `skills` | None |
|
|
228
364
|
|
|
229
|
-
In each merged list, `roleDefaults` entries come first, and the entries of the Role follow. The merge removes duplicates and occurs before resource resolution. Use `roleDefaults` for the provider extension that every child needs.
|
|
365
|
+
In each merged list, `roleDefaults` entries come first, and the entries of the Role follow. The merge removes duplicates and occurs before resource resolution. Use `roleDefaults` for the provider extension that every child needs.
|
|
366
|
+
|
|
367
|
+
Limits come only from this global file. Request fields cannot override or replenish them. Existing durable requests keep their recorded policy, but a lower current correction limit can tighten recovery. There is no whole-run timeout setting.
|
|
230
368
|
|
|
231
|
-
A bad config never stops the extension.
|
|
369
|
+
A bad config never stops the extension. The extension shows each new problem one time at launch and each time it reads the file. It reads the file for `delegate_task`, each later worker of a direct chain, and each isolated Role launch. It also reads the file for `/subagent roles` or a status inspection:
|
|
232
370
|
|
|
233
371
|
- An unknown key shows a warning. The extension ignores the key.
|
|
234
372
|
- A misspelled key that is near a missing key, such as `maxToken` for `maxTokens`, counts as an invalid value of that key. The warning gives the likely key.
|
|
235
373
|
- An invalid value in `maxSubagents`, `maxTurns`, `maxCorrections`, or `timeout` shows a warning. The extension uses the finite default for that key. If `timeout.maxMinutes` is not greater than `timeout.idleMinutes`, the extension uses the default `timeout`.
|
|
236
374
|
- An unknown or invalid key in `roleDefaults` shows a warning. The extension ignores only that key, so Roles get fewer default resources.
|
|
237
|
-
- An invalid or misspelled `maxTokens
|
|
375
|
+
- An invalid or misspelled `maxTokens` shows an error and blocks delegation. Malformed JSON, invalid UTF-8, a file larger than 64 KiB, or an unreadable file also causes this block. The default token limit is unlimited, so the extension does not use a default in these cases. `/subagent` stays available. Correct the file to enable delegation again.
|
|
376
|
+
|
|
377
|
+
The block also applies to work that already runs. The next worker of a direct workflow, or the next Role launch of an isolated request, fails before it starts. A workflow that runs keeps the limits that it started with. If the file had the problem when the session started, also run `/reload`. The session took its execution limits from the defaults.
|
|
238
378
|
|
|
239
379
|
No key is required. The extension preserves the file and never rewrites it automatically.
|
|
240
380
|
|
|
@@ -252,7 +392,11 @@ Role Markdown is in `~/.pi/agent/config/pi-subagent/`. It requires frontmatter a
|
|
|
252
392
|
| `mcps` | Optional exact server names from `~/.pi/agent/mcp.json` in Pi's native `mcpServers` format; omitted or `[]` denies MCP access |
|
|
253
393
|
| body | Required system instructions |
|
|
254
394
|
|
|
255
|
-
The extension rejects unknown frontmatter keys and names the file and key. It reports each invalid file separately. Valid Roles still load. Delegation to the Role that an invalid file claims fails with the error of that file. Duplicate names make that name unavailable. `/subagent roles` lists the errors.
|
|
395
|
+
The extension rejects unknown frontmatter keys and names the file and key. It reports each invalid file separately. Valid Roles still load. Delegation to the Role that an invalid file claims fails with the error of that file. Duplicate names make that name unavailable. `/subagent roles` lists the errors.
|
|
396
|
+
|
|
397
|
+
Roles describe responsibility and capabilities, not write access or isolation. Each task declares access, and each request chooses its mode. A user Role with the same name overrides a built-in Role. The package ships `implementer`, `reviewer`, and `scout`.
|
|
398
|
+
|
|
399
|
+
The built-in reviewer includes `git_read`. To opt in, add `git_read` to the `tools` array of an existing user reviewer. No additional extension or Bash access is necessary.
|
|
256
400
|
|
|
257
401
|
### Reviewer Git inspection
|
|
258
402
|
|
|
@@ -267,19 +411,41 @@ The extension rejects unknown frontmatter keys and names the file and key. It re
|
|
|
267
411
|
| `blame` | Required `path`, optional `revision` and paired `startLine`/`endLine` |
|
|
268
412
|
| `rev-parse` | Optional `revision`; resolves one commit ID |
|
|
269
413
|
|
|
270
|
-
Revisions accept commit IDs or named refs with optional `~N`/`^N` ancestry, not ranges or reflog expressions. Paths are literal and relative to the assigned cwd. The tool rejects absolute paths, traversal, `.git` components, and
|
|
414
|
+
Revisions accept commit IDs or named refs with optional `~N`/`^N` ancestry, not ranges or reflog expressions. Paths are literal and relative to the assigned cwd. The tool rejects absolute paths, traversal, `.git` components, and paths that look like options.
|
|
415
|
+
|
|
416
|
+
Use named candidate refs. Do not assume that Main's checkout contains an isolated candidate. In isolated judgment, the supplied exact patch stays authoritative. Git inspection supplies only referenced context, not a replacement diff. Reviewers still cannot run tests, write, commit, or push. They approve only with exact `PASS`.
|
|
417
|
+
|
|
418
|
+
You can cancel each call, and each call has a limit of 30 seconds. Results keep at most the last 32 KiB of UTF-8 output, with an explicit `truncated` flag and notice. If output is truncated, make the path, log count, or blame lines narrower. Do not treat truncated evidence as complete. Missing refs or files, non-repositories, invalid UTF-8, timeouts, and Git failures fail visibly. The tool writes no full-output artifact.
|
|
271
419
|
|
|
272
|
-
|
|
420
|
+
Git must support `--no-lazy-fetch`. Older versions fail and do not permit network access. The tool disables lazy fetch, pager, optional locks, hooks, fsmonitor, external diffs, textconv, and clean and process filters. So working-tree comparisons use unfiltered bytes and can be different from filter-aware Git output (for example Git LFS). The tool does not inspect submodule contents. Concurrent edits can still make direct inspection stale.
|
|
273
421
|
|
|
274
422
|
### Child resources
|
|
275
423
|
|
|
276
|
-
Children run with `--no-extensions`.
|
|
424
|
+
Children run with `--no-extensions`. So a Role must list the extension that registers the provider of its route model. Only declared resources and required internal policy adapters load. `builtin:<name>` entries explicitly load Pi built-in extensions (`builtin:codemode`, `builtin:tool-search`, `builtin:llama.cpp`).
|
|
277
425
|
|
|
278
|
-
|
|
426
|
+
The extension rejects `builtin:mcp`, because it would connect every configured server and bypass `mcps`. Scripts can still call extension tools registered with `codemode` or `deferred` exposure. But the model gets their declarations only when `tools` names them.
|
|
279
427
|
|
|
280
|
-
|
|
428
|
+
Main's nested calls pass admission by their own tool names, not by script or ancestor ownership. Each call that can write, including Bash, prevents the start of a direct writer until that call returns a result or execution end. Main calls do not block each other. The completion of a script does not release its active nested calls. A nested call can still pass admission after its parent ends if no direct writer owns the checkout.
|
|
281
429
|
|
|
282
|
-
|
|
430
|
+
To let a Role run `codemode` scripts, list `builtin:codemode` in `extensions`. Also list `codemode` in `tools`. Both are required, because the built-in registers the tool as inactive and the Role tool policy activates it. If `tools` has `codemode` alone, the launch fails with an unavailable tool.
|
|
431
|
+
|
|
432
|
+
Pi's `codemode.mode` and `codemode.inlineBudget` settings apply in the child without change. So the Role never forces codemode-only operation. MCP configuration never activates `codemode` in a child. Scripts can call only the active tools of the Role, plus `codemode` and `deferred` extension and MCP tools. Inactive base tools such as `bash` stay unreachable.
|
|
433
|
+
|
|
434
|
+
The servers named in `mcps` come only from the global `~/.pi/agent/mcp.json`. In a Role that activates `codemode`, each selected server keeps its configured `exposure` and `toolExposure`. Pi's default `codemode` exposure makes tools callable from scripts without declarations. `direct` declares them. `deferred` tools stay reachable from scripts, and `hidden` tools stay unreachable. An invalid exposure value fails the launch.
|
|
435
|
+
|
|
436
|
+
In every other Role, the extension forces selected servers to `direct` exposure. It ignores `toolExposure`, because that child cannot reach undeclared tools. Declared tools show to the model as `mcp__<server>__<tool>` after the server connects. Pi replaces `-` in server and tool names with `_`. Pi appends a hash suffix when two tool names collide or a name is longer than 64 characters.
|
|
437
|
+
|
|
438
|
+
Before launch, the extension checks each selected entry against Pi's documented `mcpServers` rules, in Main and again in the child. The launch fails with the file path and field for each of these conditions:
|
|
439
|
+
|
|
440
|
+
- An entry is disabled, malformed, or uses an unknown transport.
|
|
441
|
+
- A server name is invalid.
|
|
442
|
+
- Two selected names differ only in `-` and `_`.
|
|
443
|
+
- `auth.provider` uses plain HTTP outside `localhost`, `127.0.0.1`, or `[::1]`.
|
|
444
|
+
- `oauth.authServerMetadataUrl` does not use HTTPS outside those hosts.
|
|
445
|
+
|
|
446
|
+
The extension never modifies the file. Fix the entry or choose another server. The extension passes valid `auth`, `oauth`, and `description` fields through, so Pi's native provider auth and OAuth apply. `oauth.clientRegistration` must be `dcr` or `cimd`. A `cimd` entry cannot use `clientId` or `clientName`. Any `callbackUrl` must use localhost or 127.0.0.1 with path `/callback`.
|
|
447
|
+
|
|
448
|
+
The extension still ignores project MCP overrides. A project cannot change the global server allowlist or exposure of the Role. Missing Skills, tools, MCP servers, Roles, or routes fail before productive work starts. The extension excludes Main-only delegation and recovery tools and `ask_question` from children.
|
|
283
449
|
|
|
284
450
|
## API
|
|
285
451
|
|
|
@@ -299,14 +465,20 @@ The servers named in `mcps` come only from the global `~/.pi/agent/mcp.json`. In
|
|
|
299
465
|
|
|
300
466
|
Role route and launch helpers require only model routing fields and `isProjectTrusted()` from the context, plus `cwd` for configured package resources. They do not require UI methods.
|
|
301
467
|
|
|
302
|
-
`createEphemeralSubagentExecutor` accepts global concurrency, turn/token, idle, and hard-runtime policy. Queued time consumes no child timeout. A run resolves resources only after it receives its permit. It accepts abort, output, token, and activity callbacks.
|
|
468
|
+
`createEphemeralSubagentExecutor` accepts global concurrency, turn/token, idle, and hard-runtime policy. Queued time consumes no child timeout. A run resolves resources only after it receives its permit. It accepts abort, output, token, and activity callbacks. The executor limits output and diagnostics.
|
|
469
|
+
|
|
470
|
+
A child that reports `agent_settled.aborted: true` returns a failure result with `stopReason: "aborted"`, even if its process exits with code 0. The executor keeps collected output, usage, and child error text. `aborted: false` does not prove provider success. A parent abort or timeout still rejects with `EphemeralSubagentError`.
|
|
303
471
|
|
|
304
472
|
See [Orchestration and package-author API](./docs/orchestration.md) for the detailed contracts and recovery model.
|
|
305
473
|
|
|
306
474
|
## State and storage
|
|
307
475
|
|
|
308
|
-
Durable state is private under `config/pi-subagent/state/`. The extension creates isolated worker Pi sessions in advance with mode `0600` under `config/pi-subagent/leases/`. It does not change the umask of the worker. Reads stop at the 16 MiB limit, even if the session grows.
|
|
476
|
+
Durable state is private under `config/pi-subagent/state/`. The extension creates isolated worker Pi sessions in advance with mode `0600` under `config/pi-subagent/leases/`. It does not change the umask of the worker. Reads stop at the 16 MiB limit, even if the session grows. A session above this limit requires inspection, and the extension does not accept it as completion evidence.
|
|
477
|
+
|
|
478
|
+
The extension removes sessions only after exact worker-tab cleanup. Retained sessions can contain prompts and answers, so do not share them. State v5 rejects v4 and older files and does not migrate them. Keep the old state. Recover its work manually.
|
|
309
479
|
|
|
310
480
|
## Limits and recovery
|
|
311
481
|
|
|
312
|
-
Role extensions and MCP servers are trusted executable code, not a sandbox. Select the smallest resource set. Direct tasks can use declared write
|
|
482
|
+
Role extensions and MCP servers are trusted executable code, not a sandbox. Select the smallest resource set. Direct tasks can use declared resources that can write in Main's checkout only in the authorized scope.
|
|
483
|
+
|
|
484
|
+
Checkout admission coordinates the Pi calls of this Main. It does not coordinate other Pi sessions, trusted extension lifecycle code, or external processes. Concurrent changes can make the read of a direct worker stale. Retained-work reports identify exact resources for deliberate recovery.
|