@narumitw/pi-subagents 0.1.23 → 0.1.25
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/README.md +46 -0
- package/package.json +1 -1
- package/src/subagents.ts +9 -0
package/README.md
CHANGED
|
@@ -48,6 +48,52 @@ Execution modes:
|
|
|
48
48
|
- **parallel + aggregator** — run parallel jobs, then pass all outputs into one fan-in agent.
|
|
49
49
|
- **chain** — run sequential steps, passing prior output with `{previous}`.
|
|
50
50
|
|
|
51
|
+
## 🧭 Proactive use
|
|
52
|
+
|
|
53
|
+
The `subagent` tool now advertises concise prompt guidance so the main Pi agent can choose it
|
|
54
|
+
without an explicit user request when delegation is a good fit.
|
|
55
|
+
|
|
56
|
+
Use `subagent` proactively for:
|
|
57
|
+
|
|
58
|
+
- Independent read-only research, broad codebase reconnaissance, or high-volume command output
|
|
59
|
+
that would clutter the main context.
|
|
60
|
+
- Parallel multi-domain investigation where each branch can return a concise summary.
|
|
61
|
+
- Independent review or verification after implementation, especially with the read-only
|
|
62
|
+
`reviewer` agent.
|
|
63
|
+
|
|
64
|
+
Do not use `subagent` for:
|
|
65
|
+
|
|
66
|
+
- Simple answers, quick targeted edits, latency-sensitive one-step work, or tasks that need
|
|
67
|
+
frequent user back-and-forth.
|
|
68
|
+
- Parallel implementation that may edit the same files or shared state; serialize write-heavy work
|
|
69
|
+
instead.
|
|
70
|
+
- Project-local agents unless the user explicitly opts into them with `agentScope: "project"` or
|
|
71
|
+
`"both"`; keep confirmation enabled for untrusted repositories.
|
|
72
|
+
|
|
73
|
+
Good delegation example:
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"tasks": [
|
|
78
|
+
{
|
|
79
|
+
"agent": "scout",
|
|
80
|
+
"task": "Research auth-related source files. Report paths and open questions. Do not edit files."
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"agent": "scout",
|
|
84
|
+
"task": "Research auth-related tests. Report coverage gaps. Do not edit files."
|
|
85
|
+
}
|
|
86
|
+
],
|
|
87
|
+
"aggregator": {
|
|
88
|
+
"agent": "reviewer",
|
|
89
|
+
"task": "Merge these findings into a concise implementation-risk summary. Use {previous}."
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Bad delegation example: do not spawn a worker just to rename one symbol in a known file; edit it
|
|
95
|
+
directly in the main conversation.
|
|
96
|
+
|
|
51
97
|
## 🚀 Examples
|
|
52
98
|
|
|
53
99
|
Run one read-only reconnaissance agent:
|
package/package.json
CHANGED
package/src/subagents.ts
CHANGED
|
@@ -597,6 +597,15 @@ export default function (pi: ExtensionAPI) {
|
|
|
597
597
|
'Default agent scope is "user" (from ~/.pi/agent/agents).',
|
|
598
598
|
'To enable project-local agents in .pi/agents, set agentScope: "both" (or "project").',
|
|
599
599
|
].join(" "),
|
|
600
|
+
promptSnippet:
|
|
601
|
+
"Delegate independent research, review, verification, or multi-step work to isolated Pi subagents.",
|
|
602
|
+
promptGuidelines: [
|
|
603
|
+
"Use subagent for independent read-only research, broad codebase reconnaissance, high-volume command output, multi-domain parallel investigation, or an independent reviewer after implementation.",
|
|
604
|
+
"Use subagent parallel mode when work splits into independent tasks; prefer read-only agents such as scout or reviewer for fan-out and serialize write-heavy implementation that touches the same files.",
|
|
605
|
+
"Do not use subagent for simple answers, quick targeted edits, latency-sensitive one-step work, or tasks requiring frequent user back-and-forth.",
|
|
606
|
+
'Do not use subagent with project-local agents unless the user explicitly wants project agents or sets agentScope to "project" or "both"; keep confirmation enabled for untrusted repositories.',
|
|
607
|
+
"When using subagent, write self-contained tasks with file paths, context, expected output, and whether the subagent may edit files.",
|
|
608
|
+
],
|
|
600
609
|
parameters: SubagentParams,
|
|
601
610
|
|
|
602
611
|
async execute(toolCallId, params, signal, onUpdate, ctx) {
|