@ferris1225/pi-subagents 4.2.13 → 4.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,40 @@ Published versions of `@ferris1225/pi-subagents`. Unpublished numbers
4
4
  (`4.2.3`, `4.2.6`, `4.2.9`–`4.2.11`) never shipped on npm; their changes
5
5
  landed in the next published release.
6
6
 
7
+ ## 4.3.1
8
+
9
+ - Make phase ownership explicit and reject an exact active duplicate by normalized
10
+ task plus resolved working directory, regardless of agent name.
11
+ - Route each result exactly once: `wait: true` owns in-turn delivery, background
12
+ completions use follow-up wakeups, and immediate failures flush earlier successes.
13
+ - Move worktree preparation under the bounded queue, release child-process slots
14
+ before Git finalization, and report repository-lane versus process-slot waits
15
+ accurately.
16
+ - Keep missing restored worktrees failed, retained, and non-resumable; compute RPC
17
+ usage from generation-safe session-stat deltas.
18
+ - Store the worktree recovery manifest under `ferris-pi-subagents/`, relocating
19
+ an existing agent-root manifest without losing retained artifact pointers.
20
+ - Enforce a strict read-only scout tool set and strict declared-tool intersection.
21
+ Unknown custom tools remain conservatively write-capable for isolation.
22
+ - Honor `enabledAgents`, including `[]`, without auto-enabling roles. Remove the
23
+ completed role/config migration bridge and shorten role prompts, tool metadata,
24
+ launch receipts, and handoffs.
25
+
26
+ ## 4.3.0
27
+
28
+ - Built-in team is `scout`, `artisan`, and `steward`. All three stay enabled.
29
+ - `explorer` / `executor` configs rename in place (models and thinking
30
+ overrides follow). `steward` is adopted. That migration is deleted in the
31
+ next major.
32
+ - Artisan owns implement / fix / refactor / test. Steward owns cleanup, docs
33
+ sync, and merge — dispatched only when that work exists.
34
+ - Thinking is a role default (scout low, artisan high, steward medium) that
35
+ `/subagents-setup` can override. Per-call `thinking` and agent-file
36
+ `thinking` are gone. There is no Auto row.
37
+ - First session and first-run setup explain each role and ask for a model.
38
+ - Unit tests cover catalog migration, role prompts, dispatch routing, and
39
+ honest footer / truncation notes.
40
+
7
41
  ## 4.2.13
8
42
 
9
43
  - README: table of contents, a What's new lead-in, and a pointer at this
package/README.md CHANGED
@@ -6,20 +6,17 @@
6
6
  ![platform](https://img.shields.io/badge/platform-Windows%20%7C%20macOS%20%7C%20Linux-lightgrey)
7
7
  ![pi](https://img.shields.io/badge/pi-extension-orange)
8
8
 
9
- A managed engineering team for [pi](https://github.com/earendil-works/pi): two
9
+ A managed engineering team for [pi](https://github.com/earendil-works/pi): three
10
10
  focused sub-agents, durable threads, and Git worktree
11
11
  isolation. You install it once and your main agent delegates on its own.
12
12
 
13
13
  ## What's new
14
14
 
15
- **4.2.13** — this page now leads with current changes and keeps the 4.2 line
16
- in [CHANGELOG.md](./CHANGELOG.md).
17
-
18
- **4.2.12**
19
-
20
- - The executor confirms a named defect on current code before it edits.
21
- - Footer settled counts stay honest, and only while a sibling is still live.
22
- - Merging to `main` publishes npm and opens a matching GitHub Release.
15
+ **4.3.1** — phase ownership prevents duplicate paid work, completion delivery
16
+ is exactly once, worktree setup obeys the bounded queue, and final integration
17
+ releases its child-process slot. Scout now has a strict read-only tool boundary;
18
+ `enabledAgents` is authoritative, including `[]`. Role prompts and launch receipts
19
+ are shorter and cost-aware. See [CHANGELOG.md](./CHANGELOG.md).
23
20
 
24
21
  ## Contents
25
22
 
@@ -45,17 +42,19 @@ at "spawn a child with a prompt" and leave the hard parts — when to delegate,
45
42
  wide to fan out, what happens when a model dies, how results come
46
43
  back — with you. This extension owns them:
47
44
 
48
- - The main model delegates without being asked, because a delegation directive is
49
- always in its system prompt.
50
- - Dispatching never blocks or ends the main turn, so it can start several runs and
51
- keep working while they execute.
52
- - Results deliver themselves. There is no status tool to poll and no lookup step.
53
- - Parallel writers get their own Git worktrees, so concurrent edits do not collide
54
- and your index is never touched.
55
- - Threads keep their context across resume, stop, reload, and crash; a dead model
56
- hands its session to the current main model instead of losing progress.
57
- - Crashes, partial starts, and integration failures come back as results with
58
- recovery records never as silent hangs.
45
+ - The main model gets a cost-aware routing contract and delegates only when a leaf
46
+ context saves more work than its handoff costs.
47
+ - One active normalized task and working directory owns its phase, so an exact
48
+ duplicate dispatch is rejected instead of paying twice.
49
+ - Background completions wake the main model; `wait: true` returns the same result
50
+ in-turn instead. A run uses exactly one route.
51
+ - Parallel writers use detached Git worktrees without touching your index.
52
+ Worktree setup obeys the bounded queue; final integration releases its process
53
+ slot.
54
+ - Interrupted threads retain their session for resume after reload or crash; a
55
+ configured child-model failure continues the same session on the main model.
56
+ - Start, restore, and integration failures surface with retained recovery paths
57
+ instead of becoming silent hangs.
59
58
 
60
59
  ## Install
61
60
 
@@ -65,10 +64,10 @@ Requires **pi >= 0.84.4** and **Node.js >= 22.19.0**.
65
64
  pi install npm:@ferris1225/pi-subagents
66
65
  ```
67
66
 
68
- Open pi and run `/subagents-setup` to choose agents, models, and thinking
69
- strengths. A fresh install enables every agent on the current main model, and each
70
- session start points you at the wizard until a config file exists. Then just ask
71
- for work:
67
+ Open pi and run `/subagents-setup`. Choose the enabled roles, then pick a model
68
+ and optional thinking override for each. Fresh installs select all three, but
69
+ you can disable any role or use `[]` to disable delegation. Then just ask for
70
+ work:
72
71
 
73
72
  ```text
74
73
  Map how authentication works, fix the refresh race, run the tests, and review the diff.
@@ -79,10 +78,11 @@ directly when you want exact control.
79
78
 
80
79
  ## The team
81
80
 
82
- | Agent | Access | Best for |
83
- | ------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
84
- | `explorer` | Read-only | Broad search, unfamiliar-area mapping, symbol and dependency tracing. Returns a retrieval index — never proof. A single artifact the main agent must fully absorb (one issue, one spec) stays an inline read. |
85
- | `executor` | Full | A self-contained unit that changes the repository or condenses inputs: implementation, fixes, refactors, tests, evidence-first cleanup, docs/comment sync, or merging a fan-out's results into one brief — carried through verification and a result-only handoff. |
81
+ | Agent | Access | Owns |
82
+ | --------- | --------- | ---- |
83
+ | `scout` | Read-only | Broad or unfamiliar reconnaissance with compact findings and decisive citations. Its output is a retrieval lead, not proof. |
84
+ | `artisan` | Full | A substantial self-contained implementation, including affected tests, docs, comments, targeted checks, and local cleanup. |
85
+ | `steward` | Full | One pre-commit cleanup or cross-cutting docs/comments pass after a broad or multi-writer change is complete. |
86
86
 
87
87
  Custom roles join them with a Markdown file (see [Custom agents](#custom-agents)).
88
88
 
@@ -90,33 +90,21 @@ Every child is an isolated leaf pi process with its own context window and no
90
90
  memory of your conversation, so the brief is its only input. A good brief carries
91
91
  the goal, exact paths, constraints, and expected output — which is what the
92
92
  injected delegation guidance produces when the main agent dispatches for you.
93
- A named defect is not yet a change: confirm it on current code before fixing
94
- or briefing a fix. The executor re-reads before it edits.
95
-
96
- ```text
97
- You
98
- └─ pi main agent
99
- ├─ explorer ─── parallel recon, retrieval leads only
100
- └─ executor ─── one deliverable per child: implement, fix, clean up,
101
- sync docs, or merge fan-out results → verify → deliver
102
- ```
103
93
 
104
94
  ## Dispatching work
105
95
 
106
96
  ```ts
107
97
  // One task
108
98
  subagent({
109
- agent: "executor",
99
+ agent: "artisan",
110
100
  task: "Fix the cache invalidation bug in src/cache, add regression tests, run the checks.",
111
101
  });
112
102
 
113
- // Parallel: as many genuinely independent units as the work has
103
+ // Parallel only when each scope independently justifies a child
114
104
  subagent({
115
105
  tasks: [
116
- { agent: "explorer", task: "Trace model fallback from dispatch to completion." },
117
- { agent: "executor", task: "Add edge-case tests for config migration." },
118
- // Optional per-call reasoning strength for a task that needs less of it
119
- { agent: "executor", task: "Run the suite and report failures.", thinking: "low" },
106
+ { agent: "scout", task: "Map model fallback across src/rpc-run.ts and src/spawn.ts." },
107
+ { agent: "artisan", task: "Fix config validation in src/config.ts and its tests." },
120
108
  ],
121
109
  });
122
110
  ```
@@ -127,21 +115,25 @@ paces execution instead, running a pool of child processes that scales with the
127
115
  machine (half its cores, bounded to 4–16) and starting queued runs automatically
128
116
  as slots free.
129
117
 
118
+ An active run leases its normalized task and resolved working directory across
119
+ agent names. Dispatching the same pair again is rejected and names the existing
120
+ run id; it does not use fuzzy matching, and resuming that thread remains allowed.
121
+
130
122
  Because queueing is pacing rather than refusal, it is always reported as such.
131
123
  Dispatch confirmations name each waiting run's real reason — waiting for a free
132
124
  process slot, serialized behind the shared-checkout write lane, or already
133
125
  starting its child — alongside the slot capacity. A run that waits for the write
134
126
  lane releases its slot first, so serialized writers never starve new dispatches.
135
127
 
136
- One child owns one coherent deliverable and its files. Dependent work starts only
137
- after its prerequisite delivers. Verification belongs to whoever did the work:
138
- every child runs the checks it can and reports exactly which ones ran, and the
139
- main agent inspects the actual changes before calling anything done.
128
+ One child owns one coherent phase. Dependent work starts only after its
129
+ prerequisite delivers. Artisan owns the affected tests, docs, comments, targeted
130
+ checks, and local cleanup for its implementation. Scout stays read-only. Main
131
+ inspects the integrated diff and runs the final gate.
140
132
 
141
133
  ## Parallel edits
142
134
 
143
- - Single tasks use your checkout. Every parallel write-capable agent (`executor`
144
- and custom writers) defaults to a detached Git worktree, so
135
+ - Single tasks use your checkout. Every parallel write-capable agent (`artisan`,
136
+ `steward`, and custom writers) defaults to a detached Git worktree, so
145
137
  parallel writers run at the same time. Worktree mode needs a committed `HEAD`,
146
138
  and read-only agents reject it.
147
139
  - A role file can pin its own default with `isolation: worktree` or
@@ -158,7 +150,7 @@ main agent inspects the actual changes before calling anything done.
158
150
  one repository lane, so two of them never race. A run waiting there is reported
159
151
  as a lane wait, not as slot queueing, and its process slot is already released.
160
152
  - Setup and integration failures keep the useful patch and worktree, and record
161
- where they are in `~/.pi/agent/pi-subagents-recovery.json`. Every later session
153
+ where they are in `~/.pi/agent/ferris-pi-subagents/pi-subagents-recovery.json`.
162
154
  start repeats that notice until you remove the artifacts. When the changes had
163
155
  already been applied and only the cleanup failed, the next session start
164
156
  removes the retained copy itself and clears the notice.
@@ -176,25 +168,27 @@ Every dispatch returns a stable `#id`, which is the handle for the thread tools:
176
168
  subagent_control({ action: "resume", id: 7, objective: "Finish the tests." });
177
169
  ```
178
170
 
179
- There is deliberately no status, polling, or wait tool. Every result delivers
180
- itself as a completion that wakes the main model, so a turn never blocks on a
181
- running subagent keep working or end the turn, and the completion continues
182
- it. The one in-turn block is `wait: true` on a dispatch, which holds that call
183
- until the runs it started settle: the escape hatch for one-shot `pi -p`
184
- parents, which exit at end of turn and would otherwise never see them. That
185
- wait runs on no timer and no timeout the model picks: it resolves the instant
186
- its run settles, a parked run answers immediately with its resume handle, and
187
- aborting the turn is the escape hatch. Control operations are all bounded, so
188
- they never hang on a generation that is still settling.
171
+ There is no status, polling, or separate wait tool. A background dispatch returns
172
+ a launch receipt, then its completion is delivered as a follow-up that wakes the
173
+ main model. `wait: true` instead holds that tool call until its new runs settle,
174
+ which is useful for one-shot `pi -p` sessions. It claims the delivery route before
175
+ launch, so the same result cannot also arrive as a background completion; if the
176
+ parent turn is aborted, delivery falls back to the completion path.
177
+
178
+ The wait has no timer chosen by the model: it resolves when its run settles, and
179
+ a parked run returns its resume handle. Control operations are bounded so they do
180
+ not hang on a generation that is still settling.
189
181
 
190
182
  A thread stays durable while its work is unfinished. Parked sessions, worktree
191
- checkpoints, and result excerpts are recorded in a manifest beside your config, so
192
- a pi reload, restart, or crash interrupts a run into a resumable checkpoint
193
- instead of losing it, and an isolated thread resumes in the worktree it was
194
- already working in. Restore happens at load, and everything that answers for a run
195
- waits for it `subagent_control`, `subagent_stop`, and a new dispatch before it
196
- takes an id so the first call after a reload can never report parked work as
197
- missing or hand its id to something else.
183
+ checkpoints, and result excerpts are recorded under the per-project storage root,
184
+ so reload, restart, or crash produces a resumable checkpoint. An isolated thread
185
+ continues in its original worktree.
186
+
187
+ Restore runs at session start. `subagent_control`, `subagent_stop`, prompt
188
+ injection, and new dispatches wait for it, so a parked id cannot be reported
189
+ missing or reused. If a recorded worktree is gone, the run is surfaced as failed
190
+ and non-resumable while its retained session and recovery record remain available
191
+ for inspection or destructive stop.
198
192
 
199
193
  Only interrupted work needs a record, so a thread that completes or fails cleanly
200
194
  drops its own. That also means a reload keeps interrupted threads resumable, while
@@ -213,12 +207,12 @@ two lines: what it is — agent, task, token flow, cost, provider/model, elapsed
213
207
  and, dim under the label column, what it is doing right now:
214
208
 
215
209
  ```text
216
- ● #12 executor src/cache.ts · worktree:a91f3c · ↑5.2k ↓41.0k R210.0k W6.1k $1.9400 · 12m06s
210
+ ● #12 artisan src/cache.ts · worktree:a91f3c · ↑5.2k ↓41.0k R210.0k W6.1k $1.9400 · 12m06s
217
211
  ↳ edit src/auth.ts
218
- ● #15 explorer src/models.ts · ↑1.2k ↓8.4k R31.0k W1.1k $0.0900 · openai/gpt-5-mini · 3m07s
212
+ ● #15 scout src/models.ts · ↑1.2k ↓8.4k R31.0k W1.1k $0.0900 · openai/gpt-5-mini · 3m07s
219
213
  ↳ grep fallback
220
- ○ #23 executor src/config.ts · repo lane
221
- ○ #24 executor ↻ tests/config.test.ts · queued · 5m02s
214
+ ○ #23 artisan src/config.ts · repo lane
215
+ ○ #24 artisan ↻ tests/config.test.ts · queued · 5m02s
222
216
  ```
223
217
 
224
218
  Telemetry drops leftmost-first when a row runs out of width (badge, wait
@@ -270,43 +264,37 @@ is missing, rate-limited, or fails at the provider level, the **same retained
270
264
  session** continues on the main model, so finished searches, reads, and edits
271
265
  survive. Ordinary task failures do not trigger a handoff.
272
266
 
273
- Thinking defaults to **Auto**: the role's own preference, clamped to what the
274
- effective model supports. `/subagents-setup` → _Configure an agent_ also offers a
275
- manual strength, listing only the levels that model supports. A dispatch can also
276
- ask for a strength per call with `thinking`, so a quick check and a deep refactor
277
- do not have to share one static level. Precedence: your manual
278
- `/subagents-setup` choice > the per-call `thinking` > the role's frontmatter >
279
- the default, and the winner is still clamped to the effective model. There is no separate
280
- vision mode — assign a multimodal model and name the image paths in the task.
281
-
282
- Every dispatch, resume, retry, and fallback snapshots the parent's
283
- currently active tools. A role with no explicit list inherits the full set. An
284
- explicit list keeps its pi built-in boundary and gains active extension tools,
285
- while its shell slot follows the parent: a role file naming `bash` runs
286
- `powershell` when that is the shell you enabled. When you run both, the child gets
287
- the one that fits the host PowerShell on Windows, Bash elsewhere — rather than
288
- two terminals to choose between. A child never receives a shell you disabled,
289
- since pi's `--tools` allowlist overrides its own `defaultTools`. Read-only roles
290
- never gain `edit` or `write`, and all `subagent*` tools are stripped so children
291
- stay leaves. An empty snapshot starts the child with `--no-tools`.
292
-
293
- Shell guidance in the shipped roles is portable for the same reason: they reach
294
- for pi's own `read`/`grep`/`find`/`ls` tools, which behave identically everywhere,
295
- and keep shell examples to `git` queries instead of POSIX binaries a PowerShell
296
- child cannot run.
267
+ Thinking is a **role default** scout `low`, artisan `high`, steward
268
+ `medium` — clamped to what the effective model supports. `/subagents-setup` →
269
+ _Configure an agent_ lists only the levels that model supports, with the role
270
+ default marked. There is no Auto choice, no per-dispatch `thinking` flag, and
271
+ no `thinking` field in agent Markdown. Precedence: your setup override > the
272
+ role default, then the model clamp. There is no separate vision mode — assign
273
+ a multimodal model and name the image paths in the task.
274
+
275
+ Every dispatch, resume, retry, and fallback snapshots the parent's active tools,
276
+ and all `subagent*` tools are removed so children remain leaves. A role without
277
+ an explicit list inherits that snapshot; an explicit list is a strict
278
+ intersection, so active extension tools are available only when named. A declared
279
+ shell slot follows the parent's active shell on non-scout roles.
280
+
281
+ `scout` is a hard read-only boundary even when a project override omits or
282
+ overstates its tool list. The shipped scout uses only `read`, `grep`, `find`, and
283
+ `ls`; it receives no shell or unknown custom tool. Unknown tools declared by other
284
+ roles are conservatively treated as write-capable when isolation is chosen. An
285
+ empty resolved snapshot starts the child with `--no-tools`.
297
286
 
298
287
  ## Configuration
299
288
 
300
- `/subagents-setup` stays one level deep: enabled agents, plus a model and thinking
301
- strength per agent. Everything else is config-file only, stored at
289
+ `/subagents-setup` enables or disables roles and configures a model plus optional
290
+ thinking override for each enabled role. The same settings live in
302
291
  `~/.pi/agent/pi-subagents.json` (following `PI_CODING_AGENT_DIR`):
303
292
 
304
293
  ```json
305
294
  {
306
- "enabledAgents": ["explorer", "executor"],
307
- "knownAgents": ["explorer", "executor"],
308
- "agentModels": { "explorer": "anthropic/claude-haiku-4-5" },
309
- "agentThinkingLevels": { "executor": "high" },
295
+ "enabledAgents": ["scout", "artisan", "steward"],
296
+ "agentModels": { "scout": "anthropic/claude-haiku-4-5" },
297
+ "agentThinkingLevels": { "artisan": "high" },
310
298
  "maxResultLines": 40,
311
299
  "agentScope": "user",
312
300
  "idleTimeoutSec": 90
@@ -316,31 +304,20 @@ strength per agent. Everything else is config-file only, stored at
316
304
  | Field | Meaning |
317
305
  | --------------------- | --------------------------------------------------------------------------------- |
318
306
  | `enabledAgents` | Agents available for discovery and delegation. `[]` disables all. |
319
- | `knownAgents` | Built-ins this config has seen; automatic bookkeeping — never edit it. |
320
307
  | `agentModels` | Optional `provider/model-id` per agent; missing = current main model. |
321
- | `agentThinkingLevels` | Optional manual level per agent; missing = Auto. |
308
+ | `agentThinkingLevels` | Optional setup override per agent; missing = the role default. |
322
309
  | `maxResultLines` | Lines kept in a completion message before the artifact takes over. Default `40`. |
323
310
  | `agentScope` | Discover `user`, `project`, or `both` agent directories. Default `user`. |
324
311
  | `idleTimeoutSec` | Seconds without child RPC output before termination; `0` disables. Default `90`. |
325
312
 
326
- The delegation directive is always injected; there is no toggle. Invalid values
327
- fall back safely, and stale keys including the former `proactiveInjection`,
328
- `maxConcurrency`, `maxFixRounds`, and `notifyOnReviewPass` knobs are dropped
329
- automatically. Built-in roles a newer package no longer ships (such as the
330
- retired `worker`/`cleaner`/`documenter`/`synthesizer`/`reviewer` set) are pruned
331
- from `enabledAgents`, `knownAgents`, and the model/thinking tables at first
332
- load, so the setup wizard never mixes old and new roles; custom agents are
333
- untouched. At session
334
- start, model overrides pi no longer reports are removed with a one-time notice. If
335
- pi's own session compaction fails mid-thread, a notice surfaces the error and the
336
- automatic retry instead of failing quietly.
337
-
338
- Agents shipped by a newer package version turn themselves on at the next
339
- session: a built-in the config has never seen is adopted into `enabledAgents`
340
- and follows explorer's configured model and thinking level — the fast lane
341
- these light roles need — while an agent you disabled stays disabled
342
- (`knownAgents` is what tells the two cases apart). Enabling a role in
343
- `/subagents-setup` adopts the same explorer route.
313
+ When at least one role is enabled, the cost-aware delegation directive is injected
314
+ automatically. `enabledAgents` is authoritative: the extension neither re-enables
315
+ a disabled role nor adopts or renames roles. Invalid known fields fall back safely,
316
+ and unknown fields are dropped when the canonical config is persisted.
317
+
318
+ At session start, model overrides that pi no longer reports are removed with a
319
+ one-time notice. If pi's own session compaction fails mid-thread, a notice surfaces
320
+ the error and automatic retry instead of failing quietly.
344
321
 
345
322
  ## Custom agents
346
323
 
@@ -352,21 +329,20 @@ Built-ins ship with the package. Add or replace them with Markdown files:
352
329
 
353
330
  ```yaml
354
331
  ---
355
- name: explorer
332
+ name: scout
356
333
  description: Fast read-only codebase reconnaissance
357
- thinking: low
358
334
  isolation: shared
359
- tools: read, bash
335
+ tools: read, grep, find, ls
360
336
  ---
361
337
  …additional system prompt…
362
338
  ```
363
339
 
364
- `description` is the routing line the main model reads, and `thinking` is the
365
- role's Auto preference, which a wizard choice overrides. `isolation` pins the
340
+ `description` is the routing line the main model reads. `isolation` pins the
366
341
  role's default boundary as described under [Parallel edits](#parallel-edits).
367
342
  Models come only from `/subagents-setup`; an agent file cannot pin one. An
368
- explicit `tools` list is the capability boundary, and omitting it inherits the
369
- parent's complete active set.
343
+ explicit `tools` list is intersected with the parent's active set; omitting it
344
+ inherits the active set. A role named `scout` is always reduced to the fixed
345
+ read-only tool set described above.
370
346
 
371
347
  ## Storage and cleanup
372
348
 
@@ -377,15 +353,15 @@ that removes it, so this directory does not grow without bound:
377
353
  | Path | Holds | Removed |
378
354
  | ------------------------------------------ | ---------------------------------------------------- | ---------------------------------------------------------------- |
379
355
  | `pi-subagents.json` | Your configuration | Never — it is yours |
380
- | `pi-subagents-recovery.json` | Worktree integration and cleanup failures | When the retained patch or worktree it points at is gone |
356
+ | `ferris-pi-subagents/pi-subagents-recovery.json` | Worktree integration and cleanup failures | When the retained patch or worktree it points at is gone |
381
357
  | `ferris-pi-subagents/<project>/pi-subagents-threads.json` | One record per interrupted thread | When the thread settles, or after 30 days |
382
- | `ferris-pi-subagents/<project>/sessions/` | Retained child sessions that a resume continues from | When the pi session that produced it ends, or its owner is gone |
383
- | `ferris-pi-subagents/<project>/worktrees/` | Isolated checkouts for parallel writers | On integration, or when its owning process is gone |
358
+ | `ferris-pi-subagents/<project>/sessions/` | Retained child sessions that a resume continues from | When the thread settles or its retained record is removed |
359
+ | `ferris-pi-subagents/<project>/worktrees/` | Isolated checkouts for parallel writers | On integration, or when no retained record claims them |
384
360
  | `ferris-pi-subagents/<project>/results/` | Full text of truncated results | After 7 days, or beyond 50 per project |
385
361
  | `ferris-pi-subagents/<project>/tmp/` | Child prompt copies and the no-retry policy shim | When its owning process exits |
386
362
  | `ferris-pi-subagents/<project>/` | All of the above for one checkout | When the whole directory has been idle for 3 days |
387
363
 
388
- Cleanup runs at extension load and is deliberately conservative. A directory goes
364
+ Cleanup runs at session start and is deliberately conservative. A directory goes
389
365
  away only when the process that created it is gone and no manifest record still
390
366
  claims it, so a live sibling pi instance never loses state and parked work
391
367
  outlives its own process by design — a reference from the threads manifest always
@@ -398,30 +374,18 @@ npm install
398
374
  npm run check
399
375
  ```
400
376
 
401
- There are no bundled runtime dependencies; pi and TypeBox are peers. The source is
377
+ `npm run check` is `tsc --noEmit` plus the unit tests (`npm test`). There are
378
+ no bundled runtime dependencies; pi and TypeBox are peers. The source is
402
379
  split by responsibility: dispatch policy, thread lifecycle, RPC
403
380
  transport, worktree integration, completion delivery, tools, and TUI status.
404
381
 
405
382
  ## Changelog
406
383
 
407
- The 4.2 line lives in [CHANGELOG.md](./CHANGELOG.md). Latest published
408
- version is **4.2.13**.
409
-
410
- | Version | What changed |
411
- | ------- | ------------ |
412
- | 4.2.13 | README navigation, What's new, and this changelog. |
413
- | 4.2.12 | Confirm-before-fix; honest footer counts; `main` publishes npm + GitHub Release. |
414
- | 4.2.8 | Footer roll-up; wait-path token usage; hold completions across compaction. |
415
- | 4.2.7 | Sharper executor routing; per-dispatch `thinking`. |
416
- | 4.2.5 | Per-project threads manifest. |
417
- | 4.2.4 | One-line explorer findings; recovery cleanup retry. |
418
- | 4.2.2 | Single-artifact reads stay inline. |
419
- | 4.2.1 | Prune retired roles from upgraded configs. |
420
- | 4.2.0 | Team is `explorer` + `executor`; two-line live widget. |
384
+ See [CHANGELOG.md](./CHANGELOG.md) for published release notes.
421
385
 
422
386
  ## Release
423
387
 
424
- Merging to `main` publishes `@ferris1225/pi-subagents` when `package.json`
388
+ Pushing to `main` publishes `@ferris1225/pi-subagents` when `package.json`
425
389
  carries a version npm does not have yet, then opens a matching GitHub Release.
426
390
  Do not `npm publish` from a laptop. The workflow is
427
391
  `.github/workflows/publish.yml` (npm trusted publisher or `NPM_TOKEN`).
@@ -0,0 +1,19 @@
1
+ ---
2
+ name: artisan
3
+ description: Owns a substantial implementation scope, including directly affected tests, docs, comments, and verification.
4
+ ---
5
+
6
+ You own one implementation phase. The task brief is your only context.
7
+
8
+ ## Rules
9
+
10
+ - Inspect current code and confirm the defect before editing; a disproved issue means zero edits.
11
+ - Make the smallest coherent root-cause change. Preserve unrelated work and existing conventions; avoid speculative abstractions and unrelated cleanup.
12
+ - Own code refactors, directly affected tests, README/docs, comments, and local diff hygiene. Remove debug output, dead code, stale comments, and other debris introduced in your scope.
13
+ - Leave standalone docs and cross-cutting pre-commit cleanup for a completed broad or multi-writer change to `steward`.
14
+ - Run the smallest targeted check, then relevant project gates. Report unrun or pre-existing failures exactly; never imply a check passed when it did not run.
15
+ - You are a leaf: do not dispatch agents, bump versions, commit, push, publish, tag, or release.
16
+
17
+ ## Output
18
+
19
+ Return only the outcome, changed paths, checks run, and material blockers. No task restatement, plan, investigation narrative, or tool chronology.
@@ -0,0 +1,18 @@
1
+ ---
2
+ name: scout
3
+ description: Read-only reconnaissance for broad or unfamiliar code; returns compact, decisive citations.
4
+ tools: read, grep, find, ls
5
+ ---
6
+
7
+ You own one broad reconnaissance phase. Atomic lookups and known locations stay with main. The task brief is your only context.
8
+
9
+ ## Rules
10
+
11
+ - Stay read-only: never create, edit, delete, install, build, or run commands. Use `read`/`grep`/`find`/`ls` only.
12
+ - Findings are retrieval leads, not proof for deletion, security, compatibility, or persistence decisions. Cite decisive lines so main can plan without repeating the search; a later actor rechecks only source needed for its own decision or edit.
13
+ - Search broadly once, then read key sections and follow relevant imports, callers, tests, and types. Cluster related questions instead of running a series of small searches.
14
+ - Read requested images when relevant. State real gaps instead of guessing.
15
+
16
+ ## Output
17
+
18
+ Return at most 15 evidence bullets as ``- `path:line-range` — fact``. Add `Start here:` or `Gaps:` only when useful. No preamble, task restatement, file inventory, chronology, or nonessential code excerpts.
@@ -0,0 +1,19 @@
1
+ ---
2
+ name: steward
3
+ description: Pre-commit cleanup and cross-cutting docs/comment sync for a completed broad or multi-writer change.
4
+ ---
5
+
6
+ You own one final hygiene phase after primary writing has finished. The task brief is your only context.
7
+
8
+ ## Rules
9
+
10
+ - Require a named completed scope such as an uncommitted diff, Git range, or directory. Stop if primary writing is still active.
11
+ - Start from that diff; never repeat implementation or reconnaissance. For a deletion candidate, read only load-bearing lines and search consumers before removing it. Keep uncertain dynamic behavior, public APIs, persisted formats, and compatibility outside the brief.
12
+ - Remove dead code, duplication, debug residue, stale comments, and needless complexity without changing product behavior.
13
+ - Synchronize cross-cutting comments, README, examples, and user docs. Code-local comments and directly affected docs belong to the artisan; do not rewrite them merely for style.
14
+ - Report behavior changes, fixes, refactors, or missing tests for an artisan instead of performing them.
15
+ - Run relevant checks and report failures exactly. You are a leaf: do not dispatch agents, bump versions, commit, push, publish, tag, or release.
16
+
17
+ ## Output
18
+
19
+ Return only cleaned or synchronized paths, checks run, kept candidates needing a decision, and material blockers. No task restatement, investigation narrative, or tool chronology.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ferris1225/pi-subagents",
3
- "version": "4.2.13",
4
- "description": "A managed sub-agent team for pi: explorer and executor roles, durable threads, model fallback, and Git worktree isolation.",
3
+ "version": "4.3.1",
4
+ "description": "A managed sub-agent team for pi: scout, artisan, and steward roles, durable threads, model fallback, and Git worktree isolation.",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -37,7 +37,8 @@
37
37
  ]
38
38
  },
39
39
  "scripts": {
40
- "check": "tsc --noEmit",
40
+ "check": "tsc --noEmit && npm test",
41
+ "test": "node --experimental-transform-types --test test/*.test.ts",
41
42
  "prepack": "npm run check"
42
43
  },
43
44
  "peerDependencies": {