pi-subagent-manager 1.10.0 → 1.12.0

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 (95) hide show
  1. package/README.md +9 -9
  2. package/dist/index.d.ts +2 -0
  3. package/dist/index.js +790 -0
  4. package/dist/orch/checklist-integration.js +176 -0
  5. package/dist/orch/context-entries.js +6 -0
  6. package/dist/orch/cost-ledger.js +38 -0
  7. package/dist/orch/diagnostics.js +86 -0
  8. package/dist/orch/extensions.js +66 -0
  9. package/dist/orch/housekeeping-usage.js +22 -0
  10. package/dist/orch/housekeeping.js +248 -0
  11. package/dist/orch/inherited-tools.js +57 -0
  12. package/dist/orch/mailbox.js +195 -0
  13. package/dist/orch/manager.js +970 -0
  14. package/dist/orch/paths.js +69 -0
  15. package/dist/orch/prompt.js +30 -0
  16. package/dist/orch/registry.js +115 -0
  17. package/dist/orch/runtime.js +835 -0
  18. package/dist/orch/tools.js +112 -0
  19. package/dist/orch/transcript.js +165 -0
  20. package/dist/prefs/agent-import.js +188 -0
  21. package/dist/prefs/config.js +878 -0
  22. package/dist/prefs/import-discovery.js +547 -0
  23. package/{src/prefs/import-instructions.ts → dist/prefs/import-instructions.js} +0 -1
  24. package/dist/prefs/models.js +56 -0
  25. package/dist/prefs/settings.js +491 -0
  26. package/dist/types.js +1 -0
  27. package/dist/ui/agent-loader.js +63 -0
  28. package/dist/ui/agent-navigation-editor.js +168 -0
  29. package/dist/ui/cost-footer.js +209 -0
  30. package/dist/ui/dialog.js +505 -0
  31. package/dist/ui/import-picker.js +191 -0
  32. package/dist/ui/live-agent-view.js +527 -0
  33. package/dist/ui/model-picker.js +529 -0
  34. package/dist/ui/settings-ui.js +671 -0
  35. package/dist/ui/status-ui.js +470 -0
  36. package/dist/ui/thread-tree.js +142 -0
  37. package/dist/ui/tool-picker.js +331 -0
  38. package/dist/ui/transcript-tool.js +91 -0
  39. package/dist/ui/ui.js +1019 -0
  40. package/package.json +17 -5
  41. package/docs/assets/subagent-manager-demo.gif +0 -0
  42. package/docs/async-lifecycle.md +0 -153
  43. package/docs/custom-agents.md +0 -154
  44. package/docs/default-agents.md +0 -95
  45. package/docs/demo.md +0 -63
  46. package/docs/development.md +0 -74
  47. package/docs/importing-agents.md +0 -41
  48. package/docs/pi-footer.md +0 -128
  49. package/docs/research-claude.md +0 -258
  50. package/docs/research-codex.md +0 -143
  51. package/docs/research-default-agent-models.md +0 -121
  52. package/docs/research-model-audit-2026-10.md +0 -154
  53. package/docs/research-model-roles-coding.md +0 -99
  54. package/docs/research-model-roles-writing.md +0 -78
  55. package/docs/research-researcher-workflow.md +0 -97
  56. package/docs/settings.md +0 -293
  57. package/docs/subagent-extension-limitations.md +0 -98
  58. package/docs/threads.md +0 -73
  59. package/docs/tools-and-ui.md +0 -129
  60. package/src/index.ts +0 -920
  61. package/src/orch/checklist-integration.ts +0 -230
  62. package/src/orch/context-entries.ts +0 -15
  63. package/src/orch/cost-ledger.ts +0 -56
  64. package/src/orch/diagnostics.ts +0 -95
  65. package/src/orch/extensions.ts +0 -83
  66. package/src/orch/housekeeping-usage.ts +0 -47
  67. package/src/orch/housekeeping.ts +0 -348
  68. package/src/orch/inherited-tools.ts +0 -84
  69. package/src/orch/mailbox.ts +0 -261
  70. package/src/orch/manager.ts +0 -1084
  71. package/src/orch/paths.ts +0 -73
  72. package/src/orch/prompt.ts +0 -39
  73. package/src/orch/registry.ts +0 -168
  74. package/src/orch/runtime.ts +0 -1041
  75. package/src/orch/tools.ts +0 -190
  76. package/src/orch/transcript.ts +0 -186
  77. package/src/prefs/agent-import.ts +0 -245
  78. package/src/prefs/config.ts +0 -1017
  79. package/src/prefs/import-discovery.ts +0 -643
  80. package/src/prefs/models.ts +0 -74
  81. package/src/prefs/settings.ts +0 -614
  82. package/src/types.ts +0 -271
  83. package/src/ui/agent-loader.ts +0 -98
  84. package/src/ui/agent-navigation-editor.ts +0 -233
  85. package/src/ui/cost-footer.ts +0 -230
  86. package/src/ui/dialog.ts +0 -678
  87. package/src/ui/import-picker.ts +0 -231
  88. package/src/ui/live-agent-view.ts +0 -600
  89. package/src/ui/model-picker.ts +0 -701
  90. package/src/ui/settings-ui.ts +0 -830
  91. package/src/ui/status-ui.ts +0 -628
  92. package/src/ui/thread-tree.ts +0 -173
  93. package/src/ui/tool-picker.ts +0 -398
  94. package/src/ui/transcript-tool.ts +0 -142
  95. package/src/ui/ui.ts +0 -1407
package/package.json CHANGED
@@ -1,8 +1,17 @@
1
1
  {
2
2
  "name": "pi-subagent-manager",
3
- "version": "1.10.0",
3
+ "version": "1.12.0",
4
4
  "description": "Hierarchical, steerable subagent threads for pi",
5
5
  "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ },
13
+ "./package.json": "./package.json"
14
+ },
6
15
  "engines": {
7
16
  "node": ">=22.19.0"
8
17
  },
@@ -25,23 +34,26 @@
25
34
  "access": "public"
26
35
  },
27
36
  "files": [
28
- "src",
37
+ "dist/**/*.js",
38
+ "dist/index.d.ts",
29
39
  "agents",
30
- "docs",
31
40
  "README.md"
32
41
  ],
33
42
  "pi": {
34
43
  "extensions": [
35
- "./src/index.ts"
44
+ "./dist/index.js"
36
45
  ]
37
46
  },
38
47
  "scripts": {
48
+ "build": "rm -rf dist && tsc -p tsconfig.build.json",
49
+ "clean": "rm -rf dist",
39
50
  "check": "tsc --noEmit",
40
51
  "changelog": "tsx .github/scripts/changelog.ts",
41
52
  "test": "tsx --test tests/*.test.ts",
42
53
  "test:ttyd": "node .agents/skills/ttyd-testing/scripts/smoke-test.mjs && node .agents/skills/ttyd-testing/scripts/lifecycle-test.mjs",
43
54
  "test:coverage": "mkdir -p coverage && tsx --test --experimental-test-coverage --test-coverage-include='src/**' --test-reporter=spec --test-reporter-destination=stdout --test-reporter=lcov --test-reporter-destination=coverage/lcov.info tests/*.test.ts",
44
- "prepublishOnly": "npm run check && npm test",
55
+ "prepack": "npm run build",
56
+ "prepublishOnly": "npm run check && npm run build && npm test",
45
57
  "format": "prettier --write --print-width 100 src tests agents .github docs/default-agents.md README.md",
46
58
  "format:check": "prettier --check --print-width 100 src tests agents .github docs/default-agents.md README.md"
47
59
  },
@@ -1,153 +0,0 @@
1
- # Asynchronous completion and main-agent wakes
2
-
3
- A detached spawn (`wait: false`) returns while its agent is still working. Completion and reporting timeouts are separate signals: finishing cancels the agent's reporting timer, then reevaluates whether the main agent should run. It never waits for that timer to expire.
4
-
5
- With [Final Recap](settings.md#labs-final-recap-finalrecap) enabled, completed, failed, and stopped detached agents contribute to a pending completion batch. The batch becomes ready when **no detached agent is starting or running**, including nested descendants. Without Final Recap, detached settlements request ordinary wakes instead of waiting for a batch. Progress alone does not request a turn; foreground results do not request an extra completion turn. A detached pause requests an ordinary wake, not a final-result recap.
6
-
7
- The scheduler knows whether a batch is ready—not whether the user's task is finished. Both kinds of trigger tell the main agent to collect results and continue unfinished work, or give a final recap if the overall task is complete.
8
-
9
- ## Delivery and scheduling flow
10
-
11
- Root-directed events are persisted before delivery. When main is idle, their notifications enter model context without triggering a turn or appearing as the final visible chat message. A single scheduler then chooses a completion/continuation trigger or an ordinary wake.
12
-
13
- ```mermaid
14
- flowchart TD
15
- Event["Progress, timeout, or settlement"] --> Recipient{"Recipient is /root?"}
16
- Recipient -->|Yes| Mailbox["Persist root mailbox notification"]
17
- Recipient -->|No| Parent["Deliver notification to lexical parent"]
18
- Parent --> Nested{"Settlement?"}
19
- Nested -->|Yes| Reconcile["Reevaluate root mailbox and scheduler"]
20
- Nested -->|No| Stop["No root scheduling change"]
21
- Mailbox --> Reconcile
22
- Reconcile --> Enabled{"Enabled and not cancelling?"}
23
- Enabled -->|No| Hold["Do not deliver or start a turn"]
24
- Enabled -->|Yes| Drain["Deliver pending notifications if main is idle"]
25
- Drain --> Reserved{"Timer queued or automatic turn reserved?"}
26
- Reserved -->|Yes| Retain["Leave pending work for reevaluation"]
27
- Reserved -->|No| Pending{"Ready completion batch or wake intent?"}
28
- Pending -->|No| Retain
29
- Pending -->|Yes| Timer["Defer: 0 ms if idle, 100 ms if busy"]
30
- Timer --> Valid{"Same session and generation, still enabled?"}
31
- Valid -->|No| Hold
32
- Valid -->|Yes| Idle{"Main idle?"}
33
- Idle -->|No| Reconcile
34
- Idle -->|Yes| Flush["Drain mailbox and recheck live state"]
35
- Flush --> Batch{"Final Recap on, no outstanding async agents, pending results?"}
36
- Batch -->|Yes| Recap["Reserve one completion/continuation turn"]
37
- Batch -->|No| Wake{"Wake intent remains?"}
38
- Wake -->|Yes| Normal["Reserve one ordinary wake turn"]
39
- Wake -->|No| Retain
40
- Recap --> Main["Main collects results and decides what remains"]
41
- Normal --> Main
42
- Main --> Settled["Main agent_settled releases reservation"]
43
- Settled --> Reconcile
44
- ```
45
-
46
- A report-only timeout requests a wake while the child is **still running**; it does not stop the child. If a ready completion batch and timeout wake are pending at the same scheduling boundary, the completion trigger takes priority and clears the pending wake intent. Their notifications are available in that one turn. A timeout turn that already started is not retroactively merged with a later completion.
47
-
48
- The 0 ms deferral leaves the current settlement boundary and coalesces events already arriving together. The 100 ms busy retry also covers compaction, so delivery does not depend solely on a later main-agent `agent_settled` event. These are scheduling delays, not guaranteed response deadlines.
49
-
50
- ## Timing: siblings finish before their reporting timers
51
-
52
- This example has Final Recap on. Time runs downward; all three agents finish before their report deadlines.
53
-
54
- ```mermaid
55
- sequenceDiagram
56
- participant Main as Main agent
57
- participant A as Agent A
58
- participant B as Agent B
59
- participant C as Agent C
60
- participant S as Root scheduler
61
- Main->>A: Spawn detached with reporting timer
62
- Main->>B: Spawn detached with reporting timer
63
- Main->>C: Spawn detached with reporting timer
64
- Note over Main: Main settles and becomes idle
65
- A-->>S: Completed, cancel A's timer
66
- Note over S: Retain result, two async agents remain
67
- B-->>S: Completed, cancel B's timer
68
- Note over S: Retain result, one async agent remains
69
- C-->>S: Completed, cancel C's timer
70
- Note over S: Zero outstanding, defer and recheck
71
- S->>Main: One completion/continuation trigger
72
- Note over Main,C: No reporting timer had to expire
73
- alt More work remains
74
- Main->>Main: Collect results and continue the task
75
- opt Another detached batch is needed
76
- Main->>C: Spawn new work or resume retained work
77
- end
78
- else Overall task is complete
79
- Main->>Main: Give final recap
80
- end
81
- Main-->>S: agent_settled, release turn reservation
82
- ```
83
-
84
- “Batch” is a scheduling group, not a separate job object. Readiness is checked against the manager's current detached-agent count. New detached work can make the next completion batch wait again.
85
-
86
- ## Timing: a nested descendant finishes last
87
-
88
- A nested result still belongs to its lexical parent. Its settlement must also reevaluate the root scheduler because the global outstanding count includes that descendant.
89
-
90
- ```mermaid
91
- sequenceDiagram
92
- participant Main as Main agent
93
- participant A as Parent A
94
- participant B as Sibling B
95
- participant C as Child C
96
- participant S as Root scheduler
97
- Main->>A: Spawn detached
98
- Main->>B: Spawn detached
99
- A->>C: Spawn detached child
100
- A-->>S: A completes, retain root result
101
- B-->>S: B completes, retain root result
102
- Note over S: C is still active, so no completion turn
103
- C-->>A: C completes, deliver result to retained parent
104
- C-->>S: Settlement reevaluates global readiness
105
- Note over S: Zero outstanding, root batch is ready
106
- S->>Main: Completion/continuation trigger for pending root results
107
- ```
108
-
109
- C's result is not copied into the root mailbox by this path. The main agent can inspect descendant output when needed. Delivery to a retained parent does not itself restart that parent.
110
-
111
- ## Timing: busy main, coalesced signals, and follow-up work
112
-
113
- Final Recap is on here. A timeout and the last completion arrive during compaction. Later, the automatic turn launches dependent work that finishes before main settles.
114
-
115
- ```mermaid
116
- sequenceDiagram
117
- participant Main as Main agent
118
- participant Child as Detached agent
119
- participant S as Root scheduler
120
- Note over Main: Busy with compaction
121
- Child-->>S: Report timeout, child keeps running
122
- S->>S: Persist notification, retain wake intent
123
- Child-->>S: Last completion, clear reporting timer
124
- S->>S: Persist result, completion batch ready
125
- loop While main remains busy
126
- S->>S: Retry after 100 ms, recheck session and idle state
127
- end
128
- Note over Main: Compaction ends, no agent_settled required
129
- S->>Main: Deliver notifications and one completion trigger
130
- Note over S: Clear wake intent, reserve automatic turn
131
- Main->>Child: Launch dependent detached work
132
- Child-->>S: Dependent work completes while main is busy
133
- S->>S: Retain new result, do not interrupt main
134
- Main-->>S: agent_settled, release reservation
135
- S->>S: Reevaluate pending results and defer
136
- S->>Main: One follow-up completion/continuation trigger
137
- Main->>Main: Continue remaining work or give final recap
138
- ```
139
-
140
- ## Settings, cancellation, and persistence
141
-
142
- - **Subagent Mode Off:** suppresses notification delivery and automatic turns. Matching-session mailbox entries remain available for reconciliation when enabled. **Final Recap off** changes detached completion behavior to ordinary wakes; it is not a master switch for all automatic turns.
143
- - **One automatic turn at a time:** `rootTurnRunning` reserves a requested turn until main's `agent_settled`. Results arriving during it remain pending for a follow-up. The reservation covers both ordinary wakes and completion/continuation turns.
144
- - **Session changes:** tree navigation, switching, and forking cancel scheduled work and suppress cancellation-generated turns while stopping old threads. Attaching a session changes the generation; shutdown cancels the timer and changes the generation too. Deferred callbacks recheck session identity and generation before acting.
145
- - **Branch-local recovery:** root mailbox entries carry `rootSessionId` and a unique `details.mailboxId`. Delivered `pi-subagent:update` messages identify notifications already placed in context. Completion-trigger messages (`pi-subagent:final-recap`) record the completion `mailboxIds` consumed by that batch, so reconciliation does not recap those same IDs again. Ordinary wake intent is an in-memory flag, not a separate durable acknowledgment log.
146
-
147
- These records track notification delivery and trigger consumption, not successful completion of the user's task. The scheduler calls `pi.sendMessage` with `triggerTurn: true`; it does not receive an acknowledgment that the resulting model turn succeeded.
148
-
149
- ## Implementation and regression coverage
150
-
151
- - [`src/index.ts`](../src/index.ts): `delivery`, `pendingRootNotifications`, `pendingSummaries`, `scheduleRootTurn`, and session lifecycle hooks.
152
- - [`src/orch/manager.ts`](../src/orch/manager.ts): `outstandingAsync`, reporting timers, and terminal-state settlement.
153
- - [`tests/final-recap-integration.test.ts`](../tests/final-recap-integration.test.ts): all six completion orders for three timed siblings, nested-last completion, busy-state retry, timeout/completion coalescing, and completion during an automatic continuation. The compaction case simulates the SDK's busy state; it does not run a content-compaction pass.
@@ -1,154 +0,0 @@
1
- # Write your own agent
2
-
3
- A full agent type is a Markdown file: YAML frontmatter on top, system prompt below.
4
- A settings-only customization is a sparse YAML overlay.
5
-
6
- ## 1. Pick a location
7
-
8
- | Scope | Directory |
9
- | ------- | ------------------------------------------------------------------------------------------- |
10
- | User | `<pi-agent-dir>/subagent-manager/agents/` (normally `~/.pi/agent/subagent-manager/agents/`) |
11
- | Project | `<cwd>/.pi/agent/subagent-manager/agents/` — loaded only when pi trusts the project |
12
-
13
- Precedence: **project > user > bundled**. Markdown definitions replace lower-layer
14
- definitions; YAML overlays inherit any fields they do not specify.
15
-
16
- ## Tweak settings or fork the agent?
17
-
18
- Two ways to customize a bundled agent. Pick one per agent — a scope (user or
19
- project) cannot hold both a `.md` and a `.yml` for the same name.
20
-
21
- | | Tweak settings (`<name>.yml`) | Fork agent (`<name>.md`) |
22
- |---|---|---|
23
- | What it is | Settings-only override merged on top of the bundled definition | Full copy that replaces the bundled definition |
24
- | System prompt | Stays bundled; you keep receiving prompt updates | Copied; you own it, bundled prompt updates no longer apply |
25
- | Editable | Settings (models, tools, thinking, color, icon, description) | Everything, including name and system prompt |
26
- | File | Plain YAML mapping, no frontmatter, no Markdown body | YAML frontmatter on top, system prompt below |
27
-
28
- `~/.pi/agent/subagent-manager/agents/coder.yml`:
29
-
30
- ```yaml
31
- thinkingLevel: low
32
- tools:
33
- allow:
34
- - read
35
- - grep
36
- - agent_update
37
- - agent_pause
38
- ```
39
-
40
- Only listed fields override; everything else follows the lower-layer definition,
41
- so untouched models, settings, descriptions, and prompts keep tracking extension
42
- updates. `tools.allow` and `tools.block` merge independently: changing one does
43
- not pin the other. Lists replace the corresponding list, rather than appending.
44
- An empty tool list (`[]`) is an explicit empty list.
45
-
46
- Omit a field to inherit it. Set an optional field to `null` to **remove** it from
47
- the effective definition, not to restore the bundled value: `models: null` uses
48
- the parent/default model; `icon: null` hides the icon; `tools.allow: null` removes
49
- the allow list while keeping the inherited block list; `tools: null` removes the
50
- whole policy. To restore inheritance, delete that setting from the YAML file.
51
- `name` is optional and, when present, must match the filename. `.yml` and `.yaml`
52
- are both supported. An override needs a matching lower-layer agent — an orphan
53
- YAML file is rejected. Prompt fields/bodies are not allowed in YAML overlays.
54
-
55
- In `/agents types`, editing a bundled agent asks you to pick one mode first,
56
- and settings stay locked until you choose. **Tweak settings** starts with an
57
- empty overlay (`{}` when saved unchanged), not a copy of the definition. Saving
58
- writes only changed settings and retains existing explicit overrides, even if
59
- an override currently matches a default. Saving to another scope writes the
60
- edits into that scope without copying unchanged values from the displayed
61
- scope. Project overlays inherit user customizations; user overlays inherit
62
- bundled definitions. Overrides cannot rename the agent or edit the system
63
- prompt — fork it instead. Full Markdown forks remain full copies.
64
-
65
- To undo a fork or override, choose **Reset to bundled** (after Save) in the editor.
66
- It deletes the customization file after confirmation and the lower-layer agent
67
- applies again (the user customization, if any, or the shipped definition).
68
-
69
- These are the only locations read. Other packages' `~/.pi/agent/agents` or `.pi/agents` are ignored — use [`/agents import`](importing-agents.md) for those.
70
-
71
- ## 2. Write the file
72
-
73
- `~/.pi/agent/subagent-manager/agents/api-scout.md`:
74
-
75
- ```markdown
76
- ---
77
- name: api-scout
78
- description: Investigate APIs and find evidence before implementation
79
- thinkingLevel: high
80
- icon: "\uf002"
81
- models:
82
- - anthropic/claude-sonnet-4-6
83
- - openai/gpt-5
84
- tools:
85
- allow: [read, grep, find, ls, agent_update, agent_pause]
86
- ---
87
-
88
- You are an API scout. Read the relevant source and docs,
89
- report concrete findings with file paths, and do not modify files.
90
- ```
91
-
92
- ## 3. Load it
93
-
94
- Run `/agents reload`. Diagnostics show any errors. Or just start a new turn — definitions reload after model turns.
95
-
96
- Ask the main model to use it: _"spawn an api-scout at `stripe-webhooks` to check how retries work"_.
97
-
98
- ## Fields
99
-
100
- | Field | Required | What it does |
101
- | ------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
102
- | `name` | yes | Type name used in `agent_spawn` |
103
- | `description` | yes | Shown to the parent model so it knows when to pick this type |
104
- | `models` | no | Ordered `provider/model-id` preferences. How they're used depends on [Model Picking](settings.md#model-picking-modelselection). Omit to inherit the parent's model. |
105
- | `thinkingLevel` | no | `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max`. Clamped to what the model supports. |
106
- | `tools` | no | `allow` / `block` lists of exact tool names. Applied per [Tool Filtering](settings.md#tool-filtering-toolfiltering). |
107
- | `color` | no | pi semantic color (`accent`, `success`, `warning`, `error`, `muted`, `dim`) for the type pill and path. Default `accent`. |
108
- | `icon` | no | Single literal Nerd Font glyph. Displayed only with **[labs] Nerd Font icons** enabled; omit for text-only labels. |
109
- | `modelSuggestions` | no | Plain model names (e.g. `sonnet-5.5`) that rank the model picker's search. **Never** select a model at runtime. |
110
- | `model` | no | Deprecated single-model alias. Still parsed; saved back as `models`. |
111
-
112
- The Markdown body is the system prompt.
113
-
114
- ## Icons [labs]
115
-
116
- The optional `icon` field works for any custom or bundled agent type. Choose a glyph from the [Nerd Fonts cheat sheet](https://www.nerdfonts.com/cheat-sheet) and copy the actual character into quoted YAML, for example:
117
-
118
- ```yaml
119
- icon: "\uf002" # nf-fa-search, U+F002
120
- ```
121
-
122
- Use one Unicode private-use character, not an icon name (`nf-fa-search`), codepoint text (`U+F002`), emoji, or multiple glyphs. Both BMP and supplementary Nerd Font glyphs are supported. Omit the field to remove an icon; empty `icon:` values are invalid.
123
-
124
- In `/agents types`, select **[labs] Icon** and paste the glyph, then save the agent. Leave the editor blank to remove it. You can configure icons while the feature is off; enable **[labs] Nerd Font icons** in `/agents` settings to see them. A Nerd Font must also be selected in your terminal. Icons supplement names, never replace them.
125
-
126
- ## Tips
127
-
128
- - **Tools default to none.** With default filtering, an empty or missing `allow` list means the agent gets no tools. List what it needs.
129
- - **To delegate**, a type needs `agent_spawn` and `agent_wait` in `allow`.
130
- - **Include `agent_update` / `agent_pause`** so the agent can report progress or hand back early.
131
- - **Model matching is exact.** If no preference is available (or scoped, in scoped mode), spawn fails — no silent fallback.
132
- - **Unknown tool names fail** rather than widening access.
133
- - **Edits affect new threads only.** Running and retained threads keep the definition they started with.
134
-
135
- ## Editing in the TUI
136
-
137
- `/agents types` opens a browser and two-column editor.
138
-
139
- | Key | Action |
140
- | -------- | ---------------------------------------------- |
141
- | ↑↓ / Tab | Select field |
142
- | Enter | Edit field |
143
- | Ctrl+S | Save (or apply a multiline field to the draft) |
144
- | Esc | Discard draft |
145
-
146
- The model picker lists selected models first, in fallback order. **Enter** toggles a model; **w/s** moves a selected model up/down in browse mode. **/** or **Tab** enters search, where typing (including w/s) filters; **Tab** returns to browsing while keeping the filter. Other typed letters also start search. Unselected models are ranked by fuzzy match against `modelSuggestions`, scoped models first.
147
-
148
- **External editor** opens the whole Markdown definition in `$VISUAL`, `$EDITOR`,
149
- or `vi` in fork mode. For an overlay, edit its YAML file directly and reload.
150
-
151
- ## Errors
152
-
153
- - Malformed files and duplicate names in the same scope show diagnostics and disable only the affected type.
154
- - An unavailable tool or model fails the spawn with a clear message.
@@ -1,95 +0,0 @@
1
- # Bundled task-specialized agents
2
-
3
- Six packaged roles are Markdown definitions in `agents/`. User/project definitions can override any role. Retained threads keep their saved definitions until replaced through the normal configuration flow.
4
-
5
- The original model shortlist was audited **October 4, 2026 local time (October 3 UTC)**. The suggestions below include subsequent user-selected updates checked against the Pi and OpenRouter model catalogs. Read the [source-backed model audit](research-model-audit-2026-10.md) for historical measurements and qualifications, and [researcher workflow research](research-researcher-workflow.md) for retrieval guidance. The older [five-role shortlist](research-default-agent-models.md) is historical.
6
-
7
- ## Role routing
8
-
9
- | Role | Work and boundaries | Thinking |
10
- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
11
- | `architect` | Design, ambiguity, tradeoffs, verifiable plans, and explicitly authorized coordination. Not an implementation mandate or an unlimited research job. | `high` |
12
- | `coder` | Complex or sustained implementation, refactoring, debugging, and frontend UI through a checked patch. | `high` |
13
- | `researcher` | Source-backed local/remote codebase, library/API, and internet research; verification and synthesis. No implementation edits or delegation. | `medium` |
14
- | `reviewer` | Scoped, non-mutating correctness/security review with demonstrable defects and minimal local repair suggestions. No implementation or comment quota. | `high` |
15
- | `tasker` | Bounded coding, scripts, SQL/database queries, git housekeeping, diagnostics, and lookups. Escalate complex or sustained implementation. | `low` |
16
- | `writer` | Original or revised prose for a stated audience and voice, using supplied/local evidence. No invented facts or live evidence gathering. | `medium` |
17
-
18
- Use tasker for one symbol or a few facts already in the repository; use researcher for tracing behavior across a codebase, versioned API evidence, outside sources, or contradictory claims. Researcher gathers what is true; architect decides what to build. Writer turns verified material into prose.
19
-
20
- Existing user/project `researcher` overrides still win over the new packaged default. Bundled `worker`, `explorer`, and `designer` remain absent: bounded work routes to tasker, complex or sustained implementation to coder, and source investigation to researcher. Nothing is automatically renamed.
21
-
22
- ## Nerd Font icons
23
-
24
- The optional **[labs] Nerd Font icons** [setting](settings.md#labs-nerd-font-icons-nerdfonticons) is off by default and requires a Nerd Font in your terminal. Each default has a distinct literal `icon` in its frontmatter:
25
-
26
- | Role | Nerd Fonts identifier | Codepoint | Why this icon |
27
- | ------------ | --------------------- | --------- | --------------------------------------------- |
28
- | `architect` | `nf-md-floor_plan` | `U+F0821` | Structure, layout, and architecture planning. |
29
- | `coder` | `nf-fa-code` | `U+F121` | Implementation and source code. |
30
- | `researcher` | `nf-fa-search` | `U+F002` | Evidence gathering and investigation. |
31
- | `reviewer` | `nf-cod-inspect` | `U+EBD1` | Inspecting code for concrete defects. |
32
- | `tasker` | `nf-oct-checklist` | `U+F45E` | Bounded tasks and checklist-style execution. |
33
- | `writer` | `nf-fa-pencil` | `U+F040` | Writing and editorial work. |
34
-
35
- Names and codepoints were checked against the [official Nerd Fonts glyph mapping](https://raw.githubusercontent.com/ryanoasis/nerd-fonts/master/glyphnames.json); the [cheat sheet](https://www.nerdfonts.com/cheat-sheet) offers previews and character copying. These are role-based design choices, not font-detected fallbacks. User/project overrides may choose another icon or omit it entirely. See [custom icons](custom-agents.md#icons-labs).
36
-
37
- ## Model suggestions are plain names, not pins
38
-
39
- Suggestions are chosen by task capability, quality, cost, and speed. API formats, SDK adapter compatibility, provider access, and deployment convenience are not selection criteria; Pi's `pi-ai` SDK abstracts model API differences. Availability/release facts are source metadata, not a reason to downrank a capable model.
40
-
41
- Every `modelSuggestions` entry is a single plain model-name string suitable for fuzzy search—no parentheticals, tier labels, benchmark scores, or provider paths. Those belong in this guide and the audit. Suggestions are advisory: they **do not select a runtime model**. Defaults inherit the parent/default model until configured. Actual runtime preferences belong in `models` as eligible `provider/model-id` identities and are subject to scoped-model filtering.
42
-
43
- | Role | Suggested names, in order | Rationale |
44
- | ---------- | ----------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
45
- | architect | `gemini-4-neon`, `claude-opus-5.5`, `claude-fable-5.2`, `gpt-6.2-astra` | User-selected shortlist for ambiguous architecture, difficult constraints, and consequential plans. |
46
- | coder | `gemini-4-hydrogen`, `gpt-6.2-sol`, `claude-sonnet-5.5` | User-selected implementation shortlist, with high thinking by default. |
47
- | researcher | `claude-sonnet-5.5`, `gpt-6.1-terra`, `gemini-4-hydrogen` | User-selected research shortlist, with medium thinking by default. |
48
- | reviewer | `gpt-6.1-sol`, `sonnet-5.5`, `opus-5.5`, `glm-5.3`, `gemini-4-argon` | Reasoning and code evidence, without treating premium Astra as necessary for every review. |
49
- | tasker | `gpt-6-luna`, `haiku-5.5`, `deepseek-v4.1-flash-1017` | User-selected bounded-task shortlist, with low thinking by default. |
50
- | writer | `gemini-4-carbon`, `claude-opus-5.5` | User-selected shortlist for drafting and revision, with medium thinking by default. |
51
-
52
- These are choices, not an automatic fallback/escalation chain or a universal quality ranking. The architect, coder, researcher, and writer names use the model-ID suffixes from [OpenRouter](https://openrouter.ai/api/v1/models), cross-checked against the [Pi catalog](https://pi.dev/models) and local `pi --list-models`. Fuzzy matching can surface the same model across providers and normalize version separators (for example, `claude-fable-5.2` and `claude-fable-5-2`). The picker saves the concrete provider/model ID only when selected and confirmed. The historical audit is not a new benchmark evaluation of these updates. Deep-research product results are not automatically results for their underlying base models.
53
-
54
- The November 4, 2026 additions were checked against provider sources and the current catalog:
55
-
56
- - Tasker uses `deepseek-v4.1-flash-1017`, the latest V4.1 Flash weight revision. [DeepSeek](https://api-docs.deepseek.com/) serves it through `deepseek-flash`; Pi and OpenRouter also list the explicit `deepseek/deepseek-v4.1-flash-1017` identifier.
57
- - Reviewer adds `gemini-4-argon` (`google/gemini-4-argon` in the [OpenRouter catalog](https://openrouter.ai/api/v1/models)).
58
-
59
- ### Quality, price, and speed are different axes
60
-
61
- - Prefer independent task measurements alongside official releases/pricing. Arena is preference evidence, not proof of code correctness, security review, factuality, or citation fidelity. Vendor and independent benchmarks with different harnesses or thinking settings are not directly comparable.
62
- - Tasker starts with low effort and cheap models; do not spend premium reasoning tokens on a mechanical edit. A fast token rate alone does not measure wall-clock completion: include first-token latency, reasoning, tool round trips, retries, and verification.
63
- - Architect/reviewer use high effort by default. Researcher defaults to medium for source tracing and synthesis; configure high for difficult investigations or use tasker for a narrow retrieval-only job. Low-priced models are economical only if they finish reliably.
64
- - Gemini 3.8 Flash's introductory rates are time-limited; DeepSeek Flash's off-peak rates are not its general price. Distinguish cached input, batch discounts, and reasoning-output tokens. Research adds retrieval/API charges to model spend.
65
- - Researcher prioritizes low hallucination alongside factual accuracy and research/tool capability. Historical AA-Omniscience rates and their effort settings are recorded in the audit; they do not establish equivalent performance for the current shortlist at medium effort.
66
- - DeepSeek's non-reasoning speed does not establish low-effort speed. Direct browsing/codebase benchmarks do not establish citation fidelity. Researcher must abstain on unsupported claims and check claim–passage entailment.
67
- - Public latency depends on endpoint, region, load, and serving provider. Open weights do not imply cheap or fast self-hosting. Re-evaluate measured price and speed, and benchmark representative accepted tasks locally before broad adoption.
68
-
69
- ## Researcher retrieval contract
70
-
71
- With the **Allowed (except blocked)** Tool Filtering mode, the researcher child has `read`, `grep`, `find`, `ls`, `bash`, `agent_update`, and `agent_pause`. A custom allowlist can select exact names of registered non-hidden parent MCP/web tools; broader filtering modes can also make them available. Deferred/codemode tools are discoverable through child-local codemode when permitted. Skills are not automatically loaded. External tools reuse the main session's resources/context, and bridged callable tools remain subject to its tool policy; they are not fresh, isolated extension instances.
72
-
73
- Use only actually available authorized retrieval routes. For shell routes:
74
-
75
- - Local source: narrow discovery, implementation/callers/tests/config inspection, version and working-tree provenance, and path/line citations.
76
- - GitHub: `gh` read endpoints; search discovers candidates, then inspect the actual commit/ref. Legacy code search indexes the default branch and is not an exhaustive branch audit. Explicit `--method GET` avoids `gh api` field flags changing a read request into POST.
77
- - Context7: resolve library identity, query the available version, inspect matching docs, and verify upstream contracts when indexed docs lag.
78
- - Exa: semantic discovery followed by inspected content. Parallel: objective/query search followed by Extract or relevant full content. Perplexity: alternate discovery/synthesis whose original citations must be inspected.
79
- - No shell credentials or usable retrieval route: use supplied evidence/public pages where sufficient, or report the gap. No installing packages, harvesting parent configuration secrets, or pretending model memory is live research.
80
-
81
- Research starts with distinct search angles and authoritative sources, then checks consequential claims and contradictions. Bound downloads, paid calls, retries, and duration; stop when the decision has sufficient evidence or a budget/access limit is reached. Treat source text as untrusted data, not instructions. Never leak credentials or send private source to third-party search without authorization.
82
-
83
- The handback gives the answer first, inline evidence, code paths/commit-pinned citations or web URL/date/version, alternatives, uncertainty, coverage limits, and next steps. Announcements, vendor claims, observed implementation, and inference must remain distinguishable. No fabricated citations or claims of tests that were not run.
84
-
85
- ## Tool and authorization boundaries
86
-
87
- With the **Allowed (except blocked)** Tool Filtering mode, only architect has descendant delegation controls, and even architect coordinates or executes only when the assignment authorizes it. Other roles can report progress or pause without starting children. Researcher/reviewer have no `edit`/`write` tools; researcher may write only a caller-authorized evidence artifact via shell. Writer has no bash retrieval route.
88
-
89
- The manager's **Tool Filtering** setting can override these YAML tool boundaries: **All except blocked** (the default) ignores allow lists, while **All** ignores both allow and block lists. Tool sets are selected when sessions initialize; already-open sessions retain their tools. These modes do not change the role prompts or authorization requirements.
90
-
91
- Tool policy is **not an OS sandbox**: bash can mutate files, contact services, or run scripts despite a read-only research/review prompt. Research does not authorize worktree changes, remote writes, setup, installations, or untrusted code execution. Tests/builds can write files and need explicit authorization. Coder must not claim browser/rendering/accessibility checks without tooling that actually ran.
92
-
93
- ## Validation
94
-
95
- `tests/bundled-agents.test.ts` checks the six packaged definitions, precedence/disabling behavior, real tool allowlists, distinct role prompts, advisory-only suggestions, plain alias formatting, research safeguards, and cheap-first tasker routing. Run `npm run check` and `npm test` after changing defaults (this package has no build script).
package/docs/demo.md DELETED
@@ -1,63 +0,0 @@
1
- # README demo
2
-
3
- [Watch the GIF](assets/subagent-manager-demo.gif).
4
-
5
- ## What it shows
6
-
7
- An actual interactive Pi session: six parallel agent roles, two nested taskers,
8
- the live Agents widget, the fullscreen tree, watching a thread, steering a completed
9
- writer back into action, passing API checks, and the final recap. A preparatory
10
- reader makes nine agents in total.
11
-
12
- The fictional **Orbit** project lived in a private temporary demo folder, outside
13
- this repository. Its documents and Python checks were synthetic and local; the
14
- agents still used live model providers. The deliberately slow checks left time to
15
- browse live activity. No production code or data was used.
16
-
17
- ## Recording
18
-
19
- - Pi **1.3.0**, pi-subagent-manager **0.29.3**.
20
- - Started **plain `pi`**, with the user's existing configuration and all configured
21
- extensions. No `-ne`, replacement agent directory, or stripped-down configuration.
22
- - The colorful footer and checklist come from the author's configured extensions;
23
- they are not installed by pi-subagent-manager.
24
- - **Maple Mono NF**, 17 px, 112 × 34 terminal cells. Reused this installed Nerd Font
25
- rather than installing JetBrains Mono. Chromium confirmed MapleMono-NF-Regular
26
- for every footer icon; the rendered footer and role glyphs were visually checked.
27
- - Used the [ttyd-testing skill](../.agents/skills/ttyd-testing/SKILL.md): a real PTY
28
- in localhost-only authenticated ttyd, rendered by isolated headless Chrome 154
29
- through Playwright. Reused system Chrome; capture-only Playwright lived in a
30
- private temporary directory. No project dependencies or Pi settings changed.
31
- - Sampled actual screenshots at approximately 4 fps. Idle intervals were cut, a
32
- short tree section runs at 2×, and selected frames are held for readability.
33
- No UI content was synthesized, redrawn, or overlaid.
34
- - Encoded with FFmpeg's `palettegen` / `paletteuse` filters, no dithering, variable
35
- frame timing, and infinite looping: **1150 × 759 px**, **37.28 seconds**,
36
- **1,332,767 bytes** (about 1.27 MiB).
37
- - Decoded the finished GIF and inspected representative frames for text, borders,
38
- glyphs, footer, and transitions. Stopped the recording, Pi, ttyd, and browser.
39
- Private session logs, control credentials, and raw captures are not committed.
40
-
41
- To record another session, read the skill first, run its `doctor` with an installed
42
- Nerd Font, and start a fresh session in a disposable folder:
43
-
44
- ```sh
45
- SKILL="$PWD/.agents/skills/ttyd-testing"
46
- WORK="$(mktemp -d)"
47
- node "$SKILL/scripts/terminal.mjs" doctor --font 'Maple Mono NF'
48
- node "$SKILL/scripts/terminal.mjs" start \
49
- --session readme-demo --cwd "$WORK" --cols 112 --rows 34 \
50
- --font 'Maple Mono NF' --font-size 17 -- pi
51
- ```
52
-
53
- Populate the disposable folder with a small fictional project and task brief before
54
- submitting a prompt. This recording asked Pi to fan out six named roles and have the
55
- architect delegate two more, staying offline and inside the demo folder. Open the
56
- tree with **←**, select a thread and press **Enter**, send a message in **Steer**,
57
- and use **Ctrl+Q** to return to the main editor. Capture named screenshots after
58
- meaningful actions and inspect them. For continuous sampling, avoid a long `wait`
59
- action on the same session: the harness serializes controls, so it blocks captures.
60
- Always finish with `terminal.mjs stop --session readme-demo`.
61
-
62
- The GIF is an edited demonstration, not a timing benchmark or a guarantee that
63
- other fonts, themes, terminal sizes, or agent models render identically.
@@ -1,74 +0,0 @@
1
- # Development
2
-
3
- ```sh
4
- npm ci
5
- npm run check # typecheck
6
- npm test
7
- npm run format:check
8
- ```
9
-
10
- Tests run offline with no model credentials. Scripted-provider SDK tests cover nested parallel launches, level limits, pause, persistence and recovery. Generated JSONL scenarios cover multilevel trees, unopened parents, interrupted work, durable mailboxes, root forks and same-file tree navigation.
11
-
12
- ## Code layout
13
-
14
- | Path | Responsibility |
15
- | ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
16
- | `src/index.ts` | Parent-session lifecycle and extension wiring |
17
- | `src/orch/manager.ts` | Ownership, lifecycle, retained registry. `scope(caller)` gives tools and UI the same caller-bound `ThreadService`. |
18
- | `src/orch/registry.ts` | Registry persistence: a full entry per attach, then deltas of changed fields |
19
- | `src/orch/runtime.ts` | Isolated pi SDK sessions, providers, safe turn boundaries |
20
- | `src/orch/paths.ts` | Canonical ancestry and context snapshots |
21
- | `src/orch/mailbox.ts` | Input persistence, replay, transcript reconciliation |
22
- | `src/orch/tools.ts` | Caller-bound model tools |
23
- | `src/orch/prompt.ts` | System-prompt guidance per mode |
24
- | `src/orch/housekeeping.ts` | [labs] Housekeeping summarizer: throttling, cancellation, model resolution and the one-line summary call |
25
- | `src/prefs/config.ts` | Frontmatter validation, precedence, atomic saves |
26
- | `src/prefs/settings.ts` | Manager settings, validation, safe paths |
27
- | `src/prefs/models.ts` | Model selection |
28
- | `src/prefs/agent-import.ts`, `import-discovery.ts`, `import-instructions.ts` | Import consent, read-only discovery, migration guidance |
29
- | `src/ui/` | Dialogs, settings, type editor, model and import pickers, thread tree, widget |
30
- | `agents/` | Bundled agent definitions |
31
-
32
- ## Changelog
33
-
34
- [CHANGELOG.md](../CHANGELOG.md) is generated by the [changelog workflow](../.github/workflows/changelog.yml) when a version tag is pushed, together with a GitHub Release. Don't edit generated entries — edit the GitHub Release and rerun.
35
-
36
- - Headings: major `##`, minor `###`, patch `####`. Missing initial tags get series headings (`0.x`, `0.1.x`).
37
- - Stable releases compare against the previous stable ancestor tag; prereleases against the previous ancestor tag and are listed separately.
38
- - Built from GitHub's generated notes, plus a scan of all closed PRs to catch any merged into the tag range (bots, squash/rebase). Direct commits appear only in compare links.
39
- - Handwritten release highlights survive reruns.
40
- - Needs only `GITHUB_TOKEN` with `contents: write` and `pull-requests: read`. Pushes `CHANGELOG.md` to the default branch without force; branch protection must allow it.
41
-
42
- **Backfill:** Actions → Publish changelog → Run workflow. Empty `tag` rebuilds the file only; a tag also publishes/repairs that release.
43
-
44
- **Local preview** (needs authenticated `gh` with contents-write):
45
-
46
- ```sh
47
- git fetch origin --tags
48
- GITHUB_REPOSITORY=championswimmer/pi-subagent-manager npm run changelog
49
- ```
50
-
51
- Rewrites local `CHANGELOG.md` only. The workflow adds `--publish`.
52
-
53
- **Why native notes:** they fit the existing tag-based release without another release manager. Release Drafter adds a draft lifecycle; release-please takes over versioning and needs Conventional Commits; git-cliff is commit-oriented; github-changelog-generator adds Ruby/Docker.
54
-
55
- ## Publishing
56
-
57
- Pushing a `v<version>` tag runs [release.yml](../.github/workflows/release.yml): checks the tag matches `package.json`, typechecks, tests, and publishes to npm with provenance via GitHub OIDC. No `NPM_TOKEN`.
58
-
59
- npm trusted publisher: owner `championswimmer`, repo `pi-subagent-manager`, workflow `release.yml`, environment empty.
60
-
61
- To release:
62
-
63
- ```sh
64
- npm version minor --no-git-tag-version # updates package.json + lock
65
- # validate, commit
66
- git tag -a v<version> -m v<version>
67
- git push && git push --tags
68
- ```
69
-
70
- The package ships TypeScript sources and `agents/`; check `files` in `package.json` when adding assets.
71
-
72
- ## Background
73
-
74
- Initial design: [`.agents/plans`](https://github.com/championswimmer/pi-subagent-manager/tree/main/.agents/plans). Prior-art research: [Claude](research-claude.md), [Codex](research-codex.md).