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