You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/pi-subagent/README.md
+20-7Lines changed: 20 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# @henryqw/pi-subagent
2
2
3
-
Delegate one bounded task to one isolated Pi process. Main chooses role and may override model and thinking level per task.
3
+
Delegate one bounded task to one isolated Pi process. Main chooses role and model class per task.
4
4
5
5
Based on Pi's authoritative [`examples/extensions/subagent`](https://github.com/earendil-works/pi/tree/main/packages/coding-agent/examples/extensions/subagent): child processes use `pi --mode json -p --no-session`.
6
6
@@ -12,7 +12,7 @@ pi install npm:@henryqw/pi-subagent
12
12
13
13
## Configure roles
14
14
15
-
Use Pi's existing role Markdown format in package-owned `~/.pi/agent/config/pi-subagent/*.md`. No JSON config or profile layer.
15
+
Use Pi's existing role Markdown format in package-owned `~/.pi/agent/config/pi-subagent/*.md`. Configure `fast`, `balanced`, and `frontier` model routes with `/subagent`.
16
16
17
17
```markdown
18
18
---
@@ -45,22 +45,35 @@ String lists may also use comma-separated text, matching Pi's example role files
45
45
46
46
Skill entries use Pi Skill names, normally Skill directory names, not filesystem paths. At delegation time, package resolves names from Main's effective Pi Skill registry and passes matching files to child. Missing or unavailable Skills produce warning and are skipped; they do not block delegation. This preserves Main's trust and Skill collision decisions.
47
47
48
-
Pi's example `agents/` directory contains sample Role files, not another runtime mechanism. This package reuses that Markdown format but ships no presets: model choice and capabilities stay explicit in user config. No nested `agents/` directory is needed because `pi-subagent` config contains only Roles.
48
+
Pi's example `agents/` directory contains sample Role files, not another runtime mechanism. This package reuses that Markdown format but ships no presets: role capabilities and model routes stay explicit in user config. No nested `agents/` directory is needed because Roles remain Markdown files.
49
49
50
-
Reload Pi after adding or changing role files so tool description exposes current roles.
50
+
Reload Pi after adding or changing role files or manually editing model config. `/subagent` applies changes immediately.
51
51
52
52
## Execution
53
53
54
54
Main calls `delegate_task` with:
55
55
56
56
-`role`: configured role name
57
57
-`task`: one bounded task
58
-
-`model`: optional exact `provider/model`; defaults to Main model
59
-
-`thinkingLevel`: optional; defaults to Main thinking level
58
+
-`modelClass`: optional `fast`, `balanced`, or `frontier`; defaults to configured `balanced`, then Main route
59
+
60
+
Run `/subagent` once per class. Select class, authenticated text model, and supported thinking level. Config lives in `~/.pi/agent/config/pi-subagent.json`:
Explicit class routes must be configured and available. Omitted `modelClass` falls back to Main when `balanced` route is missing or stale.
60
73
61
74
Each call starts isolated child process. Ambient extensions and skills are disabled. Only role resources load. Child uses delegated working directory and normal Pi project context files, inheriting Main's project approval decision. Abort terminates child process group.
62
75
63
-
Model and thinking overrides must exist in Main model registry. Invalid role config, model, or thinking level fails before child starts.
76
+
Configured model and thinking level must exist in Main model registry. Invalid role configor explicit model class fails before child starts.
64
77
65
78
Main-visible streaming updates, final output, and errors are capped at 50 KiB of UTF-8 text. Error collection stays bounded while child runs; malformed JSON events above 1 MiB fail delegation. Truncated output ends with exact omitted-byte count.
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 configured balanced, then Main route.",
ctx.ui.notify(`${modelClass} Subagent set to ${route.model} with thinking ${thinkingLevel}.`,"info");
630
+
}catch{
631
+
ctx.ui.notify("Couldn't save pi-subagent model config.","warning");
632
+
}
633
+
},
634
+
});
635
+
524
636
pi.registerTool({
525
637
name: "delegate_task",
526
638
label: "Subagent",
527
-
description: `Delegate one bounded task to one isolated Pi Subagent. Roles: ${roleSummary()}. Select model and thinking level only when task needs a different route. Request concise conclusions and file/line references; split broad scouting work.`,
639
+
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. Request concise conclusions and file/line references; split broad scouting work.`,
0 commit comments