@henryqw/pi-subagent 2.3.1 → 2.3.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/README.md +2 -0
- package/extensions/subagent.ts +11 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -25,6 +25,8 @@ pi install npm:@henryqw/pi-subagent
|
|
|
25
25
|
|
|
26
26
|
`modelClass` is `fast`, `balanced`, or `frontier`. Omitted class uses the shared `pi-subagent/delegateTask` assignment, which defaults to `balanced`. Primary route is resolved against current scoped text models; fallback is tried only before launch. If no route is usable, delegation rejects with `Run /task-models`. A started child is never retried.
|
|
27
27
|
|
|
28
|
+
Main splits broad work into independent bounded tasks and keeps integration and cross-cutting decisions. Each `task` states its objective, exact scope and exclusions, relevant context and constraints, expected deliverable, and validation. Each call uses the least capable `modelClass` that can reliably complete its task. Independent sibling calls can run concurrently; concurrent edit tasks must own non-overlapping files.
|
|
29
|
+
|
|
28
30
|
Each call starts one isolated child (`pi --mode json -p --no-session`). Ambient extensions and Skills are off. Role/caller extensions load; those packages' tools and Skills auto-load, plus any extra `skills` names. Child uses the delegated working directory and Main's project approval. Abort kills the child process group. Streaming output is capped at 50 KiB. Unused JSON event types are discarded before payload buffering; consumed or unclassifiable events above 1 MiB fail delegation.
|
|
29
31
|
|
|
30
32
|
TUI shows one row per Subagent with role, route, task, tokens, and elapsed time. Terminal rows drop after one second.
|
package/extensions/subagent.ts
CHANGED
|
@@ -350,7 +350,9 @@ async function runPi(
|
|
|
350
350
|
|
|
351
351
|
const Parameters = Type.Object({
|
|
352
352
|
role: Type.String({ description: "Configured Subagent role name" }),
|
|
353
|
-
task: Type.String({
|
|
353
|
+
task: Type.String({
|
|
354
|
+
description: "Bounded task packet: objective; exact scope and exclusions; relevant context and constraints; expected deliverable; validation. Never the whole parent request.",
|
|
355
|
+
}),
|
|
354
356
|
modelClass: Type.Optional(StringEnum(MODEL_CLASSES, {
|
|
355
357
|
description: "Classify task complexity: fast for narrow lookups or mechanical edits; balanced for normal bounded work; frontier for ambiguous, cross-cutting, or high-risk reasoning. Defaults to the shared pi-subagent/delegateTask assignment.",
|
|
356
358
|
})),
|
|
@@ -457,7 +459,14 @@ export default function subagentExtension(pi: ExtensionAPI): void {
|
|
|
457
459
|
pi.registerTool({
|
|
458
460
|
name: "delegate_task",
|
|
459
461
|
label: "Subagent",
|
|
460
|
-
description: `Delegate one bounded task to one isolated Pi Subagent. Roles: ${roleSummary()}. Choose fast for narrow work, balanced for normal work, or frontier for ambiguous and high-risk work; omit modelClass to use shared task-model settings
|
|
462
|
+
description: `Delegate one bounded, independently executable task to one isolated Pi Subagent. Roles: ${roleSummary()}. Choose fast for narrow work, balanced for normal work, or frontier for ambiguous and high-risk work; omit modelClass to use shared task-model settings.`,
|
|
463
|
+
promptSnippet: "Delegate one bounded, independently executable task to an isolated role",
|
|
464
|
+
promptGuidelines: [
|
|
465
|
+
"Before calling delegate_task, split broad work into the smallest independent bounded tasks; keep integration and cross-cutting decisions in Main.",
|
|
466
|
+
"Each delegate_task task must state its objective, exact scope and exclusions, relevant context and constraints, expected deliverable, and validation; never pass the parent request unchanged.",
|
|
467
|
+
"For each delegate_task call, choose the least capable modelClass that can reliably complete the task: fast for narrow work, balanced for normal work, and frontier only for ambiguous, cross-cutting, or high-risk work.",
|
|
468
|
+
"Submit independent delegate_task calls together for parallel execution. Parallel edits must own non-overlapping files; otherwise sequence them. Use the minimum number of Subagents needed.",
|
|
469
|
+
],
|
|
461
470
|
parameters: Parameters,
|
|
462
471
|
async execute(toolCallId, params, signal, onUpdate, ctx) {
|
|
463
472
|
const task = cleanText(params.task, "task", "delegate_task");
|