pi-subagents 0.76.1 → 0.78.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 (391) hide show
  1. package/CHANGELOG.md +115 -0
  2. package/README.md +1 -1
  3. package/agents/evidence-auditor.md +1 -0
  4. package/agents/oracle.md +9 -19
  5. package/agents/researcher.md +0 -3
  6. package/agents/reviewer.md +18 -61
  7. package/agents/scout.md +1 -4
  8. package/agents/worker.md +8 -25
  9. package/docs/agents.md +71 -4
  10. package/docs/configuration.md +75 -10
  11. package/docs/extension-api.md +38 -9
  12. package/docs/missions.md +24 -17
  13. package/docs/models.md +1 -1
  14. package/docs/observability.md +12 -5
  15. package/docs/tool-reference.md +103 -85
  16. package/docs/watchdog.md +8 -6
  17. package/docs/workflows.md +17 -8
  18. package/package.json +1 -1
  19. package/prompts/council.md +1 -1
  20. package/skills/pi-subagents/SKILL.md +2 -2
  21. package/skills/pi-subagents/references/constraints-and-recipes.md +1 -1
  22. package/skills/pi-subagents/references/execution-controls.md +16 -16
  23. package/skills/pi-subagents/references/management-authoring-rpc.md +16 -12
  24. package/skills/pi-subagents/references/multi-lane-orchestration.md +1 -1
  25. package/skills/pi-subagents/references/prompting-and-roles.md +3 -3
  26. package/src/agents/advertised-agent-prompt.d.ts +5 -1
  27. package/src/agents/advertised-agent-prompt.d.ts.map +1 -1
  28. package/src/agents/advertised-agent-prompt.js +8 -2
  29. package/src/agents/advertised-agent-prompt.js.map +1 -1
  30. package/src/agents/agent-management.d.ts.map +1 -1
  31. package/src/agents/agent-management.js +5 -0
  32. package/src/agents/agent-management.js.map +1 -1
  33. package/src/agents/agent-scope.d.ts +1 -0
  34. package/src/agents/agent-scope.d.ts.map +1 -1
  35. package/src/agents/agent-scope.js +3 -0
  36. package/src/agents/agent-scope.js.map +1 -1
  37. package/src/agents/agent-serializer.d.ts.map +1 -1
  38. package/src/agents/agent-serializer.js +3 -0
  39. package/src/agents/agent-serializer.js.map +1 -1
  40. package/src/agents/agents.d.ts +14 -2
  41. package/src/agents/agents.d.ts.map +1 -1
  42. package/src/agents/agents.js +94 -36
  43. package/src/agents/agents.js.map +1 -1
  44. package/src/api/external-runs.d.ts.map +1 -1
  45. package/src/api/external-runs.js +5 -4
  46. package/src/api/external-runs.js.map +1 -1
  47. package/src/api/preflight.d.ts +2 -0
  48. package/src/api/preflight.d.ts.map +1 -1
  49. package/src/api/preflight.js +7 -3
  50. package/src/api/preflight.js.map +1 -1
  51. package/src/extension/active-runs-prompt.d.ts +8 -0
  52. package/src/extension/active-runs-prompt.d.ts.map +1 -0
  53. package/src/extension/active-runs-prompt.js +30 -0
  54. package/src/extension/active-runs-prompt.js.map +1 -0
  55. package/src/extension/config.d.ts.map +1 -1
  56. package/src/extension/config.js +29 -2
  57. package/src/extension/config.js.map +1 -1
  58. package/src/extension/control-notices.d.ts +0 -2
  59. package/src/extension/control-notices.d.ts.map +1 -1
  60. package/src/extension/control-notices.js +1 -7
  61. package/src/extension/control-notices.js.map +1 -1
  62. package/src/extension/declaration-pinning.d.ts +19 -0
  63. package/src/extension/declaration-pinning.d.ts.map +1 -0
  64. package/src/extension/declaration-pinning.js +154 -0
  65. package/src/extension/declaration-pinning.js.map +1 -0
  66. package/src/extension/fanout-child.d.ts.map +1 -1
  67. package/src/extension/fanout-child.js +6 -8
  68. package/src/extension/fanout-child.js.map +1 -1
  69. package/src/extension/index.d.ts +1 -2
  70. package/src/extension/index.d.ts.map +1 -1
  71. package/src/extension/index.js +104 -121
  72. package/src/extension/index.js.map +1 -1
  73. package/src/extension/rpc.d.ts.map +1 -1
  74. package/src/extension/rpc.js +12 -6
  75. package/src/extension/rpc.js.map +1 -1
  76. package/src/extension/schemas.d.ts +137 -1
  77. package/src/extension/schemas.d.ts.map +1 -1
  78. package/src/extension/schemas.js +22 -22
  79. package/src/extension/schemas.js.map +1 -1
  80. package/src/extension/subagent-guide.d.ts +1 -0
  81. package/src/extension/subagent-guide.d.ts.map +1 -1
  82. package/src/extension/subagent-guide.js +80 -6
  83. package/src/extension/subagent-guide.js.map +1 -1
  84. package/src/extension/subagent-options.d.ts +8 -0
  85. package/src/extension/subagent-options.d.ts.map +1 -0
  86. package/src/extension/subagent-options.js +52 -0
  87. package/src/extension/subagent-options.js.map +1 -0
  88. package/src/extension/tool-activation.d.ts.map +1 -1
  89. package/src/extension/tool-activation.js +7 -4
  90. package/src/extension/tool-activation.js.map +1 -1
  91. package/src/extension/tool-description.d.ts +4 -7
  92. package/src/extension/tool-description.d.ts.map +1 -1
  93. package/src/extension/tool-description.js +45 -59
  94. package/src/extension/tool-description.js.map +1 -1
  95. package/src/inspectors/actions.d.ts +2 -0
  96. package/src/inspectors/actions.d.ts.map +1 -1
  97. package/src/inspectors/actions.js +41 -13
  98. package/src/inspectors/actions.js.map +1 -1
  99. package/src/inspectors/plugins.d.ts.map +1 -1
  100. package/src/inspectors/plugins.js +3 -2
  101. package/src/inspectors/plugins.js.map +1 -1
  102. package/src/inspectors/tmux/actions.d.ts +26 -0
  103. package/src/inspectors/tmux/actions.d.ts.map +1 -0
  104. package/src/inspectors/tmux/actions.js +182 -0
  105. package/src/inspectors/tmux/actions.js.map +1 -0
  106. package/src/inspectors/tmux/client.d.ts +28 -0
  107. package/src/inspectors/tmux/client.d.ts.map +1 -0
  108. package/src/inspectors/tmux/client.js +65 -0
  109. package/src/inspectors/tmux/client.js.map +1 -0
  110. package/src/inspectors/tmux/plugin.d.ts +8 -0
  111. package/src/inspectors/tmux/plugin.d.ts.map +1 -0
  112. package/src/inspectors/tmux/plugin.js +15 -0
  113. package/src/inspectors/tmux/plugin.js.map +1 -0
  114. package/src/integrations/program-status.d.ts +31 -0
  115. package/src/integrations/program-status.d.ts.map +1 -0
  116. package/src/integrations/program-status.js +189 -0
  117. package/src/integrations/program-status.js.map +1 -0
  118. package/src/intercom/native-supervisor-channel.d.ts +16 -1
  119. package/src/intercom/native-supervisor-channel.d.ts.map +1 -1
  120. package/src/intercom/native-supervisor-channel.js +101 -8
  121. package/src/intercom/native-supervisor-channel.js.map +1 -1
  122. package/src/intercom/result-intercom.js +1 -1
  123. package/src/intercom/result-intercom.js.map +1 -1
  124. package/src/intercom/supervisor-ui.d.ts +2 -12
  125. package/src/intercom/supervisor-ui.d.ts.map +1 -1
  126. package/src/intercom/supervisor-ui.js +2 -154
  127. package/src/intercom/supervisor-ui.js.map +1 -1
  128. package/src/missions/store.d.ts.map +1 -1
  129. package/src/missions/store.js +27 -5
  130. package/src/missions/store.js.map +1 -1
  131. package/src/runs/background/active-async-capacity.d.ts +2 -1
  132. package/src/runs/background/active-async-capacity.d.ts.map +1 -1
  133. package/src/runs/background/active-async-capacity.js +10 -6
  134. package/src/runs/background/active-async-capacity.js.map +1 -1
  135. package/src/runs/background/async-execution.d.ts +9 -1
  136. package/src/runs/background/async-execution.d.ts.map +1 -1
  137. package/src/runs/background/async-execution.js +253 -144
  138. package/src/runs/background/async-execution.js.map +1 -1
  139. package/src/runs/background/async-job-tracker.d.ts +4 -1
  140. package/src/runs/background/async-job-tracker.d.ts.map +1 -1
  141. package/src/runs/background/async-job-tracker.js +3 -2
  142. package/src/runs/background/async-job-tracker.js.map +1 -1
  143. package/src/runs/background/async-resume.d.ts.map +1 -1
  144. package/src/runs/background/async-resume.js +9 -3
  145. package/src/runs/background/async-resume.js.map +1 -1
  146. package/src/runs/background/await-async-run.d.ts +8 -4
  147. package/src/runs/background/await-async-run.d.ts.map +1 -1
  148. package/src/runs/background/await-async-run.js +14 -8
  149. package/src/runs/background/await-async-run.js.map +1 -1
  150. package/src/runs/background/binary-bootstrap.d.ts.map +1 -1
  151. package/src/runs/background/binary-bootstrap.js +2 -1
  152. package/src/runs/background/binary-bootstrap.js.map +1 -1
  153. package/src/runs/background/chain-root-attachment.d.ts +2 -0
  154. package/src/runs/background/chain-root-attachment.d.ts.map +1 -1
  155. package/src/runs/background/chain-root-attachment.js +9 -6
  156. package/src/runs/background/chain-root-attachment.js.map +1 -1
  157. package/src/runs/background/control-channel.d.ts +1 -0
  158. package/src/runs/background/control-channel.d.ts.map +1 -1
  159. package/src/runs/background/control-channel.js +27 -3
  160. package/src/runs/background/control-channel.js.map +1 -1
  161. package/src/runs/background/fleet-view.js +5 -5
  162. package/src/runs/background/fleet-view.js.map +1 -1
  163. package/src/runs/background/notify.d.ts +6 -1
  164. package/src/runs/background/notify.d.ts.map +1 -1
  165. package/src/runs/background/notify.js +130 -14
  166. package/src/runs/background/notify.js.map +1 -1
  167. package/src/runs/background/result-files.d.ts +27 -0
  168. package/src/runs/background/result-files.d.ts.map +1 -1
  169. package/src/runs/background/result-files.js +100 -6
  170. package/src/runs/background/result-files.js.map +1 -1
  171. package/src/runs/background/result-watcher.d.ts.map +1 -1
  172. package/src/runs/background/result-watcher.js +60 -64
  173. package/src/runs/background/result-watcher.js.map +1 -1
  174. package/src/runs/background/resume-guidance.js +2 -2
  175. package/src/runs/background/resume-guidance.js.map +1 -1
  176. package/src/runs/background/run-child-session.d.ts.map +1 -1
  177. package/src/runs/background/run-child-session.js +9 -15
  178. package/src/runs/background/run-child-session.js.map +1 -1
  179. package/src/runs/background/run-id-resolver.d.ts.map +1 -1
  180. package/src/runs/background/run-id-resolver.js +9 -6
  181. package/src/runs/background/run-id-resolver.js.map +1 -1
  182. package/src/runs/background/run-status.d.ts.map +1 -1
  183. package/src/runs/background/run-status.js +19 -15
  184. package/src/runs/background/run-status.js.map +1 -1
  185. package/src/runs/background/runner-aliases.d.ts.map +1 -1
  186. package/src/runs/background/runner-aliases.js +11 -8
  187. package/src/runs/background/runner-aliases.js.map +1 -1
  188. package/src/runs/background/runner-child-launch.d.ts.map +1 -1
  189. package/src/runs/background/runner-child-launch.js +1 -0
  190. package/src/runs/background/runner-child-launch.js.map +1 -1
  191. package/src/runs/background/runner-http-dispatcher.d.ts +3 -0
  192. package/src/runs/background/runner-http-dispatcher.d.ts.map +1 -1
  193. package/src/runs/background/runner-http-dispatcher.js +2 -0
  194. package/src/runs/background/runner-http-dispatcher.js.map +1 -1
  195. package/src/runs/background/scheduled-runs.d.ts +9 -0
  196. package/src/runs/background/scheduled-runs.d.ts.map +1 -1
  197. package/src/runs/background/scheduled-runs.js +124 -36
  198. package/src/runs/background/scheduled-runs.js.map +1 -1
  199. package/src/runs/background/subagent-runner-bootstrap.d.ts.map +1 -1
  200. package/src/runs/background/subagent-runner-bootstrap.js +5 -1
  201. package/src/runs/background/subagent-runner-bootstrap.js.map +1 -1
  202. package/src/runs/background/subagent-runner.d.ts +3 -1
  203. package/src/runs/background/subagent-runner.d.ts.map +1 -1
  204. package/src/runs/background/subagent-runner.js +211 -283
  205. package/src/runs/background/subagent-runner.js.map +1 -1
  206. package/src/runs/background/subagent-wait.d.ts +2 -0
  207. package/src/runs/background/subagent-wait.d.ts.map +1 -1
  208. package/src/runs/background/subagent-wait.js +34 -20
  209. package/src/runs/background/subagent-wait.js.map +1 -1
  210. package/src/runs/background/terminal-run-index.d.ts +1 -0
  211. package/src/runs/background/terminal-run-index.d.ts.map +1 -1
  212. package/src/runs/background/terminal-run-index.js +47 -1
  213. package/src/runs/background/terminal-run-index.js.map +1 -1
  214. package/src/runs/background/wait-tool.d.ts.map +1 -1
  215. package/src/runs/background/wait-tool.js +36 -23
  216. package/src/runs/background/wait-tool.js.map +1 -1
  217. package/src/runs/background/workflow-terminal-proof.d.ts +1 -1
  218. package/src/runs/background/workflow-terminal-proof.d.ts.map +1 -1
  219. package/src/runs/background/workflow-terminal-proof.js +12 -3
  220. package/src/runs/background/workflow-terminal-proof.js.map +1 -1
  221. package/src/runs/foreground/async-stop-action.d.ts +7 -1
  222. package/src/runs/foreground/async-stop-action.d.ts.map +1 -1
  223. package/src/runs/foreground/async-stop-action.js +27 -23
  224. package/src/runs/foreground/async-stop-action.js.map +1 -1
  225. package/src/runs/foreground/execution.d.ts.map +1 -1
  226. package/src/runs/foreground/execution.js +91 -69
  227. package/src/runs/foreground/execution.js.map +1 -1
  228. package/src/runs/foreground/subagent-executor.d.ts +4 -1
  229. package/src/runs/foreground/subagent-executor.d.ts.map +1 -1
  230. package/src/runs/foreground/subagent-executor.js +174 -79
  231. package/src/runs/foreground/subagent-executor.js.map +1 -1
  232. package/src/runs/shared/child-hooks.js +6 -5
  233. package/src/runs/shared/child-hooks.js.map +1 -1
  234. package/src/runs/shared/child-launch.d.ts +2 -0
  235. package/src/runs/shared/child-launch.d.ts.map +1 -1
  236. package/src/runs/shared/child-launch.js +1 -0
  237. package/src/runs/shared/child-launch.js.map +1 -1
  238. package/src/runs/shared/child-session.d.ts +4 -0
  239. package/src/runs/shared/child-session.d.ts.map +1 -1
  240. package/src/runs/shared/child-session.js +28 -23
  241. package/src/runs/shared/child-session.js.map +1 -1
  242. package/src/runs/shared/child-tool-plan.d.ts.map +1 -1
  243. package/src/runs/shared/child-tool-plan.js +11 -10
  244. package/src/runs/shared/child-tool-plan.js.map +1 -1
  245. package/src/runs/shared/dynamic-fanout.js +1 -1
  246. package/src/runs/shared/dynamic-fanout.js.map +1 -1
  247. package/src/runs/shared/effective-system-prompt.d.ts +4 -4
  248. package/src/runs/shared/effective-system-prompt.d.ts.map +1 -1
  249. package/src/runs/shared/effective-system-prompt.js +5 -4
  250. package/src/runs/shared/effective-system-prompt.js.map +1 -1
  251. package/src/runs/shared/external-cli-runner.d.ts.map +1 -1
  252. package/src/runs/shared/external-cli-runner.js +3 -2
  253. package/src/runs/shared/external-cli-runner.js.map +1 -1
  254. package/src/runs/shared/herdr-placed-run.d.ts +1 -0
  255. package/src/runs/shared/herdr-placed-run.d.ts.map +1 -1
  256. package/src/runs/shared/herdr-placed-run.js +10 -6
  257. package/src/runs/shared/herdr-placed-run.js.map +1 -1
  258. package/src/runs/shared/model-resolution-diagnostic.d.ts +17 -5
  259. package/src/runs/shared/model-resolution-diagnostic.d.ts.map +1 -1
  260. package/src/runs/shared/model-resolution-diagnostic.js +37 -10
  261. package/src/runs/shared/model-resolution-diagnostic.js.map +1 -1
  262. package/src/runs/shared/model-resolution.d.ts.map +1 -1
  263. package/src/runs/shared/model-resolution.js +29 -1
  264. package/src/runs/shared/model-resolution.js.map +1 -1
  265. package/src/runs/shared/nested-events.d.ts +2 -0
  266. package/src/runs/shared/nested-events.d.ts.map +1 -1
  267. package/src/runs/shared/nested-events.js +4 -0
  268. package/src/runs/shared/nested-events.js.map +1 -1
  269. package/src/runs/shared/orca-progress-tabs.js +1 -1
  270. package/src/runs/shared/orca-progress-tabs.js.map +1 -1
  271. package/src/runs/shared/parallel-handoff.js +2 -2
  272. package/src/runs/shared/parallel-handoff.js.map +1 -1
  273. package/src/runs/shared/parallel-utils.d.ts +2 -0
  274. package/src/runs/shared/parallel-utils.d.ts.map +1 -1
  275. package/src/runs/shared/parallel-utils.js.map +1 -1
  276. package/src/runs/shared/partial-output.d.ts +7 -0
  277. package/src/runs/shared/partial-output.d.ts.map +1 -1
  278. package/src/runs/shared/partial-output.js +7 -0
  279. package/src/runs/shared/partial-output.js.map +1 -1
  280. package/src/runs/shared/runner-launcher.d.ts +12 -0
  281. package/src/runs/shared/runner-launcher.d.ts.map +1 -0
  282. package/src/runs/shared/runner-launcher.js +25 -0
  283. package/src/runs/shared/runner-launcher.js.map +1 -0
  284. package/src/runs/shared/single-output.d.ts +31 -1
  285. package/src/runs/shared/single-output.d.ts.map +1 -1
  286. package/src/runs/shared/single-output.js +100 -21
  287. package/src/runs/shared/single-output.js.map +1 -1
  288. package/src/runs/shared/structured-output.d.ts +2 -0
  289. package/src/runs/shared/structured-output.d.ts.map +1 -1
  290. package/src/runs/shared/structured-output.js +26 -8
  291. package/src/runs/shared/structured-output.js.map +1 -1
  292. package/src/runs/shared/subagent-control.js +3 -3
  293. package/src/runs/shared/subagent-control.js.map +1 -1
  294. package/src/runs/shared/subagent-prompt-runtime.d.ts +37 -2
  295. package/src/runs/shared/subagent-prompt-runtime.d.ts.map +1 -1
  296. package/src/runs/shared/subagent-prompt-runtime.js +127 -20
  297. package/src/runs/shared/subagent-prompt-runtime.js.map +1 -1
  298. package/src/runs/shared/tool-budget.js +1 -1
  299. package/src/runs/shared/tool-budget.js.map +1 -1
  300. package/src/runs/shared/workflow-async-child-guidance.js +1 -1
  301. package/src/runs/shared/workflow-async-child-guidance.js.map +1 -1
  302. package/src/runs/shared/worktree-cleanup-plan.js +1 -1
  303. package/src/runs/shared/worktree-cleanup-plan.js.map +1 -1
  304. package/src/shared/atomic-json.d.ts +4 -3
  305. package/src/shared/atomic-json.d.ts.map +1 -1
  306. package/src/shared/atomic-json.js +3 -1
  307. package/src/shared/atomic-json.js.map +1 -1
  308. package/src/shared/child-transcript.js +1 -1
  309. package/src/shared/child-transcript.js.map +1 -1
  310. package/src/shared/edit-distance.d.ts +5 -0
  311. package/src/shared/edit-distance.d.ts.map +1 -0
  312. package/src/shared/edit-distance.js +33 -0
  313. package/src/shared/edit-distance.js.map +1 -0
  314. package/src/shared/extension-context.d.ts +5 -0
  315. package/src/shared/extension-context.d.ts.map +1 -1
  316. package/src/shared/extension-context.js +7 -0
  317. package/src/shared/extension-context.js.map +1 -1
  318. package/src/shared/formatters.d.ts.map +1 -1
  319. package/src/shared/formatters.js +1 -6
  320. package/src/shared/formatters.js.map +1 -1
  321. package/src/shared/model-info.d.ts +8 -0
  322. package/src/shared/model-info.d.ts.map +1 -1
  323. package/src/shared/model-info.js +22 -0
  324. package/src/shared/model-info.js.map +1 -1
  325. package/src/shared/parent-wake.d.ts +7 -1
  326. package/src/shared/parent-wake.d.ts.map +1 -1
  327. package/src/shared/parent-wake.js +36 -12
  328. package/src/shared/parent-wake.js.map +1 -1
  329. package/src/shared/pruned-fork.d.ts +1 -1
  330. package/src/shared/pruned-fork.d.ts.map +1 -1
  331. package/src/shared/pruned-fork.js +6 -0
  332. package/src/shared/pruned-fork.js.map +1 -1
  333. package/src/shared/runtime-module-path.d.ts +11 -0
  334. package/src/shared/runtime-module-path.d.ts.map +1 -0
  335. package/src/shared/runtime-module-path.js +17 -0
  336. package/src/shared/runtime-module-path.js.map +1 -0
  337. package/src/shared/types.d.ts +33 -10
  338. package/src/shared/types.d.ts.map +1 -1
  339. package/src/shared/types.js +7 -4
  340. package/src/shared/types.js.map +1 -1
  341. package/src/shared/utils.d.ts +2 -0
  342. package/src/shared/utils.d.ts.map +1 -1
  343. package/src/shared/utils.js +10 -7
  344. package/src/shared/utils.js.map +1 -1
  345. package/src/slash/slash-commands.d.ts.map +1 -1
  346. package/src/slash/slash-commands.js +21 -10
  347. package/src/slash/slash-commands.js.map +1 -1
  348. package/src/slash/subagents-admin.d.ts.map +1 -1
  349. package/src/slash/subagents-admin.js +3 -1
  350. package/src/slash/subagents-admin.js.map +1 -1
  351. package/src/tui/fleet-status.d.ts +5 -0
  352. package/src/tui/fleet-status.d.ts.map +1 -1
  353. package/src/tui/fleet-status.js +24 -3
  354. package/src/tui/fleet-status.js.map +1 -1
  355. package/src/tui/fleet-transcript.d.ts +2 -0
  356. package/src/tui/fleet-transcript.d.ts.map +1 -1
  357. package/src/tui/fleet-transcript.js +7 -2
  358. package/src/tui/fleet-transcript.js.map +1 -1
  359. package/src/tui/fleet.d.ts.map +1 -1
  360. package/src/tui/fleet.js +11 -6
  361. package/src/tui/fleet.js.map +1 -1
  362. package/src/tui/render.d.ts +2 -2
  363. package/src/tui/render.d.ts.map +1 -1
  364. package/src/tui/render.js +19 -17
  365. package/src/tui/render.js.map +1 -1
  366. package/src/tui/subagent-messages.d.ts +23 -0
  367. package/src/tui/subagent-messages.d.ts.map +1 -0
  368. package/src/tui/subagent-messages.js +270 -0
  369. package/src/tui/subagent-messages.js.map +1 -0
  370. package/src/watchdog/change-signature.d.ts.map +1 -1
  371. package/src/watchdog/change-signature.js +1 -3
  372. package/src/watchdog/change-signature.js.map +1 -1
  373. package/src/watchdog/register-main.d.ts.map +1 -1
  374. package/src/watchdog/register-main.js +1 -19
  375. package/src/watchdog/register-main.js.map +1 -1
  376. package/src/watchdog/render.d.ts +2 -10
  377. package/src/watchdog/render.d.ts.map +1 -1
  378. package/src/watchdog/render.js +1 -19
  379. package/src/watchdog/render.js.map +1 -1
  380. package/src/watchdog/tool-actions.js +2 -2
  381. package/src/watchdog/tool-actions.js.map +1 -1
  382. package/src/workflows/scripted-workflow.d.ts.map +1 -1
  383. package/src/workflows/scripted-workflow.js +33 -10
  384. package/src/workflows/scripted-workflow.js.map +1 -1
  385. package/src/workflows/workflow-resources.d.ts.map +1 -1
  386. package/src/workflows/workflow-resources.js +12 -0
  387. package/src/workflows/workflow-resources.js.map +1 -1
  388. package/src/runs/shared/run-history.d.ts +0 -67
  389. package/src/runs/shared/run-history.d.ts.map +0 -1
  390. package/src/runs/shared/run-history.js +0 -270
  391. package/src/runs/shared/run-history.js.map +0 -1
@@ -10,6 +10,8 @@ A foreground child is a pi session created inside the parent Pi process, not a s
10
10
 
11
11
  A background child is a pi session created inside the detached runner process. The runner mirrors session events into `events.jsonl`, `output-<index>.log`, and the transcript. Interrupt and stop abort the child session; steer requests are delivered with the session's `steer` or `followUp`.
12
12
 
13
+ Pressing `Esc` in the parent stops the parent turn and its foreground children. Background children keep running. Until the next parent turn starts, usually your next prompt, their results and requests are added to the session but do not start a new parent turn, and the TUI shows how many background runs are still active. Use `/subagents-stop` to stop them.
14
+
13
15
  Long-open `bash` attention notices identify the exact tool call and include status and child-specific transcript commands. Each distinct long-open call notifies once. Inspect the running command and recent output before intervening: development servers and watch commands may intentionally never return, while builds and tests may legitimately take time. A queued steer does not cancel the shell command. For local native Pi children explicitly granted `subagent_command`, `command.yield` returns control while the selected command remains managed; `command.cancel` stops that command without interrupting the child. Query `command.status` to confirm its terminal state. Unsupported children require the existing run-scoped interrupt/resume path, which may affect siblings. See [command controls](tool-reference.md#command-controls).
14
16
 
15
17
  Live progress shows compact detail for single, chain, and parallel modes: a bounded one-line task, current tool, recent output, token counts, aggregate cost, duration, activity freshness, current-tool duration, and chain graph metadata when available. Workflow `label` metadata wins over raw task text in compact multi-child cards.
@@ -29,6 +31,8 @@ subagent({ action: "status", id: "..." }) // one run
29
31
 
30
32
  Or ask naturally: "Show me the current async runs."
31
33
 
34
+ In a terminal that supports [OSC 7501](https://www.superlogical.com/rex/docs/build/program-status), each background run is also reported to the terminal as working, waiting on you, finished, or failed. See [`programStatus`](configuration.md#programstatus).
35
+
32
36
  ### Usage and cost accounting
33
37
 
34
38
  Run `/subagent-cost` for the parent session's combined parent and child token usage and cost. It includes completed async workflow children when their persisted receipts and metadata remain available. Missing child metadata is reported as unavailable when the receipt identifies that child. If the workflow receipt itself is missing, unreadable, invalid, or non-terminal, affected children can be omitted from the total without an unavailable count, so treat the result as a lower bound when run artifacts are unavailable.
@@ -46,7 +50,7 @@ async subagent worker · background
46
50
  Press configured-expand-key for live detail
47
51
  ```
48
52
 
49
- 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.
53
+ To inspect one background child in text, use `subagent({ action: "status", id: "...", options: { view: "transcript" } })`; add `index` for a specific child in a parallel or chain run.
50
54
 
51
55
  In Pi fullscreen mode with mouse dispatch, left-click
52
56
  anywhere on the async widget's header row to fold it into a live one-line status
@@ -79,6 +83,7 @@ For compact chat results with FleetView as the only live editor surface, merge t
79
83
  - `fleetView: true` retains live progress. Open `/subagents-fleet` for details instead of repeatedly requesting status just to watch progress. Pi's expand key does not expand summary results; keep `"rich"` if you want expandable inline output.
80
84
  - `asyncWidget: false` hides only the additional under-editor async widget, leaving FleetView available. This configuration reduces visible surfaces; it does not guarantee ordering relative to other extensions.
81
85
  - `asyncWidgetCollapsed: true` starts each newly mounted async widget as a one-line live status summary; click its header to expand it.
86
+ - `asyncWidgetLayout: "rows"` shows each run in the async widget as one line under a header instead of a block of detail rows; Pi's expand key still shows the details.
82
87
 
83
88
  Thanks to [DraconDev](https://github.com/DraconDev) for reporting the display noise and suggesting summary mode in [#1931](https://github.com/nicobailon/pi-subagents/issues/1931).
84
89
 
@@ -123,11 +128,11 @@ Default keys:
123
128
 
124
129
  Set `fleetKeybindings` in the extension config to replace inspector-level keys when a terminal intercepts keys such as `PgUp`, `PgDn`, `Home`, or `End`. Prompt modes keep fixed keys such as `Esc`, `Enter`, `Tab`, and stop-confirmation `Y`/`N`.
125
130
 
126
- Enter and `H` use the available Inspect plugin. On macOS with Ghostty 1.3+ (TERM_PROGRAM=ghostty), this includes the other bundled open-only plugin using Ghostty's preview AppleScript API; status and close are unavailable because no binding is written. In a child-specific inspector, type ordinary guidance and press Enter to send it through the acknowledged steer channel; `steer <message>`, `status`, and `stop` remain available as explicit controls. The bundled Herdr plugin uses Herdr 0.7.5+.
131
+ Enter and `H` use the available Inspect plugin. Inside tmux, this includes the bundled tmux plugin: it splits the focused window, runs the inspector pane there, and records a binding, so `status` and `close` are available and ordinary tmux keys such as the prefix keep working in the pane. On macOS with Ghostty 1.3+ (TERM_PROGRAM=ghostty), this includes the other bundled open-only plugin using Ghostty's preview AppleScript API; status and close are unavailable because no binding is written. In a child-specific inspector, type ordinary guidance and press Enter to send it through the acknowledged steer channel; `steer <message>`, `status`, and `stop` remain available as explicit controls. The bundled Herdr plugin uses Herdr 0.7.5+.
127
132
 
128
- 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.
133
+ Without a TUI, `/subagents-fleet` retains the textual `subagent({ action: "status", options: { 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.
129
134
 
130
- 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.
135
+ 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. A detached foreground child runs inside the current pi-subagents runtime. When `/reload`, a session resume, or a session switch replaces that runtime, the child is stopped, and `status` then shows it as stopped with the reason. `resume` continues it from its session.
131
136
 
132
137
  Set `foregroundDetachShortcut` in `~/.pi/agent/extensions/subagent/config.json` to bind the same action to a shortcut. The running foreground card shows the configured shortcut beside its live-detail hint:
133
138
 
@@ -295,7 +300,7 @@ Debug artifacts live under `{sessionDir}/subagent-artifacts/`, `.pi/subagents/ar
295
300
  - `{runId}_{agent}.jsonl`
296
301
  - `{runId}_{agent}_meta.json`
297
302
 
298
- Metadata records timing, usage, exit code, the resolved model, and the resolved acceptance ledger with its parsed child report. A strictly guarded retained-session recovery after a verified compaction abort may continue once on that same model; it never selects another model.
303
+ Metadata records the parent session id, timing, usage, exit code, the resolved model, and the resolved acceptance ledger with its parsed child report. A strictly guarded retained-session recovery after a verified compaction abort may continue once on that same model; it never selects another model.
299
304
 
300
305
  For npm package projects, project-scoped artifacts need a `.npmignore` rule (or `.gitignore` when no `.npmignore` exists) or a `files` allowlist that does not include `.pi/subagents/`. pi-subagents warns at launch when these package settings can include the artifacts. Use `artifactDir: "session"` or `"temp"` to keep them outside the package worktree.
301
306
 
@@ -303,6 +308,8 @@ For npm package projects, project-scoped artifacts need a `.npmignore` rule (or
303
308
 
304
309
  Session files are stored under a per-run session directory. With `context: "fork"`, each child starts from a branched session file produced from the parent's current leaf (foreground children open it in-process; background children receive it as `--session`). That is a real session fork, not an injected summary. An omitted launch `context` that resolves through `defaultContext: fork` uses the same branch when the parent session file and current leaf exist, and otherwise starts fresh.
305
310
 
311
+ A child session's header records the launching session's file as `parentSession`, the field Pi uses for its own forks, so a reader can find the parent session without parsing the directory layout. A nested child points at the session of the child that launched it. Run metadata (`{runId}_{agent}_meta.json`) also records `parentSessionId`, the launching session's id.
312
+
306
313
  ## Completion notifications
307
314
 
308
315
  Async completions belong only to the originating session. The result watcher emits `subagent:async-complete` for detached runs. Awaited workflow children emit it when they settle, with `awaitedByWorkflow: true`, `parentWorkflowRunId`, and `triggerTurn: false`. They do not send a separate child notification or turn.
@@ -4,7 +4,7 @@ Parameters and actions for the `subagent` tool. These are what the LLM passes wh
4
4
 
5
5
  In a fresh parent session, `subagents_enable({})` makes the full `subagent` tool available on the immediately following model request without launching work. Pi may call it when delegation is authorized by the current request or applicable instructions, or to manage existing runs. Direct execution remains the default; task complexity does not grant delegation authority. The public `subagent` name and parameters are unchanged after activation.
6
6
 
7
- Call `{ action: "guide", topic: "tool-reference" }` for this reference or `topic: "workflows"` for [workflow recipes](workflows.md). Use `topic: "agents"` for authoring, `topic: "missions"` for missions/schedules, and `topic: "watchdog"` for watchdog controls. Guide reads do not change the schema or grant authority.
7
+ Call `{ action: "guide", options: { topic: "tool-reference" } }` for this reference or `options: { topic: "workflows" }` for [workflow recipes](workflows.md). Use `topic: "agents"` for authoring, `topic: "missions"` for missions/schedules, and `topic: "watchdog"` for watchdog controls, always inside `options`. Guide reads do not change the schema or grant authority.
8
8
 
9
9
  ## Execution examples
10
10
 
@@ -30,7 +30,7 @@ The host resolves the script and authority internally and records bounded proven
30
30
  ```js
31
31
  { workflow: "./workflows/review.js", args: { target: "src/workflows" }, cwd: "/path/to/project" }
32
32
  { action: "validate", workflow: "./workflows/review.js", args: { target: "src/workflows" } }
33
- { action: "schedule.create", every: "6h", workflow: "./workflows/review.js", args: { target: "src/workflows" } }
33
+ { action: "schedule.create", workflow: "./workflows/review.js", args: { target: "src/workflows" }, options: { every: "6h" } }
34
34
  ```
35
35
 
36
36
  Each script below is the ```` ```js workflow ```` block of a reply that then calls `subagent({ workflow: true })`:
@@ -67,49 +67,59 @@ The complete plain-JSON inventory is validated before the first launch (maximum
67
67
 
68
68
  ## Parameter reference
69
69
 
70
+ The `subagent` tool schema lists `agent`, `task`, `workflow`, `args`, `async`, `model`, `cwd`, `worktree`, `output`, `action`, `id` and `message` at the top level and every other field inside `options`, for example `subagent({ action: "status", id: "<run-id>", options: { view: "transcript" } })`. Management fields and the `runId`, `maxRuntimeMs` and `isolation` aliases also keep working at the top level, as in RPC payloads, slash commands, schedules and workflow `runs.run`/`runs.all` items; a field given in both places with different values is rejected.
71
+
72
+ ### Target and management parameters
73
+
70
74
  | Param | Type | Default | Description |
71
75
  |-------|------|---------|-------------|
76
+ | `options` | object | - | Management and control fields; the rows named `options.<name>` below go here. Unknown keys are rejected with the closest valid option. The same fields are also accepted at the top level. |
72
77
  | `agent` | string | - | One direct child or agent-management target. Workflow child agents are set inside `runs.run` or `runs.all`. |
73
78
  | `task` | string | agent default | Direct child's task; requires `agent`, excludes `action` and workflow inputs. `agent` may also select a management target. |
74
79
  | `action` | string | - | Offline workflow `validate`, agent management (including `guide`, `children.list`, and `refine`/`refine.show`/`refine.rollback`), lane evidence (`lane.status`, `lane.recordMerge`, `lane.recordSupersession`), mission (`mission.create/list/show/update/resolve-decision/attach-run/close`), Inspect actions (`inspector.command/open/status/close`), Herdr project pane (`project.open/status/close`), status/control, reviewed `worktree.cleanup`, schedule, watchdog, or doctor action. |
75
- | `topic` | `overview \| workflows \| agents \| missions \| observability \| tool-reference \| configuration \| models \| watchdog \| extension-api \| council` | `overview` | Packaged guide topic for `action: "guide"`. |
76
- | `config` | object/string | - | Agent config for management create/update. |
77
- | `context` | `fresh \| fork \| profile` | global or per-agent default, else `fresh` | Explicit `fresh` or `fork` overrides every workflow child. `profile` requires the selected agent's declared `defaultContext` and ignores config `defaultSubagentContext`; missing agent defaults fail. When omitted, [`defaultSubagentContext`](configuration.md#defaultsubagentcontext) wins over each agent's `defaultContext`; implicit fork falls back to fresh without a persisted parent session and leaf. Explicit fork is strict. Packaged `worker` defaults to `fresh`; packaged `oracle` and `advisor` default to `fork`. |
78
- | `model` | string | agent default | Call `{action:"models"}` first and copy an exact `provider/id`; bare ids resolve only if unique, and agent names are not model ids. A suffix such as `provider/id:high` (`off/minimal/low/medium/high/xhigh/max`) overrides agent thinking. The `thinking` field is only for `watchdog.configure`, ignored on dispatch. On the `claude-code` and `claude-code-writer` adapters the model is Claude Code's own alias or id, and the same suffix becomes its `--effort`, bounded by `subagents.maxThinking` and by an enforced `subagents.modelScope`. |
79
- | `missionId` | string | - | Attach a workflow, including each fire of `schedule.create`, to an existing project mission. Scheduled attachment uses ordinary lifecycle and retention rules. |
80
- | `mission` | object/false | auto-create | Override the default enclosing mission with `{ title \| summary, objective?, goal?, budget?, labels? }`. Set exactly one non-empty `title` or `summary`; `objective` and `labels` are optional. `goal` may only be `true`, requires `budget.tokens`, and enables continuation notices. Pass `false` for an intentionally ephemeral workflow with no mission for it or its children and no `state` global. Explicit mission persistence failures are strict. |
81
- | `handoffPath` | string | - | Aggregate handoff manifest for `action: "worktree.discard"` or lane evidence actions, or optional explicit metadata for `action: "worktree.cleanup"`. |
82
- | `repo` | string | runtime cwd | Repository path for `action: "worktree.cleanup"`; required explicitly for apply. The configured worktree base filters candidates by their per-project folder under it but never discovers them. |
83
- | `planId` | string | - | Saved, reviewed cleanup plan ID; required for apply, rejected in plan mode. |
84
- | `mode` | `steer \| follow_up \| auto \| plan \| apply` | - | Delivery mode for `action: "steer"`; `worktree.cleanup` accepts `plan` or `apply`; apply requires an explicit repository and saved plan ID. |
85
- | `laneId` | string | - | Exact `runId` stored in the handoff manifest for `lane.status`, `lane.recordMerge`, or `lane.recordSupersession`. |
86
- | `merge` | object | - | Attested merge evidence for `lane.recordMerge`; requires a positive PR number, full reviewed/merge SHAs, tree-equivalence and post-merge-check statuses, attestor, and timestamp. |
87
- | `supersession` | object | - | Attested replacement-lane evidence for `lane.recordSupersession`; requires a different replacement lane id, attestor, and timestamp. |
88
- | `focus` | boolean | false | Focus the newly split host inspector pane for `action: "inspector.open"` or the new Herdr project pane for `action: "project.open"`; not a standalone action. `inspector.command` is read-only and does not contact Herdr or write a binding. Panes open in the background unless you set `focus: true`. Existing saved project panes can be focused through the public project-pane API when Herdr reports a tab or workspace id. |
89
- | `view` | `fleet \| transcript` | - | Optional `status` view for the active fleet surface or transcript tail inspection. |
90
- | `lines` | number | `80` | Maximum transcript lines for `action: "status", view: "transcript"`; capped at 500. |
91
- | `agentScope` | `user \| project \| both` | `both` | Agent discovery scope. Project wins on collisions. |
92
- | `capabilities` | boolean | `false` | With `action: "list"`, return compact prompt-free rows and `details.agentCapabilities` machine-readable records for each agent's declared/default routing capabilities. External CLI rows also include their command and passive local availability. |
80
+ | `options.topic` | `overview \| workflows \| agents \| missions \| observability \| tool-reference \| configuration \| models \| watchdog \| extension-api \| council`, or `<topic>/<section>` | `overview` | Packaged guide topic for `action: "guide"`. A docs topic returns its table of contents; `<topic>/<section>` returns one section. |
81
+ | `options.config` | object/string | - | Agent config for management create/update. |
82
+ | `options.context` | `fresh \| fork \| profile` | global or per-agent default, else `fresh` | Explicit `fresh` or `fork` overrides every workflow child. `profile` requires the selected agent's declared `defaultContext` and ignores config `defaultSubagentContext`; missing agent defaults fail. When omitted, [`defaultSubagentContext`](configuration.md#defaultsubagentcontext) wins over each agent's `defaultContext`; implicit fork falls back to fresh without a persisted parent session and leaf. Explicit fork is strict. Packaged `worker` defaults to `fresh`; packaged `oracle` and `advisor` default to `fork`. |
83
+ | `model` | string | agent default | An exact `provider/id`; bare ids resolve only if unique, and agent names are not model ids. An unknown or ambiguous model fails with up to 5 closest registry ids to copy; `{action:"models"}` lists them all. A suffix such as `provider/id:high` (`off/minimal/low/medium/high/xhigh/max`) overrides agent thinking. The `thinking` field is only for `watchdog.configure`, ignored on dispatch. On the `claude-code` and `claude-code-writer` adapters the model is Claude Code's own alias or id, and the same suffix becomes its `--effort`, bounded by `subagents.maxThinking` and by an enforced `subagents.modelScope`. |
84
+ | `options.missionId` | string | - | Attach a workflow, including each fire of `schedule.create`, to an existing project mission. Scheduled attachment uses ordinary lifecycle and retention rules. |
85
+ | `options.mission` | object/false | auto-create | Override the default enclosing mission with `{ title \| summary, objective?, goal?, budget?, labels? }`. Set exactly one non-empty `title` or `summary`; `objective` and `labels` are optional. `goal` may only be `true`, requires `budget.tokens`, and enables continuation notices. Pass `false` for an intentionally ephemeral workflow with no mission for it or its children and no `state` global. Explicit mission persistence failures are strict. |
86
+ | `options.handoffPath` | string | - | Aggregate handoff manifest for `action: "worktree.discard"` or lane evidence actions, or optional explicit metadata for `action: "worktree.cleanup"`. |
87
+ | `options.repo` | string | runtime cwd | Repository path for `action: "worktree.cleanup"`; required explicitly for apply. The configured worktree base filters candidates by their per-project folder under it but never discovers them. |
88
+ | `options.planId` | string | - | Saved, reviewed cleanup plan ID; required for apply, rejected in plan mode. |
89
+ | `options.mode` | `steer \| follow_up \| auto \| plan \| apply` | - | Delivery mode for `action: "steer"`; `worktree.cleanup` accepts `plan` or `apply`; apply requires an explicit repository and saved plan ID. |
90
+ | `options.laneId` | string | - | Exact `runId` stored in the handoff manifest for `lane.status`, `lane.recordMerge`, or `lane.recordSupersession`. |
91
+ | `options.merge` | object | - | Attested merge evidence for `lane.recordMerge`; requires a positive PR number, full reviewed/merge SHAs, tree-equivalence and post-merge-check statuses, attestor, and timestamp. |
92
+ | `options.supersession` | object | - | Attested replacement-lane evidence for `lane.recordSupersession`; requires a different replacement lane id, attestor, and timestamp. |
93
+ | `options.focus` | boolean | false | Focus the newly split host inspector pane for `action: "inspector.open"` or the new Herdr project pane for `action: "project.open"`; not a standalone action. `inspector.command` is read-only and does not contact Herdr or write a binding. Panes open in the background unless you set `focus: true`. Existing saved project panes can be focused through the public project-pane API when Herdr reports a tab or workspace id. |
94
+ | `options.view` | `fleet \| transcript` | - | Optional `status` view for the active fleet surface or transcript tail inspection. |
95
+ | `options.lines` | number | `80` | Maximum transcript lines for `action: "status"` with `options.view: "transcript"`; capped at 500. |
96
+ | `options.agentScope` | `user \| project \| both` | `both` | Agent discovery scope. Project wins on collisions. |
97
+ | `options.capabilities` | boolean | `false` | With `action: "list"`, return compact prompt-free rows and `details.agentCapabilities` machine-readable records for each agent's declared/default routing capabilities. External CLI rows also include their command and passive local availability. |
98
+
99
+ ### Execution parameters
100
+
101
+ | Param | Type | Default | Description |
102
+ |-------|------|---------|-------------|
93
103
  | `async` | boolean | default-on | Background execution. Workflows default to background. `async:false` blocks the parent until completion. A local foreground child runs inside the parent Pi process and never loads the parent's ambient extensions, but it does inherit the providers those extensions registered. A pane-native remote foreground child instead uses the remote machine's provider discovery and configuration. Agents that need MCP tools (`mcpDirectTools`, or MCP tools from an ambient adapter such as pi-mcp-adapter) must run as background children, which load them inside the detached runner process. |
94
- | `chatProgress` | `auto \| off \| live-card` | `auto` | Workflow chat projection. `auto` renders a live in-chat card only for watched foreground workflows in the same Git repository, including managed worktrees; it is off otherwise. Explicit `live-card` requires `async:false` and the same Git repository. Async workflows have no inline live card, so omit `chatProgress` or use `auto`/`off`; use `async:false` only when the parent must block. |
95
- | `isolation` | `none \| worktree` | - | Workflow child isolation. `none` runs in the shared cwd and does not need Git. `worktree` requires a managed Git worktree. Do not combine it with a contradictory `worktree` value. |
96
- | `baseRef` | string | `HEAD` | `HEAD` or a supported named ref such as `refs/heads/release`, `refs/tags/v1`, or `origin/main`. Full 40/64-character commit IDs and revision expressions such as `HEAD~1` are unsupported. The ref must resolve to a commit at worktree allocation; omitted values default to `HEAD` resolved at that time. Source-checkout cleanliness is still checked. For a workflow script, set it on the outer request as a default or on an individual `runs.run`/`runs.all` child to override it. |
97
- | `timeoutMs` / `maxRuntimeMs` | number | config `timeoutMs`, else 30 min foreground / single-agent async | Optional run-level max runtime in milliseconds. Both aliases may be supplied only when their values agree. When omitted, the global [`timeoutMs`](configuration.md#timeoutms) config provides the default; absent that, foreground and plain single-agent async runs fall back to 30 minutes, while composite async runs (chains, parallel tasks, workflows) stay unbounded at the top level. Expiration of this run-level deadline is terminal. |
98
- | `toolTimeoutMs` | number | fast-tool default | Optional positive hard per-tool-call deadline in milliseconds. Precedence: call value → agent frontmatter → config → `PI_SUBAGENT_TOOL_TIMEOUT_MS`. The timer starts on `tool_execution_start`, clears on the matching `tool_execution_end`, and terminates the run with `timedOut: true` if the tool remains open. When omitted, known-fast built-in tools get a five-minute default; long-running tools get attention notices but no hard default. It never extends the run deadline; `contact_supervisor`, `intercom`, and `bg_wait` are exempt. |
99
- | `checkpointBeforeDeadlineMs` | number | none | Async single-agent runs only. The runner requests that the child "checkpoint and stop" this many milliseconds before the run deadline (finish the current tool call, report changed files, build/test state, remaining work, commit/PR state; start no new work). This best-effort steer uses the normal steering lifecycle at the next tool boundary, so the receipt is visible in status and events; the ordinary deadline kill still applies. Precedence: call value → config `checkpointBeforeDeadlineMs`. Disarmed when the deadline leaves under one second before the checkpoint. |
100
- | `toolBudget` | object | none | Optional child tool-call budget `{ soft?, hard, block? }`: `hard` is a positive integer and `soft`, if set, is a positive integer no greater than `hard`. At `soft` the child is nudged to finalize. After `hard`, configured tools are blocked; `block` defaults to `read`, `grep`, `find`, and `ls`, and accepts either a nonempty array of tool names or `"*"` for every tool call. Final assistant text is never blocked. |
101
- | `usageBudget` | object | none | Optional root-only reported-usage budget `{ tokens?: { soft?, hard }, costUsd?: { soft?, hard } }`. Include at least one metric; each `hard` must be positive and each optional `soft` positive and no greater than its `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. |
102
- | `extensionBindings` | object | none | Child-only plain JSON keyed by namespaces like `package.name/1` (positive version): at most 16 namespaces, nesting depth 16, 256 total object properties, and 16 KiB of canonical UTF-8 JSON. Native Pi launches only; external runners and retained resumes reject it. |
103
- | `preflight` | object | none | Advisory lane hints for raw scripts (`workflow: true` or a script path) only; not accepted with named workflows or direct children. See [bounded workflows](workflows.md#opt-in-bounded-workflows). |
104
+ | `options.chatProgress` | `auto \| off \| live-card` | `auto` | Workflow chat projection. `auto` renders a live in-chat card only for watched foreground workflows in the same Git repository, including managed worktrees; it is off otherwise. Explicit `live-card` requires `async:false` and the same Git repository. Async workflows have no inline live card, so omit `chatProgress` or use `auto`/`off`; use `async:false` only when the parent must block. |
105
+ | `isolation` | `none \| worktree` | - | Alias kept at the top level; prefer `worktree`. Workflow child isolation. `none` runs in the shared cwd and does not need Git. `worktree` requires a managed Git worktree. Do not combine it with a contradictory `worktree` value. |
106
+ | `options.baseRef` | string | `HEAD` | `HEAD` or a supported named ref such as `refs/heads/release`, `refs/tags/v1`, or `origin/main`. Full 40/64-character commit IDs and revision expressions such as `HEAD~1` are unsupported. The ref must resolve to a commit at worktree allocation; omitted values default to `HEAD` resolved at that time. Source-checkout cleanliness is still checked. For a workflow script, set it on the outer request as a default or on an individual `runs.run`/`runs.all` child to override it. |
107
+ | `options.timeoutMs` | number | config `timeoutMs`, else 30 min foreground / single-agent async | Optional run-level max runtime in milliseconds. The top-level alias `maxRuntimeMs` is also accepted; both must agree. When omitted, the global [`timeoutMs`](configuration.md#timeoutms) config provides the default; absent that, foreground and plain single-agent async runs fall back to 30 minutes, while composite async runs (chains, parallel tasks, workflows) stay unbounded at the top level. Expiration of this run-level deadline is terminal. |
108
+ | `options.toolTimeoutMs` | number | fast-tool default | Optional positive hard per-tool-call deadline in milliseconds. Precedence: call value → agent frontmatter → config → `PI_SUBAGENT_TOOL_TIMEOUT_MS`. The timer starts on `tool_execution_start`, clears on the matching `tool_execution_end`, and terminates the run with `timedOut: true` if the tool remains open. When omitted, known-fast built-in tools get a five-minute default; long-running tools get attention notices but no hard default. It never extends the run deadline; `contact_supervisor`, `intercom`, and `bg_wait` are exempt. |
109
+ | `options.checkpointBeforeDeadlineMs` | number | none | Async single-agent runs only. The runner requests that the child "checkpoint and stop" this many milliseconds before the run deadline (finish the current tool call, report changed files, build/test state, remaining work, commit/PR state; start no new work). This best-effort steer uses the normal steering lifecycle at the next tool boundary, so the receipt is visible in status and events; the ordinary deadline kill still applies. Precedence: call value → config `checkpointBeforeDeadlineMs`. Disarmed when the deadline leaves under one second before the checkpoint. |
110
+ | `options.toolBudget` | object | none | Optional child tool-call budget `{ soft?, hard, block? }`: `hard` is a positive integer and `soft`, if set, is a positive integer no greater than `hard`. At `soft` the child is nudged to finalize. After `hard`, configured tools are blocked; `block` defaults to `read`, `grep`, `find`, and `ls`, and accepts either a nonempty array of tool names or `"*"` for every tool call. Final assistant text is never blocked. |
111
+ | `options.usageBudget` | object | none | Optional root-only reported-usage budget `{ tokens?: { soft?, hard }, costUsd?: { soft?, hard } }`. Include at least one metric; each `hard` must be positive and each optional `soft` positive and no greater than its `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. |
112
+ | `options.extensionBindings` | object | none | Child-only plain JSON keyed by namespaces like `package.name/1` (positive version): at most 16 namespaces, nesting depth 16, 256 total object properties, and 16 KiB of canonical UTF-8 JSON. Native Pi launches only; external runners and retained resumes reject it. |
113
+ | `options.preflight` | object | none | Advisory lane hints for raw scripts (`workflow: true` or a script path) only; not accepted with named workflows or direct children. See [bounded workflows](workflows.md#opt-in-bounded-workflows). |
104
114
  | `cwd` | string | runtime cwd | Override working directory. With `machine`, the directory on that machine. |
105
- | `machine` | string | - | Herdr saved machine (label or profile id) for external-cli agents; see [agents.md](agents.md#running-external-cli-agents-on-a-herdr-saved-machine). |
106
- | `maxOutput` | object | none | Final output truncation limits `{ bytes?, lines? }`. For child runs it is only applied when set; there is no default cap on the inline path, so use `outputMode: "file-only"` for large outputs. For workflow script results, the Return, Emitted, and Console sections are always capped, at 200 KB / 5000 lines unless `maxOutput` sets other limits. |
107
- | `artifacts` | boolean | true | Write debug artifacts. |
108
- | `includeProgress` | boolean | false | Include full progress in result. |
109
- | `share` | boolean | false | Upload session export to GitHub Gist. |
110
- | `sessionDir` | string | derived | Override session log directory. |
111
- | `acceptance` | string/object/false | inferred | Configure evidence gates. See [Acceptance gates](#acceptance-gates). |
112
- | `gate` | string \| object | - | One host-run verification command, shorthand for `acceptance: { level: "verified", verify: [{ id: "gate", command }] }`. The object form `{ command, output?: "json", schema?, timeoutMs? }` adds a [typed gate](#typed-gates): with `output: "json"`, a passing command's stdout becomes the child's `structuredOutput`. Also valid on individual `runs.run`/`runs.all` items. Rejects `acceptance` except `false` (treated as omitted), rejects retained `resume`, and `output: "json"` rejects `outputSchema`. |
115
+ | `options.machine` | string | - | Herdr saved machine (label or profile id) for external-cli agents; see [agents.md](agents.md#running-external-cli-agents-on-a-herdr-saved-machine). |
116
+ | `options.maxOutput` | object | none | Final output truncation limits `{ bytes?, lines? }`. For child runs it is only applied when set; there is no default cap on the inline path, so use `outputMode: "file-only"` for large outputs. For workflow script results, the Return, Emitted, and Console sections are always capped, at 200 KB / 5000 lines unless `maxOutput` sets other limits. |
117
+ | `options.artifacts` | boolean | true | Write debug artifacts. |
118
+ | `options.includeProgress` | boolean | false | Include full progress in result. |
119
+ | `options.share` | boolean | false | Upload session export to GitHub Gist. |
120
+ | `options.sessionDir` | string | derived | Override session log directory. |
121
+ | `options.acceptance` | string/object/false | inferred | Configure evidence gates. See [Acceptance gates](#acceptance-gates). |
122
+ | `options.gate` | string \| object | - | One host-run verification command, shorthand for `acceptance: { level: "verified", verify: [{ id: "gate", command }] }`. The object form `{ command, output?: "json", schema?, timeoutMs? }` adds a [typed gate](#typed-gates): with `output: "json"`, a passing command's stdout becomes the child's `structuredOutput`. Also valid on individual `runs.run`/`runs.all` items. Rejects `acceptance` except `false` (treated as omitted), rejects retained `resume`, and `output: "json"` rejects `outputSchema`. |
113
123
 
114
124
  ### Budget guidance for writers
115
125
 
@@ -171,7 +181,7 @@ return writer;
171
181
 
172
182
  Each workflow key identifies one result lane. Use a new stable workflow key for every distinct retained resume pass; same-key calls are reused only when launch parameters are identical, and incompatible parameters are rejected.
173
183
 
174
- Inside a workflow script, `await runs.run(key, { resume, task })` waits for the revived child to finish and returns its completed output and new `runId`. Each resume can return a new retained run id, so loops must continue from the latest returned `runId`. Top-level `{ action: "resume" }` remains detached and returns a background-run receipt. When it revives a failed async workflow child (or a failed revival of one), the revived run becomes that key's latest run: workflow `status` adds `Revived → <run>: <state>` under the key, and keyed `resume: { workflowRunId, key, latest: true }` continues from it with lineage `[original, revived, ...]`. If the workflow was still running, the receipt it writes when it ends adds the revived runs to the key's lineage, and its completion notice keeps the child's failed result with the same `Revived →` line. The workflow's return value and state are not changed, notices already delivered are not rewritten, and a key accepts at most 16 chained revivals. Reviving a completed, paused, or stopped child does not change its key.
184
+ Inside a workflow script, `await runs.run(key, { resume, task })` waits for the revived child to finish and returns its completed output and new `runId`. Each resume can return a new retained run id, so loops must continue from the latest returned `runId`. Without its own `output`, a workflow resume of a run that saved a report writes to `<key>.md` in the workflow's output directory (or `<name>.<key><ext>` next to the workflow's `output`), never over the resumed run's report, whether that run belongs to this workflow or not. If that name is the resumed run's own report, as when rerunning the same workflow and key, the first 8 characters of the workflow run id are added before the extension, so read the returned `savedOutputPath` instead of building the name. Top-level `{ action: "resume" }` remains detached and returns a background-run receipt. Without its own `output`, it saves the revived report next to the original run's saved output as `<name>.<first 8 characters of the revived run id><ext>`, so the earlier report is kept; pass `output` to choose the path. When it revives a failed async workflow child (or a failed revival of one), the revived run becomes that key's latest run: workflow `status` adds `Revived → <run>: <state>` under the key, and keyed `resume: { workflowRunId, key, latest: true }` continues from it with lineage `[original, revived, ...]`. If the workflow was still running, the receipt it writes when it ends adds the revived runs to the key's lineage, and its completion notice keeps the child's failed result with the same `Revived →` line. The workflow's return value and state are not changed, notices already delivered are not rewritten, and a key accepts at most 16 chained revivals. Reviving a completed, paused, or stopped child does not change its key.
175
185
 
176
186
  For a simple implementation challenge outside a workflow script, send the challenge through `subagent({ action: "resume", id: "<retained-writer-run>", message: "Reconsider the implementation and make any better current-scope change." })` when `children.list` reports that retained writer as `resumable`, or attempt it after exact-id status inspection identifies a known direct-child candidate. Status is advisory; resume authoritatively checks eligibility and may reject missing recovery requirements. If there is no known candidate or resume rejects eligibility, start a same-role fallback challenge and record why it is a fallback. Use workflow `runs.run({ resume })` only when the script must await the revived writer output before the next step. Do not use `steer` as the sole challenge action for a completed retained child; `steer` with `mode: "follow_up"` only queues text for the next `resume`.
177
187
 
@@ -181,20 +191,20 @@ For a simple implementation challenge outside a workflow script, send the challe
181
191
 
182
192
  ### Guide
183
193
 
184
- `{ action: "guide" }` reads the packaged `README.md` from the installed version. Pass `topic` to read its packaged `docs/<topic>.md` file instead; see the `topic` parameter table for valid values. The `council` topic returns the packaged `skills/council-mode/SKILL.md` with the references it asks for, so `/council` works when Pi runs with `--no-skills`. Unknown topics list the valid values and do not change files. Use `/subagents-guide [topic]` for the slash equivalent.
194
+ `{ action: "guide" }` reads the packaged `README.md` from the installed version. Pass a docs topic to get the intro of its packaged `docs/<topic>.md` and a table of section addresses, then pass `topic: "<topic>/<section>"` (for example `"tool-reference/acceptance-gates"`) to read one section. A section runs from its heading to the next heading at the same or a higher level, and no response is longer than 8,000 characters: a larger section returns its intro and its subsection addresses. The `council` topic returns the packaged `skills/council-mode/SKILL.md` with the references it asks for, so `/council` works when Pi runs with `--no-skills`. Unknown topics list the valid values, unknown sections list the topic's table of contents, and neither changes files. Use `/subagents-guide [topic]` for the slash equivalent.
185
195
 
186
196
  Agent definitions are not loaded into context by default. Management actions let the LLM discover, inspect, create, update, and delete agents at runtime. An unknown action returns safe next steps (`status` and `list`) and may suggest a close non-destructive action. Destructive actions are only named for a near-complete one-character typo, and suggestions never execute an action.
187
197
 
188
198
  ```ts
189
199
  { action: "list" }
190
- { action: "list", agentScope: "project" }
191
- { action: "list", capabilities: true }
200
+ { action: "list", options: { agentScope: "project" } }
201
+ { action: "list", options: { capabilities: true } }
192
202
  { action: "get", agent: "scout" }
193
203
  { action: "models" }
194
204
  { action: "models", agent: "reviewer" }
195
205
  { action: "get", agent: "code-analysis.scout" }
196
206
 
197
- { action: "create", config: {
207
+ { action: "create", options: { config: {
198
208
  name: "Code Scout",
199
209
  package: "code-analysis",
200
210
  description: "Scans codebases for patterns and issues",
@@ -214,24 +224,24 @@ Agent definitions are not loaded into context by default. Management actions let
214
224
  output: "context.md",
215
225
  reads: "shared-context.md",
216
226
  progress: true
217
- }}
227
+ }}}
218
228
 
219
229
 
220
- { action: "update", agent: "code-analysis.scout", config: { model: "openai/gpt-4o" } }
221
- { action: "update", agent: "code-analysis.scout", config: { acceptance: "" } } // clear the frontmatter default
222
- { action: "update", agent: "code-analysis.scout", config: { acceptanceRole: false } } // restore default lightweight attestation
230
+ { action: "update", agent: "code-analysis.scout", options: { config: { model: "openai/gpt-4o" } } }
231
+ { action: "update", agent: "code-analysis.scout", options: { config: { acceptance: "" } } } // clear the frontmatter default
232
+ { action: "update", agent: "code-analysis.scout", options: { config: { acceptanceRole: false } } } // restore default lightweight attestation
223
233
  { action: "delete", agent: "scout" }
224
234
 
225
235
  { action: "eject", agent: "reviewer" }
226
- { action: "eject", agent: "reviewer", agentScope: "project" }
236
+ { action: "eject", agent: "reviewer", options: { agentScope: "project" } }
227
237
  { action: "disable", agent: "reviewer" }
228
- { action: "enable", agent: "reviewer", agentScope: "project" }
238
+ { action: "enable", agent: "reviewer", options: { agentScope: "project" } }
229
239
  { action: "reset", agent: "reviewer" }
230
240
  ```
231
241
 
232
242
  Rules:
233
243
 
234
- - `capabilities: true` changes `action: "list"` to compact one-line rows and adds `details.agentCapabilities: { agents, restrictedCount, capabilityCeilingSources? }`. Each agent row includes source, aliases, runner type/capabilities, tools, MCP direct tools, mutation tools, model/thinking, default async/timeout, declared acceptance policy/role, output path/mode, skills/extensions, and whether the current capability ceiling allows execution. External CLI rows include `runner.command`, `runner.available`, and a bounded `runner.unavailableReason` when passive PATH/PATHEXT/X_OK lookup cannot find the command. It never includes an agent's system prompt. Rows show declared/default capabilities and command discoverability, not authentication, version compatibility, or successful launch; launch preflight remains authoritative.
244
+ - `options.capabilities: true` changes `action: "list"` to compact one-line rows and adds `details.agentCapabilities: { agents, restrictedCount, capabilityCeilingSources? }`. Each agent row includes source, aliases, runner type/capabilities, tools, MCP direct tools, mutation tools, model/thinking, default async/timeout, declared acceptance policy/role, output path/mode, skills/extensions, and whether the current capability ceiling allows execution. External CLI rows include `runner.command`, `runner.available`, and a bounded `runner.unavailableReason` when passive PATH/PATHEXT/X_OK lookup cannot find the command. It never includes an agent's system prompt. Rows show declared/default capabilities and command discoverability, not authentication, version compatibility, or successful launch; launch preflight remains authoritative.
235
245
  - `create` uses `config.scope`, not `agentScope`.
236
246
  - `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.
237
247
  - `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`.
@@ -255,29 +265,33 @@ Lane evidence actions update an existing parallel handoff manifest at an explici
255
265
  ```ts
256
266
  subagent({
257
267
  action: "lane.recordMerge",
258
- laneId: "<manifest-run-id>",
259
- handoffPath: "/path/to/handoff.json",
260
- merge: {
261
- prNumber: 123,
262
- reviewedHead: "<40-character-sha>",
263
- mergeCommit: "<40-character-sha>",
264
- treeEquivalent: true,
265
- postMergeChecks: "recorded",
266
- attestedBy: "operator",
267
- attestedAt: "2026-08-27T16:23:00.000Z"
268
+ options: {
269
+ laneId: "<manifest-run-id>",
270
+ handoffPath: "/path/to/handoff.json",
271
+ merge: {
272
+ prNumber: 123,
273
+ reviewedHead: "<40-character-sha>",
274
+ mergeCommit: "<40-character-sha>",
275
+ treeEquivalent: true,
276
+ postMergeChecks: "recorded",
277
+ attestedBy: "operator",
278
+ attestedAt: "2026-08-27T16:23:00.000Z"
279
+ }
268
280
  }
269
281
  })
270
282
  subagent({
271
283
  action: "lane.recordSupersession",
272
- laneId: "<manifest-run-id>",
273
- handoffPath: "/path/to/handoff.json",
274
- supersession: {
275
- supersededBy: "<replacement-lane-id>",
276
- attestedBy: "operator",
277
- attestedAt: "2026-08-27T16:23:00.000Z"
284
+ options: {
285
+ laneId: "<manifest-run-id>",
286
+ handoffPath: "/path/to/handoff.json",
287
+ supersession: {
288
+ supersededBy: "<replacement-lane-id>",
289
+ attestedBy: "operator",
290
+ attestedAt: "2026-08-27T16:23:00.000Z"
291
+ }
278
292
  }
279
293
  })
280
- subagent({ action: "lane.status", laneId: "<manifest-run-id>", handoffPath: "/path/to/handoff.json" })
294
+ subagent({ action: "lane.status", options: { laneId: "<manifest-run-id>", handoffPath: "/path/to/handoff.json" } })
281
295
  ```
282
296
 
283
297
  The manifest stores one of these fail-closed eligibility states: `active` (an owning child is still running), `terminal-eligible` (complete merge evidence and recorded post-merge checks), `terminal-blocked` with a reason, `superseded-eligible` (an explicit replacement attestation), or `unknown` (missing or malformed evidence/manifest). Each attestation stores a digest of the manifest facts it covered; later group, worktree, or patch changes downgrade that evidence to `terminal-blocked` until it is recorded again. A terminal update recomputes a previously stored `active` state from the current child statuses and evidence. Conflicting reviewed heads and mismatched lane ids are rejected as stale. Existing workflow receipts remain immutable.
@@ -294,19 +308,19 @@ For backlog lanes and other subagent-governed workflows, external/foreground/CLI
294
308
 
295
309
  ```ts
296
310
  subagent({ action: "status" })
297
- subagent({ action: "status", view: "fleet" })
311
+ subagent({ action: "status", options: { view: "fleet" } })
298
312
  subagent({ action: "status", id: "<run-id>" })
299
- subagent({ action: "status", id: "<run-id>", view: "transcript", index: 0, lines: 80 })
313
+ subagent({ action: "status", id: "<run-id>", options: { view: "transcript", index: 0, lines: 80 } })
300
314
  subagent({ action: "status", id: "<nested-run-id>" })
301
315
  subagent({ action: "interrupt", id: "<run-id>" })
302
316
  subagent({ action: "interrupt", id: "<nested-run-id>" })
303
317
  subagent({ action: "stop", id: "<run-id>" })
304
318
  subagent({ action: "resume", id: "<run-id>", message: "follow-up question after it pauses or finishes" })
305
- subagent({ action: "resume", id: "<run-id>", index: 1, message: "follow-up for child 2" })
319
+ subagent({ action: "resume", id: "<run-id>", message: "follow-up for child 2", options: { index: 1 } })
306
320
  subagent({ action: "resume", id: "<nested-run-id>", message: "follow-up for a nested child" })
307
321
  subagent({ action: "steer", id: "<run-id>", message: "guidance for the running child" })
308
- subagent({ action: "steer", id: "<run-id>", mode: "follow_up", message: "check this after the current turn" })
309
- subagent({ action: "steer", id: "<run-id>", index: 1, mode: "auto", message: "guidance for child 2" })
322
+ subagent({ action: "steer", id: "<run-id>", message: "check this after the current turn", options: { mode: "follow_up" } })
323
+ subagent({ action: "steer", id: "<run-id>", message: "guidance for child 2", options: { index: 1, mode: "auto" } })
310
324
  subagent({ action: "doctor" })
311
325
  ```
312
326
 
@@ -325,10 +339,10 @@ subagent({ action: "doctor" })
325
339
  Command controls target direct local native Pi children that explicitly select both `bash` and `subagent_command`, in foreground or async runs. They require the owning parent session, a run `id`, an explicit `index` for multi-child runs, and the exact `toolCallId` for mutations. Nested, external, and custom shell backends do not expose this controller. Custom bash extensions keep their own registered `subagent_command` tool. If a custom bash backend does not provide that tool, an explicitly required `subagent_command` remains available and reports an unsupported-backend error. Native supervisor command controls are unavailable for custom backends.
326
340
 
327
341
  ```ts
328
- subagent({ action: "command.status", id: "<run-id>", index: 0 })
329
- subagent({ action: "command.yield", id: "<run-id>", index: 0, toolCallId: "<call-id>" })
330
- subagent({ action: "command.cancel", id: "<run-id>", index: 0, toolCallId: "<call-id>" })
331
- subagent({ action: "command.status", id: "<run-id>", index: 0, toolCallId: "<call-id>" })
342
+ subagent({ action: "command.status", id: "<run-id>", options: { index: 0 } })
343
+ subagent({ action: "command.yield", id: "<run-id>", options: { index: 0, toolCallId: "<call-id>" } })
344
+ subagent({ action: "command.cancel", id: "<run-id>", options: { index: 0, toolCallId: "<call-id>" } })
345
+ subagent({ action: "command.status", id: "<run-id>", options: { index: 0, toolCallId: "<call-id>" } })
332
346
  ```
333
347
 
334
348
  `command.yield` releases the selected blocking tool call without restarting the process. `command.cancel` aborts only that command through Pi's native bash cancellation; the child receives a tool error and can continue. `cancel_requested` acknowledges the request, while `cancelled` confirms the backend settled. A stale id never targets a later command. Run-scoped `interrupt` remains separate.
@@ -362,7 +376,7 @@ Commands remain owned by the child session. Normal completion with unfinished co
362
376
  - It is not a resumable pause; stopped runs should be restarted as new runs.
363
377
  - Foreground and nested targets are rejected.
364
378
  - Direct id calls execute immediately.
365
- - `/subagents-stop` without an id opens a selector with confirmation when a TUI is available. Use `↑`/`↓` or `j`/`k` to move through the selector.
379
+ - `/subagents-stop` without an id opens a selector with confirmation when a TUI is available. Use `↑`/`↓` or `j`/`k` to move through the selector. When two or more current-session async runs are active, the first row is "stop all", which stops each of them after one confirmation and leaves scheduled runs alone.
366
380
  - In non-TUI contexts the slash command prints exact `subagent({ action: "stop", id })` and `/subagents-stop <id>` commands.
367
381
  - Pass a child id to stop one child of a multi-child async run or workflow while the rest continue: `/subagents-stop <run-id> <child-id>` (equivalent to `subagent({ action: "stop", id, childId })`). Child ids come from status output, the async status snapshot, or `/subagents-inspect-rpc` replies. Only pending or running children are stoppable; the request is rejected for anything else instead of widening to a run-level stop.
368
382
  - Inactive schedules can appear in the selector, but they are labeled as schedules and route through `schedule.pause`, not `stop`.
@@ -391,15 +405,19 @@ Prefer an inline JSON object. JSON-encoded object strings are tolerated only dur
391
405
  {
392
406
  agent: "worker",
393
407
  task: "Implement the fix",
394
- acceptance: {
395
- level: "verified",
396
- criteria: ["Patch the bug without widening scope"],
397
- evidence: ["changed-files", "tests-added", "commands-run", "residual-risks", "no-staged-files"],
398
- verify: [{ id: "focused", command: "npm test", timeoutMs: 120000 }]
408
+ options: {
409
+ acceptance: {
410
+ level: "verified",
411
+ criteria: ["Patch the bug without widening scope"],
412
+ evidence: ["changed-files", "tests-added", "commands-run", "residual-risks", "no-staged-files"],
413
+ verify: [{ id: "focused", command: "npm test", timeoutMs: 120000 }]
414
+ }
399
415
  }
400
416
  }
401
417
  ```
402
418
 
419
+ A direct tool call passes `acceptance` inside `options`; a workflow `runs.run` item passes it as a plain field.
420
+
403
421
  ### One-command gates
404
422
 
405
423
  When one host-run command is the entire verification contract, use the `gate` shorthand instead of a full `acceptance` object:
@@ -519,7 +537,7 @@ return runs.run("main", { agent: "scout", task: "..." });
519
537
  ```
520
538
 
521
539
  ```js
522
- subagent({ workflow: true, share: true });
540
+ subagent({ workflow: true, options: { share: true } });
523
541
  ```
524
542
 
525
543
  This is disabled by default. Session data may contain source code, paths, environment variables, credentials, or other sensitive output. You need `gh` installed and authenticated.
@@ -529,8 +547,8 @@ This is disabled by default. Session data may contain source code, paths, enviro
529
547
  `worktree.cleanup` first saves a plan without removing anything:
530
548
 
531
549
  ```ts
532
- subagent({ action: "worktree.cleanup", repo: "/path/to/repo", mode: "plan" })
533
- subagent({ action: "worktree.cleanup", repo: "/path/to/repo", mode: "apply", planId: "<reviewed-plan-id>" })
550
+ subagent({ action: "worktree.cleanup", options: { repo: "/path/to/repo", mode: "plan" } })
551
+ subagent({ action: "worktree.cleanup", options: { repo: "/path/to/repo", mode: "apply", planId: "<reviewed-plan-id>" } })
534
552
  ```
535
553
 
536
554
  Apply uses the existing `authorityPolicy.discardWorktree` (`confirm` by default). It checks the saved plan's repository, hash and 30-minute expiry, then rechecks only reviewed candidates under a repository lock shared with retained resume admission. Only a clean, contained, provably owned terminal worktree with durable evidence can be removed. Dirty or untracked files, ignored files, Git locks, active ownership, recorded native session dependencies, retained resume admission, changed heads and missing artifacts keep the tree. Every local branch is retained; apply never forces removal or prunes unrelated Git metadata.
package/docs/watchdog.md CHANGED
@@ -46,13 +46,15 @@ you ─▶ agent turn ─▶ edits repo ─▶ agent_end ─▶ watchdog review
46
46
  └─ warning: low/medium user entry, or high steered message
47
47
  ```
48
48
 
49
- Collapsed warnings show the title and evidence line. Expanded warnings show evidence, recommended action, importance, category, and source:
49
+ A warning shows as one `[subagent] watchdog concern` or `[subagent] watchdog blocker` line, like every other message pi-subagents shows in the chat. Pi's expand key, or a click on the line, opens it to the summary, evidence, recommended action, importance, category, and source:
50
50
 
51
51
  ```
52
- ● Subagent watchdog Blocker (displayed): Claims tests passed without running them
53
- Evidence: The transcript claims `npm test` passed but no test command appears in the tool log.
54
- Recommended action: Run the focused test before finishing.
55
- Importance: High · Category: Test Gap · Source: main
52
+ [subagent] watchdog blocker
53
+
54
+ Subagent watchdog Blocker (displayed): Claims tests passed without running them
55
+ Evidence: The transcript claims npm test passed but no test command appears in the tool log.
56
+ Recommended action: Run the focused test before finishing.
57
+ Importance: High · Category: Test Gap · Source: main
56
58
  ```
57
59
 
58
60
  When consecutive boundary reviews raise the same warning, the agent is not making progress. After `stalemateRepeats` identical warnings in a row (default 3), the warning is shown as `stalemate`, no continuation is triggered, and the turn ends. Your next prompt resets the count.
@@ -110,7 +112,7 @@ Omit `main.model` to inherit the session model and thinking level. A `main.model
110
112
 
111
113
  The watchdog resolves one reviewer model and makes one review call. Unavailable models fail visibly; rate limits, quota, authentication, provider timeouts, findings, clarification, cancellation, and the overall watchdog deadline never switch models automatically. An inherited model keeps the current session model and thinking level.
112
114
 
113
- Agents can call `subagent({ action: "watchdog.recommend-model" })` and `subagent({ action: "watchdog.configure", model: "recommended", scope: "session" | "user" | "project" })`. They should use `scope: "session"` unless you ask for a lasting default.
115
+ Agents can call `subagent({ action: "watchdog.recommend-model" })` and `subagent({ action: "watchdog.configure", model: "recommended", options: { scope: "session" | "user" | "project" } })`. They should use `options: { scope: "session" }` unless you ask for a lasting default.
114
116
 
115
117
  ## Optional main-session clarification
116
118
 
package/docs/workflows.md CHANGED
@@ -12,10 +12,12 @@ clarify → scout → worker → fresh reviewers → worker
12
12
 
13
13
  Packaged `worker` defaults to fresh context so implementation starts from its assigned brief instead of the parent's unfinished conversation. Packaged `oracle` and `advisor` default to forked context; if the parent has no persisted session file or current leaf yet, that implicit default falls back to `fresh`. Explicit `context`, `context: "profile"`, and global `defaultSubagentContext` still override these profile defaults.
14
14
 
15
+ Launch children in the background (`async` follows `asyncByDefault`, normally true) and consume each result at the point a later step depends on it. Native completion wakes the parent session, so the parent returns control instead of sleeping or polling. Use `async: false` only when the parent must block, not for final reviews or gates. When an oracle or advisor reaches an unknown that needs a decision, it asks through supervisor dialogue; use a one-shot oracle call only when one was requested.
16
+
15
17
  Child-safety boundaries are enforced at runtime:
16
18
 
17
19
  - Child sessions do not receive the bundled `pi-subagents` skill.
18
- - 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.
20
+ - Child context filtering removes parent-only subagent artifacts (hidden orchestration-instruction messages, slash/status/control messages, and `subagent` tool-call/tool-result history) while preserving ordinary prose and unrelated tool calls/results. A forked child sends the history it inherited exactly as the parent sent it, so its first request can reuse the parent's prompt cache; it still cannot run `subagent`.
19
21
  - 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.
20
22
  - 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`.
21
23
 
@@ -27,7 +29,7 @@ Stop and report the exact failure, run/status, and repository/cwd/worktree/branc
27
29
 
28
30
  Failed workflow details and async `status.json` include `workflow.failureKind` as `validation`, `script`, `child`, `return-serialization`, `timeout`, `detached-child`, or `runtime`. `validation` means the host rejected the script before it ran (syntax or portability) or at completion (unawaited calls); errors thrown into a running script, including rejected `runs.run` parameters and runtime `SyntaxError`s, are `script` because the script could catch them, and failed children are `child`. `runtime` covers host setup and infrastructure failures, such as an unavailable cwd or a crashed worker. A workflow that is stopped or reloaded is not a failure and has no `failureKind`.
29
31
 
30
- When `/reload`, a session resume, or a pi-web project switch replaces the extension runtime, a running async workflow stops with `workflow.stopCause: "runtime-replaced"` in `status.json`, and its awaited async children keep running. When the same workflow script is launched again with the same `args` in that session, a `runs.run` with the same key and params returns a child that already finished successfully without launching it, and waits for a child that is still running instead of starting another. Those results carry `reused: true`, their step and trace entry are marked `reused`, and the new run records `workflow.reusedFrom`. Failed and stopped children, and children that ran in-process, launch again. Reuse applies only when the newest run of that script and args in the session was stopped this way; a user stop or a completed run ends it.
32
+ When `/reload`, a session resume, or a pi-web project switch replaces the extension runtime, a running async workflow stops with `workflow.stopCause: "runtime-replaced"` in `status.json`, and its awaited async children keep running. Its in-process foreground children are stopped, including ones that detached to ask their supervisor. When the same workflow script is launched again with the same `args` in that session, a `runs.run` with the same key and params returns a child that already finished successfully without launching it, and waits for a child that is still running instead of starting another. Those results carry `reused: true`, their step and trace entry are marked `reused`, and the new run records `workflow.reusedFrom`. Failed and stopped children, and children that ran in-process, launch again. Reuse applies only when the newest run of that script and args in the session was stopped this way; a user stop or a completed run ends it.
31
33
 
32
34
  Pi core may print a generic `pi -ne` extension-load hint; that out-of-repo hint is not protocol-approved fallback. A verified compaction abort may continue the retained child once on its already resolved model; it does not authorize an execution-mode or model switch.
33
35
 
@@ -49,6 +51,8 @@ Add `autofix` to `/parallel-review` or `/parallel-cleanup` to apply only the syn
49
51
 
50
52
  Use direct `{ agent, task }` for one bounded child. Use a workflow script when the parent needs a stable keyed child, sequence, fanout, steering, retry, or aggregation. For ordinary parallel fanout, use `await runs.all([{ key, agent, task }, ...])`. It resolves to an ordered array, not a key map, so use indexes, destructuring, or `.map(...)`, not `results.<key>`. Do not read `.output` from unawaited `runs.run` launches. Store a `runs.run` promise only when the script later observes it with `await`, `Promise.race`, or `Promise.all`, such as steering a live child before awaiting its result. Scripts are ordinary JavaScript statement bodies. Use an explicit `return` for a useful result.
51
53
 
54
+ Use top-level `await`, plain helper functions, or Promise chains; nested async functions, async arrows, and async methods are rejected (see [opt-in bounded workflows](#opt-in-bounded-workflows)).
55
+
52
56
  The `workflow` field selects the script source:
53
57
 
54
58
  - `workflow: true` runs the one ```` ```js workflow ```` fenced block written in the same assistant reply as the `subagent` call. The script is plain text in the reply, so it needs no JSON string escaping. A reply can carry exactly one such block and one `workflow: true` call; zero or several blocks fail. A reply with no tagged block may instead carry exactly one plain ```` ```js ```` block, which then runs. A line containing only ```` ``` ```` (three or more backticks, optionally followed by spaces or tabs) ends the block, so keep Markdown fences inside quoted strings.
@@ -104,9 +108,12 @@ Use a named workflow resource when a permission or policy extension needs to dis
104
108
  ```js
105
109
  subagent({ workflow: "review", args: { task: "Review the change" } });
106
110
  subagent({ workflow: "run-ci", args: { command: "npm test" } });
111
+ subagent({ workflow: "parallel", args: { tasks: [{ agent: "reviewer", task: "Review src/api" }, { agent: "scout", task: "Map the tests" }] } });
107
112
  ```
108
113
 
109
- The host resolves the name and validates bounded plain-JSON `args` before starting the workflow. Resource provenance is recorded in workflow details and receipts for downstream permission/policy checks. Resource authority is not caller-supplied: `runs.host` is available only when the resolved resource explicitly grants the requested host key and command. Reply-block (`workflow: true`) and file-path scripts remain raw, unknown-provenance inputs, so their `runs.host` calls are unavailable through the public execution boundary. Named resources cannot be combined with `agent` or `task`; this first slice ships only the package-owned `review` and `run-ci` resources, not a user/project resource registry.
114
+ The host resolves the name and validates bounded plain-JSON `args` before starting the workflow. Resource provenance is recorded in workflow details and receipts for downstream permission/policy checks. Resource authority is not caller-supplied: `runs.host` is available only when the resolved resource explicitly grants the requested host key and command. Reply-block (`workflow: true`) and file-path scripts remain raw, unknown-provenance inputs, so their `runs.host` calls are unavailable through the public execution boundary. Named resources cannot be combined with `agent` or `task`; the package ships the `review`, `run-ci` and `parallel` resources, not a user/project resource registry.
115
+
116
+ `parallel` runs independent children together without writing a script: `args.tasks` is a list of `{ agent, task }` items, the children run in one `runs.all` batch, and the result lists each child's output in order. A failed child fails the workflow. Use a workflow script when steps depend on each other.
110
117
 
111
118
  ### Opt-in bounded workflows
112
119
 
@@ -120,9 +127,11 @@ return runs.run("review", { agent: "reviewer", task: "Review:\n" + scan.output }
120
127
  ```js
121
128
  subagent({
122
129
  workflow: true,
123
- timeoutMs: 900000,
124
- toolBudget: { soft: 40, hard: 60 },
125
- usageBudget: { tokens: { soft: 100000, hard: 150000 } }
130
+ options: {
131
+ timeoutMs: 900000,
132
+ toolBudget: { soft: 40, hard: 60 },
133
+ usageBudget: { tokens: { soft: 100000, hard: 150000 } }
134
+ }
126
135
  });
127
136
  ```
128
137
 
@@ -485,7 +494,7 @@ Inspect the handoff before reconciliation; cleanup still requires fresh checks.
485
494
 
486
495
  ## Supervisor coordination (child asks parent)
487
496
 
488
- Child agents can talk back to the parent Pi session without installing `pi-intercom`. `pi-subagents` provides the child-facing `contact_supervisor` tool and the parent-facing `subagent_supervisor({ action: "reply" })` path natively. Generic `intercom` remains available only when an explicitly loaded external provider supplies it.
497
+ Child agents can talk back to the parent Pi session without installing `pi-intercom`. `pi-subagents` provides the child-facing `contact_supervisor` tool and the parent-facing `subagent_supervisor({ action: "reply" })` path natively. A session that has `subagent` also declares `contact_supervisor`, so a forked child's tools match its parent's; there it only returns an error saying the session has no supervisor. Generic `intercom` remains available only when an explicitly loaded external provider supplies it.
489
498
 
490
499
  Use it for work where the child might need a decision instead of guessing:
491
500
 
@@ -517,7 +526,7 @@ For A → B → C, C's request belongs to B, not A. B can escalate a separate qu
517
526
 
518
527
  Child-side routine completion handoffs are not expected. If a child appears stalled, needs-attention notices show up in the parent session with useful next actions, such as checking `subagent({ action: "status" })`, interrupting the run, or nudging the child.
519
528
 
520
- If a workflow script child detaches through `contact_supervisor`, the enclosing async workflow stays `paused` until that child exits. Then the extension reconciles it to `complete` or `failed`. Wait on the child until that happens.
529
+ If a workflow script child detaches through `contact_supervisor`, the enclosing async workflow stays `paused` until that child exits. Then the extension reconciles it to `complete` or `failed`. Wait on the child until that happens. A detached child that runs in-process (not as an async child) is stopped if the extension runtime is replaced before it finishes; `status` on its run id then shows it as stopped with the reason.
521
530
 
522
531
  If messages do not show up, run `/subagents-doctor`. Advanced users can tune the bridge with `intercomBridge` in [configuration.md](configuration.md).
523
532
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "pi-subagents",
4
- "version": "0.76.1",
4
+ "version": "0.78.0",
5
5
  "description": "Pi extension for single-agent delegation and scripted multi-agent workflows",
6
6
  "author": "Nico Bailon",
7
7
  "license": "MIT",
@@ -9,7 +9,7 @@ decide which feedback is valid, and write the final memo. Advisors do not talk
9
9
  directly or see peer transcripts by default. This is not free-form agent chat.
10
10
 
11
11
  Before you orchestrate, load the council protocol with
12
- `subagent({ action: "guide", topic: "council" })`. If only `subagents_enable`
12
+ `subagent({ action: "guide", options: { topic: "council" } })`. If only `subagents_enable`
13
13
  is available, call it first; `subagent` is available on the next request. The
14
14
  guide returns the packaged council-mode skill and the references it asks you to
15
15
  read, so it also works when Pi runs with `--no-skills`.