@bastani/atomic 0.10.14-alpha.1 → 0.10.15-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -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 +9 -0
- 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
|
@@ -1,29 +1,45 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "
|
|
3
|
-
sidebarTitle: "
|
|
4
|
-
description: "Run Atomic
|
|
2
|
+
title: "Run Atomic non-interactively"
|
|
3
|
+
sidebarTitle: "Run non-interactively"
|
|
4
|
+
description: "Run Atomic from scripts, pipelines, and editors using print mode (-p), JSON event streams, RPC, or the SDK."
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
You can run Atomic without the terminal UI in three
|
|
7
|
+
You can run Atomic without the terminal UI in three CLI modes, or embed it directly in TypeScript with the SDK.
|
|
8
8
|
|
|
9
|
-
|
|
|
9
|
+
| What you want | Use | Read |
|
|
10
10
|
| --- | --- | --- |
|
|
11
|
-
| One prompt, one answer, then exit | Print mode (`-p`, `--print`) | [CLI modes](/reference/cli#modes) |
|
|
12
|
-
| A machine-readable stream of
|
|
13
|
-
| A long-lived session another program drives | RPC (`--mode rpc`) | [RPC](/rpc) |
|
|
14
|
-
| Embed Atomic
|
|
11
|
+
| One prompt, one plain-text answer, then exit | Print mode (`-p`, `--print`) | [CLI modes](/reference/cli#modes) |
|
|
12
|
+
| A machine-readable stream of messages, tool calls, and results | JSON event stream (`--mode json`) | [JSON event stream](/json) |
|
|
13
|
+
| A long-lived session another program drives interactively | RPC (`--mode rpc`) | [RPC](/rpc) |
|
|
14
|
+
| Embed Atomic directly inside a TypeScript application | SDK | [SDK](/sdk) |
|
|
15
15
|
|
|
16
16
|
## Print mode
|
|
17
17
|
|
|
18
|
-
`atomic
|
|
18
|
+
`atomic -p "..."` (or `--print`) runs prompts without launching the terminal UI and exits when finished:
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
```bash
|
|
21
|
+
# Single prompt
|
|
22
|
+
atomic -p "Summarize the architecture of this repository"
|
|
23
|
+
|
|
24
|
+
# Pipe input into a prompt
|
|
25
|
+
git diff | atomic -p "Write a concise commit message for these changes"
|
|
26
|
+
|
|
27
|
+
# Run multiple sequential prompts in one session (prints the final answer)
|
|
28
|
+
atomic -p "Inspect src/auth.ts" "List any edge cases you found"
|
|
29
|
+
|
|
30
|
+
# Read-only analysis with structured JSON event output
|
|
31
|
+
atomic --mode json --tools read,search,find -p "Audit src/ for hardcoded secrets"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Key behaviors in print mode:
|
|
35
|
+
|
|
36
|
+
- **Automatic print mode on pipes and redirects:** If standard input or standard output is not a TTY (for example piping into `atomic` or redirecting `atomic > out.txt`), Atomic enters print mode automatically even without `-p`.
|
|
37
|
+
- **Piped stdin and prompt merging:** Atomic trims piped stdin and separates it from CLI prompt text or `@file` blocks with a blank line when adjacent text has no whitespace boundary. When a prompt argument or `@file` is present, Atomic waits up to 2 seconds for the first piped byte before starting without stdin (override with [`ATOMIC_STDIN_TIMEOUT_MS`](/environment-variables#diagnostics-and-performance), or set `0` to always wait for EOF).
|
|
38
|
+
- **Multiple prompts:** Passing multiple positional prompts runs them sequentially in the same session. Plain-text print mode prints only the final prompt's answer to stdout, while `--mode json` streams events for every turn.
|
|
39
|
+
- **Interactive prompts and project trust:** Both print mode and `--mode json` automatically disable interactive question prompts (`ask_user_question`) because no terminal UI is available. Non-interactive runs never prompt for project trust; when an untrusted project has local settings, Atomic prints a stderr warning advising `--approve` (`-a`) and ignores project settings, extensions, and context files unless you pass `--approve` (`-a`) or set global `defaultProjectTrust` to `"always"`. See [Project trust](/security#project-trust).
|
|
40
|
+
- **Pre-flight checks and structured output:** Before starting an automated run, verify provider credentials with `atomic auth check` ([Verify readiness before a session](/providers#verify-readiness-before-a-session)). For typed classification or final structured JSON outputs in scripts and SDK hosts, see [Structured decisions](/sdk/structured-decisions).
|
|
41
|
+
- **Truncated responses:** If a response hits the model's output token limit, print mode keeps the partial text on stdout, writes a truncation warning to stderr, and exits `1`. Always check the exit code before treating redirected output as complete.
|
|
42
|
+
- **Extension slash commands:** You can invoke extension slash commands in print mode (for example `atomic --session <id> -p "/curator off"`). If the command sends a message or triggers a turn, print mode waits for that response and prints it before continuing or exiting.
|
|
27
43
|
|
|
28
44
|
### Exit codes and signals
|
|
29
45
|
|
|
@@ -36,19 +52,45 @@ You can run Atomic without the terminal UI in three ways, or embed it directly i
|
|
|
36
52
|
| `130` | Stopped by `SIGINT` (`Ctrl+C`) after graceful shutdown |
|
|
37
53
|
| `143` | Stopped by `SIGTERM` on Linux or macOS after graceful shutdown |
|
|
38
54
|
|
|
39
|
-
Sending a second termination signal during graceful shutdown forces immediate exit.
|
|
55
|
+
Sending a second termination signal during graceful shutdown forces immediate exit.
|
|
56
|
+
|
|
57
|
+
<Tip>
|
|
58
|
+
**Running after terminal disconnect (`SIGHUP`):** On Linux and macOS, the standalone Atomic binary preserves an ignored `SIGHUP` (such as under `nohup atomic -p ...`) and keeps running after the terminal closes. An npm installation runs on Node.js, which resets an ignored `SIGHUP`; start it with `setsid` to keep it running after disconnect.
|
|
59
|
+
</Tip>
|
|
40
60
|
|
|
41
61
|
## JSON events
|
|
42
62
|
|
|
43
|
-
Use `--mode json` when
|
|
63
|
+
Use `--mode json` when a script or CI job needs to observe every message, tool call, and result rather than just the final text:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
atomic --mode json "Run the test suite and report any failures"
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Atomic writes one JSON event object per line to stdout. See [JSON event stream](/json) for the full event schema.
|
|
44
70
|
|
|
45
71
|
## RPC
|
|
46
72
|
|
|
47
|
-
Use `--mode rpc` to
|
|
73
|
+
Use `--mode rpc` to run a persistent session controlled over stdin and stdout JSON messages—ideal for editors, bots, and background services that need multi-turn control or interactive UI callbacks:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
atomic --mode rpc --no-session
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Start with [RPC](/rpc) and the [RPC protocol](/rpc/protocol).
|
|
48
80
|
|
|
49
81
|
## Next steps
|
|
50
82
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
83
|
+
<Columns cols={2}>
|
|
84
|
+
<Card title="CLI reference" href="/reference/cli">
|
|
85
|
+
Every flag, model-matching rule, subcommand, and exit code.
|
|
86
|
+
</Card>
|
|
87
|
+
<Card title="Environment variables" href="/environment-variables">
|
|
88
|
+
Configure `ATOMIC_STDIN_TIMEOUT_MS`, `ATOMIC_STORAGE`, and CI overrides.
|
|
89
|
+
</Card>
|
|
90
|
+
<Card title="Programmatic use" href="/programmatic">
|
|
91
|
+
Compare print mode, JSON events, RPC, and the TypeScript SDK.
|
|
92
|
+
</Card>
|
|
93
|
+
<Card title="Background tasks" href="/background-tasks">
|
|
94
|
+
Run subagents and shells in the background during interactive sessions.
|
|
95
|
+
</Card>
|
|
96
|
+
</Columns>
|
|
@@ -1,55 +1,63 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "Resume sessions on any machine"
|
|
3
3
|
sidebarTitle: "Resume anywhere"
|
|
4
|
-
description: "Continue sessions on another machine using shared storage, worktree snapshots, and
|
|
4
|
+
description: "Continue sessions on another machine using shared PostgreSQL storage, worktree snapshots, environment blueprints, and CI runner caches."
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
When several machines share one storage database, you can start a session on one machine and continue it on any other. Atomic reads the session from shared storage, rebuilds the repository files it was working against, runs optional environment blueprints, and continues the conversation where it
|
|
7
|
+
When several machines share one PostgreSQL storage database, you can start a session on one machine and continue it on any other. Atomic reads the session from shared storage, rebuilds the repository files it was working against, runs optional environment blueprints, and continues the conversation where it left off.
|
|
8
8
|
|
|
9
9
|
## Join each machine
|
|
10
10
|
|
|
11
|
-
Every machine must use the same shared [PostgreSQL](/storage/postgres) database
|
|
11
|
+
Every machine must use the same shared [PostgreSQL](/storage/postgres) database (PostgreSQL 16 or newer).
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
<Steps>
|
|
14
|
+
<Step title="Set up the database once">
|
|
15
|
+
Create the owner and runtime roles, then run `atomic storage migrate` as the owner role (and re-run it after each Atomic upgrade). See [Set up the database](/storage/postgres#set-up-the-database).
|
|
16
|
+
</Step>
|
|
17
|
+
<Step title="Join every machine as the runtime role">
|
|
18
|
+
Install the PostgreSQL adapter, save the runtime role's password in a private file, join the database, and restart Intercom:
|
|
15
19
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
```bash
|
|
21
|
+
atomic install npm:@bastani/atomic-storage-postgres
|
|
22
|
+
(umask 077; printf 'Runtime password: '; read -rs password; printf '\n'; printf '%s' "$password" > ~/atomic-db-password)
|
|
23
|
+
atomic storage join 'postgresql://atomic_runtime@db.example.com:5432/atomic' --password-file ~/atomic-db-password
|
|
24
|
+
rm ~/atomic-db-password # atomic storage join keeps its own copy
|
|
25
|
+
atomic intercom restart
|
|
26
|
+
atomic storage status
|
|
27
|
+
```
|
|
28
|
+
</Step>
|
|
29
|
+
</Steps>
|
|
24
30
|
|
|
25
|
-
|
|
31
|
+
<Warning>
|
|
32
|
+
Never put a password in the database URL. Always pass credentials with `--password-file`, `--token-file`, or `--auth` (see [Join a machine](/storage/postgres#join-a-machine)). A URL containing a password is rejected immediately.
|
|
33
|
+
</Warning>
|
|
26
34
|
|
|
27
|
-
`atomic storage join`
|
|
35
|
+
`atomic storage join` stores sessions in the shared database so any joined machine can resume them. If a machine sets `sessions.storage` to `{}` (keeping sessions local while sharing only Intercom), remove that setting so its sessions go to the shared database too. See [Sharing storage across hosts](/storage#sharing-storage-across-hosts).
|
|
28
36
|
|
|
29
|
-
Keep worktree snapshots enabled (`snapshots.enabled`, on by default). At the end of each turn that modifies files, Atomic saves uncommitted edits, untracked files, and unpushed commits in the shared database. If `snapshots.enabled` is
|
|
37
|
+
Keep worktree snapshots enabled (`snapshots.enabled`, on by default). At the end of each turn that modifies files, Atomic saves uncommitted edits, untracked files, and unpushed commits in the shared database. If `snapshots.enabled` is `false`, session turns do not capture snapshots and cross-machine resume cannot restore repository files (`atomic blueprint prebuild` still runs because it snapshots the committed `HEAD` independently of `snapshots.enabled`).
|
|
30
38
|
|
|
31
|
-
Work inside submodules and untracked nested repositories is not recorded, and resume warns
|
|
39
|
+
Work inside submodules and untracked nested repositories is not recorded, and resume warns so you can commit and push those changes first. See [What is left out](/worktree-snapshots#what-is-left-out).
|
|
32
40
|
|
|
33
41
|
## Resume a session
|
|
34
42
|
|
|
35
43
|
Resume as usual with `atomic --session <id>`, `atomic --resume`, or `/resume` (see [Resuming and deleting sessions](/sessions#resuming-and-deleting-sessions)).
|
|
36
44
|
|
|
37
45
|
- **Matching local checkout.** If you start Atomic inside a checkout of the same repository whose files match the snapshot (or where the recorded edits were committed), the session continues there directly.
|
|
38
|
-
- **Restored worktree.** Otherwise, Atomic restores the recorded state into a worktree under `~/.atomic/agent/worktree-snapshots` without modifying your local checkouts, and prints the restored path. Atomic reuses a clean idle worktree of the same repository when available so existing dependencies and build output stay intact
|
|
46
|
+
- **Restored worktree.** Otherwise, Atomic restores the recorded state into a worktree under `~/.atomic/agent/worktree-snapshots` without modifying your local checkouts, and prints the restored path. Atomic reuses a clean idle worktree of the same repository when available so existing dependencies and build output stay intact ([Restored worktrees](/worktree-snapshots#restored-worktrees)).
|
|
39
47
|
- **Changed local checkout.** If you start `atomic` interactively in a checkout of the same repository that differs and has uncommitted or untracked changes, Atomic asks whether to restore a fresh worktree (the default), continue in your checkout as-is, or cancel. `/resume`, non-interactive modes such as `-p`, and clean differing checkouts restore a fresh worktree automatically.
|
|
40
|
-
- **Partial (degraded) restore.** If the exact tree cannot be rebuilt (for example, an unreachable remote, a missing blob, or unpushed commits touching denied secret files), the session still opens with its full conversation. Atomic restores the closest reachable state and prints a notice naming what is missing and how to recover
|
|
41
|
-
- **Multiple checkouts.** A session that modified several checkouts restores each one that is missing on this machine. Only the checkout the session works in must be restorable; any other checkout that cannot be restored
|
|
42
|
-
- **Timing diagnostics.** Run `/session snapshot` to inspect the **Last resume** timing breakdown
|
|
48
|
+
- **Partial (degraded) restore.** If the exact tree cannot be rebuilt (for example, an unreachable remote, a missing blob, or unpushed commits touching denied secret files), the session still opens with its full conversation. Atomic restores the closest reachable state and prints a notice naming what is missing and how to recover ([Resuming](/worktree-snapshots#resuming)).
|
|
49
|
+
- **Multiple checkouts.** A session that modified several checkouts restores each one that is missing on this machine. Only the checkout the session works in must be restorable; any other checkout that cannot be restored produces a warning without blocking the resume.
|
|
50
|
+
- **Timing diagnostics.** Run `/session snapshot` to inspect the **Last resume** timing breakdown, or run `ATOMIC_TIMING=1 atomic --session <id>` to print timings to stderr ([Inspecting snapshots](/worktree-snapshots#inspecting-snapshots)).
|
|
43
51
|
|
|
44
52
|
Absolute paths from the earlier machine keep working in built-in file tools because Atomic maps paths under the old checkout to the restored worktree. Shell commands run as written, so commands containing old absolute paths need the new worktree path.
|
|
45
53
|
|
|
46
|
-
Passing `--session <id>` for a session whose recorded directory does not exist on this machine opens directly instead of offering to fork
|
|
54
|
+
Passing `--session <id>` for a session whose recorded directory does not exist on this machine opens directly instead of offering to fork. If shared storage does not respond within 15 seconds, `atomic --session`, `--resume`, `--continue`, and `/resume` stop without modifying anything; verify connectivity with `atomic storage status` and try again.
|
|
47
55
|
|
|
48
|
-
|
|
56
|
+
For SDK resume behavior with `createAgentSession({ sessionManager })`, see [Worktree snapshots in the SDK](/sdk#worktree-snapshots) and [SDK session storage](/sdk/storage).
|
|
49
57
|
|
|
50
|
-
### When the session is already open
|
|
58
|
+
### When the session is already open {#when-the-session-is-already-open}
|
|
51
59
|
|
|
52
|
-
A session runs in one process at a time. `atomic --session`, `--resume`, and `--continue` claim the session before writing to it or restoring checkouts. If another live process on
|
|
60
|
+
A session runs in one process at a time. `atomic --session`, `--resume`, and `--continue` claim the session before writing to it or restoring checkouts. If another live process on the same agent directory already holds the session, resume makes no changes and exits with code `75`:
|
|
53
61
|
|
|
54
62
|
```text
|
|
55
63
|
Error: Session <id> is already open in process <pid> on <host>. Nothing was changed. Close it there or wait for that process to exit, then resume again.
|
|
@@ -57,9 +65,12 @@ Error: Session <id> is already open in process <pid> on <host>. Nothing was chan
|
|
|
57
65
|
|
|
58
66
|
Interactive mode prints the same message before starting. If several resumes start simultaneously, one succeeds and the others exit with code `75`.
|
|
59
67
|
|
|
60
|
-
|
|
68
|
+
Atomic uses two separate coordination records:
|
|
61
69
|
|
|
62
|
-
|
|
70
|
+
- **Session claims (`~/.atomic/agent/session-claims/<id>.json`).** Prevent concurrent resumes across processes sharing an agent directory. Claims left by dead processes (such as after `SIGKILL`) are taken over automatically—matching holders by PID and, on Linux and Windows, by process start time so reused PIDs never block resume. Claims refresh every 15 seconds and expire after 60 seconds without a refresh on another host sharing the directory.
|
|
71
|
+
- **Open-session markers (SQL `session_open_markers` or `<agentDir>/open-sessions/<id>/<token>.json`).** Track active sessions across every host sharing a database so another host cannot delete an open session and one-way shared-history schema upgrades wait until older releases close. Markers refresh every 15 seconds, expire after 60 seconds from another host, and expire after 24 hours without a refresh on same-host markers that lack a process start timestamp (such as on macOS).
|
|
72
|
+
|
|
73
|
+
If a process using a different agent directory writes to the same session in shared storage at the same time, the conflicting write stops with `Another process wrote to session <id> ...` and exit code `1`. Resume again to continue from saved state.
|
|
63
74
|
|
|
64
75
|
## Resuming subagents on another machine
|
|
65
76
|
|
|
@@ -69,9 +80,9 @@ When a background subagent resumes on another machine, Atomic maps its recorded
|
|
|
69
80
|
|
|
70
81
|
Only subagents whose parent uses JSONL session files, and file-backed subagents from earlier releases, stay tied to the machine that launched them and report as unrestorable elsewhere.
|
|
71
82
|
|
|
72
|
-
## Set the environment up with a blueprint
|
|
83
|
+
## Set the environment up with a blueprint {#set-the-environment-up-with-a-blueprint}
|
|
73
84
|
|
|
74
|
-
A restored worktree contains repository files, not installed dependencies, runtimes, or build output. A *blueprint* defines how Atomic
|
|
85
|
+
A restored worktree contains repository files, not installed dependencies, runtimes, or build output. A *blueprint* defines how Atomic rebuilds the environment. Atomic uses the [blueprint](https://docs.devin.ai/onboard-devin/environment/blueprints) YAML format, reading `.atomic/blueprint.yaml` instead of `.devin/blueprint.yaml` (Atomic never reads `.devin/` paths).
|
|
75
86
|
|
|
76
87
|
| Blueprint | File | Working directory |
|
|
77
88
|
| --- | --- | --- |
|
|
@@ -99,7 +110,9 @@ knowledge:
|
|
|
99
110
|
Run the tests with `pnpm test`.
|
|
100
111
|
```
|
|
101
112
|
|
|
102
|
-
|
|
113
|
+
<Warning>
|
|
114
|
+
**Always set `runs-on` for macOS or Windows.** If a blueprint omits `runs-on`, Atomic defaults to `["linux"]` only, which silently skips the blueprint on macOS and Windows. Set `runs-on: [macos]`, `runs-on: [windows]`, or `runs-on: [linux, macos, windows]`, or define separate `---`-separated YAML documents per operating system.
|
|
115
|
+
</Warning>
|
|
103
116
|
|
|
104
117
|
| Section | Purpose | When it runs |
|
|
105
118
|
| --- | --- | --- |
|
|
@@ -108,26 +121,38 @@ knowledge:
|
|
|
108
121
|
| `knowledge` | List of `{ name, contents }` items (by convention `lint`, `test`, and `build`) | Never executed. Provided to the agent as context |
|
|
109
122
|
| `post-build` | Verify the assembled environment (global blueprint only) | During a build, after all repositories |
|
|
110
123
|
|
|
111
|
-
Each section accepts a single string (one `run` step) or a list of steps. A step is a bare string, `{ name?, run, env? }`, or `{ name?, uses, with?, env? }`, never both `run` and `uses`. `with` applies only to `uses
|
|
124
|
+
Each section accepts a single string (one `run` step) or a list of steps. A step is a bare string, `{ name?, run, env? }`, or `{ name?, uses, with?, env? }`, never both `run` and `uses`. `with` applies only to `uses`: YAML scalars convert to strings, `null` becomes `""`, and YAML arrays or objects serialize as JSON strings.
|
|
125
|
+
|
|
126
|
+
`uses` accepts `github.com/<owner>/<repo>[/<subpath>]@<ref>` in `initialize` and `post-build` (never in `maintenance`, where Atomic rejects it). Owner must start with an alphanumeric character and use `[A-Za-z0-9-]`, repo uses `[A-Za-z0-9._-]`, and `ref` cannot start with `-` or contain whitespace, control characters, or `~^:?*[\`. Anything an action writes to `GITHUB_ENV` or `GITHUB_PATH` is appended to `$ENVRC` automatically for later steps and the session. Actions cache under `~/.atomic/agent/blueprint-actions`; set `ATOMIC_BLUEPRINT_GITHUB_BASE_URL` to fetch actions from a host other than `https://github.com`.
|
|
112
127
|
|
|
113
|
-
|
|
128
|
+
<Accordion title="GitHub Actions compatibility details">
|
|
129
|
+
- **Supported action types:** Node.js actions targeting `node12`, `node16`, `node20`, or `node24`, and composite actions. Docker actions and unknown `runs.using` types fail the step.
|
|
130
|
+
- **Lifecycle hooks:** Node.js actions run `runs.pre` (respecting `runs.pre-if`) and `runs.main`. `runs.post` and `runs.post-if` are ignored.
|
|
131
|
+
- **Nesting limit:** Composite actions can nest nested `uses` steps up to **10** levels deep.
|
|
132
|
+
- **Expressions:** Composite actions support `contains`, `startsWith`, `endsWith`, `format`, `join`, `toJSON`, `fromJSON`, `always`, `success`, `failure`, and `cancelled`, along with standard comparison and boolean operators. `hashFiles`, `secrets`, and `matrix` expressions fail the step.
|
|
133
|
+
- **Stubbed `github.*` context:** `github.workspace`, `github.action_path`, `github.action_repository`, and `github.action_ref` reflect the actual build directory and action. Other `github.*` fields use fixed stubs (such as `github.repository: "atomic/blueprint"`, `github.sha: "0000000000000000000000000000000000000000"`, `github.token: ""`, `github.event: {}`).
|
|
134
|
+
</Accordion>
|
|
114
135
|
|
|
115
136
|
Key blueprint rules:
|
|
116
137
|
|
|
117
|
-
- **Platforms and validation.** `runs-on` accepts a string or list matched case-insensitively (`default` and `linux` are aliases; `macos` and `windows` are explicit
|
|
118
|
-
- **Shell.** `shell` accepts `"default"`, `"bash"`, or `"powershell"` (case-insensitive). `run` steps execute in bash (Git Bash on Windows) with `set -e
|
|
119
|
-
- **Environment.** Step `env:` applies to that step only and overrides `$ENVRC`. In bash, Atomic sources `$ENVRC` with `set -a`, so plain `KEY=VALUE` lines appended to `$ENVRC` (for example `echo "API_URL=http://localhost:3000" >> "$ENVRC"`) are exported
|
|
138
|
+
- **Platforms and validation.** `runs-on` accepts a string or list matched case-insensitively (`default` and `linux` are aliases; `macos` and `windows` are explicit). A file can hold multiple `---`-separated YAML documents as long as no two documents target the same platform. A machine runs only its matching document, but Atomic validates **every** document in the file.
|
|
139
|
+
- **Shell.** `shell` accepts `"default"`, `"bash"`, or `"powershell"` (case-insensitive). `run` steps execute in bash (Git Bash on Windows) with `set -e`. Setting `shell: powershell` runs PowerShell on Windows with `$ErrorActionPreference = 'Stop'` (on Linux and macOS, `run` steps always execute in bash). Commands must be non-interactive.
|
|
140
|
+
- **Environment.** Step `env:` applies to that step only and overrides `$ENVRC`. In bash, Atomic sources `$ENVRC` with `set -a`, so plain `KEY=VALUE` lines appended to `$ENVRC` (for example `echo "API_URL=http://localhost:3000" >> "$ENVRC"`) are exported to later steps and the resumed session's bash tool without needing `export`. On Windows, `$ENVRC` is evaluated by Git Bash with `PATH` converted back automatically; from PowerShell steps, write UTF-8 bash assignments with LF line endings and no BOM to `$env:ENVRC`. `$ENVRC` starts empty on every build, so `maintenance` should not depend on values `initialize` wrote during an earlier build.
|
|
120
141
|
- **Timeout.** Any step running longer than 3 hours is stopped and marked failed.
|
|
121
142
|
- **Includes.** The repository blueprint can list workspace directories (or `<dir>/.atomic/blueprint.yaml` paths) in `includes`, without `..` or duplicates. Workspace blueprints cannot declare `includes`, global blueprints ignore `includes`, and only global blueprints allow `post-build`.
|
|
122
143
|
- **Ignored keys.** `clone` is ignored with a warning because resume restores the recorded tree. `cache` triggers a warning pointing to `resume.cache`. Other unknown keys are ignored silently.
|
|
123
144
|
|
|
124
|
-
Note
|
|
145
|
+
<Note>
|
|
146
|
+
Legacy `.atomic/setup` is no longer read. `resume.setupCommand` is deprecated and **global-only** (project `.atomic/settings.json` values are silently ignored); it runs temporarily as a single global maintenance step with a deprecation warning. Move its command into `.atomic/blueprint.yaml` under `maintenance`.
|
|
147
|
+
</Note>
|
|
125
148
|
|
|
126
149
|
### How blueprint builds run
|
|
127
150
|
|
|
128
151
|
When resume restores a worktree, Atomic builds in order: global `initialize` and `maintenance`, then each repository's `initialize` and `maintenance` (followed by its included workspaces), then global `post-build`. Existing local checkouts that resume directly are never built.
|
|
129
152
|
|
|
130
|
-
|
|
153
|
+
<Note>
|
|
154
|
+
**Project trust required.** A restored worktree is a new directory, so project trust starts unset just like a fresh clone. Repository blueprints run only for trusted projects (saved trust, `--approve`, or `"defaultProjectTrust": "always"`). Untrusted worktrees skip project instructions, resources, and blueprint builds (the agent still receives `maintenance` and `knowledge` marked as not yet run), and the global blueprint runs only when at least one restored worktree is trusted.
|
|
155
|
+
</Note>
|
|
131
156
|
|
|
132
157
|
Builds are differential. Atomic compares each workspace blueprint against the last successful build on this machine:
|
|
133
158
|
|
|
@@ -135,33 +160,40 @@ Builds are differential. Atomic compares each workspace blueprint against the la
|
|
|
135
160
|
- New, edited, or previously failed workspaces run both `initialize` and `maintenance`.
|
|
136
161
|
- A full rebuild runs across all workspaces (including global `initialize`) whenever the global blueprint changes or the last full build is older than 7 days.
|
|
137
162
|
|
|
138
|
-
A step fails if its command exits non-zero, raises a PowerShell error, times out after 3 hours, or cannot start (Atomic
|
|
163
|
+
A step fails if its command exits non-zero, raises a PowerShell error, times out after 3 hours, or cannot start (Atomic retries temporarily busy executables for up to 2 seconds before failing). When a step fails, the remaining steps of that blueprint are skipped while other repositories and workspaces continue building. A blueprint failure never blocks resuming the session:
|
|
139
164
|
|
|
140
165
|
| Outcome | Result | What you see |
|
|
141
166
|
| --- | --- | --- |
|
|
142
167
|
| Repository or workspace blueprint failed | Partial. Worktree files are intact and usable. | Warning naming the blueprint, failing step, and log path |
|
|
143
|
-
| Global blueprint or `post-build` failed | Failed. Repository blueprints do not run. | Prominent warning
|
|
168
|
+
| Global blueprint or `post-build` failed | Failed. Repository blueprints do not run. | Prominent warning; the session still resumes |
|
|
144
169
|
| No blueprint, untrusted worktree, or no matching platform | Nothing ran | Nothing |
|
|
145
170
|
|
|
146
|
-
On Windows, if a stopped step could not be tracked as a process group after its root command exited, Atomic warns that child processes may still be running
|
|
171
|
+
On Windows, if a stopped step could not be tracked as a process group after its root command exited, Atomic warns that child processes may still be running; check for leftover processes before retrying.
|
|
172
|
+
|
|
173
|
+
Blueprint build state lives under `~/.atomic/agent/worktree-snapshots/`:
|
|
147
174
|
|
|
148
|
-
|
|
175
|
+
- `blueprint-logs/`: per-step logs with command, timestamps, duration, exit status, and output.
|
|
176
|
+
- `blueprint-builds/ledger.json`: differential build ledger on this machine.
|
|
177
|
+
- `blueprint-builds/locks/<rootKey>.json`: active build lock per restored worktree.
|
|
178
|
+
- `blueprint-env/<hash>.envrc`: exported session environment written to `$ENVRC`.
|
|
149
179
|
|
|
150
|
-
|
|
180
|
+
To recover from a failed build, read the step log, fix the environment or blueprint, and resume again.
|
|
181
|
+
|
|
182
|
+
### Start the first turn while the build runs {#start-the-first-turn-while-the-build-runs}
|
|
151
183
|
|
|
152
184
|
`resume.waitForBlueprint` controls whether Atomic waits for blueprint builds before opening the session:
|
|
153
185
|
|
|
154
|
-
- `"prompt"` (default in
|
|
186
|
+
- `"prompt"` (default in interactive mode) opens the session after the build finishes.
|
|
155
187
|
- `"tools"` (default in `-p`, `--mode json`, `--mode rpc`, and SDK sessions) opens the session immediately after restoring files so the first model request starts while the build runs in the background.
|
|
156
188
|
|
|
157
|
-
In `"tools"` mode, Atomic tells the agent that the environment is still building and holds every tool call and shell command in the restored worktree (including forks or switches into that worktree) until the build settles. The first waiting tool call receives the build result ahead of its own output. Warnings are
|
|
189
|
+
In `"tools"` mode, Atomic tells the agent that the environment is still building and holds every tool call and shell command in the restored worktree (including forks or switches into that worktree) until the build settles. The first waiting tool call receives the build result ahead of its own output. Warnings are delivered once via stderr (`-p`) or a `blueprint_build_finished` event (`--mode json` and `--mode rpc`).
|
|
158
190
|
|
|
159
191
|
Interrupting a turn cancels the tool wait without stopping the build. `atomic -p` and `--mode json` print their answer and exit once the build finishes.
|
|
160
192
|
|
|
161
193
|
Stopping and concurrent builds:
|
|
162
194
|
|
|
163
195
|
- **Graceful stop (Ctrl-C, signals, or RPC stdin closing).** Atomic stops running build processes and rebuilds the worktree on the next resume.
|
|
164
|
-
- **Abrupt kill (`SIGKILL`).** On Unix, the next resume cancels the interrupted build, terminates confirmed recorded build processes, sets that worktree aside so no session reuses it, and restores and builds a fresh worktree with a warning naming the set-aside path and logs. Atomic cleans up set-aside worktrees once no process uses them ([
|
|
196
|
+
- **Abrupt kill (`SIGKILL`).** On Unix, the next resume cancels the interrupted build, terminates confirmed recorded build processes, sets that worktree aside so no session reuses it, and restores and builds a fresh worktree with a warning naming the set-aside path and logs. Atomic cleans up set-aside worktrees once no process uses them ([Pooling and set-aside worktrees](/worktree-snapshots/reference#idle-reuse-eviction-and-set-aside-worktrees)). On Windows, step processes exit with Atomic, so the next resume rebuilds the same worktree.
|
|
165
197
|
- **Concurrent resumes on one worktree.** Only one build runs per worktree. Switching back to a session whose build is still running joins it. Another Atomic process waits up to 5 minutes (printing a stderr line or emitting `blueprint_build_waiting`) before rebuilding with a warning.
|
|
166
198
|
|
|
167
199
|
To override the mode default, set `resume.waitForBlueprint` in settings:
|
|
@@ -172,20 +204,27 @@ To override the mode default, set `resume.waitForBlueprint` in settings:
|
|
|
172
204
|
|
|
173
205
|
When an installed extension can decline saved project trust ([Project trust](/security#project-trust)), resume always defers the blueprint build like `"tools"` until trust is decided, and untrusted worktrees stay unbuilt.
|
|
174
206
|
|
|
207
|
+
<Accordion title="SDK and JSON/RPC events for background blueprint builds">
|
|
208
|
+
- **`blueprint_build_finished`** (SDK hook: `onBlueprintBuildFinished(listener)`): emitted once when a background build settles, with `{ type: "blueprint_build_finished", sessionId, roots, notices }` where each notice is `{ type: "info" | "warning", message }`.
|
|
209
|
+
- **`blueprint_build_waiting`** (SDK hook: `onBlueprintBuildWaiting(listener)`): emitted when a resume waits for another process's build on the same worktree, with `{ type: "blueprint_build_waiting", root, message }`.
|
|
210
|
+
- Both hooks replay any unannounced events from the current process when first subscribed and return an unsubscribe function. Use `blueprintBuildSettled(sessionId)` in the SDK to await build completion explicitly.
|
|
211
|
+
</Accordion>
|
|
212
|
+
|
|
175
213
|
### What the agent sees
|
|
176
214
|
|
|
177
215
|
The first turn of a resumed session includes each applicable blueprint's `maintenance` steps and `knowledge` items, tagged with their build status (ran in this build, not yet run, or partial with the failing step and log path). The agent reruns `maintenance` itself if dependencies change. Atomic's default system prompt also guides the agent to maintain `.atomic/blueprint.yaml` as project setup evolves, leaving `~/.atomic/agent/blueprint.yaml` alone unless asked.
|
|
178
216
|
|
|
179
|
-
### Caches for runners
|
|
217
|
+
### Caches for runners {#caches-for-runners}
|
|
180
218
|
|
|
181
|
-
Ephemeral runners start with an empty home directory on every job. Run `atomic blueprint cache-key` to
|
|
219
|
+
Ephemeral runners start with an empty home directory on every job. Run `atomic blueprint cache-key` to compute cache keys, restore prefixes, and paths for CI cache actions such as `actions/cache` (Atomic never uploads or downloads caches itself):
|
|
182
220
|
|
|
183
221
|
```bash
|
|
184
222
|
atomic blueprint cache-key [dir] [--format text|json|github-output]
|
|
185
223
|
```
|
|
186
224
|
|
|
187
|
-
Atomic detects package stores automatically from lockfiles at the repository root
|
|
225
|
+
Atomic detects package stores automatically from lockfiles at the repository root (subdirectory lockfiles in monorepos are not auto-detected). It reads project `resume.cache` from `.atomic/settings.json` without requiring project trust (validating paths and refusing credential locations without executing any project code) and hashes the root `.atomic/blueprint.yaml`.
|
|
188
226
|
|
|
227
|
+
<Accordion title="Auto-detected package stores (11 ecosystems)">
|
|
189
228
|
| Root files | Detected stores (Linux default) |
|
|
190
229
|
| --- | --- |
|
|
191
230
|
| `package-lock.json`, `npm-shrinkwrap.json` | `~/.npm` (`npm_config_cache`) |
|
|
@@ -200,9 +239,10 @@ Atomic detects package stores automatically from lockfiles at the repository roo
|
|
|
200
239
|
| `build.gradle(.kts)`, `settings.gradle(.kts)`, `gradle.lockfile`, Gradle wrapper | `~/.gradle/caches`, `~/.gradle/wrapper` (`GRADLE_USER_HOME`) |
|
|
201
240
|
| `pom.xml` | `~/.m2/repository` |
|
|
202
241
|
|
|
203
|
-
Environment variables in parentheses
|
|
242
|
+
Environment variables in parentheses override each store path, and `XDG_CACHE_HOME` moves Linux `~/.cache` paths. On macOS, Yarn v1 uses `~/Library/Caches/Yarn`, pip uses `~/Library/Caches/pip`, Poetry uses `~/Library/Caches/pypoetry`, Go build cache uses `~/Library/Caches/go-build`, and pnpm uses `~/Library/pnpm/store` (npm, uv, Bun, Cargo, Go modules, Gradle, and Maven match Linux). On Windows, paths use `%LOCALAPPDATA%` (`npm-cache`, `pnpm\store`, `Yarn\Cache`, `uv\cache`, `pip\Cache`, `pypoetry\Cache`, and `go-build` for `GOCACHE`).
|
|
243
|
+
</Accordion>
|
|
204
244
|
|
|
205
|
-
Declare additional stores or build outputs under `resume.cache` in `.atomic/settings.json` (a project list replaces the global list
|
|
245
|
+
Declare additional stores or build outputs under `resume.cache` in `.atomic/settings.json` (a project list replaces the global list; blueprints themselves do not declare caches):
|
|
206
246
|
|
|
207
247
|
```json
|
|
208
248
|
{
|
|
@@ -224,35 +264,44 @@ Each entry takes `paths`, an optional `kind`, and optional `keyFiles`:
|
|
|
224
264
|
|
|
225
265
|
| Entry | Paths | Key changes when |
|
|
226
266
|
| --- | --- | --- |
|
|
227
|
-
| `stores` | Detected package stores plus `"store"` paths in `resume.cache` | Lockfiles, `keyFiles`, `resume.cache`, repository blueprint, OS, or architecture change |
|
|
267
|
+
| `stores` | Detected package stores plus `"store"` paths in `resume.cache` | Lockfiles, `keyFiles`, `resume.cache`, root repository blueprint, OS, or architecture change |
|
|
228
268
|
| `build` | Parked `"build"` paths and seed manifest | Same inputs as `stores` |
|
|
229
|
-
| `git` | Atomic's Git object store for the repository | Checkout `HEAD` changes (restore newest via restore prefix) |
|
|
269
|
+
| `git` | Atomic's Git object store for the repository | Checkout `HEAD` changes (omits CPU architecture; uses `"unborn"` when `HEAD` has no commits yet; restore newest via restore prefix) |
|
|
230
270
|
| `atomic` | Atomic's compiled extension cache | Atomic version, OS, or architecture change |
|
|
231
271
|
|
|
232
272
|
Entries with no paths are omitted. The `git` and `build` entries require a Git remote. Atomic normalizes HTTPS remotes and `git@` SSH remotes by host and repository path so HTTPS runner checkouts reuse caches built from SSH checkouts (other SSH usernames stay distinct).
|
|
233
273
|
|
|
234
|
-
|
|
274
|
+
<Accordion title="Excluded credential paths">
|
|
275
|
+
To protect secrets, `cache-key` omits store paths inside the worktree, snapshot-denied paths ([What is left out](/worktree-snapshots#what-is-left-out)), `<agentDir>/auth.json`, and these home credential paths (along with any parent directory containing one, so `~/.cargo` is omitted because it holds `~/.cargo/credentials`, while `~/.cargo/registry` is allowed):
|
|
276
|
+
|
|
277
|
+
`.aws`, `.azure`, `.cargo/credentials`, `.cargo/credentials.toml`, `.config/gcloud`, `.config/gh`, `.docker/config.json`, `.gem/credentials`, `.git-credentials`, `.gnupg`, `.gradle/gradle.properties`, `.kube`, `.m2/settings.xml`, `.netrc`, `.npmrc`, `.pypirc`, `.ssh`, `.terraform.d/credentials.tfrc.json`, and `.yarnrc.yml`.
|
|
278
|
+
|
|
279
|
+
Checks run case-insensitively and across symlinks, printing a warning on stderr for every omitted path.
|
|
280
|
+
</Accordion>
|
|
235
281
|
|
|
236
282
|
Use `--format github-output` to emit `<name>-key`, `<name>-restore-prefix`, and `<name>-paths` lines for `$GITHUB_OUTPUT`. See [Caching between runs](/guides/team-setup#caching-between-runs) for a full GitHub Actions workflow.
|
|
237
283
|
|
|
238
|
-
### Prebuilt worktrees
|
|
284
|
+
### Prebuilt worktrees {#prebuilt-worktrees}
|
|
239
285
|
|
|
240
286
|
`atomic blueprint prebuild` prepares a repository ahead of time so a later resume starts with dependencies and build artifacts already built:
|
|
241
287
|
|
|
242
288
|
```bash
|
|
243
|
-
atomic blueprint prebuild [dir] [--park] [--approve]
|
|
289
|
+
atomic blueprint prebuild [dir] [--park] [--approve|-a]
|
|
244
290
|
```
|
|
245
291
|
|
|
246
292
|
Prebuild restores the committed `HEAD` at `dir` (defaulting to the current directory) into a new worktree, runs `initialize` and `maintenance`, and leaves the worktree idle for the next resume to claim. Only committed files are restored, so untracked or ignored files such as `.env` never enter the worktree.
|
|
247
293
|
|
|
248
294
|
Prebuild requires:
|
|
249
295
|
|
|
250
|
-
- `snapshots.enabled` set to `true` (otherwise it exits with `snapshots are disabled`).
|
|
251
296
|
- A Git remote on the checkout.
|
|
252
|
-
- No uncommitted edits to tracked files, and no unpushed commits touching denied secret files
|
|
253
|
-
- A trusted project (saved trust, `"defaultProjectTrust": "always"`, or `--approve`), because prebuild runs project code.
|
|
297
|
+
- No uncommitted edits to tracked files, and no unpushed commits touching denied secret files.
|
|
298
|
+
- A trusted project (saved trust, `"defaultProjectTrust": "always"`, or `--approve` / `-a`), because prebuild runs project code.
|
|
299
|
+
|
|
300
|
+
<Note>
|
|
301
|
+
`atomic blueprint prebuild` snapshots the committed `HEAD` directly (without untracked files) even if `snapshots.enabled` is set to `false` in `settings.json`.
|
|
302
|
+
</Note>
|
|
254
303
|
|
|
255
|
-
|
|
304
|
+
Exit codes: `0` when an idle worktree is ready, `1` when the project is untrusted, a precondition is not met, or a blueprint step fails (removing the new worktree while keeping earlier worktrees and seeds), and `2` on invalid CLI arguments. Timings print to stderr.
|
|
256
305
|
|
|
257
306
|
With `--park`, Atomic moves untracked build output declared with `"kind": "build"` in [`resume.cache`](#caches-for-runners) into `~/.atomic/agent/worktree-snapshots/seeds/` along with a manifest naming the built commit. When another machine restores that cache and has no idle worktree, resume creates a worktree at the same path used during prebuild, moves the parked output into place (without overwriting tracked or existing files), and checks out the session snapshot. `/session snapshot` labels such restores `(seeded)` with a `seed` timing line.
|
|
258
307
|
|
|
@@ -260,38 +309,42 @@ If parking cannot acquire the seed lock, prebuild reports the error, leaves exis
|
|
|
260
309
|
|
|
261
310
|
## What can stop a resume
|
|
262
311
|
|
|
263
|
-
Atomic checks required setup in one pass before restoring anything: the storage adapter, its credentials, and Git. When Git is absent, Atomic
|
|
312
|
+
Atomic checks required setup in one pass before restoring anything: the storage adapter, its credentials, and Git. When Git is absent, Atomic downloads a verified portable Git automatically unless offline or download fails.
|
|
264
313
|
|
|
265
|
-
For session resumes, missing Git never blocks opening the session
|
|
314
|
+
For session resumes, missing Git never blocks opening the session—it opens in its recorded or launch directory with a notice for each unrestored checkout. A session resume fails only when the session cannot be read, a snapshot fails security checks, or a target directory contains unexpected files. Blueprint failures never stop a resume.
|
|
266
315
|
|
|
267
|
-
| Symptom |
|
|
268
|
-
| --- | --- |
|
|
269
|
-
| Session ID not found on this machine | If this machine keeps
|
|
270
|
-
| Missing storage adapter, missing or unreadable credentials, or
|
|
271
|
-
| Git cannot be started or downloaded |
|
|
272
|
-
| Shared database unreachable
|
|
273
|
-
|
|
|
274
|
-
|
|
|
275
|
-
|
|
|
276
|
-
| Snapshot fails security validation (credentials in remote URL, `ext::` remote helper, or malformed hashes) | Resume only sessions from trusted storage, or re-export from the source machine. Nothing is fetched or run. | `WorkspaceRestoreError` (`invalid-snapshot`) |
|
|
277
|
-
|
|
278
|
-
Secret values never appear in error messages; errors name only the file or environment variable. SDK error classes, codes, and `isResume*Error` guards are exported from `@bastani/atomic`; see [Resuming on another machine](/sdk/reference#resuming-on-another-machine).
|
|
316
|
+
| Symptom | What to do |
|
|
317
|
+
| --- | --- |
|
|
318
|
+
| Session ID not found on this machine | If this machine keeps sessions locally, join the shared database with `atomic storage join` and remove any `sessions.storage` override. If already joined, check the session ID, database URL, and table prefix. |
|
|
319
|
+
| Missing storage adapter, missing or unreadable credentials, or offline mode | Follow each fix listed in the error—run `atomic install`, create the password or token file, or unset offline mode. |
|
|
320
|
+
| Git cannot be started or downloaded | Install Git on `PATH` or unset `ATOMIC_OFFLINE`. Session resumes still open without restoring checkouts. |
|
|
321
|
+
| Shared database unreachable or timed out after 15 seconds | Check connectivity with `atomic storage status` and resume again. |
|
|
322
|
+
| Checkout cannot be rebuilt identically (denied unpushed commits, missing blob, or full disk) | Follow the printed notice (for unpushed commits, push from the original machine and resume again). The session still opens with the closest state. |
|
|
323
|
+
| Windows worktree path exceeds Git for Windows limits | Set `ATOMIC_CODING_AGENT_DIR` to a shorter path ([Long paths on Windows](#long-paths-on-windows)). Nothing is written. |
|
|
324
|
+
| Snapshot fails security validation (credentials in remote URL, `ext::` helper, or malformed hashes) | Resume only sessions from trusted storage, or re-export from the source machine. Nothing is fetched or run. |
|
|
279
325
|
|
|
280
|
-
|
|
326
|
+
Secret values never appear in error messages; errors name only the file or environment variable.
|
|
281
327
|
|
|
282
|
-
|
|
328
|
+
<Accordion title="SDK resume and blueprint error classes">
|
|
329
|
+
All resume and blueprint errors carry stable `code`, `hint`, `retryable`, and JSON-safe `fields` and are exported from `@bastani/atomic`:
|
|
283
330
|
|
|
284
|
-
|
|
331
|
+
- **Resume errors:** `ResumeNotFoundError` (`not-found`, reasons `local-storage-not-joined` / `shared-miss`), `ResumePreconditionError` (`preconditions-unmet`), `ResumeCatalogUnavailableError` (`catalog-unavailable`), `ResumeCatalogTimeoutError` (`catalog-timeout`), `GitUnavailableError`, `WorkspaceDriftError`, and `WorkspaceRestoreError` (`path-too-long`, `invalid-snapshot`), with `isResume*Error` guards. See [Resuming on another machine](/sdk/reference#resuming-on-another-machine) and [Worktree snapshot errors](/worktree-snapshots/reference#errors).
|
|
332
|
+
- **Blueprint errors (`BlueprintError`):** Resuming never throws a `BlueprintError`—instead, builds record failures in `BlueprintBuildOutcome.failures` so the session still resumes with warnings:
|
|
333
|
+
- `BlueprintInvalidError` (`code: "blueprint-invalid"`): invalid YAML or rule violation (`reason`: `yaml-syntax`, `not-a-mapping`, `invalid-shell`, `invalid-field`, `uses-in-maintenance`, `run-and-uses`, `missing-run-or-uses`, `with-without-uses`, `invalid-uses-reference`, `duplicate-platform`, `nested-includes`, `include-parent-path`, `duplicate-include`, or `post-build-not-global`).
|
|
334
|
+
- `BlueprintStepFailedError` (`code: "blueprint-step-failed"`): step exited non-zero, stopped by a signal, or could not start (`exitStatus`, `signal`, `logPath`).
|
|
335
|
+
- `BlueprintStepTimedOutError` (`code: "blueprint-step-timed-out"`): step exceeded its 3-hour timeout (`timeoutMs`, `elapsedMs`, `phase`, `logPath`).
|
|
336
|
+
- `BlueprintUsesUnsupportedError` (`code: "blueprint-uses-unsupported"`): `uses` action could not run (`reason`: `docker-action`, `unknown-action-type`, `action-not-found`, `action-fetch-failed`, `action-metadata-invalid`, `node-unavailable`, `required-input-missing`, or `unsupported-expression`).
|
|
337
|
+
- `BlueprintBuildFailedError` (`code: "blueprint-build-failed"`): build infrastructure failure (`phase`: `read-blueprint`, `ledger`, `environment`, or `unknown`).
|
|
338
|
+
- Match and pass across boundaries with `isBlueprintError`, `isBlueprintInvalidError`, `isBlueprintStepFailedError`, `isBlueprintStepTimedOutError`, `isBlueprintUsesUnsupportedError`, `isBlueprintBuildFailedError`, `findBlueprintError`, `serializeBlueprintError`, and `rehydrateBlueprintError`.
|
|
339
|
+
</Accordion>
|
|
285
340
|
|
|
286
|
-
|
|
341
|
+
## Long paths on Windows {#long-paths-on-windows}
|
|
287
342
|
|
|
288
|
-
|
|
289
|
-
- Worktree root: 212 characters
|
|
290
|
-
- Worktree Git directory under `<store>\worktrees`: 247 characters
|
|
343
|
+
Sessions resume on Windows the same way as on Linux and macOS (see [Windows setup](/windows)).
|
|
291
344
|
|
|
292
|
-
Atomic
|
|
345
|
+
Atomic restores worktrees under `%USERPROFILE%\.atomic\agent` unless `ATOMIC_CODING_AGENT_DIR` overrides it. Even with `core.longpaths`, Git for Windows enforces path limits on administrative paths (220 characters for the object store, 212 for the worktree root, and 247 for the worktree Git directory). Atomic keeps internal names short and enables `core.longpaths`, so an agent directory path up to about 155 characters works.
|
|
293
346
|
|
|
294
|
-
If a longer agent directory would exceed those limits, restore
|
|
347
|
+
If a longer agent directory would exceed those limits, restore stops before writing anything. Point `ATOMIC_CODING_AGENT_DIR` at a shorter path:
|
|
295
348
|
|
|
296
349
|
```powershell
|
|
297
350
|
$env:ATOMIC_CODING_AGENT_DIR = "C:\atomic\agent"
|