@bastani/atomic 0.10.9 → 0.10.10-alpha.1

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 (401) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/README.md +211 -155
  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} +145 -58
  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 +85 -114
  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 +37 -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 +71 -138
  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 +60 -87
  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 +235 -243
  297. package/docs/build.md +12 -11
  298. package/docs/codemode.md +60 -51
  299. package/docs/compaction/reference.md +61 -24
  300. package/docs/compaction.md +117 -65
  301. package/docs/computer-use.md +179 -146
  302. package/docs/containerization.md +79 -33
  303. package/docs/custom-provider/api-reference.md +148 -11
  304. package/docs/custom-provider/oauth.md +44 -27
  305. package/docs/custom-provider/override.md +14 -7
  306. package/docs/custom-provider/registration.md +75 -65
  307. package/docs/custom-provider/streaming.md +42 -19
  308. package/docs/custom-provider.md +25 -61
  309. package/docs/development.md +47 -43
  310. package/docs/docs.json +33 -33
  311. package/docs/environment-variables.md +83 -57
  312. package/docs/extensions/api-reference.md +323 -734
  313. package/docs/extensions/authoring.md +186 -269
  314. package/docs/extensions/events.md +308 -375
  315. package/docs/extensions/examples.md +122 -74
  316. package/docs/extensions/ui.md +217 -197
  317. package/docs/extensions.md +152 -259
  318. package/docs/getting-started/authentication.md +27 -14
  319. package/docs/getting-started/first-session.md +25 -26
  320. package/docs/getting-started/installation.md +62 -84
  321. package/docs/getting-started/project-instructions.md +39 -14
  322. package/docs/guides/configuration.md +42 -20
  323. package/docs/guides/intercom.md +17 -13
  324. package/docs/guides/non-interactive.md +29 -16
  325. package/docs/guides/orchestration.md +16 -10
  326. package/docs/guides/resume-on-any-machine.md +54 -49
  327. package/docs/guides/subagents.md +22 -14
  328. package/docs/guides/team-setup.md +37 -26
  329. package/docs/guides.md +22 -21
  330. package/docs/herdr.md +21 -16
  331. package/docs/index.md +16 -17
  332. package/docs/intercom/operations.md +68 -66
  333. package/docs/intercom/reference.md +196 -191
  334. package/docs/intercom.md +103 -92
  335. package/docs/json.md +71 -71
  336. package/docs/keybindings.md +63 -50
  337. package/docs/libraries/agent-core.md +49 -8
  338. package/docs/libraries/ai.md +21 -12
  339. package/docs/libraries/codemode.md +28 -6
  340. package/docs/libraries/schema.md +7 -7
  341. package/docs/libraries/telemetry.md +7 -7
  342. package/docs/libraries/tui.md +74 -94
  343. package/docs/libraries.md +5 -5
  344. package/docs/llama-cpp.md +38 -33
  345. package/docs/mcp-servers.md +96 -90
  346. package/docs/models/reference.md +46 -33
  347. package/docs/models-configuration.md +12 -6
  348. package/docs/models.md +93 -88
  349. package/docs/orchestration/migrating-workflows.md +21 -19
  350. package/docs/orchestration/patterns.md +35 -20
  351. package/docs/orchestration.md +22 -21
  352. package/docs/packages/authoring.md +28 -19
  353. package/docs/packages/reference.md +75 -16
  354. package/docs/packages.md +31 -33
  355. package/docs/programmatic.md +22 -21
  356. package/docs/prompt-templates.md +63 -41
  357. package/docs/providers/reference.md +35 -19
  358. package/docs/providers.md +61 -71
  359. package/docs/quickstart.md +32 -46
  360. package/docs/reference/cli.md +249 -252
  361. package/docs/reference.md +23 -20
  362. package/docs/rpc/examples.md +74 -17
  363. package/docs/rpc/extension-ui.md +79 -62
  364. package/docs/rpc/protocol.md +816 -358
  365. package/docs/rpc.md +75 -151
  366. package/docs/sdk/reference.md +175 -45
  367. package/docs/sdk/structured-decisions.md +92 -62
  368. package/docs/sdk/web-server.md +79 -46
  369. package/docs/sdk.md +237 -195
  370. package/docs/security.md +106 -43
  371. package/docs/session-format.md +96 -59
  372. package/docs/sessions.md +149 -113
  373. package/docs/settings.md +289 -204
  374. package/docs/shell-aliases.md +15 -6
  375. package/docs/skills/authoring.md +17 -9
  376. package/docs/skills/reference.md +23 -21
  377. package/docs/skills.md +104 -97
  378. package/docs/storage.md +140 -242
  379. package/docs/subagents/authoring.md +147 -16
  380. package/docs/subagents/reference.md +100 -30
  381. package/docs/subagents.md +220 -252
  382. package/docs/terminal-setup.md +97 -69
  383. package/docs/termux.md +51 -85
  384. package/docs/themes/reference.md +51 -37
  385. package/docs/themes.md +49 -54
  386. package/docs/tmux.md +38 -21
  387. package/docs/tools.md +198 -147
  388. package/docs/tui/reference.md +64 -32
  389. package/docs/tui.md +38 -66
  390. package/docs/usage.md +76 -78
  391. package/docs/verification.md +25 -25
  392. package/docs/web-access.md +72 -55
  393. package/docs/windows.md +53 -58
  394. package/docs/worktree-snapshots.md +62 -65
  395. package/package.json +8 -8
  396. package/schemas/models.schema.json +51 -0
  397. package/dist/_shared/sdk-OSBEPR3Q.js.map +0 -1
  398. package/dist/_shared/startup-0-0-TYUFUOJZ.js.map +0 -1
  399. package/dist/_shared/startup-0-1-W2G2UY7R.js.map +0 -1
  400. package/dist/_shared/startup-0-2-UXBUEOXW.js.map +0 -1
  401. package/dist/_shared/startup-0-4-HN5EB4K7.js.map +0 -1
@@ -1,38 +1,37 @@
1
1
  ---
2
- title: Intercom reference
3
- description: The intercom tool contract, SDK error classes, and every Intercom setting.
2
+ title: "Intercom reference"
3
+ sidebarTitle: "Intercom"
4
+ description: "Complete specification of the intercom tool, targeting rules, groups, delivery limits, SDK errors, and config.json."
4
5
  ---
5
6
 
6
- # Intercom reference
7
-
8
- ## The intercom tool
7
+ ## The `intercom` tool {#the-intercom-tool}
9
8
 
10
9
  | Parameter | Type | Description |
11
10
  | --- | --- | --- |
12
11
  | `action` | string | `"list"`, `"groups"`, `"join"`, `"leave"`, `"send"`, `"ask"`, `"reply"`, `"pending"`, `"cancel"`, or `"status"`. |
13
- | `to` | string | Exact session name, full session ID, or unique 8-hex session UUID prefix. `send` also accepts a session-name glob or `subagents:` target ([Sending to several sessions at once](#sending-to-several-sessions-at-once)). `ask` requires one exact target. |
12
+ | `to` | string | Exact session name, full session ID, or unique 8-hex session UUID prefix. `send` also accepts a session-name glob (`*` only) or `subagents:` target ([Sending to several sessions at once](#sending-to-several-sessions-at-once)). `ask` requires one exact target. |
14
13
  | `message` | string | Message text for `send`, `ask`, or `reply`. |
15
14
  | `broadcast` | boolean | For `send` to a session-name glob: set `true` to send to every matching session. Without it, a glob matching more than one session is refused with the match list. `subagents:` targets broadcast without this flag. |
16
15
  | `attachments` | array | Optional `file`, `snippet`, or `context` attachments (`{ type, name, content, language? }`). |
17
- | `delivery` | string | For `send` and `ask`: `"steer"` (default, arrives after current tool calls without cancelling work), `"followUp"` (arrives after the recipient finishes and stops), or `"interrupt"` (cancels the current model call or cancellable tool call immediately). |
16
+ | `delivery` | string | Case-sensitive mode for `send` and `ask`: `"steer"` (default, arrives after current tool calls without cancelling work), `"followUp"` (arrives after the recipient finishes and stops), or `"interrupt"` (cancels the current model call or cancellable tool call immediately). |
18
17
  | `wait` | object | For `ask`: how long to wait for an inline reply before yielding, matching `bash`. Omit for the automatic yield (default 10 seconds), pass `{ kind: "foreground", budgetMs }` to wait up to a budget, or pass `{ kind: "background" }` to return at delivery. |
19
- | `askId` | string | For `cancel`: the ID, or unique prefix, of one of your pending outbound asks. |
20
- | `replyTo` | string | Exact message ID or unique 8-hex UUID prefix of an unresolved inbound ask. With `reply`, overrides current-turn and pending-ask fallback. With `cancel`, closes that inbound ask without sending anything to its sender. |
18
+ | `askId` | string | For `cancel`: any unique case-sensitive prefix (or full ID) of one of your pending outbound asks. If both `askId` and `replyTo` are passed to `cancel`, `askId` takes precedence and `replyTo` is ignored. |
19
+ | `replyTo` | string | Exact message ID or exact 8-hex UUID prefix of an unresolved inbound ask. With `reply`, overrides current-turn and pending-ask fallback. With `cancel`, closes that inbound ask without sending anything to its sender. |
21
20
  | `group` | string | Group name for `join` or an optional targeted `leave`, or a read-only group filter for `list` and `status`. `send` and `ask` still require a shared membership or reach policy. |
22
21
 
23
22
  ### Actions
24
23
 
25
24
  | Action | Behavior |
26
25
  | --- | --- |
27
- | `join` | Adds a trimmed named group membership, creating the group if needed. Waits for broker confirmation and reports the resulting membership set. Joining `default` while multi-node routing is on adds a warning. `true` and `auto` are reserved for subagent auto-groups. |
28
- | `leave` | With `group`, removes only that membership and keeps all others. Without `group`, resets memberships to the startup home group. Reports the resulting membership set. |
26
+ | `join` | Adds a trimmed named group membership, creating the group if needed. Waits for broker confirmation and reports the resulting membership set. Joining `default` while multi-node routing is on adds a warning. `true` and `auto` are reserved (case-insensitively) for subagent auto-groups. |
27
+ | `leave` | With `group`, removes that membership and keeps all others; if it was your only remaining group, returns you to your resolved startup home group (for example `project:<path>` under multi-node routing, or `"default"` locally). Without `group`, resets memberships to the startup home group. Reports the resulting membership set. |
29
28
  | `groups` | Lists every group with at least one connected session, along with its session count and whether this session belongs to it. |
30
29
  | `list` | Lists the current session and active sessions visible through your memberships. Pass `group` for a read-only view of one group. |
31
30
  | `send` | Fire-and-forget delivery through ordinary Intercom. Requires `to` and `message`; cannot message the current session. |
32
31
  | `ask` | Sends a question to a live recipient and returns at delivery with `askId`, `delivered`, and `recipient` (`name`, `state`, and `currentAction` when known). A reply within `wait` returns inline; otherwise the ask stays pending with no expiry and its reply arrives later as a message ([send vs ask vs reply](#send-vs-ask-vs-reply)). |
33
- | `reply` | Answers the intercom message that triggered the current turn, or falls back to the sole unresolved inbound ask. With multiple pending asks, pass `to` or inspect with `pending` and pass `replyTo`. |
32
+ | `reply` | Answers the Intercom message that triggered the current turn, or falls back to the sole unresolved inbound ask. With multiple pending asks, pass `to` or inspect with `pending` and pass `replyTo`. |
34
33
  | `pending` | Lists unresolved inbound asks (sender, message ID, elapsed time, and preview) and your pending outbound asks (ask ID, target, elapsed time, and question). |
35
- | `cancel` | With `askId`, cancels one of your outbound asks (a reply that arrives later is still shown once, marked late). With `replyTo`, closes an inbound ask without replying; it leaves `pending`, stays closed across restarts, and sends nothing to the asker. |
34
+ | `cancel` | With `askId` (any unique case-sensitive prefix), cancels one of your outbound asks (a reply arriving later still displays once, marked late). With `replyTo` (exact full ID or exact 8-hex prefix), closes an inbound ask without replying; it leaves `pending`, stays closed across restarts, and sends nothing to the asker. If both `askId` and `replyTo` are passed, `askId` wins and `replyTo` is ignored. |
36
35
  | `status` | Reports connection state, session ID, all group memberships (plus reachable groups when a [reach policy](#reach-policies) applies), visible active session count, and the broker's multi-node routing state with live peer broker count. Passing `group` performs a read-only peek. |
37
36
 
38
37
  To give two chat sessions a private shared group, have both call:
@@ -49,14 +48,14 @@ Sent and received messages are stored in session history as `intercom_sent` and
49
48
 
50
49
  ### Targeting sessions
51
50
 
52
- Live session lookup accepts:
51
+ Live session lookup checks targets in this order:
53
52
 
54
- - An exact full Intercom session ID.
55
- - An exact case-insensitive session name.
56
- - A unique 8-character hexadecimal prefix of a UUID-backed session ID.
57
- - A connected session's Atomic session ID (the ID passed to `atomic --session`), when exactly one visible session registered it.
53
+ 1. **Exact full Intercom session ID** (case-sensitive).
54
+ 2. **Exact session name** (case-insensitive). If multiple local sessions share the same name, lookup fails with `Multiple sessions named "<target>" are connected. Use the session ID instead.`
55
+ 3. **Unique 8-character hexadecimal prefix** (`^[0-9a-f]{8}$/i`) of a standard UUID-format (`8-4-4-4-12`) session ID. Prefixes of 6, 7, or 9+ characters do not match.
56
+ 4. **Atomic session ID** (case-sensitive, the ID passed to `atomic --session`), checked only when the rules above match nothing and exactly one visible session registered it.
58
57
 
59
- Exact names and Intercom session IDs take precedence; Atomic session IDs are checked only if other forms match nothing. Ambiguous prefixes list only authorized candidates and require the full UUID. Isolated children can target their authorized supervisor by a unique UUID prefix without gaining access to unrelated groups.
58
+ Ambiguous prefixes list only authorized candidates and require the full UUID. Isolated subagents can target their authorized supervisor by a unique 8-hex UUID prefix without gaining access to unrelated groups.
60
59
 
61
60
  Reopened sessions and restored background subagents reclaim their previous Intercom session ID so peers can keep using the ID printed by `intercom list`. The session persists this ID as an `intercom_session_identity` entry. While a live session holds an ID, another registration receives a fresh ID instead; once released, only that same Atomic session can reclaim it while the broker remembers its previous holder.
62
61
 
@@ -73,13 +72,13 @@ With [multi-node routing](/intercom/operations#running-intercom-across-machines)
73
72
 
74
73
  | Target | Reaches |
75
74
  | --- | --- |
76
- | `subagent-worker-*`, `subagent-*`, `*` | Every visible live session in your groups whose name matches, excluding yourself. `*` matches any sequence of characters (case-insensitive). |
77
- | `subagents:*` | Every running, released, or paused subagent launched by this session across all runs. |
78
- | `subagents:<runId>/*` | Every running, released, or paused subagent in one `subagent` run. |
75
+ | `subagent-worker-*`, `subagent-*`, `*` | Every visible live session in your groups whose name (or session ID if unnamed) matches, excluding yourself. **Only `*` is a wildcard** (case-insensitive); `?` and `[...]` match literally. |
76
+ | `subagents:*` | Every **running, released, or paused** subagent launched by this session across all runs. Does **not** include `quit` subagents. |
77
+ | `subagents:<runId>/*` | Every **running, released, or paused** subagent in one `subagent` run (`subagents:` prefix is case-sensitive; `<runId>` cannot contain `/` or `*`). Does **not** include `quit` subagents. |
79
78
 
80
- Each recipient receives its own direct send with standard receipts, refusals, and reconnect retries. Pattern sends never [resume a finished subagent](#messages-that-resume-a-finished-subagent): a copy targeting an ended subagent returns the refusal in [Subagents with no live session](#subagents-with-no-live-session). The result lists every recipient's outcome (`delivered`, `queued`, `not delivered` with reason, or `outcome unknown`) and errors only if zero recipients were reached. A glob matching no visible session returns an error listing the closest visible names.
79
+ Each recipient receives its own direct send (dispatched up to 16 concurrently) with standard receipts, refusals, and reconnect retries. Pattern sends never [resume a finished subagent](#messages-that-resume-a-finished-subagent): a copy targeting an ended subagent returns the refusal in [Subagents with no live session](#subagents-with-no-live-session). The result lists every recipient's outcome (`delivered`, `queued`, `not delivered` with reason, or `outcome unknown`) and errors only if zero recipients were reached. A glob matching no visible session returns an error listing up to 5 closest visible names.
81
80
 
82
- A name glob matching more than one session (including `*`) requires `broadcast: true`. Without it, nothing is sent and the error lists every match so you can pick one exact name or repeat with `broadcast: true`. A glob matching a single session sends without the flag. `subagents:*` and `subagents:<runId>/*` never require `broadcast: true`.
81
+ A name glob matching more than one session (including `*`) requires `broadcast: true`. Without it, nothing is sent and the error lists every match so you can pick one exact name or repeat with `broadcast: true`. A glob matching a single session sends without the flag. `subagents:*` and `subagents:<runId>/*` never require `broadcast: true`. When `confirmSend: true` is set in an interactive session, a pattern send shows one confirmation prompt listing all matched recipients before sending.
83
82
 
84
83
  ```typescript
85
84
  intercom({ action: "send", to: "subagent-worker-*", message: "Scope changed", broadcast: true })
@@ -91,48 +90,148 @@ Workflow stage targets (`workflow:<rootRunId>/...`) were removed in Atomic 0.10.
91
90
 
92
91
  Session list rows show the copyable session ID first, followed by status and working directory. Generated fallback aliases are hidden in list formatting while remaining valid lookup targets. Non-agent connections (such as internal control connections) are always refused as message targets.
93
92
 
94
- ### Released subagents
93
+ ### Groups
95
94
 
96
- A [released subagent](/subagents#released-subagents) stays addressable through its launching session. That session asks the broker to hold sends to the child's name and IDs and wakes the child when a message arrives. Only the launching session owns that hold; if its connection closes, sends wait up to 20 seconds and return `recipient_owner_suspended` until the same Atomic session reconnects and takes the hold back.
95
+ Every session belongs to a non-empty set of Intercom groups. Sessions with no explicit group belong only to `"default"` locally (or their [project group](/intercom/operations#project-groups) when multi-node routing is on). Ordinary discovery and messaging require at least one shared group membership; cross-group sends are rejected by the broker.
97
96
 
98
- A background subagent waiting on an `ask` or on `contact_supervisor` (`need_decision` or `interview_request`) can be released while its question remains open, under both local and [multi-node routing](/intercom/operations#running-intercom-across-machines). While multi-node routing is starting or unavailable, the subagent stays live instead.
97
+ - **Case sensitivity.** Group names are case-sensitive (`"Team"` and `"team"` are separate groups). The reserved names `"true"` and `"auto"` are rejected case-insensitively by `join` and `leave`.
98
+ - **Leaving your last group.** Calling `leave` with `group` naming your only group returns you to your resolved startup home group (for example `project:<path>` under multi-node routing, or `"default"` locally). Calling `leave` with no `group` resets all memberships to your startup home group.
99
+ - **Persistence.** Joined and left memberships persist across restarts of the same session under the same home group, and are not inherited by forked sessions.
100
+ - **Commands.** `list` returns the union of sessions visible through your memberships (or a read-only peek of one `group`), `groups` lists all active groups, and `status` reports your complete membership set.
99
101
 
100
- - **Reply delivery.** Reply normally using `reply` or `send` with `replyTo`. The reply goes to the launching session, which wakes the subagent with the answer as its tool result.
101
- - **Exactly-once replies.** Each question accepts one reply across all nodes. Later replies to the same question are refused and never queued as ordinary messages. Retries with the same message ID return the first attempt's outcome.
102
- - **When a reply is refused.** A reply fails without reaching the subagent if the launching session disconnected, dropped the hold, or ended, or if the subagent itself ended or was stopped. If the subagent's `ask` already yielded before release, the reply (or refusal) is held like an ordinary send and wakes the subagent as a `Reply to your ask` message.
103
- - **Authorized receiver only.** Only the relaunched subagent presenting the owner's supervisor capability receives held sends. Unrelated sessions registering the same name receive nothing and do not end the hold.
104
- - **Save confirmation.** The launching session confirms the reply once saved. If it does not confirm within about 8 seconds, the replier gets an [uncertain-outcome failure](/intercom/operations#how-it-works) and may retry. Reusing a message ID already awaiting confirmation for another reply fails with `message_id_conflict`.
105
- - **How long a question stays open.** An owned reply route stays open until answered or until the question's original deadline expires. An unowned reply route (whose launching session disconnected or never reserved the child) is dropped once the launching session has been away for 7 days, matching away-session ask retention and keeping abandoned routes from filling the broker's route table permanently.
106
- - **Multi-node and restarts.** Without multi-node routing, the replier and launching session must share a local broker, and a broker restart drops local reply routes (delivering a timeout to the child). With multi-node routing on, questions asked of remote peers live in the shared database and survive both session reopens and broker restarts.
107
- - **Route capacity.** Each local broker keeps at most 10,000 local released-asker reply routes (shared-database routes do not count toward this cap). Past 10,000, new routes are refused and the subagent wakes with one failed-ask message: `The Intercom broker's released-subagent reply routes are full (limit 10000); this ask can no longer receive its reply`.
102
+ Home group resolution follows this precedence (highest first):
108
103
 
109
- #### Released-subagent and hosted-session SDK errors
104
+ 1. Explicit task or subagent `group`
105
+ 2. Inherited launching-session group
106
+ 3. SDK host `group` passed to [`createAgentSession({ intercom })`](/sdk#intercom-group-and-reach)
107
+ 4. Environment variable `ATOMIC_INTERCOM_GROUP` (setting `ATOMIC_INTERCOM_GROUP=""` explicitly shadows legacy `PI_INTERCOM_GROUP` and falls through to `config.json`)
108
+ 5. `"group"` in Intercom `config.json`
109
+ 6. Project group `project:<path>` while multi-node routing is on
110
+ 7. `"default"`
110
111
 
111
- With multi-node routing on, a conflicting reply to a shared-database released-asker question returns a typed `IntercomReleasedReplyError` (`code`, `messageId`, `questionId`, `childName`, `hint`, `retryable`) with `reasonCode` matching `code`. Check `isIntercomReleasedReplyError`, `isReleasedReplyAnsweredError`, `isReleasedReplyInFlightError`, or `isRetryableIntercomReleasedReplyError` rather than matching message text. Import these classes, guards, `IntercomReleasedReplyErrorCode`, and `serializeIntercomReleasedReplyError` / `rehydrateIntercomReleasedReplyError` from `@bastani/intercom`.
112
+ Supervisor authorization is granted by the launching parent and allows `contact_supervisor` to cross groups only for that parent-child relationship. Joining a group never grants supervisor access.
112
113
 
113
- | Class | `code` | When | `retryable` | What to do |
114
- | --- | --- | --- | --- | --- |
115
- | `ReleasedReplyAnsweredError` | `released_reply_answered` | The launching session already accepted another reply to this question, or refused a duplicate handoff after a lost confirmation. | `false` | Do not resend this reply. Send a new ordinary message if the subagent needs follow-up. |
116
- | `ReleasedReplyInFlightError` | `released_reply_in_flight` | Another reply to this question is currently being handed to the launching session. | `true` | Wait, then reply again if the question is still unanswered. |
114
+ ### Answering a sender outside your groups
117
115
 
118
- Reservation, drop, and wake-acknowledgement requests are atomic per frame: if one item is refused, nothing in the frame takes effect. Errors carry `code`, `childName` when applicable, `hint`, and `retryable: false`. Import classes, `isIntercomReleasedChildError`, `IntercomReleasedChildErrorCode`, and `serializeIntercomReleasedChildError` / `rehydrateIntercomReleasedChildError` from `@bastani/intercom`.
116
+ A session can receive a message from outside its groups (for example from a session with a [reach policy](#reach-policies), or through supervisor escalation). The recipient may answer that sender directly using `send` or `ask` without joining a new group, subject to strict return-path limits:
119
117
 
120
- | Class | `code` | When | What to do |
121
- | --- | --- | --- | --- |
122
- | `ReleasedChildReservationError` | `not_owner` | Another session owns the child (reserved it first or authorized it as supervisor). | Send the request from the owning session, or launch a new child. |
123
- | `ReleasedChildReservationError` | `group_not_allowed` | An older broker rejected a `workflow:` group reservation from a non-member session. | Reserve from a session in that group, or omit `group`. |
124
- | `ReleasedChildReservationError` | `invalid_frame`, `invalid_child_name`, `invalid_alias`, `too_many_aliases`, `invalid_group` | Malformed request: frames accept 1 to 500 children, non-empty names other than `*`, at most 4 session-ID aliases, and string groups. | Fix the invalid item and retry. |
125
- | `UnknownReleasedChildError` | `unknown_released_child` | Wake acknowledgement named a child no session reserved. | Reserve the child first. |
118
+ - **Single-session scope.** The return path reaches only that specific sender by explicit `send` or `ask`, never by pattern send (`*`, `subagents:*`), and does not add the sender to `intercom list`.
119
+ - **Session-bound.** When the sender quits permanently, the path closes; another session taking the same name or ID later cannot be reached through it.
120
+ - **Count and window.** Up to **3 messages** within **30 minutes** of the sender's latest message to you. Each new message from that sender resets the count and 30-minute window. Retried deliveries do not reopen it, and retried answers count once.
121
+ - **Multi-node support.** Return paths work identically across machines, including offline-session queueing if the sender disconnects.
122
+ - **Reach-policy exclusion.** A session that has its own [reach policy](#reach-policies) never uses return paths; recipients without a reach policy can still answer it through a return path.
126
123
 
127
- A session can host lightweight sessions on its broker connection via `IntercomClient.hostSessions` (messages arrive as `hosted_message` events, and `send(to, { hostedSender })` sends as them). Refusals return `IntercomHostedSessionError` subclasses (`code`, `key` or `sessionId`, `hint`, `retryable: false`), importable with `isIntercomHostedSessionError` and `serializeIntercomHostedSessionError` / `rehydrateIntercomHostedSessionError` from `@bastani/intercom`.
124
+ Once closed, sends to that sender fail with `<sender> is outside your intercom groups and its return path has closed`. Return paths live in broker memory and clear on broker restart. If a session inside your own groups shares the same name, address the external sender by session ID. For longer exchanges, join a shared group.
128
125
 
129
- | Class | `code` | When | What to do |
130
- | --- | --- | --- | --- |
131
- | `HostedSessionRequestError` | `invalid_hosted_frame` | Malformed request: 1 to 500 sessions per frame under distinct non-empty keys, or 1 to 500 IDs to remove. | Fix the request and resend. |
132
- | `HostedSessionRequestError` | `invalid_hosted_session` | Missing name, invalid agent registration, malformed return address, or group outside the hosting session's [reach policy](#reach-policies). | Fix the named item and resend. |
133
- | `NotHostedSessionError` | `not_hosted_by_connection` | Send named a `hostedSender`, or removal named an ID, not hosted by this connection. | Use the hosting connection, or re-host after reconnecting. |
126
+ ### send vs ask vs reply
134
127
 
135
- A hosting request unanswered after 5 seconds fails with `IntercomHostedSessionTimeoutError` (`code: "hosted_session_timeout"`, `retryable: true`). An older broker that does not support hosted sessions fails with `IntercomBrokerProtocolError` until you run `atomic intercom restart`.
128
+ **`send`** returns immediately after delivery (or queueing). It sends without prompting by default; set `confirmSend: true` in `config.json` to prompt once before single or broadcast non-reply sends in interactive sessions (replies carrying `replyTo` skip confirmation).
129
+
130
+ **`ask`** never blocks the caller indefinitely. It returns once the question is delivered with `askId`, recipient state (`idle` or `busy`), and `currentAction` when known. Wait behavior matches `bash`:
131
+
132
+ | `wait` | Behavior |
133
+ | --- | --- |
134
+ | Omitted | Waits up to the automatic yield (default 10 seconds) and returns the reply inline if it arrives in time. |
135
+ | `{ kind: "foreground", budgetMs }` | Waits up to `budgetMs`, then yields. |
136
+ | `{ kind: "background" }` | Returns immediately after delivery. |
137
+
138
+ If an `ask` yields or is interrupted, it stays pending with no expiry. Its reply arrives later as a message starting `Reply to your ask <id> from <name>` (starting a turn when idle, or arriving after the current tool call when busy). Refusals and recipient exits arrive as failed-ask messages starting `Your ask <id> to <name> failed`. Saved sessions that close (anything other than `--no-session`) count as away rather than ended, so their asks stay pending until they reopen.
139
+
140
+ **Pending ask persistence and limits:**
141
+
142
+ - Use `pending` to view waiting asks and `cancel` (`askId`) to cancel one. Replies arriving after cancellation still show once, marked late.
143
+ - Restarting either session preserves open asks and delivers each reply once (holding replies for closed askers with `Reply delivered (held for <asker> until it is back)`).
144
+ - Asks waiting on a session that stays away for more than 7 days, or ends permanently, are dropped. Forked sessions do not inherit their parent's asks.
145
+ - Each closed recipient holds at most 1,000 waiting asks; asks beyond that fail immediately with `Session "<name>" went away and its queue of asks waiting for its return is full (limit 1000); this ask was not kept`. Existing asks and held replies are never evicted.
146
+ - Only the asked recipient can answer an ask; messages naming the ask from another session arrive as ordinary messages.
147
+ - Up to `maxPendingAsks` asks (default `6`, shared with `contact_supervisor` blocking waits) can wait inline concurrently; further asks still send and deliver their replies as messages.
148
+
149
+ An inbound ask stays in `pending` until you reply to it or close it with `intercom({ action: "cancel", replyTo })`. It also closes automatically when no reply can reach the asker (for example if the asker was one of your subagents and ended, or if the broker rejects the route).
150
+
151
+ **Subagents and terminal reply capability.** Single-target `send` and `ask` calls from `intercom` to completed or failed subagents queue immediately and resume the subagent through its launching session. Calls to paused or quit subagents queue without resuming until the launching session continues them.
152
+
153
+ Only permanently cancelled (`killed`) subagents, pattern sends, calls past the wake rate or chain limits, or a still-connected registration marked `replyCapability: "terminal"` reject asks immediately with `Target noninteractive child is terminal and cannot reply; launch a fresh child with explicit context`. In-flight pending asks fail explicitly if the recipient terminates before replying. Live interactive idle sessions remain askable.
154
+
155
+ **`contact_supervisor`** allows one blocking `need_decision` (requires `message`) or `interview_request` wait per subagent at a time (coexisting with ordinary peer asks and sharing the `maxPendingAsks` capacity). A second concurrent supervisor wait fails with `Already waiting for a supervisor reply`. Blocking supervisor waits time out after 10 minutes. Only a direct single-child launch in an embedded SDK session without background task management uses the terminal `[TASK_CONTEXT]` fresh-child handoff when a blocking parent request is claimed.
156
+
157
+ **`reply`** targets the incoming Intercom message that triggered the current turn, or falls back to the single unresolved inbound ask. When multiple asks are pending, inspect with `pending` and pass `to` or the exact `replyTo` message ID (required when one sender has multiple open asks). Explicit `to` and `replyTo` selectors override the active turn, must match each other if both are provided, and fail without fallback when unknown or stale.
158
+
159
+ ### Attachments
160
+
161
+ `send`, `ask`, and `reply` accept `attachments`: an array of `{ type, name, content, language? }` objects where `type` is `"file"`, `"snippet"`, or `"context"`. Attachment content appears inside the recipient's model-visible message body. In an embedded SDK session without background task management, a claimed direct single-child handoff preserves the same ordered attachments verbatim. Attachments are not exposed in the `Alt+M` compose overlay.
162
+
163
+ ### Message size limits
164
+
165
+ Message text is capped at **1 MiB** (UTF-8 bytes), and text plus all attachment names, languages, and content is capped at **8 MiB**. Larger messages are refused without sending:
166
+
167
+ - Text over 1 MiB: `Intercom message text is <n> bytes, over the limit of 1048576 bytes (1 MiB); the message was not sent`
168
+ - Total over 8 MiB: `Intercom message text and attachments total <n> bytes, over the limit of 8388608 bytes (8 MiB); the message was not sent`
169
+
170
+ For larger payloads, write a file and send its path.
171
+
172
+ Any received message whose text and attachments exceed **50 KB** (UTF-8 bytes) is saved to a file in the recipient's session directory (or temporary directory when unsaved) instead of entering context whole. The chat card displays a preview and the file path, matching oversized tool output.
173
+
174
+ ## Configuration
175
+
176
+ Create `~/.atomic/agent/intercom/config.json` (or under `ATOMIC_CODING_AGENT_DIR`, falling back to `PI_CODING_AGENT_DIR`; when `ATOMIC_CODING_AGENT_DIR` is unset, Atomic falls back to `~/.pi/agent/intercom/config.json` if the Atomic file is absent):
177
+
178
+ ```json
179
+ {
180
+ "brokerCommand": "npx",
181
+ "brokerArgs": ["--no-install", "tsx"],
182
+ "brokerStartupTimeoutMs": 30000,
183
+ "confirmSend": false,
184
+ "maxPendingAsks": 6,
185
+ "replyHint": true,
186
+ "status": "researching",
187
+ "group": "default",
188
+ "joinAtStartup": true
189
+ }
190
+ ```
191
+
192
+ | Setting | Default | Description |
193
+ | --- | --- | --- |
194
+ | `brokerCommand` | `"npx"` | Non-empty trimmed string naming the command used to start the local broker process. The default sentinel uses Atomic's own runtime without requiring `npx` or `tsx` on `PATH`. |
195
+ | `brokerArgs` | `["--no-install", "tsx"]` | String array of arguments passed to `brokerCommand` before the broker script path. |
196
+ | `brokerStartupTimeoutMs` | `30000` | Integer >= `1000`. Milliseconds a spawn attempt waits for a newly started broker to answer on its socket. |
197
+ | `confirmSend` | `false` | Boolean. Show a confirmation dialog before single or broadcast non-reply sends in interactive sessions with UI. |
198
+ | `maxPendingAsks` | `6` | Integer >= `1`. Maximum concurrent blocking reply waits per session (shared by `intercom` `ask` and `contact_supervisor`); further asks still send and deliver replies as messages. |
199
+ | `replyHint` | `true` | Boolean. Include the `intercom({ action: "reply", ... })` hint in incoming messages. |
200
+ | `status` | None | Optional custom string suffix appended after the automatic lifecycle status (for example `thinking · researching`). |
201
+ | `group` | `"default"`, or project group with multi-node routing | String setting the default home Intercom group ([Groups](#groups)). An empty string `""` falls through to the project group or `"default"`. Overridden by `ATOMIC_INTERCOM_GROUP` / `PI_INTERCOM_GROUP`, SDK host `intercom` policy, and subagent group injection. |
202
+ | `joinAtStartup` | `true` | Boolean. Have interactive sessions join Intercom automatically 3 seconds after startup. Set `false` to join on first Intercom use instead. Overridden by `ATOMIC_INTERCOM_JOIN_AT_STARTUP` (`0`/`false` disables, `1`/`true` enables; legacy `PI_INTERCOM_JOIN_AT_STARTUP`). |
203
+
204
+ Explicit custom broker commands remain supported. For example, to run the broker with Bun from `PATH`:
205
+
206
+ ```json
207
+ {
208
+ "brokerCommand": "bun",
209
+ "brokerArgs": []
210
+ }
211
+ ```
212
+
213
+ Config validation is strict for the 9 recognized keys above (unknown extra keys are ignored): if `config.json` is invalid JSON or any recognized key has an invalid type or range, the entire file is rejected, an error is logged, and all defaults apply.
214
+
215
+ Intercom publishes live session status automatically: sessions register as `idle`, switch to `thinking` while running, show `tool:<name>` during tool calls, and return to `idle` on completion. Any configured `status` string is appended rather than replacing lifecycle status.
216
+
217
+ Activity status is separate from reply capability. As an SDK/host metadata field, session rows expose `replyCapability` (`"live"` or `"terminal"`) when supplied by the host. A still-connected non-interactive child marked `"terminal"` rejects asks even if its activity reads `idle`, while a completed or failed subagent whose session has ended is resumed by single-target `send` or `ask` from the `intercom` tool.
218
+
219
+ ## Subagent delivery and wake queues
220
+
221
+ ### Released subagents
222
+
223
+ A [released subagent](/subagents#released-subagents) stays addressable through its launching session. That session asks the broker to hold sends to the subagent's name and IDs and wakes it when a message arrives. Only the launching session owns that hold; if its connection closes, sends wait up to 20 seconds and return `recipient_owner_suspended` until the same Atomic session reconnects and takes the hold back.
224
+
225
+ A background subagent waiting on an `ask` or on `contact_supervisor` (`need_decision` or `interview_request`) can be released while its question remains open, under both local and [multi-node routing](/intercom/operations#running-intercom-across-machines). While multi-node routing is starting or unavailable, the subagent stays live instead.
226
+
227
+ - **Reply delivery.** Reply normally using `reply` or `send` with `replyTo`. The reply goes to the launching session, which wakes the subagent with the answer as its tool result.
228
+ - **Exactly-once replies.** Each question accepts one reply across all nodes. Later replies to the same question are refused and never queued as ordinary messages. Retries with the same message ID return the first attempt's outcome.
229
+ - **When a reply is refused.** A reply fails without reaching the subagent if the launching session disconnected, dropped the hold, or ended, or if the subagent itself ended or was stopped. If the subagent's `ask` already yielded before release, the reply (or refusal) is held like an ordinary send and wakes the subagent as a `Reply to your ask` message.
230
+ - **Authorized receiver only.** Only the relaunched subagent presenting the launching session's supervisor capability receives held sends. Unrelated sessions registering the same name receive nothing and do not end the hold.
231
+ - **Save confirmation.** The launching session confirms the reply once saved. If it does not confirm within about 8 seconds, the replier gets an [uncertain-outcome failure](/intercom/operations#how-it-works) and may retry. Reusing a message ID already awaiting confirmation for another reply fails with `message_id_conflict`.
232
+ - **How long a question stays open.** A reply route backed by a live launching session stays open until answered or until the question's original deadline expires. A reply route whose launching session disconnected or never reserved the subagent is dropped once the launching session has been away for 7 days, matching away-session ask retention.
233
+ - **Multi-node and restarts.** Without multi-node routing, the replier and launching session must share a local broker, and a broker restart drops local reply routes (delivering a timeout to the subagent). With multi-node routing on, questions asked of remote peers live in the shared database and survive both session reopens and broker restarts.
234
+ - **Route capacity.** Each local broker keeps at most 10,000 local released-asker reply routes (shared-database routes do not count toward this cap). Past 10,000, new routes are refused and the subagent wakes with one failed-ask message: `The Intercom broker's released-subagent reply routes are full (limit 10000); this ask can no longer receive its reply`.
136
235
 
137
236
  ### Subagents with no live session
138
237
 
@@ -151,11 +250,11 @@ The send result exposes `reasonCode` and `error` (`target`, `childName`, optiona
151
250
  | `SubagentRecipientDisconnectedError` | `recipient_disconnected` | The subagent disconnected, did not reconnect within 20 seconds, and no owner report arrived. | `true` | Check `subagent({ action: "status" })` in the launching session, or retry shortly. |
152
251
  | `SubagentRecipientOwnerSuspendedError` | `recipient_owner_suspended` | The subagent is released, but its launching session is disconnected or suspended. | `true` | Retry once the launching session reconnects. |
153
252
 
154
- Launching sessions report at most 500 ended subagents per frame; malformed reports fail with the `ReleasedChildReservationError` codes above.
253
+ Launching sessions report at most 500 ended subagents per request; malformed reports fail with the `ReleasedChildReservationError` codes below.
155
254
 
156
255
  ### Messages that resume a finished subagent
157
256
 
158
- A single-target `send` or `ask` from the `intercom` tool to a subagent by name or ID opts in to waking an ended recipient (`SendOptions.wakeEndedRecipient`; SDK callers set this option explicitly). Behavior depends on how the child ended:
257
+ A single-target `send` or `ask` from the `intercom` tool to a subagent by name or ID opts in to waking an ended recipient (`SendOptions.wakeEndedRecipient`; SDK callers set this option explicitly). Behavior depends on how the subagent ended:
159
258
 
160
259
  | Last run | Immediate result | What happens next |
161
260
  | --- | --- | --- |
@@ -163,7 +262,7 @@ A single-target `send` or `ask` from the `intercom` tool to a subagent by name o
163
262
  | Paused or quit (or interrupted with its parent) | Returns at once with `queued: true` and `target: "paused subagent"`. | The subagent is not resumed automatically. Your message waits until the launching session continues it, arriving after the continuation prompt. |
164
263
  | Permanently cancelled or gone | Refused immediately with `recipient_cancelled`. | Nothing is queued. |
165
264
 
166
- The launching session keeps ownership of the resumed child: its completion notice, `/tasks` entry, budget, and `pause`/`quit` controls stay in that session, and its transcript records who woke it. An `ask` stays open and delivers its answer later as `Reply to your ask <id> from <name>`.
265
+ The launching session keeps ownership of the resumed subagent: its completion notice, `/tasks` entry, budget, and `pause`/`quit` controls stay in that session, and its transcript records who woke it. An `ask` stays open and delivers its answer later as `Reply to your ask <id> from <name>`.
167
266
 
168
267
  If a queued message can no longer be delivered, the sender receives one delivery failure (a failed ask or `Intercom delivery failed`). Common causes are the subagent being cancelled, the launching session declining or missing the 20-second wake reply window, the resumed subagent failing to start within 1 hour, or the launching session ending or staying away for 7 days in a row.
169
268
 
@@ -176,7 +275,7 @@ Queued messages for finished or paused subagents are persisted before the broker
176
275
  After a broker restart, crash, or reboot, the next broker restores queued messages in order:
177
276
 
178
277
  - When the launching session reconnects and reports the subagent, completed or failed subagents resume once for their queued messages, while paused or quit subagents keep waiting until continued.
179
- - The broker waits up to 7 consecutive days while the launching session is away; reconnecting resets that 7-day counter, and connected owners have no wait limit.
278
+ - The broker waits up to 7 consecutive days while the launching session is away; reconnecting resets that 7-day counter, and connected launching sessions have no wait limit.
180
279
  - A message already handed to the subagent just before a broker crash is redelivered on reconnect without triggering a duplicate resume, and a saved copy is ignored.
181
280
  - A sender retrying the same message ID after a disconnect receives `queued` again without duplicating the stored message.
182
281
 
@@ -191,83 +290,7 @@ A write blocked by another process's lock for 5 seconds fails immediately. Local
191
290
  - **Queue capacity.** Up to 256 messages and 32 MiB per subagent, 256 MiB across one broker, and a 1,088 MiB local-file cap. Queued messages are never dropped to make room; new messages past a cap are refused until space frees up.
192
291
  - **Scope.** Pattern sends (`subagents:*`, `name-*`), replies, and older clients never wake an ended subagent. Under [multi-node routing](/intercom/operations#running-intercom-across-machines), only senders on the launching session's broker trigger this wake queue; senders on other hosts use the [offline-session queue](/intercom/operations#offline-sessions).
193
292
 
194
- ### Groups
195
-
196
- Every session belongs to a non-empty set of Intercom groups. Sessions with no explicit group belong only to `"default"` locally (or their [project group](/intercom/operations#project-groups) when multi-node routing is on). Ordinary discovery and messaging require at least one shared group membership; cross-group sends are rejected by the broker.
197
-
198
- - `list` returns the union of sessions visible through your memberships, or a read-only view of one `group`.
199
- - `groups` lists all active groups, their session counts, and your memberships.
200
- - `join` adds one group; `leave` removes the named group or, with no `group`, resets to your startup home group.
201
- - `status` reports your complete membership set.
202
-
203
- Home group resolution follows this precedence (highest first):
204
-
205
- 1. Explicit task or subagent `group`
206
- 2. Inherited launching-session group
207
- 3. SDK host `group` passed to [`createAgentSession({ intercom })`](/sdk#intercom-group-and-reach)
208
- 4. Environment variable `ATOMIC_INTERCOM_GROUP` (legacy fallback `PI_INTERCOM_GROUP`)
209
- 5. `"group"` in Intercom `config.json`
210
- 6. Project group `project:<owner>/<repo>` while multi-node routing is on
211
- 7. `"default"`
212
-
213
- Supervisor authorization is granted by the launching parent and allows `contact_supervisor` to cross groups only for that parent-child relationship. Joining a group never grants supervisor access.
214
-
215
- #### Reach policies
216
-
217
- An SDK host can assign a reach policy via [`createAgentSession({ intercom: { group, reachable } })`](/sdk#intercom-group-and-reach) and update `reachable` dynamically with `session.intercom.setReachable(groups)`:
218
-
219
- - The session can list, send to, and ask only sessions in its home group, its `reachable` groups, or subgroups under its home group (`<group>/...`, where its subagents run). Out-of-policy targets fail with `Target session is outside this session's Intercom reach (...)` (or `Session not found` for unseen names) and are never queued or held.
220
- - Reach is one-way: reaching group B does not let group B initiate messages back unless B's own memberships or policy allow it. Replies to asks received by B are always allowed.
221
- - `groups` lists only home and reachable groups (including empty ones), `join` accepts only those groups, `leave` cannot remove the home group, and `list`/`status` peeks stay within reach.
222
- - Narrowing `reachable` automatically leaves removed groups from the next call onward. In-flight sends already accepted by the broker keep their original reach; sends with unknown outcomes after a disconnect are never retried under a changed reach.
223
- - Subagents of a policy-constrained session inherit a reach policy with their own group as home (placed under the parent's home group if custom) and no additional reachable groups. `contact_supervisor` keeps its authorized route.
224
-
225
- The broker enforces reach policies server-side. Sessions with a reach policy require a current broker; if an older broker cannot be replaced automatically, connection fails with `IntercomReachUnsupportedError` until you run `atomic intercom restart`.
226
-
227
- ### Answering a sender outside your groups
228
-
229
- A session can receive a message from outside its groups (for example from a session with a [reach policy](#reach-policies), or through supervisor escalation). The recipient may answer that sender directly using `send` or `ask` without joining a new group, subject to strict return-path limits:
230
-
231
- - **Single-session scope.** The return path reaches only that specific sender by explicit `send` or `ask`, never by pattern send (`*`, `subagents:*`), and does not add the sender to `intercom list`.
232
- - **Session-bound.** When the sender quits permanently, the path closes; another session taking the same name or ID later cannot be reached through it.
233
- - **Count and window.** Up to **3 messages** within **30 minutes** of the sender's latest message to you. Each new message from that sender resets the count and 30-minute window. Retried deliveries do not reopen it, and retried answers count once.
234
- - **Multi-node support.** Return paths work identically across machines, including offline-session queueing if the sender disconnects.
235
- - **Reach-policy exclusion.** A session that has its own [reach policy](#reach-policies) never uses return paths; recipients without a reach policy can still answer it through a return path.
236
-
237
- Once closed, sends to that sender fail with `<sender> is outside your intercom groups and its return path has closed`. Return paths live in broker memory and clear on broker restart. If a session inside your own groups shares the same name, address the external sender by session ID. For longer exchanges, join a shared group.
238
-
239
- ### send vs ask vs reply
240
-
241
- **`send`** returns immediately after delivery (or queueing). It sends without prompting by default; set `confirmSend: true` in `config.json` to prompt before non-reply sends in interactive sessions (replies carrying `replyTo` still skip confirmation).
242
-
243
- **`ask`** never blocks the caller indefinitely. It returns once the question is delivered with `askId`, recipient state (`idle` or `busy`), and `currentAction` when known. Wait behavior matches `bash`:
244
-
245
- | `wait` | Behavior |
246
- | --- | --- |
247
- | Omitted | Waits up to the automatic yield (default 10 seconds) and returns the reply inline if it arrives in time. |
248
- | `{ kind: "foreground", budgetMs }` | Waits up to `budgetMs`, then yields. |
249
- | `{ kind: "background" }` | Returns immediately after delivery. |
250
-
251
- If an `ask` yields or is interrupted, it stays pending with no expiry. Its reply arrives later as a message starting `Reply to your ask <id> from <name>` (starting a turn when idle, or arriving after the current tool call when busy). Refusals and recipient exits arrive as failed-ask messages starting `Your ask <id> to <name> failed`. Saved sessions that close (anything other than `--no-session`) count as away rather than ended, so their asks stay pending until they reopen.
252
-
253
- **Pending ask persistence and limits:**
254
-
255
- - Use `pending` to view waiting asks and `cancel` (`askId`) to cancel one. Replies arriving after cancellation still show once, marked late.
256
- - Restarting either session preserves open asks and delivers each reply once (holding replies for closed askers with `Reply delivered (held for <asker> until it is back)`).
257
- - Asks waiting on a session that stays away for more than 7 days, or ends permanently, are dropped. Forked sessions do not inherit their parent's asks.
258
- - Each closed recipient holds at most 1,000 waiting asks; asks beyond that fail immediately with `Session "<name>" went away and its queue of asks waiting for its return is full (limit 1000); this ask was not kept`. Existing asks and held replies are never evicted.
259
- - Only the asked recipient can answer an ask; messages naming the ask from another session arrive as ordinary messages.
260
- - Up to `maxPendingAsks` asks (default `6`) can wait inline concurrently; further asks still send and deliver their replies as messages.
261
-
262
- An inbound ask stays in `pending` until you reply to it or close it with `intercom({ action: "cancel", replyTo })`. It also closes automatically when no reply can reach the asker (for example if the asker was one of your subagents and ended, or if the broker rejects the route).
263
-
264
- **Subagents and terminal reply capability.** Single-target `send` and `ask` calls from `intercom` to completed or failed subagents queue immediately and resume the child through its launching session. Calls to paused or quit subagents queue without resuming until the launching session continues them.
265
-
266
- Only permanently cancelled (`killed`) children, pattern sends, calls past the wake rate or chain limits, or a still-connected registration marked `replyCapability: "terminal"` reject asks immediately with `Target noninteractive child is terminal and cannot reply; launch a fresh child with explicit context`. In-flight pending asks fail explicitly if the recipient terminates before replying. Live interactive idle sessions remain askable.
267
-
268
- **`contact_supervisor`** allows one blocking `need_decision` or `interview_request` wait per child at a time (coexisting with ordinary peer asks). A second concurrent supervisor wait fails with `Already waiting for a supervisor reply`. Blocking supervisor waits time out after 10 minutes. Only a direct single-child launch in an SDK session without a task host retains the terminal `[TASK_CONTEXT]` fresh-child handoff when a blocking parent request is claimed.
269
-
270
- **`reply`** targets the incoming Intercom message that triggered the current turn, or falls back to the single unresolved inbound ask. When multiple asks are pending, inspect with `pending` and pass `to` or the exact `replyTo` message ID (required when one sender has multiple open asks). Explicit `to` and `replyTo` selectors override the active turn, must match each other if both are provided, and fail without fallback when unknown or stale.
293
+ ## Programmatic and SDK reference
271
294
 
272
295
  ### From codemode scripts
273
296
 
@@ -292,22 +315,49 @@ return Promise.all(
292
315
  );
293
316
  ```
294
317
 
295
- ### Attachments
318
+ ### Reach policies
296
319
 
297
- `send`, `ask`, and `reply` accept `attachments`: an array of `{ type, name, content, language? }` objects where `type` is `"file"`, `"snippet"`, or `"context"`. Attachment content appears inside the recipient's model-visible message body. In an SDK session without a task host, a claimed direct single-child parent handoff preserves the same ordered attachments verbatim. Attachments are not exposed in the ALT+M compose overlay.
320
+ An SDK host can assign a reach policy via [`createAgentSession({ intercom: { group, reachable } })`](/sdk#intercom-group-and-reach) and update `reachable` dynamically with `session.intercom.setReachable(groups)`:
298
321
 
299
- ### Message size limits
322
+ - The session can list, send to, and ask only sessions in its home group, its `reachable` groups, or subgroups under its home group (`<group>/...`, where its subagents run). Out-of-policy targets fail with `Target session is outside this session's Intercom reach (...)` (or `Session not found` for unseen names) and are never queued or held.
323
+ - Reach is one-way: reaching group B does not let group B initiate messages back unless B's own memberships or policy allow it. Replies to asks received by B are always allowed.
324
+ - `groups` lists only home and reachable groups (including empty ones), `join` accepts only those groups, `leave` cannot remove the home group, and `list`/`status` peeks stay within reach.
325
+ - Narrowing `reachable` automatically leaves removed groups from the next call onward. In-flight sends already accepted by the broker keep their original reach; sends with unknown outcomes after a disconnect are never retried under a changed reach.
326
+ - Subagents of a policy-constrained session inherit a reach policy with their own group as home (placed under the parent's home group if custom) and no additional reachable groups. `contact_supervisor` keeps its authorized route.
300
327
 
301
- Message text is capped at **1 MiB** (UTF-8 bytes), and text plus all attachment names, languages, and content is capped at **8 MiB**. Larger messages are refused without sending:
328
+ The broker enforces reach policies server-side. Sessions with a reach policy require a current broker; if an older broker cannot be replaced automatically, connection fails with `IntercomReachUnsupportedError` until you run `atomic intercom restart`.
302
329
 
303
- - Text over 1 MiB: `Intercom message text is <n> bytes, over the limit of 1048576 bytes (1 MiB); the message was not sent`
304
- - Total over 8 MiB: `Intercom message text and attachments total <n> bytes, over the limit of 8388608 bytes (8 MiB); the message was not sent`
330
+ ### Hosted sessions and registration purpose (SDK)
305
331
 
306
- For larger payloads, write a file and send its path.
332
+ Custom SDK hosts can optionally pass `recipientPurpose` (`"agent"` or `"control"`) when registering a session; omitting it defaults to `"agent"`. Invalid values are rejected, and a session's purpose cannot change after registration.
307
333
 
308
- Any received message whose text and attachments exceed **50 KB** (UTF-8 bytes) is saved to a file in the recipient's session directory (or temporary directory when unsaved) instead of entering context whole. The chat card displays a preview and the file path, matching oversized tool output.
334
+ A session can host lightweight sessions on its broker connection via `IntercomClient.hostSessions` (messages arrive as `hosted_message` events, and `send(to, { hostedSender })` sends as them). Refusals return `IntercomHostedSessionError` subclasses (`code`, `key` or `sessionId`, `hint`, `retryable: false`), importable with `isIntercomHostedSessionError` and `serializeIntercomHostedSessionError` / `rehydrateIntercomHostedSessionError` from `@bastani/intercom`:
335
+
336
+ | Class | `code` | When | What to do |
337
+ | --- | --- | --- | --- |
338
+ | `HostedSessionRequestError` | `invalid_hosted_frame` | Malformed request: 1 to 500 sessions per request under distinct non-empty keys, or 1 to 500 IDs to remove. | Fix the request and resend. |
339
+ | `HostedSessionRequestError` | `invalid_hosted_session` | Missing name, invalid agent registration, malformed return address, or group outside the hosting session's [reach policy](#reach-policies). | Fix the named item and resend. |
340
+ | `NotHostedSessionError` | `not_hosted_by_connection` | Send named a `hostedSender`, or removal named an ID, not hosted by this connection. | Use the hosting connection, or re-host after reconnecting. |
341
+
342
+ A hosting request unanswered after 5 seconds fails with `IntercomHostedSessionTimeoutError` (`code: "hosted_session_timeout"`, `retryable: true`). An older broker that does not support hosted sessions fails with `IntercomBrokerProtocolError` until you run `atomic intercom restart`.
309
343
 
310
- ## SDK broker and routing errors
344
+ ### Released-subagent SDK errors
345
+
346
+ With multi-node routing on, a conflicting reply to a shared-database released-asker question returns a typed `IntercomReleasedReplyError` (`code`, `messageId`, `questionId`, `childName`, `hint`, `retryable`) with `reasonCode` matching `code`. Check `isIntercomReleasedReplyError`, `isReleasedReplyAnsweredError`, `isReleasedReplyInFlightError`, or `isRetryableIntercomReleasedReplyError` rather than matching message text. Import these classes, guards, `IntercomReleasedReplyErrorCode`, and `serializeIntercomReleasedReplyError` / `rehydrateIntercomReleasedReplyError` from `@bastani/intercom`.
347
+
348
+ | Class | `code` | When | `retryable` | What to do |
349
+ | --- | --- | --- | --- | --- |
350
+ | `ReleasedReplyAnsweredError` | `released_reply_answered` | The launching session already accepted another reply to this question, or refused a duplicate handoff after a lost confirmation. | `false` | Do not resend this reply. Send a new ordinary message if the subagent needs follow-up. |
351
+ | `ReleasedReplyInFlightError` | `released_reply_in_flight` | Another reply to this question is currently being handed to the launching session. | `true` | Wait, then reply again if the question is still unanswered. |
352
+
353
+ Reservation, drop, and wake-acknowledgement requests are atomic per request: if one item is refused, nothing in the request takes effect. Errors carry `code`, `childName` when applicable, `hint`, and `retryable: false`. Import classes, `isIntercomReleasedChildError`, `IntercomReleasedChildErrorCode`, and `serializeIntercomReleasedChildError` / `rehydrateIntercomReleasedChildError` from `@bastani/intercom`.
354
+
355
+ | Class | `code` | When | What to do |
356
+ | --- | --- | --- | --- |
357
+ | `ReleasedChildReservationError` | `not_owner` | Another session owns the child (reserved it first or authorized it as supervisor). | Send the request from the owning session, or launch a new child. |
358
+ | `ReleasedChildReservationError` | `group_not_allowed` | An older broker rejected a `workflow:` group reservation from a non-member session. | Reserve from a session in that group, or omit `group`. |
359
+ | `ReleasedChildReservationError` | `invalid_frame`, `invalid_child_name`, `invalid_alias`, `too_many_aliases`, `invalid_group` | Malformed request: requests accept 1 to 500 children, non-empty names other than `*`, at most 4 session-ID aliases, and string groups. | Fix the invalid item and retry. |
360
+ | `UnknownReleasedChildError` | `unknown_released_child` | Wake acknowledgement named a child no session reserved. | Reserve the child first. |
311
361
 
312
362
  ### Broker errors
313
363
 
@@ -325,53 +375,8 @@ Exported from `@bastani/atomic` with `isProjectGroupError()`, `isIntercomRouting
325
375
 
326
376
  | Class | `code` | When it happens | Fields | What to do |
327
377
  | --- | --- | --- | --- | --- |
328
- | `ProjectGroupError` | `git-unavailable` or `git-failed` | Multi-node routing tried to derive `project:<owner>/<repo>` inside a Git repository, but `git` is missing or failed. Not retried in the background. | `cwd`, `detail`, `hint` | Install Git, fix the repository error, or set `ATOMIC_INTERCOM_GROUP` to skip the lookup. |
378
+ | `ProjectGroupError` | `git-unavailable` or `git-failed` | Multi-node routing tried to derive `project:<path>` inside a Git repository, but `git` is missing or failed. Not retried in the background. | `cwd`, `detail`, `hint` | Install Git, fix the repository error, or set `ATOMIC_INTERCOM_GROUP` to skip the lookup. |
329
379
  | `IntercomRoutingMismatchError` | `broker-routing-mismatch` | The broker routes across machines while the session joined implicitly as `default` (`reason: "implicit-default-on-remote-broker"`), or the session selected shared storage (`storage` or `ATOMIC_PROFILE=ci`) while the running broker started without it (`reason: "shared-storage-not-on-broker"`). Terminal until session restart. | `reason`, `group`, `hint`, `retryable: false` | Run `atomic intercom restart` (if the broker lacks shared storage), then restart the session or set `ATOMIC_INTERCOM_GROUP`. |
330
380
  | `IntercomRoutingUnavailableError` | `broker-routing-unavailable` | The broker closed status without answering (`reason: "unsupported"`), sent an unreadable report (`"malformed"`), or is an older broker that could not be replaced while multi-node storage is active. | `reason`, `phase`, `hint`, `retryable: true`, optional `cause` | Run `atomic intercom restart` to replace the broker. |
331
381
  | `IntercomRoutingTimeoutError` | `broker-routing-timeout` | The broker accepted the routing status check but did not answer in time. | `timeoutMs`, `elapsedMs`, `phase`, `hint`, `retryable: true` | Wait for reconnect backoff, or run `atomic intercom restart` if it persists. |
332
382
  | `IntercomRoutingChangedError` | `broker-routing-changed` | The broker's routing mode changed between the session's status check and registration, so registration was refused. | `expectedAcrossMachines`, `hint`, `retryable: true` | Wait for automatic retry, or run `atomic intercom restart` if it persists. |
333
-
334
- ## Configuration
335
-
336
- Create `~/.atomic/agent/intercom/config.json` (Atomic falls back to `~/.pi/agent/intercom/config.json` when the Atomic file is absent):
337
-
338
- ```json
339
- {
340
- "brokerCommand": "npx",
341
- "brokerArgs": ["--no-install", "tsx"],
342
- "brokerStartupTimeoutMs": 30000,
343
- "confirmSend": false,
344
- "maxPendingAsks": 6,
345
- "replyHint": true,
346
- "status": "researching",
347
- "group": "default",
348
- "joinAtStartup": true
349
- }
350
- ```
351
-
352
- | Setting | Default | Description |
353
- | --- | --- | --- |
354
- | `brokerCommand` | `"npx"` | Command used to start the local broker process. The default sentinel uses Atomic's own runtime without requiring `npx` or `tsx` on `PATH`. |
355
- | `brokerArgs` | `["--no-install", "tsx"]` | Arguments passed to `brokerCommand` before the broker script path. |
356
- | `brokerStartupTimeoutMs` | `30000` | Integer >= `1000`. Milliseconds a spawn attempt waits for a newly started broker to answer on its socket. |
357
- | `confirmSend` | `false` | Show a confirmation dialog before non-reply sends in interactive sessions with UI. |
358
- | `maxPendingAsks` | `6` | Integer >= `1`. Maximum concurrent blocking reply waits per session; further asks still send and deliver replies as messages. |
359
- | `replyHint` | `true` | Include the `intercom({ action: "reply", ... })` hint in incoming messages. |
360
- | `status` | None | Optional custom status suffix appended after the automatic lifecycle status (for example `thinking · researching`). |
361
- | `group` | `"default"`, or project group with multi-node routing | Default home Intercom group ([Groups](#groups)). Overridden by `ATOMIC_INTERCOM_GROUP` / `PI_INTERCOM_GROUP`, SDK host `intercom` policy, and subagent group injection. |
362
- | `joinAtStartup` | `true` | Have interactive sessions join Intercom automatically a few seconds after startup. Set `false` to join on first Intercom use instead. Overridden by `ATOMIC_INTERCOM_JOIN_AT_STARTUP` (`0` disables, `1` enables). |
363
-
364
- Explicit custom broker commands remain supported. For example, to run the broker with Bun from `PATH`:
365
-
366
- ```json
367
- {
368
- "brokerCommand": "bun",
369
- "brokerArgs": []
370
- }
371
- ```
372
-
373
- Config validation is strict: if `config.json` is invalid JSON or any field has an invalid type or range, the entire file is rejected, an error is logged, and all defaults apply.
374
-
375
- Intercom publishes live session status automatically: sessions register as `idle`, switch to `thinking` while running, show `tool:<name>` during tool calls, and return to `idle` on completion. Any configured `status` string is appended rather than replacing lifecycle status.
376
-
377
- Activity status is not reply capability. Session rows expose `replyCapability` (`"live"` or `"terminal"`) when supplied by the host. A still-connected non-interactive child marked `"terminal"` rejects asks even if its activity reads `idle`, while a completed or failed subagent whose session has ended is resumed by single-target `send` or `ask` from the `intercom` tool.