pi-subagents 0.21.0 → 0.21.2
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 +31 -0
- package/README.md +49 -18
- package/agents/context-builder.md +6 -3
- package/package.json +3 -4
- package/prompts/parallel-context-build.md +53 -0
- package/prompts/parallel-handoff-plan.md +59 -0
- package/prompts/parallel-review.md +4 -0
- package/skills/pi-subagents/SKILL.md +71 -3
- package/{agent-management.ts → src/agents/agent-management.ts} +1 -5
- package/{agents.ts → src/agents/agents.ts} +1 -1
- package/{doctor.ts → src/extension/doctor.ts} +5 -5
- package/{index.ts → src/extension/index.ts} +21 -20
- package/{schemas.ts → src/extension/schemas.ts} +25 -39
- package/{intercom-bridge.ts → src/intercom/intercom-bridge.ts} +19 -10
- package/{result-intercom.ts → src/intercom/result-intercom.ts} +33 -5
- package/{agent-manager-chain-detail.ts → src/manager-ui/agent-manager-chain-detail.ts} +3 -3
- package/{agent-manager-detail.ts → src/manager-ui/agent-manager-detail.ts} +7 -7
- package/{agent-manager-edit.ts → src/manager-ui/agent-manager-edit.ts} +4 -4
- package/{agent-manager-list.ts → src/manager-ui/agent-manager-list.ts} +12 -5
- package/{agent-manager-parallel.ts → src/manager-ui/agent-manager-parallel.ts} +3 -3
- package/{agent-manager.ts → src/manager-ui/agent-manager.ts} +19 -16
- package/{async-execution.ts → src/runs/background/async-execution.ts} +11 -11
- package/{async-job-tracker.ts → src/runs/background/async-job-tracker.ts} +29 -6
- package/src/runs/background/async-resume.ts +305 -0
- package/{async-status.ts → src/runs/background/async-status.ts} +14 -12
- package/{notify.ts → src/runs/background/notify.ts} +1 -1
- package/{result-watcher.ts → src/runs/background/result-watcher.ts} +93 -23
- package/{run-status.ts → src/runs/background/run-status.ts} +63 -28
- package/src/runs/background/stale-run-reconciler.ts +275 -0
- package/{subagent-runner.ts → src/runs/background/subagent-runner.ts} +43 -55
- package/{chain-clarify.ts → src/runs/foreground/chain-clarify.ts} +7 -7
- package/{chain-execution.ts → src/runs/foreground/chain-execution.ts} +10 -10
- package/{execution.ts → src/runs/foreground/execution.ts} +26 -22
- package/{subagent-executor.ts → src/runs/foreground/subagent-executor.ts} +155 -24
- package/{long-running-guard.ts → src/runs/shared/long-running-guard.ts} +3 -3
- package/{model-fallback.ts → src/runs/shared/model-fallback.ts} +1 -1
- package/{subagent-control.ts → src/runs/shared/subagent-control.ts} +4 -8
- package/src/shared/atomic-json.ts +16 -0
- package/{settings.ts → src/shared/settings.ts} +21 -14
- package/{types.ts → src/shared/types.ts} +10 -2
- package/{utils.ts → src/shared/utils.ts} +1 -15
- package/{slash-bridge.ts → src/slash/slash-bridge.ts} +2 -2
- package/{slash-commands.ts → src/slash/slash-commands.ts} +13 -10
- package/{slash-live-state.ts → src/slash/slash-live-state.ts} +2 -2
- package/{render.ts → src/tui/render.ts} +3 -3
- package/{subagents-status.ts → src/tui/subagents-status.ts} +34 -14
- /package/{agent-scope.ts → src/agents/agent-scope.ts} +0 -0
- /package/{agent-selection.ts → src/agents/agent-selection.ts} +0 -0
- /package/{agent-serializer.ts → src/agents/agent-serializer.ts} +0 -0
- /package/{agent-templates.ts → src/agents/agent-templates.ts} +0 -0
- /package/{chain-serializer.ts → src/agents/chain-serializer.ts} +0 -0
- /package/{frontmatter.ts → src/agents/frontmatter.ts} +0 -0
- /package/{skills.ts → src/agents/skills.ts} +0 -0
- /package/{completion-dedupe.ts → src/runs/background/completion-dedupe.ts} +0 -0
- /package/{top-level-async.ts → src/runs/background/top-level-async.ts} +0 -0
- /package/{completion-guard.ts → src/runs/shared/completion-guard.ts} +0 -0
- /package/{parallel-utils.ts → src/runs/shared/parallel-utils.ts} +0 -0
- /package/{pi-args.ts → src/runs/shared/pi-args.ts} +0 -0
- /package/{pi-spawn.ts → src/runs/shared/pi-spawn.ts} +0 -0
- /package/{run-history.ts → src/runs/shared/run-history.ts} +0 -0
- /package/{single-output.ts → src/runs/shared/single-output.ts} +0 -0
- /package/{subagent-prompt-runtime.ts → src/runs/shared/subagent-prompt-runtime.ts} +0 -0
- /package/{worktree.ts → src/runs/shared/worktree.ts} +0 -0
- /package/{artifacts.ts → src/shared/artifacts.ts} +0 -0
- /package/{file-coalescer.ts → src/shared/file-coalescer.ts} +0 -0
- /package/{fork-context.ts → src/shared/fork-context.ts} +0 -0
- /package/{formatters.ts → src/shared/formatters.ts} +0 -0
- /package/{jsonl-writer.ts → src/shared/jsonl-writer.ts} +0 -0
- /package/{post-exit-stdio-guard.ts → src/shared/post-exit-stdio-guard.ts} +0 -0
- /package/{session-tokens.ts → src/shared/session-tokens.ts} +0 -0
- /package/{prompt-template-bridge.ts → src/slash/prompt-template-bridge.ts} +0 -0
- /package/{render-helpers.ts → src/tui/render-helpers.ts} +0 -0
- /package/{text-editor.ts → src/tui/text-editor.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,37 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.21.2] - 2026-04-30
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- Added a packaged `/parallel-context-build` prompt for parallel `context-builder` handoff passes.
|
|
9
|
+
- Added a packaged `/parallel-handoff-plan` prompt for external-reference research plus local `context-builder` passes that produce an implementation handoff meta-prompt.
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
- Strengthened `context-builder` guidance so handoffs require reading all relevant files and doing needed tool-available research before summarizing.
|
|
13
|
+
- Expanded the bundled `pi-subagents` skill with tool-level recipes for the packaged prompt workflows, including context-build and handoff-plan patterns that parent agents can apply without slash commands.
|
|
14
|
+
- Updated `README.md` to explain the bundled `pi-subagents` skill, what it covers, and how it helps the orchestrating agent.
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
- Make active-long-running notices time-based by default, with turn and token thresholds available only as explicit opt-in budget guards.
|
|
18
|
+
- Stop async status listing from inventing `needs_attention` with default thresholds when the runner has not persisted a control state.
|
|
19
|
+
- Treat string `"false"` output settings as disabled output so parallel reviewers do not collide on a `/false` output path, including chain-parallel agent defaults.
|
|
20
|
+
- Wrap long `/subagents-status` detail output/event lines instead of truncating them with ellipses.
|
|
21
|
+
- Treat cleanup after a clean terminal assistant stop as success even when the final assistant text is empty, using a short grace period before terminating lingering child processes without surfacing scary final-drain warnings.
|
|
22
|
+
- Express flexible tool schema fields as `anyOf` unions without parent-level `type` arrays, avoiding schema shapes rejected by strict providers such as Moonshot/opencode-go.
|
|
23
|
+
|
|
24
|
+
## [0.21.1] - 2026-04-30
|
|
25
|
+
|
|
26
|
+
### Changed
|
|
27
|
+
- Changed the `/agents` new-agent shortcut from `Alt+N` to `Shift+Ctrl+N`, and added `agentManager.newShortcut` config for overriding it.
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
- Fall back to polling async result files when native result watching is unavailable due to `EMFILE` or `ENOSPC`.
|
|
31
|
+
- Treat forced final-drain termination after a valid final assistant output as cleanup success instead of failing the subagent run.
|
|
32
|
+
- Hide disabled builtin agents from `subagent({ action: "list" })` output so agent-facing choices match executable runtime discovery.
|
|
33
|
+
- Resolve intercom bridge default paths at runtime so tests and isolated environments that change `HOME` use the correct `pi-intercom` location.
|
|
34
|
+
- Made the tool-description source check tolerant of Windows line endings.
|
|
35
|
+
|
|
5
36
|
## [0.21.0] - 2026-04-29
|
|
6
37
|
|
|
7
38
|
### Changed
|
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<p>
|
|
2
|
-
<img src="banner.png" alt="pi-subagents" width="1100">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/nicobailon/pi-subagents/main/banner.png" alt="pi-subagents" width="1100">
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
5
|
# pi-subagents
|
|
@@ -196,6 +196,8 @@ The package includes reusable prompt templates for common workflows. You do not
|
|
|
196
196
|
|--------|------------|
|
|
197
197
|
| `/parallel-review` | Launch fresh-context reviewers with distinct angles, then synthesize what to fix. |
|
|
198
198
|
| `/parallel-research` | Combine `researcher` and `scout` for external evidence, local code context, and practical tradeoffs. |
|
|
199
|
+
| `/parallel-context-build` | Run `context-builder` agents in parallel to produce planning handoff context and meta-prompts. |
|
|
200
|
+
| `/parallel-handoff-plan` | Combine external research and `context-builder` passes into an implementation handoff plan and meta-prompt. |
|
|
199
201
|
| `/gather-context-and-clarify` | Scout/research first, then ask the user the clarification questions that matter. |
|
|
200
202
|
| `/parallel-cleanup` | Run review-only cleanup passes after implementation. |
|
|
201
203
|
|
|
@@ -374,7 +376,7 @@ Useful keys:
|
|
|
374
376
|
|
|
375
377
|
- type to search the list
|
|
376
378
|
- `Enter` opens detail screens
|
|
377
|
-
- `
|
|
379
|
+
- `Shift+Ctrl+N` creates an agent or chain from a template
|
|
378
380
|
- `Ctrl+R` launches selected agents as a run or chain
|
|
379
381
|
- `Ctrl+P` opens the parallel builder
|
|
380
382
|
- `Tab` selects agents in the list or toggles skip-clarify in task input
|
|
@@ -432,7 +434,7 @@ Supported override fields are `model`, `fallbackModels`, `thinking`, `systemProm
|
|
|
432
434
|
|
|
433
435
|
You can also manage builtin overrides from `/agents`. On a builtin detail screen, press `e`, choose user or project scope if needed, and save the fields you want to override.
|
|
434
436
|
|
|
435
|
-
Set `disabled: true` to hide a builtin from runtime discovery while keeping it visible in `/agents`. For bulk control, set `subagents.disableBuiltins: true` in settings. Overridden builtins show badges like `[builtin+user]` or `[builtin+project]`; disabled builtins show `off` badges in the manager.
|
|
437
|
+
Set `disabled: true` to hide a builtin from runtime discovery and agent-facing `subagent({ action: "list" })` output while keeping it visible in `/agents`. For bulk control, set `subagents.disableBuiltins: true` in settings. Overridden builtins show badges like `[builtin+user]` or `[builtin+project]`; disabled builtins show `off` badges in the manager.
|
|
436
438
|
|
|
437
439
|
### Prompt assembly
|
|
438
440
|
|
|
@@ -618,6 +620,20 @@ Injected skills use this shape:
|
|
|
618
620
|
|
|
619
621
|
Missing skills do not fail execution. The result summary shows a warning.
|
|
620
622
|
|
|
623
|
+
### Bundled skill
|
|
624
|
+
|
|
625
|
+
The package bundles a `pi-subagents` skill that is automatically available to the parent agent when the extension is installed. It is for the orchestrating parent only: child subagents never receive it, and their context is explicitly filtered to strip parent-only orchestration instructions.
|
|
626
|
+
|
|
627
|
+
What the bundled skill covers:
|
|
628
|
+
- **Delegation patterns**: when to launch which agent, whether to use single, parallel, chain, or async mode, and whether to use fresh or forked context
|
|
629
|
+
- **Prompt workflow recipes**: how to apply the packaged techniques directly with `subagent(...)` when the user describes the workflow in natural language instead of invoking a slash command. This includes parallel review, parallel research, parallel context-build, parallel handoff-plan, gather-context-and-clarify, and parallel cleanup
|
|
630
|
+
- **GPT-5.5 prompting guidance**: compact contract prompts instead of long scripts, what to include in role-specific meta prompts, and retrieval budgets for researchers
|
|
631
|
+
- **Safety boundaries**: child agents must not run subagents, must not invent intercom targets, and must escalate unapproved decisions
|
|
632
|
+
- **Intercom conventions**: when to ask vs send, and how parent-side result delivery works with `pi-intercom`
|
|
633
|
+
- **Control and diagnostics**: attention signals, soft interrupts, status, and the `doctor` action
|
|
634
|
+
|
|
635
|
+
If you are writing an agent that orchestrates subagents, the bundled skill helps it behave correctly without guessing the patterns. If you are a human user, you do not need to read it directly; the README and prompt shortcuts encode the same workflows in user-facing form.
|
|
636
|
+
|
|
621
637
|
## Programmatic tool usage
|
|
622
638
|
|
|
623
639
|
These are the parameters the LLM passes when it calls the `subagent` tool. Most users ask naturally or use slash commands instead.
|
|
@@ -719,7 +735,7 @@ Agent definitions are not loaded into context by default. Management actions let
|
|
|
719
735
|
|-------|------|---------|-------------|
|
|
720
736
|
| `agent` | string | - | Agent name for single mode, or target for management actions. |
|
|
721
737
|
| `task` | string | - | Task string for single mode. |
|
|
722
|
-
| `action` | string | - | `list`, `get`, `create`, `update`, `delete`, `status`, `interrupt`, or `doctor`. |
|
|
738
|
+
| `action` | string | - | `list`, `get`, `create`, `update`, `delete`, `status`, `interrupt`, `resume`, or `doctor`. |
|
|
723
739
|
| `chainName` | string | - | Chain name for management actions. |
|
|
724
740
|
| `config` | object/string | - | Agent or chain config for create/update. |
|
|
725
741
|
| `output` | `string \| false` | agent default | Override single-agent output file. |
|
|
@@ -751,9 +767,12 @@ Status and control actions:
|
|
|
751
767
|
subagent({ action: "status" })
|
|
752
768
|
subagent({ action: "status", id: "<run-id>" })
|
|
753
769
|
subagent({ action: "interrupt", id: "<run-id>" })
|
|
770
|
+
subagent({ action: "resume", id: "<async-run-id>", message: "follow-up question" })
|
|
754
771
|
subagent({ action: "doctor" })
|
|
755
772
|
```
|
|
756
773
|
|
|
774
|
+
`resume` sends the follow-up directly when the async child is still reachable over intercom. After completion, it starts a new async child from the stored single-child session file.
|
|
775
|
+
|
|
757
776
|
## Worktree isolation
|
|
758
777
|
|
|
759
778
|
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`.
|
|
@@ -833,6 +852,18 @@ Session directory precedence is: `params.sessionDir`, then `config.defaultSessio
|
|
|
833
852
|
|
|
834
853
|
Controls nested delegation when no inherited `PI_SUBAGENT_MAX_DEPTH` is already in effect. Per-agent `maxSubagentDepth` can tighten the limit for that agent’s child runs, but cannot relax an inherited stricter limit.
|
|
835
854
|
|
|
855
|
+
### `agentManager.newShortcut`
|
|
856
|
+
|
|
857
|
+
```json
|
|
858
|
+
{
|
|
859
|
+
"agentManager": {
|
|
860
|
+
"newShortcut": "shift+ctrl+n"
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
```
|
|
864
|
+
|
|
865
|
+
Sets the `/agents` list shortcut for opening the new agent/chain template picker. The default is `shift+ctrl+n`; use Pi key names such as `ctrl+n` if your terminal cannot distinguish Shift for control chords.
|
|
866
|
+
|
|
836
867
|
### `intercomBridge`
|
|
837
868
|
|
|
838
869
|
```json
|
|
@@ -959,7 +990,7 @@ Intercom delivery events:
|
|
|
959
990
|
- `subagent:control-intercom`
|
|
960
991
|
- `subagent:result-intercom`
|
|
961
992
|
|
|
962
|
-
The result watcher emits `subagent:async-complete`; `index.ts` registers the notification handler that consumes it. Control/attention events are surfaced as visible parent notices and persisted for async runs. With `pi-intercom`, needs-attention notices and grouped parent-side subagent result deliveries can reach the orchestrator over intercom.
|
|
993
|
+
The result watcher emits `subagent:async-complete`; `src/extension/index.ts` registers the notification handler that consumes it. Control/attention events are surfaced as visible parent notices and persisted for async runs. With `pi-intercom`, needs-attention notices and grouped parent-side subagent result deliveries can reach the orchestrator over intercom.
|
|
963
994
|
|
|
964
995
|
## Prompt-template integration
|
|
965
996
|
|
|
@@ -987,17 +1018,17 @@ The main runtime files are:
|
|
|
987
1018
|
|
|
988
1019
|
| File | Purpose |
|
|
989
1020
|
|------|---------|
|
|
990
|
-
| `index.ts` | Extension registration, tool registration, message/render wiring. |
|
|
991
|
-
| `agents.ts` | Agent and chain discovery, frontmatter parsing. |
|
|
992
|
-
| `subagent-executor.ts` | Main execution routing for single, parallel, chain, management, status, interrupt, and doctor actions. |
|
|
993
|
-
| `execution.ts` | Core foreground `runSync` handling. |
|
|
994
|
-
| `subagent-runner.ts` | Detached async runner. |
|
|
995
|
-
| `async-execution.ts` | Background launch support. |
|
|
996
|
-
| `async-status.ts` / `subagents-status.ts` | Status discovery and overlay UI. |
|
|
997
|
-
| `chain-execution.ts` / `chain-serializer.ts` | Chain orchestration and `.chain.md` parsing. |
|
|
998
|
-
| `agent-manager*.ts` | Agents Manager screens and editing flows. |
|
|
999
|
-
| `settings.ts` | Chain behavior, instructions, and config helpers. |
|
|
1000
|
-
| `worktree.ts` | Git worktree isolation. |
|
|
1001
|
-
| `intercom-bridge.ts` | Runtime intercom bridge instructions and diagnostics. |
|
|
1002
|
-
| `schemas.ts` / `types.ts` | Tool schemas, shared types, and event constants. |
|
|
1021
|
+
| `src/extension/index.ts` | Extension registration, tool registration, message/render wiring. |
|
|
1022
|
+
| `src/agents/agents.ts` | Agent and chain discovery, frontmatter parsing. |
|
|
1023
|
+
| `src/runs/foreground/subagent-executor.ts` | Main execution routing for single, parallel, chain, management, status, interrupt, and doctor actions. |
|
|
1024
|
+
| `src/runs/foreground/execution.ts` | Core foreground `runSync` handling. |
|
|
1025
|
+
| `src/runs/background/subagent-runner.ts` | Detached async runner. |
|
|
1026
|
+
| `src/runs/background/async-execution.ts` | Background launch support. |
|
|
1027
|
+
| `src/runs/background/async-status.ts` / `src/tui/subagents-status.ts` | Status discovery and overlay UI. |
|
|
1028
|
+
| `src/runs/foreground/chain-execution.ts` / `src/agents/chain-serializer.ts` | Chain orchestration and `.chain.md` parsing. |
|
|
1029
|
+
| `src/manager-ui/agent-manager*.ts` | Agents Manager screens and editing flows. |
|
|
1030
|
+
| `src/shared/settings.ts` | Chain behavior, instructions, and config helpers. |
|
|
1031
|
+
| `src/runs/shared/worktree.ts` | Git worktree isolation. |
|
|
1032
|
+
| `src/intercom/intercom-bridge.ts` | Runtime intercom bridge instructions and diagnostics. |
|
|
1033
|
+
| `src/extension/schemas.ts` / `src/shared/types.ts` | Tool schemas, shared types, and event constants. |
|
|
1003
1034
|
| `test/unit/` / `test/integration/` | Unit and loader-based integration tests. |
|
|
@@ -12,14 +12,17 @@ output: context.md
|
|
|
12
12
|
|
|
13
13
|
You are a requirements-to-context subagent.
|
|
14
14
|
|
|
15
|
-
Analyze the user request against the codebase, gather the
|
|
15
|
+
Analyze the user request against the codebase, gather the relevant high-value context, and produce structured handoff material for planning and GPT-5.5 subagent prompts. The handoff must be complete enough that the next agent does not have to rediscover the same issue from scratch.
|
|
16
16
|
|
|
17
17
|
Working rules:
|
|
18
18
|
- Read the request carefully before touching the codebase.
|
|
19
19
|
- Search the codebase for relevant files, patterns, dependencies, and constraints.
|
|
20
|
-
-
|
|
20
|
+
- Read every file needed to fully understand the issue, not just the first matching symbol. Follow imports, callers, tests, fixtures, configuration, docs, and adjacent patterns until the problem, likely solution space, and validation path are clear.
|
|
21
|
+
- If a referenced URL, issue, PR, plan, design doc, or local file is part of the request, read or fetch it before writing the handoff.
|
|
22
|
+
- Conduct web research when the task depends on external APIs, libraries, current best practices, recently changed behavior, or when local evidence is not enough to know how to solve the problem correctly. Use `web_search` if it is available; otherwise use whatever equivalent research capability is available.
|
|
23
|
+
- Keep searching or researching until you can state the likely implementation approach, risks, and validation with evidence. If a gap remains, call it out explicitly instead of implying certainty.
|
|
21
24
|
- Write the requested output files clearly and concretely.
|
|
22
|
-
- Prefer distilled, high-signal context over exhaustive dumps.
|
|
25
|
+
- Prefer distilled, high-signal context over exhaustive dumps, but do not omit a relevant file or source just to keep the handoff short.
|
|
23
26
|
|
|
24
27
|
When running in a chain, expect to generate two files in the chain directory:
|
|
25
28
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-subagents",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.2",
|
|
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",
|
|
@@ -26,8 +26,7 @@
|
|
|
26
26
|
"pi-subagents": "install.mjs"
|
|
27
27
|
},
|
|
28
28
|
"files": [
|
|
29
|
-
"
|
|
30
|
-
"!*.test.ts",
|
|
29
|
+
"src/**/*.ts",
|
|
31
30
|
"*.mjs",
|
|
32
31
|
"agents/",
|
|
33
32
|
"skills/**/*",
|
|
@@ -43,7 +42,7 @@
|
|
|
43
42
|
},
|
|
44
43
|
"pi": {
|
|
45
44
|
"extensions": [
|
|
46
|
-
"./index.ts"
|
|
45
|
+
"./src/extension/index.ts"
|
|
47
46
|
],
|
|
48
47
|
"skills": [
|
|
49
48
|
"./skills"
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Parallel context builders for planning handoff
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Launch fresh-context `context-builder` subagents in parallel to build grounded handoff context for planning or implementation.
|
|
6
|
+
|
|
7
|
+
Use the `subagent` tool in chain mode with a single parallel step, not top-level parallel tasks, so relative output files live under the temporary chain directory. Use `context: "fresh"` unless I explicitly ask for forked context. Give every parallel task a distinct `output` path, for example:
|
|
8
|
+
|
|
9
|
+
- `context-build/request-and-scope.md`
|
|
10
|
+
- `context-build/codebase-and-patterns.md`
|
|
11
|
+
- `context-build/validation-and-risks.md`
|
|
12
|
+
|
|
13
|
+
Do not write these context artifacts into the repository unless I explicitly ask for persistent files.
|
|
14
|
+
|
|
15
|
+
Treat the slash command arguments as the primary request, target, or focus:
|
|
16
|
+
|
|
17
|
+
$@
|
|
18
|
+
|
|
19
|
+
If the invocation provides a URL, issue link, file path, plan path, or freeform request, read or fetch that target before assigning builder angles, then pass the target explicitly into every `context-builder` task.
|
|
20
|
+
|
|
21
|
+
Choose two or three strong builders based on the request. Prefer three only when the scope benefits from independent context slices. These are examples, not fixed defaults:
|
|
22
|
+
|
|
23
|
+
1. Request and scope
|
|
24
|
+
Clarify the actual goal, user intent, constraints, non-goals, open questions, and decisions that affect the handoff.
|
|
25
|
+
|
|
26
|
+
2. Codebase and patterns
|
|
27
|
+
Inspect relevant files, call paths, existing abstractions, tests, package constraints, and local conventions that the next agent must follow.
|
|
28
|
+
|
|
29
|
+
3. Validation and risks
|
|
30
|
+
Identify likely failure modes, edge cases, test strategy, commands to run, dependency/API concerns, and escalation rules.
|
|
31
|
+
|
|
32
|
+
Adapt the angles when the request calls for it:
|
|
33
|
+
- Issue or PR URL: include issue requirements, acceptance criteria, linked discussion, and likely affected files.
|
|
34
|
+
- Plan file: include plan consistency, missing context, implementation sequence, and validation readiness.
|
|
35
|
+
- External API/library work: include current docs or primary sources through `web_search` when needed.
|
|
36
|
+
- Large refactor: include module boundaries, dependency direction, migration/cutover risks, and testability.
|
|
37
|
+
- UI/product work: include user flow, accessibility, copy, visual constraints, and implementation touchpoints.
|
|
38
|
+
|
|
39
|
+
Ask each builder to produce a compact handoff file with:
|
|
40
|
+
- relevant files and line ranges;
|
|
41
|
+
- key snippets or patterns, not full dumps;
|
|
42
|
+
- constraints and invariants;
|
|
43
|
+
- risks and unknowns;
|
|
44
|
+
- validation commands or next-best checks;
|
|
45
|
+
- a `meta-prompt` section for the next planner or GPT-5.5 subagent.
|
|
46
|
+
|
|
47
|
+
After the builders return, synthesize their outputs into:
|
|
48
|
+
- the most important context the next agent needs;
|
|
49
|
+
- the recommended meta-prompt to use next;
|
|
50
|
+
- open questions or assumptions;
|
|
51
|
+
- the output artifact paths.
|
|
52
|
+
|
|
53
|
+
Do not start implementation from this command unless I explicitly ask for it.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Parallel research/context builders into an implementation handoff plan
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Use parallel subagents to understand the request, compare any external references, inspect the local codebase, and produce a grounded implementation handoff plan with a final GPT-5.5-ready meta-prompt.
|
|
6
|
+
|
|
7
|
+
Primary request, target, or focus:
|
|
8
|
+
|
|
9
|
+
$@
|
|
10
|
+
|
|
11
|
+
Use `context: "fresh"` unless I explicitly ask for forked context. First read or fetch any URLs, issue links, PRs, screenshots, plans, docs, or local files mentioned in the request. Treat them as primary scope, not optional context.
|
|
12
|
+
|
|
13
|
+
Use the `subagent` tool in chain mode:
|
|
14
|
+
|
|
15
|
+
1. First step: a parallel group.
|
|
16
|
+
- `researcher`, when the request includes external references, APIs, libraries, docs, current best practices, or prompt-guidance research.
|
|
17
|
+
- `context-builder` for local codebase context.
|
|
18
|
+
- Add a second `context-builder` only when the scope is large enough to benefit from a separate implementation-strategy pass.
|
|
19
|
+
|
|
20
|
+
2. Second step: a synthesis `context-builder` that reads the parallel findings and writes the final handoff plan and meta-prompt.
|
|
21
|
+
|
|
22
|
+
Use distinct output paths under the chain directory. Example outputs:
|
|
23
|
+
- `handoff/external-reference.md`
|
|
24
|
+
- `handoff/local-context.md`
|
|
25
|
+
- `handoff/implementation-strategy.md`
|
|
26
|
+
- `handoff/final-handoff-plan.md`
|
|
27
|
+
|
|
28
|
+
Do not write these artifacts into the repository unless I explicitly ask for persistent files.
|
|
29
|
+
|
|
30
|
+
Role guidance:
|
|
31
|
+
|
|
32
|
+
External reference researcher:
|
|
33
|
+
- Study linked projects, docs, issues, examples, source code, or prompt guidance.
|
|
34
|
+
- Identify the behavior, API, implementation files, constraints, and transferable ideas.
|
|
35
|
+
- Conduct web research if needed. Use `web_search` if it is available; otherwise use whatever equivalent research capability is available.
|
|
36
|
+
- Return source links, repo paths, key evidence, risks, and what matters for this implementation.
|
|
37
|
+
|
|
38
|
+
Local context-builder:
|
|
39
|
+
- Read all files needed to fully understand the local issue, not just the first match.
|
|
40
|
+
- Follow imports, callers, tests, fixtures, configuration, docs, and adjacent patterns until the local problem, solution space, and validation path are clear.
|
|
41
|
+
- Return relevant file paths and line ranges, current architecture, constraints, tests, risks, and open questions.
|
|
42
|
+
|
|
43
|
+
Implementation-strategy context-builder, when used:
|
|
44
|
+
- Compare the external evidence against the local architecture.
|
|
45
|
+
- Propose the safest implementation shape, files likely to change, edge cases, validation commands, and decisions that need approval.
|
|
46
|
+
- Stay review/planning-only unless I explicitly ask for implementation.
|
|
47
|
+
|
|
48
|
+
Final synthesis context-builder:
|
|
49
|
+
- Read the parallel outputs and produce one concise handoff plan.
|
|
50
|
+
- Include what the feature/change should do, what the external reference teaches, what the local codebase implies, the recommended approach, likely files to change, constraints, non-goals, validation, risks, and unresolved questions.
|
|
51
|
+
- End with a compact GPT-5.5-ready meta-prompt for the next worker/planner.
|
|
52
|
+
|
|
53
|
+
After the chain returns, synthesize the result for me with:
|
|
54
|
+
- the recommended approach;
|
|
55
|
+
- artifact paths;
|
|
56
|
+
- the final meta-prompt;
|
|
57
|
+
- any questions or assumptions that remain.
|
|
58
|
+
|
|
59
|
+
Do not start implementation from this command unless I explicitly ask for it.
|
|
@@ -37,4 +37,8 @@ While reviewers run, do your own narrow inspection if useful. After they return,
|
|
|
37
37
|
|
|
38
38
|
Do not blindly apply every reviewer suggestion. Ask before applying fixes unless I already told you to address review feedback.
|
|
39
39
|
|
|
40
|
+
Additional review target or focus from the slash command invocation:
|
|
41
|
+
|
|
40
42
|
$@
|
|
43
|
+
|
|
44
|
+
If the invocation provides a URL, issue link, file path, plan path, or freeform focus, treat it as the primary review scope. Read or fetch that target before assigning reviewer angles, and pass the target explicitly into each reviewer task.
|
|
@@ -40,10 +40,72 @@ Humans often use the slash-command layer instead:
|
|
|
40
40
|
Prefer the tool when you are writing agent logic. Prefer the slash commands when
|
|
41
41
|
you are guiding a human through an interactive flow.
|
|
42
42
|
|
|
43
|
-
Packaged prompt shortcuts are also available for repeatable workflows:
|
|
43
|
+
Packaged prompt shortcuts are also available for repeatable workflows. Treat them as reusable orchestration recipes, not just human slash commands. When the user asks for one of these shapes, or when the workflow clearly fits, apply the same pattern directly with `subagent(...)` and other tools:
|
|
44
44
|
- `/parallel-review` — fresh-context reviewers with distinct review angles, then synthesis
|
|
45
45
|
- `/parallel-research` — combine `researcher` and `scout` for external evidence plus local code context
|
|
46
|
+
- `/parallel-context-build` — parallel `context-builder` passes that produce planning handoff context and meta-prompts
|
|
47
|
+
- `/parallel-handoff-plan` — external-reference research plus local `context-builder` passes, followed by a synthesis handoff plan and GPT-5.5-ready meta-prompt
|
|
46
48
|
- `/gather-context-and-clarify` — scout/research first, then ask the user clarifying questions with `interview`
|
|
49
|
+
- `/parallel-cleanup` — two fresh-context reviewers (deslop + verbosity passes) for an adversarial cleanup review of the current diff
|
|
50
|
+
|
|
51
|
+
## Applying Prompt Techniques Without Slash Commands
|
|
52
|
+
|
|
53
|
+
The prompt templates in `prompts/` encode workflows the parent agent can run on demand. If the user provides a URL, issue, PR, plan, local file, screenshot, or freeform target, treat that target as the primary scope: read or fetch it before launching children, then include it explicitly in every child task. Do not depend on the parent conversation history when the recipe calls for fresh context.
|
|
54
|
+
|
|
55
|
+
### Parallel review technique
|
|
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.
|
|
58
|
+
|
|
59
|
+
### Parallel research technique
|
|
60
|
+
|
|
61
|
+
Use this when the question needs both external evidence and local implications. Combine `researcher` for official docs, specs, ecosystem behavior, recent changes, benchmarks, and primary sources with `scout` for repository files, patterns, constraints, tests, and likely integration points. Give each child a distinct angle: external evidence, local code context, and practical tradeoffs. Ask for source links or file ranges, confidence level, gaps, and decision implications. Do not ask these children to edit unless implementation was explicitly requested.
|
|
62
|
+
|
|
63
|
+
### Parallel context-build technique
|
|
64
|
+
|
|
65
|
+
Use this before planning or implementation when a stronger handoff is needed. Run a chain with one parallel step of `context-builder` agents rather than top-level parallel tasks, so relative output files live under the temporary chain directory. Give every task a distinct output path such as `context-build/request-and-scope.md`, `context-build/codebase-and-patterns.md`, and `context-build/validation-and-risks.md`. Choose two or three builders: request/scope, codebase/patterns, and validation/risks. Each builder must read every relevant file needed to understand its slice, follow imports/callers/tests/docs/config, conduct tool-available web research when needed, and include a compact `meta-prompt` section. The parent synthesizes the outputs into important context, recommended next meta-prompt, open questions, assumptions, and artifact paths.
|
|
66
|
+
|
|
67
|
+
Example shape:
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
subagent({
|
|
71
|
+
chain: [{
|
|
72
|
+
parallel: [
|
|
73
|
+
{ agent: "context-builder", task: "Build request/scope context for: ...", output: "context-build/request-and-scope.md" },
|
|
74
|
+
{ agent: "context-builder", task: "Build codebase/pattern context for: ...", output: "context-build/codebase-and-patterns.md" },
|
|
75
|
+
{ agent: "context-builder", task: "Build validation/risk context for: ...", output: "context-build/validation-and-risks.md" }
|
|
76
|
+
]
|
|
77
|
+
}],
|
|
78
|
+
context: "fresh"
|
|
79
|
+
})
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Parallel handoff-plan technique
|
|
83
|
+
|
|
84
|
+
Use this when the user needs a solution brief or implementation-ready handoff from an external reference plus local code context, such as “study this library behavior, inspect our codebase, then produce a GPT-5.5 worker prompt.” Run a chain with a first parallel group and a second synthesis `context-builder` step. The first group usually includes `researcher` for external projects/docs/prompt guidance and `context-builder` for local code context; add a second `context-builder` for implementation strategy only when the scope is large enough to benefit. Use distinct output paths under `handoff/`, then have the synthesis `context-builder` read those outputs and write `handoff/final-handoff-plan.md` with the recommended approach, likely files, constraints, non-goals, validation, risks, unresolved questions, and final compact GPT-5.5-ready meta-prompt.
|
|
85
|
+
|
|
86
|
+
Example shape:
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
subagent({
|
|
90
|
+
chain: [
|
|
91
|
+
{ parallel: [
|
|
92
|
+
{ agent: "researcher", task: "Research the external reference and transferable implementation ideas for: ...", output: "handoff/external-reference.md" },
|
|
93
|
+
{ agent: "context-builder", task: "Build local codebase context for: ...", output: "handoff/local-context.md" },
|
|
94
|
+
{ agent: "context-builder", task: "Compare evidence and propose implementation strategy for: ...", output: "handoff/implementation-strategy.md" }
|
|
95
|
+
] },
|
|
96
|
+
{ agent: "context-builder", task: "Read {previous} and synthesize the final handoff plan and GPT-5.5-ready meta-prompt.", output: "handoff/final-handoff-plan.md" }
|
|
97
|
+
],
|
|
98
|
+
context: "fresh"
|
|
99
|
+
})
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Gather-context-and-clarify technique
|
|
103
|
+
|
|
104
|
+
Use this at the start of non-trivial work. Launch `scout` for local context and `researcher` only when external docs, recent sources, ecosystem context, or primary evidence would materially improve understanding. Ask children for concise findings plus remaining clarification questions. Then synthesize what is known and use `interview` to ask the unresolved questions needed for shared understanding before planning or implementing.
|
|
105
|
+
|
|
106
|
+
### Parallel cleanup technique
|
|
107
|
+
|
|
108
|
+
Use this after implementation when the user wants cleanup review or when a final pass would reduce AI-slop. Launch two fresh-context `reviewer` tasks with `output: false`: one deslop pass and one verbosity pass. If the `deslop` or `verbosity-cleaner` skills are available, pass the relevant skill to that reviewer; otherwise inline the criteria. Both reviewers are review-only and should flag concrete issues with severity, file/line references, and smallest safe fixes. The parent decides what to apply and asks before making changes unless cleanup was already authorized.
|
|
47
109
|
|
|
48
110
|
## Builtin Agents
|
|
49
111
|
|
|
@@ -439,8 +501,12 @@ copying a full builtin file.
|
|
|
439
501
|
## Prompt Template Integration
|
|
440
502
|
|
|
441
503
|
The package includes prompt shortcuts for common workflows: `/parallel-review`,
|
|
442
|
-
`/parallel-research`,
|
|
443
|
-
|
|
504
|
+
`/parallel-research`, `/parallel-context-build`, `/parallel-handoff-plan`,
|
|
505
|
+
`/gather-context-and-clarify`, and `/parallel-cleanup`. Use them when the user
|
|
506
|
+
wants repeatable review, research, context handoff, implementation handoff,
|
|
507
|
+
clarification, or cleanup-review patterns. Parent agents can also apply the same
|
|
508
|
+
recipes directly with `subagent(...)` when the user describes the workflow in
|
|
509
|
+
natural language instead of invoking a slash command.
|
|
444
510
|
|
|
445
511
|
If `pi-prompt-template-model` is installed, additional user prompt templates can delegate into
|
|
446
512
|
`pi-subagents`. This is useful when a slash command should always run through a
|
|
@@ -520,6 +586,8 @@ When the user approves launching a subagent to carry out a plan or workflow, tre
|
|
|
520
586
|
- `/gather-context-and-clarify` maps to: launch `scout` and, when needed, `researcher`; synthesize findings; then use `interview` to ask every clarification question needed for shared understanding.
|
|
521
587
|
- `/parallel-review` maps to: launch fresh-context `reviewer` agents with distinct review angles; synthesize the feedback before applying anything.
|
|
522
588
|
- `/parallel-research` maps to: combine local `scout` context with external `researcher` evidence when current docs, ecosystem behavior, or API details matter.
|
|
589
|
+
- `/parallel-context-build` maps to: run a chain-mode parallel group of `context-builder` agents with distinct temp output paths, then synthesize their context and meta-prompt sections.
|
|
590
|
+
- `/parallel-handoff-plan` maps to: run external `researcher` plus local/strategy `context-builder` passes, then a synthesis `context-builder` that writes an implementation handoff plan and GPT-5.5-ready meta-prompt.
|
|
523
591
|
- `/parallel-cleanup` maps to: use review-only cleanup passes after implementation, especially for simplicity, verbosity, and redundant tests.
|
|
524
592
|
|
|
525
593
|
For feature work, use this sequence as scaffolding for parent-agent behavior:
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
import { serializeAgent } from "./agent-serializer.ts";
|
|
17
17
|
import { serializeChain } from "./chain-serializer.ts";
|
|
18
18
|
import { discoverAvailableSkills } from "./skills.ts";
|
|
19
|
-
import type { Details } from "
|
|
19
|
+
import type { Details } from "../shared/types.ts";
|
|
20
20
|
|
|
21
21
|
type ManagementAction = "list" | "get" | "create" | "update" | "delete";
|
|
22
22
|
type ManagementScope = "user" | "project";
|
|
@@ -378,16 +378,12 @@ export function handleList(params: ManagementParams, ctx: ManagementContext): Ag
|
|
|
378
378
|
const d = discoverAgentsAll(ctx.cwd);
|
|
379
379
|
const scopedAgents = allAgents(d).filter((a) => scope === "both" || a.source === "builtin" || a.source === scope).sort((a, b) => a.name.localeCompare(b.name));
|
|
380
380
|
const agents = scopedAgents.filter((a) => !a.disabled);
|
|
381
|
-
const disabledBuiltins = scopedAgents.filter((a) => a.source === "builtin" && a.disabled);
|
|
382
381
|
const chains = d.chains.filter((c) => scope === "both" || c.source === scope).sort((a, b) => a.name.localeCompare(b.name));
|
|
383
382
|
const lines = [
|
|
384
383
|
"Executable agents:",
|
|
385
384
|
...(agents.length
|
|
386
385
|
? agents.map((a) => `- ${a.name} (${a.source}${a.defaultContext ? `, context: ${a.defaultContext}` : ""}): ${a.description}`)
|
|
387
386
|
: ["- (none)"]),
|
|
388
|
-
...(disabledBuiltins.length
|
|
389
|
-
? ["", "Disabled builtins:", ...disabledBuiltins.map((a) => `- ${a.name} (${a.source}${a.defaultContext ? `, context: ${a.defaultContext}` : ""}, disabled): ${a.description}`)]
|
|
390
|
-
: []),
|
|
391
387
|
"",
|
|
392
388
|
"Chains:",
|
|
393
389
|
...(chains.length ? chains.map((c) => `- ${c.name} (${c.source}): ${c.description}`) : ["- (none)"]),
|
|
@@ -696,7 +696,7 @@ function resolveNearestProjectAgentDirs(cwd: string): { readDirs: string[]; pref
|
|
|
696
696
|
preferredDir,
|
|
697
697
|
};
|
|
698
698
|
}
|
|
699
|
-
const BUILTIN_AGENTS_DIR = path.
|
|
699
|
+
const BUILTIN_AGENTS_DIR = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "..", "agents");
|
|
700
700
|
|
|
701
701
|
export function discoverAgents(cwd: string, scope: AgentScope): AgentDiscoveryResult {
|
|
702
702
|
const userDirOld = path.join(os.homedir(), ".pi", "agent", "agents");
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as fs from "node:fs";
|
|
2
2
|
import * as path from "node:path";
|
|
3
|
-
import { discoverAgentsAll, type AgentSource } from "
|
|
4
|
-
import { isAsyncAvailable } from "
|
|
5
|
-
import { diagnoseIntercomBridge, type IntercomBridgeDiagnostic } from "
|
|
6
|
-
import { discoverAvailableSkills, type SkillSource } from "
|
|
3
|
+
import { discoverAgentsAll, type AgentSource } from "../agents/agents.ts";
|
|
4
|
+
import { isAsyncAvailable } from "../runs/background/async-execution.ts";
|
|
5
|
+
import { diagnoseIntercomBridge, type IntercomBridgeDiagnostic } from "../intercom/intercom-bridge.ts";
|
|
6
|
+
import { discoverAvailableSkills, type SkillSource } from "../agents/skills.ts";
|
|
7
7
|
import {
|
|
8
8
|
ASYNC_DIR,
|
|
9
9
|
CHAIN_RUNS_DIR,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
TEMP_ROOT_DIR,
|
|
12
12
|
type ExtensionConfig,
|
|
13
13
|
type SubagentState,
|
|
14
|
-
} from "
|
|
14
|
+
} from "../shared/types.ts";
|
|
15
15
|
|
|
16
16
|
interface DoctorPaths {
|
|
17
17
|
tempRootDir: string;
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* Toggle: async parameter (default: false, configurable via config.json)
|
|
10
10
|
*
|
|
11
11
|
* Config file: ~/.pi/agent/extensions/subagent/config.json
|
|
12
|
-
* { "asyncByDefault": true, "forceTopLevelAsync": true, "maxSubagentDepth": 1, "intercomBridge": { "mode": "always", "instructionFile": "./intercom-bridge.md" }, "worktreeSetupHook": "./scripts/setup-worktree.mjs" }
|
|
12
|
+
* { "asyncByDefault": true, "forceTopLevelAsync": true, "maxSubagentDepth": 1, "agentManager": { "newShortcut": "shift+ctrl+n" }, "intercomBridge": { "mode": "always", "instructionFile": "./intercom-bridge.md" }, "worktreeSetupHook": "./scripts/setup-worktree.mjs" }
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import * as fs from "node:fs";
|
|
@@ -18,23 +18,23 @@ import * as path from "node:path";
|
|
|
18
18
|
import type { AgentToolResult } from "@mariozechner/pi-agent-core";
|
|
19
19
|
import { type ExtensionAPI, type ExtensionContext, type ToolDefinition } from "@mariozechner/pi-coding-agent";
|
|
20
20
|
import { Box, Container, Spacer, Text, truncateToWidth, visibleWidth, wrapTextWithAnsi, type Component } from "@mariozechner/pi-tui";
|
|
21
|
-
import { discoverAgents } from "
|
|
22
|
-
import { cleanupAllArtifactDirs, cleanupOldArtifacts, getArtifactsDir } from "
|
|
23
|
-
import { cleanupOldChainDirs } from "
|
|
24
|
-
import { renderWidget, renderSubagentResult, stopResultAnimations, stopWidgetAnimation, syncResultAnimation } from "
|
|
21
|
+
import { discoverAgents } from "../agents/agents.ts";
|
|
22
|
+
import { cleanupAllArtifactDirs, cleanupOldArtifacts, getArtifactsDir } from "../shared/artifacts.ts";
|
|
23
|
+
import { cleanupOldChainDirs } from "../shared/settings.ts";
|
|
24
|
+
import { renderWidget, renderSubagentResult, stopResultAnimations, stopWidgetAnimation, syncResultAnimation } from "../tui/render.ts";
|
|
25
25
|
import { SubagentParams } from "./schemas.ts";
|
|
26
|
-
import { createSubagentExecutor } from "
|
|
27
|
-
import { createAsyncJobTracker } from "
|
|
28
|
-
import { controlNotificationKey, formatControlNoticeMessage } from "
|
|
29
|
-
import { createResultWatcher } from "
|
|
30
|
-
import { registerSlashCommands } from "
|
|
31
|
-
import { registerPromptTemplateDelegationBridge } from "
|
|
32
|
-
import { registerSlashSubagentBridge } from "
|
|
33
|
-
import { clearSlashSnapshots, getSlashRenderableSnapshot, resolveSlashMessageDetails, restoreSlashFinalSnapshots, type SlashMessageDetails } from "
|
|
34
|
-
import { inspectSubagentStatus } from "
|
|
35
|
-
import registerSubagentNotify, { type SubagentNotifyDetails } from "
|
|
36
|
-
import { SUBAGENT_CHILD_ENV } from "
|
|
37
|
-
import { formatDuration, shortenPath } from "
|
|
26
|
+
import { createSubagentExecutor } from "../runs/foreground/subagent-executor.ts";
|
|
27
|
+
import { createAsyncJobTracker } from "../runs/background/async-job-tracker.ts";
|
|
28
|
+
import { controlNotificationKey, formatControlNoticeMessage } from "../runs/shared/subagent-control.ts";
|
|
29
|
+
import { createResultWatcher } from "../runs/background/result-watcher.ts";
|
|
30
|
+
import { registerSlashCommands } from "../slash/slash-commands.ts";
|
|
31
|
+
import { registerPromptTemplateDelegationBridge } from "../slash/prompt-template-bridge.ts";
|
|
32
|
+
import { registerSlashSubagentBridge } from "../slash/slash-bridge.ts";
|
|
33
|
+
import { clearSlashSnapshots, getSlashRenderableSnapshot, resolveSlashMessageDetails, restoreSlashFinalSnapshots, type SlashMessageDetails } from "../slash/slash-live-state.ts";
|
|
34
|
+
import { inspectSubagentStatus } from "../runs/background/run-status.ts";
|
|
35
|
+
import registerSubagentNotify, { type SubagentNotifyDetails } from "../runs/background/notify.ts";
|
|
36
|
+
import { SUBAGENT_CHILD_ENV } from "../runs/shared/pi-args.ts";
|
|
37
|
+
import { formatDuration, shortenPath } from "../shared/formatters.ts";
|
|
38
38
|
import {
|
|
39
39
|
type ControlEvent,
|
|
40
40
|
type Details,
|
|
@@ -48,7 +48,7 @@ import {
|
|
|
48
48
|
SUBAGENT_ASYNC_STARTED_EVENT,
|
|
49
49
|
SUBAGENT_CONTROL_EVENT,
|
|
50
50
|
WIDGET_KEY,
|
|
51
|
-
} from "
|
|
51
|
+
} from "../shared/types.ts";
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
54
|
* Derive subagent session base directory from parent session file.
|
|
@@ -418,7 +418,7 @@ CHAIN TEMPLATE VARIABLES (use in task strings):
|
|
|
418
418
|
Example: { chain: [{agent:"agent-a", task:"Analyze {task}"}, {agent:"agent-b", task:"Plan based on {previous}"}] }
|
|
419
419
|
|
|
420
420
|
MANAGEMENT (use action field, omit agent/task/chain/tasks):
|
|
421
|
-
• { action: "list" } - discover executable agents/chains
|
|
421
|
+
• { action: "list" } - discover executable agents/chains
|
|
422
422
|
• { action: "get", agent: "name" } - full detail
|
|
423
423
|
• { action: "create", config: { name, systemPrompt, systemPromptMode, inheritProjectContext, inheritSkills, defaultContext, ... } }
|
|
424
424
|
• { action: "update", agent: "name", config: { ... } } - merge
|
|
@@ -428,6 +428,7 @@ MANAGEMENT (use action field, omit agent/task/chain/tasks):
|
|
|
428
428
|
CONTROL:
|
|
429
429
|
• { action: "status", id: "..." } - inspect an async/background run by id or prefix
|
|
430
430
|
• { action: "interrupt", id?: "..." } - soft-interrupt the current child turn and leave the run paused
|
|
431
|
+
• { action: "resume", id: "...", message: "..." } - follow up with a live async child or revive a completed single-child async run from its session
|
|
431
432
|
|
|
432
433
|
DIAGNOSTICS:
|
|
433
434
|
• { action: "doctor" } - read-only report for runtime paths, discovery, sessions, and intercom`,
|
|
@@ -475,7 +476,7 @@ DIAGNOSTICS:
|
|
|
475
476
|
};
|
|
476
477
|
|
|
477
478
|
pi.registerTool(tool);
|
|
478
|
-
registerSlashCommands(pi, state);
|
|
479
|
+
registerSlashCommands(pi, state, config);
|
|
479
480
|
|
|
480
481
|
const eventUnsubscribeStoreKey = "__piSubagentEventUnsubscribes";
|
|
481
482
|
const controlNoticeSeenStoreKey = "__piSubagentVisibleControlNotices";
|