@ferris1225/pi-subagents 4.3.30 → 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 +62 -0
- package/LICENSE +1 -1
- package/README.md +129 -265
- package/index.ts +5 -13
- package/package.json +5 -10
- package/src/configuration/config.ts +17 -125
- package/src/configuration/models.ts +1 -1
- package/src/configuration/setup.ts +90 -188
- 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/announcements.ts +2 -4
- 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,88 +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
|
-
activity no longer re-renders the widget per token, and the durable manifest is
|
|
28
|
-
no longer rewritten on every child turn.
|
|
29
|
-
|
|
30
|
-
**4.3.26** — scout is search-only, completions stop double-delivering, and
|
|
31
|
-
progress no longer routes through files. Scout's role is now exactly code and
|
|
32
|
-
documentation search plus web lookup; it has no shell, and work that needs
|
|
33
|
-
execution stays in main. A result that exceeds the inline limit is no longer
|
|
34
|
-
dumped truncated into the completion: none of it is inlined, and the notice
|
|
35
|
-
points at the full Markdown artifact, so the content enters the main context
|
|
36
|
-
exactly once. `subagent_status` answers progress with an activity trail
|
|
37
|
-
(what each run has been doing) instead of child session paths, and the
|
|
38
|
-
advisory `subagent_risk` tool is gone. Development dependencies track Pi 1.3.0.
|
|
39
|
-
|
|
40
|
-
**4.3.24** — the per-model cost footer drops the live `tok/s` throughput
|
|
41
|
-
figure: measured rates could not be trusted across providers, so the footer
|
|
42
|
-
sticks to what pi reports exactly — per-model token flow, cost, context share,
|
|
43
|
-
and thinking level.
|
|
44
|
-
|
|
45
|
-
**4.3.23** — Pi 1.0.3. Development dependencies track that release. A stored
|
|
46
|
-
agent model that still names `azure-openai-responses/<id>` keeps working: it
|
|
47
|
-
follows the live catalog, and is saved as `azure/<id>` once that is the id Pi
|
|
48
|
-
reports.
|
|
49
|
-
|
|
50
|
-
**4.3.22** — use a subagent when the work can run independently in parallel, its
|
|
51
|
-
boundary is clear, and delegation will actually reduce cost or improve
|
|
52
|
-
completion quality. Role choice stays with scout and artisan.
|
|
53
|
-
|
|
54
|
-
**4.3.21** — two built-in roles. `scout` is the lightweight read-only researcher
|
|
55
|
-
and `artisan` implements one substantial change. Steward and sentinel are no
|
|
56
|
-
longer shipped. Role prompts follow the GPT-6 Astra guidance: the brief wins,
|
|
57
|
-
authorized work runs through, and checks stay proportional. Main prefers scout
|
|
58
|
-
and artisan when a fresh context or a parallel phase helps, and does not open
|
|
59
|
-
extra phases to fill free slots.
|
|
60
|
-
|
|
61
|
-
**4.3.20** — Pi 1.0 prompt sections and tool exposure. The delegation contract
|
|
62
|
-
is a `<subagents>` section, and live leases are a separate `<subagent_leases>`
|
|
63
|
-
section, so an unchanged turn keeps the cached system prefix. Orchestration
|
|
64
|
-
tools stay declared to the model and cannot be called from codemode scripts.
|
|
65
|
-
Dispatch and stop run sequentially so one assistant message cannot race
|
|
66
|
-
admission. Child processes still force provider `maxRetries: 0`, using the
|
|
67
|
-
1.0 registration that requires an `api`.
|
|
68
|
-
|
|
69
|
-
**4.3.19** — session-start restore and recovery notices stay inside the current
|
|
70
|
-
project. A second pi window no longer surfaces another checkout's retained
|
|
71
|
-
worktree or restores (and would otherwise stop) that project's interrupted runs.
|
|
72
|
-
|
|
73
|
-
**4.3.18** — main-first delegation: keep known-context local changes in main,
|
|
74
|
-
use cleanup and review roles only where they add value, and configure process
|
|
75
|
-
capacity with `maxConcurrentAgents`. See [Evaluate delegation](#evaluate-delegation)
|
|
76
|
-
to compare quality, elapsed time, and complete task cost on your own workload.
|
|
77
|
-
|
|
78
|
-
**4.3.15** — fix the cost footer crash after `/reload`, `/new`, `/resume`, or
|
|
79
|
-
`/fork`: each footer now reads only its own session's live context, never an
|
|
80
|
-
event context retained from the previous session.
|
|
81
|
-
|
|
82
|
-
**4.3.13** — the footer is reserved for the per-model cost tally: the
|
|
83
|
-
`subagents N running` activity-count line is gone, leaving the widget,
|
|
84
|
-
completion notifications, and `subagent_status` for live progress.
|
|
85
|
-
|
|
86
|
-
**4.3.12** — per-model accounting: the main window's consumption line becomes a
|
|
87
|
-
per-model cost footer (token flow, cost, context share, and live `tok/s` per
|
|
88
|
-
`provider/model`), awaited children's usage is no longer folded into the parent
|
|
89
|
-
session total, and parallel completion totals are grouped per model instead of
|
|
90
|
-
summed across them.
|
|
91
|
-
|
|
92
|
-
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.
|
|
93
27
|
|
|
94
28
|
## Contents
|
|
95
29
|
|
|
@@ -103,10 +37,8 @@ See [CHANGELOG.md](./CHANGELOG.md).
|
|
|
103
37
|
- [Models, thinking, and tools](#models-thinking-and-tools)
|
|
104
38
|
- [Configuration](#configuration)
|
|
105
39
|
- [Evaluate delegation](#evaluate-delegation)
|
|
106
|
-
- [Custom agents](#custom-agents)
|
|
107
40
|
- [Storage and cleanup](#storage-and-cleanup)
|
|
108
41
|
- [Development](#development)
|
|
109
|
-
- [Changelog](#changelog)
|
|
110
42
|
- [Release](#release)
|
|
111
43
|
|
|
112
44
|
## Why
|
|
@@ -116,9 +48,11 @@ at "spawn a child with a prompt" and leave the hard parts — when to delegate,
|
|
|
116
48
|
wide to fan out, what happens when a model dies, how results come
|
|
117
49
|
back — with you. This extension owns them:
|
|
118
50
|
|
|
119
|
-
- Main
|
|
120
|
-
|
|
121
|
-
|
|
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
|
|
122
56
|
lookup only — it has no shell, so work that needs execution stays in main;
|
|
123
57
|
`artisan` covers one substantial change. A small edit already understood in
|
|
124
58
|
the current context stays in main, and a free process slot is not a reason
|
|
@@ -150,14 +84,11 @@ pi install npm:@ferris1225/pi-subagents
|
|
|
150
84
|
|
|
151
85
|
Pi's extension list shows `@ferris1225/pi-subagents` without an internal source-path suffix.
|
|
152
86
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
model, then its thinking level. Fresh installs select both roles. A newly shipped
|
|
159
|
-
built-in is surfaced once without being re-enabled after you deliberately turn it
|
|
160
|
-
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:
|
|
161
92
|
|
|
162
93
|
```text
|
|
163
94
|
Map how authentication works, fix the refresh race, and run the tests.
|
|
@@ -179,9 +110,8 @@ tests, docs, and local cleanup, and reports a disproved premise or a scope/appro
|
|
|
179
110
|
blocker with evidence. Handoffs lead with the outcome and report checks as
|
|
180
111
|
`command → result`.
|
|
181
112
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
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.
|
|
185
115
|
|
|
186
116
|
Every child is a leaf pi process with its own context window and no memory of your
|
|
187
117
|
conversation. It still loads normal Pi context, including applicable project
|
|
@@ -193,9 +123,7 @@ material assumptions or blockers.
|
|
|
193
123
|
|
|
194
124
|
Children run the official `pi --mode rpc` server, using Pi's exported command/response
|
|
195
125
|
types and its own session persistence. There is no separate subagent protocol. The
|
|
196
|
-
host transport remains local.
|
|
197
|
-
process, signals only that process, and does not provide process-tree shutdown,
|
|
198
|
-
bounded abort coordination, or cancellation of child extension dialogs.
|
|
126
|
+
host transport remains local.
|
|
199
127
|
|
|
200
128
|
## Dispatching work
|
|
201
129
|
|
|
@@ -230,24 +158,18 @@ subagent({
|
|
|
230
158
|
});
|
|
231
159
|
```
|
|
232
160
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
reason to invent another phase. The runtime paces
|
|
238
|
-
execution: `maxConcurrentAgents: 0` (the default) keeps automatic capacity at half
|
|
239
|
-
the machine's cores, bounded to 4–6 child processes. Set `maxConcurrentAgents` to
|
|
240
|
-
1–6 for an explicit capacity. Wider batches queue and start as slots free.
|
|
241
|
-
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.
|
|
242
165
|
|
|
243
166
|
A run leases its stable, single-line `phaseId` in the resolved working directory.
|
|
244
167
|
Rewording the task with the same `phaseId` is rejected and names the existing run.
|
|
245
168
|
Completed and failed phases stay owned for the current session, even without a retained
|
|
246
169
|
session file. Calls that omit `phaseId` keep exact normalized task+cwd matching; equal
|
|
247
|
-
task text with different phase ids is
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
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.
|
|
251
173
|
|
|
252
174
|
Because queueing is pacing rather than refusal, it is always reported as such.
|
|
253
175
|
Dispatch confirmations name each waiting run's real reason — waiting for a free
|
|
@@ -265,11 +187,10 @@ only when the phases are independent. Never overlap writers or duplicate an owne
|
|
|
265
187
|
phase, and do not split one tightly coupled change across children.
|
|
266
188
|
|
|
267
189
|
Verification follows the change and required project gates. Tests should catch
|
|
268
|
-
meaningful failures, not mirror reversible, low-impact edits
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
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.
|
|
273
194
|
|
|
274
195
|
These defaults follow [OpenAI's GPT-6 Astra model guidance](https://developers.openai.com/api/docs/guides/latest-model?model=gpt-6-astra)
|
|
275
196
|
and [Eric Provencher's skills and prompts guidance](https://x.com/pvncher/status/2095991462416490862).
|
|
@@ -299,8 +220,8 @@ launch receipt say `independence not verified`; that means the contract lacked e
|
|
|
299
220
|
metadata, not that overlap was proved safe. Single calls never make a batch-independence
|
|
300
221
|
claim. The existing shared-checkout writer lane remains the final serialization boundary.
|
|
301
222
|
|
|
302
|
-
- Single tasks use your checkout. Parallel write-capable agents (`artisan`
|
|
303
|
-
|
|
223
|
+
- Single tasks use your checkout. Parallel write-capable agents (`artisan`)
|
|
224
|
+
default to a detached Git worktree, so parallel writers run at
|
|
304
225
|
the same time. Worktree mode needs a committed `HEAD`. Read-only roles such as
|
|
305
226
|
scout stay on the shared checkout, and an explicit `isolation: worktree` for a
|
|
306
227
|
read-only role is rejected.
|
|
@@ -309,9 +230,6 @@ claim. The existing shared-checkout writer lane remains the final serialization
|
|
|
309
230
|
Child tools, network access, and environment access retain the Pi process's privileges.
|
|
310
231
|
Third-party Pi packages execute as trusted code and must be reviewed accordingly.
|
|
311
232
|
|
|
312
|
-
- A role file can pin its own default with `isolation: worktree` or
|
|
313
|
-
`isolation: shared` in the frontmatter. Precedence is an explicit per-dispatch
|
|
314
|
-
`isolation`, then the role's declaration, then the parallel write default.
|
|
315
233
|
- An isolated run's tracked, deleted, untracked, and binary changes integrate
|
|
316
234
|
back exactly once, after the child settles. Nothing is staged and your index is
|
|
317
235
|
untouched.
|
|
@@ -352,20 +270,19 @@ child to finish. The model-facing answer is the progress view: state, elapsed ti
|
|
|
352
270
|
and an activity trail of what the run has been doing (for example
|
|
353
271
|
`activity: read src/config.ts · grep "cacheKey" · thinking`), plus failure
|
|
354
272
|
diagnostics and any actionable paths (a truncated run's full-result file, retained
|
|
355
|
-
worktree/patch artifacts).
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
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.
|
|
366
283
|
|
|
367
284
|
A background dispatch returns a launch receipt, then its completion arrives at
|
|
368
|
-
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
|
|
369
286
|
call. `wait: true` instead holds the dispatch until its new runs settle, which is
|
|
370
287
|
useful for one-shot `pi -p` sessions or an immediate dependency. Each run has one
|
|
371
288
|
delivery route; aborting the waiting parent turn transfers delivery to the
|
|
@@ -380,26 +297,23 @@ manual recovery after reload or crash. Missing session files no longer discard
|
|
|
380
297
|
isolated edits. Restore for this checkout runs at session start; lookup tools,
|
|
381
298
|
prompt injection, and fresh dispatch wait for that pass so an existing id cannot
|
|
382
299
|
be reported missing or reused. A sibling window in another project leaves those
|
|
383
|
-
records untouched. Missing recorded worktrees surface as failures without
|
|
384
|
-
remaining recovery evidence.
|
|
300
|
+
records untouched. Missing recorded worktrees surface as failures without
|
|
301
|
+
discarding the remaining recovery evidence.
|
|
385
302
|
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
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.
|
|
391
308
|
|
|
392
309
|
## Live status and results
|
|
393
310
|
|
|
394
311
|
The TUI widget renders one line per active run in fixed identity columns —
|
|
395
|
-
status icon, right-aligned `#id`, padded agent name, then the task label —
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
`think:<level>`, and seconds-precision elapsed. A live run renders
|
|
401
|
-
two lines: what it is — agent, task, usage, model, thinking, elapsed —
|
|
402
|
-
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:
|
|
403
317
|
|
|
404
318
|
```text
|
|
405
319
|
● #12 artisan src/cache.ts · worktree:a91f3c · ↑5.2k ↓41.0k R210.0k W6.1k $1.9400 · think:high · 12m06s
|
|
@@ -414,18 +328,16 @@ Telemetry drops leftmost-first when a row runs out of width (badge, wait state,
|
|
|
414
328
|
usage, model, thinking) while elapsed survives every width. Queued rows state
|
|
415
329
|
what they actually wait for — `queued` for a free process slot, `repo lane`
|
|
416
330
|
for shared-checkout write serialization, or `starting`. The widget is
|
|
417
|
-
capped at ten lines:
|
|
418
|
-
`… +N more` marker so the editor keeps its space.
|
|
331
|
+
capped at ten lines: extra runs collapse into a `… +N more` marker.
|
|
419
332
|
|
|
420
333
|
Completions resume the main agent on their own, with a compact block of at most 40
|
|
421
334
|
lines by default. Longer output (or lines wider than 200 characters) is not inlined
|
|
422
|
-
at all: the notice states the true size
|
|
423
|
-
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
|
|
424
336
|
holding the full output, and main is told to read that file. The content therefore
|
|
425
337
|
enters the main context exactly once, never first as a truncated copy the model
|
|
426
|
-
cannot trust and then again as the file read. Roles write result-only handoffs —
|
|
427
|
-
verification, unresolved blockers — and the main agent is told to
|
|
428
|
-
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
|
|
429
341
|
failed-tool diagnostics.
|
|
430
342
|
|
|
431
343
|
Delivery is held while a context compaction is in flight and released once it
|
|
@@ -433,11 +345,9 @@ settles — on failure and abort too — so a result a child spent minutes produ
|
|
|
433
345
|
is never swallowed by the summary that replaces the history.
|
|
434
346
|
|
|
435
347
|
A `wait: true` dispatch streams its progress onto the tool card while it waits.
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
`provider/model` ref — when it settles, and a parallel group's totals
|
|
440
|
-
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:
|
|
441
351
|
|
|
442
352
|
```text
|
|
443
353
|
Totals: 3 runs · zhipu/glm-4.7: ↓300 $0.0500 · anthropic/claude-sonnet-4: ↓4.0k $1.5000
|
|
@@ -455,29 +365,34 @@ session** continues on the main model, so finished searches, reads, and edits
|
|
|
455
365
|
survive. Ordinary task failures do not trigger a handoff.
|
|
456
366
|
|
|
457
367
|
Thinking is a **role default** — scout `low`, artisan `high` — clamped to what
|
|
458
|
-
the effective model supports.
|
|
459
|
-
|
|
368
|
+
the effective model supports. The `/subagents-setup` thinking picker lists only
|
|
369
|
+
the levels that model supports and marks the role
|
|
460
370
|
default; selecting it clears the stored override. There is no
|
|
461
|
-
Auto choice
|
|
462
|
-
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
|
|
463
372
|
role default, then the model clamp. There is no separate vision mode — assign
|
|
464
373
|
a multimodal model and name the image paths in the task.
|
|
465
374
|
|
|
466
|
-
Every dispatch, startup retry, and model fallback snapshots the parent's
|
|
467
|
-
and all `subagent*` tools are removed so children remain leaves. A
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
`
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
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`.
|
|
481
396
|
|
|
482
397
|
For external research scout prefers official documentation, specifications, release
|
|
483
398
|
notes, and first-party repositories; it fetches decisive pages rather than citing
|
|
@@ -485,60 +400,37 @@ search snippets, records material dates/versions, and marks uncertainty.
|
|
|
485
400
|
|
|
486
401
|
## Configuration
|
|
487
402
|
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
that
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
model/thinking settings; no retired-name aliases or configuration migration are applied.
|
|
497
|
-
To start over, remove `pi-subagents.json` and run `/subagents-setup` again. Other settings live in
|
|
498
|
-
`~/.pi/agent/pi-subagents.json` (following `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`):
|
|
499
411
|
|
|
500
412
|
```json
|
|
501
413
|
{
|
|
502
|
-
"enabledAgents": ["scout", "artisan"],
|
|
503
|
-
"knownAgents": ["scout", "artisan"],
|
|
504
414
|
"agentModels": { "scout": "anthropic/claude-haiku-4-5" },
|
|
505
|
-
"agentThinkingLevels": { "artisan": "high" }
|
|
506
|
-
"maxResultLines": 40,
|
|
507
|
-
"maxConcurrentAgents": 0,
|
|
508
|
-
"agentScope": "user",
|
|
509
|
-
"idleTimeoutSec": 1800
|
|
415
|
+
"agentThinkingLevels": { "artisan": "high" }
|
|
510
416
|
}
|
|
511
417
|
```
|
|
512
418
|
|
|
513
419
|
| Field | Meaning |
|
|
514
420
|
| --------------------- | ------- |
|
|
515
|
-
| `
|
|
516
|
-
| `
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
roles or models; edit it in the JSON configuration file.
|
|
529
|
-
|
|
530
|
-
When at least one role is enabled, the delegation directive is installed as a
|
|
531
|
-
`<subagents>` prompt section. Active leases go in `<subagent_leases>`. Pi 1.0
|
|
532
|
-
appends a section delta only when that text changes, so idle turns keep the
|
|
533
|
-
cached system prefix. Hosts without a section map still receive the same
|
|
534
|
-
contract appended to the system prompt. `enabledAgents` is authoritative after
|
|
535
|
-
catalog adoption: a newly shipped built-in is appended once, then `knownAgents`
|
|
536
|
-
records that it was surfaced
|
|
537
|
-
so a deliberate later disable remains disabled. Role names left in an older
|
|
538
|
-
config do nothing unless a file still defines them; saving setup drops names
|
|
539
|
-
that have no file. Available custom roles remain
|
|
540
|
-
selectable even when disabled. Invalid known fields fall back safely, and unknown fields
|
|
541
|
-
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.
|
|
542
434
|
|
|
543
435
|
At session start, model overrides that pi no longer reports are removed with a
|
|
544
436
|
one-time notice. If pi's own session compaction fails mid-thread, a notice surfaces
|
|
@@ -556,19 +448,17 @@ facts, but its tests do not establish a quality or cost advantage over solo Pi.
|
|
|
556
448
|
Keep task prompts, models, thinking levels, tools, and project instructions
|
|
557
449
|
fixed. Keep results from earlier attempts out of later prompts; alternate
|
|
558
450
|
execution order and repeat each comparison several times.
|
|
559
|
-
3. Compare main
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
a pool of one can still launch several children sequentially. Record actual
|
|
563
|
-
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.
|
|
564
454
|
4. Measure final acceptance and regressions, elapsed time through integration,
|
|
565
455
|
and rework. Record main plus every child's token usage and cost, retaining
|
|
566
456
|
model identities and including failed attempts, review, integration, and
|
|
567
457
|
retries. A child's successful exit or quick first patch is not final success.
|
|
568
458
|
5. Compare quality under matched total-cost budgets and matched wall-clock
|
|
569
|
-
limits as separate experiments. Include failed or unfinished runs. The
|
|
570
|
-
|
|
571
|
-
|
|
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.
|
|
572
462
|
|
|
573
463
|
The [BOAD coding study](https://arxiv.org/html/2512.23631v2) found a useful small
|
|
574
464
|
expert set but declining results when adding more roles; its role-count result
|
|
@@ -577,31 +467,6 @@ does not prescribe a concurrency limit. A broader
|
|
|
577
467
|
also found that coordination outcomes depend on the task and single-agent
|
|
578
468
|
baseline. These motivate measuring your own workflow, not a universal team size.
|
|
579
469
|
|
|
580
|
-
## Custom agents
|
|
581
|
-
|
|
582
|
-
Built-ins ship with the package. Add or replace them with Markdown files:
|
|
583
|
-
|
|
584
|
-
- User agents: `~/.pi/agent/agents/`
|
|
585
|
-
- Project agents: the nearest `.pi/agents/` in a trusted project
|
|
586
|
-
- Precedence: project > user > built-in, where the same `name` wins
|
|
587
|
-
|
|
588
|
-
```yaml
|
|
589
|
-
---
|
|
590
|
-
name: scout
|
|
591
|
-
description: Fast read-only codebase reconnaissance
|
|
592
|
-
isolation: shared
|
|
593
|
-
tools: read, grep, find, ls
|
|
594
|
-
---
|
|
595
|
-
…additional system prompt…
|
|
596
|
-
```
|
|
597
|
-
|
|
598
|
-
`description` is the routing line the main model reads. `isolation` pins the
|
|
599
|
-
role's default boundary as described under [Parallel edits](#parallel-edits).
|
|
600
|
-
Models come only from `/subagents-setup`; an agent file cannot pin one. An
|
|
601
|
-
explicit `tools` list is intersected with the parent's active set; omitting it
|
|
602
|
-
inherits the active set. A role named `scout` is always reduced to the fixed
|
|
603
|
-
read-only tool set described above.
|
|
604
|
-
|
|
605
470
|
## Storage and cleanup
|
|
606
471
|
|
|
607
472
|
Everything lives under your pi agent directory, grouped per project. Nothing
|
|
@@ -636,14 +501,13 @@ npm run check
|
|
|
636
501
|
`npm run check` is `tsc --noEmit` plus the unit tests (`npm test`). There are
|
|
637
502
|
no bundled runtime dependencies; pi and TypeBox are peers. The source is
|
|
638
503
|
grouped by responsibility under `src/`: configuration, delegation, execution, isolation,
|
|
639
|
-
lifecycle, and presentation.
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
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.
|
|
647
511
|
|
|
648
512
|
## Changelog
|
|
649
513
|
|