pi-subagents 0.30.0 → 0.31.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.
Files changed (43) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +189 -18
  3. package/agents/context-builder.md +3 -3
  4. package/agents/planner.md +1 -1
  5. package/agents/researcher.md +1 -1
  6. package/agents/scout.md +1 -1
  7. package/package.json +7 -7
  8. package/skills/pi-subagents/SKILL.md +5 -0
  9. package/src/agents/agent-management.ts +170 -6
  10. package/src/agents/agent-serializer.ts +31 -13
  11. package/src/agents/agents.ts +207 -23
  12. package/src/agents/frontmatter.ts +66 -2
  13. package/src/agents/skills.ts +117 -20
  14. package/src/extension/doctor.ts +20 -0
  15. package/src/extension/fanout-child.ts +1 -0
  16. package/src/extension/index.ts +58 -4
  17. package/src/extension/schemas.ts +10 -76
  18. package/src/intercom/intercom-bridge.ts +27 -4
  19. package/src/profiles/profiles.ts +637 -0
  20. package/src/runs/background/async-execution.ts +14 -4
  21. package/src/runs/background/async-job-tracker.ts +56 -11
  22. package/src/runs/background/async-resume.ts +11 -13
  23. package/src/runs/background/control-channel.ts +177 -0
  24. package/src/runs/background/result-watcher.ts +11 -2
  25. package/src/runs/background/stale-run-reconciler.ts +9 -4
  26. package/src/runs/background/subagent-runner.ts +86 -3
  27. package/src/runs/foreground/chain-execution.ts +26 -2
  28. package/src/runs/foreground/execution.ts +113 -8
  29. package/src/runs/foreground/subagent-executor.ts +356 -86
  30. package/src/runs/shared/acceptance.ts +285 -34
  31. package/src/runs/shared/completion-guard.ts +1 -1
  32. package/src/runs/shared/dynamic-fanout.ts +4 -2
  33. package/src/runs/shared/mcp-direct-tool-allowlist.ts +2 -2
  34. package/src/runs/shared/parallel-utils.ts +6 -1
  35. package/src/runs/shared/pi-args.ts +9 -1
  36. package/src/runs/shared/single-output.ts +15 -1
  37. package/src/runs/shared/subagent-prompt-runtime.ts +1 -0
  38. package/src/shared/settings.ts +1 -0
  39. package/src/shared/types.ts +9 -2
  40. package/src/shared/utils.ts +19 -1
  41. package/src/slash/prompt-template-bridge.ts +26 -3
  42. package/src/slash/slash-commands.ts +642 -43
  43. package/src/tui/render.ts +265 -13
package/CHANGELOG.md CHANGED
@@ -2,6 +2,44 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.31.1] - 2026-06-25
6
+
7
+ ### Added
8
+ - Added `/chain` inline parallel groups with per-step metadata, group options, and tab completion.
9
+ - Added subagent profile commands and provider model catalog generation for quota and quality model profiles.
10
+
11
+ ### Fixed
12
+ - Discover `pi-intercom` installations created by `--extension npm:pi-intercom` under Pi's temporary npm extension cache.
13
+ - Made async subagent interrupt, steer, and stop requests portable across platforms that do not support Unix signals.
14
+ - Hardened profile commands by probing models without tools, rejecting unsafe profile/provider path tokens, and resolving short model IDs and thinking suffixes against the current registry.
15
+ - Limited inline `/chain` acceptance values to levels expressible in slash syntax and kept completion disabled inside shared `--` tasks with literal parentheses.
16
+
17
+ ## [0.31.0] - 2026-06-24
18
+
19
+ ### Added
20
+ - 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.
21
+ - 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.
22
+ - 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.
23
+
24
+ ### Changed
25
+ - 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.
26
+ - 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.
27
+
28
+ ### Fixed
29
+ - 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.
30
+ - 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.
31
+ - 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.
32
+ - 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.
33
+ - 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.
34
+ - 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.
35
+ - 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.
36
+ - 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.
37
+ - 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.
38
+ - 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.
39
+ - 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.
40
+ - 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.
41
+ - Keep top-level parallel `defaultProgress` files in run-scoped artifact storage instead of the parent working directory. Thanks to youngshine (@smithyyang) for #224.
42
+
5
43
  ## [0.30.0] - 2026-06-20
6
44
 
7
45
  ### 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 a builtin agent's model
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. If you want a totally different agent, create a user or project agent with the same name; for normal tweaks, prefer overrides.
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.
@@ -245,12 +329,45 @@ Skip this section until you want exact syntax.
245
329
  |---------|-------------|
246
330
  | `/run <agent> [task]` | Run one agent; omit the task for self-contained agents |
247
331
  | `/chain agent1 "task1" -> agent2 "task2"` | Run agents in sequence |
332
+ | `/chain scout "scan" -> (reviewer "A" \| reviewer "B") -> writer "fix"` | Run a chain with a static parallel group inline |
248
333
  | `/parallel agent1 "task1" -> agent2 "task2"` | Run agents in parallel |
249
334
  | `/run-chain <chainName> -- <task>` | Launch a saved `.chain.md` or `.chain.json` workflow |
250
335
  | `/subagents-doctor` | Show read-only setup diagnostics |
336
+ | `/subagents-models [agent]` | Show the runtime-loaded builtin model mapping, optionally filtered to one builtin |
337
+ | `/subagents-profiles` | List saved subagent profiles from `~/.pi/agent/profiles/pi-subagents/` |
338
+ | `/subagents-load-profile <name>` | Replace only `settings.subagents` with a saved profile and optionally switch this session to the profile worker model |
339
+ | `/subagents-refresh-provider-models <provider> [--force]` | Create or refresh the cached provider model catalog |
340
+ | `/subagents-generate-profiles <provider>` | Generate `<provider>.quota.json` and `<provider>.quality.json` profiles |
341
+ | `/subagents-check-profile <name>` | Check a saved profile against the current registry and live model probes |
251
342
 
252
343
  Commands validate agent names locally, support tab completion, and send results back into the conversation.
253
344
 
345
+ ### Profiles and provider model catalogs
346
+
347
+ Profiles are stored under:
348
+
349
+ ```text
350
+ ~/.pi/agent/profiles/pi-subagents/
351
+ ```
352
+
353
+ Provider model catalogs are cached under:
354
+
355
+ ```text
356
+ ~/.pi/agent/profiles/pi-subagents/providers/
357
+ ```
358
+
359
+ Use the profile workflow like this:
360
+
361
+ ```text
362
+ /subagents-refresh-provider-models openai-codex
363
+ /subagents-generate-profiles openai-codex
364
+ /subagents-load-profile openai-codex.quota
365
+ ```
366
+
367
+ `/subagents-refresh-provider-models` writes a serialized provider model catalog with observed registry data, simple role-oriented classification, and live probe results from tiny one-shot `pi -p --model ... --no-tools` checks. The cache refreshes when missing or stale; use `--force` to ignore freshness and probe again immediately.
368
+
369
+ `/subagents-generate-profiles` uses the provider catalog to produce quota and quality profiles. `/subagents-check-profile` re-checks each assigned model in a saved profile against the current registry and a live probe so you can detect model removals, auth problems, or stale assignments.
370
+
254
371
  ### Per-step tasks
255
372
 
256
373
  Use `->` to separate steps and give each step its own task:
@@ -268,6 +385,37 @@ Both double and single quotes work. You can also use `--` as a delimiter:
268
385
 
269
386
  Steps without a task inherit behavior from the execution mode. Chain steps get `{previous}`, the prior step’s output. Parallel steps use the first available task as a fallback.
270
387
 
388
+ ### Inline parallel groups in `/chain`
389
+
390
+ Wrap a group of agents in parentheses and separate them with `|` to fan them out within a single chain step. The group runs all of its tasks concurrently, then the next `->` step continues once they finish:
391
+
392
+ ```text
393
+ /chain scout "scan" -> (reviewer "review A" | reviewer "review B") -> writer "fix"
394
+ ```
395
+
396
+ Notes:
397
+
398
+ - Groups must contain at least two tasks separated by ` | `, each with its own task.
399
+ - Group syntax is only valid between ` -> ` separators, and the group must appear as a complete step.
400
+ - Only a step that *opens* with `(` is a group. Parentheses inside a shared `--` task (e.g. `/chain scout -- inspect auth (backend)`) stay literal text and keep the legacy single-agent behavior.
401
+ - A group is treated as the prior step’s output for the next sequential step.
402
+ - Tab completion suggests agents inside groups — after `(`, after `|`, and on each new `->` step.
403
+
404
+ Add a `[...]` suffix right after the closing `)` to set step-level options on the group:
405
+
406
+ ```text
407
+ /chain scout "scan" -> (reviewer "A" | reviewer "B")[concurrency=2,failFast,worktree] -> writer "fix"
408
+ ```
409
+
410
+ | Group option | Description |
411
+ |--------------|-------------|
412
+ | `concurrency=N` | Max tasks running at once within the group. |
413
+ | `failFast` | Stop the group as soon as one task fails. |
414
+ | `worktree` | Run each group task in its own git worktree. |
415
+
416
+ Dynamic fanout (`expand` / `collect`) is intentionally not available inline — use the
417
+ `subagent({ chain: [...] })` tool API or a saved `.chain.json` for data-driven fan-out.
418
+
271
419
  ```text
272
420
  /chain scout "analyze auth" -> planner -> worker
273
421
  # scout gets "analyze auth"; planner gets scout output; worker gets planner output
@@ -282,7 +430,7 @@ For a shared task, list agents and place one `--` before the task:
282
430
 
283
431
  ### Inline per-step config
284
432
 
285
- Append `[key=value,...]` to an agent name to override defaults for that step:
433
+ Append `[key=value,...]` to an agent name to override defaults. `/chain` applies every key below; `/run` and `/parallel` use the execution-behavior keys (`output`, `outputMode`, `reads`, `model`, `skills`, `progress`) and ignore chain-only metadata such as `as`, `label`, `phase`, `count`, `outputSchema`, and `acceptance`.
286
434
 
287
435
  ```text
288
436
  /chain scout[output=context.md] "scan code" -> planner[reads=context.md] "analyze auth"
@@ -296,11 +444,20 @@ Append `[key=value,...]` to an agent name to override defaults for that step:
296
444
  | `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
445
  | `reads` | `reads=a.md+b.md` | Read files before executing. `+` separates multiple paths. |
298
446
  | `model` | `model=anthropic/claude-sonnet-4` | Override model for this step. |
299
- | `skills` | `skills=planning+review` | Override injected skills. `+` separates multiple skills. |
447
+ | `skills` | `skills=planning+review` | Override available skills. `+` separates multiple skills. |
300
448
  | `progress` | `progress` | Enable progress tracking. |
449
+ | `as` | `as=context` | Name this step’s output so later steps can reference it. |
450
+ | `label` | `label=Recon` | Human-readable label for the step. |
451
+ | `phase` | `phase=analysis` | Group steps into a named phase. |
452
+ | `cwd` | `cwd=packages/api` | Run the step in a subdirectory. |
453
+ | `count` | `count=3` | Fan a group task into N copies (only inside a `( ... )` group). |
454
+ | `outputSchema` | `outputSchema=schema.json` | Validate structured output against a JSON Schema file (path resolved against the session cwd, not an inline step `cwd`). |
455
+ | `acceptance` | `acceptance=checked` | Inline acceptance level: `auto`, `attested`, or `checked`. Use the tool API or saved `.chain.json` for object contracts such as `none`, `verified`, or `reviewed`. |
301
456
 
302
457
  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.
303
458
 
459
+ Inline `[...]` values must not contain spaces or commas — keep `label`/`phase` to single tokens.
460
+
304
461
  ### Background and forked runs
305
462
 
306
463
  Add `--bg` to run in the background:
@@ -360,9 +517,9 @@ Agent locations, lowest to highest priority:
360
517
  | Builtin | `~/.pi/agent/extensions/subagent/agents/` |
361
518
  | Installed package | `package.json` `pi-subagents.agents` or `pi.subagents.agents` |
362
519
  | User | `~/.pi/agent/agents/**/*.md` |
363
- | Project | `.pi/agents/**/*.md` |
520
+ | Project | Project config `agents/**/*.md` (`.pi/agents/**/*.md` in standard Pi) |
364
521
 
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 `.pi/agents/` define the same parsed runtime agent name, `.pi/agents/` wins. Use `agentScope: "user" | "project" | "both"` to control discovery; `both` is the default and project definitions win runtime-name collisions.
522
+ 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
523
 
367
524
  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
525
 
@@ -377,7 +534,7 @@ pi install npm:pi-web-access
377
534
  You can override selected builtin fields without copying the whole agent. Overrides live in settings:
378
535
 
379
536
  - User: `~/.pi/agent/settings.json`
380
- - Project: `.pi/settings.json`
537
+ - Project: project config settings file (`.pi/settings.json` in standard Pi)
381
538
 
382
539
  Example:
383
540
 
@@ -397,6 +554,8 @@ Supported override fields are `model`, `fallbackModels`, `thinking`, `systemProm
397
554
 
398
555
  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
556
 
557
+ 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.
558
+
400
559
  ### Prompt assembly
401
560
 
402
561
  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.
@@ -458,7 +617,7 @@ Important fields:
458
617
  | `inheritProjectContext` | Keeps or strips inherited project instruction blocks. |
459
618
  | `inheritSkills` | Keeps or strips Pi’s discovered skills catalog. |
460
619
  | `defaultContext` | Optional `fresh` or `fork` launch context default for this agent. |
461
- | `skills` | Injects specific skills directly, regardless of `inheritSkills`. |
620
+ | `skills` | Adds specific skills to the child’s available skill list, regardless of `inheritSkills`. |
462
621
  | `output` | Default single-agent output file. |
463
622
  | `defaultReads` | Files to read before running in chain/parallel behavior. |
464
623
  | `defaultProgress` | Maintain `progress.md`. |
@@ -503,7 +662,7 @@ Chains are reusable workflows stored separately from agent files. Use `.chain.md
503
662
  |-------|------|
504
663
  | Installed package | `package.json` `pi-subagents.chains` or `pi.subagents.chains` |
505
664
  | User | `~/.pi/agent/chains/**/*.chain.md`, `~/.pi/agent/chains/**/*.chain.json` |
506
- | Project | `.pi/chains/**/*.chain.md`, `.pi/chains/**/*.chain.json` |
665
+ | Project | Project config `chains/**/*.chain.md`, `chains/**/*.chain.json` (`.pi/chains/...` in standard Pi) |
507
666
 
508
667
  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`.
509
668
 
@@ -605,14 +764,14 @@ Parallel outputs are aggregated with clear separators before being passed to the
605
764
 
606
765
  ## Skills
607
766
 
608
- Skills are `SKILL.md` files injected into an agent’s system prompt.
767
+ 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.
609
768
 
610
769
  Discovery uses project-first precedence:
611
770
 
612
- 1. `.pi/skills/{name}/SKILL.md`
771
+ 1. Project config `skills/{name}/SKILL.md` (`.pi/skills/{name}/SKILL.md` in standard Pi)
613
772
  2. Project packages and project settings packages via `package.json -> pi.skills`
614
773
  3. Current task cwd package via `package.json -> pi.skills`
615
- 4. `.pi/settings.json -> skills`
774
+ 4. Project config `settings.json -> skills`
616
775
  5. `~/.pi/agent/skills/{name}/SKILL.md`
617
776
  6. User packages and user settings packages via `package.json -> pi.skills`
618
777
  7. `~/.pi/agent/settings.json -> skills`
@@ -627,14 +786,24 @@ Use agent defaults, override them at runtime, or disable them:
627
786
 
628
787
  For chains, `skill` at the top level is additive. A step-level `skill` overrides that step; `false` disables skills for that step.
629
788
 
630
- Injected skills use this shape:
789
+ Available skills use this shape:
631
790
 
632
791
  ```xml
633
- <skill name="safe-bash">
634
- [skill content from SKILL.md, frontmatter stripped]
635
- </skill>
792
+ The following configured skills are available to this subagent.
793
+ Use the read tool to load a skill's file when the task matches its description.
794
+ 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.
795
+
796
+ <available_skills>
797
+ <skill>
798
+ <name>safe-bash</name>
799
+ <description>Run shell commands safely.</description>
800
+ <location>/absolute/path/to/safe-bash/SKILL.md</location>
801
+ </skill>
802
+ </available_skills>
636
803
  ```
637
804
 
805
+ 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.
806
+
638
807
  Missing skills do not fail execution. The result summary shows a warning.
639
808
 
640
809
  ### Bundled skill
@@ -743,6 +912,8 @@ Agent definitions are not loaded into context by default. Management actions let
743
912
  { action: "list" }
744
913
  { action: "list", agentScope: "project" }
745
914
  { action: "get", agent: "scout" }
915
+ { action: "models" }
916
+ { action: "models", agent: "reviewer" }
746
917
  { action: "get", agent: "code-analysis.scout" }
747
918
  { action: "get", chainName: "review-pipeline" }
748
919
 
@@ -801,7 +972,7 @@ Agent definitions are not loaded into context by default. Management actions let
801
972
  | `concurrency` | number | config or `4` | Top-level parallel concurrency. |
802
973
  | `worktree` | boolean | false | Create isolated git worktrees for parallel tasks. |
803
974
  | `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. |
804
- | `context` | `fresh \| fork` | agent default or `fresh` | `fork` creates real branched sessions from the parent leaf. Packaged `planner`, `worker`, and `oracle` default to `fork`. |
975
+ | `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`. |
805
976
  | `chainDir` | string | temp chain dir | Persistent directory for chain artifacts. |
806
977
  | `clarify` | boolean | true for chains | Show TUI preview/edit flow. |
807
978
  | `agentScope` | `user \| project \| both` | `both` | Agent discovery scope. Project wins on collisions. |
@@ -814,7 +985,7 @@ Agent definitions are not loaded into context by default. Management actions let
814
985
  | `sessionDir` | string | derived | Override session log directory. |
815
986
  | `acceptance` | string/object/false | inferred | Override the run's inferred acceptance gates. Use `"auto"`, `"attested"`, `"checked"`, `"verified"`, `"reviewed"`, or `{ level: "none", reason: "..." }`. |
816
987
 
817
- `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, if any requested agent has `defaultContext: fork` and the launch omits `context`, the whole invocation uses forked context; pass `context: "fresh"` when you intentionally want a fresh run.
988
+ `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.
818
989
 
819
990
  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.
820
991
 
@@ -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 two files in the chain directory:
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
- `context.md`
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
- `meta-prompt.md`
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 (`plan.md`):
26
+ Output format:
27
27
 
28
28
  # Implementation Plan
29
29
 
@@ -29,7 +29,7 @@ Search strategy:
29
29
  - practical experience or benchmark query
30
30
  - recent developments query when the topic is time-sensitive
31
31
 
32
- Output format (`research.md`):
32
+ Output format:
33
33
 
34
34
  # Research: [topic]
35
35
 
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 (`context.md`):
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.30.0",
3
+ "version": "0.31.1",
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": "^0.74.0",
72
- "jiti": "^2.7.0",
73
- "typebox": "^1.1.24"
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": "^0.74.0",
77
- "@earendil-works/pi-ai": "^0.74.0",
78
- "@earendil-works/pi-coding-agent": "^0.74.0"
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
  }
@@ -236,6 +236,11 @@ Useful override fields: `model`, `fallbackModels`, `thinking`,
236
236
  `disabled`, `skills`, `tools`, and `systemPrompt`. Create a user or project
237
237
  agent with the same name only when you want a substantially different agent.
238
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
+
239
244
  ## Discovery and Scope Rules
240
245
 
241
246
  Agent files can live in: