@ferris1225/pi-subagents 4.3.31 → 4.3.32
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/CHANGELOG.md +54 -0
- package/LICENSE +1 -1
- package/README.md +129 -271
- package/index.ts +5 -13
- package/package.json +5 -10
- package/src/configuration/config.ts +17 -121
- package/src/configuration/models.ts +1 -1
- package/src/configuration/setup.ts +80 -176
- package/src/configuration/ui.ts +28 -66
- package/src/delegation/agents.ts +78 -209
- package/src/delegation/builtin-agents.ts +60 -0
- package/src/delegation/dispatch.ts +21 -34
- package/src/delegation/prompt.ts +6 -5
- package/src/execution/rpc-control.ts +6 -2
- package/src/execution/rpc-run.ts +60 -20
- package/src/execution/spawn.ts +17 -28
- package/src/isolation/git-command.ts +1 -2
- package/src/isolation/recovery.ts +1 -1
- package/src/isolation/temp-hygiene.ts +2 -2
- package/src/isolation/worktree.ts +31 -17
- package/src/lifecycle/completion.ts +1 -1
- package/src/lifecycle/durable.ts +3 -3
- package/src/lifecycle/runtime.ts +6 -1
- package/src/lifecycle/thread-lifecycle.ts +11 -8
- package/src/lifecycle/thread-shared.ts +4 -4
- package/src/lifecycle/tools.ts +2 -5
- package/src/presentation/monitor.ts +22 -16
- package/src/presentation/widget.ts +2 -2
- package/agents/artisan.md +0 -18
- package/agents/scout.md +0 -19
package/README.md
CHANGED
|
@@ -8,92 +8,22 @@
|
|
|
8
8
|
|
|
9
9
|
On-demand delegation for [pi](https://github.com/earendil-works/pi): a lightweight
|
|
10
10
|
reader and an implementer, durable threads, and Git worktree isolation. Main
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
delegates whenever the work has independent parts or a bounded job can be briefed
|
|
12
|
+
self-contained — parallel phases usually beat a serialized main.
|
|
13
13
|
|
|
14
14
|
## What's new
|
|
15
15
|
|
|
16
|
-
**4.3.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
**4.3.28** — a child's final answer is delivered whole even when it spans
|
|
29
|
-
several text blocks, child stderr is kept to a bounded tail with one-line error
|
|
30
|
-
toasts, and model handoffs keep a multi-line objective intact. Streaming
|
|
31
|
-
activity no longer re-renders the widget per token, and the durable manifest is
|
|
32
|
-
no longer rewritten on every child turn.
|
|
33
|
-
|
|
34
|
-
**4.3.26** — scout is search-only, completions stop double-delivering, and
|
|
35
|
-
progress no longer routes through files. Scout's role is now exactly code and
|
|
36
|
-
documentation search plus web lookup; it has no shell, and work that needs
|
|
37
|
-
execution stays in main. A result that exceeds the inline limit is no longer
|
|
38
|
-
dumped truncated into the completion: none of it is inlined, and the notice
|
|
39
|
-
points at the full Markdown artifact, so the content enters the main context
|
|
40
|
-
exactly once. `subagent_status` answers progress with an activity trail
|
|
41
|
-
(what each run has been doing) instead of child session paths, and the
|
|
42
|
-
advisory `subagent_risk` tool is gone. Development dependencies track Pi 1.3.0.
|
|
43
|
-
|
|
44
|
-
**4.3.24** — the per-model cost footer drops the live `tok/s` throughput
|
|
45
|
-
figure: measured rates could not be trusted across providers, so the footer
|
|
46
|
-
sticks to what pi reports exactly — per-model token flow, cost, context share,
|
|
47
|
-
and thinking level.
|
|
48
|
-
|
|
49
|
-
**4.3.23** — Pi 1.0.3. Development dependencies track that release. A stored
|
|
50
|
-
agent model that still names `azure-openai-responses/<id>` keeps working: it
|
|
51
|
-
follows the live catalog, and is saved as `azure/<id>` once that is the id Pi
|
|
52
|
-
reports.
|
|
53
|
-
|
|
54
|
-
**4.3.22** — use a subagent when the work can run independently in parallel, its
|
|
55
|
-
boundary is clear, and delegation will actually reduce cost or improve
|
|
56
|
-
completion quality. Role choice stays with scout and artisan.
|
|
57
|
-
|
|
58
|
-
**4.3.21** — two built-in roles. `scout` is the lightweight read-only researcher
|
|
59
|
-
and `artisan` implements one substantial change. Steward and sentinel are no
|
|
60
|
-
longer shipped. Role prompts follow the GPT-6 Astra guidance: the brief wins,
|
|
61
|
-
authorized work runs through, and checks stay proportional. Main prefers scout
|
|
62
|
-
and artisan when a fresh context or a parallel phase helps, and does not open
|
|
63
|
-
extra phases to fill free slots.
|
|
64
|
-
|
|
65
|
-
**4.3.20** — Pi 1.0 prompt sections and tool exposure. The delegation contract
|
|
66
|
-
is a `<subagents>` section, and live leases are a separate `<subagent_leases>`
|
|
67
|
-
section, so an unchanged turn keeps the cached system prefix. Orchestration
|
|
68
|
-
tools stay declared to the model and cannot be called from codemode scripts.
|
|
69
|
-
Dispatch and stop run sequentially so one assistant message cannot race
|
|
70
|
-
admission. Child processes still force provider `maxRetries: 0`, using the
|
|
71
|
-
1.0 registration that requires an `api`.
|
|
72
|
-
|
|
73
|
-
**4.3.19** — session-start restore and recovery notices stay inside the current
|
|
74
|
-
project. A second pi window no longer surfaces another checkout's retained
|
|
75
|
-
worktree or restores (and would otherwise stop) that project's interrupted runs.
|
|
76
|
-
|
|
77
|
-
**4.3.18** — main-first delegation: keep known-context local changes in main,
|
|
78
|
-
use cleanup and review roles only where they add value, and configure process
|
|
79
|
-
capacity with `maxConcurrentAgents`. See [Evaluate delegation](#evaluate-delegation)
|
|
80
|
-
to compare quality, elapsed time, and complete task cost on your own workload.
|
|
81
|
-
|
|
82
|
-
**4.3.15** — fix the cost footer crash after `/reload`, `/new`, `/resume`, or
|
|
83
|
-
`/fork`: each footer now reads only its own session's live context, never an
|
|
84
|
-
event context retained from the previous session.
|
|
85
|
-
|
|
86
|
-
**4.3.13** — the footer is reserved for the per-model cost tally: the
|
|
87
|
-
`subagents N running` activity-count line is gone, leaving the widget,
|
|
88
|
-
completion notifications, and `subagent_status` for live progress.
|
|
89
|
-
|
|
90
|
-
**4.3.12** — per-model accounting: the main window's consumption line becomes a
|
|
91
|
-
per-model cost footer (token flow, cost, context share, and live `tok/s` per
|
|
92
|
-
`provider/model`), awaited children's usage is no longer folded into the parent
|
|
93
|
-
session total, and parallel completion totals are grouped per model instead of
|
|
94
|
-
summed across them.
|
|
95
|
-
|
|
96
|
-
See [CHANGELOG.md](./CHANGELOG.md).
|
|
16
|
+
**4.3.32** — codemode-aware, tool-agnostic role policy and a minimal config.
|
|
17
|
+
`scout` keeps every active tool the host proves read-only and can never keep a
|
|
18
|
+
tool that reaches other tools, such as `codemode`, while `artisan` inherits the
|
|
19
|
+
session's live surface, codemode included, so a code-mode host works unchanged.
|
|
20
|
+
The two roles ship as code, are always enabled, and custom `agent.md` discovery
|
|
21
|
+
is gone; `/subagents-setup` now only picks a model and thinking level per role,
|
|
22
|
+
and the config file keeps just `agentModels` and `agentThinkingLevels`. The
|
|
23
|
+
delegation contract defaults to delegating independent or self-contained work.
|
|
24
|
+
|
|
25
|
+
See [CHANGELOG.md](./CHANGELOG.md) for earlier releases; every published version
|
|
26
|
+
is preserved as a GitHub Release.
|
|
97
27
|
|
|
98
28
|
## Contents
|
|
99
29
|
|
|
@@ -107,10 +37,8 @@ See [CHANGELOG.md](./CHANGELOG.md).
|
|
|
107
37
|
- [Models, thinking, and tools](#models-thinking-and-tools)
|
|
108
38
|
- [Configuration](#configuration)
|
|
109
39
|
- [Evaluate delegation](#evaluate-delegation)
|
|
110
|
-
- [Custom agents](#custom-agents)
|
|
111
40
|
- [Storage and cleanup](#storage-and-cleanup)
|
|
112
41
|
- [Development](#development)
|
|
113
|
-
- [Changelog](#changelog)
|
|
114
42
|
- [Release](#release)
|
|
115
43
|
|
|
116
44
|
## Why
|
|
@@ -120,9 +48,11 @@ at "spawn a child with a prompt" and leave the hard parts — when to delegate,
|
|
|
120
48
|
wide to fan out, what happens when a model dies, how results come
|
|
121
49
|
back — with you. This extension owns them:
|
|
122
50
|
|
|
123
|
-
- Main
|
|
124
|
-
|
|
125
|
-
|
|
51
|
+
- Main delegates whenever the work has independent parts or a bounded job can be
|
|
52
|
+
briefed self-contained — parallel phases usually beat a serialized main, and
|
|
53
|
+
broad or unfamiliar lookups go to a child instead of the same searches run
|
|
54
|
+
serially.
|
|
55
|
+
`scout` covers read-only code, documentation, and web
|
|
126
56
|
lookup only — it has no shell, so work that needs execution stays in main;
|
|
127
57
|
`artisan` covers one substantial change. A small edit already understood in
|
|
128
58
|
the current context stays in main, and a free process slot is not a reason
|
|
@@ -154,14 +84,11 @@ pi install npm:@ferris1225/pi-subagents
|
|
|
154
84
|
|
|
155
85
|
Pi's extension list shows `@ferris1225/pi-subagents` without an internal source-path suffix.
|
|
156
86
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
full setup asks each enabled role's model, then its thinking level. A newly shipped
|
|
163
|
-
built-in is surfaced once without being re-enabled after you deliberately turn it
|
|
164
|
-
off. Then ask for work:
|
|
87
|
+
A fresh install writes a default config at session start — both roles enabled,
|
|
88
|
+
both following the main model — and announces `/subagents-setup` once; the file
|
|
89
|
+
itself is the marker, so later sessions stay silent. Run `/subagents-setup` to
|
|
90
|
+
pick a model and thinking level per role — that is the entire configuration
|
|
91
|
+
surface. Then ask for work:
|
|
165
92
|
|
|
166
93
|
```text
|
|
167
94
|
Map how authentication works, fix the refresh race, and run the tests.
|
|
@@ -183,9 +110,8 @@ tests, docs, and local cleanup, and reports a disproved premise or a scope/appro
|
|
|
183
110
|
blocker with evidence. Handoffs lead with the outcome and report checks as
|
|
184
111
|
`command → result`.
|
|
185
112
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
children on every task.
|
|
113
|
+
The catalog is fixed: `scout` and `artisan` are always enabled, and there are no
|
|
114
|
+
custom role files. Two roles do not require two children on every task.
|
|
189
115
|
|
|
190
116
|
Every child is a leaf pi process with its own context window and no memory of your
|
|
191
117
|
conversation. It still loads normal Pi context, including applicable project
|
|
@@ -197,9 +123,7 @@ material assumptions or blockers.
|
|
|
197
123
|
|
|
198
124
|
Children run the official `pi --mode rpc` server, using Pi's exported command/response
|
|
199
125
|
types and its own session persistence. There is no separate subagent protocol. The
|
|
200
|
-
host transport remains local.
|
|
201
|
-
process, signals only that process, and does not provide process-tree shutdown,
|
|
202
|
-
bounded abort coordination, or cancellation of child extension dialogs.
|
|
126
|
+
host transport remains local.
|
|
203
127
|
|
|
204
128
|
## Dispatching work
|
|
205
129
|
|
|
@@ -234,24 +158,18 @@ subagent({
|
|
|
234
158
|
});
|
|
235
159
|
```
|
|
236
160
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
reason to invent another phase. The runtime paces
|
|
242
|
-
execution: `maxConcurrentAgents: 0` (the default) keeps automatic capacity at half
|
|
243
|
-
the machine's cores, bounded to 4–6 child processes. Set `maxConcurrentAgents` to
|
|
244
|
-
1–6 for an explicit capacity. Wider batches queue and start as slots free.
|
|
245
|
-
This setting limits simultaneous processes, not total tasks or total token cost.
|
|
161
|
+
Independent phases go in one `tasks` array. The runtime paces execution at half
|
|
162
|
+
the machine's cores, bounded to 4–6 simultaneous child processes; wider batches
|
|
163
|
+
queue and start as slots free. The limit paces processes, not total tasks or
|
|
164
|
+
total token cost.
|
|
246
165
|
|
|
247
166
|
A run leases its stable, single-line `phaseId` in the resolved working directory.
|
|
248
167
|
Rewording the task with the same `phaseId` is rejected and names the existing run.
|
|
249
168
|
Completed and failed phases stay owned for the current session, even without a retained
|
|
250
169
|
session file. Calls that omit `phaseId` keep exact normalized task+cwd matching; equal
|
|
251
|
-
task text with different phase ids is
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
the runtime chooses which owner to report.
|
|
170
|
+
task text with different phase ids is still rejected by that fallback. Matching is
|
|
171
|
+
deterministic, never fuzzy, embedding-based, or inferred from natural language. Active
|
|
172
|
+
leases win over matching settled threads when the runtime chooses which owner to report.
|
|
255
173
|
|
|
256
174
|
Because queueing is pacing rather than refusal, it is always reported as such.
|
|
257
175
|
Dispatch confirmations name each waiting run's real reason — waiting for a free
|
|
@@ -269,11 +187,10 @@ only when the phases are independent. Never overlap writers or duplicate an owne
|
|
|
269
187
|
phase, and do not split one tightly coupled change across children.
|
|
270
188
|
|
|
271
189
|
Verification follows the change and required project gates. Tests should catch
|
|
272
|
-
meaningful failures, not mirror reversible, low-impact edits
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
the final gate, and release; children never bump versions, commit, push, or publish.
|
|
190
|
+
meaningful failures, not mirror reversible, low-impact edits. Fix failures caused
|
|
191
|
+
by the change, then repeat or broaden checks only for new edits, failures, or
|
|
192
|
+
unresolved concerns. Main owns architecture, the integrated diff, the final gate,
|
|
193
|
+
and release; children never bump versions, commit, push, or publish.
|
|
277
194
|
|
|
278
195
|
These defaults follow [OpenAI's GPT-6 Astra model guidance](https://developers.openai.com/api/docs/guides/latest-model?model=gpt-6-astra)
|
|
279
196
|
and [Eric Provencher's skills and prompts guidance](https://x.com/pvncher/status/2095991462416490862).
|
|
@@ -303,8 +220,8 @@ launch receipt say `independence not verified`; that means the contract lacked e
|
|
|
303
220
|
metadata, not that overlap was proved safe. Single calls never make a batch-independence
|
|
304
221
|
claim. The existing shared-checkout writer lane remains the final serialization boundary.
|
|
305
222
|
|
|
306
|
-
- Single tasks use your checkout. Parallel write-capable agents (`artisan`
|
|
307
|
-
|
|
223
|
+
- Single tasks use your checkout. Parallel write-capable agents (`artisan`)
|
|
224
|
+
default to a detached Git worktree, so parallel writers run at
|
|
308
225
|
the same time. Worktree mode needs a committed `HEAD`. Read-only roles such as
|
|
309
226
|
scout stay on the shared checkout, and an explicit `isolation: worktree` for a
|
|
310
227
|
read-only role is rejected.
|
|
@@ -313,9 +230,6 @@ claim. The existing shared-checkout writer lane remains the final serialization
|
|
|
313
230
|
Child tools, network access, and environment access retain the Pi process's privileges.
|
|
314
231
|
Third-party Pi packages execute as trusted code and must be reviewed accordingly.
|
|
315
232
|
|
|
316
|
-
- A role file can pin its own default with `isolation: worktree` or
|
|
317
|
-
`isolation: shared` in the frontmatter. Precedence is an explicit per-dispatch
|
|
318
|
-
`isolation`, then the role's declaration, then the parallel write default.
|
|
319
233
|
- An isolated run's tracked, deleted, untracked, and binary changes integrate
|
|
320
234
|
back exactly once, after the child settles. Nothing is staged and your index is
|
|
321
235
|
untouched.
|
|
@@ -356,20 +270,19 @@ child to finish. The model-facing answer is the progress view: state, elapsed ti
|
|
|
356
270
|
and an activity trail of what the run has been doing (for example
|
|
357
271
|
`activity: read src/config.ts · grep "cacheKey" · thinking`), plus failure
|
|
358
272
|
diagnostics and any actionable paths (a truncated run's full-result file, retained
|
|
359
|
-
worktree/patch artifacts).
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
to generate strict JSON. Agent-written reports remain evidence to verify.
|
|
273
|
+
worktree/patch artifacts). States distinguish `queued`, `running`, `interrupting`,
|
|
274
|
+
`settling` (Git finalization), `completed`, `failed`, `stopped`, and `interrupted`
|
|
275
|
+
(recovered unfinished work). Queued runs report their actual wait reason. Settled
|
|
276
|
+
runs remain queryable in the current parent session even after their transient
|
|
277
|
+
widget rows disappear.
|
|
278
|
+
|
|
279
|
+
The tool returns these facts in Pi's structured `details.runs` field. An individual
|
|
280
|
+
run's failure does not make a successful status lookup a tool error; an unknown `id`
|
|
281
|
+
does. This is runtime-authored data, not a requirement for children to generate
|
|
282
|
+
strict JSON. Agent-written reports remain evidence to verify.
|
|
370
283
|
|
|
371
284
|
A background dispatch returns a launch receipt, then its completion arrives at
|
|
372
|
-
the next safe parent boundary—after current tool calls and before the next model
|
|
285
|
+
the next safe parent boundary — after current tool calls and before the next model
|
|
373
286
|
call. `wait: true` instead holds the dispatch until its new runs settle, which is
|
|
374
287
|
useful for one-shot `pi -p` sessions or an immediate dependency. Each run has one
|
|
375
288
|
delivery route; aborting the waiting parent turn transfers delivery to the
|
|
@@ -384,26 +297,23 @@ manual recovery after reload or crash. Missing session files no longer discard
|
|
|
384
297
|
isolated edits. Restore for this checkout runs at session start; lookup tools,
|
|
385
298
|
prompt injection, and fresh dispatch wait for that pass so an existing id cannot
|
|
386
299
|
be reported missing or reused. A sibling window in another project leaves those
|
|
387
|
-
records untouched. Missing recorded worktrees surface as failures without
|
|
388
|
-
remaining recovery evidence.
|
|
300
|
+
records untouched. Missing recorded worktrees surface as failures without
|
|
301
|
+
discarding the remaining recovery evidence.
|
|
389
302
|
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
303
|
+
Invalid durable records are dropped without following or deleting their targets.
|
|
304
|
+
Recovery-owned worktrees and patches stay protected from startup sweeps and
|
|
305
|
+
project-root retention. Completed/failed runs drop their durable thread record;
|
|
306
|
+
after reload, inspect their delivered result instead of expecting them in the
|
|
307
|
+
current-session status list.
|
|
395
308
|
|
|
396
309
|
## Live status and results
|
|
397
310
|
|
|
398
311
|
The TUI widget renders one line per active run in fixed identity columns —
|
|
399
|
-
status icon, right-aligned `#id`, padded agent name, then the task label —
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
`think:<level>`, and seconds-precision elapsed. A live run renders
|
|
405
|
-
two lines: what it is — agent, task, usage, model, thinking, elapsed —
|
|
406
|
-
and, dim under the label column, what it is doing right now:
|
|
312
|
+
status icon, right-aligned `#id`, padded agent name, then the task label — with
|
|
313
|
+
the live activity dimmed after `↳` on its own line and the rest of the telemetry
|
|
314
|
+
inline after ` · `: the worktree badge, wait state, token flow in pi's footer
|
|
315
|
+
vocabulary (`↑` input, `↓` output, `R`/`W` cache read/write), cost, full
|
|
316
|
+
`provider/model`, current effective `think:<level>`, and seconds-precision elapsed:
|
|
407
317
|
|
|
408
318
|
```text
|
|
409
319
|
● #12 artisan src/cache.ts · worktree:a91f3c · ↑5.2k ↓41.0k R210.0k W6.1k $1.9400 · think:high · 12m06s
|
|
@@ -418,18 +328,16 @@ Telemetry drops leftmost-first when a row runs out of width (badge, wait state,
|
|
|
418
328
|
usage, model, thinking) while elapsed survives every width. Queued rows state
|
|
419
329
|
what they actually wait for — `queued` for a free process slot, `repo lane`
|
|
420
330
|
for shared-checkout write serialization, or `starting`. The widget is
|
|
421
|
-
capped at ten lines:
|
|
422
|
-
`… +N more` marker so the editor keeps its space.
|
|
331
|
+
capped at ten lines: extra runs collapse into a `… +N more` marker.
|
|
423
332
|
|
|
424
333
|
Completions resume the main agent on their own, with a compact block of at most 40
|
|
425
334
|
lines by default. Longer output (or lines wider than 200 characters) is not inlined
|
|
426
|
-
at all: the notice states the true size
|
|
427
|
-
a short result has a long line — and points at the unchanged Markdown artifact
|
|
335
|
+
at all: the notice states the true size and points at the unchanged Markdown artifact
|
|
428
336
|
holding the full output, and main is told to read that file. The content therefore
|
|
429
337
|
enters the main context exactly once, never first as a truncated copy the model
|
|
430
|
-
cannot trust and then again as the file read. Roles write result-only handoffs —
|
|
431
|
-
verification, unresolved blockers — and the main agent is told to
|
|
432
|
-
conclusion rather than restate what you already read. A failed run adds its
|
|
338
|
+
cannot trust and then again as the file read. Roles write result-only handoffs —
|
|
339
|
+
outcome, paths, verification, unresolved blockers — and the main agent is told to
|
|
340
|
+
add its conclusion rather than restate what you already read. A failed run adds its
|
|
433
341
|
failed-tool diagnostics.
|
|
434
342
|
|
|
435
343
|
Delivery is held while a context compaction is in flight and released once it
|
|
@@ -437,11 +345,9 @@ settles — on failure and abort too — so a result a child spent minutes produ
|
|
|
437
345
|
is never swallowed by the summary that replaces the history.
|
|
438
346
|
|
|
439
347
|
A `wait: true` dispatch streams its progress onto the tool card while it waits.
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
`provider/model` ref — when it settles, and a parallel group's totals
|
|
444
|
-
are grouped per model, never summed across them:
|
|
348
|
+
Each child reports its usage per run — with its full `provider/model` ref — when it
|
|
349
|
+
settles, and a parallel group's totals are grouped per model, never summed across
|
|
350
|
+
them:
|
|
445
351
|
|
|
446
352
|
```text
|
|
447
353
|
Totals: 3 runs · zhipu/glm-4.7: ↓300 $0.0500 · anthropic/claude-sonnet-4: ↓4.0k $1.5000
|
|
@@ -459,29 +365,34 @@ session** continues on the main model, so finished searches, reads, and edits
|
|
|
459
365
|
survive. Ordinary task failures do not trigger a handoff.
|
|
460
366
|
|
|
461
367
|
Thinking is a **role default** — scout `low`, artisan `high` — clamped to what
|
|
462
|
-
the effective model supports.
|
|
463
|
-
|
|
368
|
+
the effective model supports. The `/subagents-setup` thinking picker lists only
|
|
369
|
+
the levels that model supports and marks the role
|
|
464
370
|
default; selecting it clears the stored override. There is no
|
|
465
|
-
Auto choice
|
|
466
|
-
no `thinking` field in agent Markdown. Precedence: your setup override > the
|
|
371
|
+
Auto choice and no per-dispatch `thinking` flag. Precedence: your setup override > the
|
|
467
372
|
role default, then the model clamp. There is no separate vision mode — assign
|
|
468
373
|
a multimodal model and name the image paths in the task.
|
|
469
374
|
|
|
470
|
-
Every dispatch, startup retry, and model fallback snapshots the parent's
|
|
471
|
-
and all `subagent*` tools are removed so children remain leaves. A
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
`
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
375
|
+
Every dispatch, startup retry, and model fallback snapshots the parent's live
|
|
376
|
+
tools, and all `subagent*` tools are removed so children remain leaves. A broad
|
|
377
|
+
role inherits that snapshot — including `codemode` when the session runs it — so
|
|
378
|
+
a code-mode parent produces code-mode children under the same `codemode.mode`.
|
|
379
|
+
An explicit resolved list that names no MCP tool also excludes MCP tools it does
|
|
380
|
+
not name.
|
|
381
|
+
|
|
382
|
+
Neither role names extension, MCP, or vendor tools. `scout` is a hard
|
|
383
|
+
read-only boundary that is derived from the live catalog: it keeps every active
|
|
384
|
+
tool the host proves read-only — `annotations.readOnlyHint` for extension and
|
|
385
|
+
MCP tools, plus pi's own `read`, `grep`, `find`, and `ls` — and never a shell, a
|
|
386
|
+
mutation tool, or a tool that reaches other tools, so `codemode` and
|
|
387
|
+
`tool_search` cannot reach a writer through it. A retrieval extension or an MCP
|
|
388
|
+
search server therefore works for scout without being named anywhere, and without
|
|
389
|
+
reconfiguring the server: a read-only tool the session reaches only through
|
|
390
|
+
`codemode` or `tool_search` — pi's default for MCP servers — is handed to scout
|
|
391
|
+
directly, which is the same capability without giving scout a way to reach a
|
|
392
|
+
writer. Every other MCP tool stays excluded from that child. Tools with no
|
|
393
|
+
read-only annotation, whether they are declared by another role or by an active
|
|
394
|
+
extension, are conservatively treated as write-capable when isolation is chosen.
|
|
395
|
+
An empty resolved snapshot starts the child with `--no-tools`.
|
|
485
396
|
|
|
486
397
|
For external research scout prefers official documentation, specifications, release
|
|
487
398
|
notes, and first-party repositories; it fetches decisive pages rather than citing
|
|
@@ -489,62 +400,37 @@ search snippets, records material dates/versions, and marks uncertainty.
|
|
|
489
400
|
|
|
490
401
|
## Configuration
|
|
491
402
|
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
that
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
model/thinking settings; no retired-name aliases or configuration migration are applied.
|
|
501
|
-
The file is created on first start, and its presence is what keeps later sessions
|
|
502
|
-
silent. To start over, delete it and run `/subagents-setup`; the next session writes
|
|
503
|
-
the defaults again. Settings live in `~/.pi/agent/pi-subagents.json` (following
|
|
504
|
-
`PI_CODING_AGENT_DIR`):
|
|
403
|
+
`scout` and `artisan` are always enabled; the only settings are a model and a
|
|
404
|
+
thinking level per role. `/subagents-setup` opens a menu with one row per role —
|
|
405
|
+
its summary, current model, and current thinking level — plus a "Both roles"
|
|
406
|
+
walk that asks each role's model and then its thinking level. `Esc` moves back,
|
|
407
|
+
and the model picker supports fuzzy search. To start over, delete
|
|
408
|
+
`~/.pi/agent/pi-subagents.json` and run `/subagents-setup`; the next session
|
|
409
|
+
writes the defaults again. Settings live in `~/.pi/agent/pi-subagents.json`
|
|
410
|
+
(following `PI_CODING_AGENT_DIR`):
|
|
505
411
|
|
|
506
412
|
```json
|
|
507
413
|
{
|
|
508
|
-
"enabledAgents": ["scout", "artisan"],
|
|
509
|
-
"knownAgents": ["scout", "artisan"],
|
|
510
414
|
"agentModels": { "scout": "anthropic/claude-haiku-4-5" },
|
|
511
|
-
"agentThinkingLevels": { "artisan": "high" }
|
|
512
|
-
"maxResultLines": 40,
|
|
513
|
-
"maxConcurrentAgents": 0,
|
|
514
|
-
"agentScope": "user",
|
|
515
|
-
"idleTimeoutSec": 1800
|
|
415
|
+
"agentThinkingLevels": { "artisan": "high" }
|
|
516
416
|
}
|
|
517
417
|
```
|
|
518
418
|
|
|
519
419
|
| Field | Meaning |
|
|
520
420
|
| --------------------- | ------- |
|
|
521
|
-
| `
|
|
522
|
-
| `
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
roles or models; edit it in the JSON configuration file.
|
|
535
|
-
|
|
536
|
-
When at least one role is enabled, the delegation directive is installed as a
|
|
537
|
-
`<subagents>` prompt section. Active leases go in `<subagent_leases>`. Pi 1.0
|
|
538
|
-
appends a section delta only when that text changes, so idle turns keep the
|
|
539
|
-
cached system prefix. Hosts without a section map still receive the same
|
|
540
|
-
contract appended to the system prompt. `enabledAgents` is authoritative after
|
|
541
|
-
catalog adoption: a newly shipped built-in is appended once, then `knownAgents`
|
|
542
|
-
records that it was surfaced
|
|
543
|
-
so a deliberate later disable remains disabled. Role names left in an older
|
|
544
|
-
config do nothing unless a file still defines them; saving setup drops names
|
|
545
|
-
that have no file. Available custom roles remain
|
|
546
|
-
selectable even when disabled. Invalid known fields fall back safely, and unknown fields
|
|
547
|
-
are dropped when canonical config is persisted.
|
|
421
|
+
| `agentModels` | Optional model per role as `provider/model-id`; missing means the current main model. |
|
|
422
|
+
| `agentThinkingLevels` | Optional thinking override per role; missing means the role default (`scout` low, `artisan` high). |
|
|
423
|
+
|
|
424
|
+
Everything else is a fixed constant: result deliveries keep 40 lines before the
|
|
425
|
+
on-disk artifact takes over, process capacity is automatic, and a child silent
|
|
426
|
+
for 30 minutes is terminated. Obsolete keys left by older config files are
|
|
427
|
+
dropped when the canonical shape is persisted, and invalid values fall back to
|
|
428
|
+
defaults.
|
|
429
|
+
|
|
430
|
+
The delegation directive is installed as a `<subagents>` prompt section. Active
|
|
431
|
+
leases go in `<subagent_leases>`. Pi 1.0 appends a section delta only when that
|
|
432
|
+
text changes, so idle turns keep the cached system prefix. Hosts without a
|
|
433
|
+
section map still receive the same contract appended to the system prompt.
|
|
548
434
|
|
|
549
435
|
At session start, model overrides that pi no longer reports are removed with a
|
|
550
436
|
one-time notice. If pi's own session compaction fails mid-thread, a notice surfaces
|
|
@@ -562,19 +448,17 @@ facts, but its tests do not establish a quality or cost advantage over solo Pi.
|
|
|
562
448
|
Keep task prompts, models, thinking levels, tools, and project instructions
|
|
563
449
|
fixed. Keep results from earlier attempts out of later prompts; alternate
|
|
564
450
|
execution order and repeat each comparison several times.
|
|
565
|
-
3. Compare main
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
a pool of one can still launch several children sequentially. Record actual
|
|
569
|
-
child counts and roles as well, and do not require filling the pool.
|
|
451
|
+
3. Compare a session where main delegates freely against one where you instruct
|
|
452
|
+
it to work solo (or uninstall the extension). Record actual child counts and
|
|
453
|
+
roles as well — a delegation-prone main may still finish some tasks alone.
|
|
570
454
|
4. Measure final acceptance and regressions, elapsed time through integration,
|
|
571
455
|
and rework. Record main plus every child's token usage and cost, retaining
|
|
572
456
|
model identities and including failed attempts, review, integration, and
|
|
573
457
|
retries. A child's successful exit or quick first patch is not final success.
|
|
574
458
|
5. Compare quality under matched total-cost budgets and matched wall-clock
|
|
575
|
-
limits as separate experiments. Include failed or unfinished runs. The
|
|
576
|
-
|
|
577
|
-
|
|
459
|
+
limits as separate experiments. Include failed or unfinished runs. The idle
|
|
460
|
+
timeout only detects a silent child; enforce experiment-wide budgets in your
|
|
461
|
+
evaluation process.
|
|
578
462
|
|
|
579
463
|
The [BOAD coding study](https://arxiv.org/html/2512.23631v2) found a useful small
|
|
580
464
|
expert set but declining results when adding more roles; its role-count result
|
|
@@ -583,31 +467,6 @@ does not prescribe a concurrency limit. A broader
|
|
|
583
467
|
also found that coordination outcomes depend on the task and single-agent
|
|
584
468
|
baseline. These motivate measuring your own workflow, not a universal team size.
|
|
585
469
|
|
|
586
|
-
## Custom agents
|
|
587
|
-
|
|
588
|
-
Built-ins ship with the package. Add or replace them with Markdown files:
|
|
589
|
-
|
|
590
|
-
- User agents: `~/.pi/agent/agents/`
|
|
591
|
-
- Project agents: the nearest `.pi/agents/` in a trusted project
|
|
592
|
-
- Precedence: project > user > built-in, where the same `name` wins
|
|
593
|
-
|
|
594
|
-
```yaml
|
|
595
|
-
---
|
|
596
|
-
name: scout
|
|
597
|
-
description: Fast read-only codebase reconnaissance
|
|
598
|
-
isolation: shared
|
|
599
|
-
tools: read, grep, find, ls
|
|
600
|
-
---
|
|
601
|
-
…additional system prompt…
|
|
602
|
-
```
|
|
603
|
-
|
|
604
|
-
`description` is the routing line the main model reads. `isolation` pins the
|
|
605
|
-
role's default boundary as described under [Parallel edits](#parallel-edits).
|
|
606
|
-
Models come only from `/subagents-setup`; an agent file cannot pin one. An
|
|
607
|
-
explicit `tools` list is intersected with the parent's active set; omitting it
|
|
608
|
-
inherits the active set. A role named `scout` is always reduced to the fixed
|
|
609
|
-
read-only tool set described above.
|
|
610
|
-
|
|
611
470
|
## Storage and cleanup
|
|
612
471
|
|
|
613
472
|
Everything lives under your pi agent directory, grouped per project. Nothing
|
|
@@ -642,14 +501,13 @@ npm run check
|
|
|
642
501
|
`npm run check` is `tsc --noEmit` plus the unit tests (`npm test`). There are
|
|
643
502
|
no bundled runtime dependencies; pi and TypeBox are peers. The source is
|
|
644
503
|
grouped by responsibility under `src/`: configuration, delegation, execution, isolation,
|
|
645
|
-
lifecycle, and presentation.
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
replacement RPC server is introduced.
|
|
504
|
+
lifecycle, and presentation.
|
|
505
|
+
|
|
506
|
+
`npm test` runs the TypeScript sources on Node's built-in type stripping from
|
|
507
|
+
Node 22.19 up, including Node 26, which removed `--experimental-transform-types`;
|
|
508
|
+
the source therefore avoids parameter properties and other transform-only
|
|
509
|
+
syntax. Pi and TypeBox are peers, and the extension imports only pi's public SDK
|
|
510
|
+
surface, so nothing is bundled.
|
|
653
511
|
|
|
654
512
|
## Changelog
|
|
655
513
|
|