@henryqw/pi-subagent 30.1.0 → 31.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 +2 -2
- package/README.md +19 -23
- package/dist/direct-herdr.d.ts +5 -0
- package/dist/direct-herdr.js +9 -1
- package/dist/ephemeral.d.ts +9 -3
- package/dist/ephemeral.js +70 -11
- package/dist/herdr-runtime.js +4 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/native-host.d.ts +96 -0
- package/dist/native-host.js +243 -0
- package/dist/runner.d.ts +8 -1
- package/dist/runner.js +22 -15
- package/dist/schema.d.ts +71 -2
- package/dist/schema.js +14 -1
- package/dist/workspace-schema.d.ts +11 -0
- package/dist/workspace.d.ts +5 -2
- package/dist/workspace.js +58 -29
- package/docs/measurement.md +12 -1
- package/docs/orchestration-architecture.html +4 -4
- package/docs/orchestration-architecture.svg +2 -2
- package/docs/orchestration.md +72 -259
- package/docs/workspace.md +4 -80
- package/extensions/admission.ts +36 -11
- package/extensions/direct-check-exec.py +91 -0
- package/extensions/direct-check-supervisor.mjs +42 -0
- package/extensions/direct-check-witness.mjs +34 -0
- package/extensions/direct-native.ts +17 -5
- package/extensions/direct-outbox.ts +189 -0
- package/extensions/direct-owner.ts +49 -0
- package/extensions/direct-verification.ts +73 -0
- package/extensions/isolated.ts +25 -301
- package/extensions/prerequisite-evidence.ts +81 -0
- package/extensions/result-transport.ts +6 -4
- package/extensions/subagent-command.ts +12 -7
- package/extensions/subagent.ts +378 -499
- package/extensions/workflow-recovery.ts +359 -0
- package/extensions/workflow.ts +156 -40
- package/extensions/workspace.ts +16 -74
- package/package.json +2 -2
- package/skills/pi-subagent/SKILL.md +15 -37
package/docs/orchestration.md
CHANGED
|
@@ -1,25 +1,6 @@
|
|
|
1
1
|
# Orchestration and package-author API
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
```text
|
|
6
|
-
┌─ direct ─── shared checkout, native Pi or Herdr tab
|
|
7
|
-
request + Role + route ──┤
|
|
8
|
-
└─ isolated ─ Herdr worktree, checked candidate, durable state
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
Both paths resolve Roles and model routes from Pi's effective registries. They share the package's global concurrency, turn/token, timeout, and correction policy. A request cannot supply or refill execution limits.
|
|
12
|
-
|
|
13
|
-
## Choose a delegation mode
|
|
14
|
-
|
|
15
|
-
Main chooses the mode from your request. You do not need to select one. Words such as “direct” and “isolated” can show your intent, but the work sets the route. Main declares the selected mode in each `delegate_task` call. The extension never falls back between modes.
|
|
16
|
-
|
|
17
|
-
| Mode | Request that triggers it | Checkout behavior |
|
|
18
|
-
| --- | --- | --- |
|
|
19
|
-
| `direct` | Bounded research, review, or explicitly authorized writes and commits in the shared checkout | Runs native Pi workers outside Herdr. In Herdr, opens worker tabs without focus. Creates no worktree. |
|
|
20
|
-
| `isolated` | Implementation or a checked task graph | Runs changesets in owned Herdr worktrees. Main selects, validates, and promotes exact candidates. |
|
|
21
|
-
|
|
22
|
-
Keep trivial mechanically verifiable work in Main. Keep tightly coupled changes under one owner. Do not split them by file count.
|
|
3
|
+
Main sends bounded work to native Pi processes in the current checkout. The Pi widget displays each worker.
|
|
23
4
|
|
|
24
5
|
## Direct contract
|
|
25
6
|
|
|
@@ -70,46 +51,76 @@ Each entry has:
|
|
|
70
51
|
| `task` | yes | Non-empty task packet |
|
|
71
52
|
| `access` | yes | `read` or `write`; Main's honest classification, not enforced |
|
|
72
53
|
| `paths` | no | Write tasks only: 1 to 32 repo-relative globs (`path.matchesGlob` syntax, such as `src/**`). The change report flags changed paths outside them. A report only, not enforced |
|
|
54
|
+
| `dependsOn` | no | In `tasks`, names the prerequisites that must succeed before this entry starts. |
|
|
55
|
+
| `verification` | no | For a writer, supplies `criteria` and executable `checks`. |
|
|
73
56
|
| `continueFrom` | no | Direct reference such as `D7.1`; continues that finished worker's Pi session. `role` must equal the recorded Role |
|
|
74
57
|
| `kind` | no | `text` only (default); direct `changeset` is rejected |
|
|
75
58
|
| `modelClass` | no | `fast`, `balanced`, `frontier`, `ultra`, or `fav` route |
|
|
76
59
|
| `model` | no | `provider/modelId`; replaces only the route model |
|
|
77
60
|
|
|
78
|
-
An explicit model must support the route's thinking level. A
|
|
61
|
+
An explicit model must support the route's thinking level. A read can retry one transient operating-system launch failure (`EAGAIN`) when no child started. Both attempts use the original deadline and budget.
|
|
79
62
|
|
|
80
|
-
Direct `changeset` is rejected
|
|
63
|
+
Direct `changeset` is rejected. Use `verification` to attach acceptance checks. Resource validation and recursive-delegation exclusions apply to every task. A request becomes a write request when any task declares `access: "write"`.
|
|
81
64
|
|
|
82
|
-
###
|
|
65
|
+
### Prerequisites and acceptance checks
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"mode": "direct",
|
|
70
|
+
"tasks": [
|
|
71
|
+
{
|
|
72
|
+
"role": "implementer", "name": "Repair refresh", "access": "write",
|
|
73
|
+
"task": "Repair refresh handling in the current checkout.",
|
|
74
|
+
"verification": {
|
|
75
|
+
"criteria": "The refresh regression test passes.",
|
|
76
|
+
"checks": [{ "executable": "node", "args": ["--test", "test/refresh.test.js"], "timeoutMs": 10000 }]
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"role": "reviewer", "name": "Review repair", "access": "read",
|
|
81
|
+
"dependsOn": ["Repair refresh"], "task": "Review the repair and its tests."
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Use unique names in a dependency graph. Unknown prerequisites and cycles fail before launch. A dependent receives up to 4,096 bytes of prerequisite answer excerpts. For each truncated excerpt, the runtime supplies a `fullAnswer` field with the private file path, byte count, and SHA-256 digest. Pi verifies the bytes and gives the dependent a private read-only copy. A missing or changed file blocks that dependent. Short answers need no reference. The result preserves the original task order.
|
|
83
88
|
|
|
84
|
-
|
|
89
|
+
Each writer accepts up to three checks. Each check runs the specified executable and arguments in the writer's checkout, with its process lease. Use only checks authorized for that checkout. Each check stops at the shorter of its requested deadline and the configured worker maximum runtime (`timeout.maxMinutes`). Each check retains up to 8,192 bytes of combined output. A definite nonzero exit permits one correction per writer while the workflow has corrections left. The workflow shares `maxCorrections` across its writers. Set it to zero to return the failed check immediately. After a final acceptance failure, inspect the edits and explicitly close the workflow to release the checkout. A timeout, cancellation or uncertain termination also requires inspection.
|
|
85
90
|
|
|
86
|
-
|
|
91
|
+
Acceptance checks require `/usr/bin/python3`. Linux requires `libseccomp.so.2`. Pi installs an inherited kernel policy before starting the executable. Children must stay in the supervised process group. On macOS, checks can use fork and exec. Programs that require `posix_spawn` receive a permission error because its spawn attributes can create a separate group. For Node test files on macOS, use `node --test --test-isolation=none` on Node versions that provide this option.
|
|
92
|
+
|
|
93
|
+
Saved background requests record step intent before launch. After a same-host restart, Pi starts eligible unstarted reads on the original session branch. It checks their roles, resources, and saved evidence before launch. Recovery requires saved execution limits and applies the stricter of the saved and current limits. Interrupted workers count toward the concurrency limit. Recovery continues the original authorized tool call. Pi checks project trust and tool availability again before launch. For a chain, Pi substitutes the complete preceding answer wherever the task uses `{previous}`. It verifies any saved file before substitution. Live and recovered chains accept up to 16 MiB (16,777,216 bytes) per expanded task, including the template text. Pi rejects a larger task before it starts the worker. Main receives the original workflow result after recovery. A durable claim prevents duplicate dispatch of the same packet. An interrupted writer requires termination evidence and inspection of partial changes. Recovery leaves its work in place.
|
|
94
|
+
|
|
95
|
+
### Dry run
|
|
96
|
+
|
|
97
|
+
Set `"dryRun": true` to preview Role, model, resources, access, and continuation eligibility before dispatch.
|
|
87
98
|
|
|
88
99
|
Read requests skip checkout admission and return plain text. Parallel `tasks` run concurrently up to `maxSubagents`; chains stay ordered. The extension does not enforce `read`. Results stay in request order.
|
|
89
100
|
|
|
90
|
-
|
|
101
|
+
Direct mode uses a native Pi child in every terminal. Before a write starts, Main saves its session and process lease identity in the admission journal. Writers run alone within their request. Ready readers in a named dependency graph can run together. Release requires the observed child exit and two empty scans of the original lease. A definite final acceptance failure can release admission after termination proof. A writer that ends its turn and reports `blocked` releases admission after the same proof, and later writers in its request do not start. Other rejected writes require explicit cleanup. A write request whose Role has only read tools, and no extensions or MCP servers, is refused before admission. Checkout admission blocks every Main tool except read-only tools, whatever path or project the tool input names, because Main tools run from the session checkout. After a restart, `/subagent` provides journal recovery.
|
|
91
102
|
|
|
92
103
|
Native workers save a private Pi session and process lease. To continue a native worker, Main must have observed its process exit in this Pi process. The Role, checkout and last saved turn must match. Two lease scans must be empty. An interrupted turn can resume after these checks. Continuation after a Pi restart is unavailable. Use `{"mode":"cancel","id":"<exact workflow ID>"}` to stop locally owned work on the current branch. The `/subagent` menu also provides Close. Cancellation does not prove that detached descendants stopped.
|
|
93
104
|
|
|
94
105
|
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.
|
|
95
106
|
|
|
96
|
-
For example, a configured Git operator with `bash` can stage named pending files and commit them on the `fast` route.
|
|
107
|
+
For example, a configured Git operator with `bash` can stage named pending files and commit them on the `fast` route.
|
|
97
108
|
|
|
98
|
-
Direct writes change Main's checkout immediately. They require no clean checkout.
|
|
109
|
+
Direct writes change Main's checkout immediately. They require no clean checkout. Main runs any declared acceptance checks. Edits remain in place after a failure. 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.
|
|
99
110
|
|
|
100
|
-
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.
|
|
111
|
+
A write request without named dependencies 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. Parallel read requests still run concurrently.
|
|
101
112
|
|
|
102
|
-
A
|
|
113
|
+
A failed prerequisite blocks its descendants. Independent tasks can continue after a read failure. A terminal acceptance failure stops new graph dispatch. Uncertain writer termination stops graph dispatch. Chains replace each literal `{previous}` with the preceding successful answer and stop on failure. Task outcome and worker termination are separate.
|
|
103
114
|
|
|
104
|
-
After settlement, the coordinator
|
|
115
|
+
After settlement, the coordinator releases admission only after observed process exit and two empty private process-lease scans. This proof requires native `lsof`. This automatic step sends no signals, so a background process that the worker started and that holds its lease keeps admission held. The coordinator removes no Git files, commits, or saved sessions. A failure stays a failure even when the coordinator releases admission.
|
|
105
116
|
|
|
106
117
|
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.
|
|
107
118
|
|
|
108
|
-
The action checks session, branch, epoch, and live ownership. Recorded-only tasks cannot use local Close. Their separate recovery action cannot stop workers. After it
|
|
119
|
+
The action checks session, branch, epoch, and live ownership. Recorded-only tasks cannot use local Close. Their separate recovery action cannot stop workers. After it observes the owned child exit, it sends `SIGTERM` to each process that holds the exact private lease of an owned worker. Then it sends `SIGKILL` to each process that survives. Before each signal, it scans the lease again for that PID, and it does not signal a PID that no longer holds the lease. If a holder survives, a scan fails, or ownership changes, admission stays held. Resolve the reported blocker, then do the same action again. A restart of Pi is not termination proof.
|
|
109
120
|
|
|
110
121
|
Inspect partial changes before new writes. To recover, never retry a commit or delete work without inspection.
|
|
111
122
|
|
|
112
|
-
|
|
123
|
+
For records from releases before 31.0.0, tab creation could 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.
|
|
113
124
|
|
|
114
125
|
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.
|
|
115
126
|
|
|
@@ -144,7 +155,7 @@ A journal error blocks writes even when Pi reports the `session_start` error and
|
|
|
144
155
|
|
|
145
156
|
Recovered admission is a write barrier, not process-control authority. Replay does not restore worker handles, replay tasks, or stop processes. Continuation and collection of recorded workers wait while admission is unresolved. Reload is not termination proof.
|
|
146
157
|
|
|
147
|
-
The journal saves non-dispatch evidence first. It saves each exact allocation intent before
|
|
158
|
+
The journal saves non-dispatch evidence first. It saves each exact allocation intent before worker launch, and each continuation source before its stop. An interrupted external operation stays unproved. New launches save the private lease and parent filesystem identities before dispatch. Termination checks compare them before and after lease scans. Missing, linked, replaced, or non-private leases block proof.
|
|
148
159
|
|
|
149
160
|
A legacy worker without its original saved lease identity cannot be stopped or continued. The current lease file cannot establish its historical identity. New workers keep their original baseline throughout local execution. Allocation intents are bound to verified tab and pane identities before agent start. Older receipts for allocated workers without that binding require the warned human release, not proof-based release.
|
|
150
161
|
|
|
@@ -152,7 +163,9 @@ A legacy worker without its original saved lease identity cannot be stopped or c
|
|
|
152
163
|
|
|
153
164
|
Local Close remains the only release authority for locally owned work. It can retry a failed continuation stop or release write. It does not close an unverified allocation or a present shell without proved ownership. Resolve such resources before retrying Close.
|
|
154
165
|
|
|
155
|
-
|
|
166
|
+
Main can release a recovered reservation itself, without the user and without a restart. It calls `delegate_task` with `{"mode":"cancel","id":"<workflow ID>"}`. The admission block message names this call and the workflow ID. Cancel first accepts complete saved proof. Otherwise, every saved worker must be a native worker that held its process lease from spawn (`spawnLease`) and has a saved PID (`native-process`). Each native writer inherits a descriptor of its lease at launch, so the lease names the live worker before its first instruction. Main closes its own copy when the worker process exits, and journals the worker PID and spawn time right after spawn. Cancel checks each lease identity. It sends `SIGTERM`, then `SIGKILL`, to the process group of a lease holder only when the holder has the saved PID, still leads its process group, and started within 3 seconds of the saved spawn time. A process title hides the worker command line, so cancel does not use it. It sends no signal to other holders, such as an acceptance check witness or a diagnostic tool, and keeps protection while they hold the lease. It releases only after two consecutive empty scans of every lease. The journal saves the release as `agent-scanned` with the reviewed evidence, and replay accepts that kind only for records with spawn leases and saved PIDs. Cancel does not close worker tabs or change files, commits or sessions. Herdr tab workers, allocations, continuation sources and records from older versions keep the human action below. Older package versions cannot replay an `agent-scanned` release and block writes.
|
|
167
|
+
|
|
168
|
+
For the human path, select **Review recovered checkout protection**:
|
|
156
169
|
|
|
157
170
|
- Complete saved proof permits a confirmed release without worker control. Proof means no effect was dispatched, or the local owner saved complete termination evidence before the release write failed. The latter requires complete allocation intents, exact verified tab and pane records, matching original lease identities, and coverage of every saved resource. Missing fields or conflicting identities permit no proof-based release.
|
|
158
171
|
- Missing proof offers **Keep protection** first. The separate **Release protection despite unproved termination** action requires the exact typed session, task, and token identity. It saves the typed identity and reviewed evidence in a distinct receipt before clearing only that reservation.
|
|
@@ -170,33 +183,33 @@ Admission coordinates only this Main's Pi calls. Other Pi sessions and external
|
|
|
170
183
|
|
|
171
184
|
### Continue or stop one direct worker
|
|
172
185
|
|
|
173
|
-
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.
|
|
186
|
+
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. A native Pi process resumes the saved session after the checks above.
|
|
174
187
|
|
|
175
|
-
The new
|
|
188
|
+
The new worker gets a new 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.
|
|
176
189
|
|
|
177
|
-
A request can continue each worker only one time, and only from the checkout
|
|
190
|
+
A request can continue each worker only one time, and only from the checkout 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.
|
|
178
191
|
|
|
179
192
|
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.
|
|
180
193
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
An absent old agent still requires two empty lease scans. Continuation and Subagent Collection never send signals to lease holders.
|
|
194
|
+
Continuation requires the original native session and two empty process lease scans. Saved Herdr records remain available for recovery.
|
|
184
195
|
|
|
185
196
|
Records saved before 27.0.0 have no turn identity. The extension cannot continue them. For these records, start a new task.
|
|
186
197
|
|
|
187
|
-
In a running workflow that has only `read` tasks, `/subagent` shows **Stop this worker** for each running worker.
|
|
198
|
+
In a running workflow that has only `read` tasks, `/subagent` shows **Stop this worker** for each running worker. Pi aborts the selected child and waits for it to settle. 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.
|
|
188
199
|
|
|
189
200
|
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.
|
|
190
201
|
|
|
191
202
|
### Direct results and records
|
|
192
203
|
|
|
193
|
-
|
|
204
|
+
Main can receive several completed workflows in one follow-up. A combined follow-up has a 4,096-byte limit, including workflow identifiers and statuses. If previews are clipped, the message points to the saved full results. When the identifiers exceed the limit, one private index lists every status and result file.
|
|
205
|
+
|
|
206
|
+
The extension retrieves each final answer from its exact Pi session file, not its possibly truncated screen. Failed tasks retain the exact saved session path. No whole-run deadline applies.
|
|
194
207
|
|
|
195
208
|
The tasks in a request share a 4 KiB inline answer budget. Each worker prompt states its share. A longer exact answer is still a success. The result shows a UTF-8-safe prefix and a truncation marker. The recovery section links to a private `answer-<turn>.md` file beside the session file, which holds the full answer. For a write task, the budget applies to the `answer` field of the completion object. A chain step receives the full answer of the previous step in `{previous}`; the budget applies only to the result for Main. The result details keep `answerFile` for each full-answer file. Recovery text includes these paths outside the output limit, even when checkout notes fill the result. A one-line answer that fits the status summary appears only once.
|
|
196
209
|
|
|
197
|
-
|
|
210
|
+
Pi accepts prompt text as one command argument. To stay below the operating system's argument limit, a task packet above 64 KiB uses a private, exclusively created `task-<turn>.md` file beside the session file. This packet includes the full chain context. The worker prompt requires the Role's `read` tool to read all parts with line offsets before work starts. Pi's native `read` can return a line of exactly 50 KiB (51,200 bytes), but not a longer line. If any packet line is longer, or `read` is absent, the worker uses the Role's `bash` tool. If a line is too long and `bash` is absent, the task fails before launch with the read limit and a request for `bash` or shorter lines. A Role with neither tool also fails before launch; the extension adds no tool. The task file stays available for recovery.
|
|
198
211
|
|
|
199
|
-
In interactive and RPC modes, the tool returns a task ID.
|
|
212
|
+
In interactive and RPC modes, the tool returns a task ID. Native Pi returns the handle before the first worker starts. In these modes 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, or unknown result as success.
|
|
200
213
|
|
|
201
214
|
In the result, each launched worker has a line with its model, thinking level, measured task tokens, cost, and elapsed time. For example: `✓ [1/2] Check · worker · provider/model · thinking high · 1.5k tok · $0.12 · 42s`. The first line also shows the request total, such as `total $0.12`. Unknown and zero cost are not shown. 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.
|
|
202
215
|
|
|
@@ -206,7 +219,7 @@ In print and JSON modes the direct tool waits for completion and returns the res
|
|
|
206
219
|
|
|
207
220
|
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.
|
|
208
221
|
|
|
209
|
-
A session switch or shutdown stops observation and preserves
|
|
222
|
+
A session switch or shutdown stops observation and preserves worker session identities for recovery. Open `/subagent` on the session branch to inspect them. The menu has one row for each workflow.
|
|
210
223
|
|
|
211
224
|
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. After Main receives the result, the row shows the request cost and each worker line shows its cost. References and names help you match rows. The extension never uses them to decide ownership.
|
|
212
225
|
|
|
@@ -214,7 +227,7 @@ Older records without saved references show their saved allocation label or exac
|
|
|
214
227
|
|
|
215
228
|
### Checkout change reports
|
|
216
229
|
|
|
217
|
-
For each task in a write request, the extension takes a Git snapshot of Main's checkout before the worker starts and again when the task ends (success, failure, blocked work, or stop). A snapshot contains the `HEAD` OID and `git status --porcelain=
|
|
230
|
+
For each task in a write request, the extension takes a Git snapshot of Main's checkout before the worker starts and again when the task ends (success, failure, blocked work, or stop). A snapshot contains the `HEAD` OID and `git status --porcelain=v2 -z --untracked-files=all`, with staged object identities, file modes, conflict stages, and working file content for each dirty path. The result of the task then lists:
|
|
218
231
|
|
|
219
232
|
- New commits from `git rev-list before..after`, as a short OID and subject. If `HEAD` moved to a commit that does not descend from the start `HEAD`, the report says so.
|
|
220
233
|
- Paths with a changed status or content, and the paths that the new commits changed. If the task declares `paths`, each changed path outside them shows `outside declared paths`.
|
|
@@ -223,23 +236,25 @@ The report shows at most 10 commits and 20 paths, and it counts the omitted item
|
|
|
223
236
|
|
|
224
237
|
For a read request, the extension compares the same snapshot at launch and when each task ends. If `HEAD`, status, or dirty content changed, the result of that task shows `checkout changed during task; result may be stale`.
|
|
225
238
|
|
|
239
|
+
Both reports detect changes confined to staged content, even when the working file and status codes stay identical.
|
|
240
|
+
|
|
226
241
|
Outside a Git repository, the extension makes no report and the task continues. If a snapshot fails, the task does not fail; the result shows `change report unavailable: <reason>` (or `stale-read check unavailable: <reason>` for a read request).
|
|
227
242
|
|
|
228
243
|
### Status widgets
|
|
229
244
|
|
|
230
|
-
|
|
245
|
+
Pi shows new workers in its direct status widget. Inspecting a saved isolated request can also display its recorded task rows. 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, `4` ultra, `*` fav.
|
|
231
246
|
|
|
232
|
-
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.
|
|
247
|
+
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. Numbers continue after reload, and the session never uses a number again.
|
|
233
248
|
|
|
234
|
-
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.
|
|
249
|
+
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.
|
|
235
250
|
|
|
236
251
|
The direct widget shows the launched model, thinking level, elapsed time, measured task tokens (`— tok` until usage is available), and cost next to the tokens (such as `$0.12`; not shown when unknown or zero). Failed rows show before working and completed rows. When rows overflow, `… N more` includes counts by status.
|
|
237
252
|
|
|
238
|
-
The isolated widget shows the recorded task state and any retained workspace.
|
|
253
|
+
The isolated widget shows the recorded task state and any retained workspace. The rows reflect saved task state. 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.
|
|
239
254
|
|
|
240
255
|
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.
|
|
241
256
|
|
|
242
|
-
|
|
257
|
+
Direct results and completed widget rows sum `usage.totalTokens` from the worker's completed assistant records, including any correction. The total includes cached tokens when the provider includes them in that field. A continued worker counts only its new task turn. Missing usage stays unknown.
|
|
243
258
|
|
|
244
259
|
The cost is the sum of `usage.cost.total` from the same records, read in the same session read. Pi uses the provider's billed total when available; otherwise, it uses the catalog estimate. The extension does not replace a billed total with the sum of catalog cost fields. Isolated task state records no usage, so isolated rows show no tokens or cost.
|
|
245
260
|
|
|
@@ -255,213 +270,11 @@ Activity uses the existing session sample and file-size cache. The extension ign
|
|
|
255
270
|
|
|
256
271
|
## Explicit workspace selection
|
|
257
272
|
|
|
258
|
-
The optional
|
|
259
|
-
|
|
260
|
-
## Isolated contract
|
|
261
|
-
|
|
262
|
-
An isolated request has one durable ID, one goal, and 1 to 8 typed tasks.
|
|
263
|
-
|
|
264
|
-
New worktrees use `.worktrees/subagent-<name>-<24hex>` and branch `pi-subagent/subagent-<name>-<24hex>`. The name uses the request and task IDs. Text tasks also include `text-<attempt>`. Integration checkouts use the request ID and `integration-<generation>`. Each name component has at most 24 characters; the full readable part has at most 72. Names use lowercase ASCII letters, digits, and hyphens. The 24-hex identity suffix keeps names distinct when readable parts are shortened or normalized.
|
|
265
|
-
|
|
266
|
-
Herdr workspace labels use the worker worktree name. Worker tab labels add the model class. Names never use goals, requirements, or other free-form task text. Saved opaque worktree names and their Herdr labels stay unchanged. Resume and cleanup use the exact saved allocations; the extension does not rename existing resources.
|
|
267
|
-
|
|
268
|
-
For example:
|
|
269
|
-
|
|
270
|
-
```json
|
|
271
|
-
{
|
|
272
|
-
"mode": "isolated",
|
|
273
|
-
"id": "refresh-repair",
|
|
274
|
-
"goal": "Repair token refresh with exact checked evidence.",
|
|
275
|
-
"tasks": [
|
|
276
|
-
{
|
|
277
|
-
"id": "inspect",
|
|
278
|
-
"kind": "text",
|
|
279
|
-
"role": "scout",
|
|
280
|
-
"modelClass": "fast",
|
|
281
|
-
"requirements": "Identify the refresh failure and relevant tests.",
|
|
282
|
-
"deliverable": "A concise evidence report.",
|
|
283
|
-
"dependsOn": [],
|
|
284
|
-
"contextFrom": []
|
|
285
|
-
},
|
|
286
|
-
{
|
|
287
|
-
"id": "repair",
|
|
288
|
-
"kind": "changeset",
|
|
289
|
-
"role": "implementer",
|
|
290
|
-
"modelClass": "balanced",
|
|
291
|
-
"requirements": "Implement the smallest correct repair.",
|
|
292
|
-
"deliverable": "A committed candidate in the owned worktree.",
|
|
293
|
-
"dependsOn": [],
|
|
294
|
-
"contextFrom": ["inspect"],
|
|
295
|
-
"checks": [
|
|
296
|
-
{ "command": "pnpm", "args": ["test", "--", "refresh"] }
|
|
297
|
-
],
|
|
298
|
-
"judgment": {
|
|
299
|
-
"role": "reviewer",
|
|
300
|
-
"modelClass": "balanced",
|
|
301
|
-
"criterion": "The exact candidate fixes refresh and preserves unrelated behavior."
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
],
|
|
305
|
-
"finalChecks": [
|
|
306
|
-
{ "command": "pnpm", "args": ["test", "--", "refresh"] }
|
|
307
|
-
]
|
|
308
|
-
}
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
The request also accepts optional `finalJudgment` with `role`, `modelClass`, and `criterion`, using the same shape as task `judgment`.
|
|
312
|
-
|
|
313
|
-
Every task declares `id`, `kind`, `role`, `modelClass`, `requirements`, `deliverable`, `dependsOn`, and `contextFrom`.
|
|
314
|
-
|
|
315
|
-
- A `text` task runs in a disposable child worktree and must leave it unchanged.
|
|
316
|
-
- A `changeset` task requires focused checks and owns one worktree, Herdr workspace, worker tab, and retained worker.
|
|
317
|
-
- `dependsOn` controls ready waves; dependent tasks can run from a selected staged snapshot only after Main explicitly advances it.
|
|
318
|
-
- `contextFrom` may reference completed text tasks only, implies scheduling dependencies, and preserves declaration order. It must not overlap `dependsOn`.
|
|
319
|
-
- A graph containing changesets requires final checks. The repository root must have a `package.json` test script; admission prepends canonical `pnpm test` if absent from final checks. Combined validation rejects a changed root test script.
|
|
320
|
-
|
|
321
|
-
Admission and worker-wave dispatch pin Main's exact committed branch, HEAD, and tree without inspecting or modifying its staged, unstaged, or untracked edits. Worker allocation verifies the same committed identity around worktree creation, including resumed waves; staged-dependent waves verify their clean integration snapshot. A dirty Main can therefore produce a checked retained candidate, but branch/HEAD drift stops new waves. The runner executes ready worker tasks concurrently, inspects clean committed candidates, runs preliminary task checks and optional preliminary judgment, then records ready candidates for Main. **It does not automatically integrate them.**
|
|
322
|
-
|
|
323
|
-
Main selects exact candidates through `subagent_stage` into an owned integration checkout in explicit order. Each stage is a committed merge of the candidate, not a mutation of Main. Conflicts retain the checkout for Main to resolve; `resolve` verifies the exact two-parent merge instead of replaying an uncertain merge. Main can explicitly run dependent tasks from an exact staged tip with `subagent_integrate advance` and stage their results afterward. Independent candidates may be staged without re-running workers.
|
|
324
|
-
|
|
325
|
-
Once all selected work is staged, Main calls `subagent_integrate validate` on the exact clean combined tip. It acknowledges the durably saved validation intent and continues in the session-owned background, independent of later turn cancellation; session replacement/shutdown still cancels it. A follow-up reports completion; status remains authoritative if delivery is missed. This runs every final check, including `pnpm test`, unless [exact check reuse](#validate-and-promote) applies, and optional final judgment in the integration checkout before any Main mutation. A failed check/review can be followed by one Main-authored committed correction in that checkout, recorded with `correct`, then another `validate`.
|
|
326
|
-
|
|
327
|
-
Staging, combined validation, and `promote` require clean Main at the recorded committed identity. Dirty edits block these actions even when the checked candidate stays retained. The extension never replays or merges dirty work automatically. `promote` requires exact passing combined evidence and unchanged Main and uses a guarded update to Main. Only proven promotion leads to selected-worker termination and verified cleanup. A changed candidate, integration tip, or Main identity invalidates prior evidence or blocks promotion; review accepts only exact `PASS`.
|
|
328
|
-
|
|
329
|
-
### Text results and cleanup
|
|
330
|
-
|
|
331
|
-
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.
|
|
332
|
-
|
|
333
|
-
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.
|
|
334
|
-
|
|
335
|
-
### Readiness and Main actions
|
|
336
|
-
|
|
337
|
-
The user's request can authorize the declared local graph, checks, review, and Main's later explicit integration actions. After each successful preliminary check batch, the runner drains any follow-up already queued for the same live worker. Each revision must produce a new clean commit and rerun preliminary checks. When the queue is empty, the runner atomically seals the candidate and persists exact readiness evidence without waiting for input.
|
|
338
|
-
|
|
339
|
-
After readiness, use `subagent_stage revise` with the exact candidate, generation, current `expectedTip`, and instruction. A same-worker correction must remain available. Material scope growth, missing authorization, user-owned conflicts, and consequential external actions require a new decision. Pi Subagent never pushes, publishes, deploys, or opens a pull request.
|
|
340
|
-
|
|
341
|
-
### Inspect and revise active work
|
|
342
|
-
|
|
343
|
-
Requires Pi 1.5.0 or later in the 1.x series. To select work by label, open `/subagent` without arguments. The inline selector reports Pi's native blocked status while it waits for user input. Pi clears this status when the selector closes. Key hints use the keybinding manager that Pi supplies.
|
|
344
|
-
|
|
345
|
-
First, a **Current subagent work** report shows the work that local and saved evidence proves is running: locally owned direct workflows with a running worker, and active isolated requests while a live run holds the repository lease. The report lists active requests without a live lease as interrupted, and recorded-only direct work as unverified. A live lease does not identify its request, so several active requests in one checkout all show as working. 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**.
|
|
346
|
-
|
|
347
|
-
The menu also shows requests whose saved parent checkout no longer exists, in their own **Orphaned · parent checkout removed** group. Saved `running` and `pending` states have a `saved` prefix and an `unverified` suffix. The report lists them under **Unverified**, never **Working**, even if the current checkout has a live lease. These labels do not change saved state or prove completion. Orphaned requests with retained resources or `needs_attention` show under **Needs attention**. You can open this view from any checkout of the same repository. The saved worker or integration path identifies the primary repository. Orphaned requests have the same **Close and delete worktrees (discard work)** action, but no inspection or follow-up actions. The extension reads their original state directories; it does not recreate the removed parent checkout. Unreadable files stay preserved and are reported.
|
|
348
|
-
|
|
349
|
-
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.
|
|
350
|
-
|
|
351
|
-
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`.
|
|
352
|
-
|
|
353
|
-
Both isolated groups hide terminal requests by default: `completed`, `aborted`, `final_failed`, and `superseded`. Requests with retained resources or unresolved recovery stay visible. Select **Completed / history** to see all saved requests; **Refresh** reloads the current view. The filter does not delete records. Without interactive UI, the request list includes 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.
|
|
354
|
-
|
|
355
|
-
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.
|
|
356
|
-
|
|
357
|
-
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.
|
|
358
|
-
|
|
359
|
-
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.
|
|
360
|
-
|
|
361
|
-
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.
|
|
362
|
-
|
|
363
|
-
### Exact integration actions
|
|
364
|
-
|
|
365
|
-
`subagent_status` shows failed review verdicts from each task's latest dispatch, the final gate, and each generation, including while siblings run. Its text uses one shared 32 KiB budget and counts omitted verdicts. Structured output carries each verdict up to 32 KiB and sets `verdictTruncated` when necessary. Follow-ups give short previews and direct Main to status for the full text.
|
|
366
|
-
|
|
367
|
-
Status reports ready candidates with `taskId`, `attempt`, and `tip`. Each generation records its number, stage lineage, combined tip, checks, promotion, and retained worktree. Use these exact identities, including branch, HEAD, index, and tree. Do not guess commits.
|
|
368
|
-
|
|
369
|
-
#### Stage and resolve
|
|
370
|
-
|
|
371
|
-
```text
|
|
372
|
-
{ id, action: "stage" | "resolve" | "reject" | "revise", generation, taskId, attempt, candidate, expectedTip, instruction? }
|
|
373
|
-
```
|
|
374
|
-
|
|
375
|
-
`candidate` is the ready candidate's `tip`. For the first stage, `expectedTip` is Main's recorded identity. Later stages use the previous stage's exact tip. `resolve` checks a pending or conflicted merge, including its exact two-parent identity. It never replays an uncertain merge.
|
|
376
|
-
|
|
377
|
-
Stage and resolve remain available during an active wave; rejection and revision wait until the wave settles. If allocation was uncertain, resolve first proves that the owned checkout remains at its base before starting the selected merge. Otherwise, it retains the intent.
|
|
378
|
-
|
|
379
|
-
Rejection or revision of a staged candidate supersedes that generation and leaves its checkout read-only. Main must explicitly restage selected candidates into a new generation. Each request permits at most two unreleased integration worktrees. Superseded generations and rejected candidates remain until explicit release.
|
|
380
|
-
|
|
381
|
-
Rejection invalidates dependent work. Rejection and revision ignore dependent work that refresh or an earlier rejection already invalidated. If fresh dependent execution exceeds dispatch or lineage limits, start a new request. Do not force promotion.
|
|
382
|
-
|
|
383
|
-
#### Validate and promote
|
|
384
|
-
|
|
385
|
-
```text
|
|
386
|
-
{ id, action: "advance" | "validate" | "correct" | "promote" | "reconcile" | "cleanup", generation, expectedTip }
|
|
387
|
-
```
|
|
388
|
-
|
|
389
|
-
Use the generation's exact `combinedTip` as `expectedTip`. `advance` dispatches ready dependents from that snapshot. `correct` records one clean committed correction after a definitive failed check or review. `reconcile` inspects interrupted validation or promotion without replaying uncertain promotion. `cleanup` finishes proved post-promotion cleanup.
|
|
390
|
-
|
|
391
|
-
Post-promotion cleanup handles each promoted stage separately. A blocked termination or cleanup step records its failure on that step, and cleanup continues with the other stages and then the promoted integration checkout. Clean Main at the promoted identity is a shared precondition; if Main changed, every pending step records the blocker. Dirty, untracked, or ignored files block worktree removal and stay preserved. Until every promoted termination and cleanup step completes, the request stays `needs_attention` with promotion proven, selected tasks `completed`, and not accepted, so `/subagent` lists it. Resolve the recorded blockers, then call `cleanup` again; the request becomes `completed` and accepted only after cleanup completes.
|
|
392
|
-
|
|
393
|
-
Validation acknowledges only after saving the exact generation's validation intent. Checks and final judgment then run in the background. Later turn cancellation does not cancel acknowledged validation; session replacement or shutdown does. Acknowledgement is not passing evidence. Inspect status if the completion follow-up fails.
|
|
394
|
-
|
|
395
|
-
Validation reuses a passed preliminary result for a final check, and does not run that check again, only when all of these conditions are true:
|
|
396
|
-
|
|
397
|
-
- The candidate is staged in this generation.
|
|
398
|
-
- The tree OID of the combined tip is equal to the tree OID of the candidate. This usually occurs when you stage one candidate onto unchanged pinned Main.
|
|
399
|
-
- The saved preliminary checks of the candidate passed, and their `candidate` and `identityAfter` are equal to the candidate tip.
|
|
400
|
-
- The preliminary result has the identical command and argv, exit code 0, and no timeout or signal.
|
|
401
|
-
|
|
402
|
-
Any mismatch runs the check normally. Each reused result records `reusedFrom` with `taskId`, `attempt`, and `candidate`. Status text and the validation follow-up show each reused command. Promotion, reconciliation, and state loading accept a reused result only after they prove these conditions again from saved identities. Final judgment still runs. Reuse assumes that checks use only tracked content. Ignored files, for example `node_modules`, can be different between the worker and integration worktrees.
|
|
403
|
-
|
|
404
|
-
#### Refresh
|
|
405
|
-
|
|
406
|
-
```text
|
|
407
|
-
{ id, action: "refresh", generation, expectedTip, expectedMain, newMain }
|
|
408
|
-
```
|
|
409
|
-
|
|
410
|
-
If Main advances to a clean same-branch descendant, refresh freezes the old generation and allocates a new checkout from `newMain`. Restage selected immutable candidates in order, resolve fresh conflicts, and rerun combined validation. Dirty, divergent, or uncertain Main blocks refresh.
|
|
411
|
-
|
|
412
|
-
After interrupted validation, 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`.
|
|
413
|
-
|
|
414
|
-
A reconciled `validation_failed` generation without recorded checks, review, or a prior combined correction permits refresh with identical `expectedMain` and `newMain`. Supply the exact old combined `expectedTip` and next generation number. Main and the retained integration tip must remain exact and clean. This allocates a new checkout; it never resumes uncertain checks.
|
|
415
|
-
|
|
416
|
-
Restage selected candidates and run all final checks and required judgment before promotion. The old generation remains retained, the two-checkout limit still applies, and correction allowances do not reset.
|
|
417
|
-
|
|
418
|
-
#### Release and abort
|
|
419
|
-
|
|
420
|
-
```text
|
|
421
|
-
{ id, action: "release", generation, expectedTip, taskId?, attempt? }
|
|
422
|
-
```
|
|
423
|
-
|
|
424
|
-
Without a task, release a superseded clean checkout using its recorded tip. Use its correction tip, otherwise its last staged tip, otherwise its integration base. Supersession preserves the correction record.
|
|
425
|
-
|
|
426
|
-
With `taskId` and `attempt`, release a rejected candidate, including dependent work invalidated by refresh or rejection. First release every generation that staged it. Supply its candidate tip and the latest generation number, or `1` if none exists.
|
|
427
|
-
|
|
428
|
-
Release proves exact worker termination before cleanup. An absent worker still requires pane absence and two empty lease scans. An observed live worker without saved termination intent can close with the same proof. Uncertain termination never replays automatically.
|
|
429
|
-
|
|
430
|
-
Release saves each host, checkout, and branch step separately. It checks ownership and cleanliness, including ignored files. Branch deletion requires the exact recorded tip. A repeated release proves absence for already-removed resources. Dirty, conflicted, changed, uncertain, or still-needed resources remain for manual inspection. Resolve the blocker, then repeat release; each released checkout frees a slot.
|
|
431
|
-
|
|
432
|
-
Abort cannot discard retained resources. It becomes available after rejection and release of all candidates and owned checkouts. It also removes an empty refreshed generation that remains clean at its base.
|
|
433
|
-
|
|
434
|
-
If you removed resources outside Pi Subagent, abort can reconcile their absence. Each retained candidate or staged integration checkout must be unregistered, its path absent, and its branch absent. Workers must also be proved absent through pane and lease checks. Abort then records candidates as rejected and released and completes cleanup. Any present resource blocks abort without changing the request.
|
|
435
|
-
|
|
436
|
-
### Recovery and state
|
|
437
|
-
|
|
438
|
-
State version 5 lives privately under:
|
|
439
|
-
|
|
440
|
-
```text
|
|
441
|
-
<agent-dir>/config/pi-subagent/state/<repository-hash>/<request-id>.json
|
|
442
|
-
```
|
|
443
|
-
|
|
444
|
-
Parsing rejects unknown properties, malformed evidence, invalid lineage, and v4 or older state without migration. Preserve old files and recover work manually. Writes are atomic. A productive lease prevents concurrent execution or resumption but permits status inspection and abort.
|
|
445
|
-
|
|
446
|
-
`delegate_task`, `subagent_resume`, and `subagent_integrate advance` return a durable request ID after saving the wave. Work continues asynchronously. A saved worker attention state sends a follow-up to the launching session, including while siblings run. The wave also reports its final result.
|
|
447
|
-
|
|
448
|
-
Isolated workers save private exact Pi sessions under their owned process leases. A proved final answer without a changed clean commit requires attention. Missing or mismatched session proof cannot establish completion and never permits prompt replay.
|
|
449
|
-
|
|
450
|
-
When a finished turn leaves tracked or untracked changes in a valid owned worktree, the runner sends one commit reminder per dispatch try. It saves the reminder before delivery. This uses neither a correction nor a dispatch try. The runner never commits, stages, stashes, or discards. A resulting commit follows normal candidate checks; remaining dirty work requires attention.
|
|
451
|
-
|
|
452
|
-
`subagent_status` stays read-only and authoritative if delivery fails. Session replacement or shutdown suppresses stale follow-ups and logs the request ID and reason, not prompts or credentials. Synchronous delivery failures report without automatic replay. Pi reports asynchronous `send_message` failures through its runtime.
|
|
453
|
-
|
|
454
|
-
`subagent_resume` accepts only the reported `retry`, `verify`, or `finalize` continuation. A same-worker correction `retry` permits optional `instruction`: at most 32000 exact characters, with no NUL. The prompt includes this as Main's instruction after the saved failure and saves it before delivery. Other actions reject it.
|
|
455
|
-
|
|
456
|
-
Without retained candidates, abort terminates exact owned workers and removes only owned checkouts that remain clean and unchanged from their pinned base. Cleanup includes ignored-file checks. Productive execution delays cleanup until it settles. Repeat abort to reconcile pending cleanup without replaying uncertain termination. Dirty or committed work and uncertain allocations remain with blockers. `/subagent recover` includes aborted requests with retained resources.
|
|
457
|
-
|
|
458
|
-
### Recover after interruption
|
|
459
|
-
|
|
460
|
-
After a coordinator interruption, run `/subagent recover` one time. It gets the repository productive lease before it changes any interrupted `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.
|
|
273
|
+
The optional `repositories` map selects existing checkouts. See [Workspace selection](./workspace.md).
|
|
461
274
|
|
|
462
|
-
|
|
275
|
+
## Saved isolated requests
|
|
463
276
|
|
|
464
|
-
|
|
277
|
+
Use `/subagent` or `subagent_status` to inspect an existing request. Use `subagent_workspace` with `action: "status"` for saved multi-repository requests. A saved candidate stays in its original checkout for manual review.
|
|
465
278
|
|
|
466
279
|
### Close and delete isolated worktrees
|
|
467
280
|
|
|
@@ -481,7 +294,7 @@ The report lists removed, skipped, and failed resources. After complete cleanup,
|
|
|
481
294
|
|
|
482
295
|
### Subagent Collection
|
|
483
296
|
|
|
484
|
-
Subagent Collection closes only verified completed worker tabs. It keeps saved sessions, process leases, worktrees, candidates, and recovery records. It never closes a workspace or its root tab.
|
|
297
|
+
Subagent Collection applies to Herdr tabs saved before version 31.0.0. It closes only verified completed worker tabs. It keeps saved sessions, process leases, worktrees, candidates, and recovery records. It never closes a workspace or its root tab.
|
|
485
298
|
|
|
486
299
|
Automatic collection checks each relevant workspace after direct `delegate_task` launches, after direct or isolated workflows finish, and when Main settles. More than 10 tabs in that workspace triggers collection. Ten is a trigger, not a maximum. Collection can close all eligible tabs, even after the count falls below 10. User tabs count toward the trigger but are never collection targets. There is no timer: changes from other clients wait for the next check.
|
|
487
300
|
|
|
@@ -594,7 +407,7 @@ The extension never modifies the file. Fix the entry or choose another server. T
|
|
|
594
407
|
|
|
595
408
|
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.
|
|
596
409
|
|
|
597
|
-
Isolated
|
|
410
|
+
Isolated native worker launches receive the same turn, token, and child-runtime budget metadata as ephemeral launches. Retained workers therefore keep one non-refilling session budget across follow-ups using the usage in the saved Pi session.
|
|
598
411
|
|
|
599
412
|
### Migrate MCP exposure to 28.0.0
|
|
600
413
|
|