@bastani/atomic 0.9.38-alpha.5 → 0.9.38-alpha.7

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 (484) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/README.md +8 -6
  3. package/dist/builtin/intercom/CHANGELOG.md +9 -0
  4. package/dist/builtin/intercom/broker/broker.ts +6 -4
  5. package/dist/builtin/intercom/broker/delivered-message-cache.ts +50 -4
  6. package/dist/builtin/intercom/broker/send-handler.ts +6 -4
  7. package/dist/builtin/intercom/index.bundle.mjs +78 -33
  8. package/dist/builtin/intercom/package.json +2 -2
  9. package/dist/builtin/mcp/package.json +1 -1
  10. package/dist/builtin/subagents/CHANGELOG.md +6 -0
  11. package/dist/builtin/subagents/package.json +3 -3
  12. package/dist/builtin/subagents/src/extension/index.bundle.mjs +140 -145
  13. package/dist/builtin/web-access/CHANGELOG.md +7 -0
  14. package/dist/builtin/web-access/index.bundle.mjs +53 -15
  15. package/dist/builtin/web-access/package.json +2 -2
  16. package/dist/builtin/workflows/CHANGELOG.md +48 -0
  17. package/dist/builtin/workflows/builtin/{chunk-q7dx7kh7.js → chunk-85mx6wcf.js} +6 -6
  18. package/dist/builtin/workflows/builtin/{chunk-xg7kkgf8.js → chunk-8kkv04hz.js} +15 -15
  19. package/dist/builtin/workflows/builtin/{chunk-na3wpwzh.js → chunk-8x61e0s7.js} +396 -363
  20. package/dist/builtin/workflows/builtin/{chunk-qrrkfg9v.js → chunk-y45tkftg.js} +7 -7
  21. package/dist/builtin/workflows/builtin/goal.js +2 -2
  22. package/dist/builtin/workflows/builtin/index.js +4 -4
  23. package/dist/builtin/workflows/builtin/open-claude-design.js +1 -1
  24. package/dist/builtin/workflows/builtin/ralph.js +2 -2
  25. package/dist/builtin/workflows/package.json +2 -2
  26. package/dist/builtin/workflows/src/authoring.d.ts +3 -8
  27. package/dist/builtin/workflows/src/durable/journal/conformance.d.ts +9 -1
  28. package/dist/builtin/workflows/src/durable/journal/internal.d.ts +1 -0
  29. package/dist/builtin/workflows/src/durable/journal/lease-expiry.d.ts +2 -0
  30. package/dist/builtin/workflows/src/durable/journal/memory-run-journal.d.ts +9 -1
  31. package/dist/builtin/workflows/src/durable/journal/resolution.d.ts +19 -8
  32. package/dist/builtin/workflows/src/durable/journal/sql-run-journal.d.ts +45 -0
  33. package/dist/builtin/workflows/src/durable/journal/sqlite-run-journal.d.ts +5 -47
  34. package/dist/builtin/workflows/src/durable/journal/types.d.ts +9 -114
  35. package/dist/builtin/workflows/src/durable/journal/values.d.ts +2 -0
  36. package/dist/builtin/workflows/src/extension/index.bundle.mjs +6963 -6181
  37. package/dist/builtin/workflows/src/index.js +9078 -8395
  38. package/dist/builtin/workflows/src/shared/authoring-contract-stage.d.ts +8 -8
  39. package/dist/builtin/workflows/src/shared/authoring-contract-ui.d.ts +0 -14
  40. package/dist/cli/args.d.ts +3 -0
  41. package/dist/cli/args.d.ts.map +1 -1
  42. package/dist/cli/args.js +35 -5
  43. package/dist/cli/args.js.map +1 -1
  44. package/dist/cli/session-picker.d.ts +2 -2
  45. package/dist/cli/session-picker.d.ts.map +1 -1
  46. package/dist/cli/session-picker.js +5 -5
  47. package/dist/cli/session-picker.js.map +1 -1
  48. package/dist/core/agent-session-auto-compaction.d.ts +1 -1
  49. package/dist/core/agent-session-auto-compaction.d.ts.map +1 -1
  50. package/dist/core/agent-session-auto-compaction.js +2 -2
  51. package/dist/core/agent-session-auto-compaction.js.map +1 -1
  52. package/dist/core/agent-session-bash.d.ts +2 -3
  53. package/dist/core/agent-session-bash.d.ts.map +1 -1
  54. package/dist/core/agent-session-bash.js +18 -10
  55. package/dist/core/agent-session-bash.js.map +1 -1
  56. package/dist/core/agent-session-boundaries.d.ts +6 -6
  57. package/dist/core/agent-session-boundaries.d.ts.map +1 -1
  58. package/dist/core/agent-session-boundaries.js +22 -22
  59. package/dist/core/agent-session-boundaries.js.map +1 -1
  60. package/dist/core/agent-session-compaction.js +2 -2
  61. package/dist/core/agent-session-compaction.js.map +1 -1
  62. package/dist/core/agent-session-custom-message-commit.d.ts.map +1 -1
  63. package/dist/core/agent-session-custom-message-commit.js +10 -12
  64. package/dist/core/agent-session-custom-message-commit.js.map +1 -1
  65. package/dist/core/agent-session-events.d.ts.map +1 -1
  66. package/dist/core/agent-session-events.js +26 -14
  67. package/dist/core/agent-session-events.js.map +1 -1
  68. package/dist/core/agent-session-export.js +1 -1
  69. package/dist/core/agent-session-export.js.map +1 -1
  70. package/dist/core/agent-session-extension-bindings.d.ts +2 -2
  71. package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
  72. package/dist/core/agent-session-extension-bindings.js +75 -59
  73. package/dist/core/agent-session-extension-bindings.js.map +1 -1
  74. package/dist/core/agent-session-message-queue.d.ts +2 -2
  75. package/dist/core/agent-session-message-queue.d.ts.map +1 -1
  76. package/dist/core/agent-session-message-queue.js +17 -8
  77. package/dist/core/agent-session-message-queue.js.map +1 -1
  78. package/dist/core/agent-session-methods.d.ts +15 -15
  79. package/dist/core/agent-session-methods.d.ts.map +1 -1
  80. package/dist/core/agent-session-methods.js.map +1 -1
  81. package/dist/core/agent-session-models.d.ts +2 -2
  82. package/dist/core/agent-session-models.d.ts.map +1 -1
  83. package/dist/core/agent-session-models.js +59 -42
  84. package/dist/core/agent-session-models.js.map +1 -1
  85. package/dist/core/agent-session-persistent-custom-messages.d.ts +4 -4
  86. package/dist/core/agent-session-persistent-custom-messages.d.ts.map +1 -1
  87. package/dist/core/agent-session-persistent-custom-messages.js +16 -17
  88. package/dist/core/agent-session-persistent-custom-messages.js.map +1 -1
  89. package/dist/core/agent-session-prompt.d.ts.map +1 -1
  90. package/dist/core/agent-session-prompt.js +6 -8
  91. package/dist/core/agent-session-prompt.js.map +1 -1
  92. package/dist/core/agent-session-retry.d.ts.map +1 -1
  93. package/dist/core/agent-session-retry.js +17 -15
  94. package/dist/core/agent-session-retry.js.map +1 -1
  95. package/dist/core/agent-session-runtime.d.ts +7 -8
  96. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  97. package/dist/core/agent-session-runtime.js +88 -100
  98. package/dist/core/agent-session-runtime.js.map +1 -1
  99. package/dist/core/agent-session-services.d.ts +1 -1
  100. package/dist/core/agent-session-services.d.ts.map +1 -1
  101. package/dist/core/agent-session-services.js +2 -2
  102. package/dist/core/agent-session-services.js.map +1 -1
  103. package/dist/core/agent-session-summary.js +1 -1
  104. package/dist/core/agent-session-summary.js.map +1 -1
  105. package/dist/core/agent-session-tree.d.ts +1 -1
  106. package/dist/core/agent-session-tree.d.ts.map +1 -1
  107. package/dist/core/agent-session-tree.js +7 -7
  108. package/dist/core/agent-session-tree.js.map +1 -1
  109. package/dist/core/cache-warmer.js +1 -1
  110. package/dist/core/cache-warmer.js.map +1 -1
  111. package/dist/core/compaction/branch-summarization.d.ts +1 -4
  112. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  113. package/dist/core/compaction/branch-summarization.js +0 -4
  114. package/dist/core/compaction/branch-summarization.js.map +1 -1
  115. package/dist/core/compaction/pi-summary-fallback.d.ts.map +1 -1
  116. package/dist/core/compaction/pi-summary-fallback.js +1 -3
  117. package/dist/core/compaction/pi-summary-fallback.js.map +1 -1
  118. package/dist/core/export-html/index.js +1 -1
  119. package/dist/core/export-html/index.js.map +1 -1
  120. package/dist/core/export-html/template-js/entries-navigation.js +1 -1
  121. package/dist/core/export-html/template.js +1 -1
  122. package/dist/core/extensions/api-types.d.ts +12 -12
  123. package/dist/core/extensions/api-types.d.ts.map +1 -1
  124. package/dist/core/extensions/api-types.js.map +1 -1
  125. package/dist/core/extensions/context-types.d.ts +4 -2
  126. package/dist/core/extensions/context-types.d.ts.map +1 -1
  127. package/dist/core/extensions/context-types.js.map +1 -1
  128. package/dist/core/extensions/extension-work.d.ts +1 -0
  129. package/dist/core/extensions/extension-work.d.ts.map +1 -1
  130. package/dist/core/extensions/extension-work.js +5 -1
  131. package/dist/core/extensions/extension-work.js.map +1 -1
  132. package/dist/core/extensions/loader-api.d.ts.map +1 -1
  133. package/dist/core/extensions/loader-api.js +40 -42
  134. package/dist/core/extensions/loader-api.js.map +1 -1
  135. package/dist/core/extensions/loader-host-modules.d.ts +1 -1
  136. package/dist/core/extensions/loader-host-modules.d.ts.map +1 -1
  137. package/dist/core/extensions/loader-host-modules.js +6 -2
  138. package/dist/core/extensions/loader-host-modules.js.map +1 -1
  139. package/dist/core/extensions/loader-rollback.d.ts.map +1 -1
  140. package/dist/core/extensions/loader-rollback.js +1 -0
  141. package/dist/core/extensions/loader-rollback.js.map +1 -1
  142. package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -1
  143. package/dist/core/extensions/loader-virtual-modules.js +1 -0
  144. package/dist/core/extensions/loader-virtual-modules.js.map +1 -1
  145. package/dist/core/extensions/runner-context.d.ts +1 -0
  146. package/dist/core/extensions/runner-context.d.ts.map +1 -1
  147. package/dist/core/extensions/runner-context.js +10 -3
  148. package/dist/core/extensions/runner-context.js.map +1 -1
  149. package/dist/core/extensions/runner-handlers.d.ts +1 -1
  150. package/dist/core/extensions/runner-handlers.d.ts.map +1 -1
  151. package/dist/core/extensions/runner-handlers.js.map +1 -1
  152. package/dist/core/extensions/runner.d.ts +3 -2
  153. package/dist/core/extensions/runner.d.ts.map +1 -1
  154. package/dist/core/extensions/runner.js +20 -12
  155. package/dist/core/extensions/runner.js.map +1 -1
  156. package/dist/core/extensions/runtime-types.d.ts +7 -7
  157. package/dist/core/extensions/runtime-types.d.ts.map +1 -1
  158. package/dist/core/extensions/runtime-types.js.map +1 -1
  159. package/dist/core/extensions/session-events.d.ts +5 -5
  160. package/dist/core/extensions/session-events.d.ts.map +1 -1
  161. package/dist/core/extensions/session-events.js.map +1 -1
  162. package/dist/core/fast-model-routing.d.ts.map +1 -1
  163. package/dist/core/fast-model-routing.js +1 -0
  164. package/dist/core/fast-model-routing.js.map +1 -1
  165. package/dist/core/intercom-runtime-group.js +1 -1
  166. package/dist/core/intercom-runtime-group.js.map +1 -1
  167. package/dist/core/model-config.d.ts +765 -0
  168. package/dist/core/model-config.d.ts.map +1 -1
  169. package/dist/core/model-config.js +46 -24
  170. package/dist/core/model-config.js.map +1 -1
  171. package/dist/core/model-resolver-defaults.js +1 -1
  172. package/dist/core/model-resolver-defaults.js.map +1 -1
  173. package/dist/core/provider-attribution.js +1 -1
  174. package/dist/core/provider-attribution.js.map +1 -1
  175. package/dist/core/resource-loader-reload.js +1 -1
  176. package/dist/core/resource-loader-reload.js.map +1 -1
  177. package/dist/core/resource-loader-types.d.ts +1 -1
  178. package/dist/core/resource-loader-types.d.ts.map +1 -1
  179. package/dist/core/resource-loader-types.js.map +1 -1
  180. package/dist/core/sdk-types.d.ts +4 -0
  181. package/dist/core/sdk-types.d.ts.map +1 -1
  182. package/dist/core/sdk-types.js.map +1 -1
  183. package/dist/core/sdk.d.ts +1 -1
  184. package/dist/core/sdk.d.ts.map +1 -1
  185. package/dist/core/sdk.js +50 -20
  186. package/dist/core/sdk.js.map +1 -1
  187. package/dist/core/session-lifecycle-work.d.ts +3 -0
  188. package/dist/core/session-lifecycle-work.d.ts.map +1 -1
  189. package/dist/core/session-lifecycle-work.js +2 -0
  190. package/dist/core/session-lifecycle-work.js.map +1 -1
  191. package/dist/core/session-manager-archive.d.ts +2 -16
  192. package/dist/core/session-manager-archive.d.ts.map +1 -1
  193. package/dist/core/session-manager-archive.js +8 -104
  194. package/dist/core/session-manager-archive.js.map +1 -1
  195. package/dist/core/session-manager-core.d.ts +53 -51
  196. package/dist/core/session-manager-core.d.ts.map +1 -1
  197. package/dist/core/session-manager-core.js +547 -307
  198. package/dist/core/session-manager-core.js.map +1 -1
  199. package/dist/core/session-manager-entries.d.ts.map +1 -1
  200. package/dist/core/session-manager-entries.js +5 -10
  201. package/dist/core/session-manager-entries.js.map +1 -1
  202. package/dist/core/session-manager-errors.d.ts +10 -0
  203. package/dist/core/session-manager-errors.d.ts.map +1 -0
  204. package/dist/core/session-manager-errors.js +27 -0
  205. package/dist/core/session-manager-errors.js.map +1 -0
  206. package/dist/core/session-manager-list.d.ts +1 -0
  207. package/dist/core/session-manager-list.d.ts.map +1 -1
  208. package/dist/core/session-manager-list.js +21 -14
  209. package/dist/core/session-manager-list.js.map +1 -1
  210. package/dist/core/session-manager-storage.d.ts +3 -13
  211. package/dist/core/session-manager-storage.d.ts.map +1 -1
  212. package/dist/core/session-manager-storage.js +28 -69
  213. package/dist/core/session-manager-storage.js.map +1 -1
  214. package/dist/core/session-manager-types.d.ts +3 -11
  215. package/dist/core/session-manager-types.d.ts.map +1 -1
  216. package/dist/core/session-manager-types.js.map +1 -1
  217. package/dist/core/session-manager-validation.d.ts.map +1 -1
  218. package/dist/core/session-manager-validation.js +3 -2
  219. package/dist/core/session-manager-validation.js.map +1 -1
  220. package/dist/core/session-manager.d.ts +2 -1
  221. package/dist/core/session-manager.d.ts.map +1 -1
  222. package/dist/core/session-manager.js +2 -1
  223. package/dist/core/session-manager.js.map +1 -1
  224. package/dist/core/session-mutation-queue.d.ts +3 -0
  225. package/dist/core/session-mutation-queue.d.ts.map +1 -0
  226. package/dist/core/session-mutation-queue.js +14 -0
  227. package/dist/core/session-mutation-queue.js.map +1 -0
  228. package/dist/core/session-resume-args.d.ts +4 -0
  229. package/dist/core/session-resume-args.d.ts.map +1 -0
  230. package/dist/core/session-resume-args.js +9 -0
  231. package/dist/core/session-resume-args.js.map +1 -0
  232. package/dist/core/session-storage.d.ts +26 -0
  233. package/dist/core/session-storage.d.ts.map +1 -0
  234. package/dist/core/session-storage.js +155 -0
  235. package/dist/core/session-storage.js.map +1 -0
  236. package/dist/core/session-store-list.d.ts +4 -0
  237. package/dist/core/session-store-list.d.ts.map +1 -0
  238. package/dist/core/session-store-list.js +28 -0
  239. package/dist/core/session-store-list.js.map +1 -0
  240. package/dist/core/settings-manager-basic-accessors.d.ts +0 -1
  241. package/dist/core/settings-manager-basic-accessors.d.ts.map +1 -1
  242. package/dist/core/settings-manager-basic-accessors.js +0 -5
  243. package/dist/core/settings-manager-basic-accessors.js.map +1 -1
  244. package/dist/core/settings-merge.d.ts.map +1 -1
  245. package/dist/core/settings-merge.js +8 -2
  246. package/dist/core/settings-merge.js.map +1 -1
  247. package/dist/core/settings-schema.d.ts +74 -8
  248. package/dist/core/settings-schema.d.ts.map +1 -1
  249. package/dist/core/settings-schema.js +29 -29
  250. package/dist/core/settings-schema.js.map +1 -1
  251. package/dist/core/storage/errors.d.ts +1 -0
  252. package/dist/core/storage/errors.d.ts.map +1 -1
  253. package/dist/core/storage/errors.js.map +1 -1
  254. package/dist/core/storage/index.d.ts +5 -1
  255. package/dist/core/storage/index.d.ts.map +1 -1
  256. package/dist/core/storage/index.js +4 -1
  257. package/dist/core/storage/index.js.map +1 -1
  258. package/dist/core/storage/node-sqlite.d.ts +2 -0
  259. package/dist/core/storage/node-sqlite.d.ts.map +1 -1
  260. package/dist/core/storage/node-sqlite.js +47 -6
  261. package/dist/core/storage/node-sqlite.js.map +1 -1
  262. package/dist/core/storage/provider.d.ts +58 -0
  263. package/dist/core/storage/provider.d.ts.map +1 -0
  264. package/dist/core/storage/provider.js +243 -0
  265. package/dist/core/storage/provider.js.map +1 -0
  266. package/dist/core/storage/run-journal.d.ts +93 -0
  267. package/dist/core/storage/run-journal.d.ts.map +1 -0
  268. package/dist/core/storage/run-journal.js +15 -0
  269. package/dist/core/storage/run-journal.js.map +1 -0
  270. package/dist/core/storage/selection.d.ts +16 -0
  271. package/dist/core/storage/selection.d.ts.map +1 -0
  272. package/dist/core/storage/selection.js +87 -0
  273. package/dist/core/storage/selection.js.map +1 -0
  274. package/dist/core/storage/session/jsonl-session-store.d.ts +11 -2
  275. package/dist/core/storage/session/jsonl-session-store.d.ts.map +1 -1
  276. package/dist/core/storage/session/jsonl-session-store.js +127 -54
  277. package/dist/core/storage/session/jsonl-session-store.js.map +1 -1
  278. package/dist/core/storage/session/legacy-format.d.ts +18 -0
  279. package/dist/core/storage/session/legacy-format.d.ts.map +1 -0
  280. package/dist/core/storage/session/legacy-format.js +63 -0
  281. package/dist/core/storage/session/legacy-format.js.map +1 -0
  282. package/dist/core/storage/session/memory-session-store.d.ts +3 -1
  283. package/dist/core/storage/session/memory-session-store.d.ts.map +1 -1
  284. package/dist/core/storage/session/memory-session-store.js +9 -2
  285. package/dist/core/storage/session/memory-session-store.js.map +1 -1
  286. package/dist/core/storage/session/sql-session-store.d.ts +4 -1
  287. package/dist/core/storage/session/sql-session-store.d.ts.map +1 -1
  288. package/dist/core/storage/session/sql-session-store.js +25 -6
  289. package/dist/core/storage/session/sql-session-store.js.map +1 -1
  290. package/dist/core/storage/session/types.d.ts +4 -0
  291. package/dist/core/storage/session/types.d.ts.map +1 -1
  292. package/dist/core/storage/session/types.js.map +1 -1
  293. package/dist/core/storage/session/validation.js +1 -1
  294. package/dist/core/storage/session/validation.js.map +1 -1
  295. package/dist/core/storage/testing.d.ts +2 -0
  296. package/dist/core/storage/testing.d.ts.map +1 -1
  297. package/dist/core/storage/testing.js +45 -0
  298. package/dist/core/storage/testing.js.map +1 -1
  299. package/dist/core/tasks/completion.d.ts.map +1 -1
  300. package/dist/core/tasks/completion.js +2 -4
  301. package/dist/core/tasks/completion.js.map +1 -1
  302. package/dist/core/tools/bash-session-environment.d.ts.map +1 -1
  303. package/dist/core/tools/bash-session-environment.js +0 -2
  304. package/dist/core/tools/bash-session-environment.js.map +1 -1
  305. package/dist/core/tools/read-url.d.ts.map +1 -1
  306. package/dist/core/tools/read-url.js +6 -1
  307. package/dist/core/tools/read-url.js.map +1 -1
  308. package/dist/core/tools/todos-model.js +3 -3
  309. package/dist/core/tools/todos-model.js.map +1 -1
  310. package/dist/core/tools/todos-mutations.js +2 -2
  311. package/dist/core/tools/todos-mutations.js.map +1 -1
  312. package/dist/core/tools/todos-render.js +1 -1
  313. package/dist/core/tools/todos-render.js.map +1 -1
  314. package/dist/core/tools/todos-storage.js +2 -2
  315. package/dist/core/tools/todos-storage.js.map +1 -1
  316. package/dist/extensions/codemode/execute.d.ts.map +1 -1
  317. package/dist/extensions/codemode/execute.js +14 -1
  318. package/dist/extensions/codemode/execute.js.map +1 -1
  319. package/dist/extensions/codemode/tool.d.ts +1 -1
  320. package/dist/extensions/codemode/tool.d.ts.map +1 -1
  321. package/dist/extensions/codemode/tool.js.map +1 -1
  322. package/dist/extensions/herdr/index.d.ts.map +1 -1
  323. package/dist/extensions/herdr/index.js +6 -8
  324. package/dist/extensions/herdr/index.js.map +1 -1
  325. package/dist/extensions/mcp/index.js +1 -1
  326. package/dist/extensions/mcp/index.js.map +1 -1
  327. package/dist/extensions/mcp/tools.d.ts.map +1 -1
  328. package/dist/extensions/mcp/tools.js +6 -1
  329. package/dist/extensions/mcp/tools.js.map +1 -1
  330. package/dist/index.d.ts +3 -1
  331. package/dist/index.d.ts.map +1 -1
  332. package/dist/index.js +3 -1
  333. package/dist/index.js.map +1 -1
  334. package/dist/main-session.d.ts +12 -2
  335. package/dist/main-session.d.ts.map +1 -1
  336. package/dist/main-session.js +148 -53
  337. package/dist/main-session.js.map +1 -1
  338. package/dist/main.d.ts.map +1 -1
  339. package/dist/main.js +97 -42
  340. package/dist/main.js.map +1 -1
  341. package/dist/modes/interactive/components/chat-session-host.d.ts +3 -1
  342. package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
  343. package/dist/modes/interactive/components/chat-session-host.js +16 -7
  344. package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
  345. package/dist/modes/interactive/components/extension-input.d.ts +1 -1
  346. package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
  347. package/dist/modes/interactive/components/extension-input.js +2 -2
  348. package/dist/modes/interactive/components/extension-input.js.map +1 -1
  349. package/dist/modes/interactive/components/host-session-picker.js +1 -1
  350. package/dist/modes/interactive/components/host-session-picker.js.map +1 -1
  351. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  352. package/dist/modes/interactive/components/scoped-models-selector.js +4 -1
  353. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  354. package/dist/modes/interactive/components/session-selector-delete.d.ts +1 -1
  355. package/dist/modes/interactive/components/session-selector-delete.d.ts.map +1 -1
  356. package/dist/modes/interactive/components/session-selector-delete.js.map +1 -1
  357. package/dist/modes/interactive/components/session-selector-list.d.ts +12 -9
  358. package/dist/modes/interactive/components/session-selector-list.d.ts.map +1 -1
  359. package/dist/modes/interactive/components/session-selector-list.js +27 -25
  360. package/dist/modes/interactive/components/session-selector-list.js.map +1 -1
  361. package/dist/modes/interactive/components/session-selector.d.ts +8 -4
  362. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  363. package/dist/modes/interactive/components/session-selector.js +27 -18
  364. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  365. package/dist/modes/interactive/components/tree-selector-component.d.ts +5 -1
  366. package/dist/modes/interactive/components/tree-selector-component.d.ts.map +1 -1
  367. package/dist/modes/interactive/components/tree-selector-component.js +20 -3
  368. package/dist/modes/interactive/components/tree-selector-component.js.map +1 -1
  369. package/dist/modes/interactive/interactive-bash-compact.js +1 -1
  370. package/dist/modes/interactive/interactive-bash-compact.js.map +1 -1
  371. package/dist/modes/interactive/interactive-deferred-startup.js +2 -2
  372. package/dist/modes/interactive/interactive-deferred-startup.js.map +1 -1
  373. package/dist/modes/interactive/interactive-editor-actions.js +2 -2
  374. package/dist/modes/interactive/interactive-editor-actions.js.map +1 -1
  375. package/dist/modes/interactive/interactive-extension-runtime.js +2 -0
  376. package/dist/modes/interactive/interactive-extension-runtime.js.map +1 -1
  377. package/dist/modes/interactive/interactive-input-handling.js +6 -4
  378. package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
  379. package/dist/modes/interactive/interactive-mode-helpers.d.ts.map +1 -1
  380. package/dist/modes/interactive/interactive-mode-helpers.js +7 -3
  381. package/dist/modes/interactive/interactive-mode-helpers.js.map +1 -1
  382. package/dist/modes/interactive/interactive-mode-surface.d.ts +5 -5
  383. package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
  384. package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
  385. package/dist/modes/interactive/interactive-model-routing.js +12 -7
  386. package/dist/modes/interactive/interactive-model-routing.js.map +1 -1
  387. package/dist/modes/interactive/interactive-selectors.js +2 -2
  388. package/dist/modes/interactive/interactive-selectors.js.map +1 -1
  389. package/dist/modes/interactive/interactive-session-routing.js +38 -14
  390. package/dist/modes/interactive/interactive-session-routing.js.map +1 -1
  391. package/dist/modes/interactive/interactive-slash-commands.js +5 -3
  392. package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
  393. package/dist/modes/interactive-engine/create-isolated-runtime.d.ts.map +1 -1
  394. package/dist/modes/interactive-engine/create-isolated-runtime.js +8 -1
  395. package/dist/modes/interactive-engine/create-isolated-runtime.js.map +1 -1
  396. package/dist/modes/interactive-engine/engine-args.d.ts.map +1 -1
  397. package/dist/modes/interactive-engine/engine-args.js +11 -4
  398. package/dist/modes/interactive-engine/engine-args.js.map +1 -1
  399. package/dist/modes/interactive-engine/isolated-runtime.d.ts +1 -1
  400. package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
  401. package/dist/modes/interactive-engine/isolated-runtime.js +99 -74
  402. package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
  403. package/dist/modes/rpc/rpc-bash-request-owners.js +1 -1
  404. package/dist/modes/rpc/rpc-bash-request-owners.js.map +1 -1
  405. package/dist/modes/rpc/rpc-client-api.d.ts +1 -1
  406. package/dist/modes/rpc/rpc-client-api.d.ts.map +1 -1
  407. package/dist/modes/rpc/rpc-client-api.js +2 -2
  408. package/dist/modes/rpc/rpc-client-api.js.map +1 -1
  409. package/dist/modes/rpc/rpc-client-process.d.ts +2 -2
  410. package/dist/modes/rpc/rpc-client-process.d.ts.map +1 -1
  411. package/dist/modes/rpc/rpc-client-process.js +20 -7
  412. package/dist/modes/rpc/rpc-client-process.js.map +1 -1
  413. package/dist/modes/rpc/rpc-client.d.ts +4 -1
  414. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  415. package/dist/modes/rpc/rpc-client.js +6 -2
  416. package/dist/modes/rpc/rpc-client.js.map +1 -1
  417. package/dist/modes/rpc/rpc-command-handler.d.ts.map +1 -1
  418. package/dist/modes/rpc/rpc-command-handler.js +12 -9
  419. package/dist/modes/rpc/rpc-command-handler.js.map +1 -1
  420. package/dist/modes/rpc/rpc-provider-auth.js +2 -2
  421. package/dist/modes/rpc/rpc-provider-auth.js.map +1 -1
  422. package/dist/modes/rpc/rpc-terminal-drain.d.ts.map +1 -1
  423. package/dist/modes/rpc/rpc-terminal-drain.js +11 -2
  424. package/dist/modes/rpc/rpc-terminal-drain.js.map +1 -1
  425. package/dist/modes/rpc/rpc-types.d.ts +6 -2
  426. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  427. package/dist/modes/rpc/rpc-types.js.map +1 -1
  428. package/dist/utils/canonical-path.d.ts +5 -0
  429. package/dist/utils/canonical-path.d.ts.map +1 -0
  430. package/dist/utils/canonical-path.js +26 -0
  431. package/dist/utils/canonical-path.js.map +1 -0
  432. package/dist/utils/paths.d.ts +1 -7
  433. package/dist/utils/paths.d.ts.map +1 -1
  434. package/dist/utils/paths.js +1 -15
  435. package/dist/utils/paths.js.map +1 -1
  436. package/docs/codemode.md +2 -0
  437. package/docs/compaction.md +2 -2
  438. package/docs/custom-provider/oauth.md +2 -2
  439. package/docs/custom-provider/override.md +3 -3
  440. package/docs/custom-provider/registration.md +7 -7
  441. package/docs/custom-provider/streaming.md +1 -1
  442. package/docs/custom-provider.md +5 -5
  443. package/docs/docs.json +1 -0
  444. package/docs/environment-variables.md +10 -2
  445. package/docs/extensions/api-reference.md +40 -19
  446. package/docs/extensions/authoring.md +1 -1
  447. package/docs/extensions/events.md +8 -8
  448. package/docs/extensions.md +2 -2
  449. package/docs/getting-started/installation.md +1 -2
  450. package/docs/models/reference.md +2 -0
  451. package/docs/models-configuration.md +206 -0
  452. package/docs/models.md +11 -1
  453. package/docs/providers.md +4 -4
  454. package/docs/quickstart.md +2 -1
  455. package/docs/reference/cli.md +7 -3
  456. package/docs/rpc/protocol.md +10 -4
  457. package/docs/sdk/reference.md +15 -13
  458. package/docs/sdk/web-server.md +5 -6
  459. package/docs/sdk.md +56 -2
  460. package/docs/session-format.md +35 -28
  461. package/docs/sessions.md +50 -17
  462. package/docs/settings.md +44 -7
  463. package/docs/storage.md +346 -2
  464. package/docs/usage.md +3 -2
  465. package/docs/workflows/api-reference.md +80 -16
  466. package/docs/workflows/operations.md +6 -4
  467. package/docs/workflows/reliable-design.md +16 -16
  468. package/examples/extensions/bookmark.ts +2 -2
  469. package/examples/extensions/handoff.ts +2 -2
  470. package/examples/extensions/plan-mode/index.ts +15 -13
  471. package/examples/extensions/preset.ts +8 -8
  472. package/examples/extensions/session-name.ts +1 -1
  473. package/examples/extensions/snake.ts +3 -1
  474. package/examples/extensions/space-invaders.ts +3 -1
  475. package/examples/extensions/tic-tac-toe.ts +80 -80
  476. package/examples/sdk/11-sessions.ts +5 -5
  477. package/examples/sdk/13-session-runtime.ts +7 -7
  478. package/examples/sdk/README.md +1 -1
  479. package/npm-shrinkwrap.json +53 -53
  480. package/package.json +7 -6
  481. package/schemas/models.schema.json +62 -29
  482. package/schemas/settings.schema.json +137 -53
  483. package/dist/builtin/workflows/builtin/chunk-h5fn47y5.js +0 -8
  484. package/dist/builtin/workflows/src/durable/journal/node-sqlite.d.ts +0 -20
@@ -555,12 +555,12 @@ const { session } = await createAgentSession({
555
555
 
556
556
  // New persistent session
557
557
  const { session: persisted } = await createAgentSession({
558
- sessionManager: SessionManager.create(process.cwd()),
558
+ sessionManager: await SessionManager.create(process.cwd()),
559
559
  });
560
560
 
561
561
  // Continue most recent
562
562
  const { session: continued, modelFallbackMessage } = await createAgentSession({
563
- sessionManager: SessionManager.continueRecent(process.cwd()),
563
+ sessionManager: await SessionManager.continueRecent(process.cwd()),
564
564
  });
565
565
  if (modelFallbackMessage) {
566
566
  console.log("Note:", modelFallbackMessage);
@@ -568,7 +568,7 @@ if (modelFallbackMessage) {
568
568
 
569
569
  // Open specific file
570
570
  const { session: opened } = await createAgentSession({
571
- sessionManager: SessionManager.open("/path/to/session.jsonl"),
571
+ sessionManager: await SessionManager.open("/path/to/session.jsonl"),
572
572
  });
573
573
 
574
574
  // List sessions
@@ -592,14 +592,14 @@ const createRuntime: CreateAgentSessionRuntimeFactory = async ({ cwd, sessionMan
592
592
  const runtime = await createAgentSessionRuntime(createRuntime, {
593
593
  cwd: process.cwd(),
594
594
  agentDir: getAgentDir(),
595
- sessionManager: SessionManager.create(process.cwd()),
595
+ sessionManager: await SessionManager.create(process.cwd()),
596
596
  });
597
597
 
598
598
  // Replace the active session with a fresh one
599
599
  await runtime.newSession();
600
600
 
601
601
  // Replace the active session with another saved session
602
- await runtime.switchSession("/path/to/session.jsonl");
602
+ await runtime.switchSession("session-id");
603
603
 
604
604
  // Replace the active session with a fork from a specific user entry
605
605
  await runtime.fork("entry-id");
@@ -608,10 +608,12 @@ await runtime.fork("entry-id");
608
608
  await runtime.fork("entry-id", { position: "at" });
609
609
  ```
610
610
 
611
+ `SessionManager.create()`, `open()`, `continueRecent()`, `forkFrom()`, and mutations are asynchronous. `SessionManager.inMemory()` returns an explicitly memory-backed manager synchronously. Await a mutation before reading its result or starting dependent work. A resolved write is committed; a failed write rejects with the store's typed error and leaves the failed entry unpublished. New persistent sessions store their header during creation and commit setup entries immediately. There is no `flush` method. Reads remain synchronous.
612
+
611
613
  **SessionManager tree API:**
612
614
 
613
615
  ```typescript
614
- const sm = SessionManager.open("/path/to/session.jsonl");
616
+ const sm = await SessionManager.open("/path/to/session.jsonl");
615
617
 
616
618
  // Session listing
617
619
  const currentProjectSessions = await SessionManager.list(process.cwd());
@@ -627,12 +629,12 @@ const children = sm.getChildren(id); // Direct children of entry
627
629
 
628
630
  // Labels
629
631
  const label = sm.getLabel(id); // Get label for entry
630
- sm.appendLabelChange(id, "checkpoint"); // Set label
632
+ await sm.appendLabelChange(id, "checkpoint"); // Set label
631
633
 
632
634
  // Branching
633
- sm.branch(entryId); // Move leaf to earlier entry
634
- sm.branchWithSummary(id, "Summary..."); // Branch with context summary
635
- sm.createBranchedSession(leafId); // Extract path to new file
635
+ await sm.branch(entryId); // Move leaf to earlier entry
636
+ await sm.branchWithSummary(id, "Summary..."); // Branch with context summary
637
+ await sm.createBranchedSession(leafId); // Extract path to new file
636
638
  ```
637
639
 
638
640
  > See [examples/sdk/11-sessions.ts](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/examples/sdk/11-sessions.ts) and [Session Format](/session-format)
@@ -770,7 +772,7 @@ const createRuntime: CreateAgentSessionRuntimeFactory = async ({ cwd, sessionMan
770
772
  const runtime = await createAgentSessionRuntime(createRuntime, {
771
773
  cwd: process.cwd(),
772
774
  agentDir: getAgentDir(),
773
- sessionManager: SessionManager.create(process.cwd()),
775
+ sessionManager: await SessionManager.create(process.cwd()),
774
776
  });
775
777
 
776
778
  const mode = new InteractiveMode(runtime, {
@@ -810,7 +812,7 @@ const createRuntime: CreateAgentSessionRuntimeFactory = async ({ cwd, sessionMan
810
812
  const runtime = await createAgentSessionRuntime(createRuntime, {
811
813
  cwd: process.cwd(),
812
814
  agentDir: getAgentDir(),
813
- sessionManager: SessionManager.create(process.cwd()),
815
+ sessionManager: await SessionManager.create(process.cwd()),
814
816
  });
815
817
 
816
818
  await runPrintMode(runtime, {
@@ -847,7 +849,7 @@ const createRuntime: CreateAgentSessionRuntimeFactory = async ({ cwd, sessionMan
847
849
  const runtime = await createAgentSessionRuntime(createRuntime, {
848
850
  cwd: process.cwd(),
849
851
  agentDir: getAgentDir(),
850
- sessionManager: SessionManager.create(process.cwd()),
852
+ sessionManager: await SessionManager.create(process.cwd()),
851
853
  });
852
854
 
853
855
  await runRpcMode(runtime);
@@ -267,7 +267,7 @@ export async function POST(request: Request): Promise<Response> {
267
267
  const result = await run(reviewWorkflow, { topic }, {
268
268
  cwd: WORKSPACE,
269
269
  signal: abort.signal,
270
- durability: { mode: "memory" },
270
+ journal: { memory: true },
271
271
  adapters: {
272
272
  agentSession: createAgentSessionAdapter({ cwd: WORKSPACE, tools: ["read", "find", "search"] }),
273
273
  },
@@ -298,14 +298,13 @@ export async function POST(request: Request): Promise<Response> {
298
298
 
299
299
  `onStageSessionEvent` receives every stage's session events tagged with its run and stage ids, including stages that switch to a fallback model and stages of nested workflows. Aborting `signal`, here when the client disconnects, cancels the run.
300
300
 
301
- ### Choose workflow durability
301
+ ### Choose workflow storage
302
302
 
303
- By default, `run()` persists workflow state in a local SQLite journal so eligible runs can resume after the process exits. Keep that file on durable local storage in deployments that need restart recovery.
303
+ By default, `run()` persists workflow state in the local SQLite journal at `~/.atomic/workflows/journal.sqlite`. Keep it on durable local storage when your service needs restart recovery. If several replicas must inspect or resume each other's runs, have them share a remote SQLite-compatible database through an adapter. See [Sharing storage across hosts](/storage#sharing-storage-across-hosts).
304
304
 
305
- - **`durability: { mode: "durable" }`** explicitly requires persistent state. Journal open or write failures stop the run; they do not select non-durable execution.
306
- - **`durability: { mode: "memory" }`** explicitly keeps state for this call only and cannot resume after process exit. Use it only when that lifetime is intentional.
305
+ Use `journal: { path: "/var/lib/my-service/workflows.sqlite" }` to select a file for a run, or `journal: { memory: true }` for process-local state that cannot survive a restart. Supply a caller-owned async SQLite facade as `{ database, prefix? }`; Atomic does not close it. You can also supply a `RunJournal` instance or `{ adapter, options?, secrets?, prefix? }` for a user-installed driver module.
307
306
 
308
- Set `ATOMIC_WORKFLOW_JOURNAL_PATH` before the first workflow action to choose the journal file. See [Choosing the durable backend](/workflows/api-reference#choosing-the-durable-backend) and [Workflows](/workflows).
307
+ `RunOpts.journal` overrides a non-empty `ATOMIC_WORKFLOW_JOURNAL_PATH`, then `workflows.journal`, then shared top-level `storage`, then the default file. Nearer settings replace whole selections. Relative settings paths resolve against Atomic home. Configuration or storage failures stop the run instead of switching to memory. See [Choosing the durable backend](/workflows/api-reference#choosing-the-durable-backend).
309
308
 
310
309
  ## Secure the endpoint
311
310
 
package/docs/sdk.md CHANGED
@@ -160,6 +160,43 @@ const { session } = await createAgentSession({
160
160
  });
161
161
  ```
162
162
 
163
+ ### Session storage
164
+
165
+ `createAgentSession()` persists sessions in `~/.atomic/workflows/journal.sqlite` by default, sharing the file with workflow runs under separate `session_` and `wf_` table prefixes. Pass `sessionStore` to choose storage explicitly:
166
+
167
+ ```typescript
168
+ const { session } = await createAgentSession({
169
+ sessionStore: { kind: "sqlite", path: "./sessions.sqlite", prefix: "project_" },
170
+ });
171
+ ```
172
+
173
+ Other selections are `{ kind: "jsonl", dir }`, `{ kind: "memory" }`, `{ kind: "database", database, prefix? }`, and `{ kind: "adapter", module, options?, secrets?, prefix? }`. `database` must implement the async `SqliteDatabase` facade. Install your own driver and expose an adapter module for a remote database; Atomic bundles only its local `node:sqlite` adapter. See [Storage adapters](/storage).
174
+
175
+ `sessionStore` also accepts a `SessionStore` instance. A supplied `sessionManager` takes precedence and remains caller-owned. Otherwise, explicit SDK storage wins over the session-directory environment variable, `sessions.storage`, shared `storage`, and the persistent default. Memory is never a default or an opening-failure fallback. The `sessionDir` factory option has been removed; use a JSONL `sessionStore` selection instead. See [Session storage settings](/settings#sessions) for scope and path rules.
176
+
177
+ Atomic closes stores it opens from a selection when the session is disposed, after pending writes finish. Supplied `SessionStore` instances and stores belonging to supplied managers remain caller-owned. With `{ kind: "database", database }`, Atomic closes its store but leaves your database open. Always await `session.dispose()` and close caller-owned stores when no session still uses them.
178
+
179
+ Resume by opening the ID in the chosen store, then pass that manager to the factory:
180
+
181
+ ```typescript
182
+ import { createAgentSession, resolveSessionStore, SessionManager } from "@bastani/atomic";
183
+
184
+ const store = await resolveSessionStore(process.cwd());
185
+ try {
186
+ const manager = await SessionManager.open(store, savedSessionId);
187
+ const { session } = await createAgentSession({ sessionManager: manager });
188
+ try {
189
+ await session.prompt("Continue the task");
190
+ } finally {
191
+ await session.dispose();
192
+ }
193
+ } finally {
194
+ await store.close();
195
+ }
196
+ ```
197
+
198
+ Await every `SessionManager` mutation before reading dependent state. Writes resolve after commit; a failure rejects with a typed error without publishing the failed entry. There is no `flush()` step. Extension `pi.appendEntry`, `pi.setSessionName`, `pi.setLabel`, and `pi.setThinkingLevel` also return promises. `ExtensionContext.sessionSignal` aborts when reload or shutdown starts, before admitted work is drained. Use it to stop waiting on long-running command resources, but keep awaiting any session write already started. See [SessionManager API](/session-format#sessionmanager-api) and [Storage errors](/storage#storage-errors).
199
+
163
200
  ### Human input without a terminal
164
201
 
165
202
  Pass `extensionBindings.humanInput` to answer extension dialogs and `ask_user_question` in a Node host. `HostInput` requires all five methods: `confirm`, `select`, `input`, `editor` and `questionnaire`. `QuestionParams` and `QuestionnaireResult` are exported from `@bastani/atomic`; questionnaire answers retain their question indices, answer kinds, selections, previews and notes.
@@ -232,6 +269,23 @@ Web provider configuration caches are session-local. Configuration discovery and
232
269
 
233
270
  `session.sessionSummary` returns the current branch's latest `SessionSummaryEntry`, or `undefined` when none is available. Read `summary` for the generated text and `summarizedThroughId` for the last message it describes. `SessionManager.list()` and `SessionManager.listAll()` expose those same fields on each `SessionInfo`. Stored summaries remain readable when `sessionSummary.enabled` is false; that setting controls generation only.
234
271
 
272
+ ### Workflow journal selection
273
+
274
+ Standalone workflow `run()` accepts `RunOpts.journal` to choose a local SQLite file, a caller-owned connection, process-local memory, or a supplied `RunJournal`:
275
+
276
+ ```typescript
277
+ import { run } from "@bastani/atomic/workflows";
278
+
279
+ await run(myWorkflow, inputs, { journal: { path: "./workflow-runs.sqlite" } });
280
+ await run(myWorkflow, inputs, { journal: { memory: true } });
281
+ ```
282
+
283
+ Use `{ database, prefix? }` for an async `SqliteDatabase` facade; Atomic never closes the caller-owned database. To use a driver selected by module specifier, pass `{ adapter, options?, secrets?, prefix? }`. Atomic bundles no remote drivers. A supplied `RunJournal` is used as-is. Memory is an explicit opt-in for tests or ephemeral runs and cannot recover runs after process exit. See [Storage adapters](/storage#selecting-an-adapter).
284
+
285
+ Custom journals implement the full `RunJournal` interface, including `deleteOwnedRun(lease, expectSeq?)` for atomic lease-fenced deletion with an optional sequence check. A stale lease rejects with `StaleLeaseError` without deleting the successor's data. Open a facade-backed journal with `await SqlRunJournal.open(database, { prefix })`, or use `await openSqlRunJournal(pathOrDatabase?)` for the node adapter. Validate custom journals with `registerRunJournalConformance`; see [Choosing the durable backend](/workflows/api-reference#choosing-the-durable-backend).
286
+
287
+ Without a per-run option, a non-empty `ATOMIC_WORKFLOW_JOURNAL_PATH` overrides `workflows.journal`, which overrides shared top-level `storage`. Nearer-scope settings replace whole selections. Relative settings paths resolve against Atomic home. The default journal is `~/.atomic/workflows/journal.sqlite`; an empty shared selection uses `~/.atomic/storage.sqlite`. Keep the original journal and working directory to resume saved runs. Invalid configuration and storage failures reject rather than switching to memory. See [Workflow storage settings](/settings#workflow-storage).
288
+
235
289
  ### Workflow run control
236
290
 
237
291
  `session.workflows` controls this session's runs without slash commands or the model-facing `workflow` tool. A fresh session can inspect a durable root by its full UUID within the same working directory and journal. Inspection stays read-only and does not add the run to `listRuns()`.
@@ -435,7 +489,7 @@ interface AgentSession {
435
489
 
436
490
  Always `await session.dispose()` in `finally`. Disposal immediately refuses new work, cancels and drains owned operations, settles questions, shuts down extensions and releases session leases. Repeated calls await the same outcome.
437
491
 
438
- A `ShutdownFailed` error contains component failures in `errors`; cleanup still attempts the remaining components. Caller-supplied managers and model runtimes remain borrowed, and other sessions remain usable. Use `abort()` to cancel current work without destroying the session.
492
+ A `ShutdownFailed` error contains component failures in `errors`; cleanup still attempts the remaining components. Stores opened by the SDK, including stores created from a `sessionStore` selection, are released after session work and shutdown handlers finish. A failed session initialization releases its acquired store too. Caller-supplied `SessionStore` instances, session managers, databases, and model runtimes retain their caller-managed lifetimes. Close a supplied store or database only after its other users are done. Disposing one session does not close another session's store or a shared journal. Use `abort()` to cancel current work without destroying the session.
439
493
 
440
494
  Captured extension APIs also refuse new execution, mutations and registrations as soon as close or reload begins. Already-admitted `pi.exec()` calls remain part of the awaited drain; provide `signal` or `timeout` when invoking subprocesses that might not finish on their own. `abort()` alone does not retire the API. A rejected transactional reload restores the surviving generation's action admission.
441
495
 
@@ -538,7 +592,7 @@ const createRuntime: CreateAgentSessionRuntimeFactory = async ({ cwd, sessionMan
538
592
  const runtime = await createAgentSessionRuntime(createRuntime, {
539
593
  cwd: process.cwd(),
540
594
  agentDir: getAgentDir(),
541
- sessionManager: SessionManager.create(process.cwd()),
595
+ sessionManager: await SessionManager.create(process.cwd()),
542
596
  });
543
597
  ```
544
598
 
@@ -1,24 +1,24 @@
1
1
  # Session File Format
2
2
 
3
- Sessions are stored as JSONL (JSON Lines) files. Each line is a JSON object with a `type` field. Session entries form a tree structure via `id`/`parentId` fields, enabling in-place branching without creating new files.
3
+ This page describes format-4 JSONL files used by explicit JSONL stores and exports. Sessions default to SQLite; see [Session storage](/sessions#session-storage) to choose a store. In JSONL, each line is a JSON object with a `type` field. Session entries form a tree through `id` and `parentId`.
4
4
 
5
5
  ## File Location
6
6
 
7
7
  ```
8
- ~/.atomic/agent/sessions/--<path>--/<timestamp>_<uuid>.jsonl
8
+ <selected-jsonl-directory>/<timestamp>_<session-id-hash>.jsonl
9
9
  ```
10
10
 
11
- Where `<path>` is the working directory with `/` replaced by `-`.
11
+ `sessions.storage.dir` and `--session-dir` select the directory containing the JSONL files. Session IDs, not these paths, are used for resume and fork selection. Local artifacts and tool-result files remain on the filesystem even with a database-backed session.
12
12
 
13
13
  ## Deleting Sessions
14
14
 
15
- Sessions can be removed by deleting their `.jsonl` files under `~/.atomic/agent/sessions/` (legacy `~/.pi/agent/sessions/` may exist from older Pi installs).
15
+ For an explicitly selected JSONL store, sessions can be removed by deleting their `.jsonl` files. Do not delete the shared SQLite database to remove a single session.
16
16
 
17
- Atomic also supports deleting sessions interactively from `/resume` (select a session and press `CTRL+D`, then confirm). When available, Atomic uses the `trash` CLI to avoid permanent deletion.
17
+ Delete individual sessions from `/resume`: select a session, press `CTRL+D`, then confirm. Database stores delete the selected session record. JSONL stores use the `trash` CLI when available.
18
18
 
19
19
  ## Session Version
20
20
 
21
- SessionManager writes version 4 headers. Other versions and structurally invalid entries are rejected before loading or forking; unloadable sessions are omitted from resume listings. Session-format migrations have been removed. Start a new session instead of relying on automatic conversion. Reading a file leaves its bytes unchanged. A complete final record without a newline is accepted; a torn final record is rejected.
21
+ SessionManager writes version 4 headers. Sessions in formats 1, 2, and 3 are upgraded automatically when opened, resumed, imported, or forked. Reading converts older records in memory; listing sessions and looking up headers leave files unchanged. Opening an older JSONL session persists its upgrade atomically under the file lock before new entries are saved. Future versions, unrecognized version values, and structurally invalid entries remain rejected; unloadable sessions are omitted from resume listings. A complete final record without a newline is accepted; a torn final record is rejected.
22
22
 
23
23
  ## Source Files
24
24
 
@@ -194,25 +194,25 @@ interface SessionEntryBase {
194
194
 
195
195
  ### SessionHeader
196
196
 
197
- First line of the file. Metadata only, not part of the tree (no `id`/`parentId`).
197
+ First line of the file. Metadata only, not a tree entry. Its `id` identifies the session; it has no `parentId`.
198
198
 
199
199
  ```json
200
- {"type":"session","version":4,"id":"uuid","timestamp":"2024-12-03T14:00:00.000Z","cwd":"/path/to/project"}
200
+ {"type":"session","version":4,"id":"uuid","createdAt":"2024-12-03T14:00:00.000Z","cwd":"/path/to/project"}
201
201
  ```
202
202
 
203
203
  For sessions with a parent (created via `/fork`, `/clone`, or `newSession({ parentSession })`):
204
204
 
205
205
  ```json
206
- {"type":"session","version":4,"id":"uuid","timestamp":"2024-12-03T14:00:00.000Z","cwd":"/path/to/project","parentSession":"/path/to/original/session.jsonl"}
206
+ {"type":"session","version":4,"id":"uuid","createdAt":"2024-12-03T14:00:00.000Z","cwd":"/path/to/project","parentSessionId":"original-session-id"}
207
207
  ```
208
208
 
209
209
  Workflow-owned sessions carry both `internal: true` and complete `workflow` linkage. Atomic writes this classification before the transcript becomes visible wherever possible, including workflow stage forks and fresh/forked subagents. A session is excluded from normal resume history only when `internal` is the exact boolean `true` and `workflow.runId`, `workflow.stageId`, and `workflow.stageName` are all non-empty strings:
210
210
 
211
211
  ```json
212
- {"type":"session","version":4,"id":"uuid","timestamp":"2024-12-03T14:00:00.000Z","cwd":"/path/to/project","internal":true,"workflow":{"runId":"run-1","stageId":"stage-build","stageName":"build"}}
212
+ {"type":"session","version":4,"id":"uuid","createdAt":"2024-12-03T14:00:00.000Z","cwd":"/path/to/project","internal":true,"workflow":{"runId":"run-1","stageId":"stage-build","stageName":"build"}}
213
213
  ```
214
214
 
215
- Malformed, incomplete, workflow-only, or truthy non-boolean legacy markers remain visible in normal history. Atomic does not infer workflow ownership from `parentSession`, so ordinary user-created forks are unaffected. Valid workflow classification is inherited when an internal workflow transcript is branched or forked.
215
+ Malformed or incomplete workflow markers remain visible in normal history. Atomic does not infer workflow ownership from `parentSessionId`, so ordinary user-created forks are unaffected. Valid workflow classification is inherited when an internal workflow transcript is branched or forked.
216
216
 
217
217
  ### SessionMessageEntry
218
218
 
@@ -425,25 +425,30 @@ for (const line of lines) {
425
425
 
426
426
  Key methods for working with sessions programmatically.
427
427
 
428
+ Await `create`, `open`, `continueRecent`, `forkFrom`, and all session mutations. A resolved mutation has committed to its store; a failed write rejects with its typed storage error without publishing the failed entry. There is no `flush` method. `inMemory()` explicitly selects memory and performs no filesystem I/O. Factories without an explicit store or directory resolve the configured storage, defaulting to the shared local SQLite database. A directory argument explicitly selects JSONL. Store-open failures never fall back to memory.
429
+
428
430
  ### Static Creation Methods
429
431
 
430
- - `SessionManager.create(cwd, sessionDir?, options?)` - New session. Workflow-owned sessions require the pair `internal: true` and `workflow: { runId, stageId, stageName }`.
431
- - `SessionManager.open(path, sessionDir?)` - Open a specific session file directly, including an internal session.
432
- - `SessionManager.continueRecent(cwd, sessionDir?, options?)` - Continue the most recent regular session or create a new one. Pass `{ includeInternal: true }` only for workflow-specific recovery or diagnostics.
433
- - `SessionManager.inMemory(cwd?, options?)` - No file persistence
434
- - `SessionManager.forkFrom(sourcePath, targetCwd, sessionDir?, options?)` - Fork a session from another project. Relevant `NewSessionOptions`, including valid workflow classification, are written in the initial header.
432
+ - `SessionManager.create(cwd, sessionDir?, options?)` - New session in configured storage, or explicit JSONL when a directory is supplied.
433
+ - `SessionManager.create(store, cwd, options?)` - New session in a supplied `SessionStore`. Workflow-owned sessions require the pair `internal: true` and `workflow: { runId, stageId, stageName }`.
434
+ - `SessionManager.open(store, sessionId, cwdOverride?)` - Open an existing session by exact ID in that store. A missing ID raises `SessionNotFoundError`; it does not create a session.
435
+ - `SessionManager.open(path, sessionDir?, cwdOverride?)` - Open a JSONL file directly, creating it if missing. This is a file API, not the CLI session selector.
436
+ - `SessionManager.continueRecent(cwd, sessionDir?, options?)` or `continueRecent(store, cwd, options?)` - Continue the most recent regular session or create one. Pass `{ includeInternal: true }` only to include workflow sessions.
437
+ - `SessionManager.inMemory(cwd?, options?, entries?)` - Explicit memory storage.
438
+ - `SessionManager.forkFrom(sourcePath, targetCwd, sessionDir?, options?)` - Fork a JSONL file into the configured or explicit destination. To fork a database session, open it by ID and await `manager.forkTo(targetCwd, targetStore?, options?)`.
439
+ - `SessionManager.importFromJsonl(inputPath, cwd, targetStoreOrDir?)` - Import a JSONL export without changing its ID, upgrading older supported formats. An existing ID raises `SessionExistsError`.
435
440
 
436
441
  ### Static Listing Methods
437
442
 
438
- - `SessionManager.list(cwd, sessionDir?, onProgress?, options?)` - List project sessions. Internal workflow sessions are excluded by default; pass `{ includeInternal: true }` to include them and expose their `SessionInfo.workflow` linkage.
439
- - `SessionManager.listAll(sessionDir?, onProgress?, options?)` - List sessions across projects, or from a custom session directory. The same `includeInternal` default and opt-in apply.
443
+ - `SessionManager.list(cwd, storeOrDir?, onProgress?, options?)` - List project sessions. Internal workflow sessions are excluded by default.
444
+ - `SessionManager.listAll(storeOrDir?, onProgress?, options?)` - List sessions across projects in the selected store. Both methods accept `{ includeInternal: true, signal }` to include workflow sessions or cancel listing.
440
445
 
441
- Normal `/resume`, `atomic -r`, and `--continue` callers use the default filtering. Workflow-specific code can opt in without changing user-facing history:
446
+ Use the returned `SessionInfo.id` to select a session. Its `path` contains a JSONL location when available and otherwise the ID; do not treat it as a filesystem path. To list workflow sessions in the active store:
442
447
 
443
448
  ```typescript
444
- const stages = await SessionManager.list(cwd, sessionDir, undefined, { includeInternal: true });
449
+ const stages = await SessionManager.list(cwd, manager.getSessionStore(), undefined, { includeInternal: true });
445
450
  for (const stage of stages.filter((session) => session.internal)) {
446
- console.log(stage.workflow?.runId, stage.workflow?.stageId, stage.path);
451
+ console.log(stage.workflow?.runId, stage.workflow?.stageId, stage.id);
447
452
  }
448
453
  ```
449
454
 
@@ -451,10 +456,11 @@ for (const stage of stages.filter((session) => session.internal)) {
451
456
 
452
457
  - `newSession(options?)` - Start a new session. Options include `parentSession`, `internal`, and workflow run/stage linkage; classification requires a complete marker pair.
453
458
  - `markSessionInternal(workflow?)` - Apply valid workflow ownership to the current session, repairing malformed markers while preserving an existing valid marker.
454
- - `setSessionFile(path)` - Switch to a different session file
455
- - `createBranchedSession(leafId)` - Extract branch to new session file
459
+ - `setSessionFile(path)` - Switch to a JSONL file directly. For ID-based loading, use `SessionManager.open(store, sessionId)` to obtain a new manager.
460
+ - `createBranchedSession(leafId)` - Extract a branch into a new session in the same store
461
+ - `forkTo(cwd, targetStoreOrDir?, options?)` - Copy the conversation into a new session at the destination
456
462
 
457
- ### Instance Methods - Appending (all return entry ID)
463
+ ### Instance Methods - Appending (all return a promise of the entry ID)
458
464
  - `appendMessage(message)` - Add message
459
465
  - `appendThinkingLevelChange(level)` - Record thinking change
460
466
  - `appendContextWindowChange(contextWindow)` - Record context-window selection in tokens
@@ -488,7 +494,8 @@ for (const stage of stages.filter((session) => session.internal)) {
488
494
  - `getSessionName()` - Get display name from latest session_info entry (`undefined` when cleared or never named)
489
495
  - `getSessionNameState()` - Get the name state: `{ hasName: false }` when never named, `{ hasName: true }` when the latest entry cleared it, `{ hasName: true, name }` when currently named
490
496
  - `getCwd()` - Working directory
491
- - `getSessionDir()` - Session storage directory
492
- - `getSessionId()` - Session UUID
493
- - `getSessionFile()` - Session file path (undefined for in-memory)
494
- - `isPersisted()` - Whether session is saved to disk
497
+ - `getSessionDir()` - Local JSONL directory, or an empty string for non-JSONL storage
498
+ - `getSessionId()` - Exact session ID, not necessarily a UUID
499
+ - `getSessionStore()` - Active `SessionStore`
500
+ - `getSessionFile()` - Optional JSONL file location for display
501
+ - `isPersisted()` - Whether the store is not a `MemorySessionStore`
package/docs/sessions.md CHANGED
@@ -8,30 +8,61 @@ This page covers working with sessions: storage, commands, resuming, naming, and
8
8
 
9
9
  ## Session Storage
10
10
 
11
- Sessions auto-save to `~/.atomic/agent/sessions/`, organized by working directory. Each session is a JSONL file with a tree structure.
11
+ Sessions auto-save to the local SQLite database at `~/.atomic/workflows/journal.sqlite`. Workflow runs use the same file, with `session_` and `wf_` table prefixes separating their records. Session history remains a tree regardless of the selected store.
12
12
 
13
- The session picker also scans linked project directories inside this default store, so project aliases or relocated session folders remain discoverable through `/resume` and `atomic -r`.
13
+ To choose another store, set `sessions.storage` in settings. Use shared `storage` to select one database for both sessions and workflow runs. JSONL is available only when explicitly selected. Memory is available through `--no-session`, `{ "memory": true }` in settings, or an explicit SDK option; it is never a fallback for a failed persistent store.
14
+
15
+ Project-local storage settings apply after you approve project trust, including on the first launch. Atomic re-selects storage before saving a new conversation; resumed conversations stay in their original store. Generated resume commands for JSONL sessions include `--session-dir`; keep that option when reopening the conversation, even if the directory was previously the default.
16
+
17
+ For SQLite, resume with `atomic --session-store "/data/project A/sessions.sqlite" --session-prefix project_ --session <id>`.
14
18
 
15
19
  ```bash
16
20
  atomic -c # Continue most recent session
17
21
  atomic -r # Browse and select from past sessions
18
22
  atomic --no-session # Ephemeral mode; do not save
19
23
  atomic --name "my task" # Set session display name at startup
20
- atomic --session <path|id> # Use a file, exact ID, or unique 8-hex UUID prefix
21
- atomic --fork <path|id> # Fork a file, exact ID, or unique 8-hex UUID prefix
24
+ atomic --session <id|prefix> # Use an exact ID or unique 8-hex UUID prefix
25
+ atomic --import <file> # Import a JSONL export into session storage
26
+ atomic --fork <id|prefix> # Fork an exact ID or unique 8-hex UUID prefix
22
27
  ```
23
28
 
24
- Use `/session` in interactive mode to see the current session file, session ID, message count, tokens, and cost. You can use it while a run is active; its totals update after each completed message, not each streaming text chunk. Detailed cost and cache-waste breakdowns are shown after the run finishes only when the available session history matches those totals; otherwise, only the total cost is shown.
29
+ Use `/session` in interactive mode to see the current session ID, message count, tokens, and cost. A JSONL session also has a file location. You can use it while a run is active; its totals update after each completed message, not each streaming text chunk. Detailed cost and cache-waste breakdowns are shown after the run finishes only when the available session history matches those totals; otherwise, only the total cost is shown.
25
30
 
26
31
  For UUID-backed sessions, `--session` and `--fork` accept either the full UUID or exactly eight hexadecimal prefix characters. A prefix must be unique within the current project (or, if no local session matches, across the global session store); collisions list the matching UUIDs and require the full value. Exact custom session IDs keep their existing priority. `--session-id` remains an exact project-local ID used to open or create a session, not a prefix selector.
27
32
 
28
- ### Custom session directories
33
+ Session locations are for display, not selection. Use `--import <file>` or `/import <file>` to copy a JSONL export into the selected store. The session ID and entries are preserved. An ID already present in that store raises `SessionExistsError`; importing never replaces an existing session. Older supported formats are upgraded automatically when opened for import.
34
+
35
+ Use `atomic --no-session --import <file>` to work with an imported conversation without saving it. `--import` cannot be combined with `--session`, `--fork`, `--session-id`, `--continue`, or `--resume`; choose one way to select the conversation. `--session-dir` remains available when importing into a persistent store.
36
+
37
+ Imported IDs are kept verbatim, including an empty ID. Resume an imported empty ID with `atomic --session ""` or choose its row in the session picker. Picker actions stay bound to the selected project's store even when another project uses the same ID.
38
+
39
+ ### Choosing a store
40
+
41
+ ```json
42
+ { "sessions": { "storage": { "dir": "sessions" } } }
43
+ ```
44
+
45
+ This selects JSONL under `~/.atomic/sessions`. Use `{ "path": "sessions.sqlite" }` for another local SQLite file, `{ "memory": true }` for ephemeral sessions, or an adapter selection for a user-installed database driver. The `sessionDir` setting has been removed without an alias.
46
+
47
+ Precedence is SDK `sessionStore`, `--no-session`, `--session-dir <dir>` or `--session-store <path>` (mutually exclusive CLI selections), non-empty `ATOMIC_CODING_AGENT_SESSION_DIR`, `sessions.storage`, shared `storage`, then the default SQLite file. Each selection wins as a whole; project selections replace global ones rather than merging fields. Relative settings paths resolve against Atomic home; CLI paths and environment directories resolve against the working directory. Changing stores selects a different history without migrating sessions; keep the original store to return to it.
29
48
 
30
- Use `--session-dir <dir>`, `ATOMIC_CODING_AGENT_SESSION_DIR`, or the matching settings override to save the active chat outside `~/.atomic/agent/sessions/`.
49
+ `--session-store` cannot be combined with `--session-dir` or `--no-session`. `--session-prefix` requires `--session-store` and defaults to empty, giving `session_` table names. A non-empty prefix is prepended to those names, must match `[A-Za-z_][A-Za-z0-9_]*`, and must not start with `sqlite_` (case-insensitive). Invalid configuration or unavailable storage raises a typed error, never a fallback to another store.
50
+
51
+ Generated SQLite resume hints and Herdr commands always include `--session-store` and include `--session-prefix` when non-empty, regardless of project trust or settings. Keep these flags when reopening the conversation.
52
+
53
+ From the SDK, pass a `SessionStore` or `StorageSelection`:
54
+
55
+ ```ts
56
+ const { session } = await createAgentSession({
57
+ sessionStore: { kind: "sqlite", path: "/data/sessions.sqlite" },
58
+ });
59
+ ```
60
+
61
+ Use `{ kind: "memory" }` for an explicit ephemeral SDK session or `{ kind: "jsonl", dir: "/data/sessions" }` for JSONL. An existing `sessionManager` remains caller-owned and bypasses store selection.
31
62
 
32
63
  Workflows launched from a non-default session directory also save their stage transcripts there. A headless command such as `atomic --mode json --session-dir <dir> -p '/workflow <name> ...'` therefore captures the main and stage transcripts together. An explicit per-stage `sessionDir` overrides the inherited directory.
33
64
 
34
- When the host uses the default session store, stages keep the previous behavior: they write to the global store unless a stage explicitly sets `sessionDir`.
65
+ When the host uses the default store, stages also use the default SQLite database unless they explicitly choose a directory.
35
66
 
36
67
  For the JSONL file format and SessionManager API, see [Session Format](/session-format).
37
68
 
@@ -54,6 +85,8 @@ For the JSONL file format and SessionManager API, see [Session Format](/session-
54
85
 
55
86
  `/resume` opens an interactive session picker for the current project. `atomic -r` opens the same picker at startup.
56
87
 
88
+ Sessions written in formats 1, 2, and 3 appear in the picker and upgrade automatically to format 4 when opened, including with `--continue`, `--session`, or `--fork`. Browsing the picker does not change session files. Opening an older session rewrites only that file; no flag or confirmation is needed.
89
+
57
90
  Resuming restores saved verbatim compaction without another planning request. Older sessions with retired logical-deletion compaction can bring previously hidden content back into context.
58
91
 
59
92
  When you resume at startup with the default tool selection, Atomic restores the tools recorded in the session, including tools activated during the conversation. `--tools +name,-name` modifies that restored selection. Explicit `--tools name,...`, `--no-tools`, and `--no-builtin-tools` keep their requested tool restrictions, and excluded tools stay excluded. Sessions with no recorded tool selection use the current defaults.
@@ -69,11 +102,11 @@ In the picker you can:
69
102
  - rename with CTRL+R
70
103
  - delete with CTRL+D, then confirm
71
104
 
72
- When available, Atomic uses the `trash` CLI for deletion instead of permanently removing files.
105
+ JSONL stores use the `trash` CLI when available. Database stores delete the selected session record, not the database.
73
106
 
74
107
  ### Session summaries
75
108
 
76
- Each row shows a short generated description of what the session was about in its own column, beside the session name or first message, so you can recognize a conversation without opening it. Atomic writes one after the agent goes idle, using the model the session is already configured with, and stores it in the session file as a `session_summary` entry.
109
+ Each row shows a short generated description of what the session was about in its own column, beside the session name or first message, so you can recognize a conversation without opening it. Atomic writes one after the agent goes idle, using the model the session is already configured with, and saves it as a `session_summary` entry in the selected store.
77
110
 
78
111
  A summary describes the conversation up to a specific message and remains visible as newer messages arrive. A later branch summary retires it. "No summary available." means no summary has been generated for the current branch, generation failed, or it is still in flight. The session name and first message are never displaced by a summary, and the column only appears once at least one listed session has a summary. Summaries are also searchable along with the rest of the session text.
79
112
 
@@ -83,9 +116,7 @@ You can search, navigate, or cancel while the picker loads sessions. Closing it
83
116
 
84
117
  ### Internal (workflow) sessions
85
118
 
86
- Sessions created by workflow stage execution are marked as **internal** and are excluded from the standard `/resume`, `atomic -r`, and `--continue` history by default. This keeps the resume picker focused on your interactive coding sessions. Workflow stage sessions remain fully discoverable and resumable through the workflow-specific path: use `/workflow resume <runId>` (or the workflow tool's resume/status actions) to inspect and continue a workflow run and its stages. A workflow stage session can still be opened directly by passing its file path to `--session`.
87
-
88
- Legacy workflow sessions created before this behavior lack the internal marker and will continue to appear in the standard history until they age out or are deleted.
119
+ Sessions created by workflow stage execution are marked as **internal** and are excluded from the standard `/resume`, `atomic -r`, and `--continue` history by default. Use `/workflow resume <runId>` or the workflow tool's resume/status actions to inspect and continue a workflow run and its stages. A workflow stage session can also be opened directly by passing its session ID to `--session`.
89
120
 
90
121
  ## Naming Sessions
91
122
 
@@ -106,7 +137,7 @@ Named sessions are easier to find in `/resume` and `atomic -r`.
106
137
 
107
138
  ## Branching with `/tree`
108
139
 
109
- Sessions are stored as trees. Every entry has an `id` and `parentId`, and the current position is the active leaf. `/tree` lets you jump to any previous point and continue from there without creating a new file.
140
+ Sessions are stored as trees. Every entry has an `id` and `parentId`, and the current position is the active leaf. `/tree` lets you jump to any previous point and continue from there without creating a new session.
110
141
 
111
142
  <p align="center"><img src="images/tree-view.png" alt="Tree View" width="600" /></p>
112
143
 
@@ -137,6 +168,8 @@ Example shape:
137
168
 
138
169
  Filter modes are: default, no-tools, user-only, labeled-only, and all. Configure the default with `treeFilterMode` in [Settings](/settings).
139
170
 
171
+ Label edits are saved before the tree is updated. While a save is pending, the label editor stays open. If saving fails, Atomic displays the error and keeps your text so you can retry with Enter or cancel with Escape.
172
+
140
173
  ### Selection Behavior
141
174
 
142
175
  Selecting a user or custom message:
@@ -157,12 +190,12 @@ Selecting the root user message resets the leaf to an empty conversation and pla
157
190
 
158
191
  | Feature | `/tree` | `/fork` | `/clone` |
159
192
  |---------|---------|---------|----------|
160
- | Output | Same session file | New session file | New session file |
193
+ | Output | Same session | New session | New session |
161
194
  | View | Full tree | User-message selector | Current active branch |
162
195
  | Typical use | Explore alternatives in place | Start a new session from an earlier prompt | Duplicate current work before continuing |
163
196
  | Summary | Optional branch summary | None | None |
164
197
 
165
- Use `/tree` when you want to keep alternatives together. Use `/fork` or `/clone` when you want a separate session file.
198
+ Use `/tree` when you want to keep alternatives together. Use `/fork` or `/clone` when you want a separate session.
166
199
 
167
200
  ## Branch Summaries
168
201
 
@@ -172,6 +205,6 @@ Moved to [Compaction & Branch Summarization](/compaction#branch-summaries).
172
205
 
173
206
  ## Session Format
174
207
 
175
- Session files are JSONL and contain message entries, model changes, thinking-level changes, context-window changes, labels, active verbatim `compaction` boundaries, branch summaries, and extension entries. Retired `context_compaction` and non-verbatim `compaction` records remain parseable but inert.
208
+ Sessions contain message entries, model changes, thinking-level changes, context-window changes, labels, active verbatim `compaction` boundaries, branch summaries, and extension entries. Explicit JSONL stores and exports serialize those entries as JSONL. Retired `context_compaction` and non-verbatim `compaction` records remain parseable but inert.
176
209
 
177
210
  For parsers, extensions, SDK usage, and the full SessionManager API, see [Session Format](/session-format).
package/docs/settings.md CHANGED
@@ -280,7 +280,7 @@ On a genuine first run, Atomic previews available themes and asks whether to opt
280
280
  | Setting | Type | Default | Description |
281
281
  |---------|------|---------|-------------|
282
282
  | `compaction.enabled` | boolean | `true` | Enable automatic verbatim line compaction |
283
- | `compaction.reserveTokens` | number | `16384` | Tokens reserved for the next model response; automatic threshold compaction begins before this reserve is consumed |
283
+ | `compaction.reserveTokens` | number | `16384` | Free context tokens below which automatic compaction starts; does not limit summary output |
284
284
  | `compaction.compression_ratio` | number | `0.5` | Fraction of compactable transcript **lines to keep** (`0 < value < 1`) |
285
285
  | `compaction.preserve_recent` | number | `2` | Exact number of newest context-visible messages kept outside the compactable region; `0` keeps none |
286
286
  | `compaction.query` | string | last user message | Optional relevance focus for selecting older lines to retain |
@@ -323,7 +323,7 @@ Both fields must be non-negative safe integers, including ordinary settings. Inv
323
323
 
324
324
  | Setting | Type | Default | Description |
325
325
  |---------|------|---------|-------------|
326
- | `branchSummary.reserveTokens` | number | `16384` | Tokens reserved when selecting branch history; output is capped at 4096 tokens |
326
+ | `branchSummary.reserveTokens` | number | `16384` | Tokens reserved when selecting branch history; the provider sizes summary output |
327
327
  | `branchSummary.skipPrompt` | boolean | `false` | Skip "Summarize branch?" prompt on `/tree` navigation (defaults to no summary) |
328
328
 
329
329
  ### Session Summary
@@ -500,13 +500,20 @@ Plain names establish a replacement list before its modifiers apply. A project l
500
500
 
501
501
  | Setting | Type | Default | Description |
502
502
  |---------|------|---------|-------------|
503
- | `sessionDir` | string | - | Directory where session files are stored. Accepts absolute or relative paths, plus `~`. |
503
+ | `sessions.storage` | object | Local SQLite | Session-only storage selection: `{ "path": "..." }`, `{ "dir": "..." }`, `{ "memory": true }`, or `{ "adapter": "...", "options": {}, "secrets": {}, "prefix": "..." }`. |
504
+ | `storage` | object | Local SQLite | Shared selection for sessions and workflow runs. Accepts the same forms except `dir`. |
504
505
 
505
506
  ```json
506
- { "sessionDir": ".atomic/sessions" }
507
+ { "sessions": { "storage": { "path": "sessions.sqlite" } } }
507
508
  ```
508
509
 
509
- When multiple sources specify a session directory, precedence is `--session-dir`, `ATOMIC_CODING_AGENT_SESSION_DIR`, then `sessionDir` in settings.json.
510
+ Without configuration, sessions and workflow runs share `~/.atomic/workflows/journal.sqlite`. Session tables use `session_` names; workflow tables use `wf_` names. If `ATOMIC_CODING_AGENT_DIR` changes the agent directory, this default is `workflows/journal.sqlite` under its parent. JSONL is opt-in through `dir`, `--session-dir`, or `ATOMIC_CODING_AGENT_SESSION_DIR`. The `sessionDir` setting has been removed; use `sessions.storage.dir` instead.
511
+
512
+ Session precedence is SDK `sessionStore`, `--no-session`, `--session-dir` or `--session-store` (mutually exclusive CLI selections), non-empty `ATOMIC_CODING_AGENT_SESSION_DIR`, `sessions.storage`, shared `storage`, then the default SQLite file. Empty environment values are ignored. Project selections replace global selections as whole objects, including options, secrets and prefix; fields are never merged. A present empty `sessions.storage` selects the default session database rather than inheriting `storage`. Relative settings paths resolve against Atomic home, normally `~/.atomic`. CLI paths and environment directories resolve against the working directory.
513
+
514
+ See [Choosing a store](/sessions#choosing-a-store) for CLI selection, prefix rules, and conflicts.
515
+
516
+ Only the selected source is validated; invalid lower-precedence selections do not block an explicit override. Memory must be selected explicitly and is lost on exit. Invalid selected configuration raises `StorageConfigError`, whose `source`, `field`, and `reason` identify the problem. If a selected store cannot open, Atomic raises a typed storage error rather than falling back to memory. See [Sessions](/sessions#session-storage) and [Storage errors](/storage#storage-errors).
510
517
 
511
518
  ### Models
512
519
 
@@ -555,9 +562,39 @@ Arrays support glob patterns and exclusions. Use `!pattern` to exclude. Use `+pa
555
562
 
556
563
  #### Workflow storage
557
564
 
558
- Workflow runs use a local SQLite journal at `~/.atomic/workflows/journal.sqlite`. Set `ATOMIC_WORKFLOW_JOURNAL_PATH` before starting Atomic to choose another file. Keep the journal on durable local storage and preserve it when upgrading or restarting. Changing the path selects a different run history; use the original journal to inspect or resume existing runs.
565
+ Workflow runs use a SQLite journal, by default the local file `~/.atomic/workflows/journal.sqlite`. Set `workflows.journal.path` in `settings.json` to choose another file:
566
+
567
+ ```json
568
+ {
569
+ "workflows": {
570
+ "paths": ["./workflows"],
571
+ "journal": { "path": "workflows/project.sqlite" }
572
+ }
573
+ }
574
+ ```
575
+
576
+ Relative settings paths resolve against the Atomic home directory, normally `~/.atomic`, not the project directory. Precedence is SDK `RunOpts.journal`, non-empty `ATOMIC_WORKFLOW_JOURNAL_PATH`, `workflows.journal`, shared top-level `storage`, then the default journal file. An empty environment variable is ignored. A present empty journal block selects the journal default rather than inheriting shared storage.
577
+
578
+ To keep workflow records only in memory, set `"journal": { "memory": true }`. Do not combine `memory: true` with a non-empty `path`. Memory must be selected explicitly and cannot recover runs after the process exits; an environment path still takes precedence over this setting.
579
+
580
+ Project `workflows.journal` and `storage` each replace their global selection as a whole, including options, secrets, and prefix. For example, a project can select `{ "memory": true }` over a global path. Invalid selected settings raise `StorageConfigError` instead of trying a lower-precedence selection. Combining `memory: true` with a non-empty `path` is an error.
581
+
582
+ To use your own database driver, install an adapter module and select it by module specifier:
583
+
584
+ ```json
585
+ {
586
+ "storage": {
587
+ "adapter": "@example/atomic-sqlite",
588
+ "options": { "url": "libsql://database.example" },
589
+ "secrets": { "authToken": { "env": "DATABASE_TOKEN" } },
590
+ "prefix": "project_"
591
+ }
592
+ }
593
+ ```
594
+
595
+ The shared `storage` setting supplies defaults for both sessions and the journal. Use `sessions.storage` or `workflows.journal` for a domain-only override. A shared empty selection uses `~/.atomic/storage.sqlite`. Atomic bundles no remote driver. Adapter modules execute code, so review them before trusting project settings. Secret references accept `{ "env": "VARIABLE" }` or `{ "file": "token.txt" }`; relative secret files resolve against Atomic home and their contents are passed verbatim. See [Storage adapters](/storage#selecting-an-adapter).
559
596
 
560
- Configure workflow resource paths with `workflows: ["./workflows"]` or `workflows: { "paths": ["./workflows"] }`. Storage does not require a separate server or connection settings. If the journal cannot be opened or written, the workflow action fails rather than switching to non-durable execution. Restore filesystem access and inspect the retained run before retrying. See [Durable workflows](/workflows/operations#durable-workflows-and-cross-session-resume).
597
+ Changing the journal selects a different run history. Preserve the original file to inspect or resume its runs. The default local file needs no separate server; a remote database requires an adapter, and every host that shares runs must select the same database and prefix. See [Sharing storage across hosts](/storage#sharing-storage-across-hosts). If the selected journal cannot be opened or written, the action fails with a typed storage error rather than selecting memory. Restore access to the store and inspect the retained run before retrying. See [Durable workflows](/workflows/operations#durable-workflows-and-cross-session-resume).
561
598
 
562
599
  #### packages
563
600