@bastani/atomic 0.10.9 → 0.10.10-alpha.2

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 (406) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/README.md +226 -163
  3. package/dist/_shared/dist-KOELCESV.js +2 -2
  4. package/dist/_shared/fork-row-index-UAUAQRD5.js +2 -2
  5. package/dist/_shared/lib-4PES5P4V.js +2 -2
  6. package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js +27 -12
  7. package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js.map +1 -1
  8. package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +47 -7
  9. package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js.map +1 -1
  10. package/dist/_shared/mode-shared-2QJSCUM6.js +48 -19
  11. package/dist/_shared/mode-shared-2QJSCUM6.js.map +1 -1
  12. package/dist/_shared/{p1a-prewarm-UQY3X2UK.js → p1a-prewarm-XIU57JHF.js} +5 -5
  13. package/dist/_shared/{p1a-prewarm-UQY3X2UK.js.map → p1a-prewarm-XIU57JHF.js.map} +1 -1
  14. package/dist/_shared/p2-shell-main-B2WIALFD.js +30 -25
  15. package/dist/_shared/p2-shell-main-B2WIALFD.js.map +1 -1
  16. package/dist/_shared/runtime-O4KCSG4C.js +5 -5
  17. package/dist/_shared/{sdk-OSBEPR3Q.js → sdk-RRLVN7ER.js} +15 -9
  18. package/dist/_shared/sdk-RRLVN7ER.js.map +1 -0
  19. package/dist/_shared/session-data-AHTU7IS6.js +2 -2
  20. package/dist/_shared/session-manager-list-2BLEEZVG.js +1 -1
  21. package/dist/_shared/settings-startup-8-DNZ2RIHM.js +4 -1
  22. package/dist/_shared/settings-startup-8-DNZ2RIHM.js.map +1 -1
  23. package/dist/_shared/{startup-0-0-TYUFUOJZ.js → startup-0-0-4VG2G44V.js} +427 -33
  24. package/dist/_shared/startup-0-0-4VG2G44V.js.map +1 -0
  25. package/dist/_shared/{startup-0-1-W2G2UY7R.js → startup-0-1-XTIL65D4.js} +18 -11
  26. package/dist/_shared/startup-0-1-XTIL65D4.js.map +1 -0
  27. package/dist/_shared/{startup-0-2-UXBUEOXW.js → startup-0-2-27OWFHV6.js} +150 -62
  28. package/dist/_shared/startup-0-2-27OWFHV6.js.map +1 -0
  29. package/dist/_shared/startup-0-3-T4DVFYWX.js +15 -25
  30. package/dist/_shared/startup-0-3-T4DVFYWX.js.map +1 -1
  31. package/dist/_shared/{startup-0-4-HN5EB4K7.js → startup-0-4-ZMJV547D.js} +81 -12
  32. package/dist/_shared/startup-0-4-ZMJV547D.js.map +1 -0
  33. package/dist/_shared/startup-0-5-FD2P735I.js +90 -50
  34. package/dist/_shared/startup-0-5-FD2P735I.js.map +1 -1
  35. package/dist/_shared/startup-10-0-TDQNBDDL.js +5 -5
  36. package/dist/_shared/startup-12-0-55AAXBJZ.js +13 -7
  37. package/dist/_shared/startup-12-0-55AAXBJZ.js.map +1 -1
  38. package/dist/_shared/startup-14-0-MLX36RBG.js +4 -4
  39. package/dist/_shared/startup-15-0-YUKGAC63.js +4 -4
  40. package/dist/_shared/startup-15-1-4S7FLMNG.js +88 -28
  41. package/dist/_shared/startup-15-1-4S7FLMNG.js.map +1 -1
  42. package/dist/_shared/startup-8-0-34CBHPZH.js +5 -5
  43. package/dist/_shared/startup-8-1-4KANEHRA.js +61 -17
  44. package/dist/_shared/startup-8-1-4KANEHRA.js.map +1 -1
  45. package/dist/_shared/storage-command-7MGXLJGZ.js +4 -4
  46. package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +2 -2
  47. package/dist/_shared/tree-outline-MUEPK5B7.js +2 -2
  48. package/dist/builtin/intercom/CHANGELOG.md +6 -0
  49. package/dist/builtin/intercom/README.md +87 -116
  50. package/dist/builtin/intercom/broker/broker.bundle.mjs +3 -3
  51. package/dist/builtin/intercom/broker/presence-handler.ts +1 -1
  52. package/dist/builtin/intercom/group.ts +7 -3
  53. package/dist/builtin/intercom/index.bundle.mjs +1 -1
  54. package/dist/builtin/intercom/package.json +1 -1
  55. package/dist/builtin/mcp/README.md +61 -27
  56. package/dist/builtin/mcp/index.bundle.mjs +1 -1
  57. package/dist/builtin/mcp/package.json +1 -1
  58. package/dist/builtin/subagents/CHANGELOG.md +8 -0
  59. package/dist/builtin/subagents/README.md +74 -141
  60. package/dist/builtin/subagents/package.json +1 -1
  61. package/dist/builtin/subagents/src/extension/index.bundle.mjs +213 -74
  62. package/dist/builtin/web-access/CHANGELOG.md +9 -0
  63. package/dist/builtin/web-access/README.md +61 -88
  64. package/dist/builtin/web-access/index.bundle.mjs +387 -351
  65. package/dist/builtin/web-access/package.json +1 -1
  66. package/dist/cli/args.js +2 -2
  67. package/dist/cli/auth-cli.code.js +4 -4
  68. package/dist/cli/auth-cli.impl.js +3 -3
  69. package/dist/cli/auth-cli.js +3 -3
  70. package/dist/cli/blueprint-command.code.js +2 -2
  71. package/dist/cli/blueprint-command.impl.js +3 -3
  72. package/dist/cli/blueprint-command.js +3 -3
  73. package/dist/cli/intercom-command.code.js +3 -3
  74. package/dist/cli/intercom-command.impl.js +3 -3
  75. package/dist/cli/intercom-command.js +3 -3
  76. package/dist/cli/list-models.code.js +3 -3
  77. package/dist/cli/list-models.impl.js +3 -3
  78. package/dist/cli/list-models.js +3 -3
  79. package/dist/cli/session-picker.code.js +2 -2
  80. package/dist/cli/session-picker.impl.js +3 -3
  81. package/dist/cli/session-picker.js +3 -3
  82. package/dist/cli/startup-ui.code.js +2 -2
  83. package/dist/cli/startup-ui.impl.js +3 -3
  84. package/dist/cli/startup-ui.js +3 -3
  85. package/dist/cli/storage-command.impl.js +3 -3
  86. package/dist/cli/storage-command.js +3 -3
  87. package/dist/cli/storage-search-session.code.js +2 -2
  88. package/dist/cli/storage-search-session.impl.js +3 -3
  89. package/dist/cli/storage-search-session.js +3 -3
  90. package/dist/cli/team-command.code.js +2 -2
  91. package/dist/cli/team-command.impl.js +3 -3
  92. package/dist/cli/team-command.js +3 -3
  93. package/dist/cli.js +2 -2
  94. package/dist/core/agent-session-methods.d.ts +4 -1
  95. package/dist/core/agent-session-methods.js.map +1 -1
  96. package/dist/core/agent-session.d.ts +3 -0
  97. package/dist/core/compaction/compactor.d.ts +20 -14
  98. package/dist/core/compaction/errors.d.ts +120 -0
  99. package/dist/core/compaction/index.d.ts +1 -0
  100. package/dist/core/compaction/model-resolver.d.ts +2 -2
  101. package/dist/core/debug.impl.js +3 -3
  102. package/dist/core/debug.js +3 -3
  103. package/dist/core/export-html/card-projection.impl.js +3 -3
  104. package/dist/core/export-html/card-projection.js +3 -3
  105. package/dist/core/export-html/index.code.js +2 -2
  106. package/dist/core/export-html/index.impl.js +3 -3
  107. package/dist/core/export-html/index.js +3 -3
  108. package/dist/core/export-html/json-spans.impl.js +3 -3
  109. package/dist/core/export-html/json-spans.js +3 -3
  110. package/dist/core/export-html/oversized-render-inputs.impl.js +3 -3
  111. package/dist/core/export-html/oversized-render-inputs.js +3 -3
  112. package/dist/core/export-html/tool-renderer.code.js +1 -1
  113. package/dist/core/export-html/tool-renderer.impl.js +3 -3
  114. package/dist/core/export-html/tool-renderer.js +3 -3
  115. package/dist/core/extensions/api-types.d.ts +1 -1
  116. package/dist/core/extensions/api-types.js.map +1 -1
  117. package/dist/core/extensions/index.d.ts +1 -1
  118. package/dist/core/extensions/jiti-loader.impl.js +3 -3
  119. package/dist/core/extensions/jiti-loader.js +3 -3
  120. package/dist/core/extensions/jiti-static-loader.impl.js +3 -3
  121. package/dist/core/extensions/jiti-static-loader.js +3 -3
  122. package/dist/core/extensions/loader-host-modules.code.js +1 -1
  123. package/dist/core/extensions/loader-host-modules.impl.js +3 -3
  124. package/dist/core/extensions/loader-host-modules.js +3 -3
  125. package/dist/core/extensions/loader-virtual-modules.js +1 -1
  126. package/dist/core/extensions/provider-types.d.ts +18 -6
  127. package/dist/core/extensions/provider-types.js.map +1 -1
  128. package/dist/core/extensions/runner-context.js +1 -1
  129. package/dist/core/intercom-broker-control-host.code.js +1 -1
  130. package/dist/core/intercom-broker-control-host.impl.js +3 -3
  131. package/dist/core/intercom-broker-control-host.js +3 -3
  132. package/dist/core/intercom-broker-control.code.js +3 -3
  133. package/dist/core/intercom-broker-control.impl.js +3 -3
  134. package/dist/core/intercom-broker-control.js +3 -3
  135. package/dist/core/model-config.d.ts +40 -0
  136. package/dist/core/model-registry.js +1 -1
  137. package/dist/core/model-resolver-scope.d.ts +4 -4
  138. package/dist/core/model-runtime.d.ts +1 -1
  139. package/dist/core/package-manager-storage-adapters.impl.js +3 -3
  140. package/dist/core/package-manager-storage-adapters.js +3 -3
  141. package/dist/core/provider-composer-internal.d.ts +11 -2
  142. package/dist/core/sdk.code.js +3 -3
  143. package/dist/core/sdk.impl.js +3 -3
  144. package/dist/core/sdk.js +3 -3
  145. package/dist/core/session-manager-core.js +5 -5
  146. package/dist/core/session-manager-list.impl.js +3 -3
  147. package/dist/core/session-manager-list.js +3 -3
  148. package/dist/core/session-manager.code.js +1 -1
  149. package/dist/core/session-manager.impl.js +3 -3
  150. package/dist/core/session-manager.js +3 -3
  151. package/dist/core/session-storage.impl.js +3 -3
  152. package/dist/core/session-storage.js +3 -3
  153. package/dist/core/settings-manager-basic-accessors.d.ts +6 -2
  154. package/dist/core/storage/index.js +2 -2
  155. package/dist/core/storage/node-sqlite-thread.js +2 -2
  156. package/dist/core/storage/node-sqlite.js +2 -2
  157. package/dist/core/storage/offline-snapshot-file.impl.js +3 -3
  158. package/dist/core/storage/offline-snapshot-file.js +3 -3
  159. package/dist/core/storage/provider.js +2 -2
  160. package/dist/core/storage/selection.js +2 -2
  161. package/dist/core/storage/session/branch-fork-source.code.js +2 -2
  162. package/dist/core/storage/session/branch-fork-source.impl.js +3 -3
  163. package/dist/core/storage/session/branch-fork-source.js +3 -3
  164. package/dist/core/storage/session/card-view.impl.js +3 -3
  165. package/dist/core/storage/session/card-view.js +3 -3
  166. package/dist/core/storage/session/child-reader.code.js +3 -3
  167. package/dist/core/storage/session/child-reader.impl.js +3 -3
  168. package/dist/core/storage/session/child-reader.js +3 -3
  169. package/dist/core/storage/session/chunked-resume-projection.impl.js +3 -3
  170. package/dist/core/storage/session/chunked-resume-projection.js +3 -3
  171. package/dist/core/storage/session/expanded-child-details.code.js +2 -2
  172. package/dist/core/storage/session/expanded-child-details.impl.js +3 -3
  173. package/dist/core/storage/session/expanded-child-details.js +3 -3
  174. package/dist/core/storage/session/fork-row-bytes.impl.js +3 -3
  175. package/dist/core/storage/session/fork-row-bytes.js +3 -3
  176. package/dist/core/storage/session/fork-row-index.impl.js +3 -3
  177. package/dist/core/storage/session/fork-row-index.js +3 -3
  178. package/dist/core/storage/session/fork-staging.code.js +2 -2
  179. package/dist/core/storage/session/fork-staging.impl.js +3 -3
  180. package/dist/core/storage/session/fork-staging.js +3 -3
  181. package/dist/core/storage/session/fork-window.code.js +3 -3
  182. package/dist/core/storage/session/fork-window.impl.js +3 -3
  183. package/dist/core/storage/session/fork-window.js +3 -3
  184. package/dist/core/storage/session/history-pages.impl.js +3 -3
  185. package/dist/core/storage/session/history-pages.js +3 -3
  186. package/dist/core/storage/session/jsonl-entry-projection.impl.js +3 -3
  187. package/dist/core/storage/session/jsonl-entry-projection.js +3 -3
  188. package/dist/core/storage/session/jsonl-session-store.impl.js +3 -3
  189. package/dist/core/storage/session/jsonl-session-store.js +3 -3
  190. package/dist/core/storage/session/memory-session-store.impl.js +3 -3
  191. package/dist/core/storage/session/memory-session-store.js +3 -3
  192. package/dist/core/storage/session/pinned-branch-resume.code.js +3 -3
  193. package/dist/core/storage/session/pinned-branch-resume.impl.js +3 -3
  194. package/dist/core/storage/session/pinned-branch-resume.js +3 -3
  195. package/dist/core/storage/session/released-history-files.code.js +3 -3
  196. package/dist/core/storage/session/released-history-files.impl.js +3 -3
  197. package/dist/core/storage/session/released-history-files.js +3 -3
  198. package/dist/core/storage/session/resident-fork-rows.impl.js +3 -3
  199. package/dist/core/storage/session/resident-fork-rows.js +3 -3
  200. package/dist/core/storage/session/session-resume.impl.js +3 -3
  201. package/dist/core/storage/session/session-resume.js +3 -3
  202. package/dist/core/storage/session/snapshot-cut.impl.js +3 -3
  203. package/dist/core/storage/session/snapshot-cut.js +3 -3
  204. package/dist/core/storage/session/snapshot-history.code.js +3 -3
  205. package/dist/core/storage/session/snapshot-history.impl.js +3 -3
  206. package/dist/core/storage/session/snapshot-history.js +3 -3
  207. package/dist/core/storage/session/sql-session-store.code.js +1 -1
  208. package/dist/core/storage/session/sql-session-store.impl.js +3 -3
  209. package/dist/core/storage/session/sql-session-store.js +3 -3
  210. package/dist/core/storage/session/tree-outline.impl.js +3 -3
  211. package/dist/core/storage/session/tree-outline.js +3 -3
  212. package/dist/core/storage/session/tree-presentation.impl.js +3 -3
  213. package/dist/core/storage/session/tree-presentation.js +3 -3
  214. package/dist/core/storage/storage-status.impl.js +3 -3
  215. package/dist/core/storage/storage-status.js +3 -3
  216. package/dist/core/storage/team.impl.js +3 -3
  217. package/dist/core/storage/team.js +3 -3
  218. package/dist/core/structured-output/index.code.js +1 -1
  219. package/dist/core/structured-output/index.impl.js +3 -3
  220. package/dist/core/structured-output/index.js +3 -3
  221. package/dist/core/tasks/task-completion-entry.impl.js +3 -3
  222. package/dist/core/tasks/task-completion-entry.js +3 -3
  223. package/dist/core/tasks/task-file-history.code.js +3 -3
  224. package/dist/core/tasks/task-file-history.impl.js +3 -3
  225. package/dist/core/tasks/task-file-history.js +3 -3
  226. package/dist/core/tasks/task-reference-archive.code.js +4 -4
  227. package/dist/core/tasks/task-reference-archive.js +3 -3
  228. package/dist/core/tasks/task-reference-identity.code.js +1 -1
  229. package/dist/core/tasks/task-reference-identity.js +3 -3
  230. package/dist/core/tasks/task-reference-stream.impl.js +3 -3
  231. package/dist/core/tasks/task-reference-stream.js +3 -3
  232. package/dist/core/tasks/task-unsaved-answer.impl.js +3 -3
  233. package/dist/core/tasks/task-unsaved-answer.js +3 -3
  234. package/dist/core/tasks/task-view-source.impl.js +3 -3
  235. package/dist/core/tasks/task-view-source.js +3 -3
  236. package/dist/core/tools/read-url.code.js +2 -2
  237. package/dist/core/tools/read-url.impl.js +3 -3
  238. package/dist/core/tools/read-url.js +3 -3
  239. package/dist/core/worktree-snapshot/blob-store.js +2 -2
  240. package/dist/core/worktree-snapshot/errors.code.js +3 -3
  241. package/dist/core/worktree-snapshot/errors.impl.js +3 -3
  242. package/dist/core/worktree-snapshot/errors.js +3 -3
  243. package/dist/core/worktree-snapshot/session-index-reset.impl.js +3 -3
  244. package/dist/core/worktree-snapshot/session-index-reset.js +3 -3
  245. package/dist/extensions/codemode/execute.code.js +1 -1
  246. package/dist/extensions/codemode/execute.impl.js +3 -3
  247. package/dist/extensions/codemode/execute.js +3 -3
  248. package/dist/extensions/codemode/renderer.code.js +2 -2
  249. package/dist/extensions/codemode/renderer.impl.js +3 -3
  250. package/dist/extensions/codemode/renderer.js +3 -3
  251. package/dist/extensions/mcp/cli.code.js +2 -2
  252. package/dist/extensions/mcp/cli.impl.js +3 -3
  253. package/dist/extensions/mcp/cli.js +3 -3
  254. package/dist/extensions/mcp/cli.lazy.code.js +2 -2
  255. package/dist/extensions/mcp/cli.lazy.impl.js +3 -3
  256. package/dist/extensions/mcp/cli.lazy.js +3 -3
  257. package/dist/extensions/mcp/runtime.code.js +1 -1
  258. package/dist/extensions/mcp/runtime.impl.js +3 -3
  259. package/dist/extensions/mcp/runtime.js +3 -3
  260. package/dist/index-extensions.d.ts +1 -1
  261. package/dist/index.d.ts +8 -1
  262. package/dist/index.js +7 -7
  263. package/dist/main-first-time-setup.code.js +2 -2
  264. package/dist/main-first-time-setup.impl.js +3 -3
  265. package/dist/main-first-time-setup.js +3 -3
  266. package/dist/modes/interactive/components/settings-selector-types.d.ts +1 -0
  267. package/dist/modes/interactive/components/settings-selector-types.js.map +1 -1
  268. package/dist/modes/interactive/components/stored-tree-view.code.js +2 -2
  269. package/dist/modes/interactive/components/stored-tree-view.impl.js +3 -3
  270. package/dist/modes/interactive/components/stored-tree-view.js +3 -3
  271. package/dist/modes/interactive/components/user-message-selector-archive.impl.js +3 -3
  272. package/dist/modes/interactive/components/user-message-selector-archive.js +3 -3
  273. package/dist/modes/interactive/theme/color-utils.d.ts +5 -5
  274. package/dist/modes/interactive/theme/theme-loading.d.ts +1 -0
  275. package/dist/modes/interactive-engine/engine-prewarm.js +1 -1
  276. package/dist/modes/interactive-engine/remote-model-catalog.d.ts +1 -0
  277. package/dist/modes/print-mode.js +1 -1
  278. package/dist/modes/rpc/rpc-client-api.d.ts +6 -0
  279. package/dist/modes/rpc/rpc-types.d.ts +29 -2
  280. package/dist/package-manager-cli.code.js +5 -5
  281. package/dist/package-manager-cli.impl.js +3 -3
  282. package/dist/package-manager-cli.js +3 -3
  283. package/dist/rpc-entry.js +1 -1
  284. package/dist/startup-files.json +1 -1
  285. package/dist/startup-stages/5.js +1 -1
  286. package/dist/startup-stages/7.js +1 -1
  287. package/dist/startup-stages/8.js +1 -2
  288. package/dist/startup-stages/9.js +2 -1
  289. package/dist/utils/native-module.d.ts +44 -0
  290. package/dist/utils/startup-database-spare.code.js +3 -3
  291. package/dist/utils/startup-database-spare.impl.js +3 -3
  292. package/dist/utils/startup-database-spare.js +3 -3
  293. package/dist/utils/tools-manager.code.js +1 -1
  294. package/dist/utils/tools-manager.impl.js +3 -3
  295. package/dist/utils/tools-manager.js +3 -3
  296. package/docs/background-tasks.md +238 -243
  297. package/docs/build.md +21 -15
  298. package/docs/changelog.mdx +1 -1
  299. package/docs/codemode.md +68 -51
  300. package/docs/compaction/reference.md +65 -26
  301. package/docs/compaction.md +118 -66
  302. package/docs/computer-use.md +179 -146
  303. package/docs/containerization.md +87 -33
  304. package/docs/custom-provider/api-reference.md +152 -13
  305. package/docs/custom-provider/oauth.md +45 -28
  306. package/docs/custom-provider/override.md +14 -7
  307. package/docs/custom-provider/registration.md +77 -67
  308. package/docs/custom-provider/streaming.md +42 -19
  309. package/docs/custom-provider.md +26 -62
  310. package/docs/development.md +81 -42
  311. package/docs/docs.json +54 -38
  312. package/docs/environment-variables.md +92 -64
  313. package/docs/extensions/api-reference.md +326 -735
  314. package/docs/extensions/authoring.md +186 -269
  315. package/docs/extensions/events.md +308 -375
  316. package/docs/extensions/examples.md +122 -74
  317. package/docs/extensions/ui.md +217 -197
  318. package/docs/extensions.md +189 -259
  319. package/docs/getting-started/authentication.md +27 -14
  320. package/docs/getting-started/first-session.md +25 -26
  321. package/docs/getting-started/installation.md +62 -84
  322. package/docs/getting-started/project-instructions.md +39 -14
  323. package/docs/guides/configuration.md +62 -20
  324. package/docs/guides/intercom.md +20 -12
  325. package/docs/guides/non-interactive.md +31 -16
  326. package/docs/guides/orchestration.md +17 -9
  327. package/docs/guides/resume-on-any-machine.md +63 -52
  328. package/docs/guides/subagents.md +26 -14
  329. package/docs/guides/team-setup.md +49 -27
  330. package/docs/guides.md +30 -23
  331. package/docs/herdr.md +22 -17
  332. package/docs/index.md +24 -17
  333. package/docs/intercom/operations.md +90 -66
  334. package/docs/intercom/reference.md +219 -192
  335. package/docs/intercom.md +111 -92
  336. package/docs/json.md +73 -71
  337. package/docs/keybindings.md +74 -48
  338. package/docs/libraries/agent-core.md +52 -9
  339. package/docs/libraries/ai.md +90 -63
  340. package/docs/libraries/codemode.md +31 -8
  341. package/docs/libraries/schema.md +12 -9
  342. package/docs/libraries/storage-libsql.md +92 -0
  343. package/docs/libraries/storage-postgres.md +119 -0
  344. package/docs/libraries/telemetry.md +42 -9
  345. package/docs/libraries/tui.md +74 -94
  346. package/docs/libraries.md +25 -8
  347. package/docs/llama-cpp.md +38 -33
  348. package/docs/mcp-servers.md +140 -88
  349. package/docs/models/reference.md +53 -36
  350. package/docs/models-configuration.md +19 -13
  351. package/docs/models.md +102 -87
  352. package/docs/orchestration/migrating-workflows.md +22 -20
  353. package/docs/orchestration/patterns.md +36 -21
  354. package/docs/orchestration.md +24 -21
  355. package/docs/packages/authoring.md +29 -18
  356. package/docs/packages/reference.md +77 -16
  357. package/docs/packages.md +34 -34
  358. package/docs/programmatic.md +28 -21
  359. package/docs/prompt-templates.md +65 -41
  360. package/docs/providers/reference.md +36 -20
  361. package/docs/providers.md +78 -76
  362. package/docs/quickstart.md +42 -54
  363. package/docs/reference/cli.md +256 -254
  364. package/docs/reference.md +30 -23
  365. package/docs/rpc/examples.md +121 -17
  366. package/docs/rpc/extension-ui.md +86 -63
  367. package/docs/rpc/protocol.md +817 -358
  368. package/docs/rpc.md +78 -152
  369. package/docs/sdk/reference.md +309 -73
  370. package/docs/sdk/storage.md +614 -0
  371. package/docs/sdk/structured-decisions.md +168 -65
  372. package/docs/sdk/web-server.md +80 -46
  373. package/docs/sdk.md +168 -215
  374. package/docs/security.md +117 -44
  375. package/docs/session-format.md +127 -76
  376. package/docs/sessions.md +155 -113
  377. package/docs/settings.md +293 -205
  378. package/docs/shell-aliases.md +15 -6
  379. package/docs/skills/authoring.md +17 -9
  380. package/docs/skills/reference.md +23 -21
  381. package/docs/skills.md +148 -97
  382. package/docs/storage.md +172 -260
  383. package/docs/subagents/authoring.md +148 -15
  384. package/docs/subagents/reference.md +105 -29
  385. package/docs/subagents.md +247 -250
  386. package/docs/terminal-setup.md +97 -69
  387. package/docs/termux.md +51 -85
  388. package/docs/themes/reference.md +51 -37
  389. package/docs/themes.md +52 -55
  390. package/docs/tmux.md +38 -21
  391. package/docs/tools.md +209 -147
  392. package/docs/tui/reference.md +64 -32
  393. package/docs/tui.md +38 -66
  394. package/docs/usage.md +94 -86
  395. package/docs/verification.md +25 -25
  396. package/docs/web-access.md +106 -54
  397. package/docs/windows.md +55 -57
  398. package/docs/worktree-snapshots.md +82 -74
  399. package/examples/sdk/11-sessions.ts +4 -4
  400. package/package.json +8 -8
  401. package/schemas/models.schema.json +58 -7
  402. package/dist/_shared/sdk-OSBEPR3Q.js.map +0 -1
  403. package/dist/_shared/startup-0-0-TYUFUOJZ.js.map +0 -1
  404. package/dist/_shared/startup-0-1-W2G2UY7R.js.map +0 -1
  405. package/dist/_shared/startup-0-2-UXBUEOXW.js.map +0 -1
  406. package/dist/_shared/startup-0-4-HN5EB4K7.js.map +0 -1
package/docs/subagents.md CHANGED
@@ -1,24 +1,18 @@
1
1
  ---
2
- title: "Subagents"
3
- description: "Run focused Atomic child agents"
2
+ title: "Run subagents"
3
+ sidebarTitle: "Subagents guide"
4
+ description: "Launch bundled or custom subagents in the background, isolate edits in Git worktrees, and control running tasks."
4
5
  ---
5
6
 
6
- # Subagents
7
-
8
- Atomic bundles `@bastani/subagents` so the parent chat can delegate bounded work to specialist child agents in separate sessions. Nothing extra needs to be installed.
7
+ Subagents let your main chat delegate bounded work to specialist agents running in separate sessions. No separate package installation is required.
9
8
 
10
9
  When to delegate:
11
10
 
12
11
  - Delegate independent research, analysis, debugging, or parallel implementation work that can overlap with other steps.
13
- - Keep interactive, exploratory, or immediately blocking tasks in the main chat unless specialist focus or context isolation adds value.
14
- - Every subagent runs in the background. Let completion notices notify the parent instead of polling, and call `subagent({ action: "wait", id })` only when the next step depends on a child's result.
15
-
16
- See [Background tasks](/background-tasks) for the agent panel, `/tasks`, shell output, cancellation, and completion notices.
17
-
18
- ## Where to go next
12
+ - Keep interactive, exploratory, or immediately blocking tasks in your main chat unless specialist focus or context isolation adds value.
13
+ - Every subagent runs in the background. Let completion notices report back instead of polling, and call `subagent({ action: "wait", id })` only when the next step depends on a subagent's result.
19
14
 
20
- - [Custom subagents](/subagents/authoring) explains how to define, scope, and configure custom agents.
21
- - [Subagent reference](/subagents/reference) covers discovery order, `auto` model selection, fallbacks, reasoning levels, and task projection.
15
+ New to subagents? Start with [Subagents overview](/guides/subagents). See [Manage background tasks](/background-tasks) for the agent panel, `/tasks`, shell output, cancellation, and completion notices. For defining custom agents, see [Create custom subagents](/subagents/authoring). For discovery precedence, fallback chains, and configuration keys, see [Subagent reference](/subagents/reference). For embedding subagents in an app, see [Subagent children in the SDK](/sdk#subagent-children).
22
16
 
23
17
  ## Start with natural language
24
18
 
@@ -36,305 +30,282 @@ Run a parallel review: one pass for current behavior, one for failure modes, and
36
30
  Research the upstream library behavior online, then compare it with our local implementation.
37
31
  ```
38
32
 
39
- Atomic chooses the specialist and execution shape (single child, parallel batch, or forked context). For multi-step work, the parent can also launch children from [codemode scripts](#from-codemode-scripts).
33
+ Atomic chooses the specialist and execution shape (single subagent, parallel batch, or forked context). For multi-step coordination, your main session can also launch subagents from [codemode scripts](#from-codemode-scripts).
40
34
 
41
- ## Browse agents
42
-
43
- Run `/agents` (or `/agents <query>`) to inspect project, user, package, and built-in agents:
35
+ ## Bundled agents
44
36
 
45
- - Type to filter by name, description, or source. Select an agent and press `Enter` to view its model, fallbacks, tools, path, and system prompt.
46
- - Press `Esc` to go back to the list, then back to chat.
37
+ | Agent | Purpose | Default context | Edits files? |
38
+ | --- | --- | --- | --- |
39
+ | `codebase-locator` | Find relevant files, directories, tests, configs, and docs. | `fresh` | No |
40
+ | `codebase-analyzer` | Explain code behavior and trace data flow with `file:line` references. | `fresh` | No |
41
+ | `codebase-pattern-finder` | Find similar implementations, conventions, and test patterns. | `fresh` | No |
42
+ | `codebase-research-locator` | Find related `research/` and `specs/` documents. | `fresh` | No |
43
+ | `codebase-research-analyzer` | Extract decisions and active constraints from local docs. | `fresh` | No |
44
+ | `codebase-online-researcher` | Research official docs, libraries, and open-source code online. | `fresh` | Research notes only (no `edit`/`write` tools) |
45
+ | `debugger` | Reproduce a failure, prove root cause, apply the minimal fix, and validate it. | `fresh` | Yes |
46
+ | `code-simplifier` | Simplify recent changes while preserving behavior. | `fresh` | Yes |
47
+ | `worker` | Implement an approved task, validate the change, and escalate scope decisions. | `fork` | Yes |
47
48
 
48
- `/agents` is read-only and never launches or edits agents. It uses the same discovery rules as execution, so shadowed or disabled definitions are hidden. Leaving it open does not mark [Herdr](/herdr) blocked.
49
+ All bundled agents use `model: "auto"` with no pinned fallback chain. Pin a role via `subagents.agentOverrides.<name>.model` in `settings.json` or a per-call `model` argument. A concrete `model` runs only that model plus the agent's own `fallbackModels` (see [Fallback models](/subagents/reference#fallback-models)).
49
50
 
50
- ## Let Atomic choose the child model
51
+ The `worker` agent also enables `defaultProgress: true` (isolated run-scoped `progress.md`), sets `inheritProjectContext: true`, sets `inheritSkills: false`, and loads the `tdd`, `agent-browser`, and `tmux` skills.
51
52
 
52
- All built-in subagents default to `model: "auto"`, which runs your default model (last chosen with `/model`) at its default thinking level, or the launching session's model when no default is set. Per-call `model` overrides the default, and custom agents without `model` inherit normally. See [Automatic model selection](/subagents/reference#automatic-model-selection).
53
+ ### Browse agents with `/agents`
53
54
 
54
- - Providers without configured credentials are skipped before launch and recorded in model attempts.
55
- - A provider that rejects credentials mid-run is skipped for subsequent fallbacks.
56
- - If no candidate in the chain has credentials, launch fails immediately and lists each missing provider. See [Fallbacks and credentials](/models#fallbacks-and-credentials).
55
+ Run `/agents` (or `/agents <query>`) in an interactive session to inspect available agents, grouped in precedence order: **Project**, **User**, **Built-in**, and **Package**. Outside interactive mode, run `subagent({ action: "list" })`.
57
56
 
58
- ## Subagent execution is non-interactive
57
+ - Type to filter by name, description, or source. Select an agent and press `Enter` to view its model, fallbacks, default context, tools, file path, and system prompt.
58
+ - Press `Esc` to return to the list, then back to chat.
59
59
 
60
- Subagent launches start immediately without preview prompts or terminal input across single, parallel, forked, and prompt-template runs. Ask clarifying questions in the parent chat before delegating.
60
+ `/agents` is read-only and never launches or edits agents. It applies the same discovery rules as execution, so shadowed or disabled definitions are hidden. Leaving `/agents` open never marks [Herdr](/herdr) as blocked.
61
61
 
62
- Subagents return their results directly. Atomic does not infer acceptance gates or parse `acceptance-report` blocks, so put required tests, commands, or evidence checks in the task prompt.
62
+ ### Review compositions
63
63
 
64
- ## Background launches and waiting
64
+ Compose specialists from distinct angles and synthesize their findings in your main session:
65
65
 
66
- Every `subagent` launch runs in the background and returns at admission (`reason: "default-background"`) with each child's `taskId` and `intercomTarget` (for example `subagent-worker-1a2b3c4d-1`). Use `intercomTarget` verbatim when messaging a child. Legacy calls that pass `wait` still run in the background, and `wait: { kind: "foreground" }` adds a note pointing to `action: "wait"`.
66
+ | Angle | Specialist |
67
+ | --- | --- |
68
+ | Current behavior and regressions | `codebase-analyzer` with `file:line` citations |
69
+ | Failure modes | `debugger` in inspect-only mode (no edits) |
70
+ | Project conventions | `codebase-pattern-finder` |
71
+ | Prior decisions | `codebase-research-locator` followed by `codebase-research-analyzer` |
72
+ | External API conformance | `codebase-online-researcher` |
67
73
 
68
- ```ts
69
- subagent({ agent: "codebase-analyzer", task: "Trace the auth flow with file references." })
70
- subagent({ action: "wait", id: "<taskId>", budgetMs: 120000 })
71
- subagent({ action: "status", id: "<taskId>" })
74
+ ```text
75
+ Review the current diff with fresh-context specialists: analyze correctness, inspect failure modes without editing, and compare the implementation to existing patterns. Synthesize only issues worth fixing now.
72
76
  ```
73
77
 
74
- - **Waiting.** `subagent({ action: "wait", id: taskId, budgetMs? })` observes an existing task in the same owner up to `budgetMs` (default `tasks.wait.agentBudgetMs`, `30000` ms). Ending a wait on budget or pressing `Esc` leaves the child running. Wait for terminal completion before depending on its result. See [Choosing how long to wait](/background-tasks#choose-how-long-to-wait).
75
- - **Concurrency.** Multiple single-agent launches in one turn share `concurrency` (or the configured parallel limit). Returning from launch or ending a wait does not free a running slot.
76
- - **Heartbeats.** Running children send [task heartbeats](/background-tasks#task-heartbeats) every 15 minutes by default, reporting current tool, idle time, turns, tool calls, and tokens. Override with `heartbeatMs` on the call or task entry (`0` disables).
77
- - **Startup progress and retries.** Before its first turn, `status` reports the exact startup step (`opening its session`, `loading its resources`, `waiting for a resource-admission permit`, `creating its agent session`, `registering on Intercom`, or `dispatching its task`) with elapsed time and a structured `start` field. If startup exceeds `sessionStartTimeoutMs` (default 5 minutes), Atomic marks the attempt `stalled` and retries once after releasing its session.
78
- - **Stalled startup failures.** If a stalled attempt still holds its session after half the budget (capped at 30 seconds), it fails without retrying. Two stalled attempts fail with `Subagent did not start: its start stalled <step> after <N>s and was retried once; the retry stalled <step> after <M>s`.
79
- - **Settled output.** `wait` and `status` append up to 16 KB of output, `Full output: <path>` (a private copy; Atomic keeps the 256 most recent copies in a private temp directory and cleans them on exit), and `Requested output:` when an `output` file was specified. With `outputMode: "file-only"`, only the saved-file reference returns inline.
80
- - **Yielding to user or Intercom.** User steering (`input-needed`) or an inbound Intercom message (`intercom-coordination`) yields active `wait` calls so the parent can respond without cancelling children or queued siblings. You can wait on the task again afterward.
81
- - **Session close and reopen.** Closing a session stops running children. Reopening it automatically restores unfinished children from their saved sessions.
82
-
83
- ## Supervisor coordination
78
+ ## Context and Git worktrees
84
79
 
85
- All built-in specialists include `intercom`. `debugger` and `worker` also include `contact_supervisor` for escalating decisions to the parent. Parent tool allowlists, exclusions, `noTools`, and disabled Intercom still apply. A child without `read` or `search` receives a read-only `session_history` tool after compaction so it can recover its own history (see [Agents without read or search](/compaction#agents-without-read-or-search)).
86
-
87
- - **Supervisor decision waits vs. `intercom` `ask`.** `contact_supervisor({ reason: "need_decision" })` and `interview_request` wait only in the requesting child and resume that same child when the supervisor replies via `intercom({ action: "reply", message: "..." })` (use `pending` and `replyTo` when multiple asks are open). Never relaunch the child to answer it. By contrast, `intercom` `ask` never blocks: it returns at delivery (after any `wait` budget) and delivers late replies as messages.
88
- - **Non-blocking updates.** `intercom` `send` and `contact_supervisor({ reason: "progress_update" })` return immediately without cancelling or disrupting siblings or worktrees.
89
- - **Messaging a running child.** Children register on Intercom before their first turn, retrying while starting if the broker is briefly unreachable (supervisor authorization retries up to 30 seconds across broker restarts before starting without it). Address the child with its name or full ID from `intercom list`, and set `delivery` to `"steer"` (default), `"followUp"`, or `"interrupt"` based on urgency. See [Intercom reference](/intercom/reference#the-intercom-tool) for delivery modes and parameters.
90
- - **Ended and terminal children.** Single-target `intercom` `send` and `ask` calls to completed or failed children return `queued: true` and resume the child (late `ask` replies arrive as messages). Messages to paused or quit children queue until the launching session continues them. Immediate rejection applies only to permanently cancelled (`killed`) children, pattern sends, calls past the resume rate or chain bounds, or an `ask` that hits a still-connected registration marked `replyCapability: "terminal"` before disconnecting. In-flight pending asks fail if the child ends before replying.
91
-
92
- ### Automatic restore on reopen
93
-
94
- If Atomic exits, crashes, or you switch sessions (`/new`, `/resume`, `/fork`), running children stay resumable and relaunch automatically when you reopen the launching session. They keep their Intercom name, group, model, thinking level, original agent definition, `context: "fork"` bridge instructions, and unread queued steering or follow-up messages (delivered once in order).
95
-
96
- Inbound Intercom messages wait while the child restores (see [Intercom operations](/intercom/operations#connection-states-and-recovery)). Finished, paused, quit, and permanently cancelled children are not auto-relaunched, and session forks (`/fork`, `--fork`) never relaunch the original session's children. If a child cannot be restored (for example because its session or agent definition is missing), Atomic emits one recovery notice with its IDs, worktree or branch, `git` inspection commands, and relaunch call, then marks it gone.
97
-
98
- ### Child session storage and worktree snapshots
80
+ ### Fresh vs. forked context
99
81
 
100
- A child keeps its session in the launching session's storage: SQLite by default, or the libSQL or PostgreSQL database you selected. Children resume, wake, and export wherever their parent opens, including another machine sharing the same database.
82
+ - **`context: "fresh"`** starts an isolated child session containing only the agent's prompt and task. Use `fresh` for adversarial reviews and independent research.
83
+ - **`context: "fork"`** branches from your main session's latest settled turn and fails fast if the main session cannot be forked (it never downgrades silently to `fresh`). A forked subagent inherits the main session's model, thinking level, active tool changes, and saved tool outputs without taking ownership of the main session's other subagents or replaying Intercom cards.
101
84
 
102
- A JSONL-backed parent keeps each child's session as a file beside its own session file, and `sessionDir` (or `defaultSessionDir`) keeps fresh children's sessions as files in that directory. A parent that saves nothing (`--no-session` or memory storage) keeps child sessions in memory; a finished child's history moves to a temporary file that Atomic cleans up on exit.
85
+ <Warning>
86
+ When you omit `context` on a parallel `tasks` batch, adding **any** agent with `defaultContext: fork` (such as `worker`) causes the **entire batch** to run in forked context. Pass `context: "fresh"` explicitly if you want fresh-context siblings alongside `worker`, or launch `worker` in a separate call.
87
+ </Warning>
103
88
 
104
- A fresh child's session is marked internal so `/resume`, `atomic -r`, `-c`, and `history://sessions` omit it, while a `context: "fork"` child's session is listed as a fork of its parent. A child's result names its session file or `history://sessions/<id>`. Older sessions saved under `~/.atomic/agent/subagent-sessions/` remain readable in `/tasks` and restorable.
89
+ Use `fork` when a subagent needs the main conversation's decisions and context. A forked subagent sends the exact conversation prefix the main session last sent (system prompt, project context, skills, tools, and messages), followed by its own role, a short handoff note, and its task. When it runs on the main session's same model and thinking level, the first request reads from the main session's prompt cache and pays only for the new suffix. On another model or provider it does not share that cache, and on another thinking level it may share only part of it.
105
90
 
106
- In a blob-capable store, children record [worktree snapshots](/worktree-snapshots) of checkouts they modify. Resuming the parent restores each shared checkout from the newest capture among the parent and its finished children, while named worktrees and restored active children continue from their own snapshots.
91
+ In a fork, `inheritProjectContext` and `inheritSkills` do not hide what the main session already sent; those frontmatter flags apply to fresh subagents. The subagent's own tool allowlist still applies: calling a tool outside its allowed list fails with an error naming the allowed tools. Where the provider supports mid-conversation tool changes, removed or child-only tools are declared after the main conversation; otherwise child-only tools run through `codemode` restricted strictly to the subagent's own tools.
107
92
 
108
- ### Peer coordination
93
+ Fresh subagents inherit the main session's model registry, authentication, and workspace discovery settings. A subagent's tool list can narrow permissions, but it cannot re-enable tools or packages excluded by the main session. See [Subagent children in the SDK](/sdk#subagent-children) for programmatic child configuration.
109
94
 
110
- Peer-to-peer coordination is the default. Siblings in a parallel batch, or sharing an explicit `group`, discover each other with `intercom({ action: "list" })` and communicate directly with `send` and `ask` instead of routing through the supervisor.
95
+ ### Temporary worktrees
111
96
 
112
- - Share findings, divide file ownership or expensive test runs, reuse verified reproductions, and challenge disagreements with evidence. Each child still returns its own complete result.
113
- - Reserve `contact_supervisor` for supervisor decisions. Ordinary Intercom group boundaries and user approval gates still apply. Peer asks and one blocking supervisor ask can wait concurrently. See `/skill:intercom` for peer patterns.
97
+ Pass `worktree: true` on a parallel `tasks` call to isolate each subagent's edits in its own temporary Git worktree:
114
98
 
115
99
  ```typescript
116
- const peerRules =
117
- "Your siblings review the same diff. Run intercom list to find them, share every confirmed finding, " +
118
- "ask them whatever you need, and debate disagreements with evidence. Then return your own structured verdict.";
119
-
120
100
  subagent({
101
+ worktree: true,
121
102
  tasks: [
122
- { agent: "reviewer", task: `Review correctness of the auth changes. ${peerRules}` },
123
- { agent: "reviewer", task: `Review security of the auth changes. ${peerRules}` },
124
- { agent: "reviewer", task: `Review test coverage of the auth changes. ${peerRules}` },
103
+ { agent: "worker", task: "Implement the parser changes." },
104
+ { agent: "worker", task: "Implement the CLI flag changes." },
125
105
  ],
126
- });
106
+ })
127
107
  ```
128
108
 
129
- ### Scaling a swarm
130
-
131
- Atomic supports large parallel swarms organized into peer-coordinating teams:
132
-
133
- - **Parallel limits.** `parallel.maxTasks`, `parallel.concurrency`, and `parallel.runningCapacity` each default to `1000` with no hard upper cap. Raise all three in `config.json` to exceed 1,000, or lower `parallel.concurrency` to throttle. Provider rate limits and host memory remain practical bounds.
134
- - **Nesting.** Delegation is strictly one level deep. Only the parent launches children.
135
- - **Teams.** Intercom groups have no member cap. Assign each team its own `group` for internal messaging; members can still reach the parent via `contact_supervisor`.
136
-
137
- ### Single-child handoff without a task host
138
-
139
- In an SDK session without a task host, a single child runs directly while `subagent` waits. A claimed parent-targeted blocking request ends the child and returns its question, attachments, identity, and `[TASK_CONTEXT]` so the parent can launch a fresh child (`subagent({ agent: "worker", task: "[TASK_CONTEXT] ... Continue with this supervisor answer: ..." })`). Every other child continues in place when answered.
109
+ Key rules for `worktree: true`:
140
110
 
141
- ## Migration from acceptance gates
111
+ - **Parallel mode only.** `worktree: true` creates temporary isolated worktrees only for parallel `tasks: [...]` runs (or multiple single-agent calls combined in one assistant message). On a standalone single-agent `{ agent, task }` call, `worktree: true` has no effect and the subagent runs in the main checkout; use `worktree: { branch }` for an isolated single-agent worktree.
112
+ - **Clean tracked working tree required.** Launch fails before starting any subagent if tracked files have staged or unstaged edits (`git status --porcelain --untracked-files=no`). Untracked files do not block launch.
113
+ - **Base branch.** Temporary worktrees branch from `origin/<default-branch>` (fetching if needed) and fall back to `HEAD` only if no origin default branch is found, rather than branching from your current local `HEAD`.
114
+ - **Automatic post-creation setup.** After creating each temporary worktree, Atomic automatically copies `.atomic/settings.local.json` and any untracked `.atomic/settings.json`, configures Git `core.hooksPath` to share `.husky` or `.git/hooks`, symlinks (or creates a junction on Windows for) `node_modules`, copies gitignored files listed in `.worktreeinclude`, and runs `worktreeSetupHook` if configured in [config.json](/subagents/reference#subagent-config-json-reference).
115
+ - **No per-task `cwd` overrides.** All tasks in a `worktree: true` batch must share the same `cwd`; per-task `cwd` overrides that differ from the shared `cwd` are rejected.
116
+ - **Patch capture and cleanup.** Once every subagent in the batch finishes, Atomic saves each subagent's changes as a patch under `worktree-diffs/<run-id>` and removes the temporary worktrees and branches. If capturing a worktree's patch fails, Atomic keeps that worktree on disk and reports it in the diff summary so changes are not lost.
117
+ - **Paused, quit, and cancelled subagents.** Paused, quit, or session-closed subagents keep their temporary worktree only if it has uncommitted changes, untracked files, or new commits. Clean worktrees are removed; `resume` recreates them from base plus the saved patch and writes later patches as `task-<n>-<agent>.<execution>.patch`. Permanently cancelled subagents release their worktrees, and unresumed stopped worktrees with changes remain under `.atomic/worktrees/`.
118
+ - **Waiting on cleanup.** `pause`, `quit`, completion, and failed resume wait for Git cleanup. Pressing `Esc` stops waiting without cancelling cleanup; cleanup taking over 10 seconds warns and continues in the background. Never delete a worktree directory while `worktreeNote` reports pending cleanup or a sibling hold, or after a crash without checking for orphaned Git processes.
119
+ - **Git hook integration.** Git filters and hooks can check `ATOMIC_SUBAGENT_WORKTREE_PHASE=finishing` during teardown. Extension authors can also subscribe to `subagent:finishing`; see [Subagent reference](/subagents/reference#sdk-integration-and-errors).
142
120
 
143
- If older calls or agent definitions still use removed gate fields:
121
+ ### Named worktrees
144
122
 
145
- - Remove `acceptance` from `subagent()` calls and task entries.
146
- - Remove `completionGuard: false` from agent frontmatter (management edits strip it automatically).
147
- - Put required commands, tests, or evidence checks directly in the task prompt.
123
+ Run a single subagent or specific parallel tasks on an explicit branch and directory with `worktree: { branch, base?, path? }`. Named worktrees cannot be combined with `worktree: true`. A top-level named `worktree` object applies to every task in `tasks` that does not set its own `worktree`.
148
124
 
149
- ## Bundled agents
125
+ ```typescript
126
+ subagent({ agent: "worker", task: "Fix the parser", worktree: { branch: "fix/parser" } })
127
+ subagent({
128
+ tasks: [
129
+ { agent: "worker", task: "Add the API", worktree: { branch: "feat/api", base: "origin/main" } },
130
+ { agent: "worker", task: "Add the UI", worktree: { branch: "feat/ui", path: "../ui-worktree" } },
131
+ ],
132
+ })
133
+ ```
150
134
 
151
- | Agent | Purpose | Edits files? |
152
- | --- | --- | --- |
153
- | `codebase-locator` | Find relevant files, directories, tests, configs, and docs. | No |
154
- | `codebase-analyzer` | Explain code behavior and trace data flow with file:line references. | No |
155
- | `codebase-pattern-finder` | Find similar implementations, conventions, and test patterns. | No |
156
- | `codebase-research-locator` | Find related `research/` and `specs/` documents. | No |
157
- | `codebase-research-analyzer` | Extract decisions and active constraints from local docs. | No |
158
- | `codebase-online-researcher` | Research official docs, libraries, and open-source code online. | Research notes only |
159
- | `debugger` | Reproduce a failure, prove root cause, apply the minimal fix, and validate it. | Yes |
160
- | `code-simplifier` | Simplify recent changes while preserving behavior. | Yes |
161
- | `worker` | Implement an approved task, validate the change, and escalate scope decisions. | Yes |
135
+ How named worktrees differ from temporary worktrees:
162
136
 
163
- All bundled agents use `model: "auto"` with no pinned fallback chain. Pin a role via `subagents.agentOverrides.<name>.model` in settings or a per-call `model` argument. A concrete `model` runs only that model plus the agent's own `fallbackModels` (see [Fallback models](/subagents/reference#fallback-models)).
137
+ - **No clean-tree requirement and no automatic post-setup.** Named worktrees work with dirty local checkouts and do not symlink `node_modules`, copy settings or `.worktreeinclude` files, set `core.hooksPath`, run `worktreeSetupHook`, or save diff patches.
138
+ - **Permanent ownership.** Atomic never deletes a named worktree or its branch. Resuming reuses the worktree or checks the branch back out there if removed.
139
+ - **Branch and path rules.** `path` defaults to `.atomic/worktrees/<branch>` (`/` replaced with `+`); relative paths resolve against the caller's `cwd`, and an existing empty directory at `path` is allowed. New branches use `--no-track` and start from `base` (resolved in the caller's worktree), then the current branch's upstream (`@{upstream}`), then `HEAD`. Branch names are validated with `git check-ref-format --branch` and cannot contain `@{`. Unused existing branches check out as-is, and a branch already checked out at `path` is reused. Launch fails fast if the branch is checked out elsewhere or `path` holds something else.
140
+ - **Subdirectory `cwd`.** If your session runs inside a repository subdirectory, the subagent starts in that same subdirectory inside the worktree (falling back to the worktree root if that subdirectory does not exist on the branch).
141
+ - **Concurrency, locks, and recovery.** Different branches and paths run concurrently. Duplicate `(branch, path)` launches wait and reuse; the same branch at a different path fails after the first finishes. Prefer `worktree: { ... }` over running `git worktree add` in the same turn, which can race with sibling tool calls. External `index.lock` files or initializing worktrees time out after 30 seconds (`another git process seems to be running at <path>`). Interrupted previous checkouts fail immediately (`an interrupted named-worktree checkout left an incomplete worktree at <path>`); on Git 2.30 to 2.32, they report busy after 30 seconds. To recover an incomplete checkout, confirm no Git process is running, save needed files, run `git worktree unlock <path>`, remove the directory, run `git worktree prune`, and clear stale `HEAD.lock` or branch `.lock` files (or run `git worktree remove --force --force <path>`). Never fix a partial checkout by deleting only `index.lock`.
164
142
 
165
- ## Review compositions
143
+ ## Background launches and waiting
166
144
 
167
- Compose specialists from distinct angles and synthesize their findings in the parent session:
145
+ Every `subagent` launch runs in the background without interactive preview prompts and returns immediately with each subagent's `taskId` and `intercomTarget` (for example `subagent-worker-1a2b3c4d-1`). Use `intercomTarget` verbatim when messaging a subagent. Legacy calls that pass `wait` still run in the background, and `wait: { kind: "foreground" }` adds a note pointing to `action: "wait"`.
168
146
 
169
- | Angle | Specialist |
170
- | --- | --- |
171
- | Current behavior and regressions | `codebase-analyzer` with file:line citations |
172
- | Failure modes | `debugger` in inspect-only mode (no edits) |
173
- | Project conventions | `codebase-pattern-finder` |
174
- | Prior decisions | `codebase-research-locator` followed by `codebase-research-analyzer` |
175
- | External API conformance | `codebase-online-researcher` |
147
+ Subagents return their results directly. Atomic does not infer acceptance gates or parse `acceptance-report` blocks, so write required tests, commands, or evidence checks directly in the task prompt.
176
148
 
177
- ```text
178
- Review the current diff with fresh-context specialists: analyze correctness, inspect failure modes without editing, and compare the implementation to existing patterns. Synthesize only issues worth fixing now.
149
+ ```ts
150
+ subagent({ agent: "codebase-analyzer", task: "Trace the auth flow with file references." })
151
+ subagent({ action: "wait", id: "<taskId>", budgetMs: 120000 })
152
+ subagent({ action: "status", id: "<taskId>" })
179
153
  ```
180
154
 
181
- ## From codemode scripts
182
-
183
- When both `codemode` and `subagent` are active, `tools.subagent()` launches the same background children and resolves at admission, not completion. Admitted children belong to the parent session and continue even if the script returns, throws, or times out. Subagents cannot launch nested children from codemode.
184
-
185
- ```js
186
- const { tasks } = await tools.subagent({
187
- tasks: [
188
- { agent: "worker", task: "Check the examples" },
189
- { agent: "worker", task: "Check the links" },
190
- ],
191
- group: true,
192
- });
193
- store("checks", tasks);
194
- return tasks;
195
- ```
155
+ - **Waiting.** `subagent({ action: "wait", id: taskId, budgetMs? })` observes an existing task launched by this session up to `budgetMs` (default `tasks.wait.agentBudgetMs`, `30000` ms). Ending a wait on budget or pressing `Esc` leaves the subagent running. Wait for completion before depending on its result. See [Choose how long to wait](/background-tasks#choose-how-long-to-wait).
156
+ - **Repeating tasks with `count`.** In parallel `tasks`, set `count` (integer `>= 1`) on a task item to repeat it N times with the same settings. Expanded items count toward `parallel.maxTasks`.
157
+ - **Concurrency.** Multiple single-agent launches in one turn share `concurrency` (or the configured parallel limit). Returning from launch or ending a wait does not free a running slot.
158
+ - **Heartbeats.** Running subagents send [task heartbeats](/background-tasks#task-heartbeats) every 15 minutes by default, reporting current tool, idle time, turns, tool calls, and tokens. Override with `heartbeatMs` on the call or task entry (`0` disables).
159
+ - **Files, progress, and output.** Pass `reads` (single-agent or per-task) to prepend file contents resolved relative to the child's `cwd`. Pass `output` (path or `false`) and `outputMode` (`"inline"` default, or `"file-only"`, which requires an `output` path; duplicate `output` paths in a parallel batch are rejected). Pass `progress: true` to enable an isolated run-scoped `progress.md` under artifact storage (never inside child `cwd` or the repository; omitted inherits the agent's `defaultProgress`, suppressed for read-only tasks unless `progress: true`). Separate `includeProgress: true` adds runtime progress telemetry to the tool result.
160
+ - **Settled output.** `wait` and `status` return up to 16 KB inline, plus `Full output: <path>` (Atomic keeps the 256 most recent copies in a private temp directory and cleans them on exit) and `Requested output:` when `output` was set. With `outputMode: "file-only"`, only the saved-file reference returns inline.
161
+ - **Yielding to user or Intercom.** User steering (`input-needed`) or an inbound Intercom message (`intercom-coordination`) yields active `wait` calls so the main session can respond without cancelling running or queued subagents. Wait again afterward if you still need the result.
162
+ - **Startup progress and retries.** Before a subagent's first turn, `status` reports its exact startup step (`opening its session`, `loading its resources`, `waiting for a resource-admission permit` while waiting for a session slot, `creating its agent session`, `registering on Intercom`, or `dispatching its task`) with elapsed time. If startup exceeds `sessionStartTimeoutMs` (default 5 minutes), Atomic marks the attempt stalled and retries once after releasing its session. If a stalled attempt still holds its session after half the budget (capped at 30 seconds), it fails without retrying. Two stalled attempts fail with `Subagent did not start: its start stalled <step> after <N>s and was retried once; the retry stalled <step> after <M>s`.
163
+ - **Session close and reopen.** Closing a session stops running subagents. Reopening it automatically restores running subagents from their saved sessions.
196
164
 
197
- Single `{ agent, task }` and parallel `{ tasks }` calls both return `{ action: "launch", tasks }`. Each slot has `agent`, `state` (`admitted`, `queued`, or `refused` with `reason`), `taskId`, `childId`, and `intercomTarget` when available. Do not retry already-admitted siblings if one slot is refused.
165
+ ### Task inspection
198
166
 
199
- - **`list`, `get`, and `models`.** Inspect executable `agents`, matching `definitions`, or the model catalog (`fullId`, `isCurrent`, `availableThinkingLevels`). Creating, updating, or deleting agent definitions requires a direct tool call.
200
- - **`status`.** Returns `children` launched by this session (pass `id` for one child) with state and any `resumeCall`. Use `status` after reopening a parent to rediscover children instead of relaunching.
201
- - **`wait`.** Takes a task `id` and optional `budgetMs` (default 30 seconds, even if the owner waits indefinitely; `0` checks immediately). Script timeouts cancel `wait`, not the child. Returns `outcome: "settled"` (with `childId`, `result.status`, output excerpt, `outputPath`, and `resumeCall`) or `running`.
202
- - **`pause`, `quit`, and `resume`.** `pause` and `quit` accept `id` or `all: true`. `resume` takes `id` and optional `message` and returns the new task ID in `children`. Always pass `id` rather than the legacy `runId` alias.
203
- - **Temporary worktrees.** `status` can show `finishing` while `wait` still returns `running`. Check `worktreeNote` or `worktreeNotes` before removing any worktree directory.
167
+ Use `/tasks` (or `/tasks <id>`) or the agent panel below the prompt (`↓` on an empty prompt) to inspect running, waiting, and finished subagents and their nested shells.
204
168
 
205
- ## Waiting and control
169
+ - **Switch to a subagent.** Select a subagent row and press `Enter` (or click it) to view its live transcript and message it on the same chat screen. Press `←` on an empty prompt or select `main` in the panel to return without interrupting the subagent.
170
+ - **Pause or stop.** While viewing a working subagent, press `Esc` (or `Ctrl+C` on an empty prompt) to pause its active turn without affecting main chat. In `/tasks` or the agent panel, press `x` twice within 3 seconds to stop a running task resumably (red `◯` stopped mark), or `x` once to dismiss a finished row.
171
+ - **Subagent shells and hints.** A subagent's running shells nest underneath it in the agent panel. On a subagent's page in `/tasks`, backgrounded shell blocks show a clickable `· /tasks to manage` hint that opens that subagent's own task list. While viewing a released subagent waiting on a shell, the newest waited shell shows a clickable `· alt+w opens it` hint.
172
+ - **Questions in subagents.** A subagent's `ask_user_question` or extension dialog waits inside that subagent's transcript (**Needs input**) without blocking the main chat. SDK hosts without a task inspector route `humanInput` by `sessionId` ([Human input without a terminal](/sdk#human-input-without-a-terminal)).
173
+ - **Launch cards and status history.** Each subagent renders `Agent(<agent> · <short task title>)` with state, active elapsed time, and tokens (`Ctrl+O` expands prompt, tool calls, and result). Live progress, `/tasks`, and `status` show the resolved model and clamped reasoning effort. Atomic keeps live status for the 256 most recently finished runs plus all active runs; older subagents remain resumable via `subagent({ action: "resume", id })`.
206
174
 
207
- - **Working line (`∀`).** Shows the `∀` status line with verb, elapsed time, and tokens (`↑` waiting for content, `↓` streaming; zero counts stay hidden) for whichever agent you are viewing. Retries and fallbacks continue the same count, and switching away and back keeps elapsed time.
208
- - **Launch cards.** Each child renders `Agent(<agent> · <short task title>)` with state, elapsed time (dispatch to finish, stop, or release, excluding queue and cleanup time), and tokens. Press `Ctrl+O` to expand prompt, tool calls, and result; collapsed cards release those fields from memory. Parallel launches show one card per child and fail only if zero children start.
209
- - **Model metadata.** Live progress, `/tasks`, and run status show each step's resolved model and capability-clamped reasoning effort (including fast model IDs like `openai-codex/gpt-5.6-sol-fast · thinking medium`). Compact launch cards and completion notices omit the model line to save space while persisting metadata in saved details.
210
- - **Status history.** Atomic retains in-process status for the 256 most recent finished runs, and always keeps active runs. Older children remain resumable via `subagent({ action: "resume", id })`.
211
- - **Cancelling a parent turn.** Pressing `Esc` in the parent ends `action: "wait"`, not the child. In an SDK session without a task host, cancelling the waiting `subagent` call stops children permanently and returns labelled partial findings (`progress.md`, last assistant text, or artifact paths).
175
+ See [Manage background tasks](/background-tasks), [Viewing a subagent](/background-tasks#viewing-a-subagent), and [Shells started by subagents](/background-tasks#shells-started-by-subagents) for the full panel layout, key bindings, command-routing table, and `/tasks` controls.
212
176
 
213
177
  ### Run control
214
178
 
215
- Control children with `pause`, `quit`, and `resume`. The `id` parameter accepts a child ID (`<runId>:<index>`), task ID, Intercom name, or single-child run ID:
179
+ Control subagents with `pause`, `quit`, and `resume`. The `id` parameter accepts a child ID (`<runId>:<index>`), task ID, Intercom name, or single-child run ID:
216
180
 
217
181
  ```ts
218
182
  subagent({ action: "pause", id: "<child-id>" }) // Stop now; hold queued messages for resume
219
- subagent({ action: "pause", all: true }) // Pause all running children of this session
183
+ subagent({ action: "pause", all: true }) // Pause all running subagents of this session
220
184
  subagent({ action: "quit", id: "<child-id>" }) // Graceful stop; stays resumable
221
- subagent({ action: "quit", all: true }) // Covers running and already-paused children
185
+ subagent({ action: "quit", all: true }) // Covers running and already-paused subagents
222
186
  subagent({ action: "resume", id: "<child-id>", message: "Focus on the failing test first." })
223
187
  ```
224
188
 
225
- - **`pause`.** Stops the active turn and keeps queued steering or follow-up messages to deliver once in order before `resume`'s `message`. Intercom messages to a paused child do not resume it; they wait with no time limit and reach it after `resume`'s `message`.
226
- - **`quit`.** Stops the child gracefully, including paused children, while keeping it resumable.
227
- - **Awaiting resume.** Paused and quit children report `paused · awaiting resume` (`Subagent worker quit · paused, awaiting resume: ...` with `Stop reason: quit` or `pause`) and include the exact `subagent({ action: "resume", id: "<child-id>" })` call. `status` lists them under **Awaiting resume** across restarts without auto-relaunching. Completed and failed notices state that execution ended and also provide the `resume` call and Intercom name.
228
- - **Queued parallel children.** You can `pause` or `quit` a child still waiting for a concurrency slot. `resume` starts it with its original task, optional `message`, model, thinking level, worktree, and fork copy, and re-enters the concurrency queue. If its original model or fork copy no longer exists, `resume` reports it as gone instead of substituting silently.
229
- - **`resume`.** Continues the child's saved session under the same child ID, Intercom name, and group with fresh supervisor auth (`all: true` is not supported). For paused, quit, or interrupted children, `message` runs before continuing. For completed or failed children, `message` starts a fresh turn. Omitting `message` prompts the child to continue or stop if done.
230
- - **Resumable vs. terminal.** Paused, quit, interrupted, completed, failed, and session-closed children are resumable. **Killed** (explicit owner or batch cancellation) and **Gone** (unrestorable after restart) children are terminal and reject `resume`. Running children also reject `resume` (`<agent> (<child-id>, <intercom-name>) is already running as task <task-id>; pause or quit it first.`); use Intercom to message a running child. Failed resumes preserve `worktree: true` checkouts.
189
+ - **`pause`.** Stops the active turn and keeps queued steering or follow-up messages to deliver once in order before `resume`'s `message`. Intercom messages to a paused subagent do not resume it; they wait with no time limit and reach it after `resume`'s `message`.
190
+ - **`quit`.** Stops the subagent gracefully, including paused subagents, while keeping it resumable.
191
+ - **Awaiting resume.** Paused and quit subagents report `paused · awaiting resume` or `quit · awaiting resume` with `Stop reason: pause` or `quit` and the exact `subagent({ action: "resume", id: "<child-id>" })` call. `status` lists them under **Awaiting resume** across restarts without auto-relaunching. Completed and failed notices state that execution ended and also provide the `resume` call and Intercom name.
192
+ - **Queued parallel subagents.** You can `pause` or `quit` a subagent still waiting for a concurrency slot. `resume` starts it with its original task, optional `message`, model, thinking level, worktree, and fork copy, and re-enters the concurrency queue. If its original model or fork copy no longer exists, `resume` reports it as gone instead of substituting silently.
193
+ - **`resume`.** Continues the subagent's saved session under the same child ID, Intercom name, and group with fresh supervisor authorization (`all: true` is not supported). For paused, quit, or interrupted subagents, `message` runs before continuing. For completed or failed subagents, `message` starts a fresh turn. Omitting `message` prompts the subagent to continue or stop if done.
194
+ - **Resumable vs. terminal.** Paused, quit, interrupted, completed, failed, and session-closed subagents are resumable. **Killed** (explicit cancellation) and **Gone** (unrestorable after restart) subagents are terminal and reject `resume`. Running subagents also reject `resume` (`<agent> (<child-id>, <intercom-name>) is already running as task <task-id>; pause or quit it first.`); use Intercom to message a running subagent. Failed resumes preserve `worktree: true` checkouts.
231
195
  - **Interrupting control calls.** Pressing `Esc` stops waiting on `pause`, `quit`, or `resume`. Stops already requested still complete, while unstarted resumes cancel cleanly.
232
- - **SDK without task host.** `pause`, `quit`, and `resume` work identically; resumed children run in the background and deliver completion notices.
233
196
  - **Removed actions.** `kill` and `interrupt` were removed. Calls fail and direct you to `{ action: "quit", id }`:
234
197
 
235
198
  ```text
236
199
  The subagent action "kill" was removed. Use { action: "quit", id } to stop a child gracefully; it stays resumable with { action: "resume", id, message? }.
237
200
  ```
238
201
 
239
- #### Messages that resume a finished child
202
+ #### Messages that resume a finished subagent
240
203
 
241
- Any session allowed to message a child under ordinary Intercom group and reach rules can bring it back. A single-target `send` or `ask` to a child that completed or failed returns at once with `queued: true`. The launching session resumes the child with its own model, tools, and agent definition, delivers the message first, and adds a prompt naming who sent it. An `ask` receives its reply later as a message.
204
+ Any session allowed to message a subagent under ordinary Intercom group and reach rules can wake it. A single-target `intercom` `send` or `ask` to a completed or failed subagent returns immediately with `queued: true`, and the launching session resumes the subagent to handle the message (an `ask` receives its reply later as a message). Calling `subagent({ action: "resume", id: "<intercom-name>", message })` for a subagent launched by another session sends `message` through that same wake queue.
242
205
 
243
- A paused or quit child is not resumed by another session's message. The message waits until the launching session resumes the child, then arrives after that resume's `message`.
206
+ Messages to a paused or quit subagent wait in a durable queue without resuming it until the launching session continues it. The launching session always keeps ownership of the resumed subagent, its `/tasks` row, and its controls. Message-triggered resumes are bounded to 6 resumes in 10 minutes and chain depth 4. See [Messages that resume a finished subagent](/intercom/reference#messages-that-resume-a-finished-subagent) and [Subagents with no live session](/intercom/reference#subagents-with-no-live-session) for full queue limits and refusal rules.
244
207
 
245
- Queued messages survive Intercom broker crashes and machine restarts, and wait while the launching session is closed or disconnected. If a message can no longer reach the child because the child is cancelled or gone, or the launching session ends or stays away for 7 consecutive days, the sender receives one delivery failure. See [Messages that resume a finished subagent](/intercom/reference#messages-that-resume-a-finished-subagent).
208
+ ### Released subagents
246
209
 
247
- - **Resuming another session's child.** Calling `subagent({ action: "resume", id: "<intercom-name>", message })` for a child another session launched sends `message` through that wake queue. A running child rejects `resume` and tells you to message it over Intercom instead.
248
- - **Ownership and bounds.** The launching session always keeps the resumed child, its completion notice, its `/tasks` and agent-panel row, and `pause` or `quit` control. Its transcript records which session's message resumed it. Messages resume a child at most 6 times in 10 minutes, and agents waking each other stop after 4 consecutive resumes.
249
- - **Inactive children that cannot resume.** When a send or ask cannot resume a child (because it was permanently cancelled, it was a pattern send, resume bounds refused it, or the sender runs an older Atomic), Intercom returns an error naming its `resume` call while the parent stays connected, waiting up to 20 seconds if the parent is closing. See [Subagents with no live session](/intercom/reference#subagents-with-no-live-session).
210
+ A background subagent that waits more than 1 minute on a `detachable: true` tool call, a budgetless shell `wait`, an `intercom` `ask`, or a blocking `contact_supervisor` (`need_decision` or `interview_request`) is **released**. The waited operation keeps running while the subagent releases its session resources and wakes automatically when the result arrives.
250
211
 
251
- #### Released subagents
212
+ - **What you see.** Your main chat shows a dim notice that does not trigger a model turn (`◌ <name> is waiting on <tool> (<call id>)`). `/tasks`, the agent panel, and the launch card list it under **Waiting** with `◌` and `waiting on <tool>`. `subagent({ action: "status" })` reports `released · waiting on <tool> (<call id>)`.
213
+ - **Late results and continuation notes.** If something else wakes the subagent first, the waited call returns as still running; when its result (or a subagent background shell) arrives later, a notice card delivers it once inside the subagent's chat. Whenever Atomic continues a subagent automatically, the subagent receives a short continuation note (`Continuing after Atomic restarted`, `Continuing where it left off`, or `Woken: what it waited for arrived`).
214
+ - **Inspecting, waking, or holding.** Viewing a released subagent displays its saved transcript without waking it; press `Alt+W` (`app.tasks.openWaited`) or click `· alt+w opens it` to open its newest waited shell in `/tasks`. Sending a message in its view, sending an Intercom `send`/`ask`, or calling `resume` wakes it immediately. Pressing `x` twice or calling `pause` or `quit` stops auto-wake and holds arriving results until you `resume`.
215
+ - **Active waits and crash recovery.** Any parent `action: "wait"` yields and reports the subagent released. Queued steering, follow-up, and Intercom messages persist before wake so nothing is lost on crash. Open Intercom asks stay open across local and [multi-node Intercom routing](/intercom/operations#running-intercom-across-machines). On reopen after restart, detachable tool calls restart with the same call IDs and arguments (mark only idempotent tools `detachable: true`); local Intercom asks time out while multi-node database asks stay alive. At most `parallel.runningCapacity` released subagents wake concurrently.
252
216
 
253
- A background subagent that waits more than one minute on a `detachable: true` tool call, a budgetless shell `wait`, an `intercom` `ask`, or a blocking `contact_supervisor` (`need_decision` or `interview_request`) is **released**. The waited call keeps running while the child releases its session, task, and Intercom socket and wakes automatically when the result arrives.
217
+ For the typed `ReleasedChildError` codes reported when tracking or waking a released subagent fails, see [SDK integration and errors](/subagents/reference#sdk-integration-and-errors).
254
218
 
255
- - **What you see.** The parent chat shows a dim, non-turn-starting notice `` `◌ <name> is waiting on <tool> (<call id>)` `` (`Subagent <name> released while waiting on <tool> (<call id>)`). `/tasks`, the agent panel, and the launch card list it under **Waiting** with `◌` and `waiting on <tool>`. `subagent({ action: "status" })` reports `released · waiting on <tool> (<call id>)`.
256
- - **Late results.** If something else wakes the child first, the waited call returns as still running. When its result arrives later, or when a background shell the child launched finishes while released, the child receives a notice card in its own chat naming the tool, outcome, and output. The child reads each result once, and the notice starts its turn when nothing else does.
257
- - **Continuation notes.** When Atomic continues a subagent automatically (after a restart, a `resume` without a message, or an arriving wake result), the child receives a short note in its chat (`Continuing after Atomic restarted`, `Continuing where it left off`, or `Woken: what it waited for arrived`). A `resume` with a message delivers both the message and the note in one turn.
258
- - **Inspecting a released child.** Viewing the child on the chat screen shows its saved transcript without waking it, ending with the `◌` notice and any running shells. On the main screen, the newest waited shell shows a clickable `· alt+w opens it` hint, and `Alt+W` (`app.tasks.openWaited`) opens that shell in `/tasks` (`←` goes back).
259
- - **Waking or holding.** Sending a message while viewing the child, sending an Intercom `send` or `ask`, or calling `resume` wakes it immediately. Pressing `x` twice or calling `pause` or `quit` stops auto-wake and holds arriving results until you `resume`.
260
- - **Active waits and queued messages.** Any parent `action: "wait"` yields and reports the child released. Queued steering or follow-up messages, turn-starting Intercom or extension messages, and background notices accepted during release are persisted and delivered once on wake (`excludeFromContext: true` keeps cards only; `deliverAs: "nextTurn"` is not covered). Open Intercom asks to a released child stay open across local and [multi-node Intercom routing](/intercom/operations#running-intercom-across-machines).
261
- - **Crash recovery and restarts.** Incoming wake results persist before reopening the child so a crash or failed wake keeps them for `resume`. If the launching session temporarily disconnects, Intercom holds messages for up to 20 seconds before returning retryable `recipient_owner_suspended`. On reopen after restart, detachable tool calls restart with the same call IDs and arguments (mark only idempotent tools `detachable: true`), while open local Intercom asks time out and multi-node DB asks stay alive.
262
- - **Capacity and shell ownership.** A child that had already finished is not relaunched merely because an ask it sent was interrupted by a restart; it is notified the next time it runs. At most `parallel.runningCapacity` released children wake concurrently. A released child's background shells wake only that child, never the parent.
219
+ ### Automatic restore and session storage
263
220
 
264
- When tracking or waking a released child fails, `status` and notices report a typed `ReleasedChildError`:
221
+ If Atomic exits, crashes, or you switch sessions (`/new`, `/resume`, `/fork`), running subagents stay resumable and relaunch automatically when you reopen the launching session. They keep their Intercom name, group, model, thinking level, original agent definition, forked context instructions, and unread queued steering or follow-up messages (delivered once in order).
265
222
 
266
- | Code | Cause | Action |
267
- | --- | --- | --- |
268
- | `child-record-missing` | Current session has no record of this child. | Wake from the launching session. |
269
- | `child-record-unreadable` | Child's latest record lives in a session not open here. | Open the launching session and retry. |
270
- | `child-unrestorable` | Saved session or agent definition is missing or invalid. | Fix the reported cause and `resume`, or launch a new child. |
271
- | `record-append-failed` | Could not persist child state to session storage (retryable). | Check session storage before relying on restart recovery. |
272
- | `hold-failed` | Intercom broker could not reserve the released child (retryable; verified against restored reservations on reconnect, up to 5 seconds delay). | Confirm Intercom connectivity; until held, sends fail as not found. |
273
- | `completion-not-held` | A child's shell finished after the child resumed or ended. | None. The notice waits for the child's next run. |
274
- | `wake-failed` | Wake failed for another reason (retryable). | Results are preserved; call `resume` to retry. |
223
+ Inbound Intercom messages wait while a subagent restores (see [Connection states and recovery](/intercom/operations#connection-states-and-recovery)). Finished, paused, quit, and permanently cancelled subagents do not auto-relaunch, and session forks (`/fork`, `--fork`) never relaunch the original session's subagents. If a subagent cannot be restored (for example, its session or agent definition is missing), Atomic posts one recovery notice with its IDs, worktree or branch, `git` inspection commands, and relaunch call, then marks it gone.
275
224
 
276
- ## Task inspection
225
+ A subagent stores its session in the launching session's [storage backend](/storage). It uses SQLite by default, or your configured libSQL or PostgreSQL database. Subagents resume, wake, and export wherever their launching session opens, including [another machine sharing the same database](/guides/resume-on-any-machine).
277
226
 
278
- Use `/tasks` (or `/tasks <id>`) or the agent panel below the prompt (`↓` on an empty prompt) to inspect running, waiting, and finished subagents and their nested shells.
279
-
280
- - **Switch to a subagent.** Select a subagent row and press `Enter` (or click it) to view its live transcript and message it on the same chat screen. Press `←` on an empty prompt or select `main` in the panel to return without interrupting the child.
281
- - **Pause or stop.** While viewing a working subagent, press `Esc` (or `Ctrl+C` on an empty prompt) to pause its turn without affecting the main chat. In `/tasks` or the agent panel, press `x` twice within 3 seconds to stop a running task resumably (a red `◯` stopped mark), or `x` once to dismiss a finished row.
282
- - **Subagent shells and hints.** A subagent's running shells nest underneath it in the agent panel. On a subagent's page in `/tasks`, backgrounded shell blocks show a clickable `· /tasks to manage` hint that opens that subagent's own task list; on the main screen viewing a released subagent waiting on a shell, the newest waited shell shows a clickable `· alt+w opens it` hint.
283
- - **Questions in subagents.** A subagent's `ask_user_question` or extension dialog waits inside that subagent's transcript (**Needs input**) without blocking the main chat. SDK hosts without a task inspector route `humanInput` by `sessionId` ([Human input without a terminal](/sdk#human-input-without-a-terminal)).
227
+ - **JSONL and custom directories.** A JSONL-backed session keeps each subagent's session file beside its own. Setting `sessionDir` (or `defaultSessionDir` in [config.json](/subagents/reference#subagent-config-json-reference)) stores fresh subagents as JSONL files in that directory. Older sessions under `~/.atomic/agent/subagent-sessions/` remain readable in `/tasks` and restorable.
228
+ - **Unsaved sessions.** A session started with `--no-session` or in-memory storage keeps subagent sessions in memory; a finished subagent's history moves to a temporary file that Atomic deletes on exit.
229
+ - **Session list visibility.** Fresh subagent sessions are marked internal so `/resume`, `atomic -r`, `-c`, and `history://sessions` omit them, while `context: "fork"` sessions appear as forks of the main session. Each result names its session file or `history://sessions/<id>`.
230
+ - **Worktree snapshots.** In a blob-capable store, subagents record [worktree snapshots](/worktree-snapshots) of checkouts they modify. Reopening the main session restores each shared checkout from the newest capture among the main session and its finished subagents, while named worktrees and restored active subagents continue from their own snapshots.
284
231
 
285
- See [Background tasks](/background-tasks), [Viewing a subagent](/background-tasks#viewing-a-subagent), and [Shells started by subagents](/background-tasks#shells-started-by-subagents) for the full panel layout, key bindings, command-routing table, and `/tasks` controls.
232
+ ## Coordination and swarms
286
233
 
287
- ## Orchestrator model and group policy
234
+ ### Supervisor coordination
288
235
 
289
- - Named agents use the model and fallbacks declared in their definition. Omit the per-call `model` argument unless the user requested a specific model or you have a recorded task-specific reason.
290
- - When pinning a model, call `subagent({ action: "models" })` first and use only a returned `fullId` and supported thinking level. Never invent model IDs or inspect credentials.
291
- - When the session has an active `enabledModels` / `--models` / `/scoped-models` scope, `subagent({ action: "models" })` returns only models matching that scope, and subagent launches and fallbacks enforce the same allowlist (skipping disallowed fallback candidates and rejecting disallowed explicit models). When unset or empty, all available models remain allowed.
292
- - Children inherit the parent's Intercom group unless `group` is passed on the call or task (`contact_supervisor` still crosses group boundaries).
236
+ By default (`intercomBridge.mode: "always"` in [config.json](/subagents/reference#subagent-config-json-reference)), Atomic injects **both** `intercom` and `contact_supervisor` into **every** subagent whose launching session has Intercom active. Tool frontmatter declarations alone control Intercom tool availability only when `intercomBridge.mode` is `"off"` (or `"fork-only"` for fresh subagents). Main-session tool allowlists, exclusions, `noTools`, and disabled Intercom still apply. A subagent without `read` or `search` receives a read-only `session_history` tool after compaction so it can recover its own history (see [Agents without read or search](/compaction#agents-without-read-or-search)).
293
237
 
294
- ## Context and execution modes
238
+ - **Supervisor decision waits vs. `intercom` `ask`.** `contact_supervisor({ reason: "need_decision", message })` and `interview_request` wait inside the requesting subagent and continue that same subagent when you reply via `intercom({ action: "reply", message: "..." })` (use `pending` and `replyTo` when multiple asks are open). Never relaunch the subagent to answer it. By contrast, `intercom` `ask` never blocks: it returns at delivery (after any `wait` budget) and delivers late replies as messages.
239
+ - **Non-blocking updates.** `intercom` `send` and `contact_supervisor({ reason: "progress_update", message })` return immediately without cancelling or disrupting siblings or worktrees.
240
+ - **Messaging a running subagent.** Subagents register on Intercom before their first turn, retrying while starting if the broker is briefly unreachable (supervisor authorization retries up to 30 seconds across broker restarts before starting without it). Address the subagent by its name or full ID from `intercom list`, and set `delivery` to `"steer"` (default), `"followUp"`, or `"interrupt"`. See [Intercom reference](/intercom/reference#the-intercom-tool).
241
+ - **Embedded SDK sessions without background task management.** When an embedded SDK session launches a single subagent directly without background task management, `subagent` waits for completion; a blocking `contact_supervisor` request ends that subagent and returns its question, attachments, identity, and `[TASK_CONTEXT]` so the caller can launch a fresh subagent (`subagent({ agent: "worker", task: "[TASK_CONTEXT] ... Continue with this supervisor answer: ..." })`). Cancelling that waiting call stops the subagent permanently and returns labelled partial findings (`progress.md`, last assistant text, or artifact paths).
295
242
 
296
- ### Fresh vs. forked context
243
+ ### Peer coordination
297
244
 
298
- - `context: "fresh"` starts an isolated in-process child session containing only the agent's prompt and task. Use `fresh` (the default unless an agent sets `defaultContext: fork`) for adversarial reviews and independent research.
299
- - `context: "fork"` branches from the parent's settled entry and fails fast if the parent cannot be forked (it never downgrades to fresh). It inherits model, thinking level, tool changes, `atomic.appendEntry` data since the last clear, and referenced saved tool outputs without taking ownership of the parent's subagents or replaying parent Intercom cards.
245
+ Peer-to-peer coordination is the default. Siblings in a parallel batch, or sharing an explicit `group`, discover each other with `intercom({ action: "list" })` and communicate directly with `send` and `ask` instead of routing through the supervisor.
300
246
 
301
- Use `fork` when the child needs the parent's conversation. A forked child sends the exact conversation the parent last sent (system prompt, project context, skills, tools, and messages), followed by its own role, a short note, and its task. On the parent's model and thinking level, the first request reads from the parent's prompt cache and pays only for the new suffix; on another model or provider it reads nothing from that cache, and on another thinking level it may read only part of it.
247
+ - Share findings, divide file ownership or expensive test runs, reuse verified reproductions, and challenge disagreements with evidence. Each subagent still returns its own complete result.
248
+ - Reserve `contact_supervisor` for supervisor decisions. Ordinary Intercom group boundaries and user approval gates still apply. Peer asks and one blocking supervisor ask can wait concurrently. See `/skill:intercom` for peer patterns.
302
249
 
303
- In a fork, `inheritProjectContext` and `inheritSkills` do not hide what the parent already sent; those settings apply to fresh children. The child's own tool policy still applies: calling a tool outside the child's allowed list fails with an error naming the allowed tools. Where the provider supports mid-conversation tool changes, removed or child-only tools are declared after the parent conversation; otherwise child-only tools run through `codemode` restricted strictly to the child's own tools.
250
+ ```typescript
251
+ const peerRules =
252
+ "Your siblings review the same diff. Run intercom list to find them, share every confirmed finding, " +
253
+ "ask them whatever you need, and debate disagreements with evidence. Then return your own structured verdict.";
304
254
 
305
- Fresh children inherit the parent's SDK config, discovery inputs, model and auth runtime, and host callbacks. Child tool lists can narrow permissions but cannot re-enable excluded tools or disabled packages. See [SDK child configuration](/sdk).
255
+ subagent({
256
+ tasks: [
257
+ { agent: "reviewer", task: `Review correctness of the auth changes. ${peerRules}` },
258
+ { agent: "reviewer", task: `Review security of the auth changes. ${peerRules}` },
259
+ { agent: "reviewer", task: `Review test coverage of the auth changes. ${peerRules}` },
260
+ ],
261
+ });
262
+ ```
306
263
 
307
- ### Temporary worktrees (`worktree: true`)
264
+ ### Scaling a swarm
308
265
 
309
- Pass `worktree: true` to isolate parallel edits in temporary Git worktrees:
266
+ Atomic supports large parallel swarms organized into peer-coordinating teams:
310
267
 
311
- - Worktrees and branches are cleaned up once every child in the batch finishes, after saving each child's changes as a patch under `worktree-diffs/<run-id>`.
312
- - Paused, quit, or session-closed children keep their worktree only if it has uncommitted or untracked changes or new commits. Clean worktrees are removed; `resume` recreates them from base plus the saved patch and writes later patches as `task-<n>-<agent>.<execution>.patch`. Permanently cancelled children release their worktrees, and unresumed stopped worktrees with changes remain under `.atomic/worktrees/`.
313
- - `pause`, `quit`, completion, and failed resume wait for Git cleanup. Pressing `Esc` stops waiting without cancelling cleanup; cleanup taking over 10 seconds warns and continues in the background. Never delete a worktree while `worktreeNote` reports pending cleanup or a sibling hold, or after a crash without checking for orphaned Git processes.
314
- - **Integration hook.** Subscribe to `atomic.events.on("subagent:finishing", ({ runId, index, taskId, cwd, status }) => ...)` before launch, or check `ATOMIC_SUBAGENT_WORKTREE_PHASE=finishing` in Git filters, so external helpers do not block cleanup while waiting for the terminal report.
268
+ - **Parallel limits.** `parallel.maxTasks`, `parallel.concurrency`, and `parallel.runningCapacity` each default to `1000` with no hard upper cap. Raise all three in `config.json` to exceed 1,000, or lower `parallel.concurrency` to throttle. Provider rate limits and host memory remain practical bounds.
269
+ - **Nesting.** Delegation is strictly one level deep. Only the main session launches subagents.
270
+ - **Teams.** Intercom groups have no member cap. Assign each team its own `group` for internal messaging; members can still reach the supervisor via `contact_supervisor`.
315
271
 
316
- ### Named worktrees
272
+ ### From codemode scripts
317
273
 
318
- Run a child on an explicit branch and path with `worktree: { branch, base?, path? }` (cannot be combined with `worktree: true`):
274
+ When both `codemode` and `subagent` are active, `tools.subagent()` launches the same background subagents and resolves at launch, not completion. Launched subagents belong to the main session and continue even if the script returns, throws, or times out. Separate `tools.subagent()` calls in a script are not merged into a burst; pass `tasks: [...]` for a parallel batch. Subagents cannot launch nested subagents from codemode.
319
275
 
320
- ```typescript
321
- subagent({ agent: "worker", task: "Fix the parser", worktree: { branch: "fix/parser" } })
322
- subagent({
276
+ ```js
277
+ const { tasks } = await tools.subagent({
323
278
  tasks: [
324
- { agent: "worker", task: "Add the API", worktree: { branch: "feat/api", base: "origin/main" } },
325
- { agent: "worker", task: "Add the UI", worktree: { branch: "feat/ui", path: "../ui-worktree" } },
279
+ { agent: "worker", task: "Check the examples" },
280
+ { agent: "worker", task: "Check the links" },
326
281
  ],
327
- })
282
+ group: true,
283
+ });
284
+ store("checks", tasks);
285
+ return tasks;
328
286
  ```
329
287
 
330
- - **Checkout rules.** `path` defaults to `.atomic/worktrees/<branch>` (`/` replaced with `+`). New branches start at `base` (resolved in the caller's worktree), then upstream, then `HEAD`. Unused existing branches check out as-is, and a branch already checked out at `path` is reused. Launch fails fast if the branch is checked out elsewhere or `path` holds something else.
331
- - **Ownership.** Atomic never deletes a named worktree or its branch, saves no patch, and does not copy or link `node_modules`. Resuming reuses the worktree or checks the branch back out there if removed. Prefer `worktree: { ... }` over running `git worktree add` in the same turn, which races with sibling tool calls.
332
- - **Concurrency and locks.** Different branches and paths run concurrently. Duplicate `(branch, path)` launches wait and reuse; the same branch at a different path fails after the first finishes. External `index.lock` files or initializing worktrees time out after 30 seconds (`another git process seems to be running at <path>`). Interrupted previous checkouts fail immediately (`an interrupted named-worktree checkout left an incomplete worktree at <path>`); on Git 2.30 to 2.32, they report busy after the 30-second wait instead.
333
- - **Recovery.** Confirm no Git process is running, save needed files, run `git worktree unlock <path>`, remove the directory, run `git worktree prune`, and clear any stale `HEAD.lock` or branch `.lock` files (or run `git worktree remove --force --force <path>`). Never fix a partial checkout by deleting only `index.lock`, and never have Git checkout hooks synchronously spawn another named worktree for the same branch and path.
288
+ Single `{ agent, task }` and parallel `{ tasks }` calls both return `{ action: "launch", tasks }`. Each slot has `agent`, `state` (`"admitted"`, `"queued"`, or `"refused"` with `reason`), `taskId`, `childId`, and `intercomTarget` when available. Do not retry already-started siblings if one slot is refused.
289
+
290
+ - **`list`, `get`, and `models`.** Inspect executable `agents`, matching `definitions`, or the model catalog (`fullId`, `isCurrent`, `availableThinkingLevels`). Creating, updating, or deleting agent definitions requires a direct tool call.
291
+ - **`status`.** Returns `children` launched by this session (pass `id` for one subagent) with state and any `resumeCall`. Use `status` after reopening a session to rediscover subagents instead of relaunching.
292
+ - **`wait`.** Takes a task `id` and optional `budgetMs` (default 30 seconds, even if the host waits indefinitely; `0` checks immediately). Script timeouts cancel `wait`, not the subagent. Returns `outcome: "settled"` (with `childId`, `result.status`, output excerpt, `outputPath`, and `resumeCall`), `"running"`, or `"stopped-waiting"` (when the script's signal aborts).
293
+ - **`pause`, `quit`, and `resume`.** `pause` and `quit` accept `id` or `all: true`. `resume` takes `id` and optional `message` and returns the new task ID in `children`. Always pass `id` rather than the legacy `runId` alias.
294
+ - **Temporary worktrees.** `status` can show `finishing` while `wait` still returns `running`. Check `worktreeNote` or `worktreeNotes` before removing any worktree directory.
295
+
296
+ ## Models, scope, and configuration
297
+
298
+ ### Model selection and `enabledModels` scope
334
299
 
335
- ### Parallel config, bursts, `reads`, and `progress`
300
+ All built-in subagents default to `model: "auto"`, which runs your default model (last chosen with `/model`) at its default thinking level, or the launching session's model when no default is set. Per-call `model` overrides the default, and custom agents without `model` or `fallbackModels` inherit the launching session's model and thinking level. See [Automatic model selection](/subagents/reference#automatic-model-selection).
336
301
 
337
- Configure parallel limits and restart recovery in `~/.atomic/agent/extensions/subagent/config.json`:
302
+ - **Model catalog.** Call `subagent({ action: "models" })` before pinning a model and use only a returned `fullId` and supported thinking level. Omit per-call `model` unless the user requested a specific model or you have a clear task-specific reason.
303
+ - **Credentials.** Providers without configured credentials are skipped before launch and recorded in model attempts. A provider that rejects credentials mid-run is skipped for subsequent fallbacks. If no candidate has credentials, launch fails immediately and lists each missing provider (see [Fallbacks and credentials](/models#fallbacks-and-credentials)).
304
+ - **`enabledModels` / `--models` / `/scoped-models` scope.** Subagents enforce the main session's active model scope using the exact same matching rules (`minimatch` `*`/`?`/`[...]` globs, literal bracketed IDs, fuzzy substring matches, and case-insensitive `:thinking` suffixes). `subagent({ action: "models" })` returns only scoped models, fallbacks skip disallowed candidates, and explicit disallowed models fail before launch. If `enabledModels` is set to patterns matching zero available models, **all** subagent launches are refused; only an unset or empty `enabledModels` allows all models.
305
+
306
+ ### Subagent `config.json` and call options
307
+
308
+ Configure subagent runtime defaults in `~/.atomic/agent/extensions/subagent/config.json` (Atomic falls back to `~/.pi/agent/extensions/subagent/config.json` when the Atomic file is absent):
338
309
 
339
310
  ```json
340
311
  {
@@ -343,25 +314,24 @@ Configure parallel limits and restart recovery in `~/.atomic/agent/extensions/su
343
314
  "concurrency": 2000,
344
315
  "runningCapacity": 2000
345
316
  },
346
- "resumeInFlight": "ask"
317
+ "resumeInFlight": "ask",
318
+ "sessionStartTimeoutMs": 300000,
319
+ "intercomBridge": {
320
+ "mode": "always"
321
+ }
347
322
  }
348
323
  ```
349
324
 
350
- - **`parallel.maxTasks`, `concurrency`, and `runningCapacity`.** All default to `1000` with no hard cap. Per-call `concurrency` overrides `parallel.concurrency`. `runningCapacity` takes effect when the first child starts, so restart Atomic after changing it.
351
- - **`resumeInFlight`.** Controls paused or quit children awaiting resume on startup or `/resume` (not `/reload`, `/new`, or `/fork`): `"never"` (default, stay in **Awaiting resume**), `"ask"` (one confirmation prompt; falls back to `"never"` without a UI), or `"auto"` (resumes them automatically).
352
- - **Sibling burst collection.** Multiple synchronous execution-mode `subagent` tool calls in one assistant message combine into one parallel run while projecting each caller's results and errors back to its original call. Shared options (`concurrency`, `worktree: true`, `context`, `control`, `sessionDir`, `maxOutput`, `artifacts`, `includeProgress`, `agentScope`) must match across sibling calls; `cwd` (must match for `worktree: true`), `group`, and named `worktree: { ... }` stay per call. Prefer one explicit `{ tasks: [...] }` call when planning parallel work.
353
- - **`group`.** A named string joins that Intercom group; `true` creates a shared UUID group for a parallel set. Precedence is `explicit group`, then parent session group, then config, then `"default"`. Pending asks are per session.
354
- - **`cwd` validation.** A missing or non-directory `cwd` fails before starting the child.
355
- - **`reads: string[] | false` (single-agent).** Prepends file contents into child context, resolving relative paths against the child's effective `cwd`.
356
- - **`progress: boolean`.** Creates a run-scoped `progress.md` in isolated subagent artifact storage (never inside child `cwd` or the repository; cleaned up on exit when `artifacts: false`; shared across parallel tasks). Omitting it inherits the agent's `defaultProgress` (suppressed for read-only tasks unless `progress: true`). This is separate from `includeProgress: true`, which adds runtime progress telemetry to the tool result.
357
-
358
- ```ts
359
- subagent({ agent: "worker", task: "Implement the approved fix.", progress: true })
360
- ```
325
+ - **`parallel.maxTasks`, `concurrency`, and `runningCapacity`.** All default to `1000` with no hard cap. Per-call `concurrency` overrides `parallel.concurrency`. `runningCapacity` takes effect when the first subagent starts, so restart Atomic after changing it.
326
+ - **`resumeInFlight`.** Controls paused or quit subagents awaiting resume on startup or `/resume` (not `/reload`, `/new`, or `/fork`): `"never"` (default, stay in **Awaiting resume**), `"ask"` (one confirmation prompt; falls back to `"never"` without a UI), or `"auto"` (resumes automatically).
327
+ - **Additional keys.** `config.json` also supports `defaultSessionDir`, `control` (attention and long-running notice thresholds), `worktreeSetupHook` and `worktreeSetupHookTimeoutMs` (default `30000` ms), and `intercomBridge` (`mode`: `"off" | "fork-only" | "always"`, `instructionFile`). Invalid `resumeInFlight` or `sessionStartTimeoutMs` values drop only that field and log an error while the rest of the file loads; invalid JSON falls back to `{}`. See [Subagent config.json reference](/subagents/reference#subagent-config-json-reference) for every key.
328
+ - **Multiple `subagent` calls in one assistant message.** Separate single-agent `subagent` calls emitted in one assistant message combine into one parallel run while returning each call's own results and errors. Shared options (`concurrency`, `worktree: true`, `context`, `control`, `sessionDir`, `maxOutput`, `artifacts`, `includeProgress`, `agentScope`) must match across those calls; `cwd` (must match for `worktree: true`), `group`, and named `worktree: { ... }` stay per call. Prefer one explicit `{ tasks: [...] }` call when planning parallel work.
329
+ - **`group`.** A named string joins that Intercom group; boolean `true` or the case-insensitive string `"true"` or `"auto"` creates one shared UUID group for a parallel set. Precedence is explicit `group`, then launching session group, then config, then `"default"`.
330
+ - **`cwd` validation.** A missing or non-directory `cwd` fails before starting the subagent.
361
331
 
362
332
  ### Subagent start timeouts
363
333
 
364
- Children have a 5-minute startup budget covering session open, resource load, agent session creation (including admission wait), and task dispatch. Queue wait under `parallel.runningCapacity` does not count. Override the budget in `~/.atomic/agent/extensions/subagent/config.json` (milliseconds, `1` to `2147483647`):
334
+ Subagents have a 5-minute startup budget covering session open, resource load, agent session creation (including slot wait), and task dispatch. Queue wait under `parallel.runningCapacity` does not count. Override the budget in `~/.atomic/agent/extensions/subagent/config.json` (milliseconds, `1` to `2147483647`):
365
335
 
366
336
  ```json
367
337
  { "sessionStartTimeoutMs": 600000 }
@@ -371,38 +341,65 @@ Exceeding the budget fails with `SessionStartTimeoutError` (shown in `status` an
371
341
 
372
342
  | `phase` | Blocked on | Action |
373
343
  | --- | --- | --- |
374
- | `admission` | Waiting for a resource-admission session permit. | Free admission capacity and retry. |
344
+ | `admission` | Waiting for a session slot. | Free concurrent capacity and retry. |
375
345
  | `setup` | Opening session, loading resources, or extension startup. | Check session storage or extensions, or raise `sessionStartTimeoutMs`, then retry. |
376
346
  | `dispatch` | Session started, but `input` or `before_agent_start` blocked dispatch. | Inspect extension handlers and retry. |
377
- | `event-loop` | The main thread was saturated during startup. | Reduce in-process load and retry. |
347
+ | `event-loop` | The main thread was saturated during startup. | Reduce concurrent load and retry. |
348
+
349
+ For SDK error rehydration (`isSessionStartTimeoutError`, `rehydrateSessionStartError`), see [Session start errors](/sdk/reference#session-start-errors).
350
+
351
+ ### Using subagents from the SDK
378
352
 
379
- Rehydrate `startError` in SDK hosts (see [Session start errors](/sdk/reference#session-start-errors)):
353
+ `createAgentSession()` enables the bundled subagents package by default. Control subagents and child host behavior directly from `@bastani/atomic`:
380
354
 
381
355
  ```typescript
382
- import { isSessionStartTimeoutError, rehydrateSessionStartError } from "@bastani/atomic";
356
+ import { createAgentSession } from "@bastani/atomic";
383
357
 
384
- if (result.startError) {
385
- const error = rehydrateSessionStartError(result.startError);
386
- if (isSessionStartTimeoutError(error) && error.phase === "admission") {
387
- // Free admission capacity, then relaunch.
388
- }
389
- }
358
+ // Disable the bundled subagents package (also removes its 21 bundled skills)
359
+ const withoutPackage = await createAgentSession({
360
+ builtins: { subagents: false },
361
+ });
362
+
363
+ // Hide only the subagent tool while keeping the 21 bundled skills available
364
+ const skillsOnly = await createAgentSession({
365
+ excludedTools: ["subagent"],
366
+ });
367
+
368
+ // Route subagent ask_user_question and extension dialogs without a terminal
369
+ const headless = await createAgentSession({
370
+ extensionBindings: {
371
+ humanInput: myHostInput,
372
+ },
373
+ });
390
374
  ```
391
375
 
392
- ## Delegation and child boundaries
376
+ - **Child inheritance.** Subagents inherit the parent session's `ModelRuntime`, settings, `agentDir`, `scopedModels`, `fallbackModels`, `customTools`, `resourceAdmission`, and `humanInput`. See [Subagent children in the SDK](/sdk#subagent-children).
377
+ - **Human input.** Implement `extensionBindings.humanInput` so dialogs triggered inside a child session route cleanly by `sessionId`. See [Human input without a terminal](/sdk#human-input-without-a-terminal).
378
+ - **Background task supervision.** Bind `AgentTaskHost` and `OwnerTaskStore` to observe and control background subagents in custom hosts. See [Owner-bound task supervisor](/sdk/reference#owner-bound-task-supervisor) and [Owner-bound task projection](/subagents/reference#owner-bound-task-projection).
379
+
380
+ ## Delegation boundaries and migration
381
+
382
+ Delegation is fixed at one level: subagents cannot launch, `pause`, `resume`, or `quit` other subagents, and restricted subagents cannot `create`, `update`, or `delete` agent definitions. Subagents can still run background shells (nested under the subagent in the agent panel) and inspect status with `list`, `get`, `status`, and `wait`. Subagent prompts omit parent orchestration artifacts and prior control traffic.
383
+
384
+ If older calls or agent definitions still pass removed acceptance-gate fields:
385
+
386
+ - Remove `acceptance` from `subagent()` calls and task entries.
387
+ - Remove `completionGuard: false` from agent frontmatter (tool updates strip it automatically).
388
+ - Put required commands, tests, or evidence checks directly in the task prompt.
389
+
390
+ <div id="custom-agents" />
391
+
392
+ <div id="fallback-models" />
393
393
 
394
- Delegation is fixed at one level: children cannot launch, `pause`, `resume`, or `quit` other children, and management-restricted children cannot `create`, `update`, or `delete` agent definitions. Children can still run background shells (nested under the subagent in the agent panel) and inspect status with `list`, `get`, `status`, and `wait`. Child prompts omit parent orchestration artifacts and prior control traffic.
394
+ <div id="reasoning-levels" />
395
395
 
396
- <a id="custom-agents" />
397
- <a id="fallback-models" />
398
- <a id="reasoning-levels" />
399
- <a id="owner-bound-task-projection" />
396
+ <div id="owner-bound-task-projection" />
400
397
 
401
398
  ## Related docs
402
399
 
403
- - [Custom subagents](/subagents/authoring#custom-agents) explains how to define and scope custom agents.
400
+ - [Create custom subagents](/subagents/authoring#custom-agents) explains how to define, scope, and override agents.
404
401
  - [Subagent reference](/subagents/reference) covers [agent discovery](/subagents/reference#agent-discovery), [fallback models](/subagents/reference#fallback-models), [reasoning levels](/subagents/reference#reasoning-levels), and [owner-bound task projection](/subagents/reference#owner-bound-task-projection).
405
- - [Orchestration](/orchestration) shows multi-step work with codemode and subagents.
406
- - [Intercom](/intercom) covers cross-session messaging and supervisor escalation.
402
+ - [Orchestrate with codemode and subagents](/orchestration) shows multi-step work with codemode and subagents.
403
+ - [Coordinate sessions with Intercom](/intercom) covers cross-session messaging and supervisor escalation.
407
404
  - [Skills](/skills) covers reusable instructions invoked with `/skill:<name>`.
408
405
  - [Settings](/settings) covers user and project configuration.