@bastani/atomic 0.10.14-alpha.1 → 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 +29 -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 +9 -0
  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/storage.md CHANGED
@@ -1,99 +1,107 @@
1
1
  ---
2
2
  title: "Storage"
3
3
  sidebarTitle: "Overview"
4
- description: "Choose where Atomic keeps sessions and Intercom messages, share one database across machines, move sessions between stores, and fix storage errors."
4
+ description: "Choose where Atomic keeps sessions and Intercom messages, share one PostgreSQL database across machines, move sessions between stores, and handle storage errors."
5
5
  ---
6
6
 
7
- Atomic saves every session, with its messages, tool output, and [worktree snapshots](/worktree-snapshots), in a **session store**. By default, sessions live in a local SQLite file, `~/.atomic/workflows/journal.sqlite`, and you never need to think about it. Intercom, which carries messages between agents, keeps its own files on each machine until you share a database between machines.
8
-
9
- Read this page when you want to:
10
-
11
- - share sessions and Intercom between machines, a team, or CI;
12
- - move sessions to another machine or another store;
13
- - choose a store for one process, such as a CI job or an app that launches Atomic;
14
- - understand a storage error.
15
-
16
- Each kind of store has its own page:
17
-
18
- - [Local SQLite](/storage/sqlite): the default, with nothing to set up.
19
- - [JSONL](/storage/jsonl): sessions as plain text files in a directory on one machine.
20
- - [PostgreSQL](/storage/postgres): one shared database for many machines and many agents, with guides for [PgBouncer](/storage/postgres/pgbouncer) and [server tuning](/storage/postgres/tuning).
21
- - [Custom adapters](/storage/custom-adapters): connect Atomic to another database through your own adapter.
22
-
23
- Apps built on the SDK choose their store in code. See [SDK session storage](/sdk/storage).
24
-
7
+ Atomic saves every session—messages, tool output, and [worktree snapshots](/worktree-snapshots)—in a **session store**. By default, sessions live in a local SQLite file (`~/.atomic/workflows/journal.sqlite`) and require no setup. Intercom keeps its own local files on each machine until you point machines at a shared database.
8
+
9
+ <Columns cols={2}>
10
+ <Card title="Local SQLite" href="/storage/sqlite">
11
+ Default single-machine store with zero setup, WAL concurrency, and low-level Node SQLite APIs.
12
+ </Card>
13
+ <Card title="JSONL" href="/storage/jsonl">
14
+ Plain text `.jsonl` files on one machine—easy to inspect, copy, or delete by hand.
15
+ </Card>
16
+ <Card title="PostgreSQL" href="/storage/postgres">
17
+ Shared database for teams, CI fleets, and multi-machine Intercom, with [PgBouncer](/storage/postgres/pgbouncer) and [server tuning](/storage/postgres/tuning) guides.
18
+ </Card>
19
+ <Card title="Custom adapters" href="/storage/custom-adapters">
20
+ Connect Atomic to another SQL or non-SQL database through your own adapter module.
21
+ </Card>
22
+ </Columns>
23
+
24
+ Applications built on the SDK choose their store in code. See [SDK session storage](/sdk/storage).
25
+
26
+ <Note>
25
27
  Two rules hold for every store:
26
28
 
27
- - If the store you configured fails to open, Atomic stops with an error. It never falls back to keeping sessions in memory.
28
- - A subagent always keeps its session in the same store as the session that launched it, whatever its working directory or project settings. Subagent sessions are hidden from normal session lists. See [Subagents](/subagents).
29
+ - **No silent fallback.** If the configured store fails to open, Atomic stops with an error rather than falling back to in-memory storage.
30
+ - **Subagents inherit the parent's store.** A subagent always writes to the same store as the session that launched it, regardless of its working directory or project settings. Subagent sessions are hidden from normal session lists. See [Subagents](/subagents).
31
+ </Note>
29
32
 
30
33
  ## Which store to choose
31
34
 
32
35
  | Situation | Store | Why |
33
36
  | --- | --- | --- |
34
- | One person on one machine | [Local SQLite](/storage/sqlite), the default | Needs no setup |
35
- | Data that must not leave the machine | Local SQLite | Nothing leaves the machine |
36
- | Sessions and Intercom shared by several machines, a team, or CI | [PostgreSQL](/storage/postgres) | Many machines can write at once, and managed services add backups and high availability. Everyone who can read the database can read every session in it |
37
- | More than about 8 Atomic processes on one PostgreSQL server with its default limit of 100 connections | PostgreSQL behind [PgBouncer](/storage/postgres/pgbouncer) | Each Atomic process can open up to 10 connections, and each Intercom broker 11. [Count the connections](/storage/postgres#count-the-connections-atomic-needs) first |
38
- | Sessions as plain text files you can read, back up, or delete by hand, on one machine | [JSONL](/storage/jsonl) | One file per session. Holds sessions only, and forks copy their history |
39
- | A database Atomic does not support | A [custom adapter](/storage/custom-adapters) | You write the connection code |
37
+ | One person on one machine | [Local SQLite](/storage/sqlite) (default) | Zero setup, supports snapshots and shared-history forks |
38
+ | Data that must stay local | Local SQLite | Nothing leaves the machine |
39
+ | Sessions and Intercom shared across machines, a team, or CI | [PostgreSQL](/storage/postgres) | Concurrent multi-host writes, managed backups, and HA |
40
+ | More than ~8 Atomic processes on a default 100-connection PostgreSQL server | PostgreSQL behind [PgBouncer](/storage/postgres/pgbouncer) | Each agent process opens up to 10 connections (11 for an Intercom broker); [count connections](/storage/postgres#count-the-connections-atomic-needs) first |
41
+ | Plain-text session files on one machine | [JSONL](/storage/jsonl) | One readable file per session; holds sessions only and copies forks in full |
42
+ | Another database backend | [Custom adapter](/storage/custom-adapters) | Implement `openDatabase` or `openSessionStore` |
40
43
 
41
- A JSONL directory holds sessions only. [JSONL setup](/storage/jsonl) shows how to select it.
42
-
43
- To move existing sessions to another store, see [Exporting and importing sessions](#exporting-and-importing-sessions). Atomic no longer supports Turso and libSQL. If you used them, see [Moving off libSQL](#moving-off-libsql).
44
+ To move sessions between stores, see [Exporting and importing sessions](#exporting-and-importing-sessions). Atomic 0.10.11 removed Turso and libSQL support; see [Moving off libSQL](#moving-off-libsql).
44
45
 
45
46
  ## Sharing storage across hosts
46
47
 
47
- To share sessions and Intercom between machines, point every machine at the same [PostgreSQL](/storage/postgres) database, with the same `prefix`. A prefix starts the name of each of Atomic's tables, so several teams can share one database. Never put a local SQLite file on a network drive or a synced folder.
48
+ To share sessions and Intercom across machines, point every machine at the same [PostgreSQL](/storage/postgres) database with the same `prefix`. A prefix prepends a namespace to every table name so several teams can share one database without seeing each other's data.
48
49
 
49
- Which setting you change decides what is shared:
50
+ Which setting you configure controls what is shared:
50
51
 
51
- | Setting | Shares sessions | Shares Intercom between machines |
52
+ | Setting | Shares sessions | Shares Intercom across machines |
52
53
  | --- | --- | --- |
53
- | Top-level `storage` in global settings, `~/.atomic/agent/settings.json`, or `ATOMIC_STORAGE`, `--storage`, or `--storage-file` | Yes | Yes |
54
+ | Top-level `storage` in `~/.atomic/agent/settings.json` (or `ATOMIC_STORAGE`, `--storage`, `--storage-file`) | Yes | Yes |
54
55
  | `sessions.storage` only, pointing at the shared database | Yes | No |
55
- | Top-level `storage` in global settings, plus `sessions.storage` set to `{}` | No, sessions stay in the local default file | Yes |
56
+ | Top-level `storage` on the shared database, plus `sessions.storage` set to `{}` | No (sessions stay in local SQLite) | Yes |
56
57
 
57
- Project settings can choose where a project's sessions go, but never Intercom's store.
58
+ Project settings (`.atomic/settings.json`) can choose where a project's sessions go, never Intercom's store.
58
59
 
59
- Sharing Intercom between machines is called multi-node routing: an agent on one machine can message an agent on another. Atomic runs one Intercom broker per agent directory, usually one per machine or container. The broker is a background process that passes messages between agents, and with multi-node routing it passes them through the shared database. See [Running Intercom across machines](/intercom/operations#running-intercom-across-machines).
60
+ Sharing Intercom across machines enables **multi-node routing**: an agent on one machine can message an agent on another through the shared database. Atomic runs one Intercom broker per agent directory (usually one per machine or container). See [Running Intercom across machines](/intercom/operations#running-intercom-across-machines) and [Resume sessions on any machine](/guides/resume-on-any-machine).
60
61
 
61
- The shared database holds sessions, tool output, worktree snapshots, and Intercom messages in transit. Anyone who can read the database can read all of them, so grant read access as you would to the sessions themselves. To resume a session on another machine, see [Resume sessions on any machine](/guides/resume-on-any-machine).
62
+ <Warning>
63
+ - **Never put a local SQLite file on a network drive (NFS/SMB) or synced folder.** File locks do not coordinate safely across hosts and can corrupt the database.
64
+ - **Database read access equals full session read access.** A shared database holds sessions, tool output, worktree snapshots, and Intercom messages in transit. Grant database access only to people and services allowed to read those sessions.
65
+ </Warning>
62
66
 
63
67
  ### Joining a machine to a shared database
64
68
 
65
- To create the database, follow [Set up the database](/storage/postgres#set-up-the-database). To join a machine to it, follow [Join a machine](/storage/postgres#join-a-machine): install the PostgreSQL adapter, save the password in a file, run `atomic storage join`, and restart Intercom.
69
+ Create the database and roles once with [Set up the database](/storage/postgres#set-up-the-database), then connect each machine with [Join a machine](/storage/postgres#join-a-machine).
70
+
71
+ `atomic storage join <url>` performs four steps:
66
72
 
67
- `atomic storage join <url>` does four things:
73
+ 1. Validates the URL, adapter, and credentials, then runs `SELECT 1` with a 15-second timeout. If any check fails, nothing is written.
74
+ 2. Copies `--password-file` into an owner-only file (`~/.atomic/agent/storage-token.<id>`, mode `600`). A `--token-file` stays in place and is re-read for every new connection.
75
+ 3. Writes the top-level `storage` object (and `prefix` if `--prefix` is passed) to `~/.atomic/agent/settings.json`, leaving all other settings untouched.
76
+ 4. Reports any environment variable or project setting that overrides the new configuration, and notes if a running Intercom broker still uses the previous store.
68
77
 
69
- 1. It checks the URL, the adapter, and the credentials, then runs `SELECT 1` on the database within 15 seconds. If any check fails, it writes nothing.
70
- 2. It copies a `--password-file` into a private file in the agent directory, `~/.atomic/agent/storage-token.<id>`, readable only by you. A `--token-file` stays where it is, and Atomic reads it again for every new connection.
71
- 3. It sets the top-level `storage` key in `~/.atomic/agent/settings.json`, and `prefix` if you passed `--prefix`. It replaces any `storage` value that was there and keeps no copy, so save the old value first if you need it. It changes no other setting.
72
- 4. It lists any environment variable or project setting that overrides the new setting, and says whether the running Intercom broker still uses the old store.
78
+ The URL must not include a password. Pass exactly one of `--password-file <path>`, `--token-file <path>`, or `--auth azure|aws|gcp`. `atomic storage migrate --db <url>` accepts the same authentication flags.
73
79
 
74
- The URL must not contain a password. Pass exactly one of `--password-file <path>`, `--token-file <path>`, or `--auth azure|aws|gcp`. `atomic storage migrate --db <url>` takes the same options.
80
+ <Note>
81
+ `atomic storage join` replaces any existing top-level `storage` setting without keeping a backup copy. Save your current `storage` value first if you still need it.
82
+ </Note>
75
83
 
76
84
  ### Checking the selected storage
77
85
 
78
- Run `atomic storage status` in your project directory, or `atomic storage status --json` for scripts. For sessions and for Intercom, it shows:
86
+ Run `atomic storage status` in your project directory (or `atomic storage status --json` for scripts). For both sessions and Intercom, it reports:
79
87
 
80
- - which store is selected, and where the choice comes from: an environment variable, project settings, global settings, or the default;
81
- - any setting that is overridden or ignored, such as project settings in an untrusted project;
82
- - whether the adapter loads, and whether the database answers `SELECT 1` within 15 seconds. For PostgreSQL, it also shows the server version;
83
- - the running Intercom broker, its session count, whether multi-node routing is on, and the other brokers sharing the database.
88
+ - the active store and where it came from (environment variable, project settings, global settings, or default);
89
+ - any overridden or ignored selection (such as project settings in an untrusted project);
90
+ - whether the adapter loads (15-second load timeout) and whether the database answers `SELECT 1` (separate 15-second probe timeout), plus the server version on PostgreSQL or library version on SQLite;
91
+ - the local Intercom broker state, active session count, multi-node routing status, and peer brokers sharing the database.
84
92
 
85
- It never creates or changes anything. A local SQLite file is opened read-only. It exits `1` if the settings cannot be read, a selection is invalid, an adapter fails to load, or a database does not answer. Interactive sessions also warn at startup when the shared `storage` names an adapter that does not load.
93
+ `atomic storage status` is read-only: it never creates files, directories, or tables, and opens local SQLite files read-only. It exits `1` when settings are unreadable, a selection is invalid, an adapter fails to load, or a database does not answer. Interactive sessions also warn at startup if the shared `storage` adapter fails to load.
86
94
 
87
95
  ## Selecting storage per process
88
96
 
89
- A program that launches Atomic, such as a CI job or an app that runs `atomic --mode rpc`, can choose the store for that process without editing `settings.json`. Each option takes the same JSON object as the `storage` setting, with `adapter`, `options`, `secrets`, and `prefix`:
97
+ A launcher—such as a CI job or an app running `atomic --mode rpc`—can choose a store for one process without editing `settings.json`. Each option takes the same JSON object as the `storage` setting (`adapter`, `options`, `secrets`, `prefix`):
90
98
 
91
- | Option | Applies to | Same as the setting |
99
+ | Option | Applies to | Equivalent setting |
92
100
  | --- | --- | --- |
93
101
  | `--storage '<json>'` | Sessions and Intercom | `storage` |
94
- | `--storage-file <path>` | Sessions and Intercom. Reads the JSON from a file | `storage` |
102
+ | `--storage-file <path>` | Sessions and Intercom (reads JSON from file) | `storage` |
95
103
  | `ATOMIC_STORAGE` | Sessions and Intercom | `storage` |
96
- | `ATOMIC_SESSIONS_STORAGE` | Sessions only. Also accepts `{ "dir": "..." }` for a JSONL directory | `sessions.storage` |
104
+ | `ATOMIC_SESSIONS_STORAGE` | Sessions only (also accepts `{ "dir": "..." }` for JSONL) | `sessions.storage` |
97
105
 
98
106
  ```bash
99
107
  ATOMIC_STORAGE='{"adapter":"@bastani/atomic-storage-postgres","options":{"url":"postgresql://atomic_runtime@db.example.com:5432/atomic"},"secrets":{"password":{"env":"ATOMIC_DB_PASSWORD"}},"prefix":"svc_"}' \
@@ -103,128 +111,130 @@ atomic --mode rpc --storage-file /etc/atomic/storage.json
103
111
  ```
104
112
 
105
113
  - Pass `--storage` or `--storage-file`, not both.
106
- - An interactive session keeps `--storage` for its whole life. Child processes it starts inherit environment variables such as `ATOMIC_STORAGE`, not command-line flags.
107
- - Atomic runs one Intercom broker per agent directory, usually one per machine or container, and it serves every session that uses that agent directory. It keeps the store of the process that started it until it exits or `atomic intercom restart` replaces it. Project settings never choose the broker's store.
114
+ - An interactive session keeps `--storage` for its lifetime. Spawned child processes inherit environment variables (`ATOMIC_STORAGE`), not CLI flags.
115
+ - Each agent directory runs one Intercom broker, which keeps the storage selection of the process that started it until it exits or `atomic intercom restart` replaces it. Project settings never select the broker's store.
108
116
 
109
117
  ### Which selection wins
110
118
 
111
- For sessions, the first of these that is set wins:
119
+ For sessions, the first selection set wins (selections replace whole objects; fields are never merged):
112
120
 
113
- 1. In the SDK: `sessionManager`, then `sessionStore`, then `createAgentSession({ storage })`
114
- 2. `--session-store <file>`, a local SQLite file for this run, `--no-session`, or `--session-dir <directory>`, a JSONL directory
115
- 3. `--storage` or `--storage-file`
116
- 4. `ATOMIC_SESSIONS_STORAGE` or `ATOMIC_CODING_AGENT_SESSION_DIR`
117
- 5. `ATOMIC_STORAGE`
118
- 6. The `sessions.storage` setting
119
- 7. The `storage` setting
120
- 8. The default local SQLite file, `~/.atomic/workflows/journal.sqlite`
121
+ 1. SDK options: `sessionManager`, then `sessionStore`, then `createAgentSession({ storage })`
122
+ 2. Session CLI flags: `--session-store <file>`, `--no-session`, or `--session-dir <directory>`
123
+ 3. Process CLI flags: `--storage` or `--storage-file`
124
+ 4. Session env vars: `ATOMIC_SESSIONS_STORAGE` or `ATOMIC_CODING_AGENT_SESSION_DIR`
125
+ 5. Shared env var: `ATOMIC_STORAGE`
126
+ 6. `sessions.storage` in settings
127
+ 7. `storage` in settings
128
+ 8. Default local SQLite file (`~/.atomic/workflows/journal.sqlite`)
121
129
 
122
- Where two selections meet:
130
+ Interaction rules:
123
131
 
124
- - `--session-dir` and the other session flags replace `--storage` for sessions only. Intercom still uses `--storage`.
125
- - `ATOMIC_CODING_AGENT_SESSION_DIR` replaces `ATOMIC_STORAGE` for sessions only.
126
- - Setting `ATOMIC_SESSIONS_STORAGE`, `--storage`, or `--storage-file` together with a non-empty `ATOMIC_CODING_AGENT_SESSION_DIR` stops startup with `StorageConfigError` and reason `conflicting-overrides`. Unset one of them, or pass a session flag.
127
- - Relative `path`, `dir`, and `secrets.file` values resolve against the [storage home](#storage-home). A relative adapter path resolves from the agent directory. A relative `--storage-file` path resolves from the current directory. An empty variable counts as unset.
132
+ - Session flags (`--session-dir`, `--session-store`, `--no-session`) override `--storage` for sessions only; Intercom still uses `--storage`.
133
+ - `ATOMIC_CODING_AGENT_SESSION_DIR` overrides `ATOMIC_STORAGE` for sessions only.
134
+ - Combining a non-empty `ATOMIC_CODING_AGENT_SESSION_DIR` with `ATOMIC_SESSIONS_STORAGE`, `--storage`, or `--storage-file` fails startup with `StorageConfigError` (`conflicting-overrides`). Unset one of them or pass a session flag.
135
+ - Relative `path`, `dir`, and `secrets.file` values resolve against the [storage home](#storage-home). Relative adapter paths resolve from the agent directory. Relative `--storage-file` paths resolve from the current working directory. Empty environment variables count as unset.
128
136
 
129
- Atomic checks `--storage`, `--storage-file`, `ATOMIC_STORAGE`, and `ATOMIC_SESSIONS_STORAGE` before any session starts, in every mode, even when a higher selection wins. Invalid JSON, an unknown field, an unreadable file, a libSQL selection, or a variable of the removed CI team profile, such as `ATOMIC_PROFILE`, stops the CLI with `Error: ...` and exit code `1`, and makes the SDK throw `StorageConfigError`. Atomic never falls back to another store. Error messages name the variable or flag, never a secret.
137
+ Atomic validates `--storage`, `--storage-file`, `ATOMIC_STORAGE`, and `ATOMIC_SESSIONS_STORAGE` before any session starts, even when a higher-precedence selection wins. Invalid JSON, unknown fields, unreadable files, libSQL selections, or removed team-profile variables (`ATOMIC_PROFILE`, `ATOMIC_TEAM_*`) stop the CLI with exit code `1` and make the SDK throw `StorageConfigError`. Error messages name the variable or flag, never a secret.
130
138
 
131
139
  ### Keeping credentials safe
132
140
 
133
- - These options come from the program that launches Atomic, so they apply even in a project you have not [trusted](/security).
134
- - An adapter is code that runs with Atomic's rights. Select only adapters you trust.
141
+ - Process-level options come from the launcher, so they apply even in an untrusted project (see [Security](/security)).
142
+ - Adapter modules run code with Atomic's privileges. Select only adapters you trust.
135
143
  - Put passwords and tokens in `secrets`, never in `options`.
136
- - Prefer `--storage-file` or an environment variable to `--storage` for anything sensitive. Other users on the machine can see command-line arguments.
137
- - In the SDK, `inMemorySecret(value)` keeps a secret only in memory. It shows as `[redacted]` and is refused in settings, flags, and environment variables.
144
+ - Prefer `--storage-file` or an environment variable over `--storage` for sensitive config—other local users can inspect command-line arguments.
145
+ - In the SDK, `inMemorySecret(value)` keeps a secret in memory only. It serializes as `[redacted]` and is refused in settings, flags, and environment variables.
138
146
 
139
147
  ## Storage home
140
148
 
141
- Relative paths in storage settings resolve against the **storage home**. That includes `path`, `dir`, and `secrets.file` values, relative `--storage` and `ATOMIC_STORAGE` paths, and the shared `repos/` and `worktrees/` directories.
149
+ Relative paths in storage settings (`path`, `dir`, `secrets.file`), relative `--storage` / `ATOMIC_STORAGE` paths, and shared `repos/` and `worktrees/` directories resolve against the **storage home**:
142
150
 
143
151
  | Agent directory | Storage home |
144
152
  | --- | --- |
145
- | The default, `~/.atomic/agent` | `~/.atomic`, under the current `HOME`. Moving the home directory keeps relative paths working. |
146
- | A custom one, set with `ATOMIC_CODING_AGENT_DIR`, its older name `PI_CODING_AGENT_DIR`, or the SDK's `agentDir` | The agent directory itself, so separate profiles stay separate. |
153
+ | Default (`~/.atomic/agent`) | `~/.atomic` under the current `HOME` |
154
+ | Custom (`ATOMIC_CODING_AGENT_DIR`, legacy `PI_CODING_AGENT_DIR`, or SDK `agentDir`) | The agent directory itself, isolating separate profiles |
147
155
 
148
- An older layout kept the session database of a custom agent directory in its parent directory. When such a profile upgrades, the first profile that finds a session database there keeps using the parent directory and prints a one-time notice. Profiles that already have their own store keep it. A relative `secrets.file` can still read an existing file in the parent directory. To share one local store between profiles on purpose, use absolute paths.
156
+ An older layout stored a custom agent directory's session database in its parent directory. When an older profile upgrades, the first profile that finds an existing parent session database continues using it and prints a one-time notice; profiles with their own database keep theirs. Relative `secrets.file` paths also fall back to an existing file in the parent directory. To share one local store across profiles intentionally, use absolute paths.
149
157
 
150
158
  `atomic storage status` never creates a missing agent directory. A read-only agent directory works as long as the storage home is writable.
151
159
 
152
160
  ## Locks in the agent directory
153
161
 
154
- Processes that share an agent directory take turns writing `settings.json`, `auth.json`, project trust decisions, and session claims. They coordinate through lock files next to those files. If a process exits while holding a lock, the next process takes the lock over.
162
+ Processes sharing an agent directory coordinate writes to `settings.json`, `auth.json`, project trust decisions, and session claims through adjacent lock files. If a process exits while holding a lock, the next process takes it over.
155
163
 
156
- These locks work only between processes on one machine that see the agent directory through the same local filesystem. Do not share one agent directory:
164
+ <Warning>
165
+ Agent-directory locks work only between processes on one machine accessing the same local filesystem. Do **not** share an agent directory:
157
166
 
158
- - between machines, over NFS, SMB, or a synced folder, where file locks may not work across machines;
159
- - on one machine through both a local path and a container volume, bind mount, or network mount.
167
+ - across machines via NFS, SMB, or a cloud-synced folder;
168
+ - on one machine across both a host path and a container volume or bind mount.
160
169
 
161
- Give each machine or container its own agent directory with `ATOMIC_CODING_AGENT_DIR`, and share sessions through a [shared database](#sharing-storage-across-hosts) instead.
170
+ Give each machine or container its own directory via `ATOMIC_CODING_AGENT_DIR`, and share state through a [PostgreSQL database](#sharing-storage-across-hosts).
171
+ </Warning>
162
172
 
163
- If Atomic warns that it cannot open or remove a lock file, such as `settings.json.lock.takeover.lock`, another user owns it, often from an earlier `sudo` run. Fix the owner or remove the file, for example with `sudo chown $USER ~/.atomic/agent/settings.json.lock.takeover.lock`. Until then, Atomic takes over a stale lock after 10 seconds.
173
+ If Atomic warns that it cannot open or remove a lock file (such as `settings.json.lock.takeover.lock`), another user usually owns it—often from a previous `sudo` run. Fix ownership or delete the lock file (for example, `sudo chown $USER ~/.atomic/agent/settings.json.lock.takeover.lock`). Until resolved, Atomic takes over a stale lock after 10 seconds.
164
174
 
165
175
  ## Tuning for many concurrent agents
166
176
 
167
- How many agents can write at once depends on the store:
177
+ Write concurrency depends on the store:
168
178
 
169
- - **PostgreSQL:** it depends on how many connections each process may open. Writes to different sessions run side by side. Writes to the same session wait for each other. See [Tuning for many concurrent agents](/storage/postgres#tuning-for-many-concurrent-agents), and [Server tuning](/storage/postgres/tuning) for the server itself.
170
- - **Local SQLite:** one writer at a time, and no setting changes that. See [Tuning local SQLite](/storage/sqlite#tuning-for-many-concurrent-agents).
171
- - **JSONL:** one writer at a time per directory, and nothing to set. See [Several Atomic processes](/storage/jsonl#several-atomic-processes).
179
+ - **PostgreSQL:** writes to different sessions run in parallel up to each process's connection pool limit; writes to the same session wait in line. See [Tuning for many concurrent agents](/storage/postgres#tuning-for-many-concurrent-agents) and [Server tuning](/storage/postgres/tuning).
180
+ - **Local SQLite:** one writer at a time across the database file, with no `settings.json` knob to change. See [Tuning local SQLite](/storage/sqlite#tuning-for-many-concurrent-agents).
181
+ - **JSONL:** writes to different sessions run in parallel; writes to the same session wait in line. Nothing to configure. See [Several Atomic processes](/storage/jsonl#several-atomic-processes).
172
182
 
173
183
  ## Exporting and importing sessions
174
184
 
175
- `atomic storage export <dir>` writes sessions to JSONL files, one per session. `atomic storage import <dir>` reads them back. Use them to move sessions to another machine or another store, or to keep sessions between CI runs.
185
+ `atomic storage export <dir>` writes sessions to portable JSONL files (one per session), and `atomic storage import <dir>` loads them into a target store. Use them to migrate between stores, move sessions to another machine, or cache sessions between CI runs.
176
186
 
177
187
  ```bash
178
188
  atomic storage export <dir> [--limit <n>] [--since <time>] [--storage <json> | --storage-file <path>]
179
189
  atomic storage import <dir> [--storage <json> | --storage-file <path>]
180
190
  ```
181
191
 
182
- Each exported file is a full copy of one session, with every entry and tool output, including the history a [fork](#shared-history-forks) shares with the session it came from. It does not depend on any other session. Import always writes a standalone session, so deleting the original sessions never affects an imported one.
192
+ Both commands also accept an optional `--sessions` compatibility flag (a no-op, because sessions are all they transfer).
193
+
194
+ Each exported file is a complete, standalone copy of one session—including every branch, tool output, worktree snapshot, and the full inherited history of any [shared-history fork](#shared-history-forks). Importing writes standalone sessions, so deleting originals never affects imported copies.
183
195
 
184
196
  ### Layout
185
197
 
186
198
  ```text
187
199
  <dir>/
188
- sessions/<sessionId>.jsonl one session per file
200
+ sessions/<encodedSessionId>.jsonl one session per file
189
201
  ```
190
202
 
191
- Import reads only the `*.jsonl` files in `<dir>/sessions` and ignores everything else, including temporary files left by an interrupted export. If `<dir>/sessions` does not exist, import adds nothing.
203
+ Session IDs are URL-encoded (`encodeURIComponent(id)`) in filenames so IDs containing special characters stay portable. Import reads only `*.jsonl` files in `<dir>/sessions` and ignores everything else (including temporary files from an interrupted export). If `<dir>/sessions` does not exist, import adds nothing.
192
204
 
193
205
  ### Export
194
206
 
195
- By default, export writes every session, from every project, including the hidden sessions of subagents, so a subagent's history moves with its parent.
207
+ By default, export writes every session across all projects, including hidden subagent sessions so subagent history travels with its parent.
196
208
 
197
209
  | Option | Effect |
198
210
  | --- | --- |
199
- | `--limit <n>` | Write only the `n` most recently changed sessions. `n` is a whole number, 1 or more. |
200
- | `--since <time>` | Write only sessions changed at or after `<time>`. A date such as `2026-11-01` means midnight UTC. A date and time without a time zone, such as `2026-11-01T09:30:00`, uses your local time zone. Add `Z` or an offset, as in `2026-11-01T09:30:00Z`, to avoid surprises. |
211
+ | `--limit <n>` | Export only the `n` most recently modified sessions (`n >= 1`). |
212
+ | `--since <time>` | Export only sessions modified at or after `<time>`. A bare date like `2026-11-01` means midnight UTC; a date-time without a zone (`2026-11-01T09:30:00`) uses local time. Add `Z` or an offset (`2026-11-01T09:30:00Z`) to be explicit. |
201
213
 
202
- Export writes each file under a temporary name and renames it when it is complete, so a crash never leaves half a file. A file that would not change is not rewritten. Export never deletes files, so remove old exports yourself.
214
+ Export writes each file to a temporary path and atomically renames it when complete. Unchanged files are skipped, and existing files in `<dir>` are never deleted—prune old exports yourself.
203
215
 
204
216
  ### Import
205
217
 
206
- Import checks every file before it writes anything. A malformed file, an unsupported format version, or a session whose history differs from the copy already in the store stops the import, with the file name and line number, before any write.
218
+ Import validates every file before writing anything. A malformed line, unsupported format version, or conflicting history stops the import with the filename and line number before any data changes.
207
219
 
208
- For each session in the files:
220
+ For each file (matched by session ID):
209
221
 
210
- - A session the store does not have is added.
211
- - A session the store has with fewer entries gets the newer entries.
212
- - A session the store already has in full is skipped.
222
+ - Sessions absent from the store are added.
223
+ - Sessions present with fewer entries receive the newer entries.
224
+ - Sessions already up to date are skipped.
213
225
 
214
- So importing the same directory twice adds nothing, and importing a newer export adds only what changed. Sessions match by ID.
215
-
216
- If an import fails after writing some sessions, it exits `1` and lists what it imported and what it did not. Run the same command again to finish. Imported sessions work at once with `--session`, `/resume`, and `history://sessions`.
226
+ Importing the same directory twice is safe and idempotent. If a write fails partway through, import exits `1` and lists which sessions succeeded and which did not (`StorageImportIncompleteError` in the SDK); re-run the same command to finish. Imported sessions work immediately with `--session`, `/resume`, and `history://sessions`.
217
227
 
218
228
  ### Selecting storage for export and import
219
229
 
220
- Both commands use the store this directory's settings select. If that store is a shared database or an in-memory store, they refuse by default, because every machine joined to a shared database already sees its sessions.
230
+ By default, both commands use the store selected in the current directory. They refuse when that store is a shared database or in-memory store (machines on a shared database already see its sessions).
221
231
 
222
- To export from or import into a specific store, including a shared database, name it with `--storage <json>` or `--storage-file <path>`:
232
+ To export from or import into a specific store—including a shared PostgreSQL database—pass `--storage <json>` or `--storage-file <path>`:
223
233
 
224
- - A relative `path` in these options resolves against the current directory, not the storage home. If you copy a `storage` object from `settings.json` that has a relative `path`, make it absolute first. A relative `secrets.file` still resolves against the storage home, so the password file that `atomic storage join` wrote works as it is.
225
- - A JSONL `{ "dir": "..." }` or an empty `{}` is refused.
234
+ - A relative `path` in `--storage` / `--storage-file` resolves against the **current directory**, not the storage home. Make relative SQLite paths from `settings.json` absolute first. A relative `secrets.file` still resolves against the storage home so `atomic storage join`'s password file works as-is.
235
+ - JSONL `{ "dir": "..." }` and empty `{}` selections are refused with `--storage` / `--storage-file`. (To export from a JSONL directory selected via `--session-dir`, set `ATOMIC_SESSIONS_STORAGE` instead; see [Move to SQLite or PostgreSQL](/storage/jsonl#move-to-sqlite-or-postgresql).)
226
236
 
227
- For example, to copy every session from this machine's local SQLite store into a PostgreSQL database:
237
+ Example—copying local SQLite sessions into a new PostgreSQL database:
228
238
 
229
239
  ```bash
230
240
  atomic storage export ~/moved
@@ -237,283 +247,269 @@ atomic storage import ~/moved --storage-file new-storage.json
237
247
 
238
248
  ### Session file format and redaction
239
249
 
240
- Each file uses session format version 4, the same format as JSONL session directories and `atomic --import <file>`. Line 1 is the session header. Each later line is one entry, in the order it was added:
250
+ Export files use session format version 4 (the same format as JSONL directories and `atomic --import <file>`). Line 1 is the session header, and each subsequent line is an entry in append order:
241
251
 
242
252
  ```json
243
253
  {"type":"session","version":4,"id":"...","createdAt":"2026-11-12T09:30:00.000Z","cwd":"/repo"}
244
254
  {"type":"message","id":"a1b2c3d4","parentId":null,"timestamp":"2026-11-12T09:30:05.000Z","message":{"role":"user","content":"..."}}
245
255
  ```
246
256
 
247
- Files hold every branch of a session. Tool output and worktree snapshot files are stored once each, encoded as base64, and import checks each one against its SHA-256 hash. A file with another format version is refused.
257
+ Files contain every branch of the session. Tool output and worktree snapshot blobs are embedded once each in base64 and verified by SHA-256 on import.
248
258
 
249
- You can redact a file before you share it, for example by replacing a secret with `***`. Import still accepts the file if every line stays a valid JSON object, the lines stay in order, and these fields stay unchanged:
259
+ You can redact secrets (for example replacing a token with `***`) before sharing an export file, provided every line remains valid JSON in its original order and you keep these fields unchanged:
250
260
 
251
- - in the header, `type`, `version`, `id`, and `createdAt`. `cwd` decides which project the session belongs to;
252
- - in every entry, `id`, `parentId`, and `type`;
253
- - every `base64` value and `blobs` object, because import checks their hashes.
261
+ - Header: `type`, `version`, `id`, and `createdAt` (`cwd` determines the project).
262
+ - Every entry: `id`, `parentId`, and `type`.
263
+ - Every `base64` value and `blobs` object (hash-verified on import).
254
264
 
255
265
  ### Persisting sessions between CI runs
256
266
 
257
- On a CI runner that caches a directory between jobs:
267
+ On a CI runner that caches `$STATE_DIR` between jobs:
258
268
 
259
269
  ```bash
260
- # Start of the job, after the cache restores $STATE_DIR
270
+ # Start of the job, after cache restore
261
271
  mkdir -p "$STATE_DIR" && atomic storage import "$STATE_DIR"
262
272
 
263
273
  # ... run Atomic ...
264
274
 
265
- # End of the job, before the cache saves $STATE_DIR
275
+ # End of the job, before cache save
266
276
  atomic storage export "$STATE_DIR"
267
277
  ```
268
278
 
269
- Use `--since` or `--limit` to keep the cache small. Continue an imported session with `atomic --session <id>`.
279
+ Use `--since` or `--limit` to bound cache size, and resume an imported session with `atomic --session <id>`.
270
280
 
271
281
  ## Moving off libSQL
272
282
 
273
- Atomic 0.10.11 removed libSQL support: Turso, self-hosted `sqld`, and libSQL `file:` databases. If your sessions are in a libSQL database, move them to PostgreSQL or to a local SQLite file. Forks keep their whole history, and worktree snapshots keep their content. You export them with Atomic 0.10.11-alpha.2, the last release that reads libSQL, and import them with the current release. Use that release even if you last ran an earlier one: it reads every libSQL database, including one it already upgraded for [shared-history forks](#shared-history-forks), which 0.10.10 refuses. Its exports use session format 4, which the current release reads.
283
+ Atomic 0.10.11 removed libSQL support (Turso, self-hosted `sqld`, and libSQL `file:` databases). To migrate existing sessions to PostgreSQL or local SQLite, export them with `0.10.11-alpha.2` (the last release that reads every libSQL schema, including stores upgraded for [shared-history forks](#shared-history-forks)) and import them with your current release. Forks retain their full history and worktree snapshots keep their content.
274
284
 
275
285
  Before you start:
276
286
 
277
- - **Do this before you run `atomic storage join`.** `atomic storage join` replaces the libSQL `storage` setting, and step 1 needs it.
278
- - **Run it once, from one machine.** If several machines shared the libSQL database, the other machines only upgrade Atomic and [join the new database](/storage/postgres#join-a-machine).
279
- - **You need Node.js 24.20 or newer with `npx`** to run Atomic 0.10.11-alpha.2 next to the current release. The current release needs the same.
280
- - **Only sessions move.** Intercom messages that were not yet delivered stay behind. Forks arrive as full copies, so they take more space than they did in the libSQL database.
281
-
282
- 1. **Save the libSQL setting to a file.** It is the top-level `storage` value in `~/.atomic/agent/settings.json`:
283
-
284
- ```bash
285
- jq .storage ~/.atomic/agent/settings.json > old-storage.json
286
- ```
287
-
288
- If `sessions.storage` points at the libSQL database instead, save that value with `jq .sessions.storage` instead. If you already replaced the setting, write `old-storage.json` by hand. It looks like this, with your database's URL and your token file:
289
-
290
- ```json
291
- {
292
- "adapter": "@bastani/atomic-storage-libsql",
293
- "options": { "url": "libsql://my-db.turso.io" },
294
- "secrets": { "authToken": { "file": "/home/me/turso-token" } }
295
- }
296
- ```
297
-
298
- 2. **Export the sessions with Atomic 0.10.11-alpha.2:**
299
-
300
- ```bash
301
- npx -y @bastani/atomic@0.10.11-alpha.2 storage export ~/moved --storage-file old-storage.json
302
- ```
303
-
304
- It reads only the libSQL database, and prints how many sessions it wrote:
305
-
306
- ```text
307
- Exported 4 sessions to /home/me/moved/sessions (4 written, 0 unchanged).
308
- ```
309
-
310
- If it prints `Error: Could not load storage adapter: @bastani/atomic-storage-libsql: Cannot find module '@bastani/atomic-storage-libsql'`, install the adapter for that release, then export again:
311
-
312
- ```bash
313
- npx -y @bastani/atomic@0.10.11-alpha.2 install npm:@bastani/atomic-storage-libsql@0.10.11-alpha.2
314
- ```
315
-
316
- 3. **Import them into their new store.**
287
+ - **Export before running `atomic storage join`**, which overwrites the libSQL `storage` setting.
288
+ - **Run the migration once from a single machine.** Other machines sharing that database only need to upgrade Atomic and [join the new database](/storage/postgres#join-a-machine).
289
+ - **Requires Node.js with `npx`** (matching Atomic's minimum Node.js version) to run `@bastani/atomic@0.10.11-alpha.2`.
290
+ - **Only sessions transfer.** Undelivered Intercom messages are left behind, and forks import as full copies (using more space than shared forks).
291
+
292
+ <Steps>
293
+ <Step title="Save the libSQL setting to a file">
294
+ Extract your top-level `storage` setting (or `.sessions.storage` if libSQL was configured there):
295
+
296
+ ```bash
297
+ jq .storage ~/.atomic/agent/settings.json > old-storage.json
298
+ ```
299
+
300
+ If you already overwrote the setting, create `old-storage.json` manually:
301
+
302
+ ```json
303
+ {
304
+ "adapter": "@bastani/atomic-storage-libsql",
305
+ "options": { "url": "libsql://my-db.turso.io" },
306
+ "secrets": { "authToken": { "file": "/home/me/turso-token" } }
307
+ }
308
+ ```
309
+ </Step>
310
+ <Step title="Export sessions with Atomic 0.10.11-alpha.2">
311
+ ```bash
312
+ npx -y @bastani/atomic@0.10.11-alpha.2 storage export ~/moved --storage-file old-storage.json
313
+ ```
314
+
315
+ If it reports `Cannot find module '@bastani/atomic-storage-libsql'`, install that version's adapter and re-run the export:
316
+
317
+ ```bash
318
+ npx -y @bastani/atomic@0.10.11-alpha.2 install npm:@bastani/atomic-storage-libsql@0.10.11-alpha.2
319
+ ```
320
+ </Step>
321
+ <Step title="Import into PostgreSQL or local SQLite">
322
+ **To move to PostgreSQL**, [set up the database](/storage/postgres#set-up-the-database), join it, and import by name:
323
+
324
+ ```bash
325
+ (umask 077; printf 'Runtime password: '; read -rs password; printf '\n'; printf '%s' "$password" > ~/atomic-db-password)
326
+ atomic storage join 'postgresql://atomic_runtime@db.example.com:5432/atomic' --password-file ~/atomic-db-password
327
+ rm ~/atomic-db-password # atomic storage join keeps its own copy
328
+ jq .storage ~/.atomic/agent/settings.json > new-storage.json
329
+ atomic storage import ~/moved --storage-file new-storage.json
330
+ atomic intercom restart
331
+ ```
332
+
333
+ **To keep sessions on this machine**, remove the libSQL `storage` (and any libSQL `sessions.storage`) entries from `~/.atomic/agent/settings.json`, then import into default local SQLite:
334
+
335
+ ```bash
336
+ atomic storage import ~/moved
337
+ atomic intercom restart
338
+ ```
339
+ </Step>
340
+ <Step title="Verify and remove the old adapter">
341
+ Confirm `atomic storage status` shows the new store and `atomic -r` lists your project's sessions, then uninstall the retired adapter:
342
+
343
+ ```bash
344
+ atomic remove npm:@bastani/atomic-storage-libsql
345
+ ```
346
+ </Step>
347
+ </Steps>
348
+
349
+ Until you remove libSQL references (or legacy `ATOMIC_PROFILE` / `ATOMIC_TEAM_*` variables), Atomic exits with a `libsql-removed` configuration error pointing to this section.
317
350
 
318
- To move them to PostgreSQL, [set up the database](/storage/postgres#set-up-the-database), join it, and import into it by name. `atomic storage join` notes that it replaces the libSQL setting:
319
-
320
- ```bash
321
- (umask 077; printf 'Runtime password: '; read -rs password; printf '\n'; printf '%s' "$password" > ~/atomic-db-password)
322
- atomic storage join 'postgresql://atomic_runtime@db.example.com:5432/atomic' --password-file ~/atomic-db-password
323
- rm ~/atomic-db-password # atomic storage join keeps its own copy
324
- jq .storage ~/.atomic/agent/settings.json > new-storage.json
325
- atomic storage import ~/moved --storage-file new-storage.json
326
- atomic intercom restart
327
- ```
328
-
329
- To keep them on this machine instead, remove the libSQL `storage` setting, and any `sessions.storage` setting that points at libSQL, from `~/.atomic/agent/settings.json`. Then import them into the default local SQLite file:
330
-
331
- ```bash
332
- atomic storage import ~/moved
333
- atomic intercom restart
334
- ```
335
-
336
- Import prints what it did:
337
-
338
- ```text
339
- Imported 4 sessions from /home/me/moved/sessions (4 added, 0 updated, 0 already up to date).
340
- ```
341
-
342
- Running it again is safe. It then reports the sessions as `already up to date`.
343
-
344
- 4. **Check the result.** `atomic storage status` names the new store for sessions, and `atomic -r` in one of your projects lists that project's old sessions.
345
-
346
- 5. **Remove the libSQL adapter**, which the current release no longer uses:
347
-
348
- ```bash
349
- atomic remove npm:@bastani/atomic-storage-libsql
350
- ```
351
+ ## Size limits
351
352
 
352
- It prints `Removed npm:@bastani/atomic-storage-libsql` when it is done.
353
+ Long sessions, large pasted logs, inline images, and large worktree snapshots work across every store because Atomic splits large payloads into chunks automatically.
353
354
 
354
- Until you move off it, any setting, variable, or command that still names a libSQL database, or one of the removed `ATOMIC_PROFILE` and `ATOMIC_TEAM_*` variables, stops Atomic with a `libsql-removed` error that links to this section. For the `storage` setting it starts `Error: Invalid storage configuration: storage (libsql-removed).`
355
+ Search indexing limits differ by search surface:
355
356
 
356
- ## Size limits
357
+ - **`/resume` picker search** indexes up to **65,536 characters** (64K UTF-16 code units) per user or assistant message so session listings stay compact.
358
+ - **`history://` search** indexes entries up to **8,388,608 characters** (8M characters) across rendered content and scans any larger entry directly on demand.
357
359
 
358
- Long sessions, large pasted logs, inline images, and large worktree snapshots work in every store, because Atomic splits large data into smaller parts. Session search reads only the first 64 KiB of each message.
360
+ If a single database value still exceeds the backend's limit (~1 GB per value on local SQLite and PostgreSQL), the write fails with `StoragePayloadTooLargeError` (not retryable). Reduce the value size or raise the limit on a custom backend.
359
361
 
360
- A single value that still exceeds the store's limit fails with `StoragePayloadTooLargeError`, and retrying does not help. Local SQLite allows about 1 GB per value, and PostgreSQL about 1 GB per field. Store less in one value, or raise the limit of a custom backend.
362
+ For older local SQLite files that need offline snapshot chunk-table migration, see [Moving snapshot data in an old SQLite file](#moving-snapshot-data-in-an-old-sqlite-file).
361
363
 
362
364
  ## Upgrading older stores
363
365
 
364
- Some Atomic releases change how a store is laid out, and older releases cannot read the new layout. These changes are one-way:
366
+ Some Atomic releases perform one-way store layout upgrades that earlier versions cannot read:
365
367
 
366
- - **Large session entries.** The first session entry over 1 MiB that Atomic 0.9.88 or later saves upgrades the store. Releases before 0.9.88 then refuse it with `StorageSchemaVersionError`.
367
- - **Shared-history forks.** Atomic 0.10.11 and later upgrade a store for [shared-history forks](#shared-history-forks) once no earlier release has a session open on it. See [Older Atomic versions](#older-atomic-versions).
368
+ - **Large session entries:** Saving a session entry over 1 MiB on Atomic 0.9.88 or later upgrades the store; older releases then fail with `StorageSchemaVersionError`.
369
+ - **Shared-history forks:** Atomic 0.10.11+ upgrades stores for [shared-history forks](#shared-history-forks) once no earlier release has an open session on the store. See [Older Atomic versions](#older-atomic-versions).
368
370
 
369
- Upgrade every machine that shares a database at the same time.
371
+ Upgrade all machines sharing a database together.
370
372
 
371
373
  ### Moving snapshot data in an old SQLite file
372
374
 
373
- On older local SQLite files, Atomic moves worktree snapshot data, which it stores in parts called chunks, to a newer layout in the background when there is enough free disk space. To do it yourself, in batches that keep the database's log file small:
375
+ Earlier Atomic versions stored worktree snapshot chunks in an older table layout. On local SQLite files, Atomic migrates those chunks automatically in the background when enough free disk space is available.
374
376
 
375
- 1. Stop every Atomic process that uses the file.
376
- 2. Run:
377
+ If free disk space is tight (so the WAL file cannot hold a single-pass copy), or if SQLite refuses the automatic `ALTER TABLE RENAME` because of a custom view or trigger referencing the old chunk table, run the offline batched migration:
377
378
 
378
- ```bash
379
- atomic storage move-snapshot-chunks <sqlite-file> [--prefix <prefix>]
380
- ```
379
+ <Steps>
380
+ <Step title="Stop all Atomic processes using the SQLite file">
381
+ Ensure every session and Intercom broker targeting the database has closed cleanly so its `-wal` file is empty. If SQLite reported a view or trigger blocking the rename, drop or update that view/trigger first.
382
+ </Step>
383
+ <Step title="Run the batched chunk migration">
384
+ ```bash
385
+ atomic storage move-snapshot-chunks <sqlite-file> [--prefix <prefix>]
386
+ ```
381
387
 
382
- The file must be a local SQLite database in WAL mode, closed cleanly so its `-wal` file is empty, and without `auto_vacuum=FULL`. After a crash, never delete the `-wal` file by hand. Open the database with Atomic or SQLite first so SQLite can recover it. PostgreSQL needs no such step.
388
+ The file must be a local SQLite database in WAL mode without `auto_vacuum=FULL`. PostgreSQL databases do not need this step.
389
+ </Step>
390
+ </Steps>
383
391
 
384
- ## Shared-history forks
385
-
386
- When you fork a session, the new session starts with a copy of the conversation so far. In a SQLite or PostgreSQL store, the fork does not actually copy that history. It shares it with the session it came from, its parent, and stores only what is added after the fork. This applies to `/fork`, `/clone`, `atomic --fork`, and subagents started with `context: "fork"`.
387
-
388
- What this means for you:
392
+ <Warning>
393
+ After a crash, **never** delete a SQLite `-wal` file by hand—doing so can lose committed data or corrupt the database. Open the database with Atomic or SQLite first so WAL recovery completes cleanly.
394
+ </Warning>
389
395
 
390
- - **Forking is fast.** Forking a long session takes about as long as forking a short one.
391
- - **Forks take little space.** The store does not keep a second copy of the parent's history.
392
- - **There is almost nothing to set up.** On SQLite, Atomic does it by itself. On PostgreSQL, the owner runs `atomic storage migrate` once, as [Older Atomic versions](#older-atomic-versions) explains.
396
+ ## Shared-history forks
393
397
 
394
- A fork behaves exactly like a copy:
398
+ When you fork a session (`/fork`, `/clone`, `atomic --fork`, or a subagent with `context: "fork"`), SQLite and PostgreSQL stores do not duplicate the parent's history. The fork shares the parent's prior entries and stores only new entries added after the fork.
395
399
 
396
- - It shows the same entries, search results, tree, and history as a copy would.
397
- - It shows the parent's history only up to the moment it was forked. What the parent adds later stays in the parent.
398
- - Changing or deleting the parent never changes the fork. Before the parent's history changes, Atomic gives each fork its own copy of the part it uses. When you delete the parent, it disappears from lists and search at once, and Atomic keeps the part its forks use, out of sight, until no fork needs it.
399
- - Anything that takes a fork out of its store writes a full copy that does not depend on the parent: `/export`, `/share`, `atomic --export`, `atomic storage export`, and a fork into another store.
400
+ - **Fast and compact:** Forking a long session takes the same time as a short one and adds minimal storage overhead.
401
+ - **Zero setup on SQLite:** Handled automatically. On PostgreSQL, run `atomic storage migrate` once as the owner role (see [Older Atomic versions](#older-atomic-versions)).
402
+ - **Independent copy semantics:** A fork shows the parent's history up to the fork point only. Later edits or deletes on the parent never alter the fork—before modifying shared history, Atomic detaches affected parts for forks, and deleting a parent hides it immediately while retaining shared segments until no fork needs them.
403
+ - **Full copies on export:** Anything that exports a fork out of its store writes a self-contained copy: `/export`, `/share`, `atomic storage export`, and cross-store forks. (`atomic --export <file>` only converts an existing `.jsonl` file on disk to HTML and does not read SQLite or PostgreSQL stores.)
400
404
 
401
- JSONL directories and in-memory stores always copy.
405
+ JSONL directories and in-memory stores always write full copies on fork.
402
406
 
403
407
  ### Older Atomic versions {#older-atomic-versions}
404
408
 
405
- Shared-history forks start with Atomic 0.10.11, and its prerelease 0.10.11-alpha.2. Earlier releases cannot read a store that uses them, so Atomic upgrades the store once, and from then on earlier releases refuse to open it:
406
-
407
- ```text
408
- Unsupported sessions storage schema version 3: this store needs a newer Atomic. Update Atomic before reopening it.
409
- ```
410
-
411
- When the upgrade happens:
412
-
413
- - Atomic upgrades a store when it opens it and no earlier release has a session open on it, on any machine. Until then, forks are full copies, and the earlier release keeps working.
414
- - A session on another machine counts as open while that machine is running it. If the machine crashed, its sessions stop counting after about a minute.
415
- - On PostgreSQL, the runtime role cannot create the tables that shared forks need. Forks stay full copies until the owner runs `atomic storage migrate`, which upgrades the database. Atomic shows no error either way.
416
-
417
- What to do:
409
+ Shared-history forks require Atomic 0.10.11 (or `0.10.11-alpha.2`) or newer. Once a store upgrades, earlier releases refuse to open it with `Unsupported sessions storage schema version 3`.
418
410
 
419
- 1. Upgrade every machine that uses a shared database to 0.10.11 or later.
420
- 2. On PostgreSQL, run `atomic storage migrate` as the owner role.
411
+ - Atomic upgrades a store automatically on open once no earlier release has an active session on it across any machine (crashed sessions expire after about a minute). Until then, forks remain full copies so older releases continue working.
412
+ - On PostgreSQL, the least-privilege runtime role cannot create the shared-fork tables. Forks stay full copies without error until the owner runs `atomic storage migrate`.
421
413
 
422
- To take sessions back to an earlier release after the upgrade, export them with `atomic storage export`, which writes each fork in full, and import them with that release into a new store. With [debug mode](/development#debugging) on, Atomic writes to the debug log when it puts the upgrade off, and why.
414
+ To upgrade cleanly: upgrade every machine sharing the database to 0.10.11+, then run `atomic storage migrate` as the owner role on PostgreSQL. To move sessions back to an earlier release after an upgrade, run `atomic storage export` (which writes full copies) and import them into a fresh store with the older release. With [debug mode](/development#debugging) enabled, Atomic logs why an upgrade was deferred.
423
415
 
424
416
  ## Workflow data from earlier releases
425
417
 
426
- Releases before 0.10.0 kept workflow runs under `workflows/journal/`, `workflows/pool/`, `workflows/runs/`, and in tables named `wf_*`. Atomic no longer runs those workflows. It never opens, changes, or deletes their data, so you can downgrade without losing old runs.
418
+ Releases before 0.10.0 stored workflow runs under `workflows/journal/`, `workflows/pool/`, `workflows/runs/`, and `wf_*` tables. Atomic no longer runs those workflows and leaves their data untouched so downgrading remains safe:
427
419
 
428
- - `atomic storage status`, `migrate`, `export`, and `import` handle sessions and Intercom only. On PostgreSQL, `atomic storage migrate` still moves existing `wf_*` tables from `public` to `atomic`, so one database does not end up split across two schemas.
429
- - `atomic storage adopt`, `atomic storage consolidate`, and the `--workflows`, `--run`, and `--unfinished` flags were removed.
430
- - Cleaning up old worktree snapshots still keeps the snapshots that old workflow runs refer to.
431
- - `ATOMIC_WORKFLOWS_JOURNAL`, `ATOMIC_WORKFLOW_JOURNAL_PATH`, `workflows.journal`, and `createAgentSession({ journal })` no longer choose a store.
420
+ - `atomic storage status`, `migrate`, `export`, and `import` operate on sessions and Intercom only. On PostgreSQL, `atomic storage migrate` still moves existing `wf_*` tables from `public` to `atomic` so a database is not split across schemas.
421
+ - Worktree snapshot garbage collection continues preserving snapshots referenced by old workflow runs.
422
+ - `atomic storage adopt`, `consolidate`, `--workflows`, `--run`, `--unfinished`, `ATOMIC_WORKFLOWS_JOURNAL`, `ATOMIC_WORKFLOW_JOURNAL_PATH`, `workflows.journal`, and `createAgentSession({ journal })` no longer select a store.
432
423
 
433
- To run an older workflow definition with this release, see [Migrating workflows](/orchestration/migrating-workflows).
424
+ To migrate legacy workflow definitions, see [Migrating workflows](/orchestration/migrating-workflows).
434
425
 
435
426
  ## Storage errors
436
427
 
437
- This section lists the errors Atomic's storage can raise, for people reading error output and for SDK apps that handle them. In code, check the error class, its `code`, and its fields, not the message text. The classes are exported from `@bastani/atomic/storage`.
428
+ This reference covers the typed errors Atomic raises from storage operations. In code, inspect the error class, `code`, and structured fields rather than matching message text. Unless noted otherwise, classes are exported from `@bastani/atomic/storage` (and re-exported from `@bastani/atomic`).
438
429
 
439
430
  ### Common errors
440
431
 
441
432
  | Error | What it means | What to do |
442
433
  | --- | --- | --- |
443
- | `StorageConfigError` | A storage setting, flag, or variable is invalid. Fields: `code: "invalid-config"`, `source`, `field`, `reason`, and optional `hint`. | Fix the option named in `field`. Atomic does not fall back to another store. |
444
- | `StorageConfigError` with reason `libsql-removed` | A setting, variable, or command names a libSQL or Turso database. | Move your sessions as in [Moving off libSQL](#moving-off-libsql). |
445
- | `StorageAdapterLoadError` | An adapter could not be loaded. Fields: `module`, `cause`. | Check that the adapter package is installed and has a default export. |
446
- | `StorageUnavailableError` | The store could not be reached or opened. Fields: `adapter`, `location`, `cause`. | Restore access to the store, then retry. |
447
- | `StoragePrefixError` | The `prefix` is not allowed. Fields: `prefix`, `reason`, which is `pattern`, `reserved`, `too-long` with `maxLength`, `identifier-collision` with `identifier`, or `uppercase` on PostgreSQL. | Use another prefix. On PostgreSQL, use at most 24 lowercase characters. |
448
- | `StorageSchemaVersionError` | The store was upgraded by a newer Atomic. Fields: `domain`, which is `sessions` or `intercom`, `found`, `supported`. | Upgrade Atomic. See [Upgrading older stores](#upgrading-older-stores). |
449
- | `StoragePayloadTooLargeError` | One value is larger than the store allows. Fields: `code: "payload-too-large"`, `kind` (`value` or `response`), `limitBytes`, `actualBytes`, `adapter`, `location`, `retryable: false`, `hint`, `cause`. | Do not retry. Store less in one value. See [Size limits](#size-limits). |
450
- | `StorageTransientError` | A temporary server or network failure ended a call. Codes: `stream-expired`, `transaction-timeout`, `connection-refused`, `connection-lost`, `lock-conflict`, `read-only-server`. Fields: `adapter`, `location`, `outcome`, `attempts`, `retryable: true`, `cause`, and optional `hop` and `hopFailure`. Atomic has already retried up to 5 times if nothing was written. | Check the connection to the server, or the `hop` named in the error, then retry. If `outcome` is `unknown`, the write may have happened, so read the data back before you repeat a write. |
451
- | `StorageOutcomeUnknownError` | The driver could not confirm whether a write happened. Fields: `domain`, `id`, `key`. | Read the record back before you retry. |
434
+ | `StorageConfigError` | Invalid storage setting, flag, or environment variable (`code: "invalid-config"`, `source`, `field`, `reason`, optional `hint`). | Fix the option named in `field`. Atomic never falls back to another store. |
435
+ | `StorageConfigError` (`libsql-removed`) | A setting, variable, or command references libSQL, Turso, or removed team-profile variables. | Follow [Moving off libSQL](#moving-off-libsql). |
436
+ | `StorageAdapterLoadError` | Adapter module failed to load (`module`, `cause`). | Check that the adapter package is installed and has a default export. |
437
+ | `StorageUnavailableError` | Store could not be reached or opened (`adapter`, `location`, `cause`). | Restore connectivity or file access, then retry. |
438
+ | `StoragePrefixError` | Invalid `prefix` (`prefix`, `reason`: `pattern`, `reserved`, `too-long` with `maxLength`, `identifier-collision` with `identifier`, or `uppercase` on PostgreSQL). | Choose a valid prefix (at most 24 lowercase characters on PostgreSQL). |
439
+ | `StorageSchemaVersionError` | Store was upgraded by a newer Atomic release (`domain`: `sessions` \| `intercom`, `found`, `supported`). | Upgrade Atomic. See [Upgrading older stores](#upgrading-older-stores). |
440
+ | `StoragePayloadTooLargeError` | Value or response exceeded backend limits (`code: "payload-too-large"`, `kind`: `value` \| `response`, `limitBytes`, `actualBytes`, `adapter`, `location`, `retryable: false`, `hint`, `cause`). | Do not retry. Reduce value size or raise custom backend limits. See [Size limits](#size-limits). |
441
+ | `StorageTransientError` | Temporary network, lock, or server failure (`code`: `stream-expired`, `transaction-timeout`, `connection-refused`, `connection-lost`, `lock-conflict`, `read-only-server`; fields: `adapter`, `location`, `outcome`, `attempts`, `retryable: true`, `cause`, optional `hop` and `hopFailure`). Atomic makes up to 5 total attempts (1 initial attempt plus up to 4 retries) if nothing was written. | Check server or proxy (`hop`) health and retry. If `outcome` is `"unknown"`, read state back before repeating a write. |
442
+ | `StorageOutcomeUnknownError` | Driver could not confirm whether a write committed (`domain`, `id`, `key`). | Read the record back before retrying. |
443
+ | `StorageTransferError` | Export or import failed before writing anything (`path`, optional `line`, `id`, `reason`, `cause`). Exported from `@bastani/atomic`. | Fix the reported file or line and re-run export/import. |
444
+ | `StorageImportIncompleteError` | Import failed after writing some sessions (`written`, `notWritten`, `cause`). Exported from `@bastani/atomic`. | Fix the underlying storage error and re-run `atomic storage import` to finish remaining sessions. |
452
445
 
453
446
  ### Session errors
454
447
 
455
448
  | Error | Code | What it means | What to do |
456
449
  | --- | --- | --- | --- |
457
- | `SessionBlobError` | `blobs-unsupported` | The session store cannot hold tool output files, which an import, fork, branch, or `tool-output://` read needs. Fields: `sessionId`, `adapter`. | Use SQLite or PostgreSQL, or implement `putBlob` and `getBlob` in your custom store. |
458
- | `SessionBlobError` | `blob-missing` | A `tool-output://<sha256>` file is missing. Copies, forks, and exports continue without it and warn. Fields: `sessionId`, `hash`, optional `missing` count. | Run the tool again to recreate the output. |
459
- | `SessionBlobError` | `blob-incomplete` | Part of a tool output file is missing. Fields: `sessionId`, `hash`, `bytes`. | Run the tool again to recreate the output. |
460
- | `SessionBlobError` | `blob-corrupt` | An imported tool output failed its SHA-256 check. Nothing was written. Fields: `sessionId`, `hash`, `actualHash`. | Export the session again from its source. |
461
- | `SessionSpillError` | `spill-read-failed` | An in-memory store moves the older history of idle sessions to temporary files in the `released-history` folder of the agent directory. It could not read one of them. Retryable for `EMFILE`, `ENFILE`, `EAGAIN`, `EBUSY`, and `EINTR`. Fields: `directory`, `sessionId`, `bytes`, `errno`, `cause`. | Check the directory's permissions and the open-file limit, then reopen the session. |
462
- | `SessionSpillError` | `spill-missing`, `spill-corrupt` | That temporary file is missing, cut short, or damaged. The history in it is lost, and session lists leave the session out. | Leave `released-history` alone while Atomic runs, or use a persistent store. |
463
- | `SessionSpillError` | `spill-write-failed`, `spill-dir-refused`, `spill-cleanup-failed` | Atomic could not write or clean up that temporary file. It warns once and keeps the history in memory. Never thrown. | Free disk space, or make the agent directory writable. |
450
+ | `SessionBlobError` | `blobs-unsupported` | Store cannot hold tool output files needed by import, fork, branch, or `tool-output://` reads (`sessionId`, `adapter`). | Use SQLite or PostgreSQL, or implement `putBlob`/`getBlob` in a custom store. |
451
+ | `SessionBlobError` | `blob-missing` | A `tool-output://<sha256>` file is missing. Copies, forks, and exports continue with a warning (`sessionId`, `hash`, optional `missing`). | Re-run the tool to regenerate output. |
452
+ | `SessionBlobError` | `blob-incomplete` | Part of a stored tool output file is missing (`sessionId`, `hash`, `bytes`). | Re-run the tool to regenerate output. |
453
+ | `SessionBlobError` | `blob-corrupt` | Imported tool output failed its SHA-256 check; nothing was written (`sessionId`, `hash`, `actualHash`). | Re-export the session from its source store. |
454
+ | `SessionSpillError` | `spill-read-failed` | An in-memory store failed to read released session history spilled under `<agentDir>/released-history` (`directory`, `sessionId`, `bytes`, `errno`, `cause`). Retryable for `EMFILE`, `ENFILE`, `EAGAIN`, `EBUSY`, `EINTR`. | Check permissions and open-file limits, then reopen the session. |
455
+ | `SessionSpillError` | `spill-missing`, `spill-corrupt` | Spilled history file is missing, truncated, or corrupt. That history is lost and the session is omitted from lists. | Leave `released-history` untouched while Atomic runs, or use a persistent store. |
456
+ | `SessionSpillError` | `spill-write-failed`, `spill-dir-refused`, `spill-cleanup-failed` | Spilling or cleanup failed; Atomic warns once and keeps history in memory. Never thrown. | Free disk space or make the agent directory writable. |
464
457
 
465
- Other session errors: `SessionNotFoundError` (`sessionId`), `SessionExistsError` (`sessionId`), `SessionIdMismatchError` (`requested`, `found`), `SessionConflictError` (`sessionId`, `expectedSeq`, `actualSeq`), `SessionFormatVersionError` (`path`, `found`, `supported`), `SessionInvalidTextError` (`field`, `reason`), `SessionInvalidTimestampError` (`field`, `reason`, `value`), and `JsonlStoragePoisonedError` (`location`, `cause`, `rollbackCause`). After a `SessionConflictError`, another process wrote to the session first. Reopen the session before you write again.
458
+ Other session errors: `SessionNotFoundError` (`sessionId`), `SessionExistsError` (`sessionId`), `SessionIdMismatchError` (`requested`, `found`), `SessionConflictError` (`sessionId`, `expectedSeq`, `actualSeq`), `SessionFormatVersionError` (`path`, `found`, `supported`), `SessionInvalidTextError` (`field`, `reason`), `SessionInvalidTimestampError` (`field`, `reason`, `value`), and `JsonlStoragePoisonedError` (`location`, `cause`, `rollbackCause`). After `SessionConflictError`, another process wrote first—reopen the session before writing again.
466
459
 
467
- **When a running session cannot save.** Atomic prints `could not persist the <role> message: <cause>` once and stops that run. It starts no further model requests, tool calls, retries, or compaction. Print and JSON modes print the error on stderr and exit `1`. Print mode still prints the answer it received. Interactive mode shows the error, stays open, and tries to save again on your next prompt.
460
+ <Note>
461
+ **When a running session cannot save:** Atomic prints `could not persist the <role> message: <cause>` once and halts that run (no further model calls, tool calls, retries, or compaction). Print and JSON modes write the error to stderr and exit `1` (print mode still outputs the received answer). Interactive mode displays the error, stays open, and retries saving on your next prompt.
462
+ </Note>
468
463
 
469
464
  ### Database handle errors
470
465
 
471
- These come from the database handles that SDK apps open directly. The first four come from local SQLite files only. See [Local SQLite](/storage/sqlite#sdk-and-local-sqlite-api).
466
+ Raised by direct `SqliteDatabase` handles opened in SDK applications. The first four apply to local SQLite handles only (see [SDK and local SQLite API](/storage/sqlite#sdk-and-local-sqlite-api)).
472
467
 
473
468
  | Error | Code | What it means | What to do |
474
469
  | --- | --- | --- | --- |
475
- | `StorageWriteLockTimeoutError` | `write-lock-timeout` | A write waited `lockWaitMs` for another process to finish writing, and nothing committed in that time. Nothing ran. Fields: `adapter`, `location`, `timeoutMs`, `elapsedMs`, `phase`, the holder's `holderPid` and `holderHeldMs` or `holderCandidates`, `retryable: true`, `cause`. | Check the process that holds the lock, or raise `lockWaitMs`, then retry. |
476
- | `StorageWriterQueueUnusableError` | `writer-queue-unusable` | A write could not use the queue directories next to the database file, which line writers up between processes. Nothing ran. Fields: `adapter`, `location`, `errno`, `cause`. | Make the database's directory and the queue directories readable and writable for every user that writes. |
477
- | `StorageWriterQueueDegradedError` | `writer-queue-degraded` | Writes still work, but the queue had a problem: `watch-unavailable`, `wake-failed`, `stale-ticket-kept`, or `holder-record-unavailable`. Atomic warns once per reason. Never thrown. | Raise the file-watch limit, fix the queue directories' permissions, or remove abandoned queue entries. |
478
- | `StorageUnsupportedOperationError` | `unsupported-operation` | `getWriterQueueStats` or `getWriterQueueDegradation` got a handle that is not a local SQLite handle. Fields: `operation`, `adapter`, `location`. | Pass a handle from `openNodeSqliteDatabase` or `wrapNodeSqliteDatabase`. |
479
- | `StorageInvalidTextError` | | A text value contains the character U+0000. Fields: `parameterIndex`, `reason`. | Remove U+0000, or store the value as JSON or binary. |
480
- | `StoreClosedError`, `StorageTransactionClosedError` | | The store is closed, or a transaction's callback has already finished. | Open a new store, or use the handle passed to the active callback. |
481
- | `StorageRollbackError` | | A rollback failed after an error. Fields: `cause`, `rollbackCause`. | Do not assume the transaction rolled back. |
470
+ | `StorageWriteLockTimeoutError` | `write-lock-timeout` | A write waited `lockWaitMs` with no commit occurring; nothing ran (`adapter`, `location`, `timeoutMs`, `elapsedMs`, `phase`, `holderPid`, `holderHeldMs` or `holderCandidates`, `retryable: true`, `cause`). | Inspect the holding process or raise `lockWaitMs`, then retry. |
471
+ | `StorageWriterQueueUnusableError` | `writer-queue-unusable` | Cross-process queue directories next to the SQLite file (`<file>-writers`, `<file>-wakes`) were inaccessible; nothing ran (`adapter`, `location`, `errno`, `cause`). | Ensure the database directory and queue directories are readable and writable for every writer user. |
472
+ | `StorageWriterQueueDegradedError` | `writer-queue-degraded` | Writes continue, but queue coordination degraded (`watch-unavailable`, `wake-failed`, `stale-ticket-kept`, `holder-record-unavailable`). Logged once per reason; never thrown. | Raise the OS file-watch limit, fix queue permissions, or clean abandoned queue entries. |
473
+ | `StorageUnsupportedOperationError` | `unsupported-operation` | `getWriterQueueStats` or `getWriterQueueDegradation` was called on a non-local-SQLite handle (`operation`, `adapter`, `location`). | Pass a handle from `openNodeSqliteDatabase` or `wrapNodeSqliteDatabase`. |
474
+ | `StorageInvalidTextError` | — | A text binding contains U+0000 (`parameterIndex`, `reason`). | Strip U+0000, or store the value as JSON or binary (`Uint8Array`). |
475
+ | `StoreClosedError`, `StorageTransactionClosedError` | — | Store is closed, or a transaction handle was used after its callback settled. | Open a new store, or use only the active callback's transaction handle. |
476
+ | `StorageRollbackError` | — | Rollback failed after a transaction error (`cause`, `rollbackCause`). | Do not assume the transaction rolled back cleanly. |
482
477
 
483
478
  ### Handling errors in code
484
479
 
485
- - **Checks that work across processes.** `isStorageConfigError`, `isStorageWriteLockTimeoutError`, `isStorageUnsupportedOperationError`, `isStorageWriterQueueDegradedError`, `isStorageWriterQueueUnusableError`, `isStorageTransientError`, `isSessionBlobError`, and `isSessionSpillError` test for each coded error. `STORAGE_TRANSIENT_ERROR_CODES`, `SESSION_BLOB_ERROR_CODES`, and `SESSION_SPILL_ERROR_CODES` list the codes. `isStorageError(error)` matches any storage error.
486
- - **Errors wrapped in others.** `findStorageWriteLockTimeoutError(error)` and `isRetryableStorageError(error)` look through up to 8 levels of `cause`.
487
- - **Passing errors between processes.** `serializeStorageError(error)` and `rehydrateStorageError(json)` keep the class, fields, and `cause`, `rollbackCause`, and `cleanupCause`. An error class this release does not know comes back as `StorageError`, with its `name`, `code`, and fields.
488
- - **Cancelling.** Session listings accept an `AbortSignal`. When it fires, they reject with the signal's own `reason`, such as an `AbortError`.
480
+ - **Cross-process type guards:** `isStorageConfigError`, `isStorageWriteLockTimeoutError`, `isStorageUnsupportedOperationError`, `isStorageWriterQueueDegradedError`, `isStorageWriterQueueUnusableError`, `isStorageTransientError`, `isSessionBlobError`, `isSessionSpillError`, and `isStorageError`. Code lists: `STORAGE_TRANSIENT_ERROR_CODES`, `SESSION_BLOB_ERROR_CODES`, and `SESSION_SPILL_ERROR_CODES`.
481
+ - **Cause-chain inspection:** `findStorageWriteLockTimeoutError(error)` and `isRetryableStorageError(error)` inspect up to 8 levels of `cause`.
482
+ - **Cross-process serialization:** `serializeStorageError(error)` and `rehydrateStorageError(json)` preserve class, fields, `cause`, `rollbackCause`, and `cleanupCause`. Unknown subclasses rehydrate as `StorageError` retaining `name`, `code`, and fields.
483
+ - **Cancellation:** Session listings accept an `AbortSignal` and reject with the signal's `reason` (such as `AbortError`).
489
484
 
490
485
  ### Errors from `atomic storage join` {#team-setup-errors}
491
486
 
492
- `atomic storage join` and `atomic storage migrate --db` raise these errors, and so do [`atomic team status`](/guides/team-setup), the SDK's `getTeamProfile()`, and Atomic's refusal of a removed libSQL selection or team variable. `TeamProfileConfigError` means an input was invalid, and nothing changed. Error messages name variables, flags, and files, never a password or token.
487
+ `atomic storage join`, `atomic storage migrate --db`, [`atomic team status`](/guides/team-setup), and the SDK's `getTeamProfile()` raise `TeamProfileConfigError` (invalid inputs; nothing changed) or `TeamProfileError` (runtime failure after inputs validated). Error messages name variables, flags, and file paths, never credentials.
493
488
 
494
489
  | `TeamProfileConfigError` code | When |
495
490
  | --- | --- |
496
- | `libsql-removed` | The URL is a libSQL one, the command is `atomic team join` or `atomic team leave`, or a variable of the removed CI team profile is set: `ATOMIC_PROFILE`, `ATOMIC_TEAM_URL`, `ATOMIC_TEAM_TOKEN`, `ATOMIC_TEAM_TOKEN_FILE`, or `ATOMIC_TEAM_PREFIX`. See [Moving off libSQL](#moving-off-libsql). |
497
- | `unsupported-url` | The URL is not `postgres://` or `postgresql://`. |
498
- | `credential-in-url` | The URL contains a password. |
499
- | `missing-token` | None of `--password-file`, `--token-file`, and `--auth` was given. |
500
- | `conflicting-token` | More than one of `--password-file`, `--token-file`, and `--auth` was given. |
501
- | `unsupported-auth` | `--auth` names something other than `azure`, `aws`, or `gcp`. |
502
- | `unreadable-token-file` | The password or token file cannot be read. `path` names it. |
503
- | `empty-token` | The password or token file is empty. |
504
- | `invalid-prefix` | The prefix breaks the [prefix rules](/storage/postgres#share-one-database-between-teams). |
505
- | `unknown-command`, `unknown-option`, `unexpected-argument` | Invalid `atomic team` arguments. |
506
-
507
- `TeamProfileError` means the operation failed after its inputs passed. Fields: `code`, `subject`, `hint`, `retryable`, and optional `detail` and `cause`.
508
-
509
- | Code | When | What to do |
491
+ | `libsql-removed` | A libSQL URL is passed, `atomic team join`/`leave` is invoked, or legacy team variables (`ATOMIC_PROFILE`, `ATOMIC_TEAM_URL`, `ATOMIC_TEAM_TOKEN`, `ATOMIC_TEAM_TOKEN_FILE`, `ATOMIC_TEAM_PREFIX`) are set. See [Moving off libSQL](#moving-off-libsql). |
492
+ | `unsupported-url` | URL does not start with `postgres://` or `postgresql://`. |
493
+ | `credential-in-url` | URL embeds a password. |
494
+ | `missing-token` | None of `--password-file`, `--token-file`, or `--auth` was provided. |
495
+ | `conflicting-token` | More than one of `--password-file`, `--token-file`, and `--auth` was provided. |
496
+ | `unsupported-auth` | `--auth` is not `azure`, `aws`, or `gcp` (or their long forms). |
497
+ | `unreadable-token-file` | Password or token file cannot be read (`path` names it). |
498
+ | `empty-token` | Password or token file is empty. |
499
+ | `invalid-prefix` | Prefix breaks PostgreSQL [prefix rules](/storage/postgres#share-one-database-between-teams). |
500
+ | `unknown-command`, `unknown-option`, `unexpected-argument` | Invalid `atomic team` CLI arguments. |
501
+
502
+ `TeamProfileError` carries `code`, `subject`, `hint`, `retryable`, and optional `detail` and `cause`:
503
+
504
+ | `TeamProfileError` code | When | What to do |
510
505
  | --- | --- | --- |
511
- | `settings-unreadable` | The settings file cannot be read or parsed. `subject` names it. Nothing changed. | Fix the settings file and run the command again. |
512
- | `adapter-not-installed` | The PostgreSQL adapter cannot be loaded. Nothing changed. | Run `atomic install npm:@bastani/atomic-storage-postgres`. |
513
- | `connection-failed` | The database refused the connection, or `SELECT 1` failed. Nothing changed. Retryable. | Check the URL, the credentials, and the network, then retry. |
514
- | `connection-timeout` | The database did not answer within 15 seconds. Raised as `TeamProfileTimeoutError`. Nothing changed. Retryable. | Check that the database is reachable, then retry. |
515
- | `token-write-failed` | The private password file could not be written. Nothing changed. | Make the agent directory writable. |
516
- | `settings-write-failed` | The settings could not be written. The previous setting and password file are kept. | Make the settings file writable, or free disk space. |
517
- | `settings-locked` | Another process held the settings lock. Nothing changed. Retryable. | Retry after a few seconds. A stale lock expires after 10 seconds. |
518
-
519
- In code, `isTeamProfileError()`, `isTeamProfileTimeoutError()`, and `isTeamProfileConfigError()` check these errors across processes, and `isRetryableTeamProfileError()` looks through up to 8 levels of `cause`. `serializeTeamError(error)` and `rehydrateTeamError(json)` pass them between processes without the credentials. `POSTGRES_STORAGE_JOIN_HINT` holds the hint text `atomic storage join <postgres-url> --password-file <path>`.
506
+ | `settings-unreadable` | Settings file (`subject`) cannot be read or parsed. Nothing changed. | Fix the settings file and retry. |
507
+ | `adapter-not-installed` | `@bastani/atomic-storage-postgres` cannot be loaded. Nothing changed. | Run `atomic install npm:@bastani/atomic-storage-postgres`. |
508
+ | `auth-unavailable` | Cloud IAM sign-in failed during `--auth` (missing cloud SDK library or unavailable identity). Nothing changed. Not retryable. | Install the cloud library named in the error and check the machine's cloud identity. |
509
+ | `connection-failed` | Server refused the connection or `SELECT 1` failed. Nothing changed. Retryable. | Check the URL, credentials, and network, then retry. |
510
+ | `connection-timeout` | Server did not answer within 15 seconds (thrown as `TeamProfileTimeoutError`). Nothing changed. Retryable. | Verify database reachability, then retry. |
511
+ | `token-write-failed` | Private password file could not be written in the agent directory. Nothing changed. | Make the agent directory writable. |
512
+ | `settings-write-failed` | Settings could not be saved; previous setting and password file stay intact. | Make the settings file writable or free disk space. |
513
+ | `settings-locked` | Another process held the settings lock. Nothing changed. Retryable. | Retry after a few seconds (stale locks expire after 10 seconds). |
514
+
515
+ In code, check these across processes with `isTeamProfileError()`, `isTeamProfileTimeoutError()`, `isTeamProfileConfigError()`, and `isRetryableTeamProfileError()` (walks up to 8 levels of `cause`). Use `serializeTeamError(error)` and `rehydrateTeamError(json)` to pass them across processes without credentials. `POSTGRES_STORAGE_JOIN_HINT` holds `atomic storage join <postgres-url> --password-file <path>`.