@bastani/atomic 0.10.14 → 0.10.15-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 (341) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/_shared/dist-KOELCESV.js +2 -2
  3. package/dist/_shared/fork-row-index-UAUAQRD5.js +2 -2
  4. package/dist/_shared/lib-4PES5P4V.js +2 -2
  5. package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js +3 -3
  6. package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +3 -3
  7. package/dist/_shared/mode-shared-2QJSCUM6.js +3 -3
  8. package/dist/_shared/p1a-prewarm-XIU57JHF.js +3 -3
  9. package/dist/_shared/runtime-O4KCSG4C.js +2 -2
  10. package/dist/_shared/{sdk-B5LEWGGI.js → sdk-OHKMDJ74.js} +27 -5
  11. package/dist/_shared/{sdk-B5LEWGGI.js.map → sdk-OHKMDJ74.js.map} +1 -1
  12. package/dist/_shared/session-data-AHTU7IS6.js +2 -2
  13. package/dist/_shared/startup-0-0-Q3MWKUK4.js +2 -2
  14. package/dist/_shared/startup-0-1-M6OWAYHH.js +2 -2
  15. package/dist/_shared/{startup-0-2-5QHPCEON.js → startup-0-2-2HUMCPKX.js} +14 -16
  16. package/dist/_shared/startup-0-2-2HUMCPKX.js.map +1 -0
  17. package/dist/_shared/startup-0-3-4ZYBYQNM.js +3 -3
  18. package/dist/_shared/startup-0-4-ZMJV547D.js +3 -3
  19. package/dist/_shared/startup-0-5-YDW47QX6.js +3 -3
  20. package/dist/_shared/startup-10-0-TDQNBDDL.js +3 -3
  21. package/dist/_shared/startup-14-0-MLX36RBG.js +1 -1
  22. package/dist/_shared/startup-15-0-YUKGAC63.js +1 -1
  23. package/dist/_shared/startup-15-1-4S7FLMNG.js +6 -30
  24. package/dist/_shared/startup-15-1-4S7FLMNG.js.map +1 -1
  25. package/dist/_shared/startup-8-0-34CBHPZH.js +3 -3
  26. package/dist/_shared/startup-8-1-LZFXSD3Z.js +3 -3
  27. package/dist/_shared/storage-command-7MGXLJGZ.js +2 -2
  28. package/dist/_shared/storage-status-K7PX2RXA.js +3 -3
  29. package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +2 -2
  30. package/dist/_shared/tree-outline-MUEPK5B7.js +2 -2
  31. package/dist/builtin/intercom/index.bundle.mjs +1 -1
  32. package/dist/builtin/intercom/package.json +1 -1
  33. package/dist/builtin/mcp/index.bundle.mjs +1 -1
  34. package/dist/builtin/mcp/package.json +1 -1
  35. package/dist/builtin/subagents/package.json +1 -1
  36. package/dist/builtin/subagents/src/extension/index.bundle.mjs +1 -1
  37. package/dist/builtin/web-access/index.bundle.mjs +1 -1
  38. package/dist/builtin/web-access/package.json +1 -1
  39. package/dist/cli/auth-cli.code.js +1 -1
  40. package/dist/cli/auth-cli.impl.js +3 -3
  41. package/dist/cli/auth-cli.js +3 -3
  42. package/dist/cli/blueprint-command.impl.js +3 -3
  43. package/dist/cli/blueprint-command.js +3 -3
  44. package/dist/cli/intercom-command.code.js +3 -3
  45. package/dist/cli/intercom-command.impl.js +3 -3
  46. package/dist/cli/intercom-command.js +3 -3
  47. package/dist/cli/list-models.impl.js +3 -3
  48. package/dist/cli/list-models.js +3 -3
  49. package/dist/cli/session-picker.code.js +1 -1
  50. package/dist/cli/session-picker.impl.js +3 -3
  51. package/dist/cli/session-picker.js +3 -3
  52. package/dist/cli/startup-ui.code.js +1 -1
  53. package/dist/cli/startup-ui.impl.js +3 -3
  54. package/dist/cli/startup-ui.js +3 -3
  55. package/dist/cli/storage-command.impl.js +3 -3
  56. package/dist/cli/storage-command.js +3 -3
  57. package/dist/cli/storage-search-session.code.js +1 -1
  58. package/dist/cli/storage-search-session.impl.js +3 -3
  59. package/dist/cli/storage-search-session.js +3 -3
  60. package/dist/cli/team-command.code.js +1 -1
  61. package/dist/cli/team-command.impl.js +3 -3
  62. package/dist/cli/team-command.js +3 -3
  63. package/dist/cli.js +2 -2
  64. package/dist/core/compaction/compactor.d.ts +0 -8
  65. package/dist/core/debug.impl.js +3 -3
  66. package/dist/core/debug.js +3 -3
  67. package/dist/core/export-html/card-projection.impl.js +3 -3
  68. package/dist/core/export-html/card-projection.js +3 -3
  69. package/dist/core/export-html/index.code.js +2 -2
  70. package/dist/core/export-html/index.impl.js +3 -3
  71. package/dist/core/export-html/index.js +3 -3
  72. package/dist/core/export-html/json-spans.impl.js +3 -3
  73. package/dist/core/export-html/json-spans.js +3 -3
  74. package/dist/core/export-html/oversized-render-inputs.impl.js +3 -3
  75. package/dist/core/export-html/oversized-render-inputs.js +3 -3
  76. package/dist/core/export-html/tool-renderer.impl.js +3 -3
  77. package/dist/core/export-html/tool-renderer.js +3 -3
  78. package/dist/core/extensions/jiti-loader.impl.js +3 -3
  79. package/dist/core/extensions/jiti-loader.js +3 -3
  80. package/dist/core/extensions/jiti-static-loader.impl.js +3 -3
  81. package/dist/core/extensions/jiti-static-loader.js +3 -3
  82. package/dist/core/extensions/loader-host-modules.impl.js +3 -3
  83. package/dist/core/extensions/loader-host-modules.js +3 -3
  84. package/dist/core/intercom-broker-control-host.code.js +1 -1
  85. package/dist/core/intercom-broker-control-host.impl.js +3 -3
  86. package/dist/core/intercom-broker-control-host.js +3 -3
  87. package/dist/core/intercom-broker-control.code.js +2 -2
  88. package/dist/core/intercom-broker-control.impl.js +3 -3
  89. package/dist/core/intercom-broker-control.js +3 -3
  90. package/dist/core/package-manager-storage-adapters.impl.js +3 -3
  91. package/dist/core/package-manager-storage-adapters.js +3 -3
  92. package/dist/core/sdk.code.js +1 -1
  93. package/dist/core/sdk.impl.js +3 -3
  94. package/dist/core/sdk.js +3 -3
  95. package/dist/core/session-manager-core.js +3 -3
  96. package/dist/core/session-manager-list.impl.js +3 -3
  97. package/dist/core/session-manager-list.js +3 -3
  98. package/dist/core/session-manager.impl.js +3 -3
  99. package/dist/core/session-manager.js +3 -3
  100. package/dist/core/session-storage.impl.js +3 -3
  101. package/dist/core/session-storage.js +3 -3
  102. package/dist/core/storage/index.js +2 -2
  103. package/dist/core/storage/node-sqlite-thread.js +2 -2
  104. package/dist/core/storage/node-sqlite.js +2 -2
  105. package/dist/core/storage/offline-snapshot-file.impl.js +3 -3
  106. package/dist/core/storage/offline-snapshot-file.js +3 -3
  107. package/dist/core/storage/provider.js +2 -2
  108. package/dist/core/storage/selection.js +2 -2
  109. package/dist/core/storage/session/branch-fork-source.code.js +2 -2
  110. package/dist/core/storage/session/branch-fork-source.impl.js +3 -3
  111. package/dist/core/storage/session/branch-fork-source.js +3 -3
  112. package/dist/core/storage/session/card-view.impl.js +3 -3
  113. package/dist/core/storage/session/card-view.js +3 -3
  114. package/dist/core/storage/session/child-reader.code.js +2 -2
  115. package/dist/core/storage/session/child-reader.impl.js +3 -3
  116. package/dist/core/storage/session/child-reader.js +3 -3
  117. package/dist/core/storage/session/chunked-resume-projection.impl.js +3 -3
  118. package/dist/core/storage/session/chunked-resume-projection.js +3 -3
  119. package/dist/core/storage/session/expanded-child-details.code.js +2 -2
  120. package/dist/core/storage/session/expanded-child-details.impl.js +3 -3
  121. package/dist/core/storage/session/expanded-child-details.js +3 -3
  122. package/dist/core/storage/session/fork-row-bytes.impl.js +3 -3
  123. package/dist/core/storage/session/fork-row-bytes.js +3 -3
  124. package/dist/core/storage/session/fork-row-index.impl.js +3 -3
  125. package/dist/core/storage/session/fork-row-index.js +3 -3
  126. package/dist/core/storage/session/fork-staging.code.js +1 -1
  127. package/dist/core/storage/session/fork-staging.impl.js +3 -3
  128. package/dist/core/storage/session/fork-staging.js +3 -3
  129. package/dist/core/storage/session/fork-window.code.js +2 -2
  130. package/dist/core/storage/session/fork-window.impl.js +3 -3
  131. package/dist/core/storage/session/fork-window.js +3 -3
  132. package/dist/core/storage/session/history-pages.impl.js +3 -3
  133. package/dist/core/storage/session/history-pages.js +3 -3
  134. package/dist/core/storage/session/jsonl-entry-projection.impl.js +3 -3
  135. package/dist/core/storage/session/jsonl-entry-projection.js +3 -3
  136. package/dist/core/storage/session/jsonl-session-store.impl.js +3 -3
  137. package/dist/core/storage/session/jsonl-session-store.js +3 -3
  138. package/dist/core/storage/session/memory-session-store.impl.js +3 -3
  139. package/dist/core/storage/session/memory-session-store.js +3 -3
  140. package/dist/core/storage/session/pinned-branch-resume.code.js +2 -2
  141. package/dist/core/storage/session/pinned-branch-resume.impl.js +3 -3
  142. package/dist/core/storage/session/pinned-branch-resume.js +3 -3
  143. package/dist/core/storage/session/released-history-files.code.js +1 -1
  144. package/dist/core/storage/session/released-history-files.impl.js +3 -3
  145. package/dist/core/storage/session/released-history-files.js +3 -3
  146. package/dist/core/storage/session/resident-fork-rows.impl.js +3 -3
  147. package/dist/core/storage/session/resident-fork-rows.js +3 -3
  148. package/dist/core/storage/session/session-resume.impl.js +3 -3
  149. package/dist/core/storage/session/session-resume.js +3 -3
  150. package/dist/core/storage/session/snapshot-cut.impl.js +3 -3
  151. package/dist/core/storage/session/snapshot-cut.js +3 -3
  152. package/dist/core/storage/session/snapshot-history.code.js +2 -2
  153. package/dist/core/storage/session/snapshot-history.impl.js +3 -3
  154. package/dist/core/storage/session/snapshot-history.js +3 -3
  155. package/dist/core/storage/session/sql-session-store.code.js +1 -1
  156. package/dist/core/storage/session/sql-session-store.impl.js +3 -3
  157. package/dist/core/storage/session/sql-session-store.js +3 -3
  158. package/dist/core/storage/session/tree-outline.impl.js +3 -3
  159. package/dist/core/storage/session/tree-outline.js +3 -3
  160. package/dist/core/storage/session/tree-presentation.impl.js +3 -3
  161. package/dist/core/storage/session/tree-presentation.js +3 -3
  162. package/dist/core/storage/storage-status.impl.js +3 -3
  163. package/dist/core/storage/storage-status.js +3 -3
  164. package/dist/core/storage/team.impl.js +3 -3
  165. package/dist/core/storage/team.js +3 -3
  166. package/dist/core/structured-output/index.code.js +1 -1
  167. package/dist/core/structured-output/index.impl.js +3 -3
  168. package/dist/core/structured-output/index.js +3 -3
  169. package/dist/core/tasks/task-completion-entry.impl.js +3 -3
  170. package/dist/core/tasks/task-completion-entry.js +3 -3
  171. package/dist/core/tasks/task-file-history.code.js +2 -2
  172. package/dist/core/tasks/task-file-history.impl.js +3 -3
  173. package/dist/core/tasks/task-file-history.js +3 -3
  174. package/dist/core/tasks/task-reference-archive.code.js +2 -2
  175. package/dist/core/tasks/task-reference-archive.js +3 -3
  176. package/dist/core/tasks/task-reference-identity.js +3 -3
  177. package/dist/core/tasks/task-reference-stream.impl.js +3 -3
  178. package/dist/core/tasks/task-reference-stream.js +3 -3
  179. package/dist/core/tasks/task-unsaved-answer.impl.js +3 -3
  180. package/dist/core/tasks/task-unsaved-answer.js +3 -3
  181. package/dist/core/tasks/task-view-source.impl.js +3 -3
  182. package/dist/core/tasks/task-view-source.js +3 -3
  183. package/dist/core/tools/read-url.impl.js +3 -3
  184. package/dist/core/tools/read-url.js +3 -3
  185. package/dist/core/worktree-snapshot/blob-store.js +2 -2
  186. package/dist/core/worktree-snapshot/errors.code.js +1 -1
  187. package/dist/core/worktree-snapshot/errors.impl.js +3 -3
  188. package/dist/core/worktree-snapshot/errors.js +3 -3
  189. package/dist/core/worktree-snapshot/session-index-reset.impl.js +3 -3
  190. package/dist/core/worktree-snapshot/session-index-reset.js +3 -3
  191. package/dist/extensions/codemode/execute.impl.js +3 -3
  192. package/dist/extensions/codemode/execute.js +3 -3
  193. package/dist/extensions/codemode/renderer.impl.js +3 -3
  194. package/dist/extensions/codemode/renderer.js +3 -3
  195. package/dist/extensions/mcp/cli.code.js +1 -1
  196. package/dist/extensions/mcp/cli.impl.js +3 -3
  197. package/dist/extensions/mcp/cli.js +3 -3
  198. package/dist/extensions/mcp/cli.lazy.code.js +2 -2
  199. package/dist/extensions/mcp/cli.lazy.impl.js +3 -3
  200. package/dist/extensions/mcp/cli.lazy.js +3 -3
  201. package/dist/extensions/mcp/runtime.code.js +1 -1
  202. package/dist/extensions/mcp/runtime.impl.js +3 -3
  203. package/dist/extensions/mcp/runtime.js +3 -3
  204. package/dist/index.d.ts +21 -1
  205. package/dist/index.js +2 -2
  206. package/dist/main-first-time-setup.code.js +1 -1
  207. package/dist/main-first-time-setup.impl.js +3 -3
  208. package/dist/main-first-time-setup.js +3 -3
  209. package/dist/modes/interactive/components/stored-tree-view.code.js +2 -2
  210. package/dist/modes/interactive/components/stored-tree-view.impl.js +3 -3
  211. package/dist/modes/interactive/components/stored-tree-view.js +3 -3
  212. package/dist/modes/interactive/components/user-message-selector-archive.impl.js +3 -3
  213. package/dist/modes/interactive/components/user-message-selector-archive.js +3 -3
  214. package/dist/modes/print-mode.js +1 -1
  215. package/dist/package-manager-cli.code.js +2 -2
  216. package/dist/package-manager-cli.impl.js +3 -3
  217. package/dist/package-manager-cli.js +3 -3
  218. package/dist/startup-files.json +1 -1
  219. package/dist/startup-stages/6.js +1 -1
  220. package/dist/utils/startup-database-spare.code.js +1 -1
  221. package/dist/utils/startup-database-spare.impl.js +3 -3
  222. package/dist/utils/startup-database-spare.js +3 -3
  223. package/dist/utils/tools-manager.impl.js +3 -3
  224. package/dist/utils/tools-manager.js +3 -3
  225. package/docs/background-tasks/reference.md +182 -0
  226. package/docs/background-tasks.md +98 -405
  227. package/docs/build.md +67 -27
  228. package/docs/changelog.mdx +1 -1
  229. package/docs/codemode.md +108 -39
  230. package/docs/compaction/branch-summaries.md +54 -0
  231. package/docs/compaction/custom-compactors.md +161 -0
  232. package/docs/compaction/memory-compaction.md +77 -0
  233. package/docs/compaction/reference.md +86 -38
  234. package/docs/compaction.md +51 -252
  235. package/docs/computer-use.md +169 -321
  236. package/docs/containerization.md +71 -57
  237. package/docs/custom-provider/api-reference.md +119 -25
  238. package/docs/custom-provider/oauth.md +114 -132
  239. package/docs/custom-provider/override.md +37 -27
  240. package/docs/custom-provider/registration.md +107 -83
  241. package/docs/custom-provider/streaming.md +85 -71
  242. package/docs/custom-provider.md +85 -52
  243. package/docs/development.md +39 -29
  244. package/docs/docs.json +76 -63
  245. package/docs/environment-variables.md +94 -44
  246. package/docs/extensions/api-reference.md +86 -43
  247. package/docs/extensions/authoring.md +162 -154
  248. package/docs/extensions/events.md +80 -25
  249. package/docs/extensions/examples.md +90 -85
  250. package/docs/extensions/ui.md +206 -82
  251. package/docs/extensions.md +79 -108
  252. package/docs/getting-started/authentication.md +67 -36
  253. package/docs/getting-started/first-session.md +53 -43
  254. package/docs/getting-started/installation.md +116 -89
  255. package/docs/getting-started/project-instructions.md +48 -34
  256. package/docs/guides/configuration.md +82 -20
  257. package/docs/guides/non-interactive.md +66 -24
  258. package/docs/guides/resume-on-any-machine.md +135 -82
  259. package/docs/guides/team-setup.md +114 -105
  260. package/docs/guides.md +76 -32
  261. package/docs/herdr.md +15 -16
  262. package/docs/how-atomic-works.md +140 -0
  263. package/docs/index.md +58 -44
  264. package/docs/intercom/operations.md +141 -151
  265. package/docs/intercom/reference.md +85 -108
  266. package/docs/intercom.md +84 -145
  267. package/docs/json.md +120 -67
  268. package/docs/keybindings.md +85 -49
  269. package/docs/libraries/agent-core.md +137 -275
  270. package/docs/libraries/ai.md +100 -84
  271. package/docs/libraries/codemode.md +210 -300
  272. package/docs/libraries/schema.md +59 -53
  273. package/docs/libraries/storage-postgres.md +49 -35
  274. package/docs/libraries/telemetry.md +153 -354
  275. package/docs/libraries/tui.md +265 -393
  276. package/docs/libraries.md +42 -26
  277. package/docs/llama-cpp.md +171 -161
  278. package/docs/mcp-servers.md +90 -51
  279. package/docs/models/choose-a-model.md +188 -0
  280. package/docs/models/reference.md +74 -30
  281. package/docs/models.md +153 -88
  282. package/docs/orchestration/migrating-workflows.md +23 -16
  283. package/docs/orchestration/patterns.md +39 -44
  284. package/docs/orchestration.md +65 -26
  285. package/docs/packages/authoring.md +51 -29
  286. package/docs/packages/reference.md +42 -21
  287. package/docs/packages.md +69 -58
  288. package/docs/programmatic.md +118 -24
  289. package/docs/prompt-templates.md +84 -83
  290. package/docs/providers/reference.md +43 -48
  291. package/docs/providers.md +219 -451
  292. package/docs/quickstart.md +140 -120
  293. package/docs/reference/cli.md +135 -97
  294. package/docs/reference.md +20 -18
  295. package/docs/rpc/examples.md +76 -20
  296. package/docs/rpc/extension-ui.md +64 -38
  297. package/docs/rpc/protocol.md +361 -110
  298. package/docs/rpc.md +57 -17
  299. package/docs/sdk/reference.md +409 -534
  300. package/docs/sdk/storage.md +53 -13
  301. package/docs/sdk/structured-decisions.md +82 -56
  302. package/docs/sdk/web-server.md +57 -43
  303. package/docs/sdk.md +106 -84
  304. package/docs/security.md +42 -64
  305. package/docs/session-format.md +62 -38
  306. package/docs/sessions.md +99 -214
  307. package/docs/settings.md +165 -195
  308. package/docs/shell-aliases.md +9 -6
  309. package/docs/skills/authoring.md +69 -48
  310. package/docs/skills/reference.md +51 -20
  311. package/docs/skills.md +99 -148
  312. package/docs/slash-commands.md +129 -0
  313. package/docs/storage/custom-adapters.md +160 -85
  314. package/docs/storage/jsonl.md +81 -66
  315. package/docs/storage/postgres/pgbouncer.md +120 -126
  316. package/docs/storage/postgres/tuning.md +120 -143
  317. package/docs/storage/postgres.md +314 -330
  318. package/docs/storage/sqlite.md +71 -42
  319. package/docs/storage.md +298 -302
  320. package/docs/subagents/authoring.md +55 -38
  321. package/docs/subagents/reference.md +73 -33
  322. package/docs/subagents.md +119 -187
  323. package/docs/terminal-setup.md +50 -38
  324. package/docs/termux.md +67 -41
  325. package/docs/themes/reference.md +23 -19
  326. package/docs/themes.md +142 -127
  327. package/docs/tmux.md +47 -55
  328. package/docs/tools.md +147 -109
  329. package/docs/tui/reference.md +166 -214
  330. package/docs/tui.md +196 -341
  331. package/docs/usage.md +118 -138
  332. package/docs/verification.md +79 -51
  333. package/docs/web-access.md +121 -101
  334. package/docs/windows.md +26 -27
  335. package/docs/worktree-snapshots/reference.md +245 -0
  336. package/docs/worktree-snapshots.md +71 -259
  337. package/package.json +8 -8
  338. package/dist/_shared/startup-0-2-5QHPCEON.js.map +0 -1
  339. package/docs/guides/intercom.md +0 -32
  340. package/docs/guides/orchestration.md +0 -28
  341. package/docs/guides/subagents.md +0 -37
package/docs/build.md CHANGED
@@ -1,47 +1,87 @@
1
1
  ---
2
2
  title: "Build with Atomic"
3
- sidebarTitle: "Overview"
3
+ sidebarTitle: "Build with Atomic"
4
4
  description: "Choose how to customize an Atomic session, extend it with TypeScript or MCP, or embed it in your own software."
5
5
  ---
6
6
 
7
- Customize an Atomic session or embed it in your own software. Choose a starting point below.
7
+ Customize how Atomic behaves in your repository, connect external tools, or embed the agent runtime in your own software.
8
8
 
9
- New to Atomic? Start with the [Quickstart](/quickstart). To look up an exact contract, use the [Reference index](/reference).
9
+ New to Atomic? Start with the [Quickstart](/quickstart) or [How Atomic works](/how-atomic-works). Looking for an exact CLI flag, setting, or API contract? Use the [Reference index](/reference).
10
10
 
11
11
  ## Choose the lightest mechanism
12
12
 
13
- Work down this list and stop at the first mechanism that solves your problem.
13
+ Start at the top of this table and stop at the first mechanism that fits your task.
14
14
 
15
- 1. [Prompt templates](/prompt-templates). Expand reusable Markdown prompts from a slash command without writing code.
16
- 2. [Skills](/skills). Provide on-demand instructions and optional scripts that the agent loads when a task matches.
17
- 3. [MCP servers](/mcp-servers). Connect external tools and data sources over Model Context Protocol without writing an extension.
18
- 4. [Subagents](/subagents). Delegate a focused, bounded task to a child agent.
19
- 5. [Intercom](/intercom). Coordinate sessions on the same machine or across machines sharing a database.
20
- 6. [Orchestration](/orchestration). Use codemode to launch children, check results, and pick up after an interruption.
21
- 7. [Environment blueprints](/guides/resume-on-any-machine#set-the-environment-up-with-a-blueprint). Define `.atomic/blueprint.yaml` so restored worktrees rebuild dependencies and caches automatically on any machine or CI runner.
22
- 8. [Extensions](/extensions). Write TypeScript that adds tools, commands, events, and custom UI when nothing lighter fits.
23
- 9. [Atomic packages](/packages). Bundle and distribute your extensions, skills, prompt templates, themes, subagents, MCP servers, or [storage adapters](/storage/custom-adapters#adapters-from-atomic-packages).
15
+ | What you want | Start with | Needs code? |
16
+ | --- | --- | --- |
17
+ | Expand a reusable Markdown prompt from a `/command` | [Create prompt templates](/prompt-templates) | No |
18
+ | Give the agent on-demand instructions and optional scripts | [Use skills](/skills) | Optional scripts |
19
+ | Connect external tools and data sources over MCP | [MCP servers](/mcp-servers) | No (config only) |
20
+ | Delegate a focused, bounded task to a child agent | [Subagents](/subagents) | No |
21
+ | Coordinate live sessions on one host or across machines | [Intercom](/intercom) | No |
22
+ | Run multi-step fan-out, checks, and recovery logic | [Orchestration](/orchestration) | JavaScript in codemode |
23
+ | Add custom tools, slash commands, lifecycle hooks, or custom UI | [Extensions](/extensions) | TypeScript |
24
+ | Bundle and version customizations to share across teams | [Atomic packages](/packages) | Package manifest |
25
+
26
+ <Note>
27
+ Need restored worktrees to rebuild dependencies and caches automatically across machines or CI runners? Define `.atomic/blueprint.yaml` as an [environment blueprint](/guides/resume-on-any-machine#set-the-environment-up-with-a-blueprint).
28
+ </Note>
24
29
 
25
30
  ## Change the model layer
26
31
 
27
- - [Custom models](/models). Add model entries for a supported provider API.
28
- - [Remote compaction models](/models#remote-compaction-models). Configure custom `type: "compactor"` endpoints or override `morph/morph-compactor` parameters (see [Compaction](/compaction#customize-morph-or-add-a-remote-compactor)).
29
- - [Custom providers](/custom-provider). Implement a provider API, classifier, remote compactor, or OAuth flow that Atomic does not ship.
32
+ <Columns cols={2}>
33
+ <Card title="Choose a model" href="/models/choose-a-model">
34
+ Switch chat models, thinking levels, scoped models, and fallbacks day to day.
35
+ </Card>
36
+ <Card title="Custom models" href="/models">
37
+ Add model entries, parameter overrides, or compatible endpoints in `models.json`.
38
+ </Card>
39
+ <Card title="Remote compaction models" href="/compaction/custom-compactors">
40
+ Tune built-in Morph compaction parameters or connect your own remote compaction endpoint.
41
+ </Card>
42
+ <Card title="Custom providers" href="/custom-provider">
43
+ Implement a provider API, classifier, remote compactor, or OAuth flow that Atomic does not ship.
44
+ </Card>
45
+ </Columns>
30
46
 
31
47
  ## Customize appearance and controls
32
48
 
33
- - [Themes](/themes). Restyle the terminal with a built-in or custom JSON theme.
34
- - [Keybindings](/keybindings). Rebind interactive shortcuts and navigation keys.
49
+ <Columns cols={2}>
50
+ <Card title="Create themes" href="/themes">
51
+ Switch built-in palettes, follow terminal light or dark mode, or author custom JSON themes with live hot reload.
52
+ </Card>
53
+ <Card title="Keybindings" href="/keybindings">
54
+ Rebind interactive shortcuts and navigation keys in `keybindings.json`.
55
+ </Card>
56
+ </Columns>
35
57
 
36
58
  ## Embed Atomic in your own software
37
59
 
38
- [Programmatic modes](/programmatic) compares JSON mode, RPC, and the SDK, and links each one to its protocol or API reference.
60
+ Compare print mode, JSON streams, RPC, and the TypeScript SDK in [Programmatic modes](/programmatic), then jump to the integration that fits your stack.
39
61
 
40
- - [TypeScript SDK](/sdk). Embed Atomic in Node.js applications.
41
- - [SDK storage backends](/sdk/storage). Wire local SQLite, JSONL, in-memory, or PostgreSQL into `createAgentSession()` and `createAgentSessionRuntime()`.
42
- - [Structured decisions](/sdk/structured-decisions). Run typed classifier or chat decisions with `decide()` and `generateStructuredOutput()`.
43
- - [Web server guide](/sdk/web-server). Stream agent runs from an HTTP server or Next.js App Router endpoint.
44
- - [RPC mode](/rpc). Integrate over stdin and stdout JSONL.
45
- - [JSON event stream mode](/json). Run print mode with structured events.
46
- - [TUI components](/tui). Build custom terminal UI for extensions.
47
- - [Standalone libraries](/libraries). Use Atomic's six core packages (`ai`, `tui`, `agent-core`, `codemode`, `schema`, `telemetry`) and optional storage adapters ([`@bastani/atomic-storage-postgres`](/libraries/storage-postgres)) directly.
62
+ <Columns cols={2}>
63
+ <Card title="TypeScript SDK" href="/sdk">
64
+ Embed Atomic directly in Node.js applications with full session and tool control.
65
+ </Card>
66
+ <Card title="SDK storage backends" href="/sdk/storage">
67
+ Wire local SQLite, JSONL, in-memory, or PostgreSQL storage into `createAgentSession()`.
68
+ </Card>
69
+ <Card title="Structured decisions" href="/sdk/structured-decisions">
70
+ Run typed classifier or chat decisions with `decide()` and `generateStructuredOutput()`.
71
+ </Card>
72
+ <Card title="Web server guide" href="/sdk/web-server">
73
+ Stream agent runs from an HTTP server or Next.js App Router endpoint.
74
+ </Card>
75
+ <Card title="RPC mode" href="/rpc">
76
+ Drive an Atomic session over stdin and stdout JSONL from any language.
77
+ </Card>
78
+ <Card title="JSON event stream mode" href="/json">
79
+ Run non-interactive prompts that emit structured JSONL events.
80
+ </Card>
81
+ <Card title="TUI components" href="/tui">
82
+ Build custom terminal UI components for extensions and embedded hosts.
83
+ </Card>
84
+ <Card title="Standalone libraries" href="/libraries">
85
+ Use Atomic's six core packages (`ai`, `tui`, `agent-core`, `codemode`, `schema`, `telemetry`) and the optional PostgreSQL storage adapter (`@bastani/atomic-storage-postgres`) directly.
86
+ </Card>
87
+ </Columns>
@@ -10,7 +10,7 @@ description: "What's new in Atomic"
10
10
  After each release, the publish-release skill regenerates this page in its own docs PR.
11
11
  */}
12
12
 
13
- <Update label="November 27, 2026" description="0.10.14-alpha.1">
13
+ <Update label="November 27, 2026" description="0.10.14">
14
14
 
15
15
  This patch accepts `null` optional arguments across waitable tools and fixes PostgreSQL background snapshot collection.
16
16
 
package/docs/codemode.md CHANGED
@@ -1,14 +1,29 @@
1
1
  ---
2
- title: "Codemode reference"
2
+ title: "Codemode"
3
3
  sidebarTitle: "Codemode"
4
4
  description: "Write JavaScript scripts inside Atomic's sandbox to compose tool calls, persist state across turns, and call classifier or image models."
5
5
  ---
6
6
 
7
- `codemode` lets the model run a JavaScript script that calls Atomic tools and non-LLM models (classifiers and image generators) and returns only the filtered result. It is enabled by default. Toggle it from the CLI or settings ([`codemode` in Built-in tools](/tools#codemode)), or from the SDK with `tools: ["-codemode"]`, `noTools: "builtin"`, or `DefaultResourceLoader({ disabledBuiltinExtensions: ["codemode"] })` ([SDK extensions](/sdk/reference#extensions)). For multi-step subagent workflows in codemode, see [Orchestrate with codemode and subagents](/orchestration). To embed the sandbox in your own application, see [`@bastani/atomic-codemode`](/libraries/codemode).
7
+ `codemode` lets the model run JavaScript inside a sandboxed worker to call permitted Atomic tools, chain or parallelize steps, call classifier and image models, and return only the filtered result. It is enabled by default.
8
+
9
+ <Columns cols={2}>
10
+ <Card title="Enable or disable codemode" href="/tools#codemode">
11
+ Toggle `codemode` via CLI flags, `settings.json`, or SDK options.
12
+ </Card>
13
+ <Card title="Orchestrate with codemode" href="/orchestration">
14
+ Coordinate parallel subagents, save handoff state, and recover after interruptions.
15
+ </Card>
16
+ <Card title="MCP servers" href="/mcp-servers">
17
+ Discover and call `codemode` and `deferred` MCP tools from scripts.
18
+ </Card>
19
+ <Card title="Embed @bastani/atomic-codemode" href="/libraries/codemode">
20
+ Embed the standalone codemode sandbox in your own Node.js or Cloudflare Workers app.
21
+ </Card>
22
+ </Columns>
8
23
 
9
24
  ## Scripts
10
25
 
11
- Pass raw JavaScript source with no JSON wrapper or markdown code fences. Code runs as an async function body inside a sandboxed JavaScript runtime, so top-level `await` and `return` work. The sandbox has no Node or Bun APIs, filesystem, network, or timers; all external access goes through `tools` and `models`.
26
+ Pass raw JavaScript source with no JSON wrapper or markdown code fences. Code runs as an async function body inside a sandboxed QuickJS runtime, so top-level `await` and `return` work.
12
27
 
13
28
  ```javascript
14
29
  const [readme, pkg] = await Promise.all([
@@ -18,16 +33,19 @@ const [readme, pkg] = await Promise.all([
18
33
  return { name: JSON.parse(pkg).name, excerpt: readme.slice(0, 400) };
19
34
  ```
20
35
 
21
- An optional first-line directive sets the output budget and timeout. It must be line 1 followed by JavaScript code; unknown keys or a script with no code after the directive fail immediately:
36
+ - **Available built-ins.** Standard ECMAScript built-ins plus `atob`, `btoa`, `DOMException`, `eval`, and `Function` work inside the sandbox. `TextEncoder`, `TextDecoder`, `URL`, `fetch`, `crypto`, `setTimeout`, and all Node or Bun filesystem, network, and process APIs are unavailable—every external interaction goes through `tools` and `models`.
37
+ - **Per-script options directive.** An optional first-line comment sets the output budget and timeout. It must appear on **line 1** followed by JavaScript code; placing `// @options:` on any later line, using unknown keys, or sending an empty script fails before execution starts:
22
38
 
23
39
  ```javascript
24
40
  // @options: {"max_output_tokens": 2000, "timeout_ms": 60000}
25
41
  ```
26
42
 
27
- - **`max_output_tokens` (default `10000`).** Non-negative safe integer (`0` is accepted; budget is `max_output_tokens * 4` characters). Overflow keeps the start and end and writes full output to a temp file whose path is included in the result.
28
- - **`timeout_ms` (unset by default).** Hard deadline in milliseconds for the whole script, including waiting for a worker slot. Must be a positive integer up to `2147483647` (about 24.8 days); `0`, negative numbers, decimals, or larger values fail before running. Avoid short deadlines when generating images, which can take minutes.
43
+ | Option | Default | Behavior |
44
+ | --- | --- | --- |
45
+ | `max_output_tokens` | `10000` | Non-negative safe integer (`0` is accepted; character budget is `max_output_tokens * 4`). Text overflow keeps the start and end and writes full text to a temp file named in the result. Emitted images survive text truncation and keep their `[Image saved to ...]` paths intact. |
46
+ | `timeout_ms` | Unset | Hard deadline in milliseconds for the whole script, including waiting for a worker slot. Must be a positive integer up to `2147483647` (about 24.8 days); `0`, negative numbers, decimals, or larger values fail before running. Avoid short deadlines when generating images, which can take minutes. |
29
47
 
30
- **Result format.** Starts with `Script completed` or `Script failed` plus wall time, followed by text and image items in order. Multiple text items (from `text()` or `return`) are separated by `==> text N/M <==`. `console.*` output follows in one `<console_output>` block. On failure, partial output is kept before `Script error:`. Side effects from completed tool calls are **not** rolled back; still-running calls are cancelled and unawaited promises are dropped when the script exits.
48
+ **Result format.** Every run starts with `Script completed` or `Script failed` plus wall time, followed by text and image items in order. Multiple text items (from `text()` or `return`) are separated by `==> text N/M <==`, and `console.*` output follows in one `<console_output>` block. On failure, partial output is kept before `Script error:`. Side effects from completed tool calls are **not** rolled back; still-running tool calls are cancelled and unawaited promises are dropped when the script exits.
31
49
 
32
50
  ## Globals
33
51
 
@@ -36,40 +54,57 @@ Use `await` with every async global (`tools.*`, `searchTools()`, `describeTool()
36
54
  | Global | Sync / Async | Purpose |
37
55
  | --- | --- | --- |
38
56
  | `tools.<name>(args)` | Async (`await`) | Call a permitted tool. See [Call tools](#call-tools). |
39
- | `text(value)` | Sync | Emit a text item (strings verbatim, other values as JSON). |
40
- | `image(value)` | Sync | Emit an image from a base64 `data:` URL, `{ image_url }`, or `{ type: "image", data, mimeType }` (PNG, JPEG except JPEG-LS, GIF, or WebP; no remote URLs or SVG; see [Generate images](#generate-images)). Inspects base64 magic bytes instead of trusting the declared MIME type, strips whitespace and newlines, throws `TypeError` on invalid or mismatched base64, saves a temp file, and prints its path. |
57
+ | `text(value)` | Sync | Emit a text item (primitives as `String(value)`, objects as JSON). |
58
+ | `image(value)` | Sync | Emit an image from a base64 `data:` URL, `{ image_url }`, or `{ type: "image", data, mimeType }` (PNG, JPEG except JPEG-LS, GIF, or WebP; no remote URLs or SVG). Validates base64 magic bytes instead of trusting the declared MIME type, strips whitespace/newlines, throws `TypeError` on invalid or mismatched data, saves a temp file, and prints its path. |
41
59
  | `console.log(...)` | Sync | Append a space-joined line to `<console_output>` (`info`, `warn`, `error`, and `debug` behave identically). |
42
- | `return value` | Sync | Top-level `return` emits `value` like `text()`. |
60
+ | `return value` | Sync | Emit the script's final value across the sandbox bridge via `JSON.stringify` (strings emit verbatim). Unlike `text()`, `return undefined` emits nothing, `return NaN` and `return Infinity` serialize to `"null"`, and non-JSON-serializable values (`BigInt`, circular objects) fail. |
43
61
  | `exit()` | Sync | End the script immediately with success. Persists prior `store()` writes, takes no argument (call `text()` first to emit output), and ignores further `text()` or `image()` calls inside `finally` blocks. |
44
- | `store(key, value)` / `load(key)` | Sync | Persist small JSON values across `codemode` calls on this branch. See [Store values](#store-values). |
62
+ | `store(key, value)` / `load(key)` | Sync | Persist small JSON values across `codemode` calls on the current branch. See [Store values](#store-values). |
45
63
  | `ALL_TOOLS` | Value | Array of `{ name, description }` for every script-callable tool (excludes [model-only tools](#model-only-tools)). |
46
- | `searchTools(query, { limit?, namespace? })` | Async (`await`) | BM25 search over script-callable tools (`limit` must be a positive integer, default `8`). Exact tool names or suffixes after `__` (such as `thread_read` for `mcp__app__thread_read`) rank first. Querying an exact active model-only tool name returns a hint to call it directly unless `namespace` is passed. |
47
- | `describeTool(name)` | Async (`await`) | Returns a script-callable tool's description and TypeScript declaration, a direct-call hint for an active model-only tool, or `undefined`. Accepts exact names, JS identifiers, `mcp.<server>.<tool>`, `mcp__<raw-server>__<tool>`, `<server>__<tool>`, or `<tool>` suffixes, and throws an ambiguity error if a shorthand matches multiple tools. |
64
+ | `searchTools(query, { limit?, namespace? })` | Async (`await`) | Ranked keyword search over script-callable tools (`limit` must be a positive integer, default `8`). Exact tool names or suffixes after `__` (such as `thread_read` for `mcp__app__thread_read`) rank first. Querying an exact active model-only tool name returns a hint to call it directly unless `namespace` is passed. |
65
+ | `describeTool(name)` | Async (`await`) | Returns a script-callable tool's description and TypeScript declaration, a direct-call hint for an active model-only tool, or `undefined`. Accepts exact names, JS identifiers, `mcp.<server>.<tool>`, `mcp__<raw-server>__<tool>`, `<server>__<tool>`, or `<tool>` suffixes; throws on ambiguous shorthand. |
48
66
  | `describeNamespace(name)` | Async (`await`) | Returns `{ name, description?, instructions?, tools }` for a namespace (such as an MCP server), or `undefined`. |
49
- | `models` | Async methods (`await`) | Inspect and invoke classifier and image models. See [Models](#models). Not exposed in routing-only subagents. |
67
+ | `models` | Async methods (`await`) | Inspect and invoke classifier and image models. See [Models](#models). |
50
68
 
51
69
  ## Call tools
52
70
 
53
71
  Every script-callable tool is exposed on `tools` under both its normalized JavaScript identifier (non-identifier characters replaced with `_`, such as `tools.mcp__dev_docs__search`) and its raw tool name (`tools["mcp__dev-docs__search"]`). If two tool names normalize to the same identifier, the first registered tool keeps the normalized key. Each method accepts one argument object.
54
72
 
55
- **Return values:**
56
- - **Tools with `outputSchema`.** Resolve to their structured object (including structured failures). `bash` resolves to `{ output, truncated, full_output_path?, exit_code, wall_time_seconds }` even for nonzero exit codes; `output` keeps up to 1 MiB (the first and last 512 KiB around an omission marker if truncated, with full text in `full_output_path`).
57
- - **MCP tools.** Resolve to `CallToolResult` (`content`, `isError`, and typed `structuredContent`, with `_meta` stripped).
58
- - **`read`.** Resolves to plain LF text with `[Lines S-E of N]` range headers on partial reads (no per-line numbers or local path headers; URL reads include `URL:`, `Status:`, and `Content-Type:` headers; append `:raw` for exact bytes). For images, resolves to `{ type: "image", data, mimeType, note }` usable directly with `image()`.
59
- - **Other tools (`edit`, `write`, and similar).** Resolve to text.
73
+ ### Return values by tool
74
+
75
+ | Tool | Resolves to | Notes and failure behavior |
76
+ | --- | --- | --- |
77
+ | `bash`, `powershell` (foreground finish) | `{ output, truncated, full_output_path?, exit_code, wall_time_seconds }` | Resolves with this object even for nonzero `exit_code`. `output` keeps up to 1 MiB (first and last 512 KiB around an omission marker if truncated, with full output at `full_output_path`). Rejects if the command times out or is aborted. |
78
+ | `bash`, `powershell` (background yield or `action: "wait"`) | Plain `string` | When a command yields to the background (via `wait: { kind: "background" }` or after the default 10-second wait) or is observed with `{ action: "wait", id }`, the call returns a plain string rather than a structured object. Rejects if a waited command was stopped by its execution timeout or aborted. |
79
+ | `read` (text / URLs) | Plain `string` | Plain LF text with `[Lines S-E of N]` headers on partial reads (`:raw` returns exact bytes). Unselected HTTP(S) URL reads include `URL:`, `Content-Type:`, `Method:` (and optional `Notes:`) followed by `---`; only line-selected URL reads include `URL:`, `Status:`, and `Content-Type:`. |
80
+ | `read` (images) | `{ type: "image", data, mimeType, note }` | Pass directly to `image()` or `models.classify()`. |
81
+ | MCP tools | `{ content, isError?, structuredContent? }` | Complete untruncated MCP result (`_meta` stripped). Does not throw on `isError: true`—check `res.isError`, then read `res.structuredContent` or text blocks in `res.content`. |
82
+ | `subagent`, `intercom`, other structured tools | Tool-specific structured object | Returns structured results (including structured error objects when the tool defines an output schema). |
83
+ | `edit`, `write`, `find`, `search`, `todo`, `kill`, other text tools | Plain `string` | Rejects with `Error` on failure. |
84
+
85
+ Reading an MCP tool result safely:
86
+
87
+ ```javascript
88
+ const res = await tools.mcp__docs__search({ query: "compaction" });
89
+ if (res.isError) throw new Error("Docs search failed");
90
+ const textOut = res.structuredContent ?? res.content.find((b) => b.type === "text")?.text;
91
+ return textOut;
92
+ ```
93
+
94
+ ### Errors and tool discovery
60
95
 
61
- **Errors and discovery:**
62
- - Failed, blocked, or invalid calls reject with `Error` (except schema-backed tools that return a structured error value; check `exit_code` or `isError`). Use `Promise.allSettled()` for independent calls.
63
- - Accessing an unknown tool throws with close-match suggestions (for example `tools.Bash` suggests `tools.bash`). Check availability with `"name" in tools`.
64
- - Inline tool declarations share a `3000`-token budget (`codemode.inlineBudget` in [settings](/settings#tools)); deferred tools stay unlisted and are found via `await searchTools()`, `await describeTool()`, `await describeNamespace()`, or `ALL_TOOLS`.
65
- - `codemode.mode` in [settings](/settings#tools) controls tool visibility: `"on"` (default) keeps direct tools declared alongside codemode; `"only"` hides ordinary direct tools so the model calls them through codemode while keeping active model-only tools (like `ask_user_question`) top-level. Declarations in `codemode`, `describeTool()`, and `ALL_TOOLS` carry each tool's prompt guidelines.
96
+ - **Forwarded error details.** Failed, blocked, or invalid calls reject with `Error` (except structured tools that return `exit_code` or `isError`). When a tool throws an `Error` with extra JSON-serializable own properties (such as `code`, `hint`, or `fields`), those properties are copied onto the `Error` caught in your script. Use `Promise.allSettled()` for independent parallel calls.
97
+ - **Checking tool availability.** Accessing an unknown property on `tools` throws with close-match suggestions (for example `tools.Bash` suggests `tools.bash`). Check availability with `"name" in tools`.
98
+ - **Inline catalog and schema limits.** Inline tool declarations share a `3000`-token budget (`codemode.inlineBudget` in [settings](/settings#tools)); deferred tools stay unlisted and are found via `await searchTools()`, `await describeTool()`, `await describeNamespace()`, or `ALL_TOOLS`. Declarations carry each tool's usage instructions. If a tool's input schema exceeds 16,000 characters, `describeTool()` and inline declarations drop constraint annotations first and collapse it to `unknown` if still oversized.
99
+ - **Visibility mode.** `codemode.mode` in [settings](/settings#tools) defaults to `"on"` (direct tools declared alongside codemode). Setting `"only"` hides ordinary direct tools so the model calls them through codemode while keeping active model-only tools (such as `ask_user_question`) top-level.
66
100
 
67
101
  ### Model-only tools
68
102
 
69
103
  Tools without script access (such as `ask_user_question` and `tool_search`) are absent from `tools`, `ALL_TOOLS`, and `searchTools()` rankings. Call them as top-level tools instead. Querying their exact name with `await searchTools()` or `await describeTool()` returns a hint to call them directly without making them script-callable.
70
104
 
71
105
  Two tools expose a script-safe subset:
72
- - **`tools.subagent`.** Launches subagents (`{ agent, task }` or `{ tasks }`) and returns task IDs at admission; also supports `status`, bounded `wait`, `pause`, `quit`, `resume`, and agent and model inspection. A script timeout cancels `wait`, not the subagent; admitted subagents continue after a script returns or throws. See [Subagents from codemode scripts](/subagents#from-codemode-scripts).
106
+
107
+ - **`tools.subagent`.** Launches subagents (`{ agent, task }` or `{ tasks }`) and returns task IDs at admission; also supports `status`, bounded `wait`, `pause`, `quit`, `resume`, and agent/model inspection. A script timeout cancels `wait`, not the subagent; admitted subagents keep running after a script returns or throws. See [Subagents from codemode scripts](/subagents#from-codemode-scripts).
73
108
  - **`tools.intercom`.** Supports `list`, `status`, `pending`, and `send` to an exact target (returning structured results). Other actions and glob or `subagents:` targets must be called directly. See [Intercom from codemode scripts](/intercom/reference#from-codemode-scripts).
74
109
 
75
110
  ## Store values
@@ -77,18 +112,22 @@ Two tools expose a script-safe subset:
77
112
  `store(key, value)` synchronously saves a JSON value for subsequent `codemode` calls; `store(key, undefined)` deletes it; `load(key)` synchronously reads it back (or returns `undefined`).
78
113
 
79
114
  - Writes become visible to `load()` immediately inside the same script. They persist to the session history only when the script succeeds (including via `exit()`), so values survive resume and stay isolated per session branch. Failed scripts discard uncommitted writes.
80
- - Keys must be strings. Non-JSON-serializable values (functions, BigInt, circular references) throw `TypeError`.
81
- - Size caps are 262,144 JSON characters per value (`json.length`) and 1,048,576 characters total across all stored entries (`key.length + json.length`). Do not store images; emit them with `image()`, which writes a temp file automatically.
115
+ - Keys must be strings. Non-JSON-serializable values (functions, `BigInt`, circular references) throw `TypeError`.
116
+ - Size caps are **262,144** JSON characters per value (`json.length`) and **1,048,576** characters total across all stored entries (`key.length + json.length`). Do not store images; emit them with `image()`, which writes a temp file automatically.
82
117
 
83
118
  ## Models
84
119
 
85
- `models` accesses the model catalog and calls non-LLM models using the session's credentials. Routing-only subagents do not expose `models`.
120
+ `models` accesses the model catalog and calls non-LLM models using the session's credentials.
86
121
 
87
122
  - **Classifiers.** Answer typed questions about JSON state (and images when supported). Examples: [TypeSafe Jev](/providers#typesafe-jev), [OpenAI GPT-6 Luna](/models#use-classifier-models), and [local llama.cpp models](/llama-cpp).
88
123
  - **Image models.** Generate or edit images. Examples: OpenRouter (`provider: "openrouter"`, IDs such as `google/gemini-2.5-flash-image` and `black-forest-labs/flux.2-pro`, reusing your OpenRouter credential) and OpenAI (`provider: "openai-images"`, such as `gpt-image-2.6-flare`, reusing your [OpenAI API key](/providers#subscription-and-api-key-at-the-same-time)).
89
124
 
90
125
  Chat models are listed in the catalog (with active service-tier pricing) but cannot be called from scripts. Neither classifiers nor image models appear in `/model`.
91
126
 
127
+ <Note>
128
+ When a forked subagent does not declare `codemode` in its own tool list, Atomic may still provide a routing-only `codemode` channel so the child can call its own tools without altering its parent's tool declarations. Those routing-only subagents do not expose `models`.
129
+ </Note>
130
+
92
131
  ```typescript
93
132
  type ModelType = "chat" | "image" | "classifier";
94
133
 
@@ -117,7 +156,7 @@ declare const models: {
117
156
 
118
157
  - Pass a `ModelInfo` or `{ provider, id }`; script-supplied `baseUrl` or headers are ignored so credentials cannot be redirected.
119
158
  - Provider errors do not throw; check `stopReason`, `errorMessage`, and (for images) `error`. Malformed arguments or unknown models do throw and point to `models.getAvailableOfType(type)`.
120
- - Up to 4 model calls run concurrently per script (extra calls queue, so `Promise.all()` is safe). Token usage and cost count toward the session total.
159
+ - Up to **4** model calls run concurrently per script (extra calls queue, so `Promise.all()` is safe). Token usage and cost count toward the session total.
121
160
 
122
161
  ### Classify
123
162
 
@@ -237,12 +276,39 @@ type TextBlock = { type: "text"; text: string };
237
276
  type ImageBlock = { type: "image"; data: string; mimeType: string; role?: "markup" | "mask" };
238
277
  ```
239
278
 
240
- - **Provider options.** `ImagesOptions` targets OpenAI's `openai-images` models (OpenRouter models ignore them). The first untagged image is the base image to edit; additional untagged images are references. `role: "markup"` (a same-size transparent PNG overlay) and `role: "mask"` (an alpha mask) are mutually exclusive and require an untagged base image earlier in `input`.
241
- - **OpenAI option validation.** `outputCompression` accepts integers `0` to `100` and is valid only with `outputFormat: "jpeg"` or `"webp"`. `background: "transparent"` is valid only with `"png"`, `"webp"`, or the default format. `safetyIdentifier` has a 128-character limit. `complexity` (`"low"`, `"medium"`, or `"high"`, API default `"high"`) applies to GPT Image 2.6 only.
242
- - **GIF and SVG.** `outputFormat: "gif"` and `"svg"` require a GPT Image 2.6 model with text-only input. For GIF, `frameCount` (`2` to `16`, API default `9`) and `frameDurationMs` (`20` to `2000`, API default `200`, rounded to 10 ms) are rejected unless `outputFormat` is `"gif"`. For SVG, `n` must be `1` or omitted, and the `svg` option is rejected unless `outputFormat` is `"svg"`.
243
- - **SVG authoring model.** `{ outputFormat: "svg" }` works without extra options. If an account requires `svg.model` and you omitted `svg`, Atomic retries once with `gpt-6.1-sol` (reported in `result.svgModel`), and retries once without `svg` if rejected as unsupported. An explicit `svg: { model, reasoning }` is sent verbatim without automatic fallback. Allow at least `timeout_ms: 180000` for SVG requests (Atomic's own request timeout is at least 10 minutes).
244
- - **Structured errors.** Invalid options fail locally with `stopReason: "error"`, `error.code: "invalid-option"`, and `error.fields.field` (plus `error.fields.reason`: `required-by-api`, `rejected-by-api`, or `unsupported-by-api` for SVG). Other codes are `moderation-blocked`, `user-error`, `quota-exceeded`, `rate-limited`, `server-error`, `timeout`, and `api-error`. Branch on `error.code` and `error.retryable` (see [Image generation](/libraries/ai#image-generation)).
245
- - **Displaying and saving output.** Call `image(block)` for PNG, JPEG, GIF, and WebP (never print base64 `data` via `text()` or `return`; scripts that generate images without showing any receive a note). `image()` also saves each image to a private temp file and prints its path. For SVG (`image/svg+xml`), Atomic automatically saves a private temp `.svg` file (`[SVG saved to <path> (image/svg+xml, <size>)]`), and scripts can inspect XML text via `atob(block.data)`.
279
+ #### OpenAI image options and constraints
280
+
281
+ `ImagesOptions` targets OpenAI's `openai-images` models (OpenRouter models ignore them). For image editing, the first untagged image in `input` is the base image and additional untagged images are references; `role: "markup"` (a same-size transparent PNG overlay) and `role: "mask"` (an alpha mask) are mutually exclusive and require an untagged base image earlier in `input`.
282
+
283
+ | Option | Constraints |
284
+ | --- | --- |
285
+ | `outputCompression` | Integer `0`–`100`; valid only with `outputFormat: "jpeg"` or `"webp"`. |
286
+ | `background: "transparent"` | Valid only with `outputFormat: "png"`, `"webp"`, or omitted. |
287
+ | `safetyIdentifier` | Maximum 128 characters. |
288
+ | `complexity` | `"low"`, `"medium"`, or `"high"` (API default `"high"`); GPT Image 2.6 only. |
289
+ | `outputFormat: "gif"` | Requires GPT Image 2.6 and text-only input. `frameCount` (`2`–`16`, API default `9`) and `frameDurationMs` (`20`–`2000`, API default `200`, rounded to 10 ms) are valid only with `"gif"`. |
290
+ | `outputFormat: "svg"` | Requires GPT Image 2.6 and text-only input; `n` must be `1` or omitted; `svg` is valid only with `"svg"`. Allow at least `timeout_ms: 180000` (Atomic's own request timeout is at least 10 minutes). |
291
+
292
+ **SVG authoring model fallback.** `{ outputFormat: "svg" }` works without extra options. If an account requires `svg.model` and you omitted `svg`, Atomic retries once with `gpt-6.1-sol` (reported in `result.svgModel`), and retries once without `svg` if rejected as unsupported. An explicit `svg: { model, reasoning }` is sent verbatim without automatic fallback.
293
+
294
+ #### Structured errors
295
+
296
+ Branch on `result.error.code` and `result.error.retryable` rather than message text (see [Image generation](/libraries/ai#image-generation)):
297
+
298
+ | `error.code` | Meaning |
299
+ | --- | --- |
300
+ | `invalid-option` | Local or API option validation failure. `error.fields.field` names the field; SVG errors also set `error.fields.reason` (`required-by-api`, `rejected-by-api`, or `unsupported-by-api`). |
301
+ | `moderation-blocked` | Prompt or output blocked by provider safety filters. |
302
+ | `user-error` | Non-retryable client request error. |
303
+ | `quota-exceeded` | Account quota or billing limit reached. |
304
+ | `rate-limited` | Provider rate limit hit (`retryable: true`). |
305
+ | `server-error` | Provider 5xx failure (`retryable: true`). |
306
+ | `timeout` | Request exceeded its deadline. |
307
+ | `api-error` | Other provider API error. |
308
+
309
+ #### Displaying and saving generated images
310
+
311
+ Call `image(block)` for PNG, JPEG, GIF, and WebP—never print base64 `data` via `text()` or `return` (scripts that generate images without showing any receive a reminder note). `image()` automatically saves a private temp file and prints its path. For SVG (`image/svg+xml`), Atomic automatically saves a private temp `.svg` file (`[SVG saved to <path> (image/svg+xml, <size>)]`), and scripts can inspect the XML via `atob(block.data)`.
246
312
 
247
313
  ```javascript
248
314
  // @options: {"timeout_ms": 300000}
@@ -279,9 +345,12 @@ Extensions can call `ctx.modelRegistry.classify()` and `ctx.modelRegistry.genera
279
345
 
280
346
  ## Limits
281
347
 
282
- - **Memory.** 256 MiB per script sandbox (`InternalError: out of memory`); filter or aggregate data instead of buffering everything in memory.
283
- - **Hard output caps.** Across `text()`, `image()`, and `console.*`, a script can emit at most 16 MiB (`16,777,216` characters) total and `100,000` items. Exceeding either cap stops the script immediately with an uncatchable `RangeError`.
348
+ - **Memory and stack.** **256 MiB** heap per script sandbox (`InternalError: out of memory`) and a **512 KiB** QuickJS recursion stack guard (deep recursion throws a catchable `RangeError` rather than crashing the worker). Filter or aggregate data instead of buffering everything in memory.
349
+ - **Hard output caps.** Across `text()`, `image()`, and `console.*`, a script can emit at most **16 MiB** (`16,777,216` characters) total and **100,000** items. Exceeding either cap stops the script immediately with an uncatchable `RangeError`.
284
350
  - **Frozen built-in prototypes.** Standard JavaScript globals and built-in prototypes are frozen before your script starts. Monkey-patching built-in prototypes throws `TypeError`; normal own properties on your own objects (`name`, `message`, `toString`, `toJSON`, and custom keys) work normally.
285
- - **Cancellation.** Stopping a script or hitting `timeout_ms` cancels execution promptly. In the standalone binary release, a single long-running native built-in operation (such as a catastrophic regex) finishes before the worker exits.
286
- - **Worker concurrency.** Default limit is `2` concurrent script workers per Atomic process (override with `ATOMIC_CODEMODE_MAX_WORKERS` or legacy `PI_CODEMODE_MAX_WORKERS`). Cancelled workers occupy a slot until they exit. Additional scripts queue in FIFO order and fail if no slot opens within 60 seconds (or `timeout_ms`).
351
+ - **Worker concurrency.** Default limit is **2** concurrent script workers per Atomic process (override with `ATOMIC_CODEMODE_MAX_WORKERS`). Cancelled workers occupy a slot until they exit. Additional scripts queue in FIFO order and fail if no slot opens within 60 seconds (or `timeout_ms`).
287
352
  - **Deadlocks and nesting.** Waiting on a promise with no pending tool call fails immediately because there are no timers. Scripts cannot invoke `codemode` recursively.
353
+
354
+ <Note>
355
+ **Cancellation in standalone binaries.** Stopping a script or hitting `timeout_ms` cancels execution promptly. In the standalone binary release, a single long-running native built-in operation (such as a catastrophic regular expression) finishes before the worker exits.
356
+ </Note>
@@ -0,0 +1,54 @@
1
+ ---
2
+ title: "Summarize branches"
3
+ sidebarTitle: "Branch summaries"
4
+ description: "Optionally summarize an abandoned conversation branch when switching paths with /tree."
5
+ ---
6
+
7
+ When [`/tree`](/sessions#branching-with-tree) switches away from a branch, Atomic can optionally summarize the abandoned branch and attach that summary at the new position. This preserves context from the path you left without replaying the entire branch.
8
+
9
+ <Note>
10
+ Branch summaries are separate from `/compact` and unaffected by `compactionModel`. Branch navigation generates a lossy prose summary of an abandoned path, whereas compaction uses [memory compaction](/compaction/memory-compaction) or a [custom compaction model](/compaction/custom-compactors) on your active context.
11
+ </Note>
12
+
13
+ ## Choose whether to summarize
14
+
15
+ When leaving a branch in `/tree`, choose one of three options:
16
+
17
+ 1. No summary
18
+ 2. Summarize with the default prompt
19
+ 3. Summarize with custom focus instructions
20
+
21
+ Set `"branchSummary": { "skipPrompt": true }` in `settings.json` to skip the prompt and default to no summary.
22
+
23
+ ## How branch summarization works
24
+
25
+ Atomic collects as many recent messages from the abandoned branch (up to the common ancestor) as fit while leaving room for the summary prompt and reply. That history budget is `contextWindow - branchSummary.reserveTokens` (defaulting `contextWindow` to `128000` when unknown, and `reserveTokens` to `16384`). `branchSummary.reserveTokens` reserves headroom for the summary call rather than capping the history budget itself.
26
+
27
+ If the abandoned branch contains no summarizable messages, Atomic records `"No content to summarize"` without sending a model request.
28
+
29
+ Otherwise, the provider sizes summary output from the model's output limit and available context, inheriting the session's `thinkingLevel` unless it is `"off"`. Atomic rejects incomplete summaries rather than saving partial prose.
30
+
31
+ ```text
32
+ Tree before navigation:
33
+
34
+ ┌─ B ─ C ─ D (old leaf, being abandoned)
35
+ A ───┤
36
+ └─ E ─ F (target)
37
+
38
+ Common ancestor: A
39
+ Entries to summarize: B, C, D
40
+
41
+ After navigation with summary:
42
+
43
+ ┌─ B ─ C ─ D ─ [summary of B,C,D]
44
+ A ───┤
45
+ └─ E ─ F (new leaf)
46
+ ```
47
+
48
+ Built-in branch summaries keep a cumulative list of read and modified files, carrying forward file lists from earlier built-in branch summaries (extension-supplied summaries are not parsed for file lists).
49
+
50
+ ## How summary requests run
51
+
52
+ Branch summary requests run no tools and bypass prompt cache writes so summarizing an abandoned branch does not disturb prompt caching on your main branch. They use normal authentication, cancellation, and retry behavior.
53
+
54
+ For the exact prompt template, `BranchSummaryEntry` structure, message serialization, edge cases, and the `session_before_tree` extension hook, see [Branch summary format](/compaction/reference#branch-summary-format) and [Extension hooks for branch summarization](/compaction/reference#extension-hooks-for-branch-summarization).
@@ -0,0 +1,161 @@
1
+ ---
2
+ title: "Use custom compaction models"
3
+ sidebarTitle: "Custom compaction models"
4
+ description: "Use built-in Morph or configure your own remote HTTP compactor model with custom parameters and automatic fallback to memory compaction."
5
+ ---
6
+
7
+ **Custom compaction models** are Atomic's second form of compaction. Instead of clearing the context window outright, Atomic sends the active context once to a dedicated remote compactor endpoint—either built-in `morph/morph-compactor` or a custom compactor you define in `models.json` or an extension—and places its response inside a `<compacted-context>` block.
8
+
9
+ Your full conversation still stays verbatim in session history, and the boundary includes the same history recovery instructions as [memory compaction](/compaction/memory-compaction) so the agent can pull back anything the compactor omitted.
10
+
11
+ <Warning>
12
+ A remote compactor receives your in-context conversation and uses its own provider credentials. Enable a remote compactor only if your policy permits sending session content to that provider.
13
+ </Warning>
14
+
15
+ ## Quick start: use built-in Morph
16
+
17
+ <Steps>
18
+ <Step title="Authenticate Morph">
19
+ Run `/login morph` inside Atomic, or export `MORPH_API_KEY` in your shell.
20
+ </Step>
21
+ <Step title="Select the compaction model">
22
+ Open `/settings`, select **Compaction model**, and pick `morph/morph-compactor`. The change applies immediately with no `/reload` or restart.
23
+ </Step>
24
+ </Steps>
25
+
26
+ ## How custom compactors work
27
+
28
+ When `compactionModel` names a registered compactor model, Atomic frames the current context window (previous compacted text first, followed by role-labelled user messages, assistant text, tool calls with arguments, tool results, shell commands with exit codes, and extension messages) and sends one HTTP `POST` request to that model's endpoint:
29
+
30
+ - **No forced request defaults.** Atomic sends `{ messages, query, model }` plus any optional keys you put in `compactionParams`. When `compactionParams` is omitted, Atomic adds no provider-specific fields so the remote API applies its own defaults.
31
+ - **No built-in output size limit.** Whatever the endpoint returns is kept as-is, however long it is. To ask the endpoint for shorter output, set its own parameter in `compactionParams` (for Morph, `compression_ratio`). To reject long output locally, set `maxTokens` on the compactor model: output exceeding that token estimate falls back to memory compaction. `maxTokens` has no default.
32
+ - **Oversized output does not loop.** If a compactor returns output that remains above the automatic threshold, nothing is rejected and Atomic does not re-compact before every tool call of the same turn. The next user turn compacts again before its first request. If the provider reports a context overflow, Atomic compacts and retries once; if the retry still overflows, the provider's error is shown.
33
+ - **Content filtering and redaction.** Images become omission markers, thinking blocks are omitted, role headers are wrapped in `<keepContext>` tags, and messages excluded from model context (such as `!!` shell commands and display-only extension messages) are not sent. If an endpoint echoes your API key or a sensitive auth header, Atomic replaces it with `[redacted]` before storing or displaying the output.
34
+
35
+ ## Select a compaction model {#select-a-compaction-model}
36
+
37
+ Open `/settings` and choose **Compaction model** to switch between **Automatic** ([memory compaction](/compaction/memory-compaction)) and any registered compactor model immediately, without `/reload` or restarting.
38
+
39
+ Both built-in `morph/morph-compactor` and custom remote compactors defined in `~/.atomic/agent/models.json` or an extension appear in this searchable picker automatically (authenticated models first; unauthenticated ones show `requires /login <provider>`). The selector updates project settings when a project override already exists, and global settings otherwise.
40
+
41
+ You can also set `compactionModel` directly in `~/.atomic/agent/settings.json` or a trusted project's `.atomic/settings.json`:
42
+
43
+ ```json
44
+ {
45
+ "compactionModel": "morph/morph-compactor"
46
+ }
47
+ ```
48
+
49
+ - `"auto"` (lowercase) or `""` selects [memory compaction](/compaction/memory-compaction).
50
+ - A registered compactor ID must match `provider/model` **case-sensitively** (leading and trailing whitespace is trimmed).
51
+ - Compactor models never appear in `/model` and never run as chat models. Changing `compactionModel` does not affect [branch summaries](/compaction/branch-summaries).
52
+
53
+ Compaction never calls chat models or classifiers. On startup, once extensions finish loading, and when you trust a project, Atomic resets any saved chat or classifier `compactionModel` to `"auto"`. Compactor IDs and unknown IDs remain untouched; an unknown ID falls back to memory compaction with a notice.
54
+
55
+ For programmatic per-run overrides, live SDK/RPC switching, and registering compactors from extensions, see [Compaction reference](/compaction/reference), [Compaction and tree navigation](/sdk#compaction-and-tree-navigation), and [Custom providers](/custom-provider/api-reference).
56
+
57
+ ## Configure Morph or add a custom compactor {#configure-morph-or-add-a-custom-compactor}
58
+
59
+ Keep `settings.json` free of endpoint knobs and configure API-specific parameters directly on the compactor model in `~/.atomic/agent/models.json` (see [Remote compaction models](/models#remote-compaction-models)).
60
+
61
+ ### Override built-in Morph parameters
62
+
63
+ ```json
64
+ {
65
+ "providers": {
66
+ "morph": {
67
+ "modelOverrides": {
68
+ "morph-compactor": {
69
+ "compactionParams": {
70
+ "compression_ratio": 0.35,
71
+ "preserve_recent": 2
72
+ },
73
+ "timeoutMs": 180000
74
+ }
75
+ }
76
+ }
77
+ }
78
+ }
79
+ ```
80
+
81
+ ### Add a custom remote compactor
82
+
83
+ ```json
84
+ {
85
+ "providers": {
86
+ "my-compactor": {
87
+ "baseUrl": "https://compact.example.com/v1",
88
+ "apiKey": "$MY_COMPACTOR_API_KEY",
89
+ "headers": {
90
+ "X-Team": "platform"
91
+ },
92
+ "models": [
93
+ {
94
+ "id": "compact-v2",
95
+ "name": "Internal Compactor v2",
96
+ "type": "compactor",
97
+ "api": "custom-compact",
98
+ "endpointPath": "/compress",
99
+ "compactionParams": {
100
+ "target_ratio": 0.4,
101
+ "preserve_recent": 2
102
+ },
103
+ "timeoutMs": 180000
104
+ }
105
+ ]
106
+ }
107
+ }
108
+ }
109
+ ```
110
+
111
+ Key configuration fields:
112
+
113
+ - **`type: "compactor"`** registers the model as a compactor so it appears in `/settings` under **Compaction model** instead of `/model`.
114
+ - **`api`** is required on the provider or model for custom compactors (built-in Morph defines `"api": "morph-compact"`). Overriding an existing compactor under `modelOverrides` inherits its provider's `api` and `baseUrl`.
115
+ - **`compactionParams`** merges arbitrary API-specific keys into the JSON request body alongside `{ messages, query, model }`. Omit it to let the remote API apply its own server defaults.
116
+ - **`endpointPath`** appends to `baseUrl` and defaults to `"/compact"`. Set `"endpointPath": ""` to `POST` directly to `baseUrl`.
117
+ - **`timeoutMs`** overrides the default 120-second request timeout.
118
+ - **`maxTokens`** sets an optional estimated-token cap on the compactor's response (no default; longer output falls back to memory compaction).
119
+ - **`headers`** supports `$ENV`, `${ENV}`, and `!command` for custom auth headers (such as `"X-API-Key": "$MY_KEY"`). Sensitive auth headers are redacted automatically from errors and compacted output.
120
+
121
+ For the exact HTTP payload, header, token estimator, and response contract, see [Compactor request contract](/compaction/reference#compactor-request-contract).
122
+
123
+ ## Automatic fallback to memory compaction
124
+
125
+ Every compactor failure falls back automatically to **Automatic** ([memory compaction](/compaction/memory-compaction)) so a broken, unauthenticated, or slow remote endpoint never blocks a session:
126
+
127
+ ```text
128
+ Compaction starts
129
+ ├─ Cancelled by user or extension -> Cancelled (context unchanged)
130
+ ├─ Extension supplies replacement text -> Context compacted (extension)
131
+ ├─ Compaction model is "" / "auto" -> Memory compaction (Context cleared)
132
+ ├─ Compaction model is unknown / chat / classifier -> Automatic fallback (Context cleared)
133
+ └─ Compaction model is a registered compactor
134
+ ├─ success (within maxTokens, if you set one) -> Context compacted (compactor)
135
+ └─ missing auth / HTTP or network error / timeout / Esc /
136
+ malformed or empty output / longer than a maxTokens you set -> Automatic fallback (Context cleared)
137
+ ```
138
+
139
+ Atomic prints a one-line notice (`Compaction model not used (<reason>); context cleared instead`) without exposing your API key or sensitive headers. Pressing `Escape` while a compactor request is in flight also falls back to memory compaction with reason `request aborted`. Taking over with `/compact`, closing the session, or an extension cancelling compaction stops compaction completely.
140
+
141
+ ### Troubleshooting network and DNS errors
142
+
143
+ If Atomic cannot reach the compactor's server, the fallback notice names the underlying connection failure while falling back to memory compaction so your session keeps moving.
144
+
145
+ <Accordion title="Host name cannot be resolved (ENOTFOUND)">
146
+ ```text
147
+ Compaction model not used (morph/morph-compactor failed: fetch failed: getaddrinfo ENOTFOUND api.morphllm.com); context cleared instead
148
+ ```
149
+
150
+ Check your network connection, proxy or VPN settings, and the compactor's `baseUrl`.
151
+ </Accordion>
152
+
153
+ <Accordion title="Blocked by a DNS filter (0.0.0.0 or ::)">
154
+ A DNS filter such as NextDNS, Pi-hole, or AdGuard can block the compactor by resolving its domain to `0.0.0.0` or `::`. When the host resolves only to those addresses, Atomic names the domain to allow:
155
+
156
+ ```text
157
+ Compaction model not used (morph/morph-compactor failed: fetch failed: ERR_SSL_TLSV1_ALERT_INTERNAL_ERROR: tlsv1 alert internal error (api.morphllm.com resolves to 0.0.0.0, the address DNS filters such as NextDNS, Pi-hole or AdGuard return for blocked domains; allow api.morphllm.com in the resolver)); context cleared instead
158
+ ```
159
+
160
+ Add that domain to your DNS filter's allowlist. Until then, compaction continues working through memory compaction.
161
+ </Accordion>