@selesai/code 0.6.3 → 0.8.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 (1056) hide show
  1. package/CHANGELOG.md +22 -1
  2. package/README.md +5 -3
  3. package/dist/bun/cli.d.ts +0 -1
  4. package/dist/bun/cli.js +0 -1
  5. package/dist/bun/register-bedrock.d.ts +0 -1
  6. package/dist/bun/register-bedrock.js +0 -1
  7. package/dist/bun/restore-sandbox-env.d.ts +0 -1
  8. package/dist/bun/restore-sandbox-env.js +0 -1
  9. package/dist/cli/args.d.ts +0 -1
  10. package/dist/cli/args.js +0 -1
  11. package/dist/cli/config-selector.d.ts +0 -1
  12. package/dist/cli/config-selector.js +0 -1
  13. package/dist/cli/credential-print.d.ts +0 -1
  14. package/dist/cli/credential-print.js +0 -1
  15. package/dist/cli/file-processor.d.ts +0 -1
  16. package/dist/cli/file-processor.js +0 -1
  17. package/dist/cli/initial-message.d.ts +0 -1
  18. package/dist/cli/initial-message.js +0 -1
  19. package/dist/cli/list-models.d.ts +0 -1
  20. package/dist/cli/list-models.js +0 -1
  21. package/dist/cli/project-trust.d.ts +0 -1
  22. package/dist/cli/project-trust.js +0 -1
  23. package/dist/cli/session-picker.d.ts +0 -1
  24. package/dist/cli/session-picker.js +0 -1
  25. package/dist/cli/startup-ui.d.ts +0 -1
  26. package/dist/cli/startup-ui.js +0 -1
  27. package/dist/cli.d.ts +0 -1
  28. package/dist/cli.js +0 -1
  29. package/dist/config.d.ts +0 -1
  30. package/dist/config.js +0 -1
  31. package/dist/core/agent-session-auto-handoff.test.d.ts +0 -1
  32. package/dist/core/agent-session-auto-handoff.test.js +0 -1
  33. package/dist/core/agent-session-runtime.d.ts +0 -1
  34. package/dist/core/agent-session-runtime.js +0 -1
  35. package/dist/core/agent-session-services.d.ts +0 -1
  36. package/dist/core/agent-session-services.js +0 -1
  37. package/dist/core/agent-session-skill-block.test.d.ts +0 -1
  38. package/dist/core/agent-session-skill-block.test.js +0 -1
  39. package/dist/core/agent-session.d.ts +0 -1
  40. package/dist/core/agent-session.js +0 -1
  41. package/dist/core/agents.d.ts +0 -1
  42. package/dist/core/agents.js +0 -1
  43. package/dist/core/auth-guidance.d.ts +0 -1
  44. package/dist/core/auth-guidance.js +0 -1
  45. package/dist/core/auth-storage.d.ts +0 -1
  46. package/dist/core/auth-storage.js +0 -1
  47. package/dist/core/bash-executor.d.ts +0 -1
  48. package/dist/core/bash-executor.js +0 -1
  49. package/dist/core/built-in-extensions.d.ts +0 -1
  50. package/dist/core/built-in-extensions.js +0 -1
  51. package/dist/core/cache-stats.d.ts +0 -1
  52. package/dist/core/cache-stats.js +0 -1
  53. package/dist/core/compaction/branch-summarization.d.ts +0 -1
  54. package/dist/core/compaction/branch-summarization.js +0 -1
  55. package/dist/core/compaction/compaction.d.ts +0 -1
  56. package/dist/core/compaction/compaction.js +0 -1
  57. package/dist/core/compaction/index.d.ts +0 -1
  58. package/dist/core/compaction/index.js +0 -1
  59. package/dist/core/compaction/utils.d.ts +0 -1
  60. package/dist/core/compaction/utils.js +0 -1
  61. package/dist/core/defaults.d.ts +0 -1
  62. package/dist/core/defaults.js +0 -1
  63. package/dist/core/diagnostics.d.ts +0 -1
  64. package/dist/core/diagnostics.js +0 -1
  65. package/dist/core/event-bus.d.ts +0 -1
  66. package/dist/core/event-bus.js +0 -1
  67. package/dist/core/exec.d.ts +0 -1
  68. package/dist/core/exec.js +0 -1
  69. package/dist/core/experimental.d.ts +0 -1
  70. package/dist/core/experimental.js +0 -1
  71. package/dist/core/export-html/ansi-to-html.d.ts +0 -1
  72. package/dist/core/export-html/ansi-to-html.js +0 -1
  73. package/dist/core/export-html/index.d.ts +0 -1
  74. package/dist/core/export-html/index.js +0 -1
  75. package/dist/core/export-html/tool-renderer.d.ts +0 -1
  76. package/dist/core/export-html/tool-renderer.js +0 -1
  77. package/dist/core/extensions/index.d.ts +0 -1
  78. package/dist/core/extensions/index.js +0 -1
  79. package/dist/core/extensions/loader.d.ts +0 -1
  80. package/dist/core/extensions/loader.js +0 -1
  81. package/dist/core/extensions/runner.d.ts +0 -1
  82. package/dist/core/extensions/runner.js +0 -1
  83. package/dist/core/extensions/types.d.ts +0 -1
  84. package/dist/core/extensions/types.js +0 -1
  85. package/dist/core/extensions/wrapper.d.ts +0 -1
  86. package/dist/core/extensions/wrapper.js +0 -1
  87. package/dist/core/footer-data-provider.d.ts +0 -1
  88. package/dist/core/footer-data-provider.js +0 -1
  89. package/dist/core/git-command.d.ts +0 -1
  90. package/dist/core/git-command.js +0 -1
  91. package/dist/core/http-dispatcher.d.ts +0 -1
  92. package/dist/core/http-dispatcher.js +0 -1
  93. package/dist/core/index.d.ts +0 -1
  94. package/dist/core/index.js +0 -1
  95. package/dist/core/keybindings.d.ts +0 -1
  96. package/dist/core/keybindings.js +0 -1
  97. package/dist/core/llama/client.d.ts +0 -1
  98. package/dist/core/llama/client.js +0 -1
  99. package/dist/core/llama/huggingface.d.ts +0 -1
  100. package/dist/core/llama/huggingface.js +0 -1
  101. package/dist/core/llama/index.d.ts +0 -1
  102. package/dist/core/llama/index.js +0 -1
  103. package/dist/core/llama/provider.d.ts +0 -1
  104. package/dist/core/llama/provider.js +0 -1
  105. package/dist/core/llama/ui.d.ts +0 -1
  106. package/dist/core/llama/ui.js +0 -1
  107. package/dist/core/messages.d.ts +0 -1
  108. package/dist/core/messages.js +0 -1
  109. package/dist/core/model-config.d.ts +0 -1
  110. package/dist/core/model-config.js +0 -1
  111. package/dist/core/model-registry.d.ts +0 -1
  112. package/dist/core/model-registry.js +0 -1
  113. package/dist/core/model-resolver.d.ts +0 -1
  114. package/dist/core/model-resolver.js +0 -1
  115. package/dist/core/model-runtime.d.ts +0 -1
  116. package/dist/core/model-runtime.js +0 -1
  117. package/dist/core/models-store.d.ts +0 -1
  118. package/dist/core/models-store.js +0 -1
  119. package/dist/core/output-guard.d.ts +0 -1
  120. package/dist/core/output-guard.js +0 -1
  121. package/dist/core/package-manager.d.ts +0 -1
  122. package/dist/core/package-manager.js +0 -1
  123. package/dist/core/package-manager.test.d.ts +0 -1
  124. package/dist/core/package-manager.test.js +0 -1
  125. package/dist/core/project-trust.d.ts +0 -1
  126. package/dist/core/project-trust.js +0 -1
  127. package/dist/core/prompt-templates.d.ts +0 -1
  128. package/dist/core/prompt-templates.js +0 -1
  129. package/dist/core/provider-attribution.d.ts +0 -1
  130. package/dist/core/provider-attribution.js +0 -1
  131. package/dist/core/provider-composer.d.ts +0 -1
  132. package/dist/core/provider-composer.js +0 -1
  133. package/dist/core/radius.d.ts +0 -1
  134. package/dist/core/radius.js +0 -1
  135. package/dist/core/remote-catalog-provider.d.ts +0 -1
  136. package/dist/core/remote-catalog-provider.js +0 -1
  137. package/dist/core/resolve-config-value.d.ts +0 -1
  138. package/dist/core/resolve-config-value.js +0 -1
  139. package/dist/core/resource-loader.d.ts +0 -1
  140. package/dist/core/resource-loader.js +0 -1
  141. package/dist/core/runtime-credentials.d.ts +0 -1
  142. package/dist/core/runtime-credentials.js +0 -1
  143. package/dist/core/sdk.d.ts +0 -1
  144. package/dist/core/sdk.js +0 -1
  145. package/dist/core/session-cwd.d.ts +0 -1
  146. package/dist/core/session-cwd.js +0 -1
  147. package/dist/core/session-manager.d.ts +0 -1
  148. package/dist/core/session-manager.js +0 -1
  149. package/dist/core/settings-manager-auto-handoff.test.d.ts +0 -1
  150. package/dist/core/settings-manager-auto-handoff.test.js +0 -1
  151. package/dist/core/settings-manager.d.ts +0 -4
  152. package/dist/core/settings-manager.js +0 -12
  153. package/dist/core/skills.d.ts +0 -1
  154. package/dist/core/skills.js +0 -1
  155. package/dist/core/slash-commands.d.ts +0 -1
  156. package/dist/core/slash-commands.js +0 -1
  157. package/dist/core/source-info.d.ts +0 -1
  158. package/dist/core/source-info.js +0 -1
  159. package/dist/core/system-prompt.d.ts +0 -1
  160. package/dist/core/system-prompt.js +0 -1
  161. package/dist/core/system-prompt.test.d.ts +0 -1
  162. package/dist/core/system-prompt.test.js +0 -1
  163. package/dist/core/telemetry.d.ts +0 -1
  164. package/dist/core/telemetry.js +0 -1
  165. package/dist/core/timings.d.ts +0 -1
  166. package/dist/core/timings.js +0 -1
  167. package/dist/core/tools/bash.d.ts +0 -1
  168. package/dist/core/tools/bash.js +0 -1
  169. package/dist/core/tools/edit-diff.d.ts +0 -1
  170. package/dist/core/tools/edit-diff.js +0 -1
  171. package/dist/core/tools/edit.d.ts +0 -1
  172. package/dist/core/tools/edit.js +0 -1
  173. package/dist/core/tools/file-mutation-queue.d.ts +0 -1
  174. package/dist/core/tools/file-mutation-queue.js +0 -1
  175. package/dist/core/tools/find.d.ts +0 -1
  176. package/dist/core/tools/find.js +0 -1
  177. package/dist/core/tools/grep.d.ts +0 -1
  178. package/dist/core/tools/grep.js +0 -1
  179. package/dist/core/tools/index.d.ts +0 -1
  180. package/dist/core/tools/index.js +0 -1
  181. package/dist/core/tools/ls.d.ts +0 -1
  182. package/dist/core/tools/ls.js +0 -1
  183. package/dist/core/tools/output-accumulator.d.ts +0 -1
  184. package/dist/core/tools/output-accumulator.js +0 -1
  185. package/dist/core/tools/path-utils.d.ts +0 -1
  186. package/dist/core/tools/path-utils.js +0 -1
  187. package/dist/core/tools/read.d.ts +0 -1
  188. package/dist/core/tools/read.js +0 -1
  189. package/dist/core/tools/render-utils.d.ts +0 -1
  190. package/dist/core/tools/render-utils.js +0 -1
  191. package/dist/core/tools/tool-definition-wrapper.d.ts +0 -1
  192. package/dist/core/tools/tool-definition-wrapper.js +0 -1
  193. package/dist/core/tools/truncate.d.ts +0 -1
  194. package/dist/core/tools/truncate.js +0 -1
  195. package/dist/core/tools/write.d.ts +0 -1
  196. package/dist/core/tools/write.js +0 -1
  197. package/dist/core/trust-manager.d.ts +0 -1
  198. package/dist/core/trust-manager.js +0 -1
  199. package/dist/core/usage-totals.d.ts +0 -1
  200. package/dist/core/usage-totals.js +0 -1
  201. package/dist/defaults/models.json +8 -0
  202. package/dist/defaults/settings.json +6 -7
  203. package/dist/extensions/agent-browser.test.ts +195 -0
  204. package/dist/extensions/agent-browser.ts +158 -0
  205. package/dist/extensions/inline-skills.test.ts +27 -13
  206. package/dist/extensions/inline-skills.ts +18 -11
  207. package/dist/extensions/package.json +2 -1
  208. package/dist/extensions/pi-powerline-footer/.github/workflows/test.yml +27 -0
  209. package/dist/extensions/pi-powerline-footer/CHANGELOG.md +153 -0
  210. package/dist/extensions/pi-powerline-footer/CONTRIBUTING.md +16 -0
  211. package/dist/extensions/pi-powerline-footer/README.md +192 -44
  212. package/dist/extensions/pi-powerline-footer/bash-mode/completion.ts +19 -4
  213. package/dist/extensions/pi-powerline-footer/bash-mode/editor.ts +80 -25
  214. package/dist/extensions/pi-powerline-footer/bash-mode/history.ts +81 -29
  215. package/dist/extensions/pi-powerline-footer/bash-mode/types.ts +1 -1
  216. package/dist/extensions/pi-powerline-footer/cd-command.ts +190 -0
  217. package/dist/extensions/pi-powerline-footer/colors.ts +2 -1
  218. package/dist/extensions/pi-powerline-footer/context-usage.ts +121 -6
  219. package/dist/extensions/pi-powerline-footer/currency-rates.ts +142 -0
  220. package/dist/extensions/pi-powerline-footer/editor-composition.ts +32 -0
  221. package/dist/extensions/pi-powerline-footer/git-status.ts +108 -6
  222. package/dist/extensions/pi-powerline-footer/icons.ts +11 -2
  223. package/dist/extensions/pi-powerline-footer/index.ts +1056 -324
  224. package/dist/extensions/pi-powerline-footer/lifecycle.ts +10 -0
  225. package/dist/extensions/pi-powerline-footer/package.json +10 -6
  226. package/dist/extensions/pi-powerline-footer/paths.ts +22 -0
  227. package/dist/extensions/pi-powerline-footer/powerline-config.ts +297 -15
  228. package/dist/extensions/pi-powerline-footer/presets.ts +6 -25
  229. package/dist/extensions/pi-powerline-footer/queue/store.ts +361 -0
  230. package/dist/extensions/pi-powerline-footer/queue/types.ts +54 -0
  231. package/dist/extensions/pi-powerline-footer/render-scheduler.ts +12 -7
  232. package/dist/extensions/pi-powerline-footer/segments.ts +114 -107
  233. package/dist/extensions/pi-powerline-footer/session-usage.ts +1 -1
  234. package/dist/extensions/pi-powerline-footer/shortcuts.ts +17 -3
  235. package/dist/extensions/pi-powerline-footer/tests/bash-mode.test.ts +189 -17
  236. package/dist/extensions/pi-powerline-footer/tests/cd-command.test.ts +144 -0
  237. package/dist/extensions/pi-powerline-footer/tests/context-usage.test.ts +120 -2
  238. package/dist/extensions/pi-powerline-footer/tests/custom-items.test.ts +245 -22
  239. package/dist/extensions/pi-powerline-footer/tests/editor-composition.test.ts +48 -0
  240. package/dist/extensions/pi-powerline-footer/tests/editor-responsiveness.test.ts +34 -0
  241. package/dist/extensions/pi-powerline-footer/tests/fixed-editor-border.test.ts +39 -0
  242. package/dist/extensions/pi-powerline-footer/tests/git-status.test.ts +92 -0
  243. package/dist/extensions/pi-powerline-footer/tests/guide.test.ts +4 -1
  244. package/dist/extensions/pi-powerline-footer/tests/jump-shortcuts.test.ts +33 -197
  245. package/dist/extensions/pi-powerline-footer/tests/mode-aware-trigger.test.ts +79 -0
  246. package/dist/extensions/pi-powerline-footer/tests/paths.test.ts +63 -0
  247. package/dist/extensions/pi-powerline-footer/tests/queue-store.test.ts +195 -0
  248. package/dist/extensions/pi-powerline-footer/tests/quit-cursor.test.ts +14 -0
  249. package/dist/extensions/pi-powerline-footer/tests/remaining-regressions.test.ts +167 -0
  250. package/dist/extensions/pi-powerline-footer/tests/stash-shortcut.test.ts +23 -18
  251. package/dist/extensions/pi-powerline-footer/tests/thinking-segment.test.ts +16 -1
  252. package/dist/extensions/pi-powerline-footer/tests/token-stats.test.ts +249 -0
  253. package/dist/extensions/pi-powerline-footer/tests/usage-display.test.ts +237 -0
  254. package/dist/extensions/pi-powerline-footer/tests/welcome.test.ts +199 -0
  255. package/dist/extensions/pi-powerline-footer/tests/working-vibes.test.ts +191 -100
  256. package/dist/extensions/pi-powerline-footer/theme.ts +32 -18
  257. package/dist/extensions/pi-powerline-footer/token-stats.ts +304 -0
  258. package/dist/extensions/pi-powerline-footer/tsconfig.json +13 -0
  259. package/dist/extensions/pi-powerline-footer/types.ts +74 -29
  260. package/dist/extensions/pi-powerline-footer/welcome-dismiss.ts +34 -0
  261. package/dist/extensions/pi-powerline-footer/welcome.ts +65 -10
  262. package/dist/extensions/pi-powerline-footer/working-vibes.ts +44 -11
  263. package/dist/extensions/pi-subagents/CHANGELOG.md +89 -12
  264. package/dist/extensions/pi-subagents/README.md +339 -604
  265. package/dist/extensions/pi-subagents/package-lock.json +190 -2079
  266. package/dist/extensions/pi-subagents/package.json +13 -5
  267. package/dist/extensions/pi-subagents/prompts/parallel-context-build.md +1 -1
  268. package/dist/extensions/pi-subagents/prompts/parallel-handoff-plan.md +1 -1
  269. package/dist/extensions/pi-subagents/prompts/review-loop.md +1 -1
  270. package/dist/extensions/pi-subagents/skills/pi-subagents/SKILL.md +10 -10
  271. package/dist/extensions/pi-subagents/skills/pi-subagents/references/constraints-and-recipes.md +32 -43
  272. package/dist/extensions/pi-subagents/skills/pi-subagents/references/execution-controls.md +106 -105
  273. package/dist/extensions/pi-subagents/skills/pi-subagents/references/management-authoring-rpc.md +3 -3
  274. package/dist/extensions/pi-subagents/skills/pi-subagents/references/prompting-and-roles.md +28 -35
  275. package/dist/extensions/pi-subagents/src/agents/agent-management.ts +167 -124
  276. package/dist/extensions/pi-subagents/src/agents/agent-serializer.ts +19 -0
  277. package/dist/extensions/pi-subagents/src/agents/agents.ts +163 -75
  278. package/dist/extensions/pi-subagents/src/agents/chain-serializer.ts +10 -7
  279. package/dist/extensions/pi-subagents/src/agents/frontmatter.ts +5 -3
  280. package/dist/extensions/pi-subagents/src/agents/identity.ts +1 -1
  281. package/dist/extensions/pi-subagents/src/agents/proactive-skills.ts +14 -11
  282. package/dist/extensions/pi-subagents/src/agents/skills.ts +23 -6
  283. package/dist/extensions/pi-subagents/src/agents/task-aware-routing.ts +8 -1
  284. package/dist/extensions/pi-subagents/src/api/control-channel.ts +4 -0
  285. package/dist/extensions/pi-subagents/src/api/delegation.ts +26 -194
  286. package/dist/extensions/pi-subagents/src/api/external-runs.ts +129 -0
  287. package/dist/extensions/pi-subagents/src/api/intercom-bridge.ts +3 -0
  288. package/dist/extensions/pi-subagents/src/api/pi-args.ts +5 -0
  289. package/dist/extensions/pi-subagents/src/api/preflight.ts +4 -4
  290. package/dist/extensions/pi-subagents/src/api/shared-types.ts +19 -0
  291. package/dist/extensions/pi-subagents/src/extension/config.ts +10 -0
  292. package/dist/extensions/pi-subagents/src/extension/control-notices.ts +5 -39
  293. package/dist/extensions/pi-subagents/src/extension/doctor.ts +10 -9
  294. package/dist/extensions/pi-subagents/src/extension/fanout-child.ts +7 -4
  295. package/dist/extensions/pi-subagents/src/extension/index.ts +243 -77
  296. package/dist/extensions/pi-subagents/src/extension/rpc.ts +18 -6
  297. package/dist/extensions/pi-subagents/src/extension/schemas.ts +50 -39
  298. package/dist/extensions/pi-subagents/src/extension/tool-description.ts +36 -103
  299. package/dist/extensions/pi-subagents/src/inspectors/herdr/actions.ts +229 -0
  300. package/dist/extensions/pi-subagents/src/inspectors/herdr/client.ts +130 -0
  301. package/dist/extensions/pi-subagents/src/inspectors/herdr/inspector-runner.ts +141 -0
  302. package/dist/extensions/pi-subagents/src/inspectors/herdr/project-panes.ts +154 -0
  303. package/dist/extensions/pi-subagents/src/integrations/herdr-status.ts +330 -0
  304. package/dist/extensions/pi-subagents/src/intercom/intercom-bridge.ts +3 -2
  305. package/dist/extensions/pi-subagents/src/intercom/result-intercom.ts +5 -1
  306. package/dist/extensions/pi-subagents/src/missions/actions.ts +372 -0
  307. package/dist/extensions/pi-subagents/src/missions/lifecycle.ts +314 -0
  308. package/dist/extensions/pi-subagents/src/missions/store.ts +442 -0
  309. package/dist/extensions/pi-subagents/src/missions/types.ts +135 -0
  310. package/dist/extensions/pi-subagents/src/policy/authority.ts +46 -0
  311. package/dist/extensions/pi-subagents/src/profiles/profiles.ts +32 -6
  312. package/dist/extensions/pi-subagents/src/runs/background/async-execution.ts +103 -72
  313. package/dist/extensions/pi-subagents/src/runs/background/async-job-tracker.ts +10 -2
  314. package/dist/extensions/pi-subagents/src/runs/background/async-resume.ts +6 -6
  315. package/dist/extensions/pi-subagents/src/runs/background/async-status.ts +29 -1
  316. package/dist/extensions/pi-subagents/src/runs/background/auto-drain.ts +3 -3
  317. package/dist/extensions/pi-subagents/src/runs/background/chain-append.ts +3 -2
  318. package/dist/extensions/pi-subagents/src/runs/background/control-channel.ts +9 -7
  319. package/dist/extensions/pi-subagents/src/runs/background/fleet-view.ts +3 -4
  320. package/dist/extensions/pi-subagents/src/runs/background/notify.ts +3 -28
  321. package/dist/extensions/pi-subagents/src/runs/background/process-terminal.ts +5 -5
  322. package/dist/extensions/pi-subagents/src/runs/background/result-watcher.ts +18 -68
  323. package/dist/extensions/pi-subagents/src/runs/background/run-id-resolver.ts +3 -3
  324. package/dist/extensions/pi-subagents/src/runs/background/run-status.ts +35 -8
  325. package/dist/extensions/pi-subagents/src/runs/background/scheduled-runs.ts +602 -375
  326. package/dist/extensions/pi-subagents/src/runs/background/stale-run-reconciler.ts +3 -3
  327. package/dist/extensions/pi-subagents/src/runs/background/subagent-runner.ts +612 -464
  328. package/dist/extensions/pi-subagents/src/runs/background/subagent-wait.ts +50 -9
  329. package/dist/extensions/pi-subagents/src/runs/background/wait-subscriptions.ts +253 -0
  330. package/dist/extensions/pi-subagents/src/runs/background/wait-tool.ts +12 -4
  331. package/dist/extensions/pi-subagents/src/runs/foreground/async-steering-action.ts +3 -3
  332. package/dist/extensions/pi-subagents/src/runs/foreground/chain-clarify.ts +8 -4
  333. package/dist/extensions/pi-subagents/src/runs/foreground/chain-execution.ts +74 -102
  334. package/dist/extensions/pi-subagents/src/runs/foreground/execution.ts +21 -22
  335. package/dist/extensions/pi-subagents/src/runs/foreground/subagent-executor.ts +1050 -396
  336. package/dist/extensions/pi-subagents/src/runs/shared/acceptance.ts +44 -18
  337. package/dist/extensions/pi-subagents/src/runs/shared/capability-ceiling.ts +0 -1
  338. package/dist/extensions/pi-subagents/src/runs/shared/child-protocol.ts +302 -22
  339. package/dist/extensions/pi-subagents/src/runs/shared/dynamic-fanout.ts +1 -1
  340. package/dist/extensions/pi-subagents/src/runs/shared/external-cli-runner.ts +130 -0
  341. package/dist/extensions/pi-subagents/src/runs/shared/long-running-guard.ts +42 -1
  342. package/dist/extensions/pi-subagents/src/runs/shared/model-fallback.ts +1 -1
  343. package/dist/extensions/pi-subagents/src/runs/shared/nested-events.ts +59 -5
  344. package/dist/extensions/pi-subagents/src/runs/shared/nested-render.ts +9 -4
  345. package/dist/extensions/pi-subagents/src/runs/shared/parallel-handoff.ts +86 -2
  346. package/dist/extensions/pi-subagents/src/runs/shared/parallel-utils.ts +11 -2
  347. package/dist/extensions/pi-subagents/src/runs/shared/permissions.ts +95 -0
  348. package/dist/extensions/pi-subagents/src/runs/shared/pi-args.ts +11 -1
  349. package/dist/extensions/pi-subagents/src/runs/shared/pi-spawn.ts +15 -6
  350. package/dist/extensions/pi-subagents/src/runs/shared/run-history.ts +1 -1
  351. package/dist/extensions/pi-subagents/src/runs/shared/single-output.ts +9 -63
  352. package/dist/extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.ts +37 -6
  353. package/dist/extensions/pi-subagents/src/runs/shared/subagent-startup-retry.ts +5 -2
  354. package/dist/extensions/pi-subagents/src/runs/shared/task-intent.ts +2 -23
  355. package/dist/extensions/pi-subagents/src/runs/shared/turn-budget.ts +6 -6
  356. package/dist/extensions/pi-subagents/src/runs/shared/worktree.ts +124 -13
  357. package/dist/extensions/pi-subagents/src/shared/accessible-dir.ts +29 -7
  358. package/dist/extensions/pi-subagents/src/shared/artifacts.ts +18 -1
  359. package/dist/extensions/pi-subagents/src/shared/fork-context.ts +3 -2
  360. package/dist/extensions/pi-subagents/src/shared/launch-contract.ts +1 -0
  361. package/dist/extensions/pi-subagents/src/shared/settings.ts +10 -0
  362. package/dist/extensions/pi-subagents/src/shared/types.ts +158 -55
  363. package/dist/extensions/pi-subagents/src/shared/utils.ts +16 -66
  364. package/dist/extensions/pi-subagents/src/slash/delegation-adapters.ts +33 -199
  365. package/dist/extensions/pi-subagents/src/slash/delegation-request.ts +43 -126
  366. package/dist/extensions/pi-subagents/src/slash/inline-subagents.ts +136 -0
  367. package/dist/extensions/pi-subagents/src/slash/prompt-template-bridge.ts +158 -205
  368. package/dist/extensions/pi-subagents/src/slash/prompt-workflows.ts +22 -58
  369. package/dist/extensions/pi-subagents/src/slash/slash-bridge.ts +14 -0
  370. package/dist/extensions/pi-subagents/src/slash/slash-commands.ts +44 -642
  371. package/dist/extensions/pi-subagents/src/slash/subagents-admin.ts +18 -14
  372. package/dist/extensions/pi-subagents/src/tui/fleet-status.ts +156 -21
  373. package/dist/extensions/pi-subagents/src/tui/fleet-transcript.ts +110 -5
  374. package/dist/extensions/pi-subagents/src/tui/fleet.ts +60 -24
  375. package/dist/extensions/pi-subagents/src/tui/render.ts +296 -140
  376. package/dist/extensions/pi-subagents/src/types/pi-runtime-compat.d.ts +14 -0
  377. package/dist/extensions/pi-subagents/src/watchdog/change-signature.ts +1 -1
  378. package/dist/extensions/pi-subagents/src/watchdog/lsp-diagnostics.ts +13 -7
  379. package/dist/extensions/pi-subagents/src/watchdog/model-selection.ts +2 -2
  380. package/dist/extensions/pi-subagents/src/watchdog/permission-arbiter.ts +145 -0
  381. package/dist/extensions/pi-subagents/src/watchdog/register-child.ts +1 -1
  382. package/dist/extensions/pi-subagents/src/watchdog/register-main.ts +1 -1
  383. package/dist/extensions/pi-subagents/src/watchdog/review.ts +4 -1
  384. package/dist/extensions/pi-subagents/src/watchdog/runtime.ts +3 -2
  385. package/dist/extensions/pi-subagents/src/workflows/chat-progress.ts +140 -0
  386. package/dist/extensions/pi-subagents/src/workflows/scripted-workflow.ts +415 -0
  387. package/dist/extensions/pi-subagents/test/e2e/real-session-subagent.test.ts +41 -144
  388. package/dist/extensions/pi-subagents/test/integration/acceptance-file-report.test.ts +16 -16
  389. package/dist/extensions/pi-subagents/test/integration/async-execution.test.ts +415 -298
  390. package/dist/extensions/pi-subagents/test/integration/async-job-tracker.test.ts +149 -82
  391. package/dist/extensions/pi-subagents/test/integration/async-status.test.ts +40 -40
  392. package/dist/extensions/pi-subagents/test/integration/chain-clarify.test.ts +15 -15
  393. package/dist/extensions/pi-subagents/test/integration/chain-execution.test.ts +193 -133
  394. package/dist/extensions/pi-subagents/test/integration/detect-error.test.ts +1 -49
  395. package/dist/extensions/pi-subagents/test/integration/external-cli-runner.test.ts +62 -0
  396. package/dist/extensions/pi-subagents/test/integration/fork-context-execution.test.ts +56 -58
  397. package/dist/extensions/pi-subagents/test/integration/intercom-result-delivery.test.ts +81 -68
  398. package/dist/extensions/pi-subagents/test/integration/parallel-execution.test.ts +20 -25
  399. package/dist/extensions/pi-subagents/test/integration/render-fork-badge.test.ts +425 -317
  400. package/dist/extensions/pi-subagents/test/integration/render-widget.test.ts +73 -73
  401. package/dist/extensions/pi-subagents/test/integration/result-watcher.test.ts +123 -98
  402. package/dist/extensions/pi-subagents/test/integration/single-execution.test.ts +653 -240
  403. package/dist/extensions/pi-subagents/test/integration/slash-commands.test.ts +20 -1661
  404. package/dist/extensions/pi-subagents/test/integration/slash-live-state.test.ts +9 -9
  405. package/dist/extensions/pi-subagents/test/integration/template-resolution.test.ts +3 -3
  406. package/dist/extensions/pi-subagents/test/integration/top-level-async.test.ts +2 -2
  407. package/dist/extensions/pi-subagents/test/support/mock-pi-script.mjs +8 -5
  408. package/dist/extensions/pi-subagents/test/support/mock-pi.ts +6 -6
  409. package/dist/extensions/pi-subagents/test/support/real-session-runner.ts +4 -20
  410. package/dist/extensions/pi-subagents/test/unit/acceptance.test.ts +25 -4
  411. package/dist/extensions/pi-subagents/test/unit/agent-disabled.test.ts +1 -1
  412. package/dist/extensions/pi-subagents/test/unit/agent-frontmatter.test.ts +280 -295
  413. package/dist/extensions/pi-subagents/test/unit/agent-management.test.ts +47 -207
  414. package/dist/extensions/pi-subagents/test/unit/agent-memory.test.ts +26 -26
  415. package/dist/extensions/pi-subagents/test/unit/agent-overrides.test.ts +89 -89
  416. package/dist/extensions/pi-subagents/test/unit/agent-selection.test.ts +9 -9
  417. package/dist/extensions/pi-subagents/test/unit/artifacts.test.ts +10 -0
  418. package/dist/extensions/pi-subagents/test/unit/async-execution.test.ts +33 -9
  419. package/dist/extensions/pi-subagents/test/unit/async-interrupt-action.test.ts +24 -2
  420. package/dist/extensions/pi-subagents/test/unit/async-permission-session.test.ts +11 -9
  421. package/dist/extensions/pi-subagents/test/unit/async-recovery-descriptor.test.ts +2 -2
  422. package/dist/extensions/pi-subagents/test/unit/async-resume.test.ts +40 -40
  423. package/dist/extensions/pi-subagents/test/unit/authority-policy.test.ts +22 -0
  424. package/dist/extensions/pi-subagents/test/unit/background-work.test.ts +1 -1
  425. package/dist/extensions/pi-subagents/test/unit/capability-ceiling-agent-allowlist.test.ts +5 -39
  426. package/dist/extensions/pi-subagents/test/unit/chain-append.test.ts +19 -19
  427. package/dist/extensions/pi-subagents/test/unit/chain-root-attachment.test.ts +9 -9
  428. package/dist/extensions/pi-subagents/test/unit/chain-serializer.test.ts +20 -20
  429. package/dist/extensions/pi-subagents/test/unit/child-protocol.test.ts +99 -0
  430. package/dist/extensions/pi-subagents/test/unit/child-transcript.test.ts +9 -9
  431. package/dist/extensions/pi-subagents/test/unit/compaction-resume.test.ts +41 -0
  432. package/dist/extensions/pi-subagents/test/unit/completion-dedupe.test.ts +2 -2
  433. package/dist/extensions/pi-subagents/test/unit/completion-guard.test.ts +35 -5
  434. package/dist/extensions/pi-subagents/test/unit/config-dir-runtime.test.ts +7 -0
  435. package/dist/extensions/pi-subagents/test/unit/control-notices.test.ts +16 -82
  436. package/dist/extensions/pi-subagents/test/unit/delegation-api.test.ts +162 -620
  437. package/dist/extensions/pi-subagents/test/unit/doctor.test.ts +1 -1
  438. package/dist/extensions/pi-subagents/test/unit/dynamic-fanout.test.ts +25 -25
  439. package/dist/extensions/pi-subagents/test/unit/ensure-accessible-dir.test.ts +125 -0
  440. package/dist/extensions/pi-subagents/test/unit/external-cli-runner.test.ts +94 -0
  441. package/dist/extensions/pi-subagents/test/unit/external-runs.test.ts +66 -0
  442. package/dist/extensions/pi-subagents/test/unit/extra-agent-dirs.test.ts +3 -3
  443. package/dist/extensions/pi-subagents/test/unit/fleet-status.test.ts +242 -52
  444. package/dist/extensions/pi-subagents/test/unit/fleet-transcript.test.ts +127 -0
  445. package/dist/extensions/pi-subagents/test/unit/fleet.test.ts +197 -36
  446. package/dist/extensions/pi-subagents/test/unit/foreground-control.test.ts +4 -4
  447. package/dist/extensions/pi-subagents/test/unit/herdr-inspector.test.ts +245 -0
  448. package/dist/extensions/pi-subagents/test/unit/herdr-status-bridge.test.ts +494 -0
  449. package/dist/extensions/pi-subagents/test/unit/index-child-registration.test.ts +261 -31
  450. package/dist/extensions/pi-subagents/test/unit/inline-subagents.test.ts +127 -0
  451. package/dist/extensions/pi-subagents/test/unit/intercom-bridge.test.ts +6 -6
  452. package/dist/extensions/pi-subagents/test/unit/mission-lifecycle.test.ts +217 -0
  453. package/dist/extensions/pi-subagents/test/unit/mission-store.test.ts +182 -0
  454. package/dist/extensions/pi-subagents/test/unit/mock-pi.test.ts +22 -0
  455. package/dist/extensions/pi-subagents/test/unit/model-fallback.test.ts +1 -1
  456. package/dist/extensions/pi-subagents/test/unit/native-supervisor-channel.test.ts +10 -10
  457. package/dist/extensions/pi-subagents/test/unit/nested-control.test.ts +20 -12
  458. package/dist/extensions/pi-subagents/test/unit/nested-events.test.ts +47 -5
  459. package/dist/extensions/pi-subagents/test/unit/notify.test.ts +49 -55
  460. package/dist/extensions/pi-subagents/test/unit/package-manifest.test.ts +20 -3
  461. package/dist/extensions/pi-subagents/test/unit/parallel-handoff.test.ts +37 -7
  462. package/dist/extensions/pi-subagents/test/unit/parallel-utils.test.ts +10 -10
  463. package/dist/extensions/pi-subagents/test/unit/path-handling.test.ts +3 -3
  464. package/dist/extensions/pi-subagents/test/unit/permissions.test.ts +46 -0
  465. package/dist/extensions/pi-subagents/test/unit/pi-args.test.ts +31 -10
  466. package/dist/extensions/pi-subagents/test/unit/pi-spawn.test.ts +40 -16
  467. package/dist/extensions/pi-subagents/test/unit/preflight.test.ts +42 -44
  468. package/dist/extensions/pi-subagents/test/unit/proactive-skills.test.ts +13 -13
  469. package/dist/extensions/pi-subagents/test/unit/process-terminal.test.ts +4 -4
  470. package/dist/extensions/pi-subagents/test/unit/profiles.test.ts +75 -9
  471. package/dist/extensions/pi-subagents/test/unit/prompt-template-bridge.test.ts +20 -84
  472. package/dist/extensions/pi-subagents/test/unit/prompt-workflows.test.ts +15 -16
  473. package/dist/extensions/pi-subagents/test/unit/render-helpers.test.ts +28 -28
  474. package/dist/extensions/pi-subagents/test/unit/result-intercom.test.ts +19 -12
  475. package/dist/extensions/pi-subagents/test/unit/rpc.test.ts +37 -21
  476. package/dist/extensions/pi-subagents/test/unit/run-id-resolver.test.ts +1 -1
  477. package/dist/extensions/pi-subagents/test/unit/run-status.test.ts +50 -50
  478. package/dist/extensions/pi-subagents/test/unit/scheduled-runs.test.ts +396 -433
  479. package/dist/extensions/pi-subagents/test/unit/schemas.test.ts +76 -153
  480. package/dist/extensions/pi-subagents/test/unit/scripted-workflow.test.ts +411 -0
  481. package/dist/extensions/pi-subagents/test/unit/single-output.test.ts +1 -91
  482. package/dist/extensions/pi-subagents/test/unit/skills-fallback.test.ts +139 -0
  483. package/dist/extensions/pi-subagents/test/unit/slash-bridge.test.ts +29 -0
  484. package/dist/extensions/pi-subagents/test/unit/stale-run-reconciler.test.ts +13 -13
  485. package/dist/extensions/pi-subagents/test/unit/steering-action.test.ts +2 -2
  486. package/dist/extensions/pi-subagents/test/unit/steering.test.ts +2 -2
  487. package/dist/extensions/pi-subagents/test/unit/subagent-control.test.ts +35 -35
  488. package/dist/extensions/pi-subagents/test/unit/subagent-prompt-runtime.test.ts +53 -18
  489. package/dist/extensions/pi-subagents/test/unit/subagent-startup-retry.test.ts +13 -1
  490. package/dist/extensions/pi-subagents/test/unit/subagent-wait.test.ts +44 -11
  491. package/dist/extensions/pi-subagents/test/unit/task-intent.test.ts +2 -26
  492. package/dist/extensions/pi-subagents/test/unit/tool-description.test.ts +24 -148
  493. package/dist/extensions/pi-subagents/test/unit/turn-budget.test.ts +11 -9
  494. package/dist/extensions/pi-subagents/test/unit/wait-subscriptions.test.ts +351 -0
  495. package/dist/extensions/pi-subagents/test/unit/watchdog-child-status.test.ts +13 -13
  496. package/dist/extensions/pi-subagents/test/unit/watchdog-lsp-diagnostics.test.ts +1 -1
  497. package/dist/extensions/pi-subagents/test/unit/watchdog-permission-arbiter.test.ts +79 -0
  498. package/dist/extensions/pi-subagents/test/unit/watchdog-runtime.test.ts +1 -1
  499. package/dist/extensions/pi-subagents/test/unit/watchdog-settings.test.ts +8 -8
  500. package/dist/extensions/pi-subagents/test/unit/widget-nested-render.test.ts +45 -9
  501. package/dist/extensions/pi-subagents/test/unit/workflow-chat-progress.test.ts +197 -0
  502. package/dist/extensions/pi-subagents/test/unit/workflow-graph.test.ts +8 -8
  503. package/dist/extensions/pi-subagents/test/unit/worktree.test.ts +142 -12
  504. package/dist/extensions/pi-subagents/tsconfig.json +15 -0
  505. package/dist/extensions/ponytail/index.js +1 -31
  506. package/dist/extensions/ponytail/test/extension.test.js +5 -22
  507. package/dist/extensions/rtk.test.ts +141 -0
  508. package/dist/extensions/rtk.ts +78 -36
  509. package/dist/index.d.ts +1 -1
  510. package/dist/index.js +1 -1
  511. package/dist/main.d.ts +0 -1
  512. package/dist/main.js +0 -1
  513. package/dist/migrations.d.ts +0 -1
  514. package/dist/migrations.js +0 -1
  515. package/dist/modes/index.d.ts +0 -1
  516. package/dist/modes/index.js +0 -1
  517. package/dist/modes/interactive/components/armin.d.ts +0 -1
  518. package/dist/modes/interactive/components/armin.js +0 -1
  519. package/dist/modes/interactive/components/assistant-message.d.ts +0 -1
  520. package/dist/modes/interactive/components/assistant-message.js +0 -1
  521. package/dist/modes/interactive/components/bash-execution.d.ts +0 -1
  522. package/dist/modes/interactive/components/bash-execution.js +0 -1
  523. package/dist/modes/interactive/components/bordered-loader.d.ts +0 -1
  524. package/dist/modes/interactive/components/bordered-loader.js +0 -1
  525. package/dist/modes/interactive/components/branch-summary-message.d.ts +0 -1
  526. package/dist/modes/interactive/components/branch-summary-message.js +0 -1
  527. package/dist/modes/interactive/components/compaction-summary-message.d.ts +0 -1
  528. package/dist/modes/interactive/components/compaction-summary-message.js +0 -1
  529. package/dist/modes/interactive/components/config-selector.d.ts +0 -1
  530. package/dist/modes/interactive/components/config-selector.js +0 -1
  531. package/dist/modes/interactive/components/countdown-timer.d.ts +0 -1
  532. package/dist/modes/interactive/components/countdown-timer.js +0 -1
  533. package/dist/modes/interactive/components/custom-editor.d.ts +0 -1
  534. package/dist/modes/interactive/components/custom-editor.js +0 -1
  535. package/dist/modes/interactive/components/custom-entry.d.ts +0 -1
  536. package/dist/modes/interactive/components/custom-entry.js +0 -1
  537. package/dist/modes/interactive/components/custom-message.d.ts +0 -1
  538. package/dist/modes/interactive/components/custom-message.js +0 -1
  539. package/dist/modes/interactive/components/daxnuts.d.ts +0 -1
  540. package/dist/modes/interactive/components/daxnuts.js +0 -1
  541. package/dist/modes/interactive/components/diff.d.ts +0 -1
  542. package/dist/modes/interactive/components/diff.js +0 -1
  543. package/dist/modes/interactive/components/dynamic-border.d.ts +0 -1
  544. package/dist/modes/interactive/components/dynamic-border.js +0 -1
  545. package/dist/modes/interactive/components/earendil-announcement.d.ts +0 -1
  546. package/dist/modes/interactive/components/earendil-announcement.js +0 -1
  547. package/dist/modes/interactive/components/extension-editor.d.ts +0 -1
  548. package/dist/modes/interactive/components/extension-editor.js +0 -1
  549. package/dist/modes/interactive/components/extension-input.d.ts +0 -1
  550. package/dist/modes/interactive/components/extension-input.js +0 -1
  551. package/dist/modes/interactive/components/extension-selector.d.ts +0 -1
  552. package/dist/modes/interactive/components/extension-selector.js +0 -1
  553. package/dist/modes/interactive/components/first-time-setup.d.ts +0 -1
  554. package/dist/modes/interactive/components/first-time-setup.js +0 -1
  555. package/dist/modes/interactive/components/footer.d.ts +0 -1
  556. package/dist/modes/interactive/components/footer.js +0 -1
  557. package/dist/modes/interactive/components/index.d.ts +0 -1
  558. package/dist/modes/interactive/components/index.js +0 -1
  559. package/dist/modes/interactive/components/keybinding-hints.d.ts +0 -1
  560. package/dist/modes/interactive/components/keybinding-hints.js +0 -1
  561. package/dist/modes/interactive/components/login-dialog.d.ts +0 -1
  562. package/dist/modes/interactive/components/login-dialog.js +0 -1
  563. package/dist/modes/interactive/components/model-selector.d.ts +0 -1
  564. package/dist/modes/interactive/components/model-selector.js +0 -1
  565. package/dist/modes/interactive/components/oauth-selector.d.ts +0 -1
  566. package/dist/modes/interactive/components/oauth-selector.js +0 -1
  567. package/dist/modes/interactive/components/scoped-models-selector.d.ts +0 -1
  568. package/dist/modes/interactive/components/scoped-models-selector.js +0 -1
  569. package/dist/modes/interactive/components/session-selector-search.d.ts +0 -1
  570. package/dist/modes/interactive/components/session-selector-search.js +0 -1
  571. package/dist/modes/interactive/components/session-selector.d.ts +0 -1
  572. package/dist/modes/interactive/components/session-selector.js +0 -1
  573. package/dist/modes/interactive/components/settings-selector.d.ts +0 -3
  574. package/dist/modes/interactive/components/settings-selector.js +1 -14
  575. package/dist/modes/interactive/components/show-images-selector.d.ts +0 -1
  576. package/dist/modes/interactive/components/show-images-selector.js +0 -1
  577. package/dist/modes/interactive/components/skill-invocation-message.d.ts +0 -1
  578. package/dist/modes/interactive/components/skill-invocation-message.js +0 -1
  579. package/dist/modes/interactive/components/status-indicator.d.ts +0 -1
  580. package/dist/modes/interactive/components/status-indicator.js +0 -1
  581. package/dist/modes/interactive/components/theme-selector.d.ts +0 -1
  582. package/dist/modes/interactive/components/theme-selector.js +0 -1
  583. package/dist/modes/interactive/components/thinking-selector.d.ts +0 -1
  584. package/dist/modes/interactive/components/thinking-selector.js +0 -1
  585. package/dist/modes/interactive/components/tool-execution.d.ts +0 -1
  586. package/dist/modes/interactive/components/tool-execution.js +0 -1
  587. package/dist/modes/interactive/components/tree-selector.d.ts +0 -1
  588. package/dist/modes/interactive/components/tree-selector.js +0 -1
  589. package/dist/modes/interactive/components/trust-selector.d.ts +0 -1
  590. package/dist/modes/interactive/components/trust-selector.js +0 -1
  591. package/dist/modes/interactive/components/user-message-selector.d.ts +0 -1
  592. package/dist/modes/interactive/components/user-message-selector.js +0 -1
  593. package/dist/modes/interactive/components/user-message.d.ts +0 -1
  594. package/dist/modes/interactive/components/user-message.js +0 -1
  595. package/dist/modes/interactive/components/visual-truncate.d.ts +0 -1
  596. package/dist/modes/interactive/components/visual-truncate.js +0 -1
  597. package/dist/modes/interactive/external-editor.d.ts +0 -1
  598. package/dist/modes/interactive/external-editor.js +0 -1
  599. package/dist/modes/interactive/interactive-mode.d.ts +0 -2
  600. package/dist/modes/interactive/interactive-mode.js +1 -22
  601. package/dist/modes/interactive/model-search.d.ts +0 -1
  602. package/dist/modes/interactive/model-search.js +0 -1
  603. package/dist/modes/interactive/theme/theme-controller.d.ts +0 -1
  604. package/dist/modes/interactive/theme/theme-controller.js +0 -1
  605. package/dist/modes/interactive/theme/theme.d.ts +0 -1
  606. package/dist/modes/interactive/theme/theme.js +0 -1
  607. package/dist/modes/print-mode.d.ts +0 -1
  608. package/dist/modes/print-mode.js +0 -1
  609. package/dist/modes/rpc/jsonl.d.ts +0 -1
  610. package/dist/modes/rpc/jsonl.js +0 -1
  611. package/dist/modes/rpc/rpc-client.d.ts +1 -2
  612. package/dist/modes/rpc/rpc-client.js +1 -2
  613. package/dist/modes/rpc/rpc-mode.d.ts +0 -1
  614. package/dist/modes/rpc/rpc-mode.js +0 -9
  615. package/dist/modes/rpc/rpc-types.d.ts +0 -1
  616. package/dist/modes/rpc/rpc-types.js +0 -1
  617. package/dist/package-manager-cli.d.ts +0 -1
  618. package/dist/package-manager-cli.js +0 -1
  619. package/dist/rpc-entry.d.ts +0 -1
  620. package/dist/rpc-entry.js +0 -1
  621. package/dist/utils/ansi.d.ts +0 -1
  622. package/dist/utils/ansi.js +0 -1
  623. package/dist/utils/changelog.d.ts +0 -1
  624. package/dist/utils/changelog.js +0 -1
  625. package/dist/utils/child-process.d.ts +0 -1
  626. package/dist/utils/child-process.js +0 -1
  627. package/dist/utils/clipboard-image.d.ts +0 -1
  628. package/dist/utils/clipboard-image.js +0 -1
  629. package/dist/utils/clipboard-native.d.ts +0 -1
  630. package/dist/utils/clipboard-native.js +0 -1
  631. package/dist/utils/clipboard.d.ts +0 -1
  632. package/dist/utils/clipboard.js +0 -1
  633. package/dist/utils/deprecation.d.ts +0 -1
  634. package/dist/utils/deprecation.js +0 -1
  635. package/dist/utils/exif-orientation.d.ts +0 -1
  636. package/dist/utils/exif-orientation.js +0 -1
  637. package/dist/utils/frontmatter.d.ts +0 -1
  638. package/dist/utils/frontmatter.js +0 -1
  639. package/dist/utils/fs-watch.d.ts +0 -1
  640. package/dist/utils/fs-watch.js +0 -1
  641. package/dist/utils/git.d.ts +0 -1
  642. package/dist/utils/git.js +0 -1
  643. package/dist/utils/html.d.ts +0 -1
  644. package/dist/utils/html.js +0 -1
  645. package/dist/utils/image-convert.d.ts +0 -1
  646. package/dist/utils/image-convert.js +0 -1
  647. package/dist/utils/image-process.d.ts +0 -1
  648. package/dist/utils/image-process.js +0 -1
  649. package/dist/utils/image-resize-core.d.ts +0 -1
  650. package/dist/utils/image-resize-core.js +0 -1
  651. package/dist/utils/image-resize-worker.d.ts +0 -1
  652. package/dist/utils/image-resize-worker.js +0 -1
  653. package/dist/utils/image-resize.d.ts +0 -1
  654. package/dist/utils/image-resize.js +0 -1
  655. package/dist/utils/json.d.ts +0 -1
  656. package/dist/utils/json.js +0 -1
  657. package/dist/utils/mime.d.ts +0 -1
  658. package/dist/utils/mime.js +0 -1
  659. package/dist/utils/open-browser.d.ts +0 -1
  660. package/dist/utils/open-browser.js +0 -1
  661. package/dist/utils/paths.d.ts +0 -1
  662. package/dist/utils/paths.js +0 -1
  663. package/dist/utils/photon.d.ts +0 -1
  664. package/dist/utils/photon.js +0 -1
  665. package/dist/utils/pi-user-agent.d.ts +0 -1
  666. package/dist/utils/pi-user-agent.js +0 -1
  667. package/dist/utils/shell.d.ts +0 -1
  668. package/dist/utils/shell.js +0 -1
  669. package/dist/utils/sleep.d.ts +0 -1
  670. package/dist/utils/sleep.js +0 -1
  671. package/dist/utils/syntax-highlight.d.ts +0 -1
  672. package/dist/utils/syntax-highlight.js +0 -1
  673. package/dist/utils/thinking-tags.d.ts +0 -1
  674. package/dist/utils/thinking-tags.js +0 -1
  675. package/dist/utils/tools-manager.d.ts +3 -3
  676. package/dist/utils/tools-manager.js +125 -42
  677. package/dist/utils/version-check.d.ts +0 -1
  678. package/dist/utils/version-check.js +0 -1
  679. package/dist/utils/windows-self-update.d.ts +0 -1
  680. package/dist/utils/windows-self-update.js +0 -1
  681. package/docs/rpc.md +1 -2
  682. package/docs/settings.md +0 -1
  683. package/docs/skills.md +10 -18
  684. package/package.json +3 -2
  685. package/dist/bun/cli.d.ts.map +0 -1
  686. package/dist/bun/cli.js.map +0 -1
  687. package/dist/bun/register-bedrock.d.ts.map +0 -1
  688. package/dist/bun/register-bedrock.js.map +0 -1
  689. package/dist/bun/restore-sandbox-env.d.ts.map +0 -1
  690. package/dist/bun/restore-sandbox-env.js.map +0 -1
  691. package/dist/cli/args.d.ts.map +0 -1
  692. package/dist/cli/args.js.map +0 -1
  693. package/dist/cli/config-selector.d.ts.map +0 -1
  694. package/dist/cli/config-selector.js.map +0 -1
  695. package/dist/cli/credential-print.d.ts.map +0 -1
  696. package/dist/cli/credential-print.js.map +0 -1
  697. package/dist/cli/file-processor.d.ts.map +0 -1
  698. package/dist/cli/file-processor.js.map +0 -1
  699. package/dist/cli/initial-message.d.ts.map +0 -1
  700. package/dist/cli/initial-message.js.map +0 -1
  701. package/dist/cli/list-models.d.ts.map +0 -1
  702. package/dist/cli/list-models.js.map +0 -1
  703. package/dist/cli/project-trust.d.ts.map +0 -1
  704. package/dist/cli/project-trust.js.map +0 -1
  705. package/dist/cli/session-picker.d.ts.map +0 -1
  706. package/dist/cli/session-picker.js.map +0 -1
  707. package/dist/cli/startup-ui.d.ts.map +0 -1
  708. package/dist/cli/startup-ui.js.map +0 -1
  709. package/dist/cli.d.ts.map +0 -1
  710. package/dist/cli.js.map +0 -1
  711. package/dist/config.d.ts.map +0 -1
  712. package/dist/config.js.map +0 -1
  713. package/dist/core/agent-session-auto-handoff.test.d.ts.map +0 -1
  714. package/dist/core/agent-session-auto-handoff.test.js.map +0 -1
  715. package/dist/core/agent-session-runtime.d.ts.map +0 -1
  716. package/dist/core/agent-session-runtime.js.map +0 -1
  717. package/dist/core/agent-session-services.d.ts.map +0 -1
  718. package/dist/core/agent-session-services.js.map +0 -1
  719. package/dist/core/agent-session-skill-block.test.d.ts.map +0 -1
  720. package/dist/core/agent-session-skill-block.test.js.map +0 -1
  721. package/dist/core/agent-session.d.ts.map +0 -1
  722. package/dist/core/agent-session.js.map +0 -1
  723. package/dist/core/agents.d.ts.map +0 -1
  724. package/dist/core/agents.js.map +0 -1
  725. package/dist/core/auth-guidance.d.ts.map +0 -1
  726. package/dist/core/auth-guidance.js.map +0 -1
  727. package/dist/core/auth-storage.d.ts.map +0 -1
  728. package/dist/core/auth-storage.js.map +0 -1
  729. package/dist/core/bash-executor.d.ts.map +0 -1
  730. package/dist/core/bash-executor.js.map +0 -1
  731. package/dist/core/built-in-extensions.d.ts.map +0 -1
  732. package/dist/core/built-in-extensions.js.map +0 -1
  733. package/dist/core/cache-stats.d.ts.map +0 -1
  734. package/dist/core/cache-stats.js.map +0 -1
  735. package/dist/core/compaction/branch-summarization.d.ts.map +0 -1
  736. package/dist/core/compaction/branch-summarization.js.map +0 -1
  737. package/dist/core/compaction/compaction.d.ts.map +0 -1
  738. package/dist/core/compaction/compaction.js.map +0 -1
  739. package/dist/core/compaction/index.d.ts.map +0 -1
  740. package/dist/core/compaction/index.js.map +0 -1
  741. package/dist/core/compaction/utils.d.ts.map +0 -1
  742. package/dist/core/compaction/utils.js.map +0 -1
  743. package/dist/core/defaults.d.ts.map +0 -1
  744. package/dist/core/defaults.js.map +0 -1
  745. package/dist/core/diagnostics.d.ts.map +0 -1
  746. package/dist/core/diagnostics.js.map +0 -1
  747. package/dist/core/event-bus.d.ts.map +0 -1
  748. package/dist/core/event-bus.js.map +0 -1
  749. package/dist/core/exec.d.ts.map +0 -1
  750. package/dist/core/exec.js.map +0 -1
  751. package/dist/core/experimental.d.ts.map +0 -1
  752. package/dist/core/experimental.js.map +0 -1
  753. package/dist/core/export-html/ansi-to-html.d.ts.map +0 -1
  754. package/dist/core/export-html/ansi-to-html.js.map +0 -1
  755. package/dist/core/export-html/index.d.ts.map +0 -1
  756. package/dist/core/export-html/index.js.map +0 -1
  757. package/dist/core/export-html/tool-renderer.d.ts.map +0 -1
  758. package/dist/core/export-html/tool-renderer.js.map +0 -1
  759. package/dist/core/extensions/index.d.ts.map +0 -1
  760. package/dist/core/extensions/index.js.map +0 -1
  761. package/dist/core/extensions/loader.d.ts.map +0 -1
  762. package/dist/core/extensions/loader.js.map +0 -1
  763. package/dist/core/extensions/runner.d.ts.map +0 -1
  764. package/dist/core/extensions/runner.js.map +0 -1
  765. package/dist/core/extensions/types.d.ts.map +0 -1
  766. package/dist/core/extensions/types.js.map +0 -1
  767. package/dist/core/extensions/wrapper.d.ts.map +0 -1
  768. package/dist/core/extensions/wrapper.js.map +0 -1
  769. package/dist/core/footer-data-provider.d.ts.map +0 -1
  770. package/dist/core/footer-data-provider.js.map +0 -1
  771. package/dist/core/git-command.d.ts.map +0 -1
  772. package/dist/core/git-command.js.map +0 -1
  773. package/dist/core/http-dispatcher.d.ts.map +0 -1
  774. package/dist/core/http-dispatcher.js.map +0 -1
  775. package/dist/core/index.d.ts.map +0 -1
  776. package/dist/core/index.js.map +0 -1
  777. package/dist/core/keybindings.d.ts.map +0 -1
  778. package/dist/core/keybindings.js.map +0 -1
  779. package/dist/core/llama/client.d.ts.map +0 -1
  780. package/dist/core/llama/client.js.map +0 -1
  781. package/dist/core/llama/huggingface.d.ts.map +0 -1
  782. package/dist/core/llama/huggingface.js.map +0 -1
  783. package/dist/core/llama/index.d.ts.map +0 -1
  784. package/dist/core/llama/index.js.map +0 -1
  785. package/dist/core/llama/provider.d.ts.map +0 -1
  786. package/dist/core/llama/provider.js.map +0 -1
  787. package/dist/core/llama/ui.d.ts.map +0 -1
  788. package/dist/core/llama/ui.js.map +0 -1
  789. package/dist/core/messages.d.ts.map +0 -1
  790. package/dist/core/messages.js.map +0 -1
  791. package/dist/core/model-config.d.ts.map +0 -1
  792. package/dist/core/model-config.js.map +0 -1
  793. package/dist/core/model-registry.d.ts.map +0 -1
  794. package/dist/core/model-registry.js.map +0 -1
  795. package/dist/core/model-resolver.d.ts.map +0 -1
  796. package/dist/core/model-resolver.js.map +0 -1
  797. package/dist/core/model-runtime.d.ts.map +0 -1
  798. package/dist/core/model-runtime.js.map +0 -1
  799. package/dist/core/models-store.d.ts.map +0 -1
  800. package/dist/core/models-store.js.map +0 -1
  801. package/dist/core/output-guard.d.ts.map +0 -1
  802. package/dist/core/output-guard.js.map +0 -1
  803. package/dist/core/package-manager.d.ts.map +0 -1
  804. package/dist/core/package-manager.js.map +0 -1
  805. package/dist/core/package-manager.test.d.ts.map +0 -1
  806. package/dist/core/package-manager.test.js.map +0 -1
  807. package/dist/core/project-trust.d.ts.map +0 -1
  808. package/dist/core/project-trust.js.map +0 -1
  809. package/dist/core/prompt-templates.d.ts.map +0 -1
  810. package/dist/core/prompt-templates.js.map +0 -1
  811. package/dist/core/provider-attribution.d.ts.map +0 -1
  812. package/dist/core/provider-attribution.js.map +0 -1
  813. package/dist/core/provider-composer.d.ts.map +0 -1
  814. package/dist/core/provider-composer.js.map +0 -1
  815. package/dist/core/radius.d.ts.map +0 -1
  816. package/dist/core/radius.js.map +0 -1
  817. package/dist/core/remote-catalog-provider.d.ts.map +0 -1
  818. package/dist/core/remote-catalog-provider.js.map +0 -1
  819. package/dist/core/resolve-config-value.d.ts.map +0 -1
  820. package/dist/core/resolve-config-value.js.map +0 -1
  821. package/dist/core/resource-loader.d.ts.map +0 -1
  822. package/dist/core/resource-loader.js.map +0 -1
  823. package/dist/core/runtime-credentials.d.ts.map +0 -1
  824. package/dist/core/runtime-credentials.js.map +0 -1
  825. package/dist/core/sdk.d.ts.map +0 -1
  826. package/dist/core/sdk.js.map +0 -1
  827. package/dist/core/session-cwd.d.ts.map +0 -1
  828. package/dist/core/session-cwd.js.map +0 -1
  829. package/dist/core/session-manager.d.ts.map +0 -1
  830. package/dist/core/session-manager.js.map +0 -1
  831. package/dist/core/settings-manager-auto-handoff.test.d.ts.map +0 -1
  832. package/dist/core/settings-manager-auto-handoff.test.js.map +0 -1
  833. package/dist/core/settings-manager.d.ts.map +0 -1
  834. package/dist/core/settings-manager.js.map +0 -1
  835. package/dist/core/skills.d.ts.map +0 -1
  836. package/dist/core/skills.js.map +0 -1
  837. package/dist/core/slash-commands.d.ts.map +0 -1
  838. package/dist/core/slash-commands.js.map +0 -1
  839. package/dist/core/source-info.d.ts.map +0 -1
  840. package/dist/core/source-info.js.map +0 -1
  841. package/dist/core/system-prompt.d.ts.map +0 -1
  842. package/dist/core/system-prompt.js.map +0 -1
  843. package/dist/core/system-prompt.test.d.ts.map +0 -1
  844. package/dist/core/system-prompt.test.js.map +0 -1
  845. package/dist/core/telemetry.d.ts.map +0 -1
  846. package/dist/core/telemetry.js.map +0 -1
  847. package/dist/core/timings.d.ts.map +0 -1
  848. package/dist/core/timings.js.map +0 -1
  849. package/dist/core/tools/bash.d.ts.map +0 -1
  850. package/dist/core/tools/bash.js.map +0 -1
  851. package/dist/core/tools/edit-diff.d.ts.map +0 -1
  852. package/dist/core/tools/edit-diff.js.map +0 -1
  853. package/dist/core/tools/edit.d.ts.map +0 -1
  854. package/dist/core/tools/edit.js.map +0 -1
  855. package/dist/core/tools/file-mutation-queue.d.ts.map +0 -1
  856. package/dist/core/tools/file-mutation-queue.js.map +0 -1
  857. package/dist/core/tools/find.d.ts.map +0 -1
  858. package/dist/core/tools/find.js.map +0 -1
  859. package/dist/core/tools/grep.d.ts.map +0 -1
  860. package/dist/core/tools/grep.js.map +0 -1
  861. package/dist/core/tools/index.d.ts.map +0 -1
  862. package/dist/core/tools/index.js.map +0 -1
  863. package/dist/core/tools/ls.d.ts.map +0 -1
  864. package/dist/core/tools/ls.js.map +0 -1
  865. package/dist/core/tools/output-accumulator.d.ts.map +0 -1
  866. package/dist/core/tools/output-accumulator.js.map +0 -1
  867. package/dist/core/tools/path-utils.d.ts.map +0 -1
  868. package/dist/core/tools/path-utils.js.map +0 -1
  869. package/dist/core/tools/read.d.ts.map +0 -1
  870. package/dist/core/tools/read.js.map +0 -1
  871. package/dist/core/tools/render-utils.d.ts.map +0 -1
  872. package/dist/core/tools/render-utils.js.map +0 -1
  873. package/dist/core/tools/tool-definition-wrapper.d.ts.map +0 -1
  874. package/dist/core/tools/tool-definition-wrapper.js.map +0 -1
  875. package/dist/core/tools/truncate.d.ts.map +0 -1
  876. package/dist/core/tools/truncate.js.map +0 -1
  877. package/dist/core/tools/write.d.ts.map +0 -1
  878. package/dist/core/tools/write.js.map +0 -1
  879. package/dist/core/trust-manager.d.ts.map +0 -1
  880. package/dist/core/trust-manager.js.map +0 -1
  881. package/dist/core/usage-totals.d.ts.map +0 -1
  882. package/dist/core/usage-totals.js.map +0 -1
  883. package/dist/extensions/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
  884. package/dist/extensions/pi-subagents/test/unit/slash-chain-groups.test.ts +0 -464
  885. package/dist/index.d.ts.map +0 -1
  886. package/dist/index.js.map +0 -1
  887. package/dist/main.d.ts.map +0 -1
  888. package/dist/main.js.map +0 -1
  889. package/dist/migrations.d.ts.map +0 -1
  890. package/dist/migrations.js.map +0 -1
  891. package/dist/modes/index.d.ts.map +0 -1
  892. package/dist/modes/index.js.map +0 -1
  893. package/dist/modes/interactive/components/armin.d.ts.map +0 -1
  894. package/dist/modes/interactive/components/armin.js.map +0 -1
  895. package/dist/modes/interactive/components/assistant-message.d.ts.map +0 -1
  896. package/dist/modes/interactive/components/assistant-message.js.map +0 -1
  897. package/dist/modes/interactive/components/bash-execution.d.ts.map +0 -1
  898. package/dist/modes/interactive/components/bash-execution.js.map +0 -1
  899. package/dist/modes/interactive/components/bordered-loader.d.ts.map +0 -1
  900. package/dist/modes/interactive/components/bordered-loader.js.map +0 -1
  901. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +0 -1
  902. package/dist/modes/interactive/components/branch-summary-message.js.map +0 -1
  903. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +0 -1
  904. package/dist/modes/interactive/components/compaction-summary-message.js.map +0 -1
  905. package/dist/modes/interactive/components/config-selector.d.ts.map +0 -1
  906. package/dist/modes/interactive/components/config-selector.js.map +0 -1
  907. package/dist/modes/interactive/components/countdown-timer.d.ts.map +0 -1
  908. package/dist/modes/interactive/components/countdown-timer.js.map +0 -1
  909. package/dist/modes/interactive/components/custom-editor.d.ts.map +0 -1
  910. package/dist/modes/interactive/components/custom-editor.js.map +0 -1
  911. package/dist/modes/interactive/components/custom-entry.d.ts.map +0 -1
  912. package/dist/modes/interactive/components/custom-entry.js.map +0 -1
  913. package/dist/modes/interactive/components/custom-message.d.ts.map +0 -1
  914. package/dist/modes/interactive/components/custom-message.js.map +0 -1
  915. package/dist/modes/interactive/components/daxnuts.d.ts.map +0 -1
  916. package/dist/modes/interactive/components/daxnuts.js.map +0 -1
  917. package/dist/modes/interactive/components/diff.d.ts.map +0 -1
  918. package/dist/modes/interactive/components/diff.js.map +0 -1
  919. package/dist/modes/interactive/components/dynamic-border.d.ts.map +0 -1
  920. package/dist/modes/interactive/components/dynamic-border.js.map +0 -1
  921. package/dist/modes/interactive/components/earendil-announcement.d.ts.map +0 -1
  922. package/dist/modes/interactive/components/earendil-announcement.js.map +0 -1
  923. package/dist/modes/interactive/components/extension-editor.d.ts.map +0 -1
  924. package/dist/modes/interactive/components/extension-editor.js.map +0 -1
  925. package/dist/modes/interactive/components/extension-input.d.ts.map +0 -1
  926. package/dist/modes/interactive/components/extension-input.js.map +0 -1
  927. package/dist/modes/interactive/components/extension-selector.d.ts.map +0 -1
  928. package/dist/modes/interactive/components/extension-selector.js.map +0 -1
  929. package/dist/modes/interactive/components/first-time-setup.d.ts.map +0 -1
  930. package/dist/modes/interactive/components/first-time-setup.js.map +0 -1
  931. package/dist/modes/interactive/components/footer.d.ts.map +0 -1
  932. package/dist/modes/interactive/components/footer.js.map +0 -1
  933. package/dist/modes/interactive/components/index.d.ts.map +0 -1
  934. package/dist/modes/interactive/components/index.js.map +0 -1
  935. package/dist/modes/interactive/components/keybinding-hints.d.ts.map +0 -1
  936. package/dist/modes/interactive/components/keybinding-hints.js.map +0 -1
  937. package/dist/modes/interactive/components/login-dialog.d.ts.map +0 -1
  938. package/dist/modes/interactive/components/login-dialog.js.map +0 -1
  939. package/dist/modes/interactive/components/model-selector.d.ts.map +0 -1
  940. package/dist/modes/interactive/components/model-selector.js.map +0 -1
  941. package/dist/modes/interactive/components/oauth-selector.d.ts.map +0 -1
  942. package/dist/modes/interactive/components/oauth-selector.js.map +0 -1
  943. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +0 -1
  944. package/dist/modes/interactive/components/scoped-models-selector.js.map +0 -1
  945. package/dist/modes/interactive/components/session-selector-search.d.ts.map +0 -1
  946. package/dist/modes/interactive/components/session-selector-search.js.map +0 -1
  947. package/dist/modes/interactive/components/session-selector.d.ts.map +0 -1
  948. package/dist/modes/interactive/components/session-selector.js.map +0 -1
  949. package/dist/modes/interactive/components/settings-selector.d.ts.map +0 -1
  950. package/dist/modes/interactive/components/settings-selector.js.map +0 -1
  951. package/dist/modes/interactive/components/show-images-selector.d.ts.map +0 -1
  952. package/dist/modes/interactive/components/show-images-selector.js.map +0 -1
  953. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +0 -1
  954. package/dist/modes/interactive/components/skill-invocation-message.js.map +0 -1
  955. package/dist/modes/interactive/components/status-indicator.d.ts.map +0 -1
  956. package/dist/modes/interactive/components/status-indicator.js.map +0 -1
  957. package/dist/modes/interactive/components/theme-selector.d.ts.map +0 -1
  958. package/dist/modes/interactive/components/theme-selector.js.map +0 -1
  959. package/dist/modes/interactive/components/thinking-selector.d.ts.map +0 -1
  960. package/dist/modes/interactive/components/thinking-selector.js.map +0 -1
  961. package/dist/modes/interactive/components/tool-execution.d.ts.map +0 -1
  962. package/dist/modes/interactive/components/tool-execution.js.map +0 -1
  963. package/dist/modes/interactive/components/tree-selector.d.ts.map +0 -1
  964. package/dist/modes/interactive/components/tree-selector.js.map +0 -1
  965. package/dist/modes/interactive/components/trust-selector.d.ts.map +0 -1
  966. package/dist/modes/interactive/components/trust-selector.js.map +0 -1
  967. package/dist/modes/interactive/components/user-message-selector.d.ts.map +0 -1
  968. package/dist/modes/interactive/components/user-message-selector.js.map +0 -1
  969. package/dist/modes/interactive/components/user-message.d.ts.map +0 -1
  970. package/dist/modes/interactive/components/user-message.js.map +0 -1
  971. package/dist/modes/interactive/components/visual-truncate.d.ts.map +0 -1
  972. package/dist/modes/interactive/components/visual-truncate.js.map +0 -1
  973. package/dist/modes/interactive/external-editor.d.ts.map +0 -1
  974. package/dist/modes/interactive/external-editor.js.map +0 -1
  975. package/dist/modes/interactive/interactive-mode.d.ts.map +0 -1
  976. package/dist/modes/interactive/interactive-mode.js.map +0 -1
  977. package/dist/modes/interactive/model-search.d.ts.map +0 -1
  978. package/dist/modes/interactive/model-search.js.map +0 -1
  979. package/dist/modes/interactive/theme/theme-controller.d.ts.map +0 -1
  980. package/dist/modes/interactive/theme/theme-controller.js.map +0 -1
  981. package/dist/modes/interactive/theme/theme.d.ts.map +0 -1
  982. package/dist/modes/interactive/theme/theme.js.map +0 -1
  983. package/dist/modes/print-mode.d.ts.map +0 -1
  984. package/dist/modes/print-mode.js.map +0 -1
  985. package/dist/modes/rpc/jsonl.d.ts.map +0 -1
  986. package/dist/modes/rpc/jsonl.js.map +0 -1
  987. package/dist/modes/rpc/rpc-client.d.ts.map +0 -1
  988. package/dist/modes/rpc/rpc-client.js.map +0 -1
  989. package/dist/modes/rpc/rpc-mode.d.ts.map +0 -1
  990. package/dist/modes/rpc/rpc-mode.js.map +0 -1
  991. package/dist/modes/rpc/rpc-types.d.ts.map +0 -1
  992. package/dist/modes/rpc/rpc-types.js.map +0 -1
  993. package/dist/package-manager-cli.d.ts.map +0 -1
  994. package/dist/package-manager-cli.js.map +0 -1
  995. package/dist/rpc-entry.d.ts.map +0 -1
  996. package/dist/rpc-entry.js.map +0 -1
  997. package/dist/utils/ansi.d.ts.map +0 -1
  998. package/dist/utils/ansi.js.map +0 -1
  999. package/dist/utils/changelog.d.ts.map +0 -1
  1000. package/dist/utils/changelog.js.map +0 -1
  1001. package/dist/utils/child-process.d.ts.map +0 -1
  1002. package/dist/utils/child-process.js.map +0 -1
  1003. package/dist/utils/clipboard-image.d.ts.map +0 -1
  1004. package/dist/utils/clipboard-image.js.map +0 -1
  1005. package/dist/utils/clipboard-native.d.ts.map +0 -1
  1006. package/dist/utils/clipboard-native.js.map +0 -1
  1007. package/dist/utils/clipboard.d.ts.map +0 -1
  1008. package/dist/utils/clipboard.js.map +0 -1
  1009. package/dist/utils/deprecation.d.ts.map +0 -1
  1010. package/dist/utils/deprecation.js.map +0 -1
  1011. package/dist/utils/exif-orientation.d.ts.map +0 -1
  1012. package/dist/utils/exif-orientation.js.map +0 -1
  1013. package/dist/utils/frontmatter.d.ts.map +0 -1
  1014. package/dist/utils/frontmatter.js.map +0 -1
  1015. package/dist/utils/fs-watch.d.ts.map +0 -1
  1016. package/dist/utils/fs-watch.js.map +0 -1
  1017. package/dist/utils/git.d.ts.map +0 -1
  1018. package/dist/utils/git.js.map +0 -1
  1019. package/dist/utils/html.d.ts.map +0 -1
  1020. package/dist/utils/html.js.map +0 -1
  1021. package/dist/utils/image-convert.d.ts.map +0 -1
  1022. package/dist/utils/image-convert.js.map +0 -1
  1023. package/dist/utils/image-process.d.ts.map +0 -1
  1024. package/dist/utils/image-process.js.map +0 -1
  1025. package/dist/utils/image-resize-core.d.ts.map +0 -1
  1026. package/dist/utils/image-resize-core.js.map +0 -1
  1027. package/dist/utils/image-resize-worker.d.ts.map +0 -1
  1028. package/dist/utils/image-resize-worker.js.map +0 -1
  1029. package/dist/utils/image-resize.d.ts.map +0 -1
  1030. package/dist/utils/image-resize.js.map +0 -1
  1031. package/dist/utils/json.d.ts.map +0 -1
  1032. package/dist/utils/json.js.map +0 -1
  1033. package/dist/utils/mime.d.ts.map +0 -1
  1034. package/dist/utils/mime.js.map +0 -1
  1035. package/dist/utils/open-browser.d.ts.map +0 -1
  1036. package/dist/utils/open-browser.js.map +0 -1
  1037. package/dist/utils/paths.d.ts.map +0 -1
  1038. package/dist/utils/paths.js.map +0 -1
  1039. package/dist/utils/photon.d.ts.map +0 -1
  1040. package/dist/utils/photon.js.map +0 -1
  1041. package/dist/utils/pi-user-agent.d.ts.map +0 -1
  1042. package/dist/utils/pi-user-agent.js.map +0 -1
  1043. package/dist/utils/shell.d.ts.map +0 -1
  1044. package/dist/utils/shell.js.map +0 -1
  1045. package/dist/utils/sleep.d.ts.map +0 -1
  1046. package/dist/utils/sleep.js.map +0 -1
  1047. package/dist/utils/syntax-highlight.d.ts.map +0 -1
  1048. package/dist/utils/syntax-highlight.js.map +0 -1
  1049. package/dist/utils/thinking-tags.d.ts.map +0 -1
  1050. package/dist/utils/thinking-tags.js.map +0 -1
  1051. package/dist/utils/tools-manager.d.ts.map +0 -1
  1052. package/dist/utils/tools-manager.js.map +0 -1
  1053. package/dist/utils/version-check.d.ts.map +0 -1
  1054. package/dist/utils/version-check.js.map +0 -1
  1055. package/dist/utils/windows-self-update.d.ts.map +0 -1
  1056. package/dist/utils/windows-self-update.js.map +0 -1
@@ -4,21 +4,21 @@
4
4
 
5
5
  # pi-subagents
6
6
 
7
- `pi-subagents` lets Selesai delegate work to focused child agents. Use it for code review, scouting, implementation, parallel audits, saved workflows, background jobs, and anything else that benefits from a second or third set of model eyes.
7
+ `pi-subagents` lets Selesai explorer work to focused child agents. Use it for code review, explorering, implementation, parallel audits, saved workflows, background jobs, and anything else that benefits from a second or third set of model eyes.
8
8
 
9
9
  <https://github.com/user-attachments/assets/702554ec-faaf-4635-80aa-fb5d6e292fd1>
10
10
 
11
11
  ## Installation
12
12
 
13
13
  ```bash
14
- pi install npm:pi-subagents
14
+ selesai install npm:pi-subagents
15
15
  ```
16
16
 
17
17
  That is the only required step. You can add optional pieces later.
18
18
 
19
19
  ## Try this first
20
20
 
21
- You do not need to create agents, write config, or learn slash commands. After installing, ask Pi for delegation in plain language:
21
+ You do not need to create agents, write config, or learn slash commands. After installing, ask Selesai for delegation in plain language:
22
22
 
23
23
  ```text
24
24
  Use commentator to review this diff.
@@ -38,13 +38,28 @@ Run parallel commentators: one for correctness, one for tests, and one for unnec
38
38
 
39
39
  That is enough to start.
40
40
 
41
+ ## External CLI agent profiles
42
+
43
+ Agent profiles can opt into a local one-shot command instead of a Selesai child. External runners add no install dependency, but the configured executable must exist at runtime. They are async-only, receive one combined system/task prompt over stdin, and use argv arrays without a shell:
44
+
45
+ ```yaml
46
+ runner:
47
+ type: external-cli
48
+ command: node
49
+ args: ["./scripts/local-commentator.mjs"]
50
+ promptDelivery: stdin
51
+ async: true
52
+ ```
53
+
54
+ External CLI runners support status artifacts, stdout/stderr logs, timeout, and stop. Full stdout and stderr are written to log files, while the in-memory final stdout response and stderr error are limited to their last 64 KiB. Foreground/clarify, steer/resume/interrupt-as-pause, Selesai models/tools/extensions, skills, structured output, nested subagents, and fallback models are intentionally unsupported.
55
+
41
56
  ## What happens
42
57
 
43
- Pi is the parent session. A subagent is a focused child Pi session with its own job.
58
+ Selesai is the parent session. A subagent is a focused child Selesai session with its own job.
44
59
 
45
- When you ask for a subagent, Pi starts the child, gives it the task, and brings the result back. Foreground runs stream in the conversation. Background runs keep working and can be checked later.
60
+ When you ask for a subagent, Selesai starts the child, gives it the task, and brings the result back. Foreground runs stream in the conversation. Background runs keep working and can be checked later.
46
61
 
47
- Installing the extension does not start an automatic commentator in the background. It gives Pi a delegation tool. If you want every implementation reviewed, say that in your prompt or put it in your project instructions:
62
+ Installing the extension does not start an automatic commentator in the background. It gives Selesai a delegation tool. If you want every implementation reviewed, say that in your prompt or put it in your project instructions:
48
63
 
49
64
  ```text
50
65
  When you finish implementing, run a commentator subagent before summarizing.
@@ -78,7 +93,7 @@ Run a review loop on this change until commentators stop finding fixes worth doi
78
93
  Use explorer to understand the auth flow, then have architect turn that into an implementation plan.
79
94
  ```
80
95
 
81
- Those are ordinary Pi requests. Pi decides whether to call `subagent`, which agent to use, and whether a chain or parallel run makes sense.
96
+ Those are ordinary Selesai requests. Selesai decides whether to call `subagent`, which agent to use, and how to express composed work with `workflowScript`.
82
97
 
83
98
  ## Common workflows
84
99
 
@@ -91,7 +106,7 @@ Those are ordinary Pi requests. Pi decides whether to call `subagent`, which age
91
106
  | Implement then review | “Implement this, then review it.” |
92
107
  | Review until clean | “Run a review loop on this change with a max of 3 rounds.” |
93
108
  | Execute a plan carefully | “Have builder implement this approved plan, then run commentators and apply the feedback.” |
94
- | explorer before planning | “Use explorer to inspect the auth flow before planning.” |
109
+ | Explorer before planning | “Use explorer to inspect the auth flow before planning.” |
95
110
  | Run in the background | “Run this in the background.” |
96
111
  | Browse agents | “Show me the available subagents.” |
97
112
  | Use a saved workflow | “Run the review chain on this branch.” |
@@ -104,18 +119,18 @@ The extension ships with builtin agents you can use immediately.
104
119
 
105
120
  | Agent | Use it when you want... |
106
121
  |-------|--------------------------|
107
- | `explorer` | Fast local codebase recon: relevant files, entry points, data flow, risks, and where another agent should start. It reads and reports; it does not edit. |
108
- | `researcher` | Web/docs research with sources: official docs, specs, benchmarks, recent changes, and a concise research brief. |
109
- | `architect` | A concrete implementation plan from existing context. It should read and plan, not edit code. |
110
- | `builder` | Implementation work, including approved commentator handoffs. It edits files, validates, and escalates unapproved decisions instead of guessing. |
111
- | `commentator` | Adversarial review only: checking direction, diffs, plans, and implemented work against the task/plan, tests, edge cases, and simplicity without editing files. |
112
- | `recapper` | A clean current-state handoff: a self-contained summary of where a session stands so a later agent can continue from it. |
122
+ | `explorer` | Fast read-only local codebase reconnaissance: relevant files, entry points, data flow, and risks. |
123
+ | `researcher` | Read-only web/docs research with sources. |
124
+ | `architect` | Read-only architecture and implementation planning from inspected context. |
125
+ | `builder` | Mutation-capable scoped implementation with validation and decision escalation. |
126
+ | `commentator` | Read-only evidence-based review of directions, plans, diffs, and implementations. |
127
+ | `recapper` | Read-only handoff and context synthesis for a later agent. |
113
128
 
114
- A simple rule of thumb: use `explorer` before you understand the code, `researcher` before you trust external facts, `architect` before a bigger change, `builder` to implement, `commentator` to check, and `recapper` when you need a clean current-state handoff.
129
+ A simple rule of thumb: use `explorer` before you understand the code, `researcher` before trusting external facts, `architect` before a bigger change, `builder` to implement, `commentator` to review, and `recapper` for a clean handoff.
115
130
 
116
131
  ## Changing an agent's model
117
132
 
118
- Builtin agents inherit your current Pi default model by default. This keeps new installs from depending on a provider you may not have configured. If you want every subagent without its own model to use a different default, set `subagents.defaultModel`. If you want a role to use a specific model, set an override instead of copying the bundled agent file.
133
+ Builtin agents inherit your current Selesai default model by default. This keeps new installs from depending on a provider you may not have configured. If you want every subagent without its own model to use a different default, set `subagents.defaultModel`. If you want a role to use a specific model, set an override instead of copying the bundled agent file.
119
134
 
120
135
  ```json
121
136
  {
@@ -158,7 +173,7 @@ For a persistent override, edit settings. This example pins the commentator ever
158
173
  A setup that works well in practice is routing agents by task shape instead of running everything on one model. Four tiers:
159
174
 
160
175
  1. **Fast workhorse** — the cheapest capable model at low thinking, for recon, lookups, and mechanical edits. Example: `openai-codex/gpt-5.6-luna:low` on `explorer`.
161
- 2. **Standard well-scoped** — a mid-tier model at medium thinking, for most delegations: routine multi-file edits, focused reviews, straightforward implementation. Example: `openai-codex/gpt-5.6-terra:medium` on `builder` and `commentator`.
176
+ 2. **Standard well-scoped** — a mid-tier model at medium thinking, for most delegations: routine multi-file edits, focused reviews, straightforward implementation. Example: `openai-codex/gpt-5.6-terra:medium` on `builder`, `commentator`, and a lightweight `explorer` agent.
162
177
  3. **Deep but bounded** — a top reasoning model at high thinking, only for hard tasks that arrive with explicit goals and completion criteria. These models tend to loop on vague goals, so keep them off open-ended work. Example: `openai-codex/gpt-5.6-sol:high` on `architect` and commentator-style agents.
163
178
  4. **Taste and intent** — a model that reads human intent well and makes judgment calls without looping, for ambiguous work: UX and design decisions, product tradeoffs, planning from vague requirements, writing quality. Example: `anthropic/claude-fable-5` at `low` for lighter passes and `medium` for harder ones.
164
179
 
@@ -178,9 +193,9 @@ fallbackModels: openai-codex/gpt-5.5:high
178
193
 
179
194
  One more interaction worth knowing for tier 4: forked context over an Anthropic parent transcript with signed thinking blocks forces the child's thinking off, so intent-tier agents work best with fresh context.
180
195
 
181
- Use `~/.selesai/agent/settings.json` for a user override or the project config settings file (`.selesai/settings.json` in standard Pi) for a project override. `subagents.defaultModel` applies to builtin, package, user, and project agents that do not set `model` in frontmatter. Per-run model overrides and `agentOverrides.<name>.model` still win, and explicit agent frontmatter still wins over the global default. The same `agentOverrides` block can change `tools`, `skills`, inherited context, prompt text, or disable a builtin. Matching user and project agents also receive override fields that their frontmatter leaves unset, so a shared project config agent can keep the persona while local settings choose the model.
196
+ Use `~/.selesai/agent/settings.json` for a user override or the project config settings file (`.selesai/settings.json` in standard Selesai) for a project override. `subagents.defaultModel` applies to builtin, package, user, and project agents that do not set `model` in frontmatter. Per-run model overrides and `agentOverrides.<name>.model` still win, and explicit agent frontmatter still wins over the global default. The same `agentOverrides` block can change `tools`, `skills`, inherited context, prompt text, or disable a builtin. Matching user and project agents also receive override fields that their frontmatter leaves unset, so a shared project config agent can keep the persona while local settings choose the model.
182
197
 
183
- By default, project settings resolve from the nearest parent directory that contains a `.selesai` config dir or a legacy `.agents` agent dir, preserving existing nested-project behavior. In monorepos or git worktrees where an incidental nested `.selesai` directory should not shadow the repository-level config, set this in the repository root `.selesai/settings.json`:
198
+ By default, project settings resolve from the nearest parent directory that contains `.selesai` or `.agents`, preserving existing nested-project behavior. In monorepos or git worktrees where an incidental nested `.selesai` directory should not shadow the repository-level config, set this in the repository root `.selesai/settings.json`:
184
199
 
185
200
  ```json
186
201
  {
@@ -190,7 +205,7 @@ By default, project settings resolve from the nearest parent directory that cont
190
205
  }
191
206
  ```
192
207
 
193
- `"git-root"` keeps package discovery, project agents, chains, and `agentOverrides` anchored to the git worktree root when that root also has Pi project config. A nested project can still opt back into nearest-root behavior by setting `"projectRootResolution": "nearest"` in its own `.selesai/settings.json`.
208
+ `"git-root"` keeps package discovery, project agents, chains, and `agentOverrides` anchored to the git worktree root when that root also has Selesai project config. A nested project can still opt back into nearest-root behavior by setting `"projectRootResolution": "nearest"` in its own `.selesai/settings.json`.
194
209
 
195
210
  Set `subagents.defaultThinking` to give builtin, package, user, and project agents without a `thinking` value a shared thinking level, independent of the parent session's default. Project settings win over user settings. Explicit frontmatter, `agentOverrides.<name>.thinking`, and per-run thinking overrides still win; `thinking: false` remains an explicit opt-out:
196
211
 
@@ -207,7 +222,7 @@ Set `subagents.defaultThinking` to give builtin, package, user, and project agen
207
222
 
208
223
  If your provider rejects model IDs with thinking suffixes, set `subagents.disableThinking: true` in user or project settings. That clears bundled builtin thinking defaults in one place; an explicit higher-precedence `agentOverrides.<name>.thinking` value can opt a role back in. Existing custom-agent frontmatter remains authoritative.
209
224
 
210
- Set `subagents.defaultExtensions` to give builtin, package, user, and project agents without an `extensions` field a shared extension allowlist. Absent preserves Pi's normal ambient extension discovery. Present as an empty array, the default sets `extensions: []` for agents that do not explicitly define it, disabling ambient extension loading. Present as a non-empty array, the default supplies that allowlist to agents that do not explicitly define one. Project settings win over user settings. Use `agentOverrides.<name>.extensions` for per-agent settings; explicit custom-agent frontmatter remains authoritative.
225
+ Set `subagents.defaultExtensions` to give builtin, package, user, and project agents without an `extensions` field a shared extension allowlist. Absent preserves Selesai's normal ambient extension discovery. Present as an empty array, the default sets `extensions: []` for agents that do not explicitly define it, disabling ambient extension loading. Present as a non-empty array, the default supplies that allowlist to agents that do not explicitly define one. Project settings win over user settings. Use `agentOverrides.<name>.extensions` for per-agent settings; explicit custom-agent frontmatter remains authoritative.
211
226
 
212
227
  ```json
213
228
  {
@@ -231,7 +246,7 @@ To inspect what `pi-subagents` has actually loaded right now, use:
231
246
  /subagents-models commentator
232
247
  ```
233
248
 
234
- That reports the live runtime mapping, which can differ from settings on disk until you reload Pi.
249
+ That reports the live runtime mapping, which can differ from settings on disk until you reload Selesai.
235
250
 
236
251
  You do not have to spell a model exactly. Model ids are matched fuzzily against the registry, so provider separator variations (`anthropic/claude-sonnet-4`, `anthropic:claude-sonnet-4`, or `anthropic.claude-sonnet-4`), id separator variations (`claude-haiku-4.5` vs `claude-haiku-4-5`), case differences (`Claude-Sonnet-4` vs `claude-sonnet-4`), and optional trailing date stamps (`claude-haiku-4-5-20251001` or `claude-haiku-4-5-2025-10-01` vs `claude-haiku-4-5`) all resolve to the same model. Exact `provider/id` matches still win, and a qualified provider query never silently switches providers — it only matches within the named provider. Ambiguous bare ids that exist under multiple providers still require a provider prefix or the current session's provider to disambiguate.
237
252
 
@@ -243,7 +258,7 @@ The watchdog reviews repo edits, not ordinary conversation. It runs at the safe
243
258
 
244
259
  When enabled, the watchdog also keeps a bounded in-memory current-scope artifact from real user prompts and prepends it to review input by default (`subagents.watchdog.scope.enabled`). Newer prompts supersede and mutate older prompts, so the commentator can flag work that no longer serves the current scope as `scope-drift`. Watchdog auto-follow prompts are not recorded as scope.
245
260
 
246
- You can opt into Scopey-style scope monitoring, inspired by [Scopey](https://github.com/ArchAstro/scopey), by setting `subagents.watchdog.cadence.everyNTools` to run additional non-blocking reviews every N tool results. Cadence warnings are transcript-visible and delivered with Pi's `steer` mode after the current tool boundary; they are never hidden. The same configured watchdog model is used for all checks, so choose a cheap model for frequent monitoring or a strong model for rarer adversarial review.
261
+ You can opt into Scopey-style scope monitoring, inspired by [Scopey](https://github.com/ArchAstro/scopey), by setting `subagents.watchdog.cadence.everyNTools` to run additional non-blocking reviews every N tool results. Cadence warnings are transcript-visible and delivered with Selesai's `steer` mode after the current tool boundary; they are never hidden. The same configured watchdog model is used for all checks, so choose a cheap model for frequent monitoring or a strong model for rarer adversarial review.
247
262
 
248
263
  When the watchdog displays a blocker at `agent_end`, the existing `subagents.watchdog.autoFollow` policy can queue a visible follow-up user message asking the agent to address it. Auto-follow only runs while the watchdog is enabled, respects `maxAttempts`, and stops on repeated identical blockers using `stalemateRepeats`.
249
264
 
@@ -257,7 +272,7 @@ Use `/subagents-watchdog recommend-model` to ask pi-subagents for the current st
257
272
  /subagents-watchdog model recommended
258
273
  ```
259
274
 
260
- `session model recommended` changes only the current Pi session. `model recommended` saves the recommendation to `~/.selesai/agent/settings.json`; it does not turn the watchdog on. Enable it separately with `/subagents-watchdog on` when you want the extra review pass.
275
+ `session model recommended` changes only the current Selesai session. `model recommended` saves the recommendation to `~/.selesai/agent/settings.json`; it does not turn the watchdog on. Enable it separately with `/subagents-watchdog on` when you want the extra review pass.
261
276
 
262
277
  You can also set the model explicitly:
263
278
 
@@ -340,11 +355,43 @@ To keep subagents inside a budget or compliance profile, enforce a model scope.
340
355
 
341
356
  Foreground runs stream progress in the conversation while they run. They default to a generous 30-minute wall-clock timeout when neither the call nor the selected agent provides a timeout; explicit `timeoutMs`/`maxRuntimeMs` and agent defaults win.
342
357
 
343
- Background runs keep working after control returns to you. Inspect active runs with `subagent({ action: "status" })`, or a specific run with `subagent({ action: "status", id: "..." })`. In the TUI, a persistent FleetView below the editor by default shows `main` plus active children with task, elapsed time, and token totals. Set `fleetViewPlacement` to `"aboveEditor"` to move it above the editor. When the focused editor is empty, press `↓` or `←` to activate FleetView, then use `↑`/`↓` or `j`/`k` to select a child and `Enter` to inspect it; printable navigation keys are never intercepted before activation.
358
+ Background runs keep working after control returns to you. Inspect active runs with `subagent({ action: "status" })`, or a specific run with `subagent({ action: "status", id: "..." })`. In the TUI, a persistent FleetView below the editor keeps active work visible as a compact summary. Set `fleetViewPlacement` to `"aboveEditor"` to move it above the editor. When the focused editor is empty, press `↓` or `←` to expand the summary into `main` plus active children with task, elapsed time, and token totals; then use `↑`/`↓` or `j`/`k` to select a child and `Enter` to inspect it. Printable navigation keys are never intercepted before activation.
344
359
 
345
360
  `/subagents-fleet` opens the live fleet inspector with current-session foreground work, recent async children, structured Markdown/tool transcripts, and completed output/session paths. Use `↑`/`↓` or `j`/`k` to select a child, `Shift+K`/`Shift+J` to scroll one line, `PgUp`/`PgDn` to scroll one page, `x`/`Ctrl+O` to toggle tool details, `r` to refresh, and `Esc` to close. For a selected live async child, `s` sends an acknowledged steer message and `D` stops its top-level async run after confirmation. `Ctrl+Alt+F` opens the same inspector even while a foreground turn is active and slash input is queued. Without a TUI, `/subagents-fleet` retains the textual `subagent({ action: "status", view: "fleet" })` fallback, and mutations use explicit commands: run `/subagents-stop` and pick from the selector, or use `/subagents-stop <run-id>` / `subagent({ action: "stop", id: "..." })` when you already know the id. Use `/subagents-detach [run-id]` only for an active foreground single-subagent run you want to leave running without terminating; the eventual result remains available through status/wait. To inspect one background child in text, use `subagent({ action: "status", id: "...", view: "transcript" })`; add `index` for a specific child in a parallel or chain run.
346
361
 
347
- FleetView replaces the legacy above-editor async widget by default, while completion notifications remain enabled. Parallel runs show every active child independently. Chains with parallel groups keep their grouped shape in progress and results, so failed or paused agents stay visible next to completed ones. When a child is explicitly allowed to fan out with `tools: subagent`, its nested runs appear under that parent child in the main status tree instead of being hidden inside the child process.
362
+ FleetView replaces the legacy above-editor async widget by default. Successful background completions stay quiet so inactive Selesai tabs are not marked unread, while failed or paused completions still notify the originating session. Parallel runs show every active child independently. Chains with parallel groups keep their grouped shape in progress and results, so failed or paused agents stay visible next to completed ones. When a child is explicitly allowed to fan out with `tools: subagent`, its nested runs appear under that parent child in the main status tree instead of being hidden inside the child process.
363
+
364
+ When Selesai runs inside [Herdr](https://herdr.dev), pi-subagents automatically reports active async-run counts through Herdr pane metadata. The bridge is enabled only when Herdr supplies `HERDR_ENV=1` and `HERDR_PANE_ID`; outside Herdr it registers no listeners or timers. It restores current-session active runs after `/reload` or `/resume`, refreshes metadata while work is active, and clears it on completion or shutdown. To show the reported label in the expanded Agent sidebar, include `state_text` or `$summary` in its row layout, for example:
365
+
366
+ ```toml
367
+ [ui.sidebar.agents]
368
+ rows = [
369
+ ["state_icon", "workspace", "tab"],
370
+ ["agent", "state_text"],
371
+ ]
372
+ ```
373
+
374
+ The bridge uses Herdr's existing `herdr:blocked` sibling event when an async child needs attention. It also emits `herdr:busy` while async work remains. Herdr versions that support that sibling event keep the pane's semantic state `working`; older versions ignore it safely and still display the metadata label while the Selesai integration remains the lifecycle authority.
375
+
376
+ Herdr 0.7.5+ can also open an on-demand inspector for an existing async run:
377
+
378
+ ```ts
379
+ subagent({ action: "inspector.open", id: "<run-id>", index: 0, focus: true })
380
+ subagent({ action: "inspector.status", id: "<run-id>", index: 0 })
381
+ subagent({ action: "inspector.close", id: "<run-id>", index: 0 })
382
+ ```
383
+
384
+ The inspector is a raw dashboard pane, not the child process and not a literal attach. It reads lifecycle/status/output/mission artifacts and sends `steer` or `stop` through pi-subagents' existing control inbox. Closing it never stops the run. Herdr remains optional, ordinary launches stay headless, and missing/older Herdr versions affect only Herdr-specific inspector and project-pane actions. FleetView opens the selected active async child with `H`. Use `focus` only with `inspector.open`; Herdr 0.7.5 cannot focus an arbitrary existing raw pane id.
385
+
386
+ For substantial work in another codebase, Herdr 0.7.5+ can open a project-owned Selesai pane rooted in that repository:
387
+
388
+ ```ts
389
+ subagent({ action: "project.open", cwd: "/path/to/repo", message: "Own the auth refresh mission for this project." })
390
+ subagent({ action: "project.status", cwd: "/path/to/repo" })
391
+ subagent({ action: "project.close", cwd: "/path/to/repo" })
392
+ ```
393
+
394
+ A project pane runs its own Selesai session in the target directory, so subagents launched from that pane use that project's config, agents, skills, files, git state, and missions. The parent session keeps coordination authority; existing headless runs are not moved into the pane. Pane bindings live under `<projectRoot>/.pi-subagents/project-panes/herdr.json` and are only a local pointer to the Herdr pane.
348
395
 
349
396
  You can also ask naturally:
350
397
 
@@ -354,13 +401,13 @@ Show me the current async runs.
354
401
 
355
402
  Lifecycle artifact v3 adds `process-terminal-candidate.json` (private runner evidence) and `process-terminal.json` (the public proof projection). A proof is `observed` only after the live parent observes the exact detached runner's `close` event, every recorded child writer has a close record, and any tracked canonical-session lease is free. If the observer is unavailable, the proof is `unknown`; do not infer process exit from `endedAt`, result-file existence, PID disappearance, or lease-directory absence. The `subagent:process-terminal` event and RPC `ping.capabilities.processTerminalProof` expose this status. Process proof is point-in-time evidence and remains separate from execution success or stopped/non-resumable state.
356
403
 
357
- Async runs also write machine-readable lifecycle artifacts for observability and workflow gates. For a top-level async run, `details.asyncDir` points at a directory containing `status.json`, `events.jsonl`, `output-<index>.log`, and `subagent-log-<runId>.md`; the final summary is written to Pi's subagent results directory as `<runId>.json`. Nested async runs use the same shape under the nested async root and are discoverable through status projections that read the nested-run registry. These files are append/update artifacts only; interactive foreground behavior is unchanged.
404
+ Async runs also write machine-readable lifecycle artifacts for observability and workflow gates. For a top-level async run, `details.asyncDir` points at a directory containing `status.json`, `events.jsonl`, `output-<index>.log`, and `subagent-log-<runId>.md`; the final summary is written to Selesai's subagent results directory as `<runId>.json`. Nested async runs use the same shape under the nested async root and are discoverable through status projections that read the nested-run registry. These files are append/update artifacts only; interactive foreground behavior is unchanged.
358
405
 
359
- Foreground and async runners share bounded child-protocol handling. A child JSONL line above 4 MiB fails with structured `protocolError` code `protocol_output_limit`, stderr retains only its latest 128 KiB, split UTF-8 and final unterminated JSON events remain valid, and `agent_end.willRetry` defers completion until the child settles. Current Pi builds use `agent_settled` as the terminal watermark; older builds retain the bounded terminal-message fallback.
406
+ Foreground and async runners share bounded child-protocol handling. A child JSONL line above 16 MiB fails with structured `protocolError` code `protocol_output_limit`; oversized Selesai `turn_end` and `agent_end` aggregates are the exception because they duplicate granular events, so runners replace them with bounded lifecycle records while preserving `agent_end.willRetry`. Stderr retains only its latest 128 KiB, split UTF-8 and final unterminated JSON events remain valid, and `agent_end.willRetry` defers completion until the child settles. Current Selesai builds use `agent_settled` as the terminal watermark; older builds retain the bounded terminal-message fallback.
360
407
 
361
- The stable v1 status/result fields are `lifecycleArtifactVersion`, `runId`/`id`, `sessionId`, `mode`, `state`, `startedAt`, `lastUpdate`, `endedAt`, `durationMs`, `cwd`, `asyncDir`, `sessionFile`, `outputFile`, `workflowGraph`, `steps`, `results`, `totalTokens`, `totalCost`, `model`/`attemptedModels`/`modelAttempts`, `toolCount`, `turnCount`, optional `launchResolvedExtensions`, optional `runtimeAcknowledgedExtensions`, and nested `children` when a child is allowed to launch subagents. `launchResolvedExtensions` is parent-resolved launch intent only: it reports opaque extension identifiers and whether ambient extensions were disabled, without exposing raw extension paths or claiming the child runtime acknowledged that those extensions loaded. Cooperating child extensions can acknowledge child-runtime registration by emitting `subagent:acknowledge-extension` on the child process `pi.events` bus with payload `{ id: string }`. Acknowledgement ids are self-declared opaque strings, must be non-empty, at most 128 characters, contain only `A-Z`, `a-z`, `0-9`, `.`, `_`, `:`, `@`, `+`, or `-`, and must not contain `/`, `\\`, or `..`. The reported `runtimeAcknowledgedExtensions` projection is `{ version: 1, source: "child-runtime", ids, omitted }`, deduplicates ids, keeps at most 32 ids, and counts additional valid unique ids in `omitted`. It is best-effort observability only: absence means no cooperating extension acknowledged, and presence means only that the extension registered in the child runtime, not that its tools, health checks, or features succeeded. Late acknowledgements after terminal serialization are ignored. `events.jsonl` records lifecycle transitions such as `subagent.run.started`, `subagent.step.started`, `subagent.step.completed`/`failed`/`paused`/`stopped`, control attention events, nested interrupt failures, and `subagent.run.completed`/`stopped`; run boundary events include the lifecycle artifact version. Consumers should read these JSON files instead of scraping terminal output; unknown fields and event types should be ignored for forward compatibility.
408
+ The status/result fields are `lifecycleArtifactVersion`, `runId`/`id`, `sessionId`, `mode`, `state`, `startedAt`, `lastUpdate`, `endedAt`, `durationMs`, `cwd`, `asyncDir`, `sessionFile`, `outputFile`, `workflowGraph`, `steps`, `results`, `totalTokens`, `totalCost`, `model`/`attemptedModels`/`modelAttempts`, `toolCount`, `turnCount`, optional `launchResolvedExtensions`, optional `runtimeAcknowledgedExtensions`, and nested `children` when a child is allowed to launch subagents. `launchResolvedExtensions` is parent-resolved launch intent only: it reports opaque extension identifiers and whether ambient extensions were disabled, without exposing raw extension paths or claiming the child runtime acknowledged that those extensions loaded. Cooperating child extensions can acknowledge child-runtime registration by emitting `subagent:acknowledge-extension` on the child process `pi.events` bus with payload `{ id: string }`. Acknowledgement ids are self-declared opaque strings, must be non-empty, at most 128 characters, contain only `A-Z`, `a-z`, `0-9`, `.`, `_`, `:`, `@`, `+`, or `-`, and must not contain `/`, `\\`, or `..`. The reported `runtimeAcknowledgedExtensions` projection is `{ version: 1, source: "child-runtime", ids, omitted }`, deduplicates ids, keeps at most 32 ids, and counts additional valid unique ids in `omitted`. It is best-effort observability only: absence means no cooperating extension acknowledged, and presence means only that the extension registered in the child runtime, not that its tools, health checks, or features succeeded. Late acknowledgements after terminal serialization are ignored. `events.jsonl` records lifecycle transitions such as `subagent.run.started`, `subagent.step.started`, `subagent.step.completed`/`failed`/`paused`/`stopped`, control attention events, nested interrupt failures, and `subagent.run.completed`/`stopped`; run boundary events include the lifecycle artifact version. Consumers should read these JSON files instead of scraping terminal output; unknown fields and event types should be ignored for forward compatibility.
362
409
 
363
- Other Pi extensions can use the versioned in-process event-bus RPC instead of scraping slash output or calling internal modules. Listen for `subagents:rpc:v1:ready`, send requests on `subagents:rpc:v1:request`, and read replies from `subagents:rpc:v1:reply:<requestId>`. The `ping` capability metadata also advertises `events.asyncComplete` for exact process-local completion correlation after RPC `spawn`. Delegation v1/v2 progress updates carry `runId` as soon as foreground execution allocates it, so a caller can retain the package-owned revival target even if its own tool turn is interrupted before the terminal response. Foreground `details.results[]` rows also include a numeric `index` that is unique within the run and stable across partial progress snapshots and the final result; use `(runId, index)` instead of row position to correlate single, counted parallel, and chain children.
410
+ Other Selesai extensions can use the in-process event-bus RPC instead of scraping slash output or calling internal modules. Listen for `subagents:rpc:v1:ready`, send requests on `subagents:rpc:v1:request`, and read replies from `subagents:rpc:v1:reply:<requestId>`. The `ping` capability metadata also advertises `events.asyncComplete` for exact process-local completion correlation after RPC `spawn`. Structured delegation progress updates carry `runId` as soon as foreground execution allocates it, so a caller can retain the package-owned revival target even if its own tool turn is interrupted before the terminal response. Foreground `details.results[]` rows also include a numeric `index` that is unique within the run and stable across partial progress snapshots and the final result; use `(runId, index)` instead of row position to correlate single, counted parallel, and chain children.
364
411
 
365
412
  ```typescript
366
413
  const requestId = crypto.randomUUID();
@@ -376,9 +423,9 @@ pi.events.emit("subagents:rpc:v1:request", {
376
423
  });
377
424
  ```
378
425
 
379
- The v1 methods are `ping`, `status`, `spawn`, `steer`, `interrupt`, `stop`, and `resume`. `status`, `steer`, `interrupt`, and `resume` reuse the normal package-owned actions. `ping.capabilities.launchResolvedExtensions` advertises the optional launch-resolved extension projection in status details. `ping.capabilities.runtimeAcknowledgedExtensions` advertises the optional child-runtime acknowledgement projection and event name. When `ping.capabilities.fleetStatus` is `{ version: 1 }`, successful `status` replies additionally include `data.fleet`: `{ version: 1, entries, totalActive, omitted }`. Entries are bounded, current-session public display records with an opaque reconciliation `key`, resolved `agent`, optional `role`, `model`, `effort`, caller-facing `goal`, safe `startedAt`, and `{ input, output, total }` tokens. `totalActive` and `omitted` preserve overflow information beyond the bounded entry window. The DTO intentionally never exposes run, async, or tool IDs; clients must ignore unknown fields and fall back to status text when the capability is absent. `steer` requires an async run `id` (plus optional child `index`) and a non-empty `message`; its reply preserves the normal acknowledged-delivery result. RPC steering disables the direct tool's pause-and-revive recovery so an extension keeps authority over the exact child it spawned; `ping.capabilities.nonRecoveringSteer` advertises this guarantee. `resume` requires a run target and non-empty `message`; it builders to the existing revival path, which validates current-session ownership, persisted session/recovery metadata, stopped/live state, capability ceilings, and the exclusive session lease before returning the new async run details. Callers may request a `file-only` output path for the revived result without overriding its model, tools, or budgets. `ping.capabilities.resume` advertises this seam. `spawn` is async-only: omit `async` or set `async: true`, omit `clarify` or set `clarify: false`, and do not pass management `action` values. It goes through the same executor as the `subagent` tool, so agent discovery, validation, session attribution, configured spawn caps, child-safety depth, artifacts, and async status all behave the same. `stop` targets current-session top-level async runs through the stop control channel and records a `stopped` lifecycle instead of reporting a timeout.
426
+ The RPC methods are `ping`, `status`, `spawn`, `steer`, `interrupt`, `stop`, and `resume`. `status`, `steer`, `interrupt`, and `resume` reuse the normal package-owned actions. `ping.capabilities.launchResolvedExtensions` advertises the optional launch-resolved extension projection in status details. `ping.capabilities.runtimeAcknowledgedExtensions` advertises the optional child-runtime acknowledgement projection and event name. When `ping.capabilities.fleetStatus` is `{ version: 1 }`, successful `status` replies additionally include `data.fleet`: `{ version: 1, entries, totalActive, omitted }`. Entries are bounded, current-session public display records with an opaque reconciliation `key`, resolved `agent`, optional `role`, `model`, `effort`, caller-facing `goal`, safe `startedAt`, and `{ input, output, total }` tokens. `totalActive` and `omitted` preserve overflow information beyond the bounded entry window. The DTO intentionally never exposes run, async, or tool IDs; clients must ignore unknown fields and fall back to status text when the capability is absent. `steer` requires an async run `id` (plus optional child `index`) and a non-empty `message`; its reply preserves the normal acknowledged-delivery result. RPC steering disables the direct tool's pause-and-revive recovery so an extension keeps authority over the exact child it spawned; `ping.capabilities.nonRecoveringSteer` advertises this guarantee. `resume` requires a run target and non-empty `message`; it explorers to the existing revival path, which validates current-session ownership, persisted session/recovery metadata, stopped/live state, capability ceilings, and the exclusive session lease before returning the new async run details. Callers may request a `file-only` output path for the revived result without overriding its model, tools, or budgets. `ping.capabilities.resume` advertises this seam. `spawn` is async-only: omit `async` or set `async: true`, omit `clarify` or set `clarify: false`, and do not pass management `action` values. It goes through the same executor as the `subagent` tool, so agent discovery, validation, session attribution, configured spawn caps, child-safety depth, artifacts, and async status all behave the same. `stop` targets current-session top-level async runs through the stop control channel and records a `stopped` lifecycle instead of reporting a timeout.
380
427
 
381
- `pi.events` is in-process only. It does not reach separate Pi processes or child subagents; use the file lifecycle artifacts or `pi-intercom` for cross-process coordination.
428
+ `pi.events` is in-process only. It does not reach separate Selesai processes or child subagents; use the file lifecycle artifacts or `pi-intercom` for cross-process coordination.
382
429
 
383
430
  If something feels misconfigured, run:
384
431
 
@@ -402,7 +449,7 @@ clarify → architect → builder → fresh commentators → builder
402
449
 
403
450
  Use the optional prompt shortcuts below when you want the pattern to be repeatable.
404
451
 
405
- Packaged `architect` and `recapper` default to forked context when a launch omits `context`; `builder`, `commentator`, `explorer`, and `researcher` default to fresh context. Pass explicit `context: "fresh"` or `context: "fork"` when you intentionally want one context for every child.
452
+ Packaged `architect`, `builder`, `commentator`, and `commentator` default to forked context when a launch omits `context`; pass `context: "fresh"` when you intentionally want a fresh child run.
406
453
 
407
454
  Child-safety boundaries are enforced at runtime. Spawned child sessions do not receive the bundled `pi-subagents` skill, and forked child context filtering removes parent-only subagent artifacts (including old hidden orchestration-instruction messages, slash/status/control messages, and prior parent `subagent` tool-call/tool-result history) while preserving ordinary prose and unrelated tool calls/results. By default, children do not register the `subagent` tool and receive boundary instructions that they are not the parent orchestrator and must not propose or run subagents. The explicit exception is an agent whose resolved builtin `tools` includes `subagent`; that child gets a child-safe `subagent` tool for the fanout work the parent assigned, still bounded by `maxSubagentDepth`.
408
455
 
@@ -417,14 +464,14 @@ The package includes reusable prompt templates for common workflows. You do not
417
464
  | `/parallel-research` | Combine `researcher` and `explorer` for external evidence, local code context, and practical tradeoffs. |
418
465
  | `/parallel-context-build` | Run `explorer` agents in parallel to produce planning handoff context and meta-prompts. |
419
466
  | `/parallel-handoff-plan` | Combine external research and `explorer` passes into an implementation handoff plan and meta-prompt. |
420
- | `/gather-context-and-clarify` | explorer/research first, then ask the user the clarification questions that matter. |
467
+ | `/gather-context-and-clarify` | Explorer/research first, then ask the user the clarification questions that matter. |
421
468
  | `/parallel-cleanup` | Run review-only cleanup passes after implementation. |
422
469
 
423
470
  Add `autofix` to `/parallel-review` or `/parallel-cleanup` to apply only the synthesized fixes worth doing now after commentators return.
424
471
 
425
472
  ## Native supervisor coordination
426
473
 
427
- Child agents can talk back to the parent Pi session without installing `pi-intercom`. `pi-subagents` now provides the child-facing `contact_supervisor` tool and the parent-facing `subagent_supervisor({ action: "reply" })` path natively. If no external `pi-intercom` tool owns the `intercom` name, the native channel also exposes `intercom` as a compatibility fallback.
474
+ Child agents can talk back to the parent Selesai session without installing `pi-intercom`. `pi-subagents` now provides the child-facing `contact_supervisor` tool and the parent-facing `subagent_supervisor({ action: "reply" })` path natively. If no external `pi-intercom` tool owns the `intercom` name, the native channel also exposes `intercom` as a compatibility fallback.
428
475
 
429
476
  Use it for work where the child might need a decision instead of guessing:
430
477
 
@@ -438,9 +485,9 @@ Ask commentator to review this plan. If it sees a decision I need to make, have
438
485
 
439
486
  The child can use one dedicated coordination tool:
440
487
 
441
- - `contact_supervisor`: the child contacts the parent/supervisor session that delegated the task. Use `reason: "need_decision"` for blocking decisions or clarification, `reason: "interview_request"` for structured input, and `reason: "progress_update"` for short non-blocking updates when a discovery changes the plan. Do not ask for clarification when the only conflict is review-only/no-edit versus progress-writing or artifact-writing instructions; no-edit wins.
488
+ - `contact_supervisor`: the child contacts the parent/supervisor session that explorerd the task. Use `reason: "need_decision"` for blocking decisions or clarification, `reason: "interview_request"` for structured input, and `reason: "progress_update"` for short non-blocking updates when a discovery changes the plan. Do not ask for clarification when the only conflict is review-only/no-edit versus progress-writing or artifact-writing instructions; no-edit wins.
442
489
 
443
- The parent replies with `subagent_supervisor({ action: "reply", replyTo, message })` or checks pending requests with `subagent_supervisor({ action: "pending" })`. Supervisor messages are scoped to the exact Pi session id that spawned the child. A second Pi session in the same repository does not receive those requests.
490
+ The parent replies with `subagent_supervisor({ action: "reply", replyTo, message })` or checks pending requests with `subagent_supervisor({ action: "pending" })`. Supervisor messages are scoped to the exact Selesai session id that spawned the child. A second Selesai session in the same repository does not receive those requests.
444
491
 
445
492
  Child-side routine completion handoffs are still not expected. If a child appears stalled, needs-attention notices can show up in the parent session with useful next actions, such as checking `subagent({ action: "status" })`, interrupting the run, or nudging the child.
446
493
 
@@ -452,107 +499,61 @@ If messages do not show up, run:
452
499
 
453
500
  For normal use, you do not need to configure anything. Advanced users can tune the bridge with `intercomBridge` in the configuration section below.
454
501
 
455
- At this point, you know enough to use the plugin. The rest of this README is reference material for exact command syntax, custom agents, saved chains, worktrees, and configuration.
502
+ At this point, you know enough to use the plugin. The rest of this README is reference material for exact command syntax, custom agents, scripted workflows, and configuration.
456
503
 
457
- ## Optional pi-permission-system integration
504
+ ## Native child tool permissions
458
505
 
459
- [`@gotgenes/pi-permission-system`](https://github.com/gotgenes/pi-packages/tree/main/packages/pi-permission-system)
460
- adds a second policy layer — `allow` / `ask` / `deny` — on top of
461
- pi-subagents' visibility-based tool restrictions.
506
+ Native permissions are opt-in and apply only to Selesai child runtimes. With no rules configured, every tool call passes through unchanged. Configure explicit non-bash rules globally in `~/.selesai/agent/extensions/subagent/config.json`:
462
507
 
463
- The two compose independently:
464
-
465
- | Layer | What it controls | Who provides it |
466
- |-------|-----------------|-----------------|
467
- | Visibility | Which tools are registered before the session starts | pi-subagents (`tools:` frontmatter key) |
468
- | Policy | Runtime allow/ask/deny decisions on every tool call, bash command, MCP operation | pi-permission-system (`permission:` frontmatter key) |
469
-
470
- ### Installing
471
-
472
- ```bash
473
- pi install npm:@gotgenes/pi-permission-system
508
+ ```json
509
+ {
510
+ "permissions": {
511
+ "rules": {
512
+ "read": "allow",
513
+ "write": "ask",
514
+ "edit": "deny"
515
+ }
516
+ }
517
+ }
474
518
  ```
475
519
 
476
- No configuration is required for the integration — it is automatic when both
477
- extensions are installed. pi-subagents passes the parent session identity
478
- to child processes via the `PI_SUBAGENT_PARENT_SESSION` environment variable,
479
- which the permission system uses to forward `ask` prompts from headless
480
- subagent processes back to the parent session's UI.
481
-
482
- ### Per-agent permission frontmatter
483
-
484
- Agent files can include a `permission:` block alongside the standard `tools:`
485
- key. The permission system reads it independently:
520
+ Custom agents can override matching global rules with a `permission:` or `permissions:` frontmatter block:
486
521
 
487
522
  ```yaml
488
523
  ---
489
524
  name: builder
490
- tools: bash,read,write,edit
491
525
  permission:
492
- "*": ask
493
- read: allow
494
- bash:
495
- "*": ask
496
- "git *": allow
497
- "npm test": allow
526
+ write: allow
527
+ edit: ask
498
528
  ---
499
529
  ```
500
530
 
501
- In this example the subagent extension restricts visibility to four tools,
502
- and the permission system then applies `ask`/`allow` policy within that
503
- visible set. Both keys coexist without collision.
531
+ Rules support `allow`, `ask`, and `deny`. Agent rules override matching global rules; omitted and unknown tools default to `allow`. Explicit `allow` removes an inherited restriction. The gate is not registered when the resolved policy has no `ask` or `deny` rules.
504
532
 
505
- ### Checking the integration
533
+ An explicit `ask` pauses that exact tool call and sends a bounded, redacted preview to a one-call permission arbiter owned by the built-in child watchdog. The arbiter uses the configured child-watchdog model and returns only `approve` or `deny`; it does not notify the parent agent. Enable and configure `subagents.watchdog.children` before using `ask` rules. A disabled watchdog, missing model/auth, timeout, malformed response, or runtime error denies the call with a clear error.
506
534
 
507
- Run `/subagents-doctor` to check the permission system status.
508
- If `ask` prompts from children are not reaching the parent UI, verify both
509
- extensions are installed:
510
-
511
- ```bash
512
- pi list
513
- ```
535
+ Asked requests and decisions are written to bounded audit JSONL, including `decisionSource: "watchdog"` and bounded failure reasons. Ordinary direction and clarification through `contact_supervisor` or the optional `pi-intercom` extension remain separate and are never permission-gated.
514
536
 
515
- ### How it works
537
+ `bash` is always passed through by pi-subagents. Bash rules are rejected rather than parsed, gated, denied, or audited. Install and configure `pi-guard` when command-level bash policy is needed.
516
538
 
517
- At session start, the interactive (root) session records its own identity in
518
- `PI_SUBAGENT_PARENT_SESSION`. When pi-subagents launches a child, it passes the
519
- launching session's identity to that child explicitly, falling back to the
520
- inherited environment variable. When the permission system inside a child
521
- encounters an `ask` permission, it reads this variable to locate the parent
522
- session and forwards the confirmation request there.
539
+ A pi-subagents child is headless, so a pi-guard rule that resolves to `ask` cannot request approval from the parent Selesai UI. Native permissions do not forward pi-guard decisions; they only apply to the separate non-bash child permission gate. For child-specific policy, use `PI_GUARD` through a `SELESAI_SUBAGENT_PI_BINARY` wrapper or an equivalent launch wrapper, and configure explicit `allow` or `deny` rules. An `allow` rule grants execution; it is not approval forwarding, so retain explicit denies for commands the child must not run.
523
540
 
524
- This resolves an interactive prompt only when the parent it points at is the
525
- interactive session — i.e. for the direct children of the root session. A
526
- nested child's parent is itself a headless subagent process with no UI to
527
- surface the prompt, so `ask` policies are best placed on agents that run as
528
- direct children of the interactive session.
541
+ External CLI profiles are opaque processes, so native permissions cannot intercept their tools. A launch with effective `ask` or `deny` rules is rejected for an external CLI agent instead of claiming enforcement.
529
542
 
530
543
  ## Direct commands
531
544
 
532
- Skip this section until you want exact syntax.
533
-
534
- | Command | Description |
535
- |---------|-------------|
536
- | `/run <agent> [task]` | Run one agent; omit the task for self-contained agents |
537
- | `/chain agent1 "task1" -> agent2 "task2"` | Run agents in sequence |
538
- | `/chain explorer "scan" -> (commentator "A" \| commentator "B") -> writer "fix"` | Run a chain with a static parallel group inline |
539
- | `/parallel agent1 "task1" -> agent2 "task2"` | Run agents in parallel |
540
- | `/run-chain <chainName> -- <task>` | Launch a saved `.chain.md` or `.chain.json` workflow |
541
- | `/subagent-cost` | Show parent plus child subagent token usage and cost for this session |
542
- | `/subagents [agent] [model\|thinking\|prompt\|details]` | Interactively inspect or edit an agent's model, thinking level, or system prompt |
543
- | `/subagents-doctor` | Show read-only setup diagnostics |
544
- | `/subagents-detach [run-id]` | Detach an active foreground single-subagent run without terminating its child |
545
- | `/subagents-models [agent]` | Show the runtime-loaded builtin model mapping, optionally filtered to one builtin |
546
- | `/subagents-watchdog [status|on|off|recommend-model|model ...|session model ...|check]` | Show or configure the opt-in watchdog; use a strong complementary model such as Opus 4.8 high or GPT 5.5 high |
547
- | `/subagents-profiles` | List saved subagent profiles from `~/.selesai/agent/profiles/pi-subagents/` |
548
- | `/subagents-load-profile <name>` | Replace only `settings.subagents` with a saved profile and optionally switch this session to the profile builder model |
549
- | `/subagents-refresh-provider-models <provider> [--force]` | Create or refresh the cached provider model catalog |
550
- | `/subagents-generate-profiles <provider>` | Generate `<provider>.quota.json` and `<provider>.quality.json` profiles |
551
- | `/subagents-check-profile <name>` | Check a saved profile against the current registry and live model probes |
552
-
553
- Commands validate agent names locally, support tab completion, and send results back into the conversation.
554
-
555
- `/subagents` opens a compact administration flow for builtin, package, user, and project agents. Model choices refresh Pi's model registry first, thinking choices are filtered to levels declared by the selected model, and prompt editing uses Pi's native multiline editor; press Ctrl+G to open the configured external editor. Full metadata is opt-in through `details`. Edits are persisted to the field-owning layer: explicit custom-agent frontmatter remains in the agent file, while settings/profile-managed fields remain in `settings.subagents.agentOverrides`. Package-owned fields and definitions loaded through `PI_SUBAGENT_EXTRA_AGENT_DIRS` stay read-only; settings can still supply model or thinking fields omitted by a package definition.
545
+ Use `/run <agent> [task] [--bg] [--fork]` for one child. Multi-agent orchestration is expressed through `workflowScript` in the `subagent` tool; the legacy `/chain`, `/parallel`, and `/run-chain` commands are not registered.
546
+
547
+ ### Inline invocation
548
+
549
+ In interactive chat, `#agent-name` at the start of a message runs that agent directly, like `/run agent-name task` — type `#` in the editor to autocomplete installed agents:
550
+
551
+ ```text
552
+ #architect Turn this plan into a step-by-step implementation plan.
553
+ #commentator What am I missing here?
554
+ ```
555
+
556
+ Unknown or ambiguous agent names are reported via a notification and the input is consumed (nothing is sent to the main agent). Like `/run`, the task text is passed to the agent as its prompt.
556
557
 
557
558
  ### Profiles and provider model catalogs
558
559
 
@@ -580,132 +581,24 @@ Use the profile workflow like this:
580
581
 
581
582
  `/subagents-generate-profiles` uses the provider catalog to produce quota and quality profiles. `/subagents-check-profile` re-checks each assigned model in a saved profile against the current registry and a live probe so you can detect model removals, auth problems, or stale assignments.
582
583
 
583
- ### Per-step tasks
584
-
585
- Use `->` to separate steps and give each step its own task:
586
-
587
- ```text
588
- /chain explorer "scan the codebase" -> architect "create an implementation plan"
589
- /parallel scanner "find security issues" -> commentator "check code style"
590
- ```
591
-
592
- Both double and single quotes work. You can also use `--` as a delimiter:
593
-
594
- ```text
595
- /chain explorer -- scan code -> architect -- analyze auth
596
- ```
597
-
598
- Steps without a task inherit behavior from the execution mode. Chain steps get `{previous}`, the prior step’s output. Parallel steps use the first available task as a fallback.
599
-
600
- ### Inline parallel groups in `/chain`
601
-
602
- Wrap a group of agents in parentheses and separate them with `|` to fan them out within a single chain step. The group runs all of its tasks concurrently, then the next `->` step continues once they finish:
603
-
604
- ```text
605
- /chain explorer "scan" -> (commentator "review A" | commentator "review B") -> writer "fix"
606
- ```
607
-
608
- Notes:
609
-
610
- - Groups must contain at least two tasks separated by ` | `, each with its own task.
611
- - Group syntax is only valid between ` -> ` separators, and the group must appear as a complete step.
612
- - Only a step that *opens* with `(` is a group. Parentheses inside a shared `--` task (e.g. `/chain explorer -- inspect auth (backend)`) stay literal text and keep the legacy single-agent behavior.
613
- - A group is treated as the prior step’s output for the next sequential step.
614
- - Tab completion suggests agents inside groups — after `(`, after `|`, and on each new `->` step.
615
-
616
- Add a `[...]` suffix right after the closing `)` to set step-level options on the group:
617
-
618
- ```text
619
- /chain explorer "scan" -> (commentator "A" | commentator "B")[concurrency=2,failFast,worktree] -> writer "fix"
620
- ```
621
-
622
- | Group option | Description |
623
- |--------------|-------------|
624
- | `concurrency=N` | Max tasks running at once within the group. |
625
- | `failFast` | Stop the group as soon as one task fails. |
626
- | `worktree` | Run each group task in its own git worktree. |
627
-
628
- Dynamic fanout (`expand` / `collect`) is intentionally not available inline — use the
629
- `subagent({ chain: [...] })` tool API or a saved `.chain.json` for data-driven fan-out.
630
-
631
- ```text
632
- /chain explorer "analyze auth" -> architect -> builder
633
- # explorer gets "analyze auth"; architect gets explorer output; builder gets architect output
634
- ```
635
-
636
- For a shared task, list agents and place one `--` before the task:
637
-
638
- ```text
639
- /chain explorer architect -- analyze the auth system
640
- /parallel explorer commentator -- check for security issues
641
- ```
642
-
643
- ### Inline per-step config
644
-
645
- Append `[key=value,...]` to an agent name to override defaults. `/chain` applies every key below; `/run` and `/parallel` use the execution-behavior keys (`output`, `outputMode`, `reads`, `model`, `skills`, `progress`) and ignore chain-only metadata such as `as`, `label`, `phase`, `count`, `outputSchema`, and `acceptance`.
646
-
647
- ```text
648
- /chain explorer[output=context.md] "scan code" -> architect[reads=context.md] "analyze auth"
649
- /run explorer[model=anthropic/claude-sonnet-4] summarize this codebase
650
- /parallel commentator[skills=code-review+security] "review backend" -> commentator[model=openai/gpt-5-mini] "review frontend"
651
- ```
652
-
653
- | Key | Example | Description |
654
- |-----|---------|-------------|
655
- | `output` | `output=context.md` | Write results to a file. Absolute paths are used as-is. Relative paths in `/run` resolve under `singleRunOutputBaseDir` when configured, otherwise under the run's output artifact directory. Relative paths in `/chain` and `/parallel` live under the chain or parallel run directory. When omitted, a collision-safe per-run path is generated (`<singleRunOutputBaseDir>/<runId>/result.md` for `/run`; `<chainDir>/outputs/<flat-index>-<agent>.md` for chains; `<asyncDir>/outputs/<flat-index>-<agent>.md` for async) unless `output=false`. |
656
- | `outputMode` | `outputMode=file-only` | Delivery is reference-first by default: completion returns a concise saved-output reference instead of full child content. Omitted `outputMode` resolves to `file-only` whenever an output path is active; explicit `outputMode=inline` keeps the legacy full inline delivery; explicit `outputMode=file-only` still requires an output path. |
657
- | `reads` | `reads=a.md+b.md` | Read files before executing. `+` separates multiple paths. |
658
- | `model` | `model=anthropic/claude-sonnet-4` | Override model for this step. |
659
- | `skills` | `skills=planning+review` | Override available skills. `+` separates multiple skills. |
660
- | `progress` | `progress` | Enable progress tracking. |
661
- | `as` | `as=context` | Name this step’s output so later steps can reference it. |
662
- | `label` | `label=Recon` | Human-readable label for the step. |
663
- | `phase` | `phase=analysis` | Group steps into a named phase. |
664
- | `cwd` | `cwd=packages/api` | Run the step in a subdirectory. |
665
- | `count` | `count=3` | Fan a group task into N copies (only inside a `( ... )` group). |
666
- | `outputSchema` | `outputSchema=schema.json` | Validate structured output against a JSON Schema file (path resolved against the session cwd, not an inline step `cwd`). |
667
- | `acceptance` | `acceptance=checked` | Inline evidence level: `auto`, `attested`, or `checked`. Use the tool API or saved `.chain.json` for object contracts such as `none`, `verified`, or an orthogonal review requirement. `reviewed` is an achieved status, not an input level. |
584
+ ### WorkflowScript replacements
668
585
 
669
- Set `output=false`, `reads=false`, or `skills=false` to disable that behavior explicitly. Do not use `output=false` for file-only returns; use `outputMode=file-only` with an `output` path.
586
+ Use stable keys and ordinary JavaScript for sequence and parallelism. For watched same-repo workflows, pass `async:false` to show the live in-chat workflow card; `chatProgress` can force `off`, `terminal`, `milestones`, or `live-card` when the automatic policy is not what you want.
670
587
 
671
- Inline `[...]` values must not contain spaces or commas — keep `label`/`phase` to single tokens.
672
-
673
- ### Background and forked runs
674
-
675
- Add `--bg` to run in the background:
676
-
677
- ```text
678
- /run explorer "audit the codebase" --bg
679
- /chain explorer "analyze auth" -> architect "design refactor" -> builder --bg
680
- /parallel explorer "scan frontend" -> explorer "scan backend" --bg
588
+ ```js
589
+ subagent({ workflowScript: `
590
+ const scan = await runs.run("scan", { agent: "explorer", task: "Scan the codebase" });
591
+ const reviews = await runs.all([
592
+ { key: "correctness", agent: "commentator", task: "Review correctness: " + scan.output },
593
+ { key: "tests", agent: "commentator", task: "Review tests: " + scan.output }
594
+ ]);
595
+ return reviews.map(result => result.output);
596
+ ` });
681
597
  ```
682
598
 
683
- Add `--fork` to start each child from a real branched session created from the parent’s current leaf:
684
-
685
- ```text
686
- /run commentator "review this diff" --fork
687
- /chain explorer "analyze this branch" -> architect "plan next steps" --fork
688
- /parallel explorer "audit frontend" -> commentator "audit backend" --fork
689
- ```
690
-
691
- You can combine them in either order:
692
-
693
- ```text
694
- /run commentator "review this diff" --fork --bg
695
- /run commentator "review this diff" --bg --fork
696
- ```
697
-
698
- Background runs are detached. If the parent agent has other independent work, it should keep working. In an interactive chat, it should normally return control when ready to yield and let Pi deliver the completion notification instead of blocking merely to wait. Override that default and use `subagent_wait` when the current request is run-to-completion — for example, the user asked you to report results back before continuing or a skill cannot return before its work finishes. In a non-interactive run, Pi auto-drains current-session work at `agent_end`; use `subagent_wait` when this turn must receive results before it ends. It returns when the next initially active run or registered provider item finishes or a subagent needs attention; use `subagent_wait({ all: true })` for all work active at call time, `subagent_wait({ id })` for one async or remembered detached foreground run, and `subagent_wait({ timeoutMs })` to cap the block.
699
-
700
- A foreground child can detach while it waits for a supervisor reply. Reply first, then call `subagent_wait({ id: runId })`. While that wait blocks, it streams the detached child's current tool and recent transcript activity into the pending tool row when transcript artifacts are available. The remembered run stays pending until the child exits, then emits a session-scoped completion notification with recovered output and remains inspectable through `subagent({ action: "status", id: runId })`. Do not call `resume` or launch a replacement while the child remains detached.
701
-
702
- Headless sessions also auto-drain current-session subagent and registered provider work at `agent_end`, using one absolute timeout and continuing through attention states. This is a final lifecycle safeguard rather than a replacement for explicit orchestration: `subagent_wait` still lets a model react to each result during the turn. Provider, reconciliation, timeout, and malformed-state failures remain visible errors instead of being treated as successful drains.
703
-
704
- The `commentator` and `builder` builtins are designed for an explicit decision loop. A typical pattern is to ask `commentator` for diagnosis and a recommended execution prompt, then only run `builder` after the main agent approves that direction.
705
-
706
599
  ## Clarify and launch UI
707
600
 
708
- Tool calls launch directly by default. Set `clarify: true` on single, parallel, or chain runs when you want to preview and edit the workflow before it runs; slash commands launch directly.
601
+ Tool calls start background work by default. Set `async: false` when the current turn needs a foreground result, or `clarify: true` on single, parallel, or chain runs when you want to preview and edit the workflow before it runs; clarify stays foreground.
709
602
 
710
603
  Common clarify keys:
711
604
 
@@ -722,9 +615,9 @@ Common clarify keys:
722
615
  - `p` toggles progress tracking where supported
723
616
  Picker screens use `↑↓`, `Enter`, `Esc`, and type-to-filter. The full-screen editor supports word wrapping, paste, `Esc` to save, and `Ctrl+C` to discard.
724
617
 
725
- ## Agents and chains
618
+ ## Agents
726
619
 
727
- Agents are markdown files with YAML frontmatter and a system prompt body. They define the specialist that will run in the child Pi process.
620
+ Agents are markdown files with YAML frontmatter and a system prompt body. They define the specialist that will run in the child Selesai process.
728
621
 
729
622
  Agent locations, lowest to highest priority:
730
623
 
@@ -733,18 +626,24 @@ Agent locations, lowest to highest priority:
733
626
  | Builtin | `~/.selesai/agent/extensions/subagent/agents/` |
734
627
  | Installed package | `package.json` `pi-subagents.agents` or `pi.subagents.agents` |
735
628
  | User | `~/.selesai/agent/agents/**/*.md` |
736
- | Project | Project config `agents/**/*.md` (`.selesai/agents/**/*.md` in standard Pi) |
629
+ | Project | Project config `agents/**/*.md` (`.selesai/agents/**/*.md` in standard Selesai) |
737
630
 
738
- Project discovery also reads legacy `.agents/**/*.md` files. Nested subdirectories are discovered recursively. `.chain.md` files do not define agents. Installed Pi packages can expose agent directories from either `{"pi-subagents":{"agents":["./agents"]}}` or `{"pi":{"subagents":{"agents":["./agents"]}}}` in their package manifest. Package agents load above builtins and below user/project agents. If both `.agents/` and the project config agents directory define the same parsed runtime agent name, the project config directory wins. Use `agentScope: "user" | "project" | "both"` to control discovery; `both` is the default and project definitions win runtime-name collisions.
631
+ Project discovery also reads legacy `.agents/**/*.md` files. Nested subdirectories are discovered recursively. `.chain.md` files do not define agents. Installed Selesai packages can expose agent directories from either `{"pi-subagents":{"agents":["./agents"]}}` or `{"pi":{"subagents":{"agents":["./agents"]}}}` in their package manifest. Package agents load above builtins and below user/project agents. If both `.agents/` and the project config agents directory define the same parsed runtime agent name, the project config directory wins. Use `agentScope: "user" | "project" | "both"` to control discovery; `both` is the default and project definitions win runtime-name collisions.
739
632
 
740
- Builtin agents load at the lowest priority, so a user or project agent with the same name overrides them. They do not pin a provider model; they inherit your current Pi default model unless you set `subagents.defaultModel` or `subagents.agentOverrides.<name>.model`. `commentator` is an advisory reviewer that critiques direction and proposes an execution prompt without editing files. `builder` is the implementation agent for normal tasks and approved commentator handoffs.
633
+ Builtin agents load at the lowest priority, so a user or project agent with the same name overrides them. They do not pin a provider model; they inherit your current Selesai default model unless you set `subagents.defaultModel` or `subagents.agentOverrides.<name>.model`. `commentator` is an commentatory commentator that critiques direction and proposes an execution prompt without editing files; `commentator` is the same bundled role under the Claude Code-compatible name. `builder` is the implementation agent for normal tasks and approved commentator handoffs.
634
+
635
+ The `researcher` builtin uses `web_search`, `fetch_content`, and `get_search_content`; those require [pi-web-access](https://github.com/nicobailon/pi-web-access):
636
+
637
+ ```bash
638
+ pi install npm:pi-web-access
639
+ ```
741
640
 
742
641
  ### Builtin overrides
743
642
 
744
643
  You can override selected builtin fields without copying the whole agent. Overrides live in settings:
745
644
 
746
645
  - User: `~/.selesai/agent/settings.json`
747
- - Project: project config settings file (`.selesai/settings.json` in standard Pi)
646
+ - Project: project config settings file (`.selesai/settings.json` in standard Selesai)
748
647
 
749
648
  Example:
750
649
 
@@ -771,18 +670,18 @@ Set `subagents.disableThinking: true` to clear bundled builtin thinking defaults
771
670
 
772
671
  ### Prompt assembly
773
672
 
774
- Subagents are designed to be narrow by default. Custom agents start with a clean system prompt and only the context you intentionally give them. They do not automatically inherit Pi’s whole base prompt, project instruction files, or discovered skills catalog.
673
+ Subagents are designed to be narrow by default. Custom agents start with a clean system prompt and only the context you intentionally give them. They do not automatically inherit Selesai’s whole base prompt, project instruction files, or discovered skills catalog.
775
674
 
776
675
  Use these fields when an agent should see more:
777
676
 
778
677
  | Field | Effect |
779
678
  |-------|--------|
780
- | `systemPromptMode: append` | Append the agent prompt to Pi’s normal base prompt. |
679
+ | `systemPromptMode: append` | Append the agent prompt to Selesai’s normal base prompt. |
781
680
  | `inheritProjectContext: true` | Keep inherited project instructions from files like `AGENTS.md` and `CLAUDE.md`. |
782
- | `inheritSkills: true` | Let the child see Pi’s discovered skills catalog. |
681
+ | `inheritSkills: true` | Let the child see Selesai’s discovered skills catalog. |
783
682
  | `defaultContext: fork` | Use forked session context when a launch omits `context`; explicit `context: "fresh"` still wins. |
784
683
 
785
- Builtin agents opt into project instruction inheritance by default so they follow repo-specific rules out of the box. `builder` also uses append mode because its job is orchestration inside the parent workflow.
684
+ Builtin agents opt into project instruction inheritance by default so they follow repo-specific rules out of the box. `explorer` also uses append mode because its job is orchestration inside the parent workflow.
786
685
 
787
686
  ### Agent frontmatter
788
687
 
@@ -838,21 +737,21 @@ Important fields:
838
737
  | Field | Notes |
839
738
  |-------|-------|
840
739
  | `package` | Optional package identifier. A file with `name: explorer` and `package: code-analysis` registers as `code-analysis.explorer`; serialization keeps `name` and `package` separate. |
841
- | `aliases` | Optional comma-separated or block-list names that resolve to this agent for selection and explicit `agent`/chain/task inputs. Runtime status, persistence, and config still use the canonical `name`; exact canonical names take precedence over aliases, and alias collisions between distinct canonical agents fail as ambiguous. |
740
+ | `aliases` | Optional comma-separated or block-list names that resolve to this agent for selection and explicit `agent` and task inputs. Runtime status, persistence, and config still use the canonical `name`; exact canonical names take precedence over aliases, and alias collisions between distinct canonical agents fail as ambiguous. |
842
741
  | `tools` | Strict child tool allowlist. Named extension tools must also have their provider loaded. `mcp:` entries select direct MCP tools when `pi-mcp-adapter` is installed. |
843
742
  | `extensions` | Omitted means normal extensions; empty means no extensions; list values allowlist specific extensions. |
844
- | `subagentOnlyExtensions` | Extension paths loaded only in spawned child sessions for this agent. Tools registered there are unavailable to the main agent unless also installed through normal Pi extension configuration. |
743
+ | `subagentOnlyExtensions` | Extension paths loaded only in spawned child sessions for this agent. Tools registered there are unavailable to the main agent unless also installed through normal Selesai extension configuration. |
845
744
  | `model` | Default model. Bare ids prefer the current provider when possible, then unique registry matches. |
846
745
  | `fallbackModels` | Ordered backup models for provider/model failures such as quota, auth, timeout, or unavailable model. Ordinary task failures do not trigger fallback. |
847
746
  | `thinking` | Appended as a `:level` suffix at runtime unless a suffix is already present. |
848
- | `systemPromptMode` | `replace` by default; `append` keeps Pi’s base prompt. |
747
+ | `systemPromptMode` | `replace` by default; `append` keeps Selesai’s base prompt. |
849
748
  | `inheritProjectContext` | Keeps or strips inherited project instruction blocks. |
850
- | `inheritSkills` | Keeps or strips Pi’s discovered skills catalog. |
749
+ | `inheritSkills` | Keeps or strips Selesai’s discovered skills catalog. |
851
750
  | `defaultContext` | Optional `fresh` or `fork` launch context default for this agent. |
852
751
  | `skills` | Selects specific skills for the child, regardless of `inheritSkills`. |
853
752
  | `skillPath` | Invocation-private skill files or discovery directories. Relative paths resolve from the agent definition file. Local matches take precedence, while unresolved or unreadable matches fall back to normal skill discovery. This field discovers candidates only; `skills` still selects what the child receives. |
854
753
  | `output` | Default single-agent output file. |
855
- | `defaultReads` | Files to read before running in chain/parallel behavior. |
754
+ | `defaultReads` | Files to read before running the agent. |
856
755
  | `defaultProgress` | Maintain `progress.md`. |
857
756
  | `async` | Default a single-agent launch to background (`true`) or foreground (`false`) when the call omits `async`. Explicit call values and `forceTopLevelAsync` win. |
858
757
  | `timeoutMs` | Positive integer default runtime deadline in milliseconds for single-agent launches. Foreground launches use 30 minutes when neither the call nor agent provides a timeout; explicit `timeoutMs`/`maxRuntimeMs` and agent defaults win. |
@@ -860,15 +759,15 @@ Important fields:
860
759
  | `acceptance` | Acceptance default for single-agent launches. Use a scalar level such as `checked` or an inline/block YAML map such as `{ level: "none", reason: "lightweight lookup" }`. Explicit call values win; chain and parallel acceptance remains task/step configuration. |
861
760
  | `acceptanceRole` | Optional `read-only` or `writer` role for automatic acceptance inference. Explicit task mutation or no-edit intent wins; otherwise the declared role replaces agent-name guessing. This does not grant or revoke tools. |
862
761
  | `completionGuard` | Set `false` only for non-implementation agents that may mention implementation words while using mutation-capable tools such as `bash`. |
863
- | `interactive` | Parsed for compatibility but not enforced in v1. |
762
+ | `interactive` | Parsed for compatibility but not currently enforced. |
864
763
  | `maxSubagentDepth` | Tightens nested delegation for this agent's children. |
865
764
  | `memory` | Opt-in role-specific persistent memory. `memory: { scope: "project" \| "user", path: "<name>" }` injects the first lines of a `MEMORY.md` from a dedicated `agent-memory/` directory into the child system prompt. Agents with write tools (`edit`/`write`/`bash`) get a read-write block; read-only agents get a read-only fallback. Project scope resolves under `<project>/.selesai/agent-memory/`, user scope under `~/.selesai/agent/agent-memory/`. Paths are validated against traversal and symlink escape. |
866
765
 
867
- Agent-local `skillPath` candidates never enter Pi's parent/global skills catalog. Pair `inheritSkills: false` with explicit `skills` and `skillPath` when a child should receive only its selected private skills.
766
+ Agent-local `skillPath` candidates never enter Selesai's parent/global skills catalog. Pair `inheritSkills: false` with explicit `skills` and `skillPath` when a child should receive only its selected private skills.
868
767
 
869
768
  ### Per-agent persistent memory
870
769
 
871
- A recurring custom agent can opt into a durable, role-specific memory scope with the `memory` frontmatter field. This is independent of Pi's own parent/session/project memory system and writes nothing to it; memory lives under a dedicated `agent-memory/` namespace so the two never collide.
770
+ A recurring custom agent can opt into a durable, role-specific memory scope with the `memory` frontmatter field. This is independent of Selesai's own parent/session/project memory system and writes nothing to it; memory lives under a dedicated `agent-memory/` namespace so the two never collide.
872
771
 
873
772
  ```yaml
874
773
  memory:
@@ -882,7 +781,7 @@ Project-scoped memory resolves under `<project>/.selesai/agent-memory/<path>` an
882
781
 
883
782
  ### Tool and extension selection
884
783
 
885
- If `tools` is omitted, `pi-subagents` does not pass `--tools`, so the child gets Pi’s normal builtin tools. If `tools` is present, regular tool names become an explicit allowlist; an empty `tools:` field emits `--no-tools`. An allowlisted name does not load the extension that registers it: load that provider through normal Pi extension discovery, `extensions`, `subagentOnlyExtensions`, or a path-like `tools` entry. `mcp:` entries are split out and forwarded as direct MCP selections without granting normal builtins unless those builtins are also listed. Path-like `tools` entries, such as extension paths or `.ts`/`.js` files, are treated as tool-extension paths rather than tool names. Internal runtime tools such as `structured_output` are added to an explicit allowlist only when their contract is active. Agents that declare only known read-only builtin tools skip the implementation completion guard, but `bash`, unknown tools, and MCP tools stay mutation-capable. Use `completionGuard: false` for bash-enabled validators or commentators that should never be judged as implementation agents.
784
+ If `tools` is omitted, `pi-subagents` does not pass `--tools`, so the child gets Selesai’s normal builtin tools. If `tools` is present, regular tool names become an explicit allowlist; an empty `tools:` field emits `--no-tools`. An allowlisted name does not load the extension that registers it: load that provider through normal Selesai extension discovery, `extensions`, `subagentOnlyExtensions`, or a path-like `tools` entry. `mcp:` entries are split out and forwarded as direct MCP selections without granting normal builtins unless those builtins are also listed. Path-like `tools` entries, such as extension paths or `.ts`/`.js` files, are treated as tool-extension paths rather than tool names. Internal runtime tools such as `structured_output` are added to an explicit allowlist only when their contract is active. Agents that declare only known read-only builtin tools skip the implementation completion guard, but `bash`, unknown tools, and MCP tools stay mutation-capable. Use `completionGuard: false` for bash-enabled validators or commentators that should never be judged as implementation agents.
886
785
 
887
786
  Examples:
888
787
 
@@ -892,7 +791,7 @@ Examples:
892
791
  - `tools: subagent, read`: a child-safe `subagent` tool is available inside that child so it can run explicitly assigned nested fanout.
893
792
  - `tools: read, fixture_search` plus `subagentOnlyExtensions: ./tools/fixture-search.ts`: the provider loads only in this agent's child process, and the registered `fixture_search` name survives the strict allowlist.
894
793
 
895
- Direct MCP tools require [pi-mcp-adapter](https://github.com/nicobailon/pi-mcp-adapter). Subagents only receive direct MCP tools when `mcp:` entries are listed in their frontmatter; global `directTools: true` in `mcp.json` is not enough by itself. The generic `mcp` proxy tool can still be used for discovery when available. The adapter caches tool metadata at startup, so after connecting a new MCP server for the first time, restart Pi before relying on direct tools. An `mcp:` entry named `subagent` does not authorize nested fanout; only the builtin `subagent` tool name does. If a resolved direct MCP name is missing from the child registry, pi-subagents keeps the launch failed under the strict allowlist and identifies the condition as a host/pi-mcp-adapter registration problem; verify that the adapter registers the selected tools before child startup.
794
+ Direct MCP tools require [pi-mcp-adapter](https://github.com/nicobailon/pi-mcp-adapter). Subagents only receive direct MCP tools when `mcp:` entries are listed in their frontmatter; global `directTools: true` in `mcp.json` is not enough by itself. The generic `mcp` proxy tool can still be used for discovery when available. The adapter caches tool metadata at startup, so after connecting a new MCP server for the first time, restart Selesai before relying on direct tools. An `mcp:` entry named `subagent` does not authorize nested fanout; only the builtin `subagent` tool name does. If a resolved direct MCP name is missing from the child registry, pi-subagents keeps the launch failed under the strict allowlist and identifies the condition as a host/pi-mcp-adapter registration problem; verify that the adapter registers the selected tools before child startup.
896
795
 
897
796
  `extensions` controls child extension loading:
898
797
 
@@ -912,115 +811,7 @@ Use `subagentOnlyExtensions` when a custom extension tool should exist only insi
912
811
 
913
812
  To apply the same `extensions` allowlist to every agent that does not declare its own, set `subagents.defaultExtensions` in user or project settings. Omit it to preserve ambient extension discovery or set it to `[]` to disable ambient extensions by default; project settings win over user settings. Agents that explicitly define `extensions` keep their own value, including an empty `extensions:` field.
914
813
 
915
- Before the first model turn, the child runtime compares every explicit tool name with Pi's final filtered registry. A missing provider now fails the run with the unavailable names and concrete `subagentOnlyExtensions`/`extensions` guidance instead of letting a direct or chained child silently continue without its requested tools.
916
-
917
- ## Chain files
918
-
919
- Chains are reusable workflows stored separately from agent files. Use `.chain.md` for simple sequential saved chains. Use `.chain.json` when a chain needs dynamic fanout.
920
-
921
- | Scope | Path |
922
- |-------|------|
923
- | Installed package | `package.json` `pi-subagents.chains` or `pi.subagents.chains` |
924
- | User | `~/.selesai/agent/chains/**/*.chain.md`, `~/.selesai/agent/chains/**/*.chain.json` |
925
- | Project | Project config `chains/**/*.chain.md`, `chains/**/*.chain.json` (`.selesai/chains/...` in standard Pi) |
926
-
927
- Nested subdirectories are discovered recursively. Installed Pi packages can expose chain directories from either `{"pi-subagents":{"chains":["./chains"]}}` or `{"pi":{"subagents":{"chains":["./chains"]}}}` in their package manifest. Package chains load below user/project chains. If both `.chain.md` and `.chain.json` define the same parsed runtime chain name in the same scope, `.chain.json` wins. If user and project scopes define the same parsed runtime chain name, the project chain wins. Chains support the same optional `package` frontmatter as agents; `name: review-flow` plus `package: code-analysis` runs as `code-analysis.review-flow`.
928
-
929
- Example:
930
-
931
- ```md
932
- ---
933
- name: explorer-architect
934
- description: Gather context then plan implementation
935
- ---
936
-
937
- ## explorer
938
- phase: Context
939
- label: Map auth flow
940
- as: context
941
- output: context.md
942
-
943
- Analyze the codebase for {task}
944
-
945
- ## architect
946
- phase: Planning
947
- label: Implementation plan
948
- reads: context.md
949
- model: anthropic/claude-sonnet-4-5:high
950
- progress: true
951
-
952
- Create an implementation plan based on {outputs.context}
953
- ```
954
-
955
- Each `.chain.md` `## agent-name` section is a step. Config lines such as `phase`, `label`, `as`, `outputSchema`, `output`, `outputMode`, `reads`, `model`, `skills`, and `progress` go immediately after the header. A blank line separates config from task text. In saved `.chain.md` files, `outputSchema` is a path to a JSON Schema file; direct tool calls and `.chain.json` files can pass the schema object inline.
956
-
957
- For `output`, `reads`, `skills`, and `progress`, chain behavior is three-state: omitted inherits from the agent, a value overrides, and `false` disables.
958
-
959
- Use `phase` to group related work in status output, `label` for a readable step name, and `as` to store a successful step or parallel task result for later `{outputs.name}` references. Duplicate `as` names, invalid identifiers, and unknown output references fail before child execution.
960
-
961
- Dynamic fanout is available only through direct `subagent({ chain: [...] })` JSON or saved `.chain.json` files. It expands an array from a prior structured named output, runs one child template per item, and stores the ordered collection under `collect.as`. The source must be structured output; prose is never parsed. `expand.maxItems` is required, over-limit arrays fail, nested fanout and arbitrary expressions are not supported, and `.chain.md` has no dynamic syntax in this release.
962
-
963
- ```json
964
- {
965
- "name": "dynamic-review",
966
- "description": "Find review targets, fan out commentators, then synthesize.",
967
- "chain": [
968
- {
969
- "agent": "explorer",
970
- "task": "Return {\"items\":[{\"path\":\"...\",\"reason\":\"...\"}]} via structured_output.",
971
- "as": "targets",
972
- "outputSchema": { "type": "object" }
973
- },
974
- {
975
- "expand": {
976
- "from": { "output": "targets", "path": "/items" },
977
- "item": "target",
978
- "key": "/path",
979
- "maxItems": 12
980
- },
981
- "parallel": {
982
- "agent": "commentator",
983
- "label": "Review {target.path}",
984
- "task": "Review {target.path}. Reason: {target.reason}",
985
- "outputSchema": { "type": "object" }
986
- },
987
- "collect": { "as": "reviews" },
988
- "concurrency": 4
989
- },
990
- {
991
- "agent": "builder",
992
- "task": "Synthesize fixes from {outputs.reviews}"
993
- }
994
- ]
995
- }
996
- ```
997
-
998
- Create simple `.chain.md` chains by writing files directly or with the `subagent({ action: "create", config: ... })` management action. Create dynamic `.chain.json` chains by writing the JSON file directly. Run saved chains with natural language or:
999
-
1000
- ```text
1001
- /run-chain explorer-architect -- refactor authentication
1002
- ```
1003
-
1004
- ## Chain variables
1005
-
1006
- Task templates support:
1007
-
1008
- | Variable | Description |
1009
- |----------|-------------|
1010
- | `{task}` | Original task from the first step. |
1011
- | `{previous}` | Output from the prior step, or aggregated output from a parallel step. |
1012
- | `{chain_dir}` | Path to the chain artifact directory. |
1013
- | `{outputs.name}` | Text value from a prior step or completed parallel task with `as: "name"`. |
1014
-
1015
- Parallel outputs are aggregated with clear separators before being passed to the next step:
1016
-
1017
- ```text
1018
- === Parallel Task 1 (builder) ===
1019
- ...
1020
-
1021
- === Parallel Task 2 (builder) ===
1022
- ...
1023
- ```
814
+ Before the first model turn, the child runtime compares every explicit tool name with Selesai's final filtered registry. A missing provider now fails the run with the unavailable names and concrete `subagentOnlyExtensions`/`extensions` guidance instead of letting a direct or chained child silently continue without its requested tools.
1024
815
 
1025
816
  ## Skills
1026
817
 
@@ -1028,7 +819,7 @@ Skills are `SKILL.md` files made available to an agent. The prompt includes skil
1028
819
 
1029
820
  Discovery uses project-first precedence:
1030
821
 
1031
- 1. Project config `skills/{name}/SKILL.md` (`.selesai/skills/{name}/SKILL.md` in standard Pi)
822
+ 1. Project config `skills/{name}/SKILL.md` (`.selesai/skills/{name}/SKILL.md` in standard Selesai)
1032
823
  2. Project packages and project settings packages via `package.json -> pi.skills`
1033
824
  3. Current task cwd package via `package.json -> pi.skills`
1034
825
  4. Project config `settings.json -> skills`
@@ -1083,7 +874,7 @@ If you are writing an agent that orchestrates subagents, the bundled skill helps
1083
874
 
1084
875
  ## Extension delegation API
1085
876
 
1086
- Pi extensions can request configured foreground agents through the public event
877
+ Selesai extensions can request configured foreground agents through the public event
1087
878
  contract exported by `pi-subagents/delegation`.
1088
879
 
1089
880
  ### Launch contract preflight
@@ -1111,11 +902,14 @@ if (!result.ok) {
1111
902
  console.log(result.contract.digest, result.contract.tools.effectiveAllowlist);
1112
903
  ```
1113
904
 
1114
- Preflight covers ordinary single-agent launch resolution under public contract version 2: selected agent identity and shadowed candidates, a versioned parsed-definition digest (including system prompt and launch-affecting model, tool, skill, extension, output, and memory fields), fresh/fork context, effective model and thinking, skill and tool resolution, direct MCP selections, runtime/configured extensions, artifact/session paths, async lifecycle/status/result/event/process-terminal paths, package/lifecycle versions, capability-ceiling audit data, and stable digests. `launchContractDigest` is the canonical digest of the caller task, effective system prompt (including the resolved `turnBudget` prompt augmentation when supplied), model candidates, effective tools/extensions/MCP (including inherited capability ceilings), output binding, and structured-output schema that ordinary foreground and async execution report in results/status/events and metadata. Runtime acceptance prose and output-task annotations are intentionally excluded because side-effect-free preflight does not resolve those host/runtime augmentations; the contract version and task digest make that boundary explicit. Raw prompts are not exposed in public contract output. It is side-effect-free for launch state: it does not create child sessions, temp prompt files, structured-output runtimes, tool-diagnostic files, or run artifacts. Some host-owned facts, such as exact fork snapshots, nested async roots, and live model registries, can only be proven by the Pi host; those appear as `host_required` diagnostics instead of silently pretending to be exact.
905
+ Preflight covers ordinary single-agent launch resolution: selected agent identity and shadowed candidates, a parsed-definition digest (including system prompt and launch-affecting model, tool, skill, extension, output, and memory fields), fresh/fork context, effective model and thinking, skill and tool resolution, direct MCP selections, runtime/configured extensions, artifact/session paths, async lifecycle/status/result/event/process-terminal paths, package/lifecycle versions, capability-ceiling audit data, and stable digests. `launchContractDigest` is the canonical digest of the caller task, effective system prompt (including the resolved `turnBudget` prompt augmentation when supplied), model candidates, effective tools/extensions/MCP (including inherited capability ceilings), output binding, and structured-output schema that ordinary foreground and async execution report in results/status/events and metadata. Runtime acceptance prose and output-task annotations are intentionally excluded because side-effect-free preflight does not resolve those host/runtime augmentations; the launch and task digests make that boundary explicit. Raw prompts are not exposed in public contract output. It is side-effect-free for launch state: it does not create child sessions, temp prompt files, structured-output runtimes, tool-diagnostic files, or run artifacts. Some host-owned facts, such as exact fork snapshots, nested async roots, and live model registries, can only be proven by the Selesai host; those appear as `host_required` diagnostics instead of silently pretending to be exact.
1115
906
 
1116
- ### Delegation v1
907
+ ### Structured delegation API
1117
908
 
1118
- The compatibility v1 contract runs one configured foreground agent per request:
909
+ Other Selesai extensions can ask `pi-subagents` to run one configured foreground leaf
910
+ agent through the structured delegation API. It uses the established
911
+ `prompt-template:subagent:*` event family and the same executor as the
912
+ `subagent` tool; it does not add another launcher.
1119
913
 
1120
914
  ```ts
1121
915
  import {
@@ -1126,51 +920,6 @@ import {
1126
920
  } from "pi-subagents/delegation";
1127
921
 
1128
922
  const request: SubagentDelegationRequest = {
1129
- version: 1,
1130
- requestId: crypto.randomUUID(),
1131
- agent: "commentator",
1132
- task: "Review the supplied evidence.",
1133
- context: "fresh",
1134
- cwd: ctx.cwd,
1135
- timeoutMs: 120_000,
1136
- toolBudget: { soft: 10, hard: 16, block: "*" },
1137
- };
1138
-
1139
- const unsubscribe = pi.events.on(SUBAGENT_DELEGATION_RESPONSE_EVENT, (payload) => {
1140
- const response = payload as SubagentDelegationResponse;
1141
- if (response.requestId !== request.requestId) return;
1142
- unsubscribe();
1143
- // Inspect response.status and the metadata present for this run.
1144
- });
1145
- pi.events.emit(SUBAGENT_DELEGATION_REQUEST_EVENT, request);
1146
- ```
1147
-
1148
- The contract uses the established `prompt-template:subagent:*` event transport and the same executor as the `subagent` tool; it does not add another launcher. New integrations must send `version: 1`. Requests are strict and single-agent only. They can set fresh or fork context, model, cwd, timeout, turn and tool-call budgets, skills, output behavior, acceptance, and artifact capture. Unknown or malformed fields return `invalid_request` before execution.
1149
-
1150
- Responses distinguish completion, failure, timeout, cancellation, interruption,
1151
- turn or tool-budget exhaustion, explicit acceptance failure, invalid requests,
1152
- and unavailable active context. Optional metadata is omitted when unavailable.
1153
- Request IDs must be unique while active; duplicate active IDs are ignored so the
1154
- original request keeps ownership of its terminal response. Emit
1155
- `SUBAGENT_DELEGATION_CANCEL_EVENT` with the same version and request ID to cancel
1156
- queued or active work.
1157
-
1158
- ### Delegation v2
1159
-
1160
- V2 is the owned-leaf contract for workflow supervisors. Independent requests
1161
- can overlap through the delegated executor without weakening the ordinary
1162
- model-facing tool's one-foreground-call-per-turn guard.
1163
-
1164
- ```ts
1165
- import {
1166
- SUBAGENT_DELEGATION_REQUEST_EVENT,
1167
- SUBAGENT_DELEGATION_RESPONSE_EVENT,
1168
- type SubagentDelegationV2Request,
1169
- type SubagentDelegationV2Response,
1170
- } from "pi-subagents/delegation";
1171
-
1172
- const request: SubagentDelegationV2Request = {
1173
- version: 2,
1174
923
  requestId: crypto.randomUUID(),
1175
924
  ownerRunId: workflowRunId,
1176
925
  nodeId: "review-accuracy",
@@ -1191,8 +940,8 @@ const request: SubagentDelegationV2Request = {
1191
940
  };
1192
941
 
1193
942
  const unsubscribe = pi.events.on(SUBAGENT_DELEGATION_RESPONSE_EVENT, (payload) => {
1194
- const response = payload as SubagentDelegationV2Response;
1195
- if (response.version !== 2 || response.requestId !== request.requestId) return;
943
+ const response = payload as SubagentDelegationResponse;
944
+ if (response.requestId !== request.requestId) return;
1196
945
  if (response.ownerRunId !== request.ownerRunId || response.nodeId !== request.nodeId) return;
1197
946
  unsubscribe();
1198
947
  // Inspect response.status, response.result, response.usage, model, and thinking.
@@ -1213,22 +962,28 @@ Terminal usage reports input, output, cache-read, cache-write, cost, turns, tool
1213
962
  calls, and duration alongside the effective model and thinking level when
1214
963
  known. Schemas are capped at 64 KiB; tasks and returned text/structured values
1215
964
  are capped at 1 MiB, with smaller bounds on identity/configuration strings and
1216
- a maximum v2 `timeoutMs` of 2,147,483,647. V2 alone accepts
965
+ a maximum `timeoutMs` of 2,147,483,647. Structured delegation accepts
1217
966
  `toolBudget: { hard: 0, block: "*" }` to block the first tool call and run a
1218
- zero-tool leaf; delegation v1 and ordinary model-facing/configured budgets keep
1219
- their existing minimum of one. The foreground bridge retains up to 8,192 exact
1220
- pending-cancellation and settled-attempt identities per extension
1221
- context. If either history fills, it fails closed with `unavailable_context`
1222
- for later v2 starts rather than evicting identity facts; lifecycle reset clears
1223
- the bounded history.
1224
-
1225
- Delegation requires an active extension context. Emit requests from a supported event callback or queued application step, not by recursively invoking the `subagent` tool inside another tool's `tool_call` hook. The caller selects a configured agent, but agent discovery and effective tools remain package-owned. A request cannot grant arbitrary tools, and tool restrictions are not an operating-system sandbox. The detached RPC remains async-only; this API is foreground-only.
1226
-
1227
- Existing prompt-template payloads and delegation v1 continue over the same event
1228
- family. V2 remains foreground-only and inherits the configured agent's current
1229
- tools, skills, context, model policy, and workspace authority; it is not a
1230
- sandbox or a durable task broker. `pi-subagents/delegation` is the canonical
1231
- contract for extension integrations.
967
+ zero-tool leaf; ordinary model-facing/configured budgets keep their existing
968
+ minimum of one. The foreground bridge retains up to 8,192 exact
969
+ pending-cancellation and settled-attempt identities per extension context. If
970
+ either history fills, it fails closed with `unavailable_context` for later
971
+ starts rather than evicting identity facts; lifecycle reset clears the bounded
972
+ history.
973
+
974
+ Delegation requires an active extension context. Emit requests from a supported
975
+ event callback or queued application step, not by recursively invoking the
976
+ `subagent` tool inside another tool's `tool_call` hook. The caller selects a
977
+ configured agent, but agent discovery and effective tools remain package-owned.
978
+ A request cannot grant arbitrary tools, and tool restrictions are not an
979
+ operating-system sandbox. The detached RPC remains async-only; this API is
980
+ foreground-only.
981
+
982
+ Unversioned prompt-template payloads with `requestId`, `agent`, `task`,
983
+ `context`, `model`, and `cwd` are still accepted as a legacy bridge while we
984
+ validate whether any integrations still use them. New integrations should use
985
+ the structured owned-leaf request above. `pi-subagents/delegation` is the
986
+ canonical contract for extension integrations.
1232
987
 
1233
988
  ## Capability ceilings
1234
989
 
@@ -1256,7 +1011,7 @@ Active registrations intersect their `allowedTools` and `allowedAgents` sets and
1256
1011
 
1257
1012
  ## Background-work provider API
1258
1013
 
1259
- Other Pi extensions can make their current-session jobs visible to `subagent_wait` through the versioned process-local provider contract:
1014
+ Other Selesai extensions can make their current-session jobs visible to `subagent_wait` through the process-local provider contract:
1260
1015
 
1261
1016
  ```ts
1262
1017
  import { registerBackgroundWorkProvider } from "pi-subagents/background-work";
@@ -1271,11 +1026,11 @@ const dispose = registerBackgroundWorkProvider({
1271
1026
  });
1272
1027
  ```
1273
1028
 
1274
- Each item needs a stable provider-local ID and the exact Pi session ID that owns it. `subagent_wait` captures those identities rather than a count, so one job finishing while another starts still satisfies first-completion waits without losing the replacement. It filters snapshots to the active session, fails closed if a provider disappears while its work is tracked, and surfaces malformed snapshots or provider errors with provider context. Wake channels only shorten polling; validated snapshots remain authoritative.
1029
+ Each item needs a stable provider-local ID and the exact Selesai session ID that owns it. `subagent_wait` captures those identities rather than a count, so one job finishing while another starts still satisfies first-completion waits without losing the replacement. It filters snapshots to the active session, fails closed if a provider disappears while its work is tracked, and surfaces malformed snapshots or provider errors with provider context. Wake channels only shorten polling; validated snapshots remain authoritative.
1275
1030
 
1276
- Providers share a registry through `Symbol.for("pi-subagents.background-work.v1")`, allowing independently loaded extension modules to meet in one Pi process. Registration is reload-safe: a new provider with the same name replaces the old callback, and the old disposer cannot remove the replacement. Call the disposer during extension shutdown when possible.
1031
+ Providers share a registry through `Symbol.for("pi-subagents.background-work.v1")`, allowing independently loaded extension modules to meet in one Selesai process. Registration is reload-safe: a new provider with the same name replaces the old callback, and the old disposer cannot remove the replacement. Call the disposer during extension shutdown when possible.
1277
1032
 
1278
- Child processes do not gain provider tools or extensions automatically. Add `subagent_wait` to the child agent's `tools` allowlist and load each provider through `extensions` or `subagentOnlyExtensions`. The parent's effective `waitTool` setting is serialized through foreground, async, resume, chain, parallel, and fanout launch paths; `PI_SUBAGENT_WAIT_TOOL_ENABLED` keeps precedence.
1033
+ Child processes do not gain provider tools or extensions automatically. Add `subagent_wait` to the child agent's `tools` allowlist and load each provider through `extensions` or `subagentOnlyExtensions`. The parent's effective `waitTool` setting is serialized through foreground, async, resume, chain, parallel, and fanout launch paths; `SELESAI_SUBAGENT_WAIT_TOOL_ENABLED` keeps precedence.
1279
1034
 
1280
1035
  ## Programmatic tool usage
1281
1036
 
@@ -1283,83 +1038,24 @@ These are the parameters the LLM passes when it calls the `subagent` tool. Most
1283
1038
 
1284
1039
  ### Execution examples
1285
1040
 
1286
- ```ts
1287
- // Single agent
1288
- { agent: "builder", task: "refactor auth" }
1289
- { agent: "explorer", task: "find todos", maxOutput: { lines: 1000 } }
1290
- { agent: "explorer", task: "investigate", output: false }
1291
- { agent: "explorer", task: "write a large report", output: "reports/explorer.md", outputMode: "file-only" }
1292
-
1293
- // Forked context
1294
- { agent: "builder", task: "continue this thread", context: "fork" }
1295
-
1296
- // Parallel
1297
- { tasks: [{ agent: "explorer", task: "a" }, { agent: "commentator", task: "b" }] }
1298
- { tasks: [{ agent: "explorer", task: "audit auth", count: 3 }] }
1299
- { tasks: [{ agent: "explorer", task: "audit frontend" }, { agent: "commentator", task: "audit backend" }], context: "fork" }
1300
-
1301
- // Chain
1302
- { chain: [
1303
- { agent: "explorer", task: "Gather context for auth refactor" },
1304
- { agent: "architect" },
1305
- { checkpoint: "implementation", message: "Approve implementation before review?" },
1306
- { agent: "builder" },
1307
- { agent: "commentator" }
1308
- ]}
1309
-
1310
- // Chain in the background, suitable for unblocking the main chat
1311
- { chain: [...], async: true }
1312
-
1313
- // Chain with fan-out/fan-in
1314
- { chain: [
1315
- { agent: "explorer", task: "Gather context", phase: "Context", label: "Map code", as: "context" },
1316
- { parallel: [
1317
- { agent: "builder", task: "Implement feature A from {outputs.context}", label: "Feature A", as: "featureA" },
1318
- { agent: "builder", task: "Implement feature B from {outputs.context}", label: "Feature B", as: "featureB" }
1319
- ], concurrency: 2, failFast: true },
1320
- { agent: "commentator", task: "Review {outputs.featureA} and {outputs.featureB}" }
1321
- ]}
1322
-
1323
- // Dynamic fanout from structured output
1324
- { chain: [
1325
- {
1326
- agent: "explorer",
1327
- task: "Return review targets as structured_output: { items: [{ path, reason }] }",
1328
- as: "targets",
1329
- outputSchema: { type: "object" }
1330
- },
1331
- {
1332
- expand: { from: { output: "targets", path: "/items" }, item: "target", key: "/path", maxItems: 12 },
1333
- parallel: { agent: "commentator", task: "Review {target.path}. Reason: {target.reason}", outputSchema: { type: "object" } },
1334
- collect: { as: "reviews" },
1335
- concurrency: 4
1336
- },
1337
- { agent: "builder", task: "Synthesize fixes from {outputs.reviews}" }
1338
- ] }
1339
-
1340
- // Strict structured output for reliable handoff data
1341
- { chain: [
1342
- {
1343
- agent: "explorer",
1344
- task: "Return the key files and risks for {task}",
1345
- as: "scan",
1346
- outputSchema: {
1347
- type: "object",
1348
- required: ["files", "risks"],
1349
- properties: {
1350
- files: { type: "array", items: { type: "string" } },
1351
- risks: { type: "array", items: { type: "string" } }
1352
- }
1353
- }
1354
- },
1355
- { agent: "architect", task: "Plan from this scan: {outputs.scan}" }
1356
- ] }
1041
+ ```js
1042
+ // Single child
1043
+ { agent: "explorer", task: "Analyze the auth flow", async: true }
1044
+
1045
+ // Sequential workflow
1046
+ { workflowScript: `
1047
+ const scan = await runs.run("scan", { agent: "explorer", task: "Analyze auth" });
1048
+ return (await runs.run("plan", { agent: "architect", task: "Plan from: " + scan.output })).output;
1049
+ ` }
1357
1050
 
1358
- // Worktree isolation
1359
- { tasks: [
1360
- { agent: "builder", task: "Implement auth" },
1361
- { agent: "builder", task: "Implement API" }
1362
- ], worktree: true }
1051
+ // Parallel workflow
1052
+ { workflowScript: `
1053
+ const results = await runs.all([
1054
+ { key: "backend", agent: "commentator", task: "Review backend" },
1055
+ { key: "frontend", agent: "commentator", task: "Review frontend" }
1056
+ ]);
1057
+ return results.map(result => result.output);
1058
+ ` }
1363
1059
  ```
1364
1060
 
1365
1061
  ### Management actions
@@ -1369,7 +1065,6 @@ Agent definitions are not loaded into context by default. Management actions let
1369
1065
  ```ts
1370
1066
  { action: "list" }
1371
1067
  { action: "list", agentScope: "project" }
1372
- { action: "list", task: "Inspect the authentication flow and report findings only" }
1373
1068
  { action: "get", agent: "explorer" }
1374
1069
  { action: "models" }
1375
1070
  { action: "models", agent: "commentator" }
@@ -1377,7 +1072,7 @@ Agent definitions are not loaded into context by default. Management actions let
1377
1072
  { action: "get", chainName: "review-pipeline" }
1378
1073
 
1379
1074
  { action: "create", config: {
1380
- name: "Code explorer",
1075
+ name: "Code Explorer",
1381
1076
  package: "code-analysis",
1382
1077
  description: "Scans codebases for patterns and issues",
1383
1078
  scope: "user",
@@ -1400,7 +1095,7 @@ Agent definitions are not loaded into context by default. Management actions let
1400
1095
 
1401
1096
  { action: "create", config: {
1402
1097
  name: "review-pipeline",
1403
- description: "explorer then review",
1098
+ description: "Explorer then review",
1404
1099
  scope: "project",
1405
1100
  steps: [
1406
1101
  { agent: "explorer", task: "Scan {task}", output: "context.md" },
@@ -1422,8 +1117,6 @@ Agent definitions are not loaded into context by default. Management actions let
1422
1117
  { action: "reset", agent: "commentator" }
1423
1118
  ```
1424
1119
 
1425
- `list` accepts an optional advisory `task` (the sole management-field exception): with a non-empty task it appends a text-only "Task-aware advisory routing" block that deterministically recommends one canonical executable agent for the task (implementation needs a writer role with write tools; read-only needs a read-only role without known write tools) or explains why none is safe. It only recommends and never launches: no agent is started, no params are changed, and executor selection is untouched. To proceed, make a separate explicit execution call with the recommended canonical agent name, e.g. `{ agent: "builder", task: "..." }`. `agentScope` narrows discovery for the recommendation exactly as it does for the rest of `list`.
1426
-
1427
1120
  `create` uses `config.scope`, not `agentScope`. `config.name` is the local frontmatter name; optional `config.package` registers the runtime name as `{package}.{name}` and is saved as separate `name` and `package` frontmatter. `config.aliases` accepts a comma-separated string, string array, or `false` to clear aliases; aliases resolve to the canonical agent name for execution and are shown by `list`/`get`. `update` and `delete` use the runtime name and `agentScope` only when the same runtime name exists in multiple scopes. To clear optional string fields, including `package`, set them to `false` or `""`.
1428
1121
 
1429
1122
  `eject` copies a bundled builtin or package agent verbatim into the user or project agent dir (default `user`) as an editable custom file that shadows the original, so you can customize a builtin without hunting package files. `disable` writes a reversible `agentOverrides.<name>.disabled: true` entry to the user or project settings file (default `user`); the agent stays on disk but is hidden from runtime discovery and `list`. `enable` removes that `disabled` field while preserving any other override fields on the same entry. `reset` deletes the scope's custom agent file and/or settings override entry, restoring the bundled default; it refuses if no bundled default exists (use `delete` for purely custom agents). All four accept `agentScope: "user" | "project"` and operate in one scope at a time; project overrides still win over user ones, so a project-scope disable survives a user-scope `enable` until you target the project scope.
@@ -1433,52 +1126,46 @@ Agent definitions are not loaded into context by default. Management actions let
1433
1126
  | Param | Type | Default | Description |
1434
1127
  |-------|------|---------|-------------|
1435
1128
  | `agent` | string | - | Agent name or alias for single mode, or target for management actions. Execution records use the canonical agent name. |
1436
- | `task` | string | - | Task for single mode, or an optional advisory intent for `action: "list"` (appends a task-aware recommendation to list output; never launches). |
1437
- | `action` | string | - | `list`, `get`, `create`, `update`, `delete`, `status`, `interrupt`, `stop`, `resume`, `steer`, `append-step`, `approve-checkpoint`, `reject-checkpoint`, or `doctor`. |
1129
+ | `task` | string | - | Task string for single mode. |
1130
+ | `action` | string | - | Agent, mission (`mission.create/list/show/update/attach-run/close`), Herdr inspector (`inspector.open/status/close`), status/control, schedule, watchdog, or doctor action. |
1438
1131
  | `chainName` | string | - | Chain name for management actions. |
1439
- | `config` | object/string | - | Agent or chain config for create/update. |
1132
+ | `config` | object/string | - | Agent or existing durable chain config for management create/update. |
1440
1133
  | `output` | `string \| false` | agent default | Override single-agent output file. |
1441
- | `outputMode` | `"inline" \| "file-only"` | mode-dependent | Delivery of saved output. Explicit `"inline"` keeps legacy full inline output; explicit `"file-only"` returns a concise saved-file reference and requires an `output` path. Omitted, it resolves to `file-only` whenever an output path is active and `inline` otherwise. |
1134
+ | `outputMode` | `"inline" \| "file-only"` | `inline` | Return saved output inline or as a concise saved-file reference. `file-only` requires an `output` path. |
1442
1135
  | `skill` | `string \| string[] \| false` | agent default | Override skills or disable all. |
1443
1136
  | `model` | string | agent default | Override model. |
1444
1137
  | `outputSchema` | object | - | Require schema-valid structured output for a direct single-agent run. |
1445
- | `agentContract` | `{ version: 1 }` | - | Opt into generic agent contract v1. Omit to keep the current/default contract. |
1446
- | `tasks` | array | - | Top-level parallel tasks. Supports `agent`, `task`, `cwd`, `count`, `output`, `outputMode`, `outputSchema`, `reads`, `progress`, `skill`, `model`, `toolBudget`, `acceptance`, and `agentContract`. |
1447
- | `concurrency` | number | config or `4` | Top-level parallel concurrency. |
1448
- | `worktree` | boolean | false | Create isolated git worktrees for parallel tasks. |
1449
- | `chain` | array | - | Sequential, checkpoint, static parallel, and dynamic fanout chain steps. Steps and chain parallel tasks support `phase`, `label`, `as`, `outputSchema`, `acceptance`, `agentContract`, and v1-only `gateOn` in addition to the usual execution fields. Dynamic fanout uses `expand`, one child `parallel` template, and `collect`. With `action: "append-step"`, pass exactly one step to append to a running async chain. |
1450
- | `context` | `fresh \| fork` | per-agent default or `fresh` | Explicit `fresh` or `fork` overrides every child. When omitted, each agent uses its own `defaultContext`; `fork` creates real branched sessions from the parent leaf. Packaged `architect` and `recapper` default to `fork`; `builder`, `commentator`, `explorer`, and `researcher` default to `fresh`. |
1451
- | `chainDir` | string | temp chain dir | Persistent directory for chain artifacts. Relative chain `output`, `reads`, and `progress` paths live under this directory. |
1138
+ | `agentContract` | `{ version: 1 }` | - | Enable the compatibility behavior for this run. Omit for the default behavior. |
1139
+ | `context` | `fresh \| fork` | per-agent default or `fresh` | Explicit `fresh` or `fork` overrides every child. When omitted, each agent uses its own `defaultContext`; `fork` creates real branched sessions from the parent leaf. Packaged `architect`, `builder`, `commentator`, and `commentator` default to `fork`. |
1140
+ | `missionId` | string | - | Attach a single-agent or workflow launch to an existing project mission. |
1141
+ | `mission` | object/false | - | Create-and-attach shortcut: `{ title, goal?, labels? }`; pass `false` for an intentionally ephemeral launch with no mission record. Explicit mission persistence failures are strict. |
1142
+ | `handoffPath` | string | - | Aggregate handoff manifest required by `action: "worktree.discard"`. |
1143
+ | `focus` | boolean | true | Focus the newly split pane for `action: "inspector.open"`; not a standalone action. |
1452
1144
  | `view` | `fleet \| transcript` | - | Optional `status` view for the active fleet surface or transcript tail inspection. |
1453
1145
  | `lines` | number | `80` | Maximum transcript lines for `action: "status", view: "transcript"`; capped at 500. |
1454
1146
  | `clarify` | boolean | false | Show TUI preview/edit flow. Explicit `clarify: true` keeps the run foreground for the clarify UI. |
1455
1147
  | `agentScope` | `user \| project \| both` | `both` | Agent discovery scope. Project wins on collisions. |
1456
- | `async` | boolean | false | Background execution. For chains, `clarify: true` explicitly keeps the run foreground for the clarify UI. |
1148
+ | `async` | boolean | default-on | Background execution. Scripted workflows always default to background and accept `async:false` as an explicit foreground escape hatch. `clarify:true` applies only to single-agent execution; workflowScript does not open clarify UI. |
1149
+ | `chatProgress` | `auto \| off \| terminal \| milestones \| live-card` | `auto` | WorkflowScript chat projection. `auto` renders a live in-chat card only for watched foreground workflows in the same Git repository, including managed worktrees; background and other-repo workflows stay compact. Explicit `live-card` requires `async:false` and the same Git repository. |
1457
1150
  | `timeoutMs` / `maxRuntimeMs` | number | 30 min foreground; none async | Optional run-level max runtime in milliseconds. Foreground uses 30 minutes only when neither the call nor selected agent provides a timeout. |
1458
1151
  | `turnBudget` | object | none | Optional assistant-turn budget `{ maxTurns, graceTurns }`. At `maxTurns` the child is warned to wrap up. After the grace window (default 1), termination occurs at the next assistant boundary; a response that starts tool work records `termination-deferred` until a later boundary. Partial output is returned on abort. |
1459
1152
  | `toolBudget` | object | none | Optional child tool-call budget `{ soft?, hard, block? }`. At `soft` the child is nudged to finalize. After `hard`, configured tools are blocked; `block` defaults to `read`, `grep`, `find`, and `ls`, while `"*"` blocks every tool call. Final assistant text is never blocked. |
1460
1153
  | `usageBudget` | object | none | Optional root-only reported-usage budget `{ tokens?: { soft?, hard }, costUsd?: { soft?, hard } }`. Soft limits are status-only. Hard limits prevent later child launches after reported usage is reconciled; already-running children are not stopped and no reservations are made. |
1461
1154
  | `cwd` | string | runtime cwd | Override working directory. |
1462
1155
  | `maxOutput` | object | 200KB, 5000 lines | Final output truncation limits. |
1463
- | `artifacts` | boolean | false | Write debug artifacts. |
1156
+ | `artifacts` | boolean | true | Write debug artifacts. |
1464
1157
  | `includeProgress` | boolean | false | Include full progress in result. |
1465
1158
  | `share` | boolean | false | Upload session export to GitHub Gist. |
1466
1159
  | `sessionDir` | string | derived | Override session log directory. |
1467
1160
  | `acceptance` | string/object/false | inferred | Configure evidence gates with `"auto"`, `"attested"`, `"checked"`, `"verified"`, or `{ level: "none", reason: "..." }`. Independent review is orthogonal: use `review: { required: true, agent?: "commentator", focus?: "..." }`. `review-required` means evidence passed but review is pending; `reviewed` is achieved only after a real independent result. Explicit `"reviewed"` remains schema-recognized solely for actionable preflight recovery. For commentator/read-only calls, omit acceptance. `false` disables gates. With `agentContract: { version: 1 }`, omitted, `"auto"`, and `false` mean no acceptance request for that run; explicit acceptance is reported separately from execution. |
1468
1161
 
1469
- `agentContract: { version: 1 }` keeps existing fields and artifacts but adds derived `execution`, `acceptance`, `review`, and `effects` projections. In v1, acceptance failures do not rewrite execution success, and an explicit completion guard reports `effects.fileMutation` instead of failing the run by itself. Chain steps default to advancing on execution under v1; set `gateOn: "acceptance"` on a v1 step or parallel task when rejected acceptance should stop the chain.
1470
-
1471
- Checkpoint steps use `{ checkpoint: "stable-name", message?: "..." }`. A checkpoint does not launch a child, consume spawn budget, or produce an output reference. Foreground chains return a paused result at the checkpoint so the current parent can explicitly choose the next action. Async chains persist `checkpoint` in status/details and pause before the next step; approve with `subagent({ action: "approve-checkpoint", id: "<run-id>" })` or reject with `subagent({ action: "reject-checkpoint", id: "<run-id>" })`. Approval resumes from that boundary without rerunning completed steps. Rejection is terminal with `state: "rejected"`.
1472
-
1473
1162
  As a conservative orchestration policy, do not set `turnBudget`, a hard `toolBudget`, or a tight `usageBudget` on implementation builders, fix builders, commentators with edit authority, or other mutation-capable children. A default tool budget blocks read/search tools rather than mutation tools, and reported usage has no reservation model, so neither assistant turns, tool-call counts, nor token/cost totals measure whether a delivery slice is buildable or safe to hand off. Hard caps remain appropriate for explicitly read-only explorers, commentators, and validators.
1474
1163
 
1475
1164
  Bound writer work with a narrow task and an outer `timeoutMs` or `maxRuntimeMs` that leaves enough margin for the slice. An elapsed timeout is not a mutation-safe boundary and may still signal a child during tool work. Before the deadline, use `steer` or an attention notice to request a checkpoint after the current tool returns, including changed files, build/test state, remaining work, and commit or PR state.
1476
1165
 
1477
- `context: "fork"` fails fast when the parent session is not persisted, the current leaf is missing, or the branched child session cannot be created. When the inherited transcript contains signed Anthropic `thinking` / `redacted_thinking` blocks, `pi-subagents` strips those provider-private blocks from the forked child session. It forces thinking `off` only when the child’s effective primary or fallback model resolves through the model registry to the Anthropic provider or `anthropic-messages` API; unresolved models are treated conservatively. The result reports every affected child, including on failed runs. Use `context: "fresh"` when an Anthropic child needs thinking. Forking never silently downgrades to `fresh`. In multi-agent runs that omit `context`, each agent/task/step follows its own `defaultContext`, so a fresh-default explorer can run fresh beside a fork-default architect. Pass explicit `context: "fork"` or `context: "fresh"` when you intentionally want one context for every child.
1478
-
1479
- Delegated results are reference-first by default. Every child gets a durable saved output unless the caller explicitly uses `output: false`: omitted `output` uses a generated per-run path, omitted `outputMode` resolves to `file-only`, and completion returns a compact reference like `Output saved to: /abs/report.md (48.2 KB, 2847 lines). Read this file if needed.` Inspect full output through the saved path, async status/transcript, or resume. Explicit `outputMode: "inline"` restores legacy full inline delivery; `output: false` disables durable result persistence (follow-up visibility falls back to bounded excerpts). Failed runs with a successfully persisted result return the error/status plus the saved-output reference; when persistence or read-back fails, only a bounded excerpt (first 80 lines / 4 KiB) is returned together with the error, never raw unbounded output. Generated output files persist even with `artifacts: false`; debug `_input`, `_output`, metadata, and transcript artifacts remain opt-in. In chains, relative `output` paths are resolved inside the chain artifact directory, not the caller's CWD; later `{previous}` steps receive the same compact reference when the prior step used file-only mode. To persist chain outputs outside the temp artifact area, pass a persistent `chainDir` or use an absolute `output` path. A child with only read-only tools does not need direct filesystem access for `output`: it returns the complete artifact in its final response and the runtime persists it. Children with mutation-capable tools retain the direct-write instruction.
1166
+ `context: "fork"` fails fast when the parent session is not persisted, the current leaf is missing, or the branched child session cannot be created. When the inherited transcript contains signed Anthropic `thinking` / `redacted_thinking` blocks, `pi-subagents` strips those provider-private blocks from the forked child session. It forces thinking `off` only when the child’s effective primary or fallback model resolves through the model registry to the Anthropic provider or `anthropic-messages` API; unresolved models are treated conservatively. The result reports every affected child, including on failed runs. Use `context: "fresh"` when an Anthropic child needs thinking. Forking never silently downgrades to `fresh`. In workflow runs that omit `context`, each `runs.run` child follows its own `defaultContext`, so a fresh-default explorer can run fresh beside a fork-default builder. Pass explicit `context: "fork"` or `context: "fresh"` when you intentionally want one context for every child.
1480
1167
 
1481
- Sequential and parallel chain tasks accept `agent`, `task`, `phase`, `label`, `as`, `outputSchema`, `cwd`, `output`, `outputMode`, `reads`, `progress`, `skill`, `model`, `toolBudget`, `acceptance`, `agentContract`, and v1-only `gateOn`. Parallel tasks also accept `count`. Parallel step groups accept `parallel`, `concurrency`, `failFast`, and `worktree`. If `outputSchema` is present, the child must call `structured_output` with schema-valid JSON; prose-only completion or invalid JSON fails the step. Validated structured values are preserved on the step result, and `as` also exposes a compact text representation through `{outputs.name}`.
1168
+ Use `outputMode: "file-only"` when a saved output may be large and the parent only needs a pointer. The returned text is a compact reference like `Output saved to: /abs/report.md (48.2 KB, 2847 lines). Read this file if needed.` Failed runs and save errors still return normal inline output for debugging. In workflowScript, give each child an explicit output path when later script steps need a durable file reference. A child with only read-only tools does not need direct filesystem access for `output`: it returns the complete artifact in its final response and the runtime persists it. Children with mutation-capable tools retain the direct-write instruction.
1482
1169
 
1483
1170
  Status and control actions:
1484
1171
 
@@ -1496,7 +1183,7 @@ subagent({ action: "resume", id: "<run-id>", index: 1, message: "follow-up for c
1496
1183
  subagent({ action: "resume", id: "<nested-run-id>", message: "follow-up for a nested child" })
1497
1184
  subagent({ action: "steer", id: "<run-id>", message: "guidance for the running child" })
1498
1185
  subagent({ action: "steer", id: "<run-id>", index: 1, message: "guidance for child 2" })
1499
- subagent({ action: "append-step", id: "<run-id>", chain: [{ agent: "builder", task: "Continue from {previous}" }] })
1186
+ subagent({ action: "append-step", id: "<run-id>", step: { agent: "builder", task: "Continue from {previous}" } })
1500
1187
  subagent({ action: "approve-checkpoint", id: "<run-id>" })
1501
1188
  subagent({ action: "reject-checkpoint", id: "<run-id>" })
1502
1189
  subagent({ action: "doctor" })
@@ -1504,47 +1191,55 @@ subagent({ action: "doctor" })
1504
1191
 
1505
1192
  `status` resolves exact foreground ids, top-level async ids, and nested run ids before falling back to prefix matching. `view: "fleet"` is an optional read-only active-run surface with transcript commands; it does not add steering or stop controls. `view: "transcript"` tails the selected run's live `output-<index>.log` or persisted session transcript, with `lines` capped at 500. Nested status shows the root/parent path, nested children, session/artifact paths when known, and nested control commands. Inside child-safe fanout mode, bare `status` requires an id when no local foreground run is active, so children cannot enumerate unrelated top-level async runs. Bare `interrupt` still targets only the visible top-level run; interrupting a nested run requires its explicit nested id.
1506
1193
 
1507
- `resume` revives a paused, completed, or failed async/foreground child by starting a new child from its stored session file; stopped runs remain non-resumable, and it does not interrupt a live top-level async child. Use `steer` for acknowledged live async guidance. Multi-child async runs and remembered foreground single, parallel, or chain runs can be revived by passing `index` to choose the child. Nested runs can be resumed by nested id when their live route or persisted nested session metadata is available. Revive starts a new child process from the old session context; it does not restart the same OS process, and it requires the chosen child to have a persisted `.jsonl` session file. Direct revival takes an exclusive cross-process lease on the canonical session file until the new child finishes. A concurrent attempt fails before Pi is spawned and identifies the owning revived run; dead-owner leases are reclaimed only when staleness can be proved.
1194
+ `resume` revives a paused, completed, or failed async/foreground child by starting a new child from its stored session file; stopped runs remain non-resumable, and it does not interrupt a live top-level async child. Use `steer` for acknowledged live async guidance. Multi-child async runs and remembered foreground single, parallel, or chain runs can be revived by passing `index` to choose the child. Nested runs can be resumed by nested id when their live route or persisted nested session metadata is available. Revive starts a new child process from the old session context; it does not restart the same OS process, and it requires the chosen child to have a persisted `.jsonl` session file. Direct revival takes an exclusive cross-process lease on the canonical session file until the new child finishes. A concurrent attempt fails before Selesai is spawned and identifies the owning revived run; dead-owner leases are reclaimed only when staleness can be proved.
1508
1195
 
1509
- `stop` ends a current-session top-level async run. It is deliberately stronger than `interrupt`: it is not a resumable pause, stopped runs should be restarted as new runs, foreground and nested targets are rejected, direct id calls execute immediately, and `/subagents-stop` without an id opens a selector with confirmation when a TUI is available. Use `↑`/`↓` or `j`/`k` to move through that selector. In non-TUI contexts the slash command prints exact `subagent({ action: "stop", id })` and `/subagents-stop <id>` commands. Scheduled jobs can appear in the selector, but they are labeled as scheduled cancellations and route through `schedule-cancel`, not `stop`.
1196
+ `stop` ends a current-session top-level async run. It is deliberately stronger than `interrupt`: it is not a resumable pause, stopped runs should be restarted as new runs, foreground and nested targets are rejected, direct id calls execute immediately, and `/subagents-stop` without an id opens a selector with confirmation when a TUI is available. Use `↑`/`↓` or `j`/`k` to move through that selector. In non-TUI contexts the slash command prints exact `subagent({ action: "stop", id })` and `/subagents-stop <id>` commands. Inactive schedules can appear in the selector, but they are labeled as schedules and route through `schedule.pause`, not `stop`.
1510
1197
 
1511
- `steer` waits up to three seconds for a correlated child-Pi input acceptance and returns a request id with `delivered`, `scheduled`, `pending`, `partial`, `recovered`, or `failed` plus per-child states. Delivery means Pi accepted the user message, not model compliance. A pending indexed child returns `scheduled`. Only a top-level single run may interrupt after the acknowledgment deadline and recover after a further 15-second pause/revival bound; chain, parallel, and nested runs never auto-interrupt. Recovery launches a replacement only after the source is confirmed paused, a valid persisted session exists, and deadline, turn, and tool budgets remain. It preserves the original child contract and remaining limits; otherwise the source stays paused with an explicit failure. Late acceptance is recorded but cannot cancel committed recovery. The persisted `steering` ledger retains 20 requests and replaces the old `steerCount`/`lastSteerAt` fields.
1198
+ `steer` waits up to three seconds for a correlated child-Selesai input acceptance and returns a request id with `delivered`, `scheduled`, `pending`, `partial`, `recovered`, or `failed` plus per-child states. Delivery means Selesai accepted the user message, not model compliance. A pending indexed child returns `scheduled`. Only a top-level single run may interrupt after the acknowledgment deadline and recover after a further 15-second pause/revival bound; durable multi-child and nested runs never auto-interrupt. Recovery launches a replacement only after the source is confirmed paused, a valid persisted session exists, and deadline, turn, and tool budgets remain. It preserves the original child contract and remaining limits; otherwise the source stays paused with an explicit failure. Late acceptance is recorded but cannot cancel committed recovery. The persisted `steering` ledger retains 20 requests and replaces the old `steerCount`/`lastSteerAt` fields.
1512
1199
 
1513
- `append-step` accepts exactly one sequential, checkpoint, static parallel, or dynamic fanout chain step for a top-level async chain whose status is still `running`. The step is persisted in the run directory and becomes eligible only after the chain's already-queued steps finish; completed, failed, rejected, paused, foreground, single, and top-level parallel runs reject appends.
1200
+ `append-step` accepts exactly one `step` object for an existing durable chain for a top-level async chain whose status is still `running`. The step is persisted in the run directory and becomes eligible only after the chain's already-queued steps finish; completed, failed, rejected, paused, foreground, single, and non-chain runs reject appends.
1514
1201
 
1515
- ## Worktree isolation
1202
+ ## Durable missions
1203
+
1204
+ Missions are durable wrappers around runs. The noun map is:
1205
+
1206
+ - **Project/codebase** — where work happens.
1207
+ - **Mission** — why explorerd work exists and how to recover it later.
1208
+ - **Run** — one actual subagent execution.
1209
+ - **Receipt** — proof or a link for an external outcome, such as a PR, CI check, deployment, or release.
1516
1210
 
1517
- 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`.
1211
+ Ordinary task launches create a mission by default, with detailed JSON records under `<cwd>/.pi-subagents/missions/` linking goals, run ids, lifecycle status, decisions, artifact paths, and delivery receipts. Automatic persistence failures do not block the run and are reported as `details.missionWarning`; explicit `missionId` and `mission` requests remain strict before launch. Human receipts end with `Mission: <id> (<status>)`, while JSON/structured output text stays unchanged and `details.missionId` is authoritative. Pass `mission: false` for an intentionally ephemeral launch that should not leave a durable mission record. Set `missions.enabled: false` to disable automatic mission creation; explicit mission fields and actions still work.
1518
1212
 
1519
1213
  ```ts
1520
- { tasks: [
1521
- { agent: "builder", task: "Implement auth", count: 2 },
1522
- { agent: "builder", task: "Implement API" }
1523
- ], worktree: true }
1214
+ const created = subagent({
1215
+ action: "mission.create",
1216
+ mission: { title: "Ship auth refresh", goal: "Implement and validate token refresh" }
1217
+ })
1218
+ subagent({ agent: "builder", task: "Implement the approved auth refresh plan", missionId: "<mission-id>" })
1524
1219
 
1525
- { chain: [
1526
- { agent: "explorer", task: "Gather context" },
1527
- { parallel: [
1528
- { agent: "builder", task: "Implement feature A from {previous}" },
1529
- { agent: "builder", task: "Implement feature B from {previous}" }
1530
- ], worktree: true },
1531
- { agent: "commentator", task: "Review all changes from {previous}" }
1532
- ]}
1220
+ // Or create and attach in one launch
1221
+ subagent({ agent: "builder", task: "Implement the approved plan", mission: { title: "Ship auth refresh" } })
1533
1222
  ```
1534
1223
 
1535
- Requirements:
1224
+ Use `mission.list`, `mission.show`, `mission.update`, `mission.attach-run`, and `mission.close` for management. Use `mission.update` to record decisions, artifacts, labels, summaries, and delivery receipts while work runs; receipts are durable links for pull requests, CI, deployments, or releases, each with `kind`, `status`, `title`, `url`, and optional `description`. They record delivery state only; pi-subagents does not merge, poll CI, or deploy. Use `mission.close` with a terminal status and summary when a mission is done. After compaction or restart, resume from `mission.list`/`mission.show` first: `mission.show` refreshes linked async status where available, then use the linked run ids with normal `status`, `steer`, `resume`, or `stop` actions. `mission.list` with `missionScope: "global"` reads the user-local pointer index under the Selesai agent directory; project records remain the source of truth, and missing records are reported as stale rather than hiding other projects.
1536
1225
 
1537
- - run inside a git repo
1538
- - working tree must be clean
1539
- - `node_modules/` is symlinked into each worktree when present
1540
- - task-level `cwd` overrides must be omitted or match the shared cwd
1541
- - configured `worktreeSetupHook` must return valid JSON before timeout
1226
+ For cross-project work, keep same-project tasks on ordinary subagents. Use an explicit `cwd` for small bounded work in another project. For substantial or long-running work in another project, open a project-owned Herdr pane with `project.open` and give that project Selesai session a narrow mission/result contract. The project pane owns its own subagents; do not model it as ordinary child nesting or expect existing headless runs to move into the pane.
1542
1227
 
1543
- Git worktrees start from tracked files, so ignored dependency state may be absent. `pi-subagents` attempts the `node_modules` symlink above, but if module resolution fails in a fresh worktree, first confirm dependencies were linked, installed, or provisioned by `worktreeSetupHook` before treating it as a code failure.
1228
+ ## Worktree isolation
1229
+
1230
+ Scripted workflows can give each writing child a separate managed git worktree by setting `worktree: true` on each `runs.run` / `runs.all` item:
1231
+
1232
+ ```javascript
1233
+ const [api, ui] = await runs.all([
1234
+ { key: "api", agent: "builder", task: "Implement the API", worktree: true },
1235
+ { key: "ui", agent: "builder", task: "Implement the UI", worktree: true }
1236
+ ]);
1237
+ return { api: api.artifactPaths, ui: ui.artifactPaths };
1238
+ ```
1544
1239
 
1545
- By default, worktrees are created under the system temp directory. Set `worktreeBaseDir` in config, or `SELESAI_SUBAGENTS_WORKTREE_DIR` when config is unset, to put them under a stable trusted directory. Missing base directories are created automatically.
1240
+ Each child uses the existing worktree lifecycle: it branches from clean HEAD, journals ownership before launch, captures a patch and handoff manifest, then removes cleanly captured temporary worktrees and branches. The handoff manifest path remains available in the child's `artifactPaths`; return or emit it when the orchestrator needs to apply or inspect the patches. `runs.ref` stays concise and intentionally omits full paths.
1546
1241
 
1547
- After a worktree parallel step completes, per-agent diff stats are appended to the output and full patch files are written to artifacts. The runtime also writes a versioned aggregate handoff manifest: foreground runs use the artifact directory's `handoffs/<run-id>.json`, while async runs use `<async-dir>/handoff.json`. The manifest records each child's terminal status, summary, output/session/structured-output references, patch stats and path, and whether its worktree and temporary branch were actually removed. Foreground `details`, async `status.json` and result files, status output, intercom delivery, and completion notifications expose the manifest path. Worktrees and temp branches still receive best-effort fallback cleanup if handoff finalization cannot run.
1242
+ A top-level `{ workflowScript, worktree: true }` makes isolation the default for every workflow child. An individual child can override that default with `worktree: false`. Keep one writer when parallel writes are not intentionally isolated.
1548
1243
 
1549
1244
  ## Configuration
1550
1245
 
@@ -1558,15 +1253,23 @@ After a worktree parallel step completes, per-agent diff stats are appended to t
1558
1253
 
1559
1254
  Controls the parent-facing `subagent` tool description registered at startup. `full` is the default. `compact` keeps the execution modes, async/`subagent_wait` guidance, child-safety boundary, management/action split, one-writer review guidance, and artifact/status essentials with less prompt bloat.
1560
1255
 
1561
- `custom` reads `subagent-tool-description.md` from the project config directory, then from `~/.selesai/agent/subagent-tool-description.md`. Missing, empty, unreadable, or oversized custom files fall back to the full description. Custom templates may use `{{fullDescription}}`, `{{compactDescription}}`, `{{safetyGuidance}}`, `{{agentDir}}`, and `{{projectConfigDir}}`; the safety guidance is always present so custom prose cannot remove the runtime guardrails. Restart Pi after changing the mode or custom file.
1256
+ `custom` reads `subagent-tool-description.md` from the project config directory, then from `~/.selesai/agent/subagent-tool-description.md`. Missing, empty, unreadable, or oversized custom files fall back to the full description. Custom templates may use `{{fullDescription}}`, `{{compactDescription}}`, `{{safetyGuidance}}`, `{{agentDir}}`, and `{{projectConfigDir}}`; the safety guidance is always present so custom prose cannot remove the runtime guardrails. Restart Selesai after changing the mode or custom file.
1257
+
1258
+ ### `inlineToolDisplay`
1259
+
1260
+ ```json
1261
+ { "inlineToolDisplay": "summary" }
1262
+ ```
1263
+
1264
+ Controls the `subagent` tool result shown inline in chat. The default, `"rich"`, shows live child activity and expands to detailed output. `"summary"` keeps the inline result at one stable row for running, completed, failed, stopped, and paused runs; it does not animate, show elapsed time, preview child output, or change when Selesai's expand key is pressed. FleetView remains available for live progress and detailed inspection.
1562
1265
 
1563
1266
  ### `asyncByDefault`
1564
1267
 
1565
1268
  ```json
1566
- { "asyncByDefault": true }
1269
+ { "asyncByDefault": false }
1567
1270
  ```
1568
1271
 
1569
- Makes top-level calls use background execution when the request does not explicitly set `async`. Callers can still force foreground with `async: false` unless `forceTopLevelAsync` is enabled.
1272
+ Ordinary top-level calls use background execution when the request omits `async`. Set `asyncByDefault` to `false` to restore foreground-by-default behavior. Callers can still force foreground with `async: false` unless `forceTopLevelAsync` is enabled; `clarify: true` remains foreground for its UI.
1570
1273
 
1571
1274
  ### `fleetView`
1572
1275
 
@@ -1590,7 +1293,7 @@ Places the persistent FleetView either `"belowEditor"` or `"aboveEditor"`. The d
1590
1293
  { "asyncWidget": true }
1591
1294
  ```
1592
1295
 
1593
- Controls the legacy above-editor widget for background runs. It defaults to `false` while FleetView is enabled and `true` when FleetView is disabled. Set it explicitly to show both surfaces or hide the legacy widget entirely.
1296
+ Controls the under-editor widget for active background runs. It defaults to `true`, including when FleetView is enabled, so active work remains visible after reload. Set it to `false` to hide this widget while keeping FleetView available.
1594
1297
 
1595
1298
  ### `waitTool`
1596
1299
 
@@ -1598,7 +1301,9 @@ Controls the legacy above-editor widget for background runs. It defaults to `fal
1598
1301
  { "waitTool": { "enabled": false } }
1599
1302
  ```
1600
1303
 
1601
- Keeps the `subagent_wait` tool registered but makes direct calls return immediately instead of blocking on active subagent or provider work. The default is enabled. You can also set `"waitTool": false`; set `PI_SUBAGENT_WAIT_TOOL_ENABLED=false` (or `0`, `off`, `disabled`) to override config for one process. The effective value is passed explicitly to child runtimes. Headless `agent_end` auto-drain remains a lifecycle safeguard even when direct wait calls are disabled. Invalid config or environment values fail instead of being coerced.
1304
+ Keeps the `subagent_wait` tool registered but makes direct calls return immediately instead of blocking on active subagent or provider work. The default is enabled. You can also set `"waitTool": false`; set `SELESAI_SUBAGENT_WAIT_TOOL_ENABLED=false` (or `0`, `off`, `disabled`) to override config for one process. The effective value is passed explicitly to child runtimes. Headless `agent_end` auto-drain remains a lifecycle safeguard even when direct wait calls are disabled. Invalid config or environment values fail instead of being coerced.
1305
+
1306
+ Blocking `subagent_wait({ id: "..." })` keeps the current tool call open until that run changes. In a long-lived interactive parent session, `subagent_wait({ id: "...", nonBlocking: true })` instead resolves the prefix once, persists the exact run identity, returns a subscription token immediately, and wakes that session on completion, failure, attention, reconciliation failure, or timeout. Armed subscriptions appear in ordinary `subagent({ action: "status" })` output and are not counted as active child work. This is different from `waitTool.enabled=false`, which returns immediately without registering any future wake. Provider items remain available only to blocking fleet-wide waits; non-blocking subscriptions require one async or remembered detached foreground run id.
1602
1307
 
1603
1308
  ### `forceTopLevelAsync`
1604
1309
 
@@ -1614,7 +1319,7 @@ Forces depth-0 single, parallel, and chain runs into background mode and bypasse
1614
1319
  { "globalConcurrencyLimit": 20 }
1615
1320
  ```
1616
1321
 
1617
- Caps simultaneously running subagent tasks within a single run across top-level parallel tasks, inline chain parallel groups, and dynamic fanout groups. The default is `20`; invalid values are clamped to `1`. Per-step `concurrency` and `parallel.concurrency` still apply, so effective concurrency is the lower of the local cap and the available global slots.
1322
+ Caps simultaneously running children inside existing durable legacy multi-child runs. New orchestration uses `workflowScript` and `runs.all`.
1618
1323
 
1619
1324
  ### `maxSubagentSpawnsPerSession`
1620
1325
 
@@ -1622,7 +1327,7 @@ Caps simultaneously running subagent tasks within a single run across top-level
1622
1327
  { "maxSubagentSpawnsPerSession": 100 }
1623
1328
  ```
1624
1329
 
1625
- Optionally caps the total number of child subagent launches during one parent session, including completed and failed children, parallel task counts, static chain steps, and bounded dynamic fanout children. Sessions are unlimited by default. Set this value to `0` to disable a configured cap. `PI_SUBAGENT_MAX_SPAWNS_PER_SESSION` overrides the config for a process and follows the same positive-cap/zero-unlimited semantics.
1330
+ Optionally caps the total number of child subagent launches during one parent session, including completed and failed children, parallel task counts, static chain steps, and bounded dynamic fanout children. Sessions are unlimited by default. Set this value to `0` to disable a configured cap. `SELESAI_SUBAGENT_MAX_SPAWNS_PER_SESSION` overrides the config for a process and follows the same positive-cap/zero-unlimited semantics.
1626
1331
 
1627
1332
  `subagent({ action: "status" })`, fleet status, and `subagent({ action: "doctor" })` expose used, effective limit, remaining capacity, grants, and the remaining grant allowance. Static chains and parallel calls fail before creating run artifacts or starting partial work when their declared capacity cannot fit. Later retries or unbounded dynamic work are not guaranteed by that preflight.
1628
1333
 
@@ -1631,10 +1336,12 @@ A user may explicitly call `subagent({ action: "grant-spawn-budget", additional:
1631
1336
  ### `scheduledRuns`
1632
1337
 
1633
1338
  ```json
1634
- { "scheduledRuns": { "enabled": true, "maxPending": 20, "maxLatenessMs": 300000 } }
1339
+ { "scheduledRuns": { "enabled": false, "maxPending": 20 } }
1635
1340
  ```
1636
1341
 
1637
- Enables optional one-shot scheduled subagent runs. When enabled, `subagent({ action: "schedule", agent, task?, schedule: "+10m" | "2030-01-01T09:00:00Z", scheduleName? })` defers a subagent launch until a future time. Absolute ISO timestamps must include a timezone (`Z` or an offset such as `+05:30`). The scheduled run launches as a normal tracked async run with fresh context once it fires, and joins the existing async widget, status, `subagent_wait`, and completion-notification paths. `schedule-list`, `schedule-status`, and `schedule-cancel` manage pending jobs. Schedules are persisted per session and restored after a Pi restart; a job missed by more than `maxLatenessMs` while Pi is unavailable is marked `missed` instead of firing late. `maxPending` caps the number of pending or running scheduled jobs per session (default `20`). The feature is opt-in: leave `enabled` unset to keep scheduling out of the tool surface and prompt. Only schedule explicit delayed runs the user asked for.
1342
+ Durable schedules are enabled by default and stored per project under `.pi-subagents/schedules/<id>/`. Create a one-shot schedule with `subagent({ action: "schedule.create", id: "evening-review", name: "Evening review", at: "+30m", agent: "commentator", task: "Review the current diff." })`. Create a fixed recurring workflow with `subagent({ action: "schedule.create", id: "backlog", every: "6h", catchUp: "latest", workflowScript: "..." })`. Fixed intervals support `m`, `h`, `d`, and `w` units and advance from the planned time without completion drift.
1343
+
1344
+ Manage schedules with `schedule.list`, `schedule.show`, `schedule.history`, `schedule.pause`, `schedule.resume`, `schedule.run`, `schedule.run-due`, and `schedule.delete`. Runs always launch async with fresh context and disable automatic mission creation; mission attachment is deferred from this first slice. Definitions, bounded history, append-only events, and per-run receipts are stored with mode `0600`. `overlap` is currently fixed to `skip`; `catchUp` supports `latest` (default) and `none`. `schedule.run-due` lets an external launcher start due project work without making `pi-subagents` a daemon. Calendar recurrence, cron, queue/replace overlap, and the schedule TUI inspector are intentionally deferred to the next slice. The old `schedule`, `schedule-list`, `schedule-status`, and `schedule-cancel` actions were removed in this hard cutover.
1638
1345
 
1639
1346
  ### `parallel`
1640
1347
 
@@ -1660,7 +1367,7 @@ Session directory precedence is: `params.sessionDir`, then `config.defaultSessio
1660
1367
  ### `singleRunOutputBaseDir`
1661
1368
 
1662
1369
  ```json
1663
- { "singleRunOutputBaseDir": "~/.pi/subagent-outputs" }
1370
+ { "singleRunOutputBaseDir": "~/.selesai/subagent-outputs" }
1664
1371
  ```
1665
1372
 
1666
1373
  Routes relative `output` paths for single-agent `/run` calls under this directory. Absolute per-call or agent output paths are still used as-is. When unset, relative single-run outputs go under the run's output artifact directory instead of the project root.
@@ -1671,15 +1378,15 @@ Routes relative `output` paths for single-agent `/run` calls under this director
1671
1378
  { "maxSubagentDepth": 1 }
1672
1379
  ```
1673
1380
 
1674
- 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. This applies even to children that explicitly declare `tools: subagent`; at the cap, execution fanout is blocked instead of silently hiding nested work.
1381
+ Controls nested delegation when no inherited `SELESAI_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. This applies even to children that explicitly declare `tools: subagent`; at the cap, execution fanout is blocked instead of silently hiding nested work.
1675
1382
 
1676
- ### `PI_SUBAGENT_PI_BINARY`
1383
+ ### `SELESAI_SUBAGENT_PI_BINARY`
1677
1384
 
1678
1385
  ```bash
1679
- export PI_SUBAGENT_PI_BINARY=/path/to/pi-or-wrapper
1386
+ export SELESAI_SUBAGENT_PI_BINARY=/path/to/pi-or-wrapper
1680
1387
  ```
1681
1388
 
1682
- Overrides the command used to launch child Pi processes. Package wrappers can set this to their own `pi`/agent binary so subagents inherit wrapper flags, environment setup, and bundled resources without relying on `PATH` ordering. Empty or whitespace-only values are ignored.
1389
+ Overrides the command used to launch child Selesai processes. Package wrappers can set this to their own `pi`/agent binary so subagents inherit wrapper flags, environment setup, and bundled resources without relying on `PATH` ordering. Empty or whitespace-only values are ignored.
1683
1390
 
1684
1391
  ### `intercomBridge`
1685
1392
 
@@ -1699,7 +1406,7 @@ Fields:
1699
1406
 
1700
1407
  - `mode`: default `always`; use `fork-only` to inject only for forked runs, or `off` to disable the bridge.
1701
1408
  - `instructionFile`: optional Markdown template replacing the default bridge instructions. `{orchestratorTarget}` is interpolated. Relative paths resolve from `~/.selesai/agent/extensions/subagent/`.
1702
- - `resultDelivery`: default `true`; attempts acknowledged grouped completion delivery through an external `subagent:result-intercom` listener. Set `false` when native parent notifications own completion delivery. Supervisor asks/progress remain active, and genuine enabled-transport acknowledgement failures remain visible.
1409
+ - `resultDelivery`: default `false`; set `true` only when an external `subagent:result-intercom` listener is installed. Enabled delivery waits for acknowledgement and reports acknowledgement failures. Supervisor asks/progress remain active.
1703
1410
 
1704
1411
  Bridge activation requires a targetable current parent session id, which `pi-subagents` passes to children automatically. It no longer depends on an external `pi-intercom` installation or per-agent extension allowlists.
1705
1412
 
@@ -1732,6 +1439,38 @@ stdin is a JSON object with `repoRoot`, `worktreePath`, `agentCwd`, `branch`, `i
1732
1439
 
1733
1440
  `syntheticPaths` must be relative to the worktree root. They are removed before diff capture so helper files do not pollute patches. Tracked files are never excluded; marking a tracked path as synthetic fails setup. Default timeout is `30000` ms.
1734
1441
 
1442
+ ### `missions`
1443
+
1444
+ ```json
1445
+ {
1446
+ "missions": {
1447
+ "enabled": true,
1448
+ "directory": ".pi-subagents/missions",
1449
+ "globalIndex": true,
1450
+ "retainTerminal": 200
1451
+ }
1452
+ }
1453
+ ```
1454
+
1455
+ Automatic missions are enabled by default for ordinary launches with a task. Use per-launch `mission: false` for intentionally ephemeral work, or set `enabled: false` to disable automatic creation globally; explicit mission actions and `missionId`/`mission` launch fields still work. `directory` may be absolute, `~/...`, or project-relative. `retainTerminal` is a positive count (default `200`); pruning removes only the oldest completed, failed, or cancelled records and their pointers, never planned, active, waiting, needs-decision, or corrupt records. The user-global index contains pointers only; missing-record pointers self-heal when globally listed. Set `globalIndex: false` to disable writes or `globalIndexDir` to redirect it.
1456
+
1457
+ ### `authorityPolicy`
1458
+
1459
+ ```json
1460
+ {
1461
+ "authorityPolicy": {
1462
+ "discardWorktree": "confirm",
1463
+ "destructiveCleanup": "confirm",
1464
+ "spawnBudgetGrant": "confirm",
1465
+ "scheduleCreate": "auto",
1466
+ "stopRun": "auto",
1467
+ "steerRun": "auto"
1468
+ }
1469
+ }
1470
+ ```
1471
+
1472
+ Each fixed action resolves to `"auto"`, `"confirm"`, or `"forbid"`. This is intentionally a small action map, not a generic policy language. Confirm-required control actions fail closed without an interactive UI.
1473
+
1735
1474
  ### `artifactDir`
1736
1475
 
1737
1476
  ```json
@@ -1742,7 +1481,9 @@ stdin is a JSON object with `repoRoot`, `worktreePath`, `agentCwd`, `branch`, `i
1742
1481
 
1743
1482
  Controls where subagent artifact files (inputs, outputs, transcripts, metadata) are stored. Defaults to `"project"`, which writes to `<cwd>/.pi-subagents/artifacts/`. Set to `"session"` to store artifacts under pi's session directory (`~/.selesai/agent/sessions/<session>/subagent-artifacts/`), keeping the working directory clean. Set to `"temp"` to use the OS temp directory.
1744
1483
 
1745
- The `"session"` option uses the same directory that `cleanupAllArtifactDirs` already scans for age-based cleanup, so artifacts are still cleaned up automatically.
1484
+ This preference also controls the default chain scratch directory. `"project"` uses `<cwd>/.pi-subagents/chain-runs/`, while `"session"` and `"temp"` use the user-scoped temp chain directory.
1485
+
1486
+ The `"session"` option uses the same directory that `cleanupAllArtifactDirs` already scans for age-based cleanup, so artifacts are still cleaned up automatically. Temporary chain directories are cleaned up separately after 24 hours.
1746
1487
 
1747
1488
  ### `completionBatch`
1748
1489
 
@@ -1759,21 +1500,21 @@ The `"session"` option uses the same directory that `cleanupAllArtifactDirs` alr
1759
1500
  }
1760
1501
  ```
1761
1502
 
1762
- Controls smart batching of async-completion notifications. When several background subagents finish within a short window, their successful completions are held briefly and delivered as a single grouped message instead of separate notifications. A hard `maxWaitMs` cap (measured from the first completion in a group) guarantees nothing is held indefinitely, and late-finishing siblings that arrive within `stragglerWindowMs` of a group emit join a shorter straggler group governed by `stragglerDebounceMs` and `stragglerMaxWaitMs`.
1503
+ Controls smart batching of async-completion notifications. When several background subagents finish within a short window, their successful completions are held briefly and delivered as a single quiet grouped completion instead of separate completions. A hard `maxWaitMs` cap (measured from the first completion in a group) guarantees nothing is held indefinitely, and late-finishing siblings that arrive within `stragglerWindowMs` of a group emit join a shorter straggler group governed by `stragglerDebounceMs` and `stragglerMaxWaitMs`.
1763
1504
 
1764
1505
  Failed and paused completions bypass batching and fire immediately, flushing any held successes first, so failure and needs-attention signals are never delayed. Set `enabled` to `false` to restore the original one-notification-per-completion behavior. Changes apply on the next session start.
1765
1506
 
1766
1507
  ## Files, logs, and observability
1767
1508
 
1768
- Each chain run creates a user-scoped temp directory like:
1509
+ Each chain run creates a scratch directory under its resolved chain root. With the default `artifactDir: "project"`, that root is `<cwd>/.pi-subagents/chain-runs/`. With `artifactDir: "session"` or `"temp"`, it is user-scoped temp storage:
1769
1510
 
1770
1511
  ```text
1771
1512
  <tmpdir>/pi-subagents-<scope>/chain-runs/{runId}/
1772
1513
  ```
1773
1514
 
1774
- It may contain files such as `context.md`, `plan.md`, `progress.md`, and `parallel-{stepIndex}/.../output.md`. Directories older than 24 hours are cleaned up on extension startup.
1515
+ A run directory may contain files such as `context.md`, `plan.md`, `progress.md`, and `parallel-{stepIndex}/.../output.md`. User-scoped temp chain directories older than 24 hours are cleaned up on extension startup; project-local and explicit persistent roots are not age-scanned.
1775
1516
 
1776
- When explicitly enabled with `artifacts: true`, debug artifacts live under `{sessionDir}/subagent-artifacts/`, `.pi-subagents/artifacts/` for project-scoped runs, or a user-scoped temp artifact directory. Single-run relative `output` files are saved under `{artifactsDir}/outputs/{runId}/` unless `singleRunOutputBaseDir` is configured. Per task you may see:
1517
+ Debug artifacts live under `{sessionDir}/subagent-artifacts/`, `.pi-subagents/artifacts/` for project-scoped runs, or a user-scoped temp artifact directory. Single-run relative `output` files are saved under `{artifactsDir}/outputs/{runId}/` unless `singleRunOutputBaseDir` is configured. Per task you may see:
1777
1518
 
1778
1519
  - `{runId}_{agent}_input.md`
1779
1520
  - `{runId}_{agent}_output.md`
@@ -1784,7 +1525,7 @@ Metadata records timing, usage, exit code, final model, attempted models, fallba
1784
1525
 
1785
1526
  Session files are stored under a per-run session directory. With `context: "fork"`, each child starts with `--session <branched-session-file>` produced from the parent’s current leaf. That is a real session fork, not an injected summary.
1786
1527
 
1787
- Async completions notify only the originating session. The result watcher emits `subagent:async-complete`, and the extension consumes that event to render completion notifications. Successful sibling completions are held briefly and delivered as a single grouped message when they finish within a short window (see `completionBatch`); failed and paused completions always fire immediately.
1528
+ Async completions belong only to the originating session. The result watcher emits `subagent:async-complete`, and the extension consumes that event to record completion state. Successful sibling completions are held briefly and delivered as a quiet grouped completion when they finish within a short window (see `completionBatch`), avoiding unread markers on inactive tabs. Failed and paused completions remain visible and fire immediately.
1788
1529
 
1789
1530
  Async runs write:
1790
1531
 
@@ -1796,7 +1537,7 @@ Async runs write:
1796
1537
  subagent-log-<id>.md
1797
1538
  ```
1798
1539
 
1799
- `status.json` powers the widget and `subagent({ action: "status" })` output. `events.jsonl` contains wrapper events plus child Pi JSON events annotated with run and step metadata, including correlated `subagent.steer.requested`, `scheduled`, `routed`, `delivered`, `failed`, and `recovered` events plus failure/partial/recovery notices. Nested fanout status is stored as compact sidecar event/registry metadata and merged into parent status views and result/intercom payloads; full recursive status snapshots are not embedded in parent result files. `output-<n>.log` is a live human-readable tail. Fallback information is persisted so background runs are debuggable after completion.
1540
+ `status.json` powers the widget and `subagent({ action: "status" })` output. `events.jsonl` contains wrapper events plus child Selesai JSON events annotated with run and step metadata, including correlated `subagent.steer.requested`, `scheduled`, `routed`, `delivered`, `failed`, and `recovered` events plus failure/partial/recovery notices. Nested fanout status is stored as compact sidecar event/registry metadata and merged into parent status views and result/intercom payloads; full recursive status snapshots are not embedded in parent result files. `output-<n>.log` is a live human-readable tail. Fallback information is persisted so background runs are debuggable after completion.
1800
1541
 
1801
1542
  ## Acceptance Gates
1802
1543
 
@@ -1837,7 +1578,7 @@ Acceptance fences are removed from normal output artifacts, while the raw child
1837
1578
 
1838
1579
  Foreground runs show compact live progress for single, chain, and parallel modes: current tool, recent output, token counts, aggregate cost, duration, activity freshness, current-tool duration, and chain graph metadata when available.
1839
1580
 
1840
- Press Pi's configured expand key (`Ctrl+O` by default) to expand the full streaming view with complete output per step.
1581
+ Press Selesai's configured expand key (`Ctrl+O` by default) to expand the full streaming view with complete output per step.
1841
1582
 
1842
1583
  Sequential chains show a flow line like `done explorer → running architect`. Chains with parallel steps show per-step cards instead. Chain status uses `label` and `phase` metadata when present, while falling back to agent names for older chains.
1843
1584
 
@@ -1853,23 +1594,23 @@ This is disabled by default. Session data may contain source code, paths, enviro
1853
1594
 
1854
1595
  ## Recursion guard
1855
1596
 
1856
- Subagents can call `subagent` only when their resolved builtin tools explicitly include `subagent`. That is meant for delegated fanout agents, not ordinary builder/commentator children. A depth guard prevents unbounded nesting.
1597
+ Subagents can call `subagent` only when their resolved builtin tools explicitly include `subagent`. That is meant for explorerd fanout agents, not ordinary builder/commentator children. A depth guard prevents unbounded nesting.
1857
1598
 
1858
1599
  By default, nesting is limited to two levels: main session → subagent → sub-subagent. Deeper calls are blocked with guidance to complete the current task directly. Nested runs appear in the parent status widget and `status` output as a tree, and `status`, `interrupt`, and `resume` can target a nested run by its id.
1859
1600
 
1860
1601
  Configure the limit with:
1861
1602
 
1862
- 1. `PI_SUBAGENT_MAX_DEPTH` before starting Pi
1603
+ 1. `SELESAI_SUBAGENT_MAX_DEPTH` before starting Selesai
1863
1604
  2. `config.maxSubagentDepth`
1864
1605
  3. `maxSubagentDepth` in agent frontmatter, which can only tighten the inherited limit
1865
1606
 
1866
1607
  ```bash
1867
- export PI_SUBAGENT_MAX_DEPTH=3
1868
- export PI_SUBAGENT_MAX_DEPTH=1
1869
- export PI_SUBAGENT_MAX_DEPTH=0
1608
+ export SELESAI_SUBAGENT_MAX_DEPTH=3
1609
+ export SELESAI_SUBAGENT_MAX_DEPTH=1
1610
+ export SELESAI_SUBAGENT_MAX_DEPTH=0
1870
1611
  ```
1871
1612
 
1872
- `PI_SUBAGENT_DEPTH` is internal and propagated automatically. Do not set it manually.
1613
+ `SELESAI_SUBAGENT_DEPTH` is internal and propagated automatically. Do not set it manually.
1873
1614
 
1874
1615
  ## Events
1875
1616
 
@@ -1909,15 +1650,9 @@ Then run it through the native adapter:
1909
1650
  /prompt-workflow take-screenshot https://example.com
1910
1651
  ```
1911
1652
 
1912
- The adapter builders to the named subagent, applies `model`, `skill`, `cwd`, `worktree`, and fork/fresh context metadata, and supports runtime overrides such as `--subagent commentator`, `--fork`, `--fresh`, `--worktree`, and `--bg`.
1913
-
1914
- For prompt-template chains, use:
1915
-
1916
- ```text
1917
- /chain-prompts analyze -> fix -- user arguments here
1918
- ```
1653
+ The adapter explorers to the named subagent, applies `model`, `skill`, `cwd`, and fork/fresh context metadata, and supports runtime overrides such as `--subagent commentator`, `--fork`, `--fresh`, and `--bg`.
1919
1654
 
1920
- Each named prompt becomes a native `subagent` chain step. This is intentionally scoped to subagent workflows; compare-style prompt features such as `/best-of-n` are not part of the built-in adapter.
1655
+ Prompt templates with `chain:` frontmatter are translated into `workflowScript` and launched through `/prompt-workflow`; `/chain-prompts` is no longer registered.
1921
1656
 
1922
1657
  ## Runtime files
1923
1658