@bastani/atomic 0.10.14 → 0.10.15-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (341) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/_shared/dist-KOELCESV.js +2 -2
  3. package/dist/_shared/fork-row-index-UAUAQRD5.js +2 -2
  4. package/dist/_shared/lib-4PES5P4V.js +2 -2
  5. package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js +3 -3
  6. package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +3 -3
  7. package/dist/_shared/mode-shared-2QJSCUM6.js +3 -3
  8. package/dist/_shared/p1a-prewarm-XIU57JHF.js +3 -3
  9. package/dist/_shared/runtime-O4KCSG4C.js +2 -2
  10. package/dist/_shared/{sdk-B5LEWGGI.js → sdk-OHKMDJ74.js} +27 -5
  11. package/dist/_shared/{sdk-B5LEWGGI.js.map → sdk-OHKMDJ74.js.map} +1 -1
  12. package/dist/_shared/session-data-AHTU7IS6.js +2 -2
  13. package/dist/_shared/startup-0-0-Q3MWKUK4.js +2 -2
  14. package/dist/_shared/startup-0-1-M6OWAYHH.js +2 -2
  15. package/dist/_shared/{startup-0-2-5QHPCEON.js → startup-0-2-2HUMCPKX.js} +14 -16
  16. package/dist/_shared/startup-0-2-2HUMCPKX.js.map +1 -0
  17. package/dist/_shared/startup-0-3-4ZYBYQNM.js +3 -3
  18. package/dist/_shared/startup-0-4-ZMJV547D.js +3 -3
  19. package/dist/_shared/startup-0-5-YDW47QX6.js +3 -3
  20. package/dist/_shared/startup-10-0-TDQNBDDL.js +3 -3
  21. package/dist/_shared/startup-14-0-MLX36RBG.js +1 -1
  22. package/dist/_shared/startup-15-0-YUKGAC63.js +1 -1
  23. package/dist/_shared/startup-15-1-4S7FLMNG.js +6 -30
  24. package/dist/_shared/startup-15-1-4S7FLMNG.js.map +1 -1
  25. package/dist/_shared/startup-8-0-34CBHPZH.js +3 -3
  26. package/dist/_shared/startup-8-1-LZFXSD3Z.js +3 -3
  27. package/dist/_shared/storage-command-7MGXLJGZ.js +2 -2
  28. package/dist/_shared/storage-status-K7PX2RXA.js +3 -3
  29. package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +2 -2
  30. package/dist/_shared/tree-outline-MUEPK5B7.js +2 -2
  31. package/dist/builtin/intercom/index.bundle.mjs +1 -1
  32. package/dist/builtin/intercom/package.json +1 -1
  33. package/dist/builtin/mcp/index.bundle.mjs +1 -1
  34. package/dist/builtin/mcp/package.json +1 -1
  35. package/dist/builtin/subagents/package.json +1 -1
  36. package/dist/builtin/subagents/src/extension/index.bundle.mjs +1 -1
  37. package/dist/builtin/web-access/index.bundle.mjs +1 -1
  38. package/dist/builtin/web-access/package.json +1 -1
  39. package/dist/cli/auth-cli.code.js +1 -1
  40. package/dist/cli/auth-cli.impl.js +3 -3
  41. package/dist/cli/auth-cli.js +3 -3
  42. package/dist/cli/blueprint-command.impl.js +3 -3
  43. package/dist/cli/blueprint-command.js +3 -3
  44. package/dist/cli/intercom-command.code.js +3 -3
  45. package/dist/cli/intercom-command.impl.js +3 -3
  46. package/dist/cli/intercom-command.js +3 -3
  47. package/dist/cli/list-models.impl.js +3 -3
  48. package/dist/cli/list-models.js +3 -3
  49. package/dist/cli/session-picker.code.js +1 -1
  50. package/dist/cli/session-picker.impl.js +3 -3
  51. package/dist/cli/session-picker.js +3 -3
  52. package/dist/cli/startup-ui.code.js +1 -1
  53. package/dist/cli/startup-ui.impl.js +3 -3
  54. package/dist/cli/startup-ui.js +3 -3
  55. package/dist/cli/storage-command.impl.js +3 -3
  56. package/dist/cli/storage-command.js +3 -3
  57. package/dist/cli/storage-search-session.code.js +1 -1
  58. package/dist/cli/storage-search-session.impl.js +3 -3
  59. package/dist/cli/storage-search-session.js +3 -3
  60. package/dist/cli/team-command.code.js +1 -1
  61. package/dist/cli/team-command.impl.js +3 -3
  62. package/dist/cli/team-command.js +3 -3
  63. package/dist/cli.js +2 -2
  64. package/dist/core/compaction/compactor.d.ts +0 -8
  65. package/dist/core/debug.impl.js +3 -3
  66. package/dist/core/debug.js +3 -3
  67. package/dist/core/export-html/card-projection.impl.js +3 -3
  68. package/dist/core/export-html/card-projection.js +3 -3
  69. package/dist/core/export-html/index.code.js +2 -2
  70. package/dist/core/export-html/index.impl.js +3 -3
  71. package/dist/core/export-html/index.js +3 -3
  72. package/dist/core/export-html/json-spans.impl.js +3 -3
  73. package/dist/core/export-html/json-spans.js +3 -3
  74. package/dist/core/export-html/oversized-render-inputs.impl.js +3 -3
  75. package/dist/core/export-html/oversized-render-inputs.js +3 -3
  76. package/dist/core/export-html/tool-renderer.impl.js +3 -3
  77. package/dist/core/export-html/tool-renderer.js +3 -3
  78. package/dist/core/extensions/jiti-loader.impl.js +3 -3
  79. package/dist/core/extensions/jiti-loader.js +3 -3
  80. package/dist/core/extensions/jiti-static-loader.impl.js +3 -3
  81. package/dist/core/extensions/jiti-static-loader.js +3 -3
  82. package/dist/core/extensions/loader-host-modules.impl.js +3 -3
  83. package/dist/core/extensions/loader-host-modules.js +3 -3
  84. package/dist/core/intercom-broker-control-host.code.js +1 -1
  85. package/dist/core/intercom-broker-control-host.impl.js +3 -3
  86. package/dist/core/intercom-broker-control-host.js +3 -3
  87. package/dist/core/intercom-broker-control.code.js +2 -2
  88. package/dist/core/intercom-broker-control.impl.js +3 -3
  89. package/dist/core/intercom-broker-control.js +3 -3
  90. package/dist/core/package-manager-storage-adapters.impl.js +3 -3
  91. package/dist/core/package-manager-storage-adapters.js +3 -3
  92. package/dist/core/sdk.code.js +1 -1
  93. package/dist/core/sdk.impl.js +3 -3
  94. package/dist/core/sdk.js +3 -3
  95. package/dist/core/session-manager-core.js +3 -3
  96. package/dist/core/session-manager-list.impl.js +3 -3
  97. package/dist/core/session-manager-list.js +3 -3
  98. package/dist/core/session-manager.impl.js +3 -3
  99. package/dist/core/session-manager.js +3 -3
  100. package/dist/core/session-storage.impl.js +3 -3
  101. package/dist/core/session-storage.js +3 -3
  102. package/dist/core/storage/index.js +2 -2
  103. package/dist/core/storage/node-sqlite-thread.js +2 -2
  104. package/dist/core/storage/node-sqlite.js +2 -2
  105. package/dist/core/storage/offline-snapshot-file.impl.js +3 -3
  106. package/dist/core/storage/offline-snapshot-file.js +3 -3
  107. package/dist/core/storage/provider.js +2 -2
  108. package/dist/core/storage/selection.js +2 -2
  109. package/dist/core/storage/session/branch-fork-source.code.js +2 -2
  110. package/dist/core/storage/session/branch-fork-source.impl.js +3 -3
  111. package/dist/core/storage/session/branch-fork-source.js +3 -3
  112. package/dist/core/storage/session/card-view.impl.js +3 -3
  113. package/dist/core/storage/session/card-view.js +3 -3
  114. package/dist/core/storage/session/child-reader.code.js +2 -2
  115. package/dist/core/storage/session/child-reader.impl.js +3 -3
  116. package/dist/core/storage/session/child-reader.js +3 -3
  117. package/dist/core/storage/session/chunked-resume-projection.impl.js +3 -3
  118. package/dist/core/storage/session/chunked-resume-projection.js +3 -3
  119. package/dist/core/storage/session/expanded-child-details.code.js +2 -2
  120. package/dist/core/storage/session/expanded-child-details.impl.js +3 -3
  121. package/dist/core/storage/session/expanded-child-details.js +3 -3
  122. package/dist/core/storage/session/fork-row-bytes.impl.js +3 -3
  123. package/dist/core/storage/session/fork-row-bytes.js +3 -3
  124. package/dist/core/storage/session/fork-row-index.impl.js +3 -3
  125. package/dist/core/storage/session/fork-row-index.js +3 -3
  126. package/dist/core/storage/session/fork-staging.code.js +1 -1
  127. package/dist/core/storage/session/fork-staging.impl.js +3 -3
  128. package/dist/core/storage/session/fork-staging.js +3 -3
  129. package/dist/core/storage/session/fork-window.code.js +2 -2
  130. package/dist/core/storage/session/fork-window.impl.js +3 -3
  131. package/dist/core/storage/session/fork-window.js +3 -3
  132. package/dist/core/storage/session/history-pages.impl.js +3 -3
  133. package/dist/core/storage/session/history-pages.js +3 -3
  134. package/dist/core/storage/session/jsonl-entry-projection.impl.js +3 -3
  135. package/dist/core/storage/session/jsonl-entry-projection.js +3 -3
  136. package/dist/core/storage/session/jsonl-session-store.impl.js +3 -3
  137. package/dist/core/storage/session/jsonl-session-store.js +3 -3
  138. package/dist/core/storage/session/memory-session-store.impl.js +3 -3
  139. package/dist/core/storage/session/memory-session-store.js +3 -3
  140. package/dist/core/storage/session/pinned-branch-resume.code.js +2 -2
  141. package/dist/core/storage/session/pinned-branch-resume.impl.js +3 -3
  142. package/dist/core/storage/session/pinned-branch-resume.js +3 -3
  143. package/dist/core/storage/session/released-history-files.code.js +1 -1
  144. package/dist/core/storage/session/released-history-files.impl.js +3 -3
  145. package/dist/core/storage/session/released-history-files.js +3 -3
  146. package/dist/core/storage/session/resident-fork-rows.impl.js +3 -3
  147. package/dist/core/storage/session/resident-fork-rows.js +3 -3
  148. package/dist/core/storage/session/session-resume.impl.js +3 -3
  149. package/dist/core/storage/session/session-resume.js +3 -3
  150. package/dist/core/storage/session/snapshot-cut.impl.js +3 -3
  151. package/dist/core/storage/session/snapshot-cut.js +3 -3
  152. package/dist/core/storage/session/snapshot-history.code.js +2 -2
  153. package/dist/core/storage/session/snapshot-history.impl.js +3 -3
  154. package/dist/core/storage/session/snapshot-history.js +3 -3
  155. package/dist/core/storage/session/sql-session-store.code.js +1 -1
  156. package/dist/core/storage/session/sql-session-store.impl.js +3 -3
  157. package/dist/core/storage/session/sql-session-store.js +3 -3
  158. package/dist/core/storage/session/tree-outline.impl.js +3 -3
  159. package/dist/core/storage/session/tree-outline.js +3 -3
  160. package/dist/core/storage/session/tree-presentation.impl.js +3 -3
  161. package/dist/core/storage/session/tree-presentation.js +3 -3
  162. package/dist/core/storage/storage-status.impl.js +3 -3
  163. package/dist/core/storage/storage-status.js +3 -3
  164. package/dist/core/storage/team.impl.js +3 -3
  165. package/dist/core/storage/team.js +3 -3
  166. package/dist/core/structured-output/index.code.js +1 -1
  167. package/dist/core/structured-output/index.impl.js +3 -3
  168. package/dist/core/structured-output/index.js +3 -3
  169. package/dist/core/tasks/task-completion-entry.impl.js +3 -3
  170. package/dist/core/tasks/task-completion-entry.js +3 -3
  171. package/dist/core/tasks/task-file-history.code.js +2 -2
  172. package/dist/core/tasks/task-file-history.impl.js +3 -3
  173. package/dist/core/tasks/task-file-history.js +3 -3
  174. package/dist/core/tasks/task-reference-archive.code.js +2 -2
  175. package/dist/core/tasks/task-reference-archive.js +3 -3
  176. package/dist/core/tasks/task-reference-identity.js +3 -3
  177. package/dist/core/tasks/task-reference-stream.impl.js +3 -3
  178. package/dist/core/tasks/task-reference-stream.js +3 -3
  179. package/dist/core/tasks/task-unsaved-answer.impl.js +3 -3
  180. package/dist/core/tasks/task-unsaved-answer.js +3 -3
  181. package/dist/core/tasks/task-view-source.impl.js +3 -3
  182. package/dist/core/tasks/task-view-source.js +3 -3
  183. package/dist/core/tools/read-url.impl.js +3 -3
  184. package/dist/core/tools/read-url.js +3 -3
  185. package/dist/core/worktree-snapshot/blob-store.js +2 -2
  186. package/dist/core/worktree-snapshot/errors.code.js +1 -1
  187. package/dist/core/worktree-snapshot/errors.impl.js +3 -3
  188. package/dist/core/worktree-snapshot/errors.js +3 -3
  189. package/dist/core/worktree-snapshot/session-index-reset.impl.js +3 -3
  190. package/dist/core/worktree-snapshot/session-index-reset.js +3 -3
  191. package/dist/extensions/codemode/execute.impl.js +3 -3
  192. package/dist/extensions/codemode/execute.js +3 -3
  193. package/dist/extensions/codemode/renderer.impl.js +3 -3
  194. package/dist/extensions/codemode/renderer.js +3 -3
  195. package/dist/extensions/mcp/cli.code.js +1 -1
  196. package/dist/extensions/mcp/cli.impl.js +3 -3
  197. package/dist/extensions/mcp/cli.js +3 -3
  198. package/dist/extensions/mcp/cli.lazy.code.js +2 -2
  199. package/dist/extensions/mcp/cli.lazy.impl.js +3 -3
  200. package/dist/extensions/mcp/cli.lazy.js +3 -3
  201. package/dist/extensions/mcp/runtime.code.js +1 -1
  202. package/dist/extensions/mcp/runtime.impl.js +3 -3
  203. package/dist/extensions/mcp/runtime.js +3 -3
  204. package/dist/index.d.ts +21 -1
  205. package/dist/index.js +2 -2
  206. package/dist/main-first-time-setup.code.js +1 -1
  207. package/dist/main-first-time-setup.impl.js +3 -3
  208. package/dist/main-first-time-setup.js +3 -3
  209. package/dist/modes/interactive/components/stored-tree-view.code.js +2 -2
  210. package/dist/modes/interactive/components/stored-tree-view.impl.js +3 -3
  211. package/dist/modes/interactive/components/stored-tree-view.js +3 -3
  212. package/dist/modes/interactive/components/user-message-selector-archive.impl.js +3 -3
  213. package/dist/modes/interactive/components/user-message-selector-archive.js +3 -3
  214. package/dist/modes/print-mode.js +1 -1
  215. package/dist/package-manager-cli.code.js +2 -2
  216. package/dist/package-manager-cli.impl.js +3 -3
  217. package/dist/package-manager-cli.js +3 -3
  218. package/dist/startup-files.json +1 -1
  219. package/dist/startup-stages/6.js +1 -1
  220. package/dist/utils/startup-database-spare.code.js +1 -1
  221. package/dist/utils/startup-database-spare.impl.js +3 -3
  222. package/dist/utils/startup-database-spare.js +3 -3
  223. package/dist/utils/tools-manager.impl.js +3 -3
  224. package/dist/utils/tools-manager.js +3 -3
  225. package/docs/background-tasks/reference.md +182 -0
  226. package/docs/background-tasks.md +98 -405
  227. package/docs/build.md +67 -27
  228. package/docs/changelog.mdx +1 -1
  229. package/docs/codemode.md +108 -39
  230. package/docs/compaction/branch-summaries.md +54 -0
  231. package/docs/compaction/custom-compactors.md +161 -0
  232. package/docs/compaction/memory-compaction.md +77 -0
  233. package/docs/compaction/reference.md +86 -38
  234. package/docs/compaction.md +51 -252
  235. package/docs/computer-use.md +169 -321
  236. package/docs/containerization.md +71 -57
  237. package/docs/custom-provider/api-reference.md +119 -25
  238. package/docs/custom-provider/oauth.md +114 -132
  239. package/docs/custom-provider/override.md +37 -27
  240. package/docs/custom-provider/registration.md +107 -83
  241. package/docs/custom-provider/streaming.md +85 -71
  242. package/docs/custom-provider.md +85 -52
  243. package/docs/development.md +39 -29
  244. package/docs/docs.json +76 -63
  245. package/docs/environment-variables.md +94 -44
  246. package/docs/extensions/api-reference.md +86 -43
  247. package/docs/extensions/authoring.md +162 -154
  248. package/docs/extensions/events.md +80 -25
  249. package/docs/extensions/examples.md +90 -85
  250. package/docs/extensions/ui.md +206 -82
  251. package/docs/extensions.md +79 -108
  252. package/docs/getting-started/authentication.md +67 -36
  253. package/docs/getting-started/first-session.md +53 -43
  254. package/docs/getting-started/installation.md +116 -89
  255. package/docs/getting-started/project-instructions.md +48 -34
  256. package/docs/guides/configuration.md +82 -20
  257. package/docs/guides/non-interactive.md +66 -24
  258. package/docs/guides/resume-on-any-machine.md +135 -82
  259. package/docs/guides/team-setup.md +114 -105
  260. package/docs/guides.md +76 -32
  261. package/docs/herdr.md +15 -16
  262. package/docs/how-atomic-works.md +140 -0
  263. package/docs/index.md +58 -44
  264. package/docs/intercom/operations.md +141 -151
  265. package/docs/intercom/reference.md +85 -108
  266. package/docs/intercom.md +84 -145
  267. package/docs/json.md +120 -67
  268. package/docs/keybindings.md +85 -49
  269. package/docs/libraries/agent-core.md +137 -275
  270. package/docs/libraries/ai.md +100 -84
  271. package/docs/libraries/codemode.md +210 -300
  272. package/docs/libraries/schema.md +59 -53
  273. package/docs/libraries/storage-postgres.md +49 -35
  274. package/docs/libraries/telemetry.md +153 -354
  275. package/docs/libraries/tui.md +265 -393
  276. package/docs/libraries.md +42 -26
  277. package/docs/llama-cpp.md +171 -161
  278. package/docs/mcp-servers.md +90 -51
  279. package/docs/models/choose-a-model.md +188 -0
  280. package/docs/models/reference.md +74 -30
  281. package/docs/models.md +153 -88
  282. package/docs/orchestration/migrating-workflows.md +23 -16
  283. package/docs/orchestration/patterns.md +39 -44
  284. package/docs/orchestration.md +65 -26
  285. package/docs/packages/authoring.md +51 -29
  286. package/docs/packages/reference.md +42 -21
  287. package/docs/packages.md +69 -58
  288. package/docs/programmatic.md +118 -24
  289. package/docs/prompt-templates.md +84 -83
  290. package/docs/providers/reference.md +43 -48
  291. package/docs/providers.md +219 -451
  292. package/docs/quickstart.md +140 -120
  293. package/docs/reference/cli.md +135 -97
  294. package/docs/reference.md +20 -18
  295. package/docs/rpc/examples.md +76 -20
  296. package/docs/rpc/extension-ui.md +64 -38
  297. package/docs/rpc/protocol.md +361 -110
  298. package/docs/rpc.md +57 -17
  299. package/docs/sdk/reference.md +409 -534
  300. package/docs/sdk/storage.md +53 -13
  301. package/docs/sdk/structured-decisions.md +82 -56
  302. package/docs/sdk/web-server.md +57 -43
  303. package/docs/sdk.md +106 -84
  304. package/docs/security.md +42 -64
  305. package/docs/session-format.md +62 -38
  306. package/docs/sessions.md +99 -214
  307. package/docs/settings.md +165 -195
  308. package/docs/shell-aliases.md +9 -6
  309. package/docs/skills/authoring.md +69 -48
  310. package/docs/skills/reference.md +51 -20
  311. package/docs/skills.md +99 -148
  312. package/docs/slash-commands.md +129 -0
  313. package/docs/storage/custom-adapters.md +160 -85
  314. package/docs/storage/jsonl.md +81 -66
  315. package/docs/storage/postgres/pgbouncer.md +120 -126
  316. package/docs/storage/postgres/tuning.md +120 -143
  317. package/docs/storage/postgres.md +314 -330
  318. package/docs/storage/sqlite.md +71 -42
  319. package/docs/storage.md +298 -302
  320. package/docs/subagents/authoring.md +55 -38
  321. package/docs/subagents/reference.md +73 -33
  322. package/docs/subagents.md +119 -187
  323. package/docs/terminal-setup.md +50 -38
  324. package/docs/termux.md +67 -41
  325. package/docs/themes/reference.md +23 -19
  326. package/docs/themes.md +142 -127
  327. package/docs/tmux.md +47 -55
  328. package/docs/tools.md +147 -109
  329. package/docs/tui/reference.md +166 -214
  330. package/docs/tui.md +196 -341
  331. package/docs/usage.md +118 -138
  332. package/docs/verification.md +79 -51
  333. package/docs/web-access.md +121 -101
  334. package/docs/windows.md +26 -27
  335. package/docs/worktree-snapshots/reference.md +245 -0
  336. package/docs/worktree-snapshots.md +71 -259
  337. package/package.json +8 -8
  338. package/dist/_shared/startup-0-2-5QHPCEON.js.map +0 -1
  339. package/docs/guides/intercom.md +0 -32
  340. package/docs/guides/orchestration.md +0 -28
  341. package/docs/guides/subagents.md +0 -37
@@ -1,156 +1,85 @@
1
1
  ---
2
- title: "Worktree snapshots"
2
+ title: "Save and restore worktree snapshots"
3
3
  sidebarTitle: "Worktree snapshots"
4
- description: "How Atomic automatically saves and restores Git checkout state, handles exclusions and partial restores, and cleans up old worktrees."
4
+ description: "How Atomic automatically saves and restores Git checkout state, excludes secrets, handles partial restores, and cleans up old worktrees."
5
5
  ---
6
6
 
7
- Atomic records the state of each Git checkout a session modifies. You can resume a session on another machine, or after a local checkout is deleted or reset, with the same repository files.
7
+ Atomic automatically records the state of every Git checkout a session modifies. When you resume on another machine—or after a local checkout is deleted, reset, or moved—Atomic restores the exact repository files without touching your existing checkouts.
8
8
 
9
- For cross-machine setup, shared storage, and environment blueprints, see [Resume sessions on any machine](/guides/resume-on-any-machine).
9
+ <Columns cols={2}>
10
+ <Card title="Resume on any machine" href="/guides/resume-on-any-machine">
11
+ Share a PostgreSQL store across machines and rebuild dependencies with environment blueprints.
12
+ </Card>
13
+ <Card title="Worktree snapshots reference" href="/worktree-snapshots/reference">
14
+ SDK capture and restore APIs, WorkspaceError classes, 25-file environment hash list, leases, and garbage collection.
15
+ </Card>
16
+ </Columns>
10
17
 
11
- ## What a snapshot holds
18
+ ## What snapshots save and when they run
12
19
 
13
- For each repository root a session changes, a snapshot records:
20
+ Snapshots require a Git checkout with at least one commit and a SQL database store (local SQLite by default, or shared PostgreSQL; see [Storage](/storage)). Directories outside Git repositories, JSONL directories, and in-memory sessions do not capture snapshots.
14
21
 
15
- - `root`: the checkout path on the recording machine (informational).
16
- - `remotes`: configured remote fetch URLs with embedded credentials stripped.
17
- - `branch` and `head`: the active branch name (or `null` when detached) and `HEAD` commit.
18
- - `tree`: the Git tree of the working copy, built through a private index so your own index, branch, and files stay untouched.
19
- - A patch chain: a binary delta against `head`, followed by incremental deltas against earlier snapshots, restarting from `head` every `snapshots.fullEvery` snapshots (default `10`) or when `HEAD` changes.
20
- - A bundle of commits reachable from `HEAD` but not from any remote-tracking ref, so unpushed commits travel with the session.
21
- - `omitted`: paths or commits left out of the snapshot and why.
22
- - `filters`: conversion settings on the recording host (`core.autocrlf`, `core.eol`, and `.gitattributes` filter drivers such as Git LFS).
23
- - `envHash`: a SHA-256 hash of these 24 root-relative lockfiles and toolchain files to detect when dependencies need rebuilding: `.devcontainer.json`, `.devcontainer/Dockerfile`, `.devcontainer/devcontainer.json`, `.mise.toml`, `.node-version`, `.nvmrc`, `.python-version`, `.tool-versions`, `Cargo.lock`, `Gemfile.lock`, `Pipfile.lock`, `bun.lock`, `bun.lockb`, `composer.lock`, `flake.lock`, `go.sum`, `mise.toml`, `npm-shrinkwrap.json`, `package-lock.json`, `pnpm-lock.yaml`, `poetry.lock`, `rust-toolchain`, `rust-toolchain.toml`, `uv.lock`, and `yarn.lock`. Other files such as `requirements.txt`, `build.gradle`, and `pom.xml` are not included in `envHash`.
22
+ At the end of any turn that runs `bash`, `edit`, `write`, `powershell`, or an extension tool that writes files, Atomic captures the session's working directory and any checkout modified by `edit` or `write`:
24
23
 
25
- Patches and bundles are stored once by content hash in the session's database (`snapshot_blobs` table). Payloads over 1 MiB split into rows of at most 1 MiB, so every SQL backend supports files up to `snapshots.maxFileBytes` (default 5 MiB). Machines sharing one database read the same blobs automatically.
24
+ - **Working tree and branch state.** Your branch, `HEAD` commit, and full working tree are captured through a private Git index so your own staging area, branch, and files are never altered.
25
+ - **Unpushed commits.** Commits reachable from `HEAD` that have not been pushed to any remote travel with the session as a compact Git bundle.
26
+ - **Incremental deltas.** Changes are stored as deduplicated binary patches in the session database (split into 1 MiB chunks automatically), restarting from `HEAD` every `snapshots.fullEvery` snapshots.
27
+ - **Dependency fingerprint.** A hash of root-level lockfiles and toolchain files lets Atomic match restored worktrees that already have the right dependencies installed. See [Environment fingerprint](/worktree-snapshots/reference#environment-fingerprint).
26
28
 
27
- **What "the same tree" means.** A restore reproduces the repository's Git content so the restored worktree's Git tree ID matches `tree` and every file blob matches. Host-specific worktree encodings are not copied. For example, a source checkout with `core.autocrlf=true` and CRLF files restores with LF files and identical Git content, accompanied by a filter warning.
29
+ If `HEAD`, the working tree, and the list of excluded files have not changed since the last turn, Atomic links to the previous snapshot instead of writing a duplicate. Subagents share their parent's store and capture snapshots too. If a path cannot be read (for example due to permissions or a symlink loop), capture skips that checkout with a warning instead of failing your turn.
28
30
 
29
- ## When snapshots are taken
31
+ A restore reproduces exact Git file content rather than host-specific worktree encodings. For example, a Windows checkout using CRLF with `core.autocrlf=true` restores on Linux with identical Git file content and LF endings, accompanied by a filter notice.
30
32
 
31
- Snapshots require a Git checkout with at least one commit and a SQL database store (local SQLite or PostgreSQL; see [Storage](/storage)). Directories outside Git repositories, in-memory sessions, JSONL directory stores, and custom stores without blob tables record nothing. A new session in a blob-less store reports `blob-store-unsupported` once; a transient store failure reports `blob-store-failed` once without failing the turn.
33
+ ## What is left out {#what-is-left-out}
32
34
 
33
- Atomic captures snapshots at the end of any turn that ran `bash`, `edit`, `write`, `powershell`, or an extension tool declaring `writesFiles: true`. It captures the session's working directory along with the directories of files targeted by `edit` and `write`.
35
+ <Warning>
36
+ **Built-in secret deny list (cannot be overridden).** Atomic never captures `.env*` (including `.env.example` and `.env.template`), `*.pem`, `*.key`, `*.p12`, `*.pfx`, `credentials`, `credentials.json`, `.netrc`, `_netrc`, `.git-credentials`, `.pgpass`, or private SSH key files (any extensionless `id_*` file, plus `id_rsa*`, `id_ed25519*`, `id_ecdsa*`, `id_dsa*`, `id_mldsa*`, and `id_xmss*` regardless of suffix, excluding `.pub` public keys).
34
37
 
35
- - **Unchanged trees.** If `HEAD`, the working tree, and the omitted-file list are all unchanged, Atomic records a reference to the previous snapshot instead of creating a new one. Adding a newly omitted file, such as a new `.env.local`, writes a new snapshot listing it in `omitted` so restores warn about it.
36
- - **Subagent snapshots.** A subagent's session lives in its parent's store and captures snapshots of its own when backed by a database. When multiple subagents finish file-writing turns in the same checkout while a capture is already running, they share the next snapshot.
37
- - **Unpushed-commit omission reuse.** When unpushed commits are omitted because a commit touches a deny-listed secret or the bundle exceeds `snapshots.maxSnapshotBytes` (default 50 MiB), Atomic caches that omission for the running process so later turns avoid re-bundling large unpushed histories. Atomic re-checks and re-bundles automatically if the set of unpushed commits changes (including after pushing or a force push), a new Atomic process starts, the repository is repacked (`git gc` or `git repack`), Git packing or attributes settings change, or `snapshots.maxSnapshotBytes` is raised above the bundle size.
38
- - **Private capture index.** Captures share a private Git index per checkout under `~/.atomic/agent/worktree-snapshots/capture-index/` so unchanged files are not re-read on later turns. Deleting that directory is safe; the next capture rebuilds it automatically.
39
- - **Unreadable paths.** If a path cannot be read because of permissions or a looping symlink, capture skips that checkout and reports `unreadable-path` without failing the turn. Fix the path or add it to `.atomic/snapshot-ignore` to resume capturing.
38
+ These rules match **case-insensitively at any directory depth** and run before `.atomic/snapshot-ignore` and `git add -f`. You cannot re-include a denied file with `!` negation rules. If an unpushed commit modifies a denied path, the unpushed-commit bundle is omitted too.
39
+ </Warning>
40
40
 
41
- ## What is left out
41
+ Atomic also excludes:
42
42
 
43
- Atomic excludes the following from snapshots:
43
+ - **Git-ignored files.** Files matched by `.gitignore`, `.git/info/exclude`, or global excludes are omitted unless staged with `git add -f` (staging overrides `.gitignore`, never the secret deny list).
44
+ - **Project snapshot excludes.** Add `.atomic/snapshot-ignore` at the repository root using `.gitignore` syntax (respects the repository's `core.ignorecase` setting).
45
+ - **Untracked and oversized files.** Untracked files when `snapshots.includeUntracked` is `false`, files larger than `snapshots.maxFileBytes` (default 5 MiB), and files or unpushed bundles exceeding `snapshots.maxSnapshotBytes` (default 50 MiB).
46
+ - **Nested repositories and submodules.** Untracked nested Git repositories are omitted. For submodules, snapshots record only the checked-out submodule commit and do not check submodules out on restore; commit and push submodule changes so they travel cleanly.
44
47
 
45
- - **Built-in secret deny list (cannot be overridden).** `.env*`, `*.pem`, `*.key`, `*.p12`, `*.pfx`, `credentials`, `credentials.json`, `.netrc`, `_netrc`, `.git-credentials`, `.pgpass`, plus SSH key files: any extensionless `id_*` file and any file starting with `id_rsa`, `id_ed25519`, `id_ecdsa`, `id_dsa`, `id_mldsa`, or `id_xmss` regardless of suffix (such as `id_rsa.bak`), except `.pub` public keys and certificates. Other `id_*` files with extensions, such as `id_utils.ts`, are kept unless they carry a denied extension like `.pem` or `.key`.
46
- - Built-in deny rules match **case-insensitively at any directory depth** and run **before** `.atomic/snapshot-ignore` and Git staging. You cannot un-deny a built-in pattern with a `!` negation rule in `.atomic/snapshot-ignore` or with `git add -f`.
47
- - Because `.env*` matches at any depth, non-secret template files such as `.env.example` or `.env.template` are also excluded and cannot be re-included with `!.env.example`.
48
- - **Git-ignored files.** Files matched by `.gitignore`, `.git/info/exclude`, or global excludes are skipped unless explicitly staged with `git add -f` (staging overrides `.gitignore`, not the built-in secret deny list).
49
- - **Project snapshot excludes.** Rules in `.atomic/snapshot-ignore` at the repository root use `.gitignore` syntax and respect the repository's `core.ignorecase` setting.
50
- - **Untracked and oversized files.** Untracked files when `snapshots.includeUntracked` is `false`, files larger than `snapshots.maxFileBytes` (default 5 MiB), and files pushing the snapshot past `snapshots.maxSnapshotBytes` (default 50 MiB).
51
- - **Nested repositories.** Untracked Git repositories inside the checkout appear in `omitted` as `nested-repository`.
52
- - **Submodule contents.** When `.gitmodules` is present, snapshots record only each submodule's checked-out commit and do not check submodules out on restore. Uncommitted submodule changes appear as `submodule-changes`, unpushed submodule commits as `unpushed-submodule-commit`, and submodules that time out after 10 seconds as `submodule-unchecked`. Commit and push submodule work to preserve it.
48
+ Tracked files that are ignored or denied keep their `HEAD` content in the snapshot, and any local edits to them are reported as omitted.
53
49
 
54
- Tracked files that are ignored or denied keep their `HEAD` content in the snapshot, and local edits to them are listed in `omitted`.
50
+ ## Resuming and automatic restore {#resuming}
55
51
 
56
- **Deny-list guarantee.** Deny-listed file bytes are never captured unless already reachable from a remote-tracking ref. If an unpushed commit adds or modifies a deny-listed path, the unpushed-commit bundle is omitted and `omitted` lists the commits and paths. Bundles larger than `snapshots.maxSnapshotBytes` are omitted the same way.
52
+ When you resume a session, Atomic checks every checkout the session recorded a snapshot for—not only its working directory—and adopts any newer capture made by a finished subagent in the same store:
57
53
 
58
- ## Settings
59
-
60
- Configure `snapshots.*` options in `~/.atomic/agent/settings.json` or `.atomic/settings.json`:
61
-
62
- | Setting | Default | Meaning |
63
- | --- | --- | --- |
64
- | `snapshots.enabled` | `true` | Capture worktree snapshots after file-writing turns |
65
- | `snapshots.includeUntracked` | `true` | Include non-ignored untracked files |
66
- | `snapshots.maxFileBytes` | `5242880` (5 MiB) | Largest individual file captured (positive integer) |
67
- | `snapshots.maxSnapshotBytes` | `52428800` (50 MiB) | Largest total snapshot or unpushed bundle size (positive integer) |
68
- | `snapshots.fullEvery` | `10` | Restart patch chain from `HEAD` after this many incremental snapshots |
69
- | `snapshots.autoCollect` | `true` | Run background snapshot garbage collection |
70
- | `snapshots.collectIntervalSeconds` | `3600` (1 hour) | Minimum interval between automatic garbage collection runs |
71
- | `snapshots.graceSeconds` | `3600` (1 hour) | Protect newly written blobs for this many seconds (`0` disables grace window) |
72
- | `snapshots.pool.maxIdlePerRepository` | `2` | Maximum clean idle restored worktrees kept per repository |
73
-
74
- See [Snapshots settings](/settings#snapshots) for full schema notes. In the SDK, pass `createAgentSession({ snapshots })` to override settings for one session. Invalid values fail immediately with `WorkspaceConfigError` before running Git commands.
75
-
76
- ## Resuming
77
-
78
- When you resume a session, Atomic checks every checkout the session recorded a snapshot for, not only its working directory.
79
-
80
- If a finished subagent stored in the same session store captured a checkout later than the parent session did, Atomic adopts that newer subagent capture as the checkout's latest snapshot. Captures compare by recording timestamp, with the parent session winning ties. Partly restored checkouts keep their original restore target, and named subagent worktrees stay separate.
81
-
82
- For each checkout, Atomic applies these rules in order:
83
-
84
- - **In-place resume.** If the tree matches and `HEAD` is the recorded commit or a descendant of it, the session resumes in place. If the active checkout changed locally since its snapshot but is still the same checkout on this machine (holding the snapshot commit, the session's [snapshot ref](#snapshot-refs-in-your-repository), or a local Atomic restore), the session continues there without overwriting your files.
85
- - **Return to original checkout.** If an earlier resume moved the session into a restored worktree and no new work was saved there, Atomic returns to the original checkout once it is available again on this machine.
86
- - **Automatic restore.** If another checkout drifted, or the active checkout is missing, belongs to a different clone, or has no commits, Atomic restores the snapshot into a fresh worktree under `~/.atomic/agent/worktree-snapshots/worktrees/` and prints a one-line notice. Your existing checkouts are never modified.
87
- - **Non-blocking secondary checkouts.** Secondary checkouts outside the session's working directory restore concurrently (up to 4 at a time) and never stop a resume. If one cannot be checked or restored, Atomic skips it with a warning and builds [blueprints](/guides/resume-on-any-machine) for every restored worktree.
88
-
89
- ### Partial (degraded) restores
90
-
91
- A resume always opens the session with its full conversation. When a snapshot cannot be restored exactly (for example because unpushed commits touched denied files, a remote is unreachable, a blob is missing, or a patch fails to apply), Atomic restores the closest reachable state in order:
92
-
93
- 1. The recorded `HEAD` with every change set that applies cleanly, stopping before the first conflicting patch. If host checkout filters alter written files, Atomic keeps the worktree and lists the differing files.
94
- 2. Otherwise, the closest commit fetchable from recorded remotes: the pushed base of the unpushed bundle, then earlier snapshots of the same checkout (nearest first), then the tip of the recorded branch (or default branch when detached).
95
- 3. Otherwise, Atomic skips the restore and continues in the session's recorded directory without writing to it, or in the directory where the resume started if the recorded directory is absent. Missing Git or a missing snapshot record also ends here.
96
-
97
- Each partial or unrestored checkout emits one notice listing what was restored, what is missing, and how to fix it (such as pushing missing commits and resuming again). The outcome is stored on the session entry (`restore.degraded` or `unrestored`) and displayed by `/session snapshot`.
98
-
99
- Only three errors refuse a resume: an unreadable session, a snapshot failing security validation (`invalid-snapshot`), or a non-empty restore target (`unsafe-target`). Working directories reached through symlinks are matched by their resolved physical path.
100
-
101
- <div id="snapshots-restored-only-partly" />
102
-
103
- ### Recovering from a partial restore
104
-
105
- When a snapshot restores only partly, Atomic keeps trying to restore the full original snapshot for 30 days, and garbage collection retains its blobs and patch chain until one of three things happens: a later resume restores it completely, you clear the target with `discardDegradedRestore()` (see [SDK](#sdk)), or 30 days pass since the partial restore.
106
-
107
- Each turn captured in a partly restored worktree records its actual tree and links back to the original snapshot in `degradedFrom`, so work done in a partial restore never overwrites the original target.
108
-
109
- On a later resume, Atomic retries restoring the original snapshot:
110
-
111
- - **Full restore succeeds.** If you edited files in the partly restored worktree, Atomic applies those edits on top as a single patch, shows an info notice, and records a new snapshot immediately. Once saved, Atomic stops retrying the older target.
112
- - **Carried-over edits conflict.** Atomic leaves the restored worktree at the original snapshot, saves your conflicting edits under `refs/atomic/degraded-work/<snapshot>`, keeps them in snapshot storage until discarded or 30 days pass, and prints a `git diff ... | git apply --3way` command so you can merge them manually.
113
- - **Carried-over edits are unavailable.** If the partial-restore edits cannot be read on this machine (for example, unpushed commits made there), Atomic reports them, leaves them in the partial worktree, and clears the original target.
114
- - **Full restore still fails.** Atomic restores the partly restored worktree's latest snapshot so your new work stays intact, warns that the original is still unreachable, and keeps retrying on later resumes.
115
-
116
- After 30 days, the next resume warns that the original snapshot is no longer retained, promotes the partial worktree's latest snapshot to the active target, and clears `degradedFrom` on the next capture.
117
-
118
- ### Restored worktrees
119
-
120
- Restored checkouts live at stable pooled paths under `~/.atomic/agent/worktree-snapshots/worktrees/<repository>-<n>`, with pool metadata in `~/.atomic/agent/worktree-snapshots/pool/`.
121
-
122
- Only checkouts sharing the same repository remotes share a pool. Checkouts without remotes are never pooled so ignored files such as `node_modules` or `.env` cannot cross between unrelated projects. They restore into fresh worktrees each time, and `atomic blueprint prebuild` refuses them. Add a remote to enable pooling.
54
+ | Local state on resume | What Atomic does |
55
+ | --- | --- |
56
+ | Matching local checkout (or same local checkout with your edits) | Resumes in place without touching your files |
57
+ | Original checkout is available again and no new work was saved in a restored worktree | Returns to the original checkout |
58
+ | Missing checkout, different clone, or drifted secondary checkout | Restores into `~/.atomic/agent/worktree-snapshots/worktrees/` with a one-line notice |
123
59
 
124
- A worktree stays associated with the session it was restored for after that session closes so resuming it again continues in the same directory. If another session later takes over that worktree, the original session gets a fresh worktree on its next resume.
60
+ Secondary checkouts restore concurrently (up to 4 at a time) and never block a resume. If a secondary checkout cannot be restored, Atomic skips it with a warning and continues opening the session.
125
61
 
126
- #### Worktree leases
62
+ ### Recovering from a partial restore {#snapshots-restored-only-partly}
127
63
 
128
- An open session refreshes its worktree lease every 10 seconds. On the same host, a worktree held by a running session process is never reclaimed (Linux and Windows check both PID and process start time so reused PIDs after a reboot do not block reuse; macOS falls back to a 24-hour cap without a refresh). If a process stalls or stops refreshing on another host sharing the pool, the worktree remains reserved for 90 seconds after the last refresh before another machine can claim or remove it.
64
+ A resume always opens your conversation even when a snapshot cannot be rebuilt identically (for example, because an unpushed commit touched a denied file, a remote is unreachable, or a patch conflicts). Atomic restores the closest reachable state in order:
129
65
 
130
- Before saving a snapshot or continuing in a pooled worktree, Atomic verifies that the session still holds the lease. If another session claimed the worktree meanwhile, Atomic skips the snapshot and warns with `pooled-worktree-lost` so you can stop editing there and run `/resume` to open a fresh worktree.
66
+ 1. The recorded `HEAD` with every patch that applies cleanly.
67
+ 2. Otherwise, the closest fetchable commit (the pushed base commit, an earlier snapshot of the checkout, or the branch tip).
68
+ 3. Otherwise, Atomic continues in the session's recorded directory (or the launch directory) without modifying any files.
131
69
 
132
- #### Idle reuse, eviction, and set-aside worktrees
70
+ Atomic prints a notice explaining what is missing and how to fix it (such as pushing missing commits from the original machine and resuming again). It keeps retrying the original snapshot for up to 30 days, and any edits you make in the partial worktree carry over automatically once a full restore succeeds (or are saved under `refs/atomic/degraded-work/<snapshot>` with a merge command if they conflict). See [Partial restore recovery](/worktree-snapshots/reference#partial-restore-recovery) for SDK controls.
133
71
 
134
- When restoring a repository, Atomic reuses an idle pooled worktree if one matches its last recorded snapshot with no extra untracked or excluded files. It resets tracked files to the target snapshot while keeping ignored files such as `node_modules`, `target`, or `.venv`, prioritizing worktrees with the same `envHash`. `/session snapshot` labels a reused worktree as `(claimed)`.
72
+ ### Restored worktrees {#restored-worktrees}
135
73
 
136
- When idle worktrees for one repository exceed `snapshots.pool.maxIdlePerRepository`, Atomic removes the oldest clean idle ones. Any worktree with unrecorded edits or excluded files (such as `.env`) is preserved.
74
+ Restored worktrees live under `~/.atomic/agent/worktree-snapshots/worktrees/<repository>-<n>` and share one Git object store per repository. Checkouts that share the same repository remotes share a pool; repositories with no remotes are never pooled so ignored files cannot cross between unrelated projects.
137
75
 
138
- If Atomic is killed mid-blueprint build, that worktree is marked set-aside under `~/.atomic/agent/worktree-snapshots/pool/set-aside/` so no session reuses it while build processes might still run (see [Start the first turn while the build runs](/guides/resume-on-any-machine#start-the-first-turn-while-the-build-runs)). Atomic deletes set-aside pooled worktrees on a later restore once no user process has an open file or working directory inside them. If another user's or protected process prevents checking open files, or for non-pooled worktrees, inspect with `lsof +D <path>` and delete the directory manually.
76
+ - **Warm reuse.** When restoring, Atomic reuses a clean idle worktree of the same repository—preferring one with the same dependency fingerprint—so ignored folders like `node_modules`, `target`, or `.venv` stay intact. Excess clean idle worktrees above `snapshots.pool.maxIdlePerRepository` are removed automatically, while any worktree with unrecorded edits or excluded files (such as `.env`) is preserved.
77
+ - **Non-interactive fetches and Git LFS.** Restore fetches never hang waiting for terminal input (SSH runs in batch mode with a 15-second connect timeout; run `git ls-remote <remote>` once interactively if a host key or passphrase is needed). Missing Git LFS objects download automatically—up to **2 in parallel per session resume**—leaving unavailable files as pointers with a warning.
78
+ - **Cleanup and refs.** Atomic tracks snapshot commits under `refs/atomic/snapshots/` so `git gc` preserves them without affecting `git push`, and cleans up unused snapshot blobs automatically in the background. See [Worktree snapshots reference](/worktree-snapshots/reference) for lease rules, ref cleanup commands, and garbage collection internals.
139
79
 
140
- #### Shared object stores, SSH, LFS, and interrupted restores
80
+ ## Inspecting snapshots {#inspecting-snapshots}
141
81
 
142
- - **Shared object stores.** Restored worktrees share one object store per repository under `~/.atomic/agent/worktree-snapshots/repositories/`. Missing commits fetch shallowly (`--depth=1`), falling back to a full fetch when needed; run `git fetch --unshallow origin` if you need full history locally. Safe credential-free remotes are added as `origin`, `origin-2`, and so on, and pushed commits get refs under `refs/remotes/atomic/pushed/` so later snapshots bundle only truly unpushed work.
143
- - **Non-interactive fetches.** Restore fetches never wait for terminal input. Unless you set `GIT_SSH_COMMAND`, `GIT_SSH`, or `core.sshCommand`, SSH runs with `BatchMode=yes` and a 15-second connect timeout. Unknown host keys or locked SSH keys fail immediately with `commits-unavailable` (`reason: "not-fetched"`); run `git ls-remote <remote>` once interactively, then resume again.
144
- - **Git LFS.** Restores download missing LFS objects across recorded remotes without prompting. Unavailable files stay as pointers with an `lfs-objects-unavailable` warning; push missing objects from the source machine (`git lfs push --all <remote>` or `git lfs push --object-id <remote> <oid>`), then restore again.
145
- - **LFS download concurrency.** During session resume, at most two LFS downloads run in parallel per host. A checkout's blueprint and first prompt (or first tool call under [`resume.waitForBlueprint: "tools"`](/guides/resume-on-any-machine#start-the-first-turn-while-the-build-runs)) wait until its download finishes, and a second resume waits up to 10 minutes for an in-flight download.
146
- - **Interrupted restores.** Restores stage and verify worktrees before moving them into place. If a process dies mid-restore, the next restore cleans up the staging record under `~/.atomic/agent/worktree-snapshots/restores/` once its lock is 30 seconds stale without deleting files it did not create. Any retained leftover reports `stale-restore-retained` once with `kind` (`worktree`, `record`, or `records-directory`) so you can inspect and delete it safely.
147
- - **Snapshot security checks.** Before running Git, Atomic validates snapshot IDs, hashes, and remotes. Unsafe values (credentials, leading `-`, control characters, or Git remote helpers such as `ext::`) fail with `invalid-snapshot`.
148
-
149
- ## Inspecting snapshots
150
-
151
- Run `/session snapshot` to see the latest snapshot of each checkout (branch, `HEAD`, tree, patch chain, bundled commits, omissions, and filter settings), along with a `git diff --stat` when the recorded tree is available locally.
152
-
153
- It also prints how long the last turn capture took (`last capture took 0.4 s`) and a **Last resume** timing breakdown after any restore or blueprint run:
82
+ Run `/session snapshot` inside a session to inspect the latest snapshot for each checkout (branch, `HEAD`, omissions, and a `git diff --stat` when available locally), the last capture time, and the **Last resume** timing breakdown:
154
83
 
155
84
  ```text
156
85
  Last resume
@@ -160,145 +89,28 @@ Last resume
160
89
  ready after 62.8 s
161
90
  ```
162
91
 
163
- Each checkout line breaks down restore phases in seconds (`fetch`, `reconstruct`, `materialize`, `LFS`, `verify`, `publish`) and appends `(degraded)` for partial restores. Blueprint steps note `failed` or `timed-out` when applicable. Under [`resume.waitForBlueprint: "tools"`](/guides/resume-on-any-machine#start-the-first-turn-while-the-build-runs), `ready after` measures up to worktree restore completion and the blueprint line appears once the build finishes.
164
-
165
- Set `ATOMIC_TIMING=1` to print the same summary to stderr during `atomic --session`. Atomic also stores these numbers in a `resume_timings` entry for exports and SDK inspection.
166
-
167
- ### Moving a session as a file
168
-
169
- [`/export`](/sessions#session-commands) `session.jsonl` embeds each snapshot patch and bundle inline once and reports the included size. `--import session.jsonl` and `/import` verify every blob hash and store the blobs in the target database before saving the session. `/share` omits snapshot blobs from the gist. For bulk multi-branch backups across stores, see [Exporting and importing sessions](/storage#exporting-and-importing-sessions).
170
-
171
- ## Snapshot refs in your repository
172
-
173
- Every snapshot is also a Git commit in the checkout's repository. Atomic keeps the latest snapshot commit per session and checkout reachable at `refs/atomic/snapshots/<session-id>/<checkout>` so `git gc` and `git maintenance` do not prune it, and resume can recognize your local checkout even after further edits.
174
-
175
- - Each new snapshot advances the ref so at most one snapshot commit stays alive per session and checkout.
176
- - Moving work to or from a restored worktree deletes the old ref once a snapshot is captured in the new location.
177
- - Deleting a session through `/resume`, the picker, or `SessionManager.deleteSession()` deletes its local refs along with refs of its non-running subagents.
92
+ Set `ATOMIC_TIMING=1` to print the same summary to stderr when running `atomic --session <id>`.
178
93
 
179
- If you import a copy of a session into another store on the same machine, both copies share the same session ID and ref; deleting one copy can remove the ref used by the other. No files are lost, though if `git gc` later prunes that commit and the checkout drifted, resume restores into a fresh worktree.
94
+ To move a session with its snapshots as a single file, run [`/export <file>.jsonl`](/sessions#session-commands) and import it elsewhere with `--import` or `/import`. `/share` omits snapshot blobs from uploaded gists. For multi-session backups, see [Exporting and importing sessions](/storage#exporting-and-importing-sessions).
180
95
 
181
- Snapshot refs sit outside `refs/heads` and `refs/tags`, so `git push`, `git push --all`, `git push --tags`, and snapshot bundles ignore them. Avoid `git push --mirror` if you do not want to push snapshot commits (which contain uncommitted tracked and untracked work excluding [What is left out](#what-is-left-out)).
182
-
183
- Snapshot commits appear in `git for-each-ref` and `git log --all` titled `Atomic worktree snapshot`. Exclude them from `git log --all` with:
184
-
185
- ```bash
186
- git log --exclude='refs/atomic/*' --all
187
- ```
188
-
189
- Sessions deleted on another machine or via `SessionStore.delete()` can leave local refs behind. Remove all Atomic snapshot refs in a repository with:
190
-
191
- ```bash
192
- git for-each-ref --format='delete %(refname)' refs/atomic/snapshots/ | git update-ref --stdin
193
- ```
194
-
195
- ## Retention and collection
196
-
197
- Snapshot blobs live in one shared table per database and are garbage-collected automatically when no retained session needs them:
198
-
199
- - **Retained snapshots.** For every branch of every session (including internal sessions), Atomic keeps the latest snapshot of each checkout on that branch. Deleting a session releases its snapshots. A partly restored snapshot remains retained for up to 30 days (see [Recovering from a partial restore](#snapshots-restored-only-partly)). Unfinished workflow runs kept in the database from earlier releases retain their snapshots until removed.
200
- - **Background schedule.** When `snapshots.autoCollect` is `true`, Atomic runs collection in the background 10 seconds after an interactive or RPC session starts and 10 seconds after it closes, at most once per `snapshots.collectIntervalSeconds` per database (measured on the database clock). Collection runs in short batches so the UI stays responsive, aborts cleanly when the last store on the database closes, and resumes later if interrupted.
201
- - **Grace window.** Blobs stored or reused within `snapshots.graceSeconds` (default 1 hour) are never deleted, protecting captures in progress. Reusing an earlier patch resets its age; if a blob is collected before its snapshot commits, Atomic retries storing it or reports `blobs-collected` without recording a broken snapshot. Raise `snapshots.graceSeconds` if `blobs-collected` repeats.
202
- - **Failures and disk space.** Collection errors never fail an active session; they are recorded in the `snapshot_collection` table (`finished_at`, `deleted`, `error_code`) and retried after the configured interval. SQLite reuses freed space internally without shrinking the file; run `VACUUM` while no Atomic process uses the database to reclaim disk space.
203
-
204
- To trigger collection immediately from code, call `collectSnapshotGarbage()`. For older local SQLite databases that need offline chunk-table migration, see [Size limits](/storage#size-limits).
205
-
206
- ## SDK
207
-
208
- Open a `SqliteDatabase` handle with `openNodeSqliteDatabase()` or `openPostgresDatabase()` (see [SDK session storage](/sdk/storage) and [SDK and local SQLite API](/storage/sqlite#sdk-and-local-sqlite-api)), then open a `SqlSnapshotBlobStore` on that database:
209
-
210
- ```typescript
211
- import {
212
- captureWorktreeSnapshot,
213
- restoreWorktreeSnapshot,
214
- verifyWorktree,
215
- SqlSnapshotBlobStore,
216
- type WorkspaceBinding,
217
- } from "@bastani/atomic";
218
- import { openNodeSqliteDatabase } from "@bastani/atomic/storage";
219
-
220
- const database = await openNodeSqliteDatabase("./sessions.sqlite");
221
- try {
222
- // Pass the same table prefix as your sessions when using a prefix (positional string).
223
- const blobs = await SqlSnapshotBlobStore.open(database, "project_");
224
- const capture = await captureWorktreeSnapshot(process.cwd(), { blobs });
225
- if (capture.status === "captured" || capture.status === "unchanged") {
226
- const binding: WorkspaceBinding = capture.binding; // { remotes, head, tree, envHash }
227
- const path = await restoreWorktreeSnapshot(capture.snapshot, { blobs });
228
- await verifyWorktree(binding, path);
229
- }
230
- } finally {
231
- await database.close();
232
- }
233
- ```
234
-
235
- `SqlSnapshotBlobStore.open(database, prefix?)` takes `prefix` as an optional positional string (unlike `SqlSessionStore.open(database, { prefix })`, which takes an options object). `SqlSnapshotBlobStore` does not own `database` and has no `close()` method; close your caller-owned `database` in a `finally` block after snapshot operations and any running garbage collection finish.
236
-
237
- ### Capture, restore, and verification
238
-
239
- - `captureWorktreeSnapshot(dir, { settings?, previous?, blobs?, signal? })`: resolves to `captured`, `unchanged`, `disabled`, or `unavailable` with a typed `GitUnavailableError` or `WorkspaceSnapshotError`.
240
- - `restoreWorktreeSnapshot(bindingOrSnapshot, { into?, blobs?, snapshots?, storeDir?, onWarning?, signal?, git? })`: resolves to the path of a new verified worktree (`into` must be new or empty). Checks the target and blobs before writing, cleans up on failure, and emits `omitted-content`, `filters`, `lfs-objects-unavailable`, and `stale-restore-retained` warnings to `onWarning`.
241
- - `restoreDegradedWorktree(snapshot, failure, { blobs?, storeDir?, candidates?, onWarning?, signal?, git? })`: restores the closest reachable state after a degradable `WorkspaceRestoreError` accepted by `isDegradableRestoreFailure` (`blob-missing`, `blob-corrupt`, `commits-unavailable`, `delta-failed`, or `tree-mismatch`). Resolves `{ path, degraded, warnings }`.
242
- - `restoreBestWorktree(snapshot, { blobs?, storeDir?, candidates?, signal?, git? })`: runs exact restore followed by degraded restore, resolving `{ status: "restored", path, warnings, degraded? }` or `{ status: "unrestored", reason }`. Rejects only on `invalid-snapshot`, `unsafe-target`, abort, or untyped errors. Pair with `unrestoredRecord(snapshot, reason, continuedIn, place)` to build a `WorktreeUnrestored` entry.
243
- - `verifyWorktree(binding, dir, { settings?, signal? })`: resolves to the checkout's current binding when `HEAD` and tree match, or rejects with `WorkspaceDriftError`.
244
- - `isHeadOnlyAdvance(driftError, signal?)`: resolves `true` when `WorkspaceDriftError` reflects only `HEAD` advancing over the same recorded tree.
245
- - `canonicalizeWorktreePath(path)`: resolves symlinks in the existing portion of a path so paths compare consistently with snapshot roots.
246
- - `removeRestoredWorktree(path, { storeDir?, onWarning?, signal? })`: removes a worktree created by Atomic restore (for rolling back multi-checkout restores) and rejects any non-restored path with `unsafe-target`.
247
-
248
- ### Session resume and partial restores
249
-
250
- - `openSessionInWorktree(sessionManager, { settings, storeDir?, signal?, beforeRecord?, pendingMappings?, keepInPlace?, cannotRestore?, fallbackCwd?, skipMissingRecords? })`: checks every recorded checkout and restores drifted or missing ones without running blueprints, resolving `{ sessionManager, notices, unrestored, missingRecords }`. `resumeSessionWorktree` performs the same restore without reopening the session. For standard SDK resume with blueprints, pass `sessionManager` directly to `createAgentSession({ sessionManager })` (see [Worktree snapshots in the SDK](/sdk#worktree-snapshots)).
251
- - `discardDegradedRestore(sessionManager, { settings, root?, signal? })`: records each partly restored worktree (or only `root`) without `degradedFrom` so it becomes the active restore target and releases the original snapshot on the next collection.
252
- - `degradedRestorePin(sessionManager, root)`: returns `{ snapshotId, since, base?, lapsed, work?, kept? }` for a checkout with an active partial-restore target, or `undefined` otherwise.
253
- - `withWorktreeRestoreNotices(notices, work)` and `currentWorktreeRestoreNotices()`: scope `worktree_restore` system prompt notices across sessions opened inside `work`.
96
+ ## Settings
254
97
 
255
- ### Reading older snapshots on demand
98
+ Configure `snapshots.*` in `~/.atomic/agent/settings.json` or a trusted project's `.atomic/settings.json`:
256
99
 
257
- Sessions opened at the default tail window load only the snapshot records needed for resume into memory. Use `sessionManager.readWorktreeSnapshotPages()` and `sessionManager.loadWorktreeSnapshotRecords()` (see [SessionManager API](/session-format#sessionmanager-api)) to inspect older snapshots on demand:
100
+ | Setting | Default | Meaning |
101
+ | --- | --- | --- |
102
+ | `snapshots.enabled` | `true` | Capture worktree snapshots after file-writing turns |
103
+ | `snapshots.includeUntracked` | `true` | Include non-ignored untracked files |
104
+ | `snapshots.maxFileBytes` | `5242880` (5 MiB) | Largest single file captured (positive integer) |
105
+ | `snapshots.maxSnapshotBytes` | `52428800` (50 MiB) | Largest total snapshot or unpushed bundle size (positive integer) |
106
+ | `snapshots.fullEvery` | `10` | Restart patch chain from `HEAD` after this many incremental snapshots |
107
+ | `snapshots.autoCollect` | `true` | Run background snapshot garbage collection |
108
+ | `snapshots.collectIntervalSeconds` | `3600` (1 hour) | Minimum interval between automatic garbage collection runs |
109
+ | `snapshots.graceSeconds` | `3600` (1 hour) | Protect newly written blobs for this many seconds (`0` disables grace window) |
110
+ | `snapshots.pool.maxIdlePerRepository` | `2` | Maximum clean idle restored worktrees kept per repository (`0` keeps none) |
258
111
 
259
- ```typescript
260
- const session = await SessionManager.open(store, sessionId);
261
- const held = session.getWorktreeSnapshotRecords();
262
- const ids: string[] = [];
263
- for await (const page of session.readWorktreeSnapshotPages({ branch: true })) {
264
- for (const { entry } of page) ids.push(entry.snapshotId);
265
- }
266
- const records = await session.loadWorktreeSnapshotRecords(ids);
267
- ```
112
+ <Note>
113
+ Invalid values for the capture and collection settings (`enabled` through `graceSeconds`) fail immediately before running Git. `snapshots.pool.maxIdlePerRepository` accepts `0` or any positive integer and silently falls back to `2` if invalid.
114
+ </Note>
268
115
 
269
- ### Garbage collection
270
-
271
- - `collectSnapshotGarbage(blobs, { graceSeconds?, signal? })`: deletes eligible unreferenced blobs from a `SqlSnapshotBlobStore` (default `graceSeconds` is `DEFAULT_BLOB_GRACE_SECONDS`, 1 hour) and resolves `{ deleted, pendingChunkMove? }`. Rejects non-SQL stores with `blob-store-unsupported`.
272
- - `scheduleSnapshotCollection(blobs, settings, { onFailure?, delayMs? })`: starts background collection when `settings.autoCollect` is enabled and due (sessions pass `SNAPSHOT_COLLECTION_SESSION_DELAY_MS`). Never rejects after validating settings; resolves with `collected`, `skipped`, `interrupted`, or `failed`, and does not keep an idle process alive.
273
- - `runningSnapshotCollection(blobs)`: returns a promise settling when the current process's active collection finishes, or `undefined` if none is running.
274
-
275
- ## Errors
276
-
277
- Every workspace error except `GitUnavailableError` extends `WorkspaceError`. Each error carries a stable `code`, JSON-safe `fields`, a `hint`, a `summary`, and `retryable` (`true` only on `WorkspaceCollectionError`).
278
-
279
- Match errors by class or `code`, never by message text. Use `isRetryableWorkspaceError(error)` and `findWorkspaceError(error, guard)` to inspect cause chains up to 8 levels deep, and `serializeWorkspaceError` / `rehydrateWorkspaceError` to pass errors across process boundaries.
280
-
281
- | Class | Code | When | Fields | What to do |
282
- | --- | --- | --- | --- | --- |
283
- | `WorkspaceConfigError` | `invalid-setting` | A snapshot setting or SDK option has an invalid type or range | `source`, `field`, `expected` | Fix the named setting or option |
284
- | `GitUnavailableError` | `not-installed`, `unsupported-platform`, `offline`, `checksum-mismatch`, `download-failed`, `install-failed` | Git could not be started or provisioned | `platform`, `arch`, `installDir`, `installCommand?`, `systemGit?` | Follow `hint` (install Git or put it on `PATH`) |
285
- | `WorkspaceGitError` | `git-failed` | A Git command failed (`detail` holds its first error line) | `operation`, `cwd`, `exitCode`, `detail` | Check repository permissions, free disk space, and Git locks, then retry |
286
- | `WorkspaceSnapshotError` | `not-a-repository` | The directory is outside any Git work tree | `subject` | Work inside a Git checkout |
287
- | `WorkspaceSnapshotError` | `unborn-head` | The repository has no commits yet | `subject` | Create an initial commit |
288
- | `WorkspaceSnapshotError` | `blob-store-unsupported` | The selected storage cannot hold snapshot blobs | `subject` | Use a SQLite or SQL database store (`--session-store` or `sessions.storage`) |
289
- | `WorkspaceSnapshotError` | `blob-store-failed` | The session's storage was unreachable or rejected the snapshot payload | `subject`, `cause` | Restore storage access (`atomic storage status`); the next file-writing turn captures again |
290
- | `WorkspaceSnapshotError` | `blobs-collected` | Collection deleted a capture's blobs before the snapshot recorded, and retrying failed | `subject` | Raise `snapshots.graceSeconds` |
291
- | `WorkspaceSnapshotError` | `pooled-worktree-lost` | Another session took over the pooled worktree while this session was running | `subject` | Stop editing files there and run `/resume` to restore into a fresh worktree |
292
- | `WorkspaceSnapshotError` | `unreadable-path` | A path needed by capture, restore, or verification cannot be read | `subject`, `cause` | Fix permissions or symlinks, or add the path to `.gitignore` or `.atomic/snapshot-ignore` |
293
- | `WorkspaceRestoreError` | `snapshot-not-found` | A binding has no recorded snapshot and its tree is not on this host | `head`, `tree` | Pass the recorded snapshot or restore where the tree exists |
294
- | `WorkspaceRestoreError` | `blob-missing` | A patch or bundle is missing from storage | `snapshotId`, `blob`, `role`, `deltaIndex` | Use the storage where the snapshot was recorded, or import a `.jsonl` export |
295
- | `WorkspaceRestoreError` | `blob-corrupt` | A stored or imported blob fails its hash check | `snapshotId`, `blob`, `role` | Restore an earlier snapshot or re-export the session |
296
- | `WorkspaceRestoreError` | `commits-unavailable` | `HEAD` cannot be fetched and no usable bundle exists | `head`, `commits`, `paths`, `remotes`, `reason` (`denied-history`, `bundle-over-cap`, `not-fetched`) | Push `head` to a recorded remote, raise `snapshots.maxSnapshotBytes` for `bundle-over-cap`, or verify remote access |
297
- | `WorkspaceRestoreError` | `delta-failed` | A patch failed to produce its recorded tree | `snapshotId`, `deltaIndex`, `blob`, `expectedTree`, `actualTree` | Restore an earlier snapshot |
298
- | `WorkspaceRestoreError` | `tree-mismatch` | The materialized worktree tree differs from the snapshot | `target`, `expectedTree`, `actualTree` | Check `.gitattributes` filters on this host, then retry |
299
- | `WorkspaceRestoreError` | `unsafe-target` | `into` is non-empty (`not-empty`), or `removeRestoredWorktree` received a non-restored path (`not-restored`) | `target`, `reason` | Pass a new or empty directory, or omit `into` |
300
- | `WorkspaceRestoreError` | `unwritable-path` | A restore or removal could not write a directory or file | `target`, `snapshotId`, `cause` | Free disk space or fix directory permissions, then retry |
301
- | `WorkspaceRestoreError` | `path-too-long` | On Windows, a restored worktree path or Git directory exceeds Git for Windows path limits. Nothing is written. | `snapshotId`, `target`, `limit`, `agentDir` | Set `ATOMIC_CODING_AGENT_DIR` to a shorter path ([Long paths on Windows](/guides/resume-on-any-machine#long-paths-on-windows)) |
302
- | `WorkspaceRestoreError` | `invalid-snapshot` | A snapshot record has unsafe remotes or malformed IDs or hashes | `snapshotId`, `field`, `reason` (`unsafe-remote`, `invalid-object-id`, `invalid-snapshot-id`, `invalid-blob-hash`) | Restore only trusted storage records or re-export on the recording machine |
303
- | `WorkspaceDriftError` | `tree-drift` | A checkout drifted from its snapshot and could not be restored | `root`, `expectedHead`, `actualHead`, `expectedTree`, `actualTree`, `snapshotId`, `reason?`, `restoreCode?`, `cause?` | Follow `hint` |
304
- | `WorkspaceCollectionError` | `collection-failed` | Database garbage collection failed (`retryable: true`; retained blobs are untouched) | `table`, `phase` (`claim`, `index`, `sweep`, `record`), `deleted`, `cause` | Check database permissions, disk space, and locks; drop broken triggers or views if hinted ([Size limits](/storage#size-limits)) |
116
+ See [Snapshots settings](/settings#snapshots) for schema details, and [Worktree snapshots reference](/worktree-snapshots/reference) for SDK APIs, error classes, and storage internals.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/atomic",
3
- "version": "0.10.14",
3
+ "version": "0.10.15-alpha.1",
4
4
  "description": "Atomic coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "atomicConfig": {
@@ -118,13 +118,13 @@
118
118
  "prepack": "node -e \"require('node:fs').existsSync('scripts/split-dist.mjs') && import('./scripts/split-dist.mjs').then(() => import('./scripts/write-startup-files.mjs')).then(() => import('./scripts/write-startup-stages.mjs'))\""
119
119
  },
120
120
  "dependencies": {
121
- "@bastani/atomic-natives": "0.10.14",
122
- "@bastani/atomic-ai": "0.10.14",
123
- "@bastani/atomic-agent-core": "0.10.14",
124
- "@bastani/atomic-codemode": "0.10.14",
125
- "@bastani/atomic-tui": "0.10.14",
126
- "@bastani/atomic-schema": "0.10.14",
127
- "@bastani/atomic-telemetry": "0.10.14",
121
+ "@bastani/atomic-natives": "0.10.15-alpha.1",
122
+ "@bastani/atomic-ai": "0.10.15-alpha.1",
123
+ "@bastani/atomic-agent-core": "0.10.15-alpha.1",
124
+ "@bastani/atomic-codemode": "0.10.15-alpha.1",
125
+ "@bastani/atomic-tui": "0.10.15-alpha.1",
126
+ "@bastani/atomic-schema": "0.10.15-alpha.1",
127
+ "@bastani/atomic-telemetry": "0.10.15-alpha.1",
128
128
  "@silvia-odwyer/photon-node": "0.3.4",
129
129
  "chalk": "6.0.0",
130
130
  "glob": "14.0.6",