pi-subagents 0.29.0 → 0.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +43 -0
- package/README.md +125 -19
- package/agents/context-builder.md +3 -3
- package/agents/planner.md +1 -1
- package/agents/researcher.md +1 -1
- package/agents/scout.md +1 -1
- package/package.json +7 -7
- package/skills/pi-subagents/SKILL.md +30 -0
- package/src/agents/agent-management.ts +189 -8
- package/src/agents/agent-serializer.ts +35 -12
- package/src/agents/agents.ts +243 -24
- package/src/agents/frontmatter.ts +66 -2
- package/src/agents/proactive-skills.ts +191 -0
- package/src/agents/skills.ts +117 -20
- package/src/extension/doctor.ts +20 -0
- package/src/extension/fanout-child.ts +2 -1
- package/src/extension/index.ts +50 -5
- package/src/extension/schemas.ts +40 -79
- package/src/intercom/intercom-bridge.ts +2 -3
- package/src/runs/background/async-execution.ts +180 -67
- package/src/runs/background/async-job-tracker.ts +56 -11
- package/src/runs/background/async-resume.ts +53 -5
- package/src/runs/background/async-status.ts +4 -1
- package/src/runs/background/chain-append.ts +282 -0
- package/src/runs/background/chain-root-attachment.ts +161 -0
- package/src/runs/background/result-watcher.ts +11 -2
- package/src/runs/background/run-status.ts +1 -0
- package/src/runs/background/stale-run-reconciler.ts +9 -4
- package/src/runs/background/subagent-runner.ts +158 -11
- package/src/runs/foreground/chain-execution.ts +26 -2
- package/src/runs/foreground/execution.ts +114 -8
- package/src/runs/foreground/subagent-executor.ts +611 -87
- package/src/runs/shared/acceptance.ts +285 -34
- package/src/runs/shared/chain-outputs.ts +23 -8
- package/src/runs/shared/completion-guard.ts +1 -1
- package/src/runs/shared/dynamic-fanout.ts +5 -3
- package/src/runs/shared/mcp-direct-tool-allowlist.ts +2 -2
- package/src/runs/shared/parallel-utils.ts +13 -1
- package/src/runs/shared/pi-args.ts +12 -3
- package/src/runs/shared/single-output.ts +15 -1
- package/src/runs/shared/subagent-control.ts +8 -11
- package/src/shared/settings.ts +1 -0
- package/src/shared/types.ts +17 -2
- package/src/shared/utils.ts +19 -1
- package/src/slash/prompt-template-bridge.ts +26 -3
- package/src/slash/slash-bridge.ts +3 -1
- package/src/slash/slash-commands.ts +34 -4
- package/src/tui/render.ts +265 -13
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,49 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.31.0] - 2026-06-24
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- Added `subagents.disableThinking` so bundled builtin agents can drop thinking suffix defaults for providers that do not accept them. Thanks to Joshua Harding (@jhstatewide) for #212.
|
|
9
|
+
- Discover nested grouped skills such as `.pi/skills/group/name/SKILL.md` so subagents match the host runtime's recursive skill lookup. Thanks to Weaxs (@Weaxs) for #262.
|
|
10
|
+
- Follow Pi's configured project config directory for project-local agents, chains, skills, packages, settings, direct MCP config, and intercom package discovery instead of hardcoding `.pi`, while retaining `.pi` as the fallback for older Pi versions.
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
- Hardened npm installs by tracking `package-lock.json`, pinning direct dependencies, and using `npm ci --ignore-scripts` in CI and release workflows. Thanks to Modestas Vainius (@modax) for #234.
|
|
14
|
+
- List configured subagent skills by name, description, and file path instead of inlining full skill bodies, and ensure tool-restricted children can read those skill files on demand. Thanks to Ruben Paz (@Istar-Eldritch) for #183.
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
- Resolve the async result watcher directory with `fs.realpathSync.native()` before `fs.watch()` so Windows profiles with 8.3 temp paths do not crash Pi when async subagent results arrive. Thanks to kerushidao (@kerushidao) for #254.
|
|
18
|
+
- Accept structured acceptance reports emitted in JSON-family fences when the fenced body has the acceptance-report shape. Thanks to Suleiman Tawil (@stawils) for #253.
|
|
19
|
+
- Report field-level acceptance-report validation errors instead of a generic parse failure, and clarify array element types in the acceptance prompt. Thanks to Whisperfall (@Whisperfall) for #264 and josephkEA (@josephkEA) for the follow-up reproduction.
|
|
20
|
+
- Simplified the public `acceptance` and chain tool schemas so Kimi/Moonshot-style parsers can load `subagent`, while runtime validation still rejects malformed acceptance config and dynamic fanout steps. Thanks to Sergio Agosti (@sergio-agosti) for #249.
|
|
21
|
+
- Reject duplicate concurrent `subagent` execution calls while a prior subagent dispatch is still in progress, keeping intentional parallel mode within a single call unchanged. Thanks to desideratum (@desideratum) for #247.
|
|
22
|
+
- Bound async `events.jsonl` growth by dropping noisy child `message_update` snapshots, capping persisted child diagnostics, and scanning control events in chunks during status polling. Thanks to Tri Van Pham (@pvtri96) for #246.
|
|
23
|
+
- Keep crowded async subagent widgets at a stable collapsed height in short terminals, reducing destructive full-screen TUI redraws and flicker. Thanks to ssyram (@ssyram) for #186.
|
|
24
|
+
- Actually wire the previously documented foreground-only `timeoutMs`/`maxRuntimeMs` aliases through single, parallel, chain, and dynamic fanout runs, including stable `timedOut: true` results, preserved partial output, manual-interrupt precedence, and skipped acceptance verification after timeout.
|
|
25
|
+
- Apply `subagents.agentOverrides.<name>` to matching user-scope and project-scope custom agents, while keeping explicit agent frontmatter authoritative per field. Thanks to Jacek Juraszek (@jjuraszek) for #218.
|
|
26
|
+
- Preserve compact foreground `write`/`edit` tool-call evidence in prompt-template delegation responses so convergence checks do not stop loops early. Thanks to Hans Schnedlitz (@hschne) for #207.
|
|
27
|
+
- Respect each agent's `defaultContext` in mixed parallel and chain subagent calls when no explicit `context` is provided, so fresh-default scouts no longer inherit forked parent transcripts just because another agent in the same invocation defaults to fork. Thanks to Mitch Fultz (@fitchmultz) for #228.
|
|
28
|
+
- Make runtime `output` overrides authoritative in child task and system prompts, and remove stale static filenames from bundled output-format instructions. Thanks to youngshine (@smithyyang) for #223.
|
|
29
|
+
- Keep top-level parallel `defaultProgress` files in run-scoped artifact storage instead of the parent working directory. Thanks to youngshine (@smithyyang) for #224.
|
|
30
|
+
|
|
31
|
+
## [0.30.0] - 2026-06-20
|
|
32
|
+
|
|
33
|
+
### Added
|
|
34
|
+
- Allow active async chains to accept an `append-step` request that adds one new tail step while the chain is still running.
|
|
35
|
+
- Allow async subagent results to be attached as the root step of a new follow-up chain.
|
|
36
|
+
- Added `subagentOnlyExtensions` so agents can pass selected tool extensions only to spawned subagents without exposing them to the parent agent.
|
|
37
|
+
- Added proactive skill-subagent suggestions to `subagent({ action: "list" })` based on repeatedly configured skill use, while keeping the behavior advisory and opt-out friendly.
|
|
38
|
+
- Added regression coverage for long worker/reviewer chains and parallel -> funnel -> fanout chain flows across foreground and async execution.
|
|
39
|
+
|
|
40
|
+
### Fixed
|
|
41
|
+
- Interrupt live async children before delivering `resume` follow-up messages so intercom nudges reach workers that are stuck mid-turn more reliably.
|
|
42
|
+
- Reject appended chain steps with duplicate reserved output names or unknown named-output references before they are queued.
|
|
43
|
+
- Ignore legacy `.agents/skills` files during agent discovery so skill definitions are not registered as subagents. Thanks to chyax98 (@chyax98) for #257.
|
|
44
|
+
- Launch detached async runners through Node when Pi itself is not the Node executable. Thanks to Tetsuya.dev (@tetsuya-dev-jp) for #273.
|
|
45
|
+
- Preserve the slash command requester context when bridge requests launch subagents. Thanks to Victor Sumner (@vsumner) for #268.
|
|
46
|
+
- Trim repeated nested `subagent` tool schema descriptions so provider payloads stay compact while retaining top-level parameter guidance. Thanks to Thomas Mustier (@tmustier) for #250.
|
|
47
|
+
|
|
5
48
|
## [0.29.0] - 2026-06-19
|
|
6
49
|
|
|
7
50
|
### Added
|
package/README.md
CHANGED
|
@@ -115,7 +115,7 @@ The extension ships with builtin agents you can use immediately.
|
|
|
115
115
|
|
|
116
116
|
A simple rule of thumb: use `scout` before you understand the code, `researcher` before you trust external facts, `planner` before a bigger change, `worker` to implement, `reviewer` to check, and `oracle` when the decision itself feels risky.
|
|
117
117
|
|
|
118
|
-
## Changing
|
|
118
|
+
## Changing an agent's model
|
|
119
119
|
|
|
120
120
|
Builtin agents inherit your current Pi default model by default. This keeps new installs from depending on a provider you may not have configured. If you want a role to use a specific model, set an override instead of copying the bundled agent file.
|
|
121
121
|
|
|
@@ -141,7 +141,18 @@ For a persistent override, edit settings. This example pins the reviewer everywh
|
|
|
141
141
|
}
|
|
142
142
|
```
|
|
143
143
|
|
|
144
|
-
Use `~/.pi/agent/settings.json` for a user override or `.pi/settings.json` for a project override. The same `agentOverrides` block can change `tools`, `skills`, inherited context, prompt text, or disable a builtin.
|
|
144
|
+
Use `~/.pi/agent/settings.json` for a user override or the project config settings file (`.pi/settings.json` in standard Pi) for a project override. The same `agentOverrides` block can change `tools`, `skills`, inherited context, prompt text, or disable a builtin. Matching user and project agents also receive override fields that their frontmatter leaves unset, so a shared project config agent can keep the persona while local settings choose the model. Explicit frontmatter still wins.
|
|
145
|
+
|
|
146
|
+
If your provider rejects model IDs with thinking suffixes, set `subagents.disableThinking: true` in user or project settings. That clears bundled builtin thinking defaults in one place; an explicit higher-precedence `agentOverrides.<name>.thinking` value can opt a role back in.
|
|
147
|
+
|
|
148
|
+
To inspect what `pi-subagents` has actually loaded right now, use:
|
|
149
|
+
|
|
150
|
+
```text
|
|
151
|
+
/subagents-models
|
|
152
|
+
/subagents-models reviewer
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
That reports the live runtime mapping, which can differ from settings on disk until you reload Pi.
|
|
145
156
|
|
|
146
157
|
## Where running subagents show up
|
|
147
158
|
|
|
@@ -237,6 +248,79 @@ For normal use, you do not need to configure anything. Advanced users can tune t
|
|
|
237
248
|
|
|
238
249
|
At this point, you know enough to use the plugin. The rest of this README is reference material for exact command syntax, custom agents, saved chains, worktrees, and configuration.
|
|
239
250
|
|
|
251
|
+
## Optional pi-permission-system integration
|
|
252
|
+
|
|
253
|
+
[`@gotgenes/pi-permission-system`](https://github.com/gotgenes/pi-packages/tree/main/packages/pi-permission-system)
|
|
254
|
+
adds a second policy layer — `allow` / `ask` / `deny` — on top of
|
|
255
|
+
pi-subagents' visibility-based tool restrictions.
|
|
256
|
+
|
|
257
|
+
The two compose independently:
|
|
258
|
+
|
|
259
|
+
| Layer | What it controls | Who provides it |
|
|
260
|
+
|-------|-----------------|-----------------|
|
|
261
|
+
| Visibility | Which tools are registered before the session starts | pi-subagents (`tools:` frontmatter key) |
|
|
262
|
+
| Policy | Runtime allow/ask/deny decisions on every tool call, bash command, MCP operation | pi-permission-system (`permission:` frontmatter key) |
|
|
263
|
+
|
|
264
|
+
### Installing
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
pi install npm:@gotgenes/pi-permission-system
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
No configuration is required for the integration — it is automatic when both
|
|
271
|
+
extensions are installed. pi-subagents passes the parent session identity
|
|
272
|
+
to child processes via the `PI_SUBAGENT_PARENT_SESSION` environment variable,
|
|
273
|
+
which the permission system uses to forward `ask` prompts from headless
|
|
274
|
+
subagent processes back to the parent session's UI.
|
|
275
|
+
|
|
276
|
+
### Per-agent permission frontmatter
|
|
277
|
+
|
|
278
|
+
Agent files can include a `permission:` block alongside the standard `tools:`
|
|
279
|
+
key. The permission system reads it independently:
|
|
280
|
+
|
|
281
|
+
```yaml
|
|
282
|
+
---
|
|
283
|
+
name: worker
|
|
284
|
+
tools: bash,read,write,edit
|
|
285
|
+
permission:
|
|
286
|
+
"*": ask
|
|
287
|
+
read: allow
|
|
288
|
+
bash:
|
|
289
|
+
"*": ask
|
|
290
|
+
"git *": allow
|
|
291
|
+
"npm test": allow
|
|
292
|
+
---
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
In this example the subagent extension restricts visibility to four tools,
|
|
296
|
+
and the permission system then applies `ask`/`allow` policy within that
|
|
297
|
+
visible set. Both keys coexist without collision.
|
|
298
|
+
|
|
299
|
+
### Checking the integration
|
|
300
|
+
|
|
301
|
+
Run `/subagents-doctor` to check the permission system status.
|
|
302
|
+
If `ask` prompts from children are not reaching the parent UI, verify both
|
|
303
|
+
extensions are installed:
|
|
304
|
+
|
|
305
|
+
```bash
|
|
306
|
+
pi list
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
### How it works
|
|
310
|
+
|
|
311
|
+
At session start, the interactive (root) session records its own identity in
|
|
312
|
+
`PI_SUBAGENT_PARENT_SESSION`. When pi-subagents launches a child, it passes the
|
|
313
|
+
launching session's identity to that child explicitly, falling back to the
|
|
314
|
+
inherited environment variable. When the permission system inside a child
|
|
315
|
+
encounters an `ask` permission, it reads this variable to locate the parent
|
|
316
|
+
session and forwards the confirmation request there.
|
|
317
|
+
|
|
318
|
+
This resolves an interactive prompt only when the parent it points at is the
|
|
319
|
+
interactive session — i.e. for the direct children of the root session. A
|
|
320
|
+
nested child's parent is itself a headless subagent process with no UI to
|
|
321
|
+
surface the prompt, so `ask` policies are best placed on agents that run as
|
|
322
|
+
direct children of the interactive session.
|
|
323
|
+
|
|
240
324
|
## Direct commands
|
|
241
325
|
|
|
242
326
|
Skip this section until you want exact syntax.
|
|
@@ -248,6 +332,7 @@ Skip this section until you want exact syntax.
|
|
|
248
332
|
| `/parallel agent1 "task1" -> agent2 "task2"` | Run agents in parallel |
|
|
249
333
|
| `/run-chain <chainName> -- <task>` | Launch a saved `.chain.md` or `.chain.json` workflow |
|
|
250
334
|
| `/subagents-doctor` | Show read-only setup diagnostics |
|
|
335
|
+
| `/subagents-models [agent]` | Show the runtime-loaded builtin model mapping, optionally filtered to one builtin |
|
|
251
336
|
|
|
252
337
|
Commands validate agent names locally, support tab completion, and send results back into the conversation.
|
|
253
338
|
|
|
@@ -296,7 +381,7 @@ Append `[key=value,...]` to an agent name to override defaults for that step:
|
|
|
296
381
|
| `outputMode` | `outputMode=file-only` | Return only a concise file reference for saved output instead of the full saved content. Requires `output`; default is `inline`. |
|
|
297
382
|
| `reads` | `reads=a.md+b.md` | Read files before executing. `+` separates multiple paths. |
|
|
298
383
|
| `model` | `model=anthropic/claude-sonnet-4` | Override model for this step. |
|
|
299
|
-
| `skills` | `skills=planning+review` | Override
|
|
384
|
+
| `skills` | `skills=planning+review` | Override available skills. `+` separates multiple skills. |
|
|
300
385
|
| `progress` | `progress` | Enable progress tracking. |
|
|
301
386
|
|
|
302
387
|
Set `output=false`, `reads=false`, or `skills=false` to disable that behavior explicitly. Do not use `output=false` for file-only returns; use `outputMode=file-only` with an `output` path.
|
|
@@ -360,9 +445,9 @@ Agent locations, lowest to highest priority:
|
|
|
360
445
|
| Builtin | `~/.pi/agent/extensions/subagent/agents/` |
|
|
361
446
|
| Installed package | `package.json` `pi-subagents.agents` or `pi.subagents.agents` |
|
|
362
447
|
| User | `~/.pi/agent/agents/**/*.md` |
|
|
363
|
-
| Project | `.pi/agents/**/*.md` |
|
|
448
|
+
| Project | Project config `agents/**/*.md` (`.pi/agents/**/*.md` in standard Pi) |
|
|
364
449
|
|
|
365
|
-
Project discovery also reads legacy `.agents/**/*.md` files. Nested subdirectories are discovered recursively. `.chain.md` files do not define agents. Installed Pi packages can expose agent directories from either `{"pi-subagents":{"agents":["./agents"]}}` or `{"pi":{"subagents":{"agents":["./agents"]}}}` in their package manifest. Package agents load above builtins and below user/project agents. If both `.agents/` and
|
|
450
|
+
Project discovery also reads legacy `.agents/**/*.md` files. Nested subdirectories are discovered recursively. `.chain.md` files do not define agents. Installed Pi packages can expose agent directories from either `{"pi-subagents":{"agents":["./agents"]}}` or `{"pi":{"subagents":{"agents":["./agents"]}}}` in their package manifest. Package agents load above builtins and below user/project agents. If both `.agents/` and the project config agents directory define the same parsed runtime agent name, the project config directory wins. Use `agentScope: "user" | "project" | "both"` to control discovery; `both` is the default and project definitions win runtime-name collisions.
|
|
366
451
|
|
|
367
452
|
Builtin agents load at the lowest priority, so a user or project agent with the same name overrides them. They do not pin a provider model; they inherit your current Pi default model unless you set `subagents.agentOverrides.<name>.model`. `oracle` is an advisory reviewer that critiques direction and proposes an execution prompt without editing files. `worker` is the implementation agent for normal tasks and approved oracle handoffs.
|
|
368
453
|
|
|
@@ -377,7 +462,7 @@ pi install npm:pi-web-access
|
|
|
377
462
|
You can override selected builtin fields without copying the whole agent. Overrides live in settings:
|
|
378
463
|
|
|
379
464
|
- User: `~/.pi/agent/settings.json`
|
|
380
|
-
- Project: `.pi/settings.json`
|
|
465
|
+
- Project: project config settings file (`.pi/settings.json` in standard Pi)
|
|
381
466
|
|
|
382
467
|
Example:
|
|
383
468
|
|
|
@@ -397,6 +482,8 @@ Supported override fields are `model`, `fallbackModels`, `thinking`, `systemProm
|
|
|
397
482
|
|
|
398
483
|
Set `disabled: true` to hide a builtin from runtime discovery and agent-facing `subagent({ action: "list" })` output. For bulk control, set `subagents.disableBuiltins: true` in settings.
|
|
399
484
|
|
|
485
|
+
Set `subagents.disableThinking: true` to clear bundled builtin thinking defaults globally for providers that do not support `:low`, `:medium`, `:high`, or similar model suffixes. A higher-precedence per-agent `thinking` override can opt one builtin back in.
|
|
486
|
+
|
|
400
487
|
### Prompt assembly
|
|
401
488
|
|
|
402
489
|
Subagents are designed to be narrow by default. Custom agents start with a clean system prompt and only the context you intentionally give them. They do not automatically inherit Pi’s whole base prompt, project instruction files, or discovered skills catalog.
|
|
@@ -424,6 +511,7 @@ package: code-analysis
|
|
|
424
511
|
description: Fast codebase recon
|
|
425
512
|
tools: read, grep, find, ls, bash, mcp:chrome-devtools
|
|
426
513
|
extensions:
|
|
514
|
+
subagentOnlyExtensions: ./tools/child-only-search.ts
|
|
427
515
|
model: claude-haiku-4-5
|
|
428
516
|
fallbackModels: openai/gpt-5-mini, anthropic/claude-sonnet-4
|
|
429
517
|
thinking: high
|
|
@@ -449,6 +537,7 @@ Important fields:
|
|
|
449
537
|
| `package` | Optional package identifier. A file with `name: scout` and `package: code-analysis` registers as `code-analysis.scout`; serialization keeps `name` and `package` separate. |
|
|
450
538
|
| `tools` | Builtin tool allowlist. `mcp:` entries select direct MCP tools when `pi-mcp-adapter` is installed. |
|
|
451
539
|
| `extensions` | Omitted means normal extensions; empty means no extensions; comma-separated values allowlist specific extensions. |
|
|
540
|
+
| `subagentOnlyExtensions` | Comma-separated extension paths loaded only in spawned child sessions for this agent. Tools registered there are unavailable to the main agent unless also installed through normal Pi extension configuration. |
|
|
452
541
|
| `model` | Default model. Bare ids prefer the current provider when possible, then unique registry matches. |
|
|
453
542
|
| `fallbackModels` | Ordered backup models for provider/model failures such as quota, auth, timeout, or unavailable model. Ordinary task failures do not trigger fallback. |
|
|
454
543
|
| `thinking` | Appended as a `:level` suffix at runtime unless a suffix is already present. |
|
|
@@ -456,7 +545,7 @@ Important fields:
|
|
|
456
545
|
| `inheritProjectContext` | Keeps or strips inherited project instruction blocks. |
|
|
457
546
|
| `inheritSkills` | Keeps or strips Pi’s discovered skills catalog. |
|
|
458
547
|
| `defaultContext` | Optional `fresh` or `fork` launch context default for this agent. |
|
|
459
|
-
| `skills` |
|
|
548
|
+
| `skills` | Adds specific skills to the child’s available skill list, regardless of `inheritSkills`. |
|
|
460
549
|
| `output` | Default single-agent output file. |
|
|
461
550
|
| `defaultReads` | Files to read before running in chain/parallel behavior. |
|
|
462
551
|
| `defaultProgress` | Maintain `progress.md`. |
|
|
@@ -491,6 +580,8 @@ extensions: /abs/path/to/ext-a.ts, /abs/path/to/ext-b.ts
|
|
|
491
580
|
|
|
492
581
|
When `extensions` is present, it takes precedence over extension paths implied by `tools` entries.
|
|
493
582
|
|
|
583
|
+
Use `subagentOnlyExtensions` when a custom extension tool should exist only inside child sessions. It is scoped by agent config: every run of that agent receives those extension paths, while other agents do not unless they declare the same field. The current model does not have a separate named-subagent audience inside one agent definition.
|
|
584
|
+
|
|
494
585
|
## Chain files
|
|
495
586
|
|
|
496
587
|
Chains are reusable workflows stored separately from agent files. Use `.chain.md` for simple sequential saved chains. Use `.chain.json` when a chain needs dynamic fanout.
|
|
@@ -499,7 +590,7 @@ Chains are reusable workflows stored separately from agent files. Use `.chain.md
|
|
|
499
590
|
|-------|------|
|
|
500
591
|
| Installed package | `package.json` `pi-subagents.chains` or `pi.subagents.chains` |
|
|
501
592
|
| User | `~/.pi/agent/chains/**/*.chain.md`, `~/.pi/agent/chains/**/*.chain.json` |
|
|
502
|
-
| Project |
|
|
593
|
+
| Project | Project config `chains/**/*.chain.md`, `chains/**/*.chain.json` (`.pi/chains/...` in standard Pi) |
|
|
503
594
|
|
|
504
595
|
Nested subdirectories are discovered recursively. Installed Pi packages can expose chain directories from either `{"pi-subagents":{"chains":["./chains"]}}` or `{"pi":{"subagents":{"chains":["./chains"]}}}` in their package manifest. Package chains load below user/project chains. If both `.chain.md` and `.chain.json` define the same parsed runtime chain name in the same scope, `.chain.json` wins. If user and project scopes define the same parsed runtime chain name, the project chain wins. Chains support the same optional `package` frontmatter as agents; `name: review-flow` plus `package: code-analysis` runs as `code-analysis.review-flow`.
|
|
505
596
|
|
|
@@ -601,14 +692,14 @@ Parallel outputs are aggregated with clear separators before being passed to the
|
|
|
601
692
|
|
|
602
693
|
## Skills
|
|
603
694
|
|
|
604
|
-
Skills are `SKILL.md` files
|
|
695
|
+
Skills are `SKILL.md` files made available to an agent. The prompt includes skill metadata and the file location; the agent reads the full skill file only when the task matches.
|
|
605
696
|
|
|
606
697
|
Discovery uses project-first precedence:
|
|
607
698
|
|
|
608
|
-
1. `.pi/skills/{name}/SKILL.md`
|
|
699
|
+
1. Project config `skills/{name}/SKILL.md` (`.pi/skills/{name}/SKILL.md` in standard Pi)
|
|
609
700
|
2. Project packages and project settings packages via `package.json -> pi.skills`
|
|
610
701
|
3. Current task cwd package via `package.json -> pi.skills`
|
|
611
|
-
4.
|
|
702
|
+
4. Project config `settings.json -> skills`
|
|
612
703
|
5. `~/.pi/agent/skills/{name}/SKILL.md`
|
|
613
704
|
6. User packages and user settings packages via `package.json -> pi.skills`
|
|
614
705
|
7. `~/.pi/agent/settings.json -> skills`
|
|
@@ -623,14 +714,24 @@ Use agent defaults, override them at runtime, or disable them:
|
|
|
623
714
|
|
|
624
715
|
For chains, `skill` at the top level is additive. A step-level `skill` overrides that step; `false` disables skills for that step.
|
|
625
716
|
|
|
626
|
-
|
|
717
|
+
Available skills use this shape:
|
|
627
718
|
|
|
628
719
|
```xml
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
720
|
+
The following configured skills are available to this subagent.
|
|
721
|
+
Use the read tool to load a skill's file when the task matches its description.
|
|
722
|
+
When a skill file references a relative path, resolve it against the skill directory (parent of SKILL.md / dirname of the path) and use that absolute path in tool commands.
|
|
723
|
+
|
|
724
|
+
<available_skills>
|
|
725
|
+
<skill>
|
|
726
|
+
<name>safe-bash</name>
|
|
727
|
+
<description>Run shell commands safely.</description>
|
|
728
|
+
<location>/absolute/path/to/safe-bash/SKILL.md</location>
|
|
729
|
+
</skill>
|
|
730
|
+
</available_skills>
|
|
632
731
|
```
|
|
633
732
|
|
|
733
|
+
If an agent has an explicit `tools` allowlist and resolved skills, `read` is added for that child run so the listed skill files can be loaded on demand.
|
|
734
|
+
|
|
634
735
|
Missing skills do not fail execution. The result summary shows a warning.
|
|
635
736
|
|
|
636
737
|
### Bundled skill
|
|
@@ -739,6 +840,8 @@ Agent definitions are not loaded into context by default. Management actions let
|
|
|
739
840
|
{ action: "list" }
|
|
740
841
|
{ action: "list", agentScope: "project" }
|
|
741
842
|
{ action: "get", agent: "scout" }
|
|
843
|
+
{ action: "models" }
|
|
844
|
+
{ action: "models", agent: "reviewer" }
|
|
742
845
|
{ action: "get", agent: "code-analysis.scout" }
|
|
743
846
|
{ action: "get", chainName: "review-pipeline" }
|
|
744
847
|
|
|
@@ -786,7 +889,7 @@ Agent definitions are not loaded into context by default. Management actions let
|
|
|
786
889
|
|-------|------|---------|-------------|
|
|
787
890
|
| `agent` | string | - | Agent name for single mode, or target for management actions. |
|
|
788
891
|
| `task` | string | - | Task string for single mode. |
|
|
789
|
-
| `action` | string | - | `list`, `get`, `create`, `update`, `delete`, `status`, `interrupt`, `resume`, or `doctor`. |
|
|
892
|
+
| `action` | string | - | `list`, `get`, `create`, `update`, `delete`, `status`, `interrupt`, `resume`, `append-step`, or `doctor`. |
|
|
790
893
|
| `chainName` | string | - | Chain name for management actions. |
|
|
791
894
|
| `config` | object/string | - | Agent or chain config for create/update. |
|
|
792
895
|
| `output` | `string \| false` | agent default | Override single-agent output file. |
|
|
@@ -796,8 +899,8 @@ Agent definitions are not loaded into context by default. Management actions let
|
|
|
796
899
|
| `tasks` | array | - | Top-level parallel tasks. Supports `agent`, `task`, `cwd`, `count`, `output`, `outputMode`, `reads`, `progress`, `skill`, `model`, and `acceptance`. |
|
|
797
900
|
| `concurrency` | number | config or `4` | Top-level parallel concurrency. |
|
|
798
901
|
| `worktree` | boolean | false | Create isolated git worktrees for parallel tasks. |
|
|
799
|
-
| `chain` | array | - | Sequential, static parallel, and dynamic fanout chain steps. Steps and chain parallel tasks support `phase`, `label`, `as`, `outputSchema`, and `acceptance` in addition to the usual execution fields. Dynamic fanout uses `expand`, one child `parallel` template, and `collect`. |
|
|
800
|
-
| `context` | `fresh \| fork` | agent default or `fresh` | `fork` creates real branched sessions from the parent leaf. Packaged `planner`, `worker`, and `oracle` default to `fork`. |
|
|
902
|
+
| `chain` | array | - | Sequential, static parallel, and dynamic fanout chain steps. Steps and chain parallel tasks support `phase`, `label`, `as`, `outputSchema`, and `acceptance` in addition to the usual execution fields. Dynamic fanout uses `expand`, one child `parallel` template, and `collect`. With `action: "append-step"`, pass exactly one step to append to a running async chain. |
|
|
903
|
+
| `context` | `fresh \| fork` | per-agent default or `fresh` | Explicit `fresh` or `fork` overrides every child. When omitted, each agent uses its own `defaultContext`; `fork` creates real branched sessions from the parent leaf. Packaged `planner`, `worker`, and `oracle` default to `fork`. |
|
|
801
904
|
| `chainDir` | string | temp chain dir | Persistent directory for chain artifacts. |
|
|
802
905
|
| `clarify` | boolean | true for chains | Show TUI preview/edit flow. |
|
|
803
906
|
| `agentScope` | `user \| project \| both` | `both` | Agent discovery scope. Project wins on collisions. |
|
|
@@ -810,7 +913,7 @@ Agent definitions are not loaded into context by default. Management actions let
|
|
|
810
913
|
| `sessionDir` | string | derived | Override session log directory. |
|
|
811
914
|
| `acceptance` | string/object/false | inferred | Override the run's inferred acceptance gates. Use `"auto"`, `"attested"`, `"checked"`, `"verified"`, `"reviewed"`, or `{ level: "none", reason: "..." }`. |
|
|
812
915
|
|
|
813
|
-
`context: "fork"` fails fast when the parent session is not persisted, the current leaf is missing, or the branched child session cannot be created. It never silently downgrades to `fresh`. In multi-agent runs
|
|
916
|
+
`context: "fork"` fails fast when the parent session is not persisted, the current leaf is missing, or the branched child session cannot be created. It never silently downgrades to `fresh`. In multi-agent runs that omit `context`, each agent/task/step follows its own `defaultContext`, so a fresh-default scout can run fresh beside a fork-default worker. Pass explicit `context: "fork"` or `context: "fresh"` when you intentionally want one context for every child.
|
|
814
917
|
|
|
815
918
|
Use `outputMode: "file-only"` when a saved output may be large and the parent only needs a pointer. The returned text is a compact reference like `Output saved to: /abs/report.md (48.2 KB, 2847 lines). Read this file if needed.` Failed runs and save errors still return normal inline output for debugging. In chains, later `{previous}` steps receive the same compact reference when the prior step used file-only mode.
|
|
816
919
|
|
|
@@ -827,6 +930,7 @@ subagent({ action: "interrupt", id: "<nested-run-id>" })
|
|
|
827
930
|
subagent({ action: "resume", id: "<run-id>", message: "follow-up question" })
|
|
828
931
|
subagent({ action: "resume", id: "<run-id>", index: 1, message: "follow-up for child 2" })
|
|
829
932
|
subagent({ action: "resume", id: "<nested-run-id>", message: "follow-up for a nested child" })
|
|
933
|
+
subagent({ action: "append-step", id: "<run-id>", chain: [{ agent: "worker", task: "Continue from {previous}" }] })
|
|
830
934
|
subagent({ action: "doctor" })
|
|
831
935
|
```
|
|
832
936
|
|
|
@@ -834,6 +938,8 @@ subagent({ action: "doctor" })
|
|
|
834
938
|
|
|
835
939
|
`resume` sends the follow-up directly when an async child is still reachable over intercom. After completion, it revives the child by starting a new async child from the stored child session file. Multi-child async runs and remembered foreground single, parallel, or chain runs can be revived by passing `index` to choose the child. Nested runs can be resumed by nested id when their live route or persisted session metadata is available. Revive starts a new child process from the old session context; it does not restart the same OS process, and it requires the chosen child to have a persisted `.jsonl` session file.
|
|
836
940
|
|
|
941
|
+
`append-step` accepts exactly one sequential, static parallel, or dynamic fanout chain step for a top-level async chain whose status is still `running`. The step is persisted in the run directory and becomes eligible only after the chain's already-queued steps finish; completed, failed, paused, foreground, single, and top-level parallel runs reject appends.
|
|
942
|
+
|
|
837
943
|
## Worktree isolation
|
|
838
944
|
|
|
839
945
|
Parallel agents can clobber each other if they edit the same checkout. `worktree: true` gives each parallel child its own git worktree branched from `HEAD`.
|
|
@@ -23,14 +23,14 @@ Working rules:
|
|
|
23
23
|
- Write the requested output files clearly and concretely.
|
|
24
24
|
- Prefer distilled, high-signal context over exhaustive dumps, but do not omit a relevant file or source just to keep the handoff short.
|
|
25
25
|
|
|
26
|
-
When running in a chain, expect to generate
|
|
26
|
+
When running in a chain, expect to generate context and meta-prompt handoff material. Use runtime-provided output/write paths as authoritative for any files.
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
Context handoff:
|
|
29
29
|
- relevant files with line numbers and key snippets
|
|
30
30
|
- important patterns already used in the codebase
|
|
31
31
|
- dependencies, constraints, and implementation risks
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
Meta-prompt handoff:
|
|
34
34
|
- goal: the concrete outcome the next agent should produce
|
|
35
35
|
- context/evidence: relevant files, diffs, decisions, constraints, and source-backed facts
|
|
36
36
|
- success criteria: what must be true before the next agent can finish
|
package/agents/planner.md
CHANGED
|
@@ -23,7 +23,7 @@ Working rules:
|
|
|
23
23
|
- Call out risks, dependencies, and anything that needs explicit validation.
|
|
24
24
|
- If the task is underspecified, surface the ambiguity in the plan instead of guessing.
|
|
25
25
|
|
|
26
|
-
Output format
|
|
26
|
+
Output format:
|
|
27
27
|
|
|
28
28
|
# Implementation Plan
|
|
29
29
|
|
package/agents/researcher.md
CHANGED
package/agents/scout.md
CHANGED
|
@@ -28,7 +28,7 @@ Working rules:
|
|
|
28
28
|
- If you are told to write output, write it to the provided path and keep the final response short.
|
|
29
29
|
- When running solo, summarize what you found after writing the output.
|
|
30
30
|
|
|
31
|
-
Output format
|
|
31
|
+
Output format:
|
|
32
32
|
|
|
33
33
|
# Code Context
|
|
34
34
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-subagents",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
4
4
|
"description": "Pi extension for delegating tasks to subagents with chains, parallel execution, and TUI clarification",
|
|
5
5
|
"author": "Nico Bailon",
|
|
6
6
|
"license": "MIT",
|
|
@@ -68,13 +68,13 @@
|
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@earendil-works/pi-tui": "
|
|
72
|
-
"jiti": "
|
|
73
|
-
"typebox": "
|
|
71
|
+
"@earendil-works/pi-tui": "0.74.0",
|
|
72
|
+
"jiti": "2.7.0",
|
|
73
|
+
"typebox": "1.1.24"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@earendil-works/pi-agent-core": "
|
|
77
|
-
"@earendil-works/pi-ai": "
|
|
78
|
-
"@earendil-works/pi-coding-agent": "
|
|
76
|
+
"@earendil-works/pi-agent-core": "0.74.0",
|
|
77
|
+
"@earendil-works/pi-ai": "0.74.0",
|
|
78
|
+
"@earendil-works/pi-coding-agent": "0.74.0"
|
|
79
79
|
}
|
|
80
80
|
}
|
|
@@ -20,6 +20,7 @@ Use this skill when the parent orchestrator needs to launch a specialized subage
|
|
|
20
20
|
- **Implementation handoff**: have `oracle` advise, then `worker` implement only after an approved direction
|
|
21
21
|
- **Recon and planning**: use `scout` or `context-builder`, then `planner`
|
|
22
22
|
- **Parallel exploration**: run multiple non-conflicting tasks concurrently
|
|
23
|
+
- **Regular skill specialists**: when discovery shows proactive skill subagent suggestions and the current work is broad enough, launch a small fresh-context fanout that asks one subagent per relevant regularly used skill to apply that skill's perspective to the task
|
|
23
24
|
- **Long-running work**: launch async/background runs and inspect them later
|
|
24
25
|
- **Subagent control**: watch needs-attention signals and soft-interrupt only when a delegated run is genuinely blocked
|
|
25
26
|
- **Agent authoring**: create, update, or override agents and chains for a project
|
|
@@ -55,6 +56,30 @@ The prompt templates in `prompts/` encode workflows the parent agent can run on
|
|
|
55
56
|
|
|
56
57
|
Use this when the user wants adversarial review of a diff, plan, issue, file, or implemented work. Launch fresh-context `reviewer` agents with distinct angles generated from the actual target. Common angles are correctness/regressions, tests/validation, and simplicity/maintainability; adapt for TypeScript, UI, security, docs, or large structural changes. Reviewers should inspect files and diffs directly, return concise evidence-backed findings with file/line references, and avoid edits unless the user explicitly asks for a writer pass. The parent synthesizes fixes worth doing now, optional improvements, and feedback to ignore/defer before applying anything.
|
|
57
58
|
|
|
59
|
+
### Proactive skill-specialist technique
|
|
60
|
+
|
|
61
|
+
Use this when `{ action: "list" }` reports proactive skill subagent suggestions and the user's task would benefit from perspectives the parent regularly uses. These suggestions are conservative: a skill is recommended only when it is available and referenced repeatedly by configured agents or saved chains. Treat the list as an opt-in hint for the current task, not a command to always fan out.
|
|
62
|
+
|
|
63
|
+
Default guardrails:
|
|
64
|
+
- Keep the fanout small: usually one or two skill-specialist children, never more than the listed recommendations or configured cap.
|
|
65
|
+
- Prefer `context: "fresh"` and include only the files, diff, plan, URL, or request details each child needs. Use forked context only when private/session history is essential and appropriate to share.
|
|
66
|
+
- Use read-only agents for analysis/review unless implementation was explicitly requested; do not create several writers in the same worktree.
|
|
67
|
+
- Skip proactive skill subagents for tiny questions, direct commands, highly private requests, or when the user asks not to delegate.
|
|
68
|
+
- Make cost and concurrency visible by using an ordinary `subagent(...)` call rather than hidden/background automation.
|
|
69
|
+
|
|
70
|
+
Example shape:
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
subagent({
|
|
74
|
+
tasks: [
|
|
75
|
+
{ agent: "reviewer", task: "Apply the available 'deslop' skill to review the current diff for concrete cleanup findings only. Do not modify files.", skill: "deslop" },
|
|
76
|
+
{ agent: "reviewer", task: "Apply the available 'accessibility' skill to review the UI changes for concrete issues only. Do not modify files.", skill: "accessibility" }
|
|
77
|
+
],
|
|
78
|
+
context: "fresh",
|
|
79
|
+
concurrency: 2
|
|
80
|
+
})
|
|
81
|
+
```
|
|
82
|
+
|
|
58
83
|
### Review-loop technique
|
|
59
84
|
|
|
60
85
|
Use this when the user wants implementation or current diff review to continue until reviewers stop finding fixes worth doing now. Keep the loop in the parent session: one async `worker` implements or fixes, fresh-context `reviewer` agents inspect the actual repo and diff, the parent synthesizes accepted fixes, and one async forked `worker` applies them. The parent can express the sequence up front as an async/background chain when the workflow is known, or continue with explicit follow-up subagent runs after each async completion. For an initial chain, pass `async: true` so the main chat is unblocked; do not set `clarify: true` unless the user explicitly wants the foreground clarify UI. Treat an async implementation worker handoff as an intermediate state, not final completion, unless the user explicitly asked for worker-only work, review-only output, or to stop after implementation. Stop when reviewers find no blockers or fixes worth doing now, remaining feedback is optional or deferred, an unapproved product/scope/architecture decision appears, or the max review-round cap is reached. Default to 3 review rounds unless the user sets a different cap. Do not loop for optional polish, and do not let children launch subagents or decide the loop outcome.
|
|
@@ -211,6 +236,11 @@ Useful override fields: `model`, `fallbackModels`, `thinking`,
|
|
|
211
236
|
`disabled`, `skills`, `tools`, and `systemPrompt`. Create a user or project
|
|
212
237
|
agent with the same name only when you want a substantially different agent.
|
|
213
238
|
|
|
239
|
+
If a provider rejects model IDs with thinking suffixes, use
|
|
240
|
+
`subagents.disableThinking: true` in user or project settings to clear bundled
|
|
241
|
+
builtin thinking defaults globally. A higher-precedence per-agent `thinking`
|
|
242
|
+
override can opt one builtin back in.
|
|
243
|
+
|
|
214
244
|
## Discovery and Scope Rules
|
|
215
245
|
|
|
216
246
|
Agent files can live in:
|