@bastani/atomic 0.8.11 → 0.8.12

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 (514) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/dist/builtin/intercom/package.json +1 -1
  3. package/dist/builtin/mcp/package.json +1 -1
  4. package/dist/builtin/subagents/CHANGELOG.md +3 -0
  5. package/dist/builtin/subagents/package.json +1 -1
  6. package/dist/builtin/subagents/src/agents/agent-serializer.ts +3 -2
  7. package/dist/builtin/subagents/src/agents/agents.ts +1 -1
  8. package/dist/builtin/subagents/src/extension/index.ts +597 -471
  9. package/dist/builtin/subagents/src/runs/background/async-job-tracker.ts +16 -8
  10. package/dist/builtin/subagents/src/runs/background/subagent-runner.ts +9 -13
  11. package/dist/builtin/subagents/src/runs/foreground/execution.ts +7 -3
  12. package/dist/builtin/subagents/src/shared/formatters.ts +8 -3
  13. package/dist/builtin/subagents/src/slash/slash-commands.ts +625 -468
  14. package/dist/builtin/subagents/src/tui/render.ts +342 -158
  15. package/dist/builtin/web-access/package.json +1 -1
  16. package/dist/builtin/workflows/package.json +1 -1
  17. package/dist/builtin/workflows/src/runs/foreground/executor.ts +15 -4
  18. package/dist/builtin/workflows/src/runs/foreground/stage-control-registry.ts +75 -33
  19. package/dist/builtin/workflows/src/shared/store-types.ts +3 -4
  20. package/dist/builtin/workflows/src/shared/store.ts +2 -3
  21. package/dist/builtin/workflows/src/tui/graph-view.ts +12 -1
  22. package/dist/builtin/workflows/src/tui/stage-chat-view.ts +1 -2
  23. package/dist/builtin/workflows/src/tui/status-helpers.ts +1 -1
  24. package/dist/bun/cli.d.ts.map +1 -1
  25. package/dist/bun/cli.js.map +1 -1
  26. package/dist/cli/args.d.ts +1 -1
  27. package/dist/cli/args.d.ts.map +1 -1
  28. package/dist/cli/args.js.map +1 -1
  29. package/dist/cli/config-selector.d.ts +2 -2
  30. package/dist/cli/config-selector.d.ts.map +1 -1
  31. package/dist/cli/config-selector.js.map +1 -1
  32. package/dist/cli/file-processor.d.ts.map +1 -1
  33. package/dist/cli/file-processor.js.map +1 -1
  34. package/dist/cli/initial-message.d.ts +1 -1
  35. package/dist/cli/initial-message.d.ts.map +1 -1
  36. package/dist/cli/initial-message.js.map +1 -1
  37. package/dist/cli/list-models.d.ts +1 -1
  38. package/dist/cli/list-models.d.ts.map +1 -1
  39. package/dist/cli/list-models.js.map +1 -1
  40. package/dist/cli/session-picker.d.ts +1 -1
  41. package/dist/cli/session-picker.d.ts.map +1 -1
  42. package/dist/cli/session-picker.js.map +1 -1
  43. package/dist/cli.d.ts.map +1 -1
  44. package/dist/cli.js +2 -6
  45. package/dist/cli.js.map +1 -1
  46. package/dist/config.d.ts.map +1 -1
  47. package/dist/config.js +45 -22
  48. package/dist/config.js.map +1 -1
  49. package/dist/core/agent-session-runtime.d.ts +9 -9
  50. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  51. package/dist/core/agent-session-runtime.js +2 -3
  52. package/dist/core/agent-session-runtime.js.map +1 -1
  53. package/dist/core/agent-session-services.d.ts +7 -7
  54. package/dist/core/agent-session-services.d.ts.map +1 -1
  55. package/dist/core/agent-session-services.js.map +1 -1
  56. package/dist/core/agent-session.d.ts +10 -10
  57. package/dist/core/agent-session.d.ts.map +1 -1
  58. package/dist/core/agent-session.js.map +1 -1
  59. package/dist/core/atomic-guide-command.d.ts.map +1 -1
  60. package/dist/core/atomic-guide-command.js.map +1 -1
  61. package/dist/core/auth-guidance.d.ts.map +1 -1
  62. package/dist/core/auth-guidance.js.map +1 -1
  63. package/dist/core/auth-storage.d.ts +1 -1
  64. package/dist/core/auth-storage.d.ts.map +1 -1
  65. package/dist/core/auth-storage.js +1 -1
  66. package/dist/core/auth-storage.js.map +1 -1
  67. package/dist/core/bash-executor.d.ts +1 -1
  68. package/dist/core/bash-executor.d.ts.map +1 -1
  69. package/dist/core/bash-executor.js.map +1 -1
  70. package/dist/core/builtin-packages.d.ts.map +1 -1
  71. package/dist/core/builtin-packages.js.map +1 -1
  72. package/dist/core/compaction/branch-summarization.d.ts +3 -3
  73. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  74. package/dist/core/compaction/branch-summarization.js.map +1 -1
  75. package/dist/core/compaction/compaction.d.ts +2 -2
  76. package/dist/core/compaction/compaction.d.ts.map +1 -1
  77. package/dist/core/compaction/compaction.js.map +1 -1
  78. package/dist/core/compaction/index.d.ts +3 -3
  79. package/dist/core/compaction/index.d.ts.map +1 -1
  80. package/dist/core/compaction/index.js.map +1 -1
  81. package/dist/core/exec.d.ts.map +1 -1
  82. package/dist/core/exec.js.map +1 -1
  83. package/dist/core/export-html/index.d.ts +1 -1
  84. package/dist/core/export-html/index.d.ts.map +1 -1
  85. package/dist/core/export-html/index.js.map +1 -1
  86. package/dist/core/export-html/tool-renderer.d.ts +2 -2
  87. package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
  88. package/dist/core/export-html/tool-renderer.js.map +1 -1
  89. package/dist/core/extensions/index.d.ts +8 -8
  90. package/dist/core/extensions/index.d.ts.map +1 -1
  91. package/dist/core/extensions/index.js.map +1 -1
  92. package/dist/core/extensions/loader.d.ts +3 -3
  93. package/dist/core/extensions/loader.d.ts.map +1 -1
  94. package/dist/core/extensions/loader.js.map +1 -1
  95. package/dist/core/extensions/runner.d.ts +6 -6
  96. package/dist/core/extensions/runner.d.ts.map +1 -1
  97. package/dist/core/extensions/runner.js.map +1 -1
  98. package/dist/core/extensions/types.d.ts +20 -20
  99. package/dist/core/extensions/types.d.ts.map +1 -1
  100. package/dist/core/extensions/types.js.map +1 -1
  101. package/dist/core/extensions/wrapper.d.ts +2 -2
  102. package/dist/core/extensions/wrapper.d.ts.map +1 -1
  103. package/dist/core/extensions/wrapper.js.map +1 -1
  104. package/dist/core/footer-data-provider.d.ts.map +1 -1
  105. package/dist/core/footer-data-provider.js.map +1 -1
  106. package/dist/core/http-dispatcher.d.ts +32 -0
  107. package/dist/core/http-dispatcher.d.ts.map +1 -0
  108. package/dist/core/http-dispatcher.js +43 -0
  109. package/dist/core/http-dispatcher.js.map +1 -0
  110. package/dist/core/index.d.ts +8 -8
  111. package/dist/core/index.d.ts.map +1 -1
  112. package/dist/core/index.js.map +1 -1
  113. package/dist/core/keybindings.d.ts.map +1 -1
  114. package/dist/core/keybindings.js.map +1 -1
  115. package/dist/core/model-registry.d.ts +4 -4
  116. package/dist/core/model-registry.d.ts.map +1 -1
  117. package/dist/core/model-registry.js +2 -2
  118. package/dist/core/model-registry.js.map +1 -1
  119. package/dist/core/model-resolver.d.ts +1 -1
  120. package/dist/core/model-resolver.d.ts.map +1 -1
  121. package/dist/core/model-resolver.js.map +1 -1
  122. package/dist/core/package-manager.d.ts +1 -1
  123. package/dist/core/package-manager.d.ts.map +1 -1
  124. package/dist/core/package-manager.js +10 -11
  125. package/dist/core/package-manager.js.map +1 -1
  126. package/dist/core/prompt-templates.d.ts +1 -1
  127. package/dist/core/prompt-templates.d.ts.map +1 -1
  128. package/dist/core/prompt-templates.js.map +1 -1
  129. package/dist/core/resolve-config-value.d.ts.map +1 -1
  130. package/dist/core/resolve-config-value.js.map +1 -1
  131. package/dist/core/resource-loader.d.ts +9 -9
  132. package/dist/core/resource-loader.d.ts.map +1 -1
  133. package/dist/core/resource-loader.js.map +1 -1
  134. package/dist/core/sdk.d.ts +13 -13
  135. package/dist/core/sdk.d.ts.map +1 -1
  136. package/dist/core/sdk.js.map +1 -1
  137. package/dist/core/session-manager.d.ts +1 -1
  138. package/dist/core/session-manager.d.ts.map +1 -1
  139. package/dist/core/session-manager.js.map +1 -1
  140. package/dist/core/settings-manager.d.ts +3 -0
  141. package/dist/core/settings-manager.d.ts.map +1 -1
  142. package/dist/core/settings-manager.js +21 -0
  143. package/dist/core/settings-manager.js.map +1 -1
  144. package/dist/core/skills.d.ts +2 -2
  145. package/dist/core/skills.d.ts.map +1 -1
  146. package/dist/core/skills.js.map +1 -1
  147. package/dist/core/slash-commands.d.ts +1 -1
  148. package/dist/core/slash-commands.d.ts.map +1 -1
  149. package/dist/core/slash-commands.js.map +1 -1
  150. package/dist/core/source-info.d.ts +1 -1
  151. package/dist/core/source-info.d.ts.map +1 -1
  152. package/dist/core/source-info.js.map +1 -1
  153. package/dist/core/system-prompt.d.ts +1 -1
  154. package/dist/core/system-prompt.d.ts.map +1 -1
  155. package/dist/core/system-prompt.js +7 -8
  156. package/dist/core/system-prompt.js.map +1 -1
  157. package/dist/core/telemetry.d.ts +1 -1
  158. package/dist/core/telemetry.d.ts.map +1 -1
  159. package/dist/core/telemetry.js.map +1 -1
  160. package/dist/core/timings.d.ts.map +1 -1
  161. package/dist/core/timings.js.map +1 -1
  162. package/dist/core/tools/ask-user-question/ask-user-question.d.ts +4 -4
  163. package/dist/core/tools/ask-user-question/ask-user-question.d.ts.map +1 -1
  164. package/dist/core/tools/ask-user-question/ask-user-question.js.map +1 -1
  165. package/dist/core/tools/ask-user-question/index.d.ts +1 -1
  166. package/dist/core/tools/ask-user-question/index.d.ts.map +1 -1
  167. package/dist/core/tools/ask-user-question/index.js.map +1 -1
  168. package/dist/core/tools/ask-user-question/state/build-questionnaire.d.ts +5 -5
  169. package/dist/core/tools/ask-user-question/state/build-questionnaire.d.ts.map +1 -1
  170. package/dist/core/tools/ask-user-question/state/build-questionnaire.js.map +1 -1
  171. package/dist/core/tools/ask-user-question/state/key-router.d.ts +2 -2
  172. package/dist/core/tools/ask-user-question/state/key-router.d.ts.map +1 -1
  173. package/dist/core/tools/ask-user-question/state/key-router.js.map +1 -1
  174. package/dist/core/tools/ask-user-question/state/questionnaire-session.d.ts +3 -3
  175. package/dist/core/tools/ask-user-question/state/questionnaire-session.d.ts.map +1 -1
  176. package/dist/core/tools/ask-user-question/state/questionnaire-session.js.map +1 -1
  177. package/dist/core/tools/ask-user-question/state/row-intent.d.ts +2 -2
  178. package/dist/core/tools/ask-user-question/state/row-intent.d.ts.map +1 -1
  179. package/dist/core/tools/ask-user-question/state/row-intent.js.map +1 -1
  180. package/dist/core/tools/ask-user-question/state/selectors/contract.d.ts +6 -6
  181. package/dist/core/tools/ask-user-question/state/selectors/contract.d.ts.map +1 -1
  182. package/dist/core/tools/ask-user-question/state/selectors/contract.js.map +1 -1
  183. package/dist/core/tools/ask-user-question/state/selectors/derivations.d.ts +2 -2
  184. package/dist/core/tools/ask-user-question/state/selectors/derivations.d.ts.map +1 -1
  185. package/dist/core/tools/ask-user-question/state/selectors/derivations.js.map +1 -1
  186. package/dist/core/tools/ask-user-question/state/selectors/focus.d.ts +1 -1
  187. package/dist/core/tools/ask-user-question/state/selectors/focus.d.ts.map +1 -1
  188. package/dist/core/tools/ask-user-question/state/selectors/focus.js.map +1 -1
  189. package/dist/core/tools/ask-user-question/state/selectors/projections.d.ts +8 -8
  190. package/dist/core/tools/ask-user-question/state/selectors/projections.d.ts.map +1 -1
  191. package/dist/core/tools/ask-user-question/state/selectors/projections.js.map +1 -1
  192. package/dist/core/tools/ask-user-question/state/state-reducer.d.ts +4 -4
  193. package/dist/core/tools/ask-user-question/state/state-reducer.d.ts.map +1 -1
  194. package/dist/core/tools/ask-user-question/state/state-reducer.js.map +1 -1
  195. package/dist/core/tools/ask-user-question/state/state.d.ts +2 -2
  196. package/dist/core/tools/ask-user-question/state/state.d.ts.map +1 -1
  197. package/dist/core/tools/ask-user-question/state/state.js.map +1 -1
  198. package/dist/core/tools/ask-user-question/tool/format-answer.d.ts +1 -1
  199. package/dist/core/tools/ask-user-question/tool/format-answer.d.ts.map +1 -1
  200. package/dist/core/tools/ask-user-question/tool/format-answer.js.map +1 -1
  201. package/dist/core/tools/ask-user-question/tool/response-envelope.d.ts +1 -1
  202. package/dist/core/tools/ask-user-question/tool/response-envelope.d.ts.map +1 -1
  203. package/dist/core/tools/ask-user-question/tool/response-envelope.js.map +1 -1
  204. package/dist/core/tools/ask-user-question/tool/types.d.ts.map +1 -1
  205. package/dist/core/tools/ask-user-question/tool/types.js.map +1 -1
  206. package/dist/core/tools/ask-user-question/tool/validate-questionnaire.d.ts +1 -1
  207. package/dist/core/tools/ask-user-question/tool/validate-questionnaire.d.ts.map +1 -1
  208. package/dist/core/tools/ask-user-question/tool/validate-questionnaire.js.map +1 -1
  209. package/dist/core/tools/ask-user-question/view/body-residual-spacer.d.ts.map +1 -1
  210. package/dist/core/tools/ask-user-question/view/body-residual-spacer.js.map +1 -1
  211. package/dist/core/tools/ask-user-question/view/component-binding.d.ts +4 -4
  212. package/dist/core/tools/ask-user-question/view/component-binding.d.ts.map +1 -1
  213. package/dist/core/tools/ask-user-question/view/component-binding.js.map +1 -1
  214. package/dist/core/tools/ask-user-question/view/components/chat-row-view.d.ts +2 -2
  215. package/dist/core/tools/ask-user-question/view/components/chat-row-view.d.ts.map +1 -1
  216. package/dist/core/tools/ask-user-question/view/components/chat-row-view.js.map +1 -1
  217. package/dist/core/tools/ask-user-question/view/components/multi-select-view.d.ts +4 -4
  218. package/dist/core/tools/ask-user-question/view/components/multi-select-view.d.ts.map +1 -1
  219. package/dist/core/tools/ask-user-question/view/components/multi-select-view.js.map +1 -1
  220. package/dist/core/tools/ask-user-question/view/components/option-list-view.d.ts +2 -2
  221. package/dist/core/tools/ask-user-question/view/components/option-list-view.d.ts.map +1 -1
  222. package/dist/core/tools/ask-user-question/view/components/option-list-view.js.map +1 -1
  223. package/dist/core/tools/ask-user-question/view/components/preview/markdown-content-cache.d.ts +2 -2
  224. package/dist/core/tools/ask-user-question/view/components/preview/markdown-content-cache.d.ts.map +1 -1
  225. package/dist/core/tools/ask-user-question/view/components/preview/markdown-content-cache.js.map +1 -1
  226. package/dist/core/tools/ask-user-question/view/components/preview/preview-block-renderer.d.ts +3 -3
  227. package/dist/core/tools/ask-user-question/view/components/preview/preview-block-renderer.d.ts.map +1 -1
  228. package/dist/core/tools/ask-user-question/view/components/preview/preview-block-renderer.js.map +1 -1
  229. package/dist/core/tools/ask-user-question/view/components/preview/preview-layout-decider.d.ts +2 -2
  230. package/dist/core/tools/ask-user-question/view/components/preview/preview-layout-decider.d.ts.map +1 -1
  231. package/dist/core/tools/ask-user-question/view/components/preview/preview-layout-decider.js.map +1 -1
  232. package/dist/core/tools/ask-user-question/view/components/preview/preview-pane.d.ts +8 -8
  233. package/dist/core/tools/ask-user-question/view/components/preview/preview-pane.d.ts.map +1 -1
  234. package/dist/core/tools/ask-user-question/view/components/preview/preview-pane.js.map +1 -1
  235. package/dist/core/tools/ask-user-question/view/components/submit-picker.d.ts +3 -3
  236. package/dist/core/tools/ask-user-question/view/components/submit-picker.d.ts.map +1 -1
  237. package/dist/core/tools/ask-user-question/view/components/submit-picker.js.map +1 -1
  238. package/dist/core/tools/ask-user-question/view/components/tab-bar.d.ts +3 -3
  239. package/dist/core/tools/ask-user-question/view/components/tab-bar.d.ts.map +1 -1
  240. package/dist/core/tools/ask-user-question/view/components/tab-bar.js.map +1 -1
  241. package/dist/core/tools/ask-user-question/view/dialog-builder.d.ts +8 -8
  242. package/dist/core/tools/ask-user-question/view/dialog-builder.d.ts.map +1 -1
  243. package/dist/core/tools/ask-user-question/view/dialog-builder.js.map +1 -1
  244. package/dist/core/tools/ask-user-question/view/props-adapter.d.ts +5 -5
  245. package/dist/core/tools/ask-user-question/view/props-adapter.d.ts.map +1 -1
  246. package/dist/core/tools/ask-user-question/view/props-adapter.js.map +1 -1
  247. package/dist/core/tools/ask-user-question/view/tab-components.d.ts +4 -4
  248. package/dist/core/tools/ask-user-question/view/tab-components.d.ts.map +1 -1
  249. package/dist/core/tools/ask-user-question/view/tab-components.js.map +1 -1
  250. package/dist/core/tools/ask-user-question/view/tab-content-strategy.d.ts +9 -9
  251. package/dist/core/tools/ask-user-question/view/tab-content-strategy.d.ts.map +1 -1
  252. package/dist/core/tools/ask-user-question/view/tab-content-strategy.js +2 -2
  253. package/dist/core/tools/ask-user-question/view/tab-content-strategy.js.map +1 -1
  254. package/dist/core/tools/bash.d.ts +2 -2
  255. package/dist/core/tools/bash.d.ts.map +1 -1
  256. package/dist/core/tools/bash.js +9 -1
  257. package/dist/core/tools/bash.js.map +1 -1
  258. package/dist/core/tools/edit-diff.d.ts.map +1 -1
  259. package/dist/core/tools/edit-diff.js.map +1 -1
  260. package/dist/core/tools/edit.d.ts +2 -2
  261. package/dist/core/tools/edit.d.ts.map +1 -1
  262. package/dist/core/tools/edit.js.map +1 -1
  263. package/dist/core/tools/find.d.ts +2 -2
  264. package/dist/core/tools/find.d.ts.map +1 -1
  265. package/dist/core/tools/find.js.map +1 -1
  266. package/dist/core/tools/grep.d.ts +2 -2
  267. package/dist/core/tools/grep.d.ts.map +1 -1
  268. package/dist/core/tools/grep.js.map +1 -1
  269. package/dist/core/tools/index.d.ts +19 -19
  270. package/dist/core/tools/index.d.ts.map +1 -1
  271. package/dist/core/tools/index.js.map +1 -1
  272. package/dist/core/tools/ls.d.ts +2 -2
  273. package/dist/core/tools/ls.d.ts.map +1 -1
  274. package/dist/core/tools/ls.js.map +1 -1
  275. package/dist/core/tools/output-accumulator.d.ts +1 -1
  276. package/dist/core/tools/output-accumulator.d.ts.map +1 -1
  277. package/dist/core/tools/output-accumulator.js.map +1 -1
  278. package/dist/core/tools/read.d.ts +2 -2
  279. package/dist/core/tools/read.d.ts.map +1 -1
  280. package/dist/core/tools/read.js.map +1 -1
  281. package/dist/core/tools/render-utils.d.ts +1 -1
  282. package/dist/core/tools/render-utils.d.ts.map +1 -1
  283. package/dist/core/tools/render-utils.js.map +1 -1
  284. package/dist/core/tools/todos.d.ts +1 -1
  285. package/dist/core/tools/todos.d.ts.map +1 -1
  286. package/dist/core/tools/todos.js.map +1 -1
  287. package/dist/core/tools/tool-definition-wrapper.d.ts +1 -1
  288. package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
  289. package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
  290. package/dist/core/tools/write.d.ts +1 -1
  291. package/dist/core/tools/write.d.ts.map +1 -1
  292. package/dist/core/tools/write.js.map +1 -1
  293. package/dist/index.d.ts +30 -29
  294. package/dist/index.d.ts.map +1 -1
  295. package/dist/index.js +1 -0
  296. package/dist/index.js.map +1 -1
  297. package/dist/main.d.ts +1 -1
  298. package/dist/main.d.ts.map +1 -1
  299. package/dist/main.js +2 -0
  300. package/dist/main.js.map +1 -1
  301. package/dist/migrations.d.ts.map +1 -1
  302. package/dist/migrations.js.map +1 -1
  303. package/dist/modes/index.d.ts +5 -5
  304. package/dist/modes/index.d.ts.map +1 -1
  305. package/dist/modes/index.js.map +1 -1
  306. package/dist/modes/interactive/components/armin.d.ts.map +1 -1
  307. package/dist/modes/interactive/components/armin.js.map +1 -1
  308. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  309. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  310. package/dist/modes/interactive/components/atomic-banner.d.ts +1 -1
  311. package/dist/modes/interactive/components/atomic-banner.d.ts.map +1 -1
  312. package/dist/modes/interactive/components/atomic-banner.js.map +1 -1
  313. package/dist/modes/interactive/components/bash-execution.d.ts +1 -1
  314. package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
  315. package/dist/modes/interactive/components/bash-execution.js.map +1 -1
  316. package/dist/modes/interactive/components/bordered-loader.d.ts +1 -1
  317. package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -1
  318. package/dist/modes/interactive/components/bordered-loader.js.map +1 -1
  319. package/dist/modes/interactive/components/branch-summary-message.d.ts +1 -1
  320. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
  321. package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
  322. package/dist/modes/interactive/components/chat-message-renderer.d.ts +3 -3
  323. package/dist/modes/interactive/components/chat-message-renderer.d.ts.map +1 -1
  324. package/dist/modes/interactive/components/chat-message-renderer.js +1 -1
  325. package/dist/modes/interactive/components/chat-message-renderer.js.map +1 -1
  326. package/dist/modes/interactive/components/chat-transcript.d.ts.map +1 -1
  327. package/dist/modes/interactive/components/chat-transcript.js.map +1 -1
  328. package/dist/modes/interactive/components/compaction-summary-message.d.ts +1 -1
  329. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
  330. package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
  331. package/dist/modes/interactive/components/config-selector.d.ts +2 -2
  332. package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
  333. package/dist/modes/interactive/components/config-selector.js.map +1 -1
  334. package/dist/modes/interactive/components/countdown-timer.d.ts +2 -2
  335. package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -1
  336. package/dist/modes/interactive/components/countdown-timer.js.map +1 -1
  337. package/dist/modes/interactive/components/custom-editor.d.ts +1 -1
  338. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
  339. package/dist/modes/interactive/components/custom-editor.js.map +1 -1
  340. package/dist/modes/interactive/components/custom-message.d.ts +2 -2
  341. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  342. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  343. package/dist/modes/interactive/components/daxnuts.d.ts.map +1 -1
  344. package/dist/modes/interactive/components/daxnuts.js.map +1 -1
  345. package/dist/modes/interactive/components/diff.d.ts.map +1 -1
  346. package/dist/modes/interactive/components/diff.js.map +1 -1
  347. package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
  348. package/dist/modes/interactive/components/dynamic-border.js.map +1 -1
  349. package/dist/modes/interactive/components/earendil-announcement.d.ts.map +1 -1
  350. package/dist/modes/interactive/components/earendil-announcement.js.map +1 -1
  351. package/dist/modes/interactive/components/extension-editor.d.ts +1 -1
  352. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
  353. package/dist/modes/interactive/components/extension-editor.js.map +1 -1
  354. package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
  355. package/dist/modes/interactive/components/extension-input.js.map +1 -1
  356. package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
  357. package/dist/modes/interactive/components/extension-selector.js.map +1 -1
  358. package/dist/modes/interactive/components/footer.d.ts +3 -3
  359. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  360. package/dist/modes/interactive/components/footer.js +1 -1
  361. package/dist/modes/interactive/components/footer.js.map +1 -1
  362. package/dist/modes/interactive/components/index.d.ts +34 -34
  363. package/dist/modes/interactive/components/index.d.ts.map +1 -1
  364. package/dist/modes/interactive/components/index.js.map +1 -1
  365. package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
  366. package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
  367. package/dist/modes/interactive/components/login-dialog.d.ts +1 -1
  368. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  369. package/dist/modes/interactive/components/login-dialog.js +1 -1
  370. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  371. package/dist/modes/interactive/components/model-selector.d.ts +2 -2
  372. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  373. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  374. package/dist/modes/interactive/components/oauth-selector.d.ts +1 -1
  375. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  376. package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  377. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  378. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  379. package/dist/modes/interactive/components/session-selector-search.d.ts +1 -1
  380. package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
  381. package/dist/modes/interactive/components/session-selector-search.js.map +1 -1
  382. package/dist/modes/interactive/components/session-selector.d.ts +3 -3
  383. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  384. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  385. package/dist/modes/interactive/components/settings-selector.d.ts +3 -1
  386. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  387. package/dist/modes/interactive/components/settings-selector.js +13 -0
  388. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  389. package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -1
  390. package/dist/modes/interactive/components/show-images-selector.js.map +1 -1
  391. package/dist/modes/interactive/components/skill-invocation-message.d.ts +1 -1
  392. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
  393. package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
  394. package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -1
  395. package/dist/modes/interactive/components/theme-selector.js.map +1 -1
  396. package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
  397. package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
  398. package/dist/modes/interactive/components/tool-execution.d.ts +1 -1
  399. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  400. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  401. package/dist/modes/interactive/components/tree-selector.d.ts +1 -1
  402. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  403. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  404. package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
  405. package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
  406. package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
  407. package/dist/modes/interactive/components/user-message.js.map +1 -1
  408. package/dist/modes/interactive/components/working-status.d.ts.map +1 -1
  409. package/dist/modes/interactive/components/working-status.js.map +1 -1
  410. package/dist/modes/interactive/interactive-mode.d.ts +2 -2
  411. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  412. package/dist/modes/interactive/interactive-mode.js +7 -1
  413. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  414. package/dist/modes/interactive/theme/theme.d.ts +1 -1
  415. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  416. package/dist/modes/interactive/theme/theme.js.map +1 -1
  417. package/dist/modes/print-mode.d.ts +1 -1
  418. package/dist/modes/print-mode.d.ts.map +1 -1
  419. package/dist/modes/print-mode.js.map +1 -1
  420. package/dist/modes/rpc/rpc-client.d.ts +5 -5
  421. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  422. package/dist/modes/rpc/rpc-client.js +1 -1
  423. package/dist/modes/rpc/rpc-client.js.map +1 -1
  424. package/dist/modes/rpc/rpc-mode.d.ts +2 -2
  425. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  426. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  427. package/dist/modes/rpc/rpc-types.d.ts +4 -4
  428. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  429. package/dist/modes/rpc/rpc-types.js.map +1 -1
  430. package/dist/package-manager-cli.d.ts.map +1 -1
  431. package/dist/package-manager-cli.js +22 -6
  432. package/dist/package-manager-cli.js.map +1 -1
  433. package/dist/utils/changelog.d.ts +1 -1
  434. package/dist/utils/changelog.d.ts.map +1 -1
  435. package/dist/utils/changelog.js.map +1 -1
  436. package/dist/utils/child-process.d.ts +5 -2
  437. package/dist/utils/child-process.d.ts.map +1 -1
  438. package/dist/utils/child-process.js +9 -7
  439. package/dist/utils/child-process.js.map +1 -1
  440. package/dist/utils/clipboard-image.d.ts.map +1 -1
  441. package/dist/utils/clipboard-image.js.map +1 -1
  442. package/dist/utils/clipboard.d.ts.map +1 -1
  443. package/dist/utils/clipboard.js.map +1 -1
  444. package/dist/utils/exif-orientation.d.ts +1 -1
  445. package/dist/utils/exif-orientation.d.ts.map +1 -1
  446. package/dist/utils/exif-orientation.js.map +1 -1
  447. package/dist/utils/image-convert.d.ts.map +1 -1
  448. package/dist/utils/image-convert.js.map +1 -1
  449. package/dist/utils/image-resize.d.ts.map +1 -1
  450. package/dist/utils/image-resize.js.map +1 -1
  451. package/dist/utils/shell.d.ts.map +1 -1
  452. package/dist/utils/shell.js.map +1 -1
  453. package/dist/utils/syntax-highlight.d.ts.map +1 -1
  454. package/dist/utils/syntax-highlight.js.map +1 -1
  455. package/dist/utils/tools-manager.d.ts.map +1 -1
  456. package/dist/utils/tools-manager.js.map +1 -1
  457. package/dist/utils/version-check.d.ts.map +1 -1
  458. package/dist/utils/version-check.js.map +1 -1
  459. package/dist/utils/windows-self-update.d.ts +3 -0
  460. package/dist/utils/windows-self-update.d.ts.map +1 -0
  461. package/dist/utils/windows-self-update.js +78 -0
  462. package/dist/utils/windows-self-update.js.map +1 -0
  463. package/docs/compaction.md +5 -5
  464. package/docs/custom-provider.md +2 -2
  465. package/docs/development.md +22 -16
  466. package/docs/docs.json +6 -2
  467. package/docs/extensions.md +25 -25
  468. package/docs/index.md +11 -14
  469. package/docs/keybindings.md +5 -5
  470. package/docs/models.md +6 -6
  471. package/docs/packages.md +55 -48
  472. package/docs/prompt-templates.md +5 -5
  473. package/docs/providers.md +10 -10
  474. package/docs/quickstart.md +32 -30
  475. package/docs/rpc.md +9 -9
  476. package/docs/sdk.md +1 -1
  477. package/docs/session-format.md +3 -3
  478. package/docs/sessions.md +11 -11
  479. package/docs/settings.md +18 -15
  480. package/docs/shell-aliases.md +2 -2
  481. package/docs/skills.md +11 -11
  482. package/docs/terminal-setup.md +8 -8
  483. package/docs/termux.md +6 -6
  484. package/docs/themes.md +10 -10
  485. package/docs/tui.md +5 -4
  486. package/docs/usage.md +50 -50
  487. package/docs/windows.md +2 -2
  488. package/docs/workflows.md +695 -0
  489. package/examples/extensions/custom-provider-gitlab-duo/test.ts +1 -1
  490. package/examples/extensions/doom-overlay/doom-component.ts +2 -2
  491. package/examples/extensions/doom-overlay/index.ts +3 -3
  492. package/examples/extensions/overlay-qa-tests.ts +116 -33
  493. package/examples/extensions/overlay-test.ts +9 -3
  494. package/examples/extensions/plan-mode/index.ts +1 -1
  495. package/examples/extensions/subagent/index.ts +1159 -903
  496. package/package.json +6 -4
  497. package/dist/builtin/workflows/skills/workflow/SKILL.md +0 -322
  498. package/dist/builtin/workflows/skills/workflow/references/context-engineering/advanced-evaluation.md +0 -404
  499. package/dist/builtin/workflows/skills/workflow/references/context-engineering/bdi-mental-states.md +0 -313
  500. package/dist/builtin/workflows/skills/workflow/references/context-engineering/context-compression.md +0 -274
  501. package/dist/builtin/workflows/skills/workflow/references/context-engineering/context-degradation.md +0 -208
  502. package/dist/builtin/workflows/skills/workflow/references/context-engineering/context-fundamentals.md +0 -203
  503. package/dist/builtin/workflows/skills/workflow/references/context-engineering/context-optimization.md +0 -197
  504. package/dist/builtin/workflows/skills/workflow/references/context-engineering/evaluation.md +0 -253
  505. package/dist/builtin/workflows/skills/workflow/references/context-engineering/filesystem-context.md +0 -289
  506. package/dist/builtin/workflows/skills/workflow/references/context-engineering/hosted-agents.md +0 -262
  507. package/dist/builtin/workflows/skills/workflow/references/context-engineering/memory-systems.md +0 -221
  508. package/dist/builtin/workflows/skills/workflow/references/context-engineering/multi-agent-patterns.md +0 -259
  509. package/dist/builtin/workflows/skills/workflow/references/context-engineering/project-development.md +0 -293
  510. package/dist/builtin/workflows/skills/workflow/references/context-engineering/tool-design.md +0 -273
  511. package/dist/builtin/workflows/skills/workflow/references/context-engineering.md +0 -23
  512. package/dist/builtin/workflows/skills/workflow/references/design-checklist.md +0 -83
  513. package/dist/builtin/workflows/skills/workflow/references/running-workflows.md +0 -159
  514. package/dist/builtin/workflows/skills/workflow/references/sdk-authoring.md +0 -260
@@ -0,0 +1,695 @@
1
+ > Atomic can help you create workflows. Ask it to turn a repeatable process into a tracked multi-stage workflow.
2
+
3
+ # Workflows
4
+
5
+ Workflows let Atomic run reusable multi-stage automation with tracked stages, parallel branches, artifacts, human input, live status, and resumable background execution.
6
+
7
+ Use a workflow when a task should be repeatable, inspectable, resumable, or split across multiple model sessions. For one-off work, the `workflow` tool can also run a tracked single task, parallel fan-out, or chain without creating a saved workflow file.
8
+
9
+ **Key capabilities:**
10
+ - **Tracked stages** - Name each step and inspect it in workflow status and graph views
11
+ - **Parallel branches** - Run independent research, review, or implementation branches concurrently
12
+ - **Context handoffs** - Pass summaries, artifacts, files, and structured outputs between stages
13
+ - **Human input** - Pause for `ctx.ui.input`, `confirm`, `select`, or `editor` decisions during a run
14
+ - **Resumable control** - Interrupt, pause, resume, attach to, or kill workflow runs
15
+ - **Artifacts** - Save large outputs to files instead of pushing everything through model context
16
+ - **Model fallback chains** - Retry important stages on fallback models when providers fail
17
+ - **Package distribution** - Ship workflows through Atomic packages, settings, or conventional directories
18
+
19
+ **Example use cases:**
20
+ - Codebase research with parallel local and external research stages
21
+ - Review/fix loops with independent reviewers and a synthesis stage
22
+ - Release planning with human approval gates
23
+ - Documentation audits that save findings as artifacts
24
+ - Multi-stage migrations with validation and rollback checks
25
+ - Reusable team workflows distributed through npm, git, or project settings
26
+
27
+ ## Table of Contents
28
+
29
+ - [Quick Start](#quick-start)
30
+ - [When to Use Workflows](#when-to-use-workflows)
31
+ - [Workflow Locations](#workflow-locations)
32
+ - [Workflow Configuration](#workflow-configuration)
33
+ - [Package Setup](#package-setup)
34
+ - [Settings](#settings)
35
+ - [Running Workflows](#running-workflows)
36
+ - [Workflow Commands](#workflow-commands)
37
+ - [Monitor and Control Runs](#monitor-and-control-runs)
38
+ - [Direct One-Off Runs](#direct-one-off-runs)
39
+ - [Writing a Workflow](#writing-a-workflow)
40
+ - [Workflow Primitives](#workflow-primitives)
41
+ - [Task and Stage Options](#task-and-stage-options)
42
+ - [Programmatic Usage](#programmatic-usage)
43
+ - [Context Engineering](#context-engineering)
44
+ - [Design Checklist](#design-checklist)
45
+ - [Common Mistakes](#common-mistakes)
46
+
47
+ ## Quick Start
48
+
49
+ Create `.atomic/workflows/explain-file.ts` in a project:
50
+
51
+ ```ts
52
+ import { defineWorkflow } from "@bastani/workflows";
53
+
54
+ export default defineWorkflow("explain-file")
55
+ .description("Explain a file with tracked workflow stages.")
56
+ .input("path", {
57
+ type: "text",
58
+ required: true,
59
+ description: "File path to explain.",
60
+ })
61
+ .run(async (ctx) => {
62
+ const explanation = await ctx.task("explain", {
63
+ prompt: `Read ${String(ctx.inputs.path)} and explain purpose, risks, and key symbols.`,
64
+ context: "fresh",
65
+ });
66
+
67
+ return { explanation: explanation.text };
68
+ })
69
+ .compile();
70
+ ```
71
+
72
+ Restart Atomic or run `/reload`, then list and run it:
73
+
74
+ ```text
75
+ /workflow list
76
+ /workflow inputs explain-file
77
+ /workflow explain-file path="src/index.ts"
78
+ ```
79
+
80
+ Named workflow runs are background-oriented. After launch, expect a run id and monitor it with `/workflow status`, F2, or `/workflow connect <run-id>`.
81
+
82
+ ## When to Use Workflows
83
+
84
+ Workflows are a good fit when you need:
85
+
86
+ - named stages that appear in status and graph views
87
+ - sequential or parallel work with explicit handoffs
88
+ - long-running or resumable background execution
89
+ - human approval or missing information during a run
90
+ - saved artifacts for later inspection
91
+ - model fallback chains for important stages
92
+ - reusable automation that can be launched again with different inputs
93
+
94
+ If the task is only deterministic TypeScript with no LLM/session stage, use a script, custom tool, or extension command instead.
95
+
96
+ | User goal | Use |
97
+ |-----------|-----|
98
+ | Run, inspect, attach to, pause, interrupt, resume, or check status for an existing workflow | `/workflow ...` or `workflow({ action: ... })` |
99
+ | Create or edit reusable automation | a TypeScript workflow definition with `defineWorkflow(...).run(...).compile()` |
100
+ | Track one-off work without saving a workflow file | direct `workflow({ task })`, `workflow({ tasks })`, or `workflow({ chain })` calls |
101
+ | Make a workflow robust | design the stage graph, context handoffs, artifacts, validation gates, model fallbacks, and human approval points before coding |
102
+
103
+ ## Workflow Locations
104
+
105
+ Atomic discovers workflow definitions in this order:
106
+
107
+ | Location | Scope | Notes |
108
+ |----------|-------|-------|
109
+ | `.atomic/extensions/workflow/config.json` | Project | `workflows.<name>.path`; project entries override global entries |
110
+ | `.atomic/workflows/*.{ts,js,mjs,cjs}` | Project | Legacy `.pi/workflows/` is also checked |
111
+ | `~/.atomic/agent/extensions/workflow/config.json` | Global | `workflows.<name>.path` for user-wide configured paths |
112
+ | `~/.atomic/agent/workflows/*.{ts,js,mjs,cjs}` | Global | Legacy `~/.pi/agent/workflows/` is also checked |
113
+ | Installed Atomic packages | Package | Uses package metadata or conventional `workflows/` directories |
114
+ | Bundled workflows | Built-in | Shipped with `@bastani/workflows` |
115
+
116
+ A workflow module may export one default workflow definition and/or named workflow definitions. Discovery checks the default export first, then named exports.
117
+
118
+ ## Workflow Configuration
119
+
120
+ Configured workflow paths live in workflow extension config. Project config paths are relative to the project root. Global config paths are relative to `~/.atomic/agent`.
121
+
122
+ Project config:
123
+
124
+ ```text
125
+ .atomic/extensions/workflow/config.json
126
+ ```
127
+
128
+ Global config:
129
+
130
+ ```text
131
+ ~/.atomic/agent/extensions/workflow/config.json
132
+ ```
133
+
134
+ Example config:
135
+
136
+ ```json
137
+ {
138
+ "workflows": {
139
+ "team": { "path": "./workflows/team.ts" },
140
+ "shared": { "path": "/shared/team/workflows" }
141
+ },
142
+ "defaultConcurrency": 4,
143
+ "maxDepth": 4,
144
+ "persistRuns": true,
145
+ "statusFile": false,
146
+ "resumeInFlight": "ask"
147
+ }
148
+ ```
149
+
150
+ Runtime config defaults:
151
+
152
+ | Key | Default | Purpose |
153
+ |-----|---------|---------|
154
+ | `defaultConcurrency` | `4` | Default concurrency for direct parallel/grouped execution |
155
+ | `maxDepth` | `4` | Maximum workflow nesting depth |
156
+ | `persistRuns` | `true` | Persist run metadata for status/resume/history |
157
+ | `statusFile` | `false` | Write a derived status file; defaults under `.atomic/workflows/status.json` when enabled |
158
+ | `resumeInFlight` | `"ask"` | Behavior when discovering resumable in-flight work |
159
+
160
+ Invalid JSON or invalid shapes produce `CONFIG_INVALID` diagnostics. Missing config files are ignored.
161
+
162
+ ## Package Setup
163
+
164
+ Atomic packages can ship workflows through package metadata or conventional directories. A package manifest can declare workflows next to extensions, skills, prompt templates, and themes:
165
+
166
+ ```json
167
+ {
168
+ "name": "my-atomic-workflows",
169
+ "keywords": ["atomic-package", "pi-package"],
170
+ "atomic": {
171
+ "extensions": ["./src/index.ts"],
172
+ "workflows": ["./workflows"]
173
+ }
174
+ }
175
+ ```
176
+
177
+ Paths are relative to the package root and may use glob patterns. Include `atomic-package` for Atomic package discovery and `pi-package` when you want compatibility with existing package-gallery tooling.
178
+
179
+ For new Atomic package examples, prefer `atomic.workflows` and `atomic.extensions`. `pi.workflows` and `pi.extensions` remain supported for compatibility with existing packages. If no manifest declares workflows, a conventional `workflows/` directory is auto-discovered. Singular `workflow/` is accepted as an alias. App-level config prefers `atomicConfig` where available; legacy `piConfig` is still read as a shim.
180
+
181
+ Convention directory example:
182
+
183
+ ```text
184
+ my-atomic-workflows/
185
+ package.json
186
+ workflows/
187
+ release-plan.ts
188
+ review-loop.ts
189
+ src/
190
+ index.ts
191
+ ```
192
+
193
+ Install packages globally or locally:
194
+
195
+ ```bash
196
+ atomic install npm:my-atomic-workflows
197
+ atomic install git:github.com/user/my-atomic-workflows
198
+ atomic install ./local-workflow-package -l
199
+ ```
200
+
201
+ By default, `atomic install` writes to global settings (`~/.atomic/agent/settings.json`). Use `-l` to write to project settings (`.atomic/settings.json`). Project settings can be committed so a team gets the same workflow package set.
202
+
203
+ To temporarily try a package for one run, use `--extension` or `-e`:
204
+
205
+ ```bash
206
+ atomic -e npm:my-atomic-workflows
207
+ atomic -e ./local-workflow-package
208
+ ```
209
+
210
+ ## Settings
211
+
212
+ Settings can list package sources directly:
213
+
214
+ ```json
215
+ {
216
+ "packages": [
217
+ "npm:my-atomic-workflows@1.0.0",
218
+ "git:github.com/user/team-workflows@v2",
219
+ "./tools/local-workflows"
220
+ ]
221
+ }
222
+ ```
223
+
224
+ Use object form to filter which workflows load from a package:
225
+
226
+ ```json
227
+ {
228
+ "packages": [
229
+ {
230
+ "source": "npm:my-atomic-workflows",
231
+ "workflows": ["workflows/*.ts", "!workflows/experimental/**"]
232
+ }
233
+ ]
234
+ }
235
+ ```
236
+
237
+ `workflows` patterns follow package filtering rules:
238
+
239
+ - Omit `workflows` to load every workflow allowed by the package manifest.
240
+ - Use `[]` to load no workflows from that package.
241
+ - Use `!pattern` to exclude matches.
242
+ - Use `+path` to force-include an exact path.
243
+ - Use `-path` to force-exclude an exact path.
244
+
245
+ You can also run `atomic config` to enable or disable package resources interactively. Workflow package filters are saved as `workflows` patterns in settings.
246
+
247
+ ## Running Workflows
248
+
249
+ List or inspect unfamiliar workflows before running them. If required inputs are missing and cannot be inferred, ask for the missing values before launch:
250
+
251
+ ```ts
252
+ workflow({ action: "list" })
253
+ workflow({ action: "get", workflow: "deep-research-codebase" })
254
+ workflow({ action: "inputs", workflow: "deep-research-codebase" })
255
+ ```
256
+
257
+ Run a named workflow with inputs:
258
+
259
+ ```ts
260
+ workflow({
261
+ action: "run",
262
+ workflow: "deep-research-codebase",
263
+ inputs: { prompt: "map workflow runtime", max_concurrency: 4 },
264
+ })
265
+ ```
266
+
267
+ Slash equivalent:
268
+
269
+ ```text
270
+ /workflow deep-research-codebase prompt="map workflow runtime" max_concurrency=4
271
+ ```
272
+
273
+ Input overrides are bare `key=value` tokens. Values are JSON-parsed when possible, so `count=3`, `flag=true`, and `prompt="multi word value"` preserve useful types. A whole input object can also be passed as one JSON token.
274
+
275
+ In the TUI, `/workflow <name>` opens an input picker when the workflow declares inputs and either no arguments were supplied or required inputs are missing. Supplied values seed the picker. Pass `--no-picker` to skip that interactive flow.
276
+
277
+ ## Workflow Commands
278
+
279
+ ```text
280
+ /workflow list
281
+ /workflow inputs <name>
282
+ /workflow <name> --help
283
+ /workflow <name> [key=value ...]
284
+ /workflow connect [run-id]
285
+ /workflow attach [run-id] [stage-id-or-name]
286
+ /workflow pause [run-id] [stage-id-or-name]
287
+ /workflow status [run-id]
288
+ /workflow status --all
289
+ /workflow interrupt <run-id|--all>
290
+ /workflow kill <run-id|--all>
291
+ /workflow resume <run-id> [stage-id-or-name] [message]
292
+ ```
293
+
294
+ Use `connect` for the workflow graph. Use `attach` when you want a chat pane for a specific stage. Use `interrupt`, `pause`, and `resume` for resumable live work; `resume` on a non-paused run reopens the saved snapshot or overlay. Use `kill` only when the run should be terminated and removed from live history/status. `/workflow status` lists in-flight runs by default; `/workflow status --all` includes retained ended runs.
295
+
296
+ Human-in-the-loop prompts from `ctx.ui.input`, `ctx.ui.confirm`, `ctx.ui.select`, and `ctx.ui.editor` appear in the workflow UI/graph viewer, not as ordinary chat modals.
297
+
298
+ ## Monitor and Control Runs
299
+
300
+ The workflow tool exposes lifecycle controls for non-interactive use:
301
+
302
+ ```ts
303
+ workflow({ action: "status" })
304
+ workflow({ action: "status", runId: "<id-or-prefix>" })
305
+
306
+ workflow({ action: "interrupt", runId: "<id-or-prefix>" })
307
+ workflow({ action: "interrupt", all: true })
308
+
309
+ workflow({ action: "resume", runId: "<id-or-prefix>" })
310
+ workflow({ action: "resume", runId: "<id-or-prefix>", stageId: "review", message: "continue" })
311
+
312
+ workflow({ action: "kill", runId: "<id-or-prefix>" })
313
+ workflow({ action: "kill", all: true })
314
+ ```
315
+
316
+ Control behavior:
317
+
318
+ - `runId` accepts full run ids or unique prefixes for `status`, `interrupt`, `resume`, and `kill`.
319
+ - `interrupt` and `kill` default to the active run when `runId` is omitted.
320
+ - `interrupt` is resumable: it pauses live work when pausable stages exist and keeps the run in live history/status.
321
+ - `resume` can target a stage with `stageId`; the target may be a stage id, unique prefix, or stage name. `message` is forwarded to paused work.
322
+ - `kill` is destructive: it aborts in-flight work and removes the run from live history/status.
323
+
324
+ Use slash commands for graph connect and stage attach because those are interactive TUI surfaces. When a run needs user input or attention, surface that to the user instead of polling silently.
325
+
326
+ ## Direct One-Off Runs
327
+
328
+ Use direct workflow-native orchestration for one-off tracked work that does not need a reusable workflow file.
329
+
330
+ Single tracked task:
331
+
332
+ ```ts
333
+ workflow({
334
+ task: {
335
+ name: "review",
336
+ task: "Review this patch for API risks.",
337
+ context: "fresh",
338
+ output: "reviews/api.md",
339
+ },
340
+ async: true,
341
+ intercom: { delivery: "result" },
342
+ })
343
+ ```
344
+
345
+ Parallel fan-out:
346
+
347
+ ```ts
348
+ workflow({
349
+ tasks: [
350
+ { name: "docs", task: "Review documentation gaps" },
351
+ { name: "risks", task: "Review operational risks" },
352
+ ],
353
+ concurrency: 2,
354
+ outputMode: "file-only",
355
+ async: true,
356
+ })
357
+ ```
358
+
359
+ Dependent chain:
360
+
361
+ ```ts
362
+ workflow({
363
+ task: "Design the workflow SDK migration",
364
+ chain: [
365
+ { name: "research", task: "Research {task}" },
366
+ { name: "plan", task: "Plan from {previous}" },
367
+ ],
368
+ async: true,
369
+ })
370
+ ```
371
+
372
+ Mixed chain with a parallel review step:
373
+
374
+ ```ts
375
+ workflow({
376
+ task: "map the release process",
377
+ chain: [
378
+ { name: "researcher", task: "Research {task}" },
379
+ {
380
+ parallel: [
381
+ { name: "risk-reviewer", task: "Review risks in {previous}" },
382
+ { name: "docs-reviewer", task: "Find documentation gaps in {previous}" },
383
+ ],
384
+ concurrency: 2,
385
+ },
386
+ { name: "planner", task: "Create a plan from {previous}" },
387
+ ],
388
+ async: true,
389
+ intercom: { delivery: "result" },
390
+ })
391
+ ```
392
+
393
+ Direct mode supports top-level/default options and per-task options such as `context`, `forkFromSessionFile`, `model`, `fallbackModels`, `thinkingLevel`, `tools`, `noTools`, `customTools`, `mcp`, `output`, `outputMode`, `reads`, `worktree`, `maxOutput`, `artifacts`, `sessionDir`, `cwd`, and `agentDir`. Direct chains also support `chainName`, `chainDir`, and `failFast`.
394
+
395
+ For large fan-outs, prefer `outputMode: "file-only"` so the parent result contains compact file references instead of full output. Treat intercom payloads from async direct runs as user-visible workflow output.
396
+
397
+ ## Writing a Workflow
398
+
399
+ Workflow files are TypeScript modules that export a compiled definition:
400
+
401
+ ```ts
402
+ import { defineWorkflow } from "@bastani/workflows";
403
+
404
+ export default defineWorkflow("my-workflow")
405
+ .description("Short description shown in workflow listings.")
406
+ .input("prompt", {
407
+ type: "text",
408
+ required: true,
409
+ description: "Task or question for the workflow.",
410
+ })
411
+ .run(async (ctx) => {
412
+ const prompt = String(ctx.inputs.prompt);
413
+
414
+ const scout = await ctx.task("scout", {
415
+ prompt: `Map the relevant context for: ${prompt}`,
416
+ context: "fresh",
417
+ });
418
+
419
+ const reviews = await ctx.parallel(
420
+ [
421
+ { name: "quality", prompt: "Inspect quality risks using this context: {previous}", previous: scout },
422
+ { name: "runtime", prompt: "Inspect runtime concerns using this context: {previous}", previous: scout },
423
+ ],
424
+ { concurrency: 2 },
425
+ );
426
+
427
+ const final = await ctx.task("synthesis", {
428
+ prompt: "Synthesize findings and recommend next steps.",
429
+ previous: reviews,
430
+ });
431
+
432
+ return { summary: final.text, reviewer_count: reviews.length };
433
+ })
434
+ .compile();
435
+ ```
436
+
437
+ Builder basics:
438
+
439
+ - `defineWorkflow("name")` starts a builder; the name must be non-empty.
440
+ - Workflow names normalize for lookup: trim, lowercase, convert whitespace/underscore to hyphen, remove other punctuation, and collapse hyphens.
441
+ - `.description(text)` sets the listing text.
442
+ - `.input(key, schema)` declares typed user inputs.
443
+ - `.run(async (ctx) => { ... })` defines the workflow body.
444
+ - `.compile()` returns the workflow definition for discovery.
445
+
446
+ `prompt` and `task` are aliases for task text. Prefer `prompt` inside authored workflow files because it mirrors lower-level `stage.prompt(...)`; `task` remains useful in direct tool calls and chain examples.
447
+
448
+ A valid workflow must create at least one tracked stage by calling `ctx.task()`, `ctx.chain()`, `ctx.parallel()`, or `ctx.stage()` in its run body. A no-stage workflow is skipped during discovery because it has no graph node to inspect, attach to, interrupt, resume, or render.
449
+
450
+ ### Inputs
451
+
452
+ Supported input schema types are:
453
+
454
+ - `text` / `string`: optional `default: string`
455
+ - `number`: optional `default: number`
456
+ - `boolean`: optional `default: boolean`
457
+ - `select`: required `choices: string[]`, optional `default: string`
458
+
459
+ All schemas support `description` and `required`. Prefer explicit descriptions because `/workflow inputs <name>`, `/workflow <name> --help`, and the input picker show them to the user. Runtime validation rejects unknown keys, missing required values, type mismatches, and select values outside `choices`; it does not coerce strings like `"3"` to numbers.
460
+
461
+ ## Workflow Primitives
462
+
463
+ Prefer high-level primitives because they create tracked graph nodes, provide consistent handoff semantics, and keep workflow definitions easier to read.
464
+
465
+ | Need | Use |
466
+ |------|-----|
467
+ | One LLM/session task with workflow tracking | `ctx.task(name, options)` |
468
+ | Dependent sequential tasks | `ctx.chain(steps, options?)` |
469
+ | Independent concurrent branches | `ctx.parallel(steps, options?)` |
470
+ | Human input during a workflow run | `ctx.ui.input/confirm/select/editor` |
471
+ | Pure deterministic computation, parsing, or file I/O | Plain TypeScript in `.run()` or helpers |
472
+ | Fine-grained session control | `ctx.stage(name, options?)` |
473
+
474
+ Use `previous` and `{previous}` for context handoff. If no placeholder is present, the runtime appends context. Chain defaults are:
475
+
476
+ - first missing task uses `{task}` from chain options or the root direct task
477
+ - later missing tasks use `{previous}`
478
+ - missing tasks in chain-parallel groups use `{previous}`
479
+
480
+ For large handoffs, save artifacts and pass file references instead of full transcripts.
481
+
482
+ ### Fine-Grained Stages
483
+
484
+ Use `ctx.stage(name, options?)` when `ctx.task` is too coarse and you need direct control over the underlying stage session. `StageContext` supports:
485
+
486
+ - prompting and completion: `prompt(text, options?)`, `complete(text, options?)`
487
+ - live input: `steer(text)`, `followUp(text)`, `subscribe(listener)`
488
+ - session metadata: `sessionId`, `sessionFile`
489
+ - model controls: `setModel`, `setThinkingLevel`, `cycleModel`, `cycleThinkingLevel`
490
+ - state access: `agent`, `model`, `thinkingLevel`, `messages`, `isStreaming`
491
+ - tree/context controls: `navigateTree(...)`, `compact(...)`, `abortCompaction()`
492
+ - current operation abort: `abort()`
493
+
494
+ ## Task and Stage Options
495
+
496
+ Common task/stage options include:
497
+
498
+ - `prompt` or `task`
499
+ - `previous` for handoff context
500
+ - `context: "fresh" | "fork"`, `forkFromSessionFile`
501
+ - `model`, `fallbackModels`, `thinkingLevel`, `scopedModels`, `modelRegistry`
502
+ - `tools`, `noTools`, `customTools`, `mcp: { allow?: string[], deny?: string[] }`
503
+ - `output`, `outputMode`, `reads`, `worktree`, `maxOutput`, `artifacts`, `sessionDir`, `cwd`, `agentDir`
504
+ - advanced host-supplied SDK seams: `authStorage`, `resourceLoader`, `sessionManager`, `settingsManager`, `sessionStartEvent`
505
+
506
+ `fallbackModels` retries transient provider/model failures with the primary `model` first, then each fallback, then the current Atomic-selected model when available. It is for rate limits, quota/auth/provider outages, unavailable models, network timeouts, and 5xx errors — not workflow-code errors, tool failures, validation failures, or cancellations.
507
+
508
+ ## Programmatic Usage
509
+
510
+ `@bastani/workflows` is an Atomic package extension. It registers:
511
+
512
+ - `/workflow <name> key=value ...` for interactive named runs
513
+ - `/workflow connect|attach|pause|interrupt|resume|status|inputs` for live control and inspection
514
+ - the `workflow` tool for agent-initiated orchestration and direct one-off runs
515
+ - `runWorkflow(definition)` for explicit library or script usage
516
+
517
+ Programmatic runner example:
518
+
519
+ ```ts
520
+ import { runWorkflow, type WorkflowOptions } from "@bastani/workflows";
521
+
522
+ const definition = {
523
+ mode: "workflow",
524
+ workflow: "deep-research-codebase",
525
+ inputs: {
526
+ prompt: "map workflow sdk",
527
+ max_partitions: 1,
528
+ max_concurrency: 4,
529
+ },
530
+ } as const;
531
+
532
+ const options: WorkflowOptions = {};
533
+
534
+ await runWorkflow(definition, options);
535
+ ```
536
+
537
+ The programmatic definition object mirrors the workflow tool for named runs (`mode: "workflow"` / `"named"`), direct single-task runs (`"single"`), parallel runs (`"parallel"`), and chain runs (`"chain"`). Direct chains support `chainName` for status/artifact grouping and `chainDir` as a shared directory for relative reads, outputs, and worktree diffs.
538
+
539
+ Use `createRegistry()` when code needs to group definitions explicitly:
540
+
541
+ ```ts
542
+ import { createRegistry, defineWorkflow } from "@bastani/workflows";
543
+
544
+ const alpha = defineWorkflow("alpha")
545
+ .run(async (ctx) => {
546
+ const result = await ctx.task("alpha", { prompt: "Run alpha." });
547
+ return { text: result.text };
548
+ })
549
+ .compile();
550
+
551
+ const registry = createRegistry().register(alpha);
552
+ registry.names();
553
+ registry.get("alpha");
554
+ ```
555
+
556
+ ## Context Engineering
557
+
558
+ A workflow is an information-flow system, not just a list of prompts. Most workflow failures come from missing, stale, oversized, or poorly-routed context. Design every stage boundary deliberately.
559
+
560
+ ### Context Fundamentals
561
+
562
+ Treat context as a finite attention budget. Include only information needed for the current decision, place critical constraints near the beginning or end of prompts, and use progressive disclosure instead of loading every possible reference up front.
563
+
564
+ Common context sources:
565
+
566
+ - **System instructions:** persistent behavior and guardrails.
567
+ - **User inputs:** workflow inputs and human-in-the-loop decisions.
568
+ - **Retrieved documents:** files, search results, logs, API responses, and artifacts.
569
+ - **Message history:** useful for continuity, but grows quickly in long-running stages.
570
+ - **Tool outputs:** often the largest source of context bloat.
571
+
572
+ For long workflows, assume effective model performance degrades before the advertised context limit. Keep high-signal summaries and artifact references close to the stage that needs them.
573
+
574
+ ### Context Degradation Patterns
575
+
576
+ Watch for these failure modes in long or multi-stage workflows:
577
+
578
+ | Pattern | Symptom | Mitigation |
579
+ |---------|---------|------------|
580
+ | Lost in the middle | Important constraints are ignored in long prompts | Repeat critical constraints near the end; shorten handoffs |
581
+ | Context poisoning | Bad or obsolete information steers later stages | Validate sources, overwrite stale artifacts, cite evidence |
582
+ | Distraction | Irrelevant context crowds out useful context | Pass only stage-specific files and summaries |
583
+ | Confusion | Similar instructions or duplicate facts conflict | Consolidate instructions and name artifacts clearly |
584
+ | Clash | User, system, or stage instructions disagree | Resolve conflicts before launching downstream stages |
585
+
586
+ Use compaction, file references, and bounded loops before context fills with transcript noise.
587
+
588
+ ### Compression and Artifact Handoffs
589
+
590
+ Optimize for tokens per completed task, not simply the smallest prompt. Aggressive compression can force later stages to rediscover information.
591
+
592
+ A good compressed handoff includes:
593
+
594
+ - objective and current status
595
+ - decisions already made
596
+ - files, symbols, commands, and artifact paths with evidence
597
+ - open questions and known risks
598
+ - rejected alternatives when they matter
599
+ - next action expected from the downstream stage
600
+
601
+ Use `output`, `outputMode: "file-only"`, `reads`, and `chainDir` for large research bundles, logs, or reviewer outputs. Keep summaries compact and let downstream stages read full artifacts only when needed.
602
+
603
+ ### Multi-Agent and Parallel Patterns
604
+
605
+ Use parallel stages for context isolation and independent work, not just for role labels. Good parallel branches have distinct evidence-gathering or review angles:
606
+
607
+ - locator / mapper: where relevant files and systems live
608
+ - analyzer: how the current implementation works
609
+ - pattern finder: how similar code is written elsewhere
610
+ - external researcher: what upstream docs or APIs require
611
+ - reviewer/evaluator: whether outputs satisfy the validation contract
612
+
613
+ Have the parent workflow synthesize results rather than letting branches silently make conflicting decisions. If branches must agree, design an explicit consensus or adjudication stage.
614
+
615
+ ### Filesystem Context
616
+
617
+ Use files as the overflow layer for workflow context:
618
+
619
+ ```text
620
+ .atomic/workflows/runs/<run-name>/
621
+ research.md
622
+ reviews/
623
+ correctness.md
624
+ docs.md
625
+ artifacts/
626
+ raw-log.txt
627
+ summary.json
628
+ ```
629
+
630
+ Recommended patterns:
631
+
632
+ - write large tool outputs to files and return concise references
633
+ - store plans, state, and reviewer findings in structured markdown or JSON
634
+ - give parallel branches separate output paths to avoid write conflicts
635
+ - use `grep`, globbing, and line-range reads instead of loading entire logs
636
+ - clean scratch files or keep them under run-specific directories
637
+
638
+ ### Evaluation and Quality Gates
639
+
640
+ Build validation into the workflow instead of waiting for a final manual check. Useful gates include:
641
+
642
+ - deterministic checks: tests, typechecks, linters, schema validation, command exit codes
643
+ - rubric checks: completeness, correctness, evidence quality, risk coverage, user fit
644
+ - reviewer stages: fresh-context reviewers that inspect artifacts and current files
645
+ - LLM-as-judge stages: direct scoring, pairwise comparison, or rubric-based grading for subjective outputs
646
+
647
+ When using LLM judges, mitigate bias by defining score anchors, asking for evidence, calibrating against examples, and keeping length/order effects in mind. Track pass rates and failures over time for reusable workflows.
648
+
649
+ ### Tools, MCP, Memory, and Hosted Execution
650
+
651
+ Constrain each stage to the tools it needs. Too many tools increase ambiguity and token cost; too few tools force brittle workarounds. Tool descriptions should make inputs, side effects, and error handling clear.
652
+
653
+ Use per-stage `mcp` allow/deny lists when a workflow needs external systems but some stages should remain read-only or isolated. Use memory or durable project knowledge only when cross-run continuity is genuinely required; otherwise prefer explicit inputs and artifacts.
654
+
655
+ Hosted or remote agent workflows need additional design work: sandbox setup, dependency caching, auth boundaries, artifact transfer, concurrency limits, and multiplayer/session handoff behavior. Optimize startup before the user begins the run; do not make each stage rebuild its environment.
656
+
657
+ ### Task Fit and Project Design
658
+
659
+ Before turning a process into a workflow, validate that it is a good automation target:
660
+
661
+ | Proceed when | Avoid or redesign when |
662
+ |--------------|------------------------|
663
+ | The task needs synthesis across sources | The task requires exact deterministic computation only |
664
+ | The output is natural language or judgment with a rubric | The workflow must be perfectly deterministic every run |
665
+ | Errors can be caught by review or validation gates | A single hallucination would be unacceptable |
666
+ | Stages can be cached, retried, or inspected | Every step depends on unverified previous guesses |
667
+ | A manual prototype works on representative inputs | The model lacks required context and cannot retrieve it |
668
+
669
+ For complex workflows, structure the implementation as a pipeline: acquire context, prepare prompts/artifacts, process with LLM stages, parse or validate outputs, and render the final result.
670
+
671
+ ## Design Checklist
672
+
673
+ Before implementing or shipping a non-trivial workflow, answer these questions:
674
+
675
+ - **Purpose and fit:** What concrete outcome should the workflow produce? Is the task naturally multi-stage, parallel, resumable, or reusable? What is out of scope?
676
+ - **Inputs:** Which values should be declared as inputs? What is the narrowest schema type? Which defaults are safe?
677
+ - **Stage decomposition:** For each stage, what question does it answer, what context does it need, what output should it return, and what model/tool/MCP requirements does it have?
678
+ - **Information flow:** For every edge between stages, is `previous` enough, or should the handoff use structured returns, files, `reads`, `output`, or `outputMode`?
679
+ - **Context size:** Can downstream stages succeed from the handoff alone? Should large transcripts, logs, or research bundles be summarized or saved as artifacts?
680
+ - **Control flow:** Should the workflow use `ctx.chain`, `ctx.parallel`, `ctx.ui`, bounded loops, `failFast`, or `fallbackModels`?
681
+ - **User experience:** Are stage names readable in status and graph views? Is the final output compact? Are important artifacts saved with stable paths?
682
+ - **Validation:** What success criteria, review gates, deterministic checks, or evaluator stages prove the workflow did the right thing?
683
+
684
+ Good workflows are information-flow systems, not just prompt sequences. Keep stage prompts focused, preserve evidence with file paths or artifacts, and pass only the context each downstream stage needs.
685
+
686
+ ## Common Mistakes
687
+
688
+ - Do not fabricate workflow names; list first.
689
+ - Do not guess input keys; inspect with `inputs` or `get` first.
690
+ - Do not call `create`, `update`, or `delete` on the workflow tool; definitions are code-authored.
691
+ - Do not use legacy workflow tool fields like `agent`, `stage`, or run-control `name`.
692
+ - Do not expect named workflow runs to block the chat turn; they are background tasks.
693
+ - Do not call `kill` when the user asks to interrupt or pause resumably.
694
+ - Keep stage names readable because they appear in workflow status and UI.
695
+ - Return compact structured output and save large artifacts to files.