@bastani/atomic 0.10.10-alpha.1 → 0.10.10
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 +85 -0
- package/README.md +22 -15
- 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 +2 -2
- package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +2 -2
- package/dist/_shared/mode-shared-2QJSCUM6.js +2 -2
- package/dist/_shared/p1a-prewarm-XIU57JHF.js +3 -3
- package/dist/_shared/sdk-RRLVN7ER.js +2 -2
- package/dist/_shared/session-data-AHTU7IS6.js +2 -2
- package/dist/_shared/startup-0-0-4VG2G44V.js +2 -2
- package/dist/_shared/startup-0-1-XTIL65D4.js +2 -2
- package/dist/_shared/startup-0-2-27OWFHV6.js +7 -6
- package/dist/_shared/startup-0-2-27OWFHV6.js.map +1 -1
- package/dist/_shared/startup-0-3-T4DVFYWX.js +2 -2
- package/dist/_shared/startup-0-4-ZMJV547D.js +2 -2
- package/dist/_shared/startup-0-5-FD2P735I.js +2 -2
- package/dist/_shared/startup-10-0-TDQNBDDL.js +2 -2
- package/dist/_shared/startup-15-1-4S7FLMNG.js +2 -2
- package/dist/_shared/startup-8-0-34CBHPZH.js +2 -2
- package/dist/_shared/startup-8-1-4KANEHRA.js +2 -2
- package/dist/_shared/storage-command-7MGXLJGZ.js +2 -2
- package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +2 -2
- package/dist/_shared/tree-outline-MUEPK5B7.js +2 -2
- package/dist/builtin/intercom/CHANGELOG.md +6 -0
- package/dist/builtin/intercom/README.md +4 -4
- package/dist/builtin/intercom/index.bundle.mjs +1 -1
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/README.md +28 -4
- package/dist/builtin/mcp/index.bundle.mjs +1 -1
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +8 -0
- package/dist/builtin/subagents/README.md +3 -3
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +1 -1
- package/dist/builtin/web-access/CHANGELOG.md +9 -0
- package/dist/builtin/web-access/README.md +2 -2
- package/dist/builtin/web-access/index.bundle.mjs +1 -1
- package/dist/builtin/web-access/package.json +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 +2 -2
- 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.impl.js +3 -3
- package/dist/cli/session-picker.js +3 -3
- 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.impl.js +3 -3
- package/dist/cli/storage-search-session.js +3 -3
- 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/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.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.impl.js +3 -3
- package/dist/core/sdk.js +3 -3
- package/dist/core/session-manager-core.js +2 -2
- 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.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.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.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.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.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.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.impl.js +3 -3
- package/dist/extensions/mcp/runtime.js +3 -3
- 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/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/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.md +8 -5
- package/docs/build.md +11 -6
- package/docs/changelog.mdx +1 -1
- package/docs/codemode.md +10 -2
- package/docs/compaction/reference.md +6 -4
- package/docs/compaction.md +3 -3
- package/docs/containerization.md +13 -5
- package/docs/custom-provider/api-reference.md +8 -6
- package/docs/custom-provider/oauth.md +4 -4
- package/docs/custom-provider/registration.md +3 -3
- package/docs/custom-provider.md +8 -8
- package/docs/development.md +40 -5
- package/docs/docs.json +21 -5
- package/docs/environment-variables.md +20 -18
- package/docs/extensions/api-reference.md +8 -6
- package/docs/extensions/authoring.md +4 -4
- package/docs/extensions.md +43 -6
- package/docs/guides/configuration.md +21 -1
- package/docs/guides/intercom.md +4 -0
- package/docs/guides/non-interactive.md +4 -2
- package/docs/guides/orchestration.md +4 -2
- package/docs/guides/resume-on-any-machine.md +12 -6
- package/docs/guides/subagents.md +4 -0
- package/docs/guides/team-setup.md +13 -2
- package/docs/guides.md +10 -4
- package/docs/herdr.md +4 -4
- package/docs/index.md +12 -4
- package/docs/intercom/operations.md +26 -4
- package/docs/intercom/reference.md +25 -3
- package/docs/intercom.md +13 -5
- package/docs/json.md +2 -0
- package/docs/keybindings.md +17 -4
- package/docs/libraries/agent-core.md +4 -2
- package/docs/libraries/ai.md +71 -53
- package/docs/libraries/codemode.md +3 -2
- package/docs/libraries/schema.md +5 -2
- package/docs/libraries/storage-libsql.md +92 -0
- package/docs/libraries/storage-postgres.md +119 -0
- package/docs/libraries/telemetry.md +35 -2
- package/docs/libraries.md +23 -6
- package/docs/llama-cpp.md +2 -2
- package/docs/mcp-servers.md +50 -4
- package/docs/models/reference.md +13 -9
- package/docs/models-configuration.md +7 -7
- package/docs/models.md +18 -8
- package/docs/orchestration/migrating-workflows.md +2 -2
- package/docs/orchestration/patterns.md +8 -8
- package/docs/orchestration.md +5 -3
- package/docs/packages/authoring.md +3 -1
- package/docs/packages/reference.md +3 -1
- package/docs/packages.md +5 -3
- package/docs/programmatic.md +14 -8
- package/docs/prompt-templates.md +5 -3
- package/docs/providers/reference.md +7 -7
- package/docs/providers.md +22 -10
- package/docs/quickstart.md +13 -11
- package/docs/reference/cli.md +10 -5
- package/docs/reference.md +8 -4
- package/docs/rpc/examples.md +47 -0
- package/docs/rpc/extension-ui.md +7 -1
- package/docs/rpc/protocol.md +3 -2
- package/docs/rpc.md +3 -1
- package/docs/sdk/reference.md +144 -38
- package/docs/sdk/storage.md +614 -0
- package/docs/sdk/structured-decisions.md +77 -4
- package/docs/sdk/web-server.md +3 -2
- package/docs/sdk.md +26 -115
- package/docs/security.md +17 -7
- package/docs/session-format.md +38 -24
- package/docs/sessions.md +21 -15
- package/docs/settings.md +17 -14
- package/docs/skills.md +47 -3
- package/docs/storage.md +38 -24
- package/docs/subagents/authoring.md +3 -1
- package/docs/subagents/reference.md +8 -2
- package/docs/subagents.md +35 -6
- package/docs/terminal-setup.md +1 -1
- package/docs/themes.md +5 -3
- package/docs/tmux.md +4 -4
- package/docs/tools.md +11 -0
- package/docs/usage.md +25 -15
- package/docs/web-access.md +35 -0
- package/docs/windows.md +9 -6
- package/docs/worktree-snapshots.md +22 -11
- package/examples/sdk/11-sessions.ts +4 -4
- package/package.json +8 -8
- package/schemas/models.schema.json +7 -7
package/docs/sessions.md
CHANGED
|
@@ -6,6 +6,11 @@ description: "Resume, search, name, branch, fork, share, and export conversation
|
|
|
6
6
|
|
|
7
7
|
Atomic saves every conversation as an append-only tree in a local SQLite database (`~/.atomic/workflows/journal.sqlite` by default). You can resume past work, jump back to earlier turns, and branch without losing history. For branch summaries and context clearing, see [Context and compaction](/compaction#branch-summarization).
|
|
8
8
|
|
|
9
|
+
- To configure SQLite, PostgreSQL, Turso/libSQL, or custom adapters, see [Storage backends](/storage).
|
|
10
|
+
- To resume sessions across machines with worktree snapshots and blueprints, see [Resume sessions on any machine](/guides/resume-on-any-machine).
|
|
11
|
+
- To open and pass session stores from Node.js or TypeScript, see [SDK session storage](/sdk/storage).
|
|
12
|
+
- For JSONL schemas, entry types, and the `SessionManager` API, see [Session file format](/session-format).
|
|
13
|
+
|
|
9
14
|
## Session commands
|
|
10
15
|
|
|
11
16
|
Start, resume, fork, or import sessions from the command line:
|
|
@@ -118,7 +123,7 @@ atomic --name "Refactor auth module"
|
|
|
118
123
|
atomic --name "CI audit" -p "Review this build failure"
|
|
119
124
|
```
|
|
120
125
|
|
|
121
|
-
## Branching with `/tree`
|
|
126
|
+
## Branching with `/tree` {#branching-with-tree}
|
|
122
127
|
|
|
123
128
|
Every session entry carries `id` and `parentId`. Run `/tree` to jump to any earlier entry and start a new branch in place:
|
|
124
129
|
|
|
@@ -225,22 +230,23 @@ Supported store objects:
|
|
|
225
230
|
- `{ "dir": "sessions" }`: JSONL directory store. Allowed **only** in `sessions.storage` and `ATOMIC_SESSIONS_STORAGE`. Passing `"dir"` in top-level `storage`, `--storage`, `--storage-file`, or `ATOMIC_STORAGE` fails with `StorageConfigError`.
|
|
226
231
|
- `{ "memory": true }`: ephemeral in-memory store.
|
|
227
232
|
- `{}` (empty object): selects the default session SQLite file (`<storageHome>/workflows/journal.sqlite`) in `sessions.storage` (overriding any shared `storage`), or `<storageHome>/storage.sqlite` in top-level `storage`.
|
|
228
|
-
- Database [
|
|
233
|
+
- Database adapter: [PostgreSQL](/storage#postgresql), [Turso and libSQL](/storage#turso-and-libsql), or a [custom adapter](/storage#selecting-an-adapter).
|
|
229
234
|
|
|
230
235
|
Legacy `sessionDir` has been removed.
|
|
231
236
|
|
|
232
237
|
Store selection follows this precedence order, from highest to lowest:
|
|
233
238
|
|
|
234
|
-
1. SDK `
|
|
235
|
-
2. SDK `
|
|
236
|
-
3.
|
|
237
|
-
4. `--
|
|
238
|
-
5. `
|
|
239
|
-
6. `
|
|
240
|
-
7. `
|
|
241
|
-
8. `
|
|
242
|
-
9. `storage` in `settings.json`
|
|
243
|
-
10.
|
|
239
|
+
1. Explicit SDK `sessionManager` (bypasses store selection)
|
|
240
|
+
2. SDK `sessionStore`
|
|
241
|
+
3. SDK `createAgentSession({ storage })`
|
|
242
|
+
4. `--session-store`, `--no-session`, or `--session-dir`
|
|
243
|
+
5. `--storage` or `--storage-file`
|
|
244
|
+
6. `ATOMIC_SESSIONS_STORAGE` or `ATOMIC_CODING_AGENT_SESSION_DIR`
|
|
245
|
+
7. `ATOMIC_STORAGE`
|
|
246
|
+
8. `ATOMIC_PROFILE=ci`
|
|
247
|
+
9. `sessions.storage` in `settings.json`
|
|
248
|
+
10. `storage` in `settings.json`
|
|
249
|
+
11. Default local SQLite (`~/.atomic/workflows/journal.sqlite`)
|
|
244
250
|
|
|
245
251
|
Each selection replaces lower-precedence settings as a whole object rather than merging fields. Settings, JSON flags, and JSON environment variables resolve relative paths from [storage home](/storage#storage-home). `--session-dir`, `--session-store`, and `ATOMIC_CODING_AGENT_SESSION_DIR` resolve relative paths from `cwd`.
|
|
246
252
|
|
|
@@ -248,10 +254,10 @@ Flag validation rules:
|
|
|
248
254
|
|
|
249
255
|
- `--session-store` conflicts with `--session-dir` and `--no-session`.
|
|
250
256
|
- Combining a non-empty `ATOMIC_CODING_AGENT_SESSION_DIR` with `ATOMIC_SESSIONS_STORAGE`, `--storage`, or `--storage-file` fails startup with `StorageConfigError` (`conflicting-overrides`).
|
|
251
|
-
- `--session-prefix` requires `--session-store` and must match `[A-Za-z_][A-Za-z0-9_]*` without starting with `sqlite_` (case-insensitive, so `SQLITE_` is also rejected).
|
|
257
|
+
- `--session-prefix` requires `--session-store` (local SQLite only) and must match `[A-Za-z_][A-Za-z0-9_]*` without starting with `sqlite_` (case-insensitive, so `SQLITE_` is also rejected). Shared databases use `storage.prefix` or `atomic storage join --prefix` with the same pattern; PostgreSQL also requires lowercase ASCII and at most 24 characters.
|
|
252
258
|
- Invalid CLI storage flags exit cleanly with `Error: ...` (exit code `1`). Invalid or unavailable stores always raise a typed error instead of falling back to memory. See [Selecting storage per process](/storage#selecting-storage-per-process).
|
|
253
259
|
|
|
254
|
-
From the SDK,
|
|
260
|
+
From the SDK, `sessionStore` accepts all five selection kinds (`{ kind: "sqlite", path, prefix? }`, `{ kind: "jsonl", dir }`, `{ kind: "memory" }`, `{ kind: "database", database, prefix? }`, and `{ kind: "adapter", module, options?, secrets?, prefix? }`) or a concrete `SessionStore` instance (`SqlSessionStore`, `JsonlSessionStore`, or `MemorySessionStore`). Passing an explicit `sessionManager` bypasses store selection:
|
|
255
261
|
|
|
256
262
|
```typescript
|
|
257
263
|
const { session } = await createAgentSession({
|
|
@@ -259,4 +265,4 @@ const { session } = await createAgentSession({
|
|
|
259
265
|
});
|
|
260
266
|
```
|
|
261
267
|
|
|
262
|
-
See [Session file format](/session-format) for JSONL schemas, entry types, and the `SessionManager` API.
|
|
268
|
+
See [SDK session storage](/sdk/storage) for PostgreSQL, libSQL, direct `SessionStore`, and store-closing recipes, [SDK and local SQLite API](/storage#sdk-and-local-sqlite-api) for low-level SQLite handles, and [Session file format](/session-format) for JSONL schemas, entry types, and the `SessionManager` API.
|
package/docs/settings.md
CHANGED
|
@@ -11,7 +11,7 @@ Atomic reads JSON settings from two scopes, with trusted project settings overri
|
|
|
11
11
|
| `~/.atomic/agent/settings.json` | Global (all projects; legacy `~/.pi/agent/settings.json` is a fallback) |
|
|
12
12
|
| `.atomic/settings.json` | Project override (requires project trust; legacy `.pi/settings.json` is a fallback) |
|
|
13
13
|
|
|
14
|
-
Edit these files directly or run `/settings` to change common options interactively. For a starter file and project-override walkthrough, see [Configure Atomic](/guides/configuration).
|
|
14
|
+
Edit these files directly or run `/settings` to change common options interactively. For a starter file and project-override walkthrough, see [Configure Atomic](/guides/configuration). For programmatic access through `SettingsManager` and `createAgentSession()`, see [SDK](/sdk) and [Settings management](/sdk/reference#settings-management).
|
|
15
15
|
|
|
16
16
|
## How settings load and save
|
|
17
17
|
|
|
@@ -22,8 +22,8 @@ Edit these files directly or run `/settings` to change common options interactiv
|
|
|
22
22
|
- **Invalid values.** For most settings, a wrong-typed value is ignored with a one-time warning without rewriting your file, and wrong-typed entries in list settings are dropped while keeping valid entries. The settings below behave more strictly:
|
|
23
23
|
- **Stops startup (or `/reload`) with an error:** an invalid `httpIdleTimeoutMs`, or an invalid active `storage` or `sessions.storage` selection (`StorageConfigError`).
|
|
24
24
|
- **Stops the first model request with an error:** an invalid `websocketConnectTimeoutMs` or `streamDeadlineMs`.
|
|
25
|
-
- **Stops the feature with an error:** an invalid `decisionModel` throws `DecisionConfigError` (wrong type or whitespace-padded string)
|
|
26
|
-
- **Special handling for `compactionModel`:** a non-string value throws
|
|
25
|
+
- **Stops the feature with an error:** an invalid `decisionModel` throws `DecisionConfigError` (wrong type or whitespace-padded string) when `getDecisionModel()` runs during `decide()`, `structured_output`, or opening `/settings`. An unregistered ID, bare ID without `provider/`, image model, or compactor model throws `DecisionModelUnavailableError` when calling `decide()` or `structured_output` with no explicit `model` (opening `/settings` shows it as unavailable without throwing). An invalid `snapshots` block throws `WorkspaceConfigError` at session creation, resume, or `atomic blueprint` (except `snapshots.pool.maxIdlePerRepository`, which falls back to `2`). A negative or non-integer `compaction.reserveTokens` throws a plain `Error` when compaction settings are read.
|
|
26
|
+
- **Special handling for `compactionModel`:** a non-string value throws a plain `Error` when compaction runs or `/settings` opens instead of falling back to `"auto"`. Leading or trailing whitespace in `settings.json` is trimmed on read, while `setCompactionModel()` and RPC `set_compaction_model` reject whitespace-padded strings with `CompactionConfigError`. Saved non-compactor model IDs (chat, classifier, or image) reset to `"auto"` on startup (rewriting trusted `settings.json`). Unknown string IDs stay in the file and clear context with a notice on compaction.
|
|
27
27
|
|
|
28
28
|
## Project trust
|
|
29
29
|
|
|
@@ -39,6 +39,8 @@ See [Project trust](/security#project-trust) for the full list of trust-gated in
|
|
|
39
39
|
|
|
40
40
|
### Models and thinking
|
|
41
41
|
|
|
42
|
+
Set up provider credentials in [Model providers](/providers) and define custom endpoints or overrides in [Configure custom models](/models).
|
|
43
|
+
|
|
42
44
|
| Setting | Type | Default | Description |
|
|
43
45
|
| --- | --- | --- | --- |
|
|
44
46
|
| `defaultProvider` | string | unset | Startup provider, saved automatically on interactive model switch |
|
|
@@ -53,7 +55,8 @@ See [Project trust](/security#project-trust) for the full list of trust-gated in
|
|
|
53
55
|
| `showCacheMissNotices` | boolean | `false` | Show notices for significant prompt-cache misses, billed compaction or branch summaries, and provider recovery diagnostics (such as dropped Anthropic thinking blocks), including on resume |
|
|
54
56
|
| `cacheWarming` | `"off" \| "streaming" \| "idle"` | `"idle"` | Keep eligible prompt caches warm during runs (`"streaming"`, up to 60 min after the starting request) or up to 30 min between runs (`"idle"`). `"off"` disables. Refreshes incur provider cost. Global setting only. |
|
|
55
57
|
|
|
56
|
-
- **Cache warming.** Runs only when the model declares `promptCache` ([`models.json`
|
|
58
|
+
- **Cache warming.** Runs only when the model declares `promptCache` ([`models.json` field reference](/models-configuration)) and estimated avoided miss cost is at least $0.05. Recorded in usage and never added to context; extensions can intercept via `cache_warming_decision`.
|
|
59
|
+
- **Compaction model (`compactionModel`).** Compaction is configured under [Compaction](#compaction) (default `""`, equivalent to `"auto"`, or a registered compactor ID such as `morph/morph-compactor`). See [Remote compaction models](/models#remote-compaction-models).
|
|
57
60
|
- **Unsupported saved default provider.** If `defaultProvider` and `defaultModel` name a provider that is still unsupported after extensions load, Atomic does not switch providers silently. Interactive mode warns, print and JSON modes warn on stderr and exit nonzero (stdout stays valid JSONL), and RPC rejects `prompt` until an explicit `set_model` or model cycle succeeds. If the provider is supported but the model is unknown or unauthenticated, normal auto-selection applies.
|
|
58
61
|
- **Subagents (`model: "auto"`).** Subagents use `defaultProvider`/`defaultModel` when authenticated (at agent `thinking`, else `modelThinkingLevels`, else `defaultThinkingLevel`, else `medium`), falling back to the launching session's model. When `enabledModels` or `--models` is active, subagent model selection must stay inside that scope. Built-in agent overrides can also be configured under `subagents.agentOverrides` in `settings.json`; see [Subagent reference](/subagents/reference#automatic-model-selection).
|
|
59
62
|
|
|
@@ -98,7 +101,7 @@ When a scope is active, it governs five areas across your session:
|
|
|
98
101
|
- **`Ctrl+P` model cycling.** Cycles only through your scoped models in order.
|
|
99
102
|
- **`/model` picker and `/model <name>`.** `/model` opens filtered to your scoped models (press `Tab` to toggle between scoped models and all models; press `←`/`→` on a reasoning model row to set thinking effort before selecting). Direct `/model <name>` searches only your scoped models.
|
|
100
103
|
- **Subagent allowlist.** Child subagents inherit the active `enabledModels` / `--models` scope using the same matching rules. Any subagent start model (including `model: "auto"`, agent frontmatter `model`, or per-call `model` overrides) and any child fallback candidate outside scope is rejected with an error. If your `enabledModels` patterns match zero available models, subagent launches are blocked rather than widening to all models.
|
|
101
|
-
- **Extensions.** Extensions read the active resolved scope through `ctx.scopedModels` (read-only).
|
|
104
|
+
- **Extensions and SDK.** Extensions read the active resolved scope through [`ctx.scopedModels`](/extensions/api-reference#ctx-modelregistry-ctx-model-ctx-scopedmodels) (read-only). SDK hosts can resolve patterns with `resolveModelScopeFromModels()`; see [Resolving scoped models](/sdk/reference#resolving-scoped-models).
|
|
102
105
|
|
|
103
106
|
**What stays independent:** Main-chat `fallbackModels` is independent of `enabledModels`, so you can keep an out-of-scope emergency fallback for main-chat turns. Child subagent fallback chains remain bound by the parent session's `enabledModels` scope.
|
|
104
107
|
|
|
@@ -112,7 +115,7 @@ When a scope is active, it governs five areas across your session:
|
|
|
112
115
|
|
|
113
116
|
| Mechanism | Matching rules | Globs (`*`, `?`, `[`) | Fuzzy match | `:thinking` suffix | Ambiguous bare ID |
|
|
114
117
|
| --- | --- | --- | --- | --- | --- |
|
|
115
|
-
| `enabledModels` / `--models` | Exact, then glob, then fuzzy (authenticated models only) | Yes (case-insensitive) | Yes | Lenient (case-insensitive; invalid warns and drops) | Adds all matching providers
|
|
118
|
+
| `enabledModels` / `--models` | Exact, then glob, then fuzzy (authenticated models only) | Yes (case-insensitive) | Yes | Lenient (case-insensitive; invalid warns and drops) | Adds all matching authenticated providers (no warning) |
|
|
116
119
|
| `fallbackModels` / `--fallback-models` | Exact, then fuzzy (skips unauthenticated at runtime) | No | Yes | Strict (case-insensitive; invalid fails match) | Prefers current or default provider; else skips |
|
|
117
120
|
| `--model` (CLI) | Exact, then fuzzy (searches all models; synthesizes unknown ID if provider known) | No | Yes | Strict (case-insensitive; invalid kept literally) | Breaks tie by sole authenticated provider; else errors |
|
|
118
121
|
| `/model <name>` | Exact `provider/id` or bare `id` (scoped models only when scoped; opens picker on miss) | No | No | No (use `←`/`→` or `/thinking`) | Opens picker instead of switching |
|
|
@@ -152,11 +155,11 @@ Ordered fallback chain for main-chat turns after same-model retries exhaust on a
|
|
|
152
155
|
Controls which model answers `structured_output` calls (when no `model` is passed; classifiers answer finite `Choice` schemas, otherwise Atomic tries `fallbackModels` and then the current chat model) and extension [`decide()`](/sdk/structured-decisions#decide) calls. It does not change your chat model or subagent execution model.
|
|
153
156
|
|
|
154
157
|
- **Configure.** Set in JSON, open `/settings` and select **Decision model** (edits project override if present, otherwise global), or call `session.setDecisionModel(model, scope?)` / RPC `set_decision_model`. Selections made through `/settings`, the SDK, or RPC take effect immediately in the active session without running `/reload` or restarting. `""` or `"auto"` uses the current chat model. To pin a model, specify an exact case-sensitive `provider/model` of a registered classifier (such as `typesafe/jev-latest`, `vercel-ai-gateway/typesafe-ai/jev`, `opencode/jev-1.13`, or `opencode/jev-1.13-free`) or chat model (classifiers are checked before chat models). Run `/reload` only if you edited `settings.json` directly outside Atomic.
|
|
155
|
-
- **Errors and fallback.** A wrong JSON type or whitespace-padded string throws `DecisionConfigError` when
|
|
158
|
+
- **Errors and fallback.** A wrong JSON type or whitespace-padded string throws `DecisionConfigError` when `getDecisionModel()` runs during `decide()`, `structured_output`, or opening `/settings`. An unregistered ID, bare ID without `provider/`, image model, or compactor model throws `DecisionModelUnavailableError` during `decide()` or `structured_output` with no explicit `model` instead of falling back (opening `/settings` shows the ID as unavailable without throwing). Once a registered classifier is selected, runtime failures (missing credentials, context error, refusal, or malformed output) fall back silently to the current chat model and log in [debug mode](#debug-mode). Chat models get 1 initial attempt plus 3 corrective retries within [`httpIdleTimeoutMs`](#http) (default 10 minutes). Cancellation does not fall back.
|
|
156
159
|
- **Provider, credentials, and cost.** The decision model's provider receives the decision context, so choose a permitted provider. Authenticate a pinned classifier with its provider login (for example `/login typesafe` or `TYPESAFE_API_KEY`). Classifiers do not appear in `/model`. An explicit empty project value overrides a global selection and restores the current chat model. Falling back to the current chat model can incur chat-provider charges.
|
|
157
160
|
- **Legacy migration.** Valid legacy `routerModel` values migrate automatically when `decisionModel` is absent without rewriting the file. Removed `modelRouting` and built-in override `modelConstraints`/`taskNeeds` keys are removed automatically on startup from writable `.atomic` settings with a one-time notice.
|
|
158
161
|
|
|
159
|
-
See [Structured decisions](/sdk/structured-decisions) and [TypeSafe Jev](/providers#typesafe-jev).
|
|
162
|
+
See [Structured decisions](/sdk/structured-decisions), [Classifier models](/models#use-classifier-models), [Local classification](/llama-cpp#classification), and [TypeSafe Jev](/providers#typesafe-jev).
|
|
160
163
|
|
|
161
164
|
#### thinkingBudgets
|
|
162
165
|
|
|
@@ -175,7 +178,7 @@ A changed budget applies to new sessions. A resumed session keeps the budget it
|
|
|
175
178
|
|
|
176
179
|
### Fast models
|
|
177
180
|
|
|
178
|
-
Fast inference
|
|
181
|
+
Fast and Ultrafast inference use canonical `<model-id>-fast` and `<model-id>-ultrafast` model IDs (not a separate setting) anywhere models are configured (`/model`, `fallbackModels`, `enabledModels`, and subagents). Reasoning suffixes work normally (`openai-codex/gpt-5.6-sol-fast:medium`, `openai/gpt-6.2-astra-ultrafast:high`), and standard, fast, and ultrafast IDs act as separate candidates:
|
|
179
182
|
|
|
180
183
|
```json
|
|
181
184
|
{
|
|
@@ -186,7 +189,7 @@ Fast inference uses canonical `<model-id>-fast` model IDs (not a separate settin
|
|
|
186
189
|
}
|
|
187
190
|
```
|
|
188
191
|
|
|
189
|
-
See [Fast models](/providers#fast-models) for supported providers and precedence over custom `-fast` IDs.
|
|
192
|
+
See [Fast models](/providers#fast-models) and [Fast and Ultrafast tiers](/providers#fast-and-ultrafast-tiers) for supported providers, eligibility, and precedence over custom `-fast` or `-ultrafast` IDs.
|
|
190
193
|
|
|
191
194
|
### Interface and display
|
|
192
195
|
|
|
@@ -278,7 +281,7 @@ For the global HTTP idle timeout, see [HTTP](#http) (`httpIdleTimeoutMs`).
|
|
|
278
281
|
| --- | --- | --- | --- |
|
|
279
282
|
| `compaction.enabled` | boolean | `true` | Enable automatic compaction |
|
|
280
283
|
| `compaction.reserveTokens` | number | `16384` | Non-negative safe integer; triggers auto-compaction when usage exceeds `contextWindow - reserveTokens` |
|
|
281
|
-
| `compactionModel` | string | `"
|
|
284
|
+
| `compactionModel` | string | `""` | `""` (equivalent to `"auto"`) clears context so the agent recovers from history; an exact registered compactor ID (such as `morph/morph-compactor`) compacts via that model. Selecting **Compaction model** in `/settings` edits the project override if set, otherwise global (saving `""` for Automatic). Whitespace in `settings.json` is trimmed on read, while `setCompactionModel()` and RPC `set_compaction_model` reject whitespace-padded strings with `CompactionConfigError`. Non-string values throw a plain `Error` when compaction runs or `/settings` opens. Saved non-compactor IDs (chat, classifier, or image) reset to `"auto"` on startup. See [Compaction model](/compaction#compaction-model), [Remote compaction models](/models#remote-compaction-models), and [Compactor request contract](/compaction/reference#compactor-request-contract). |
|
|
282
285
|
|
|
283
286
|
```json
|
|
284
287
|
{
|
|
@@ -409,12 +412,12 @@ On Windows, write JSON paths with forward slashes or escaped backslashes:
|
|
|
409
412
|
```
|
|
410
413
|
|
|
411
414
|
- **Default.** `~/.atomic/workflows/journal.sqlite` (`session_` tables; under `<agentDir>/workflows/` when `ATOMIC_CODING_AGENT_DIR` is set unless it adopted a parent store; see [Storage home](/storage#storage-home)). JSONL is opt-in via `dir`, `--session-dir`, or `ATOMIC_CODING_AGENT_SESSION_DIR` (legacy `sessionDir` was removed).
|
|
412
|
-
- **Precedence.** Highest to lowest: SDK `sessionStore`, `--no-session`, `--session-dir
|
|
413
|
-
- **Errors.** Only the winning setting (
|
|
415
|
+
- **Precedence.** Highest to lowest: SDK `sessionStore`, SDK `storage` (`createAgentSession({ storage })`, see [SDK storage](/sdk/storage)), `--no-session`, `--session-dir`, or `--session-store`, `--storage` or `--storage-file`, `ATOMIC_SESSIONS_STORAGE` or `ATOMIC_CODING_AGENT_SESSION_DIR`, `ATOMIC_STORAGE`, `ATOMIC_PROFILE=ci`, `sessions.storage`, `storage`, and default SQLite. Project selections replace global objects whole rather than merging; an explicit `{}` on `sessions.storage` selects default SQLite rather than inheriting `storage`. Relative paths in settings and JSON flags or env vars resolve from [storage home](/storage#storage-home); `--session-dir`, `--session-store`, and `ATOMIC_CODING_AGENT_SESSION_DIR` resolve from `cwd`. See [Storage and team variables](/environment-variables#storage-and-team-variables).
|
|
416
|
+
- **Errors.** Only the winning setting is validated from `settings.json`, whereas process-level selections (`--storage`, `--storage-file`, `ATOMIC_STORAGE`, `ATOMIC_SESSIONS_STORAGE`, and `ATOMIC_PROFILE=ci` with `ATOMIC_TEAM_*`) are validated unconditionally even when outranked. Invalid config throws `StorageConfigError` (`source`, `field`, `reason`) or `TeamProfileConfigError`, and open failures throw typed errors without falling back to memory. See [Choosing a store](/sessions#choosing-a-store), [Selecting storage per process](/storage#selecting-storage-per-process), and [Storage errors](/storage#storage-errors).
|
|
414
417
|
|
|
415
418
|
#### Storage adapters
|
|
416
419
|
|
|
417
|
-
Install an adapter [Atomic package](/storage#adapters-from-atomic-packages) (or pass its directory via `--extension` or SDK `additionalExtensionPaths
|
|
420
|
+
Install an adapter [Atomic package](/storage#adapters-from-atomic-packages) (such as [`@bastani/atomic-storage-postgres`](/libraries/storage-postgres) or [`@bastani/atomic-storage-libsql`](/libraries/storage-libsql)), or pass its directory via `--extension` or SDK `additionalExtensionPaths` (which takes precedence over settings), and reference it in `storage` or `sessions.storage`:
|
|
418
421
|
|
|
419
422
|
```json
|
|
420
423
|
{
|
package/docs/skills.md
CHANGED
|
@@ -14,6 +14,28 @@ Read this page to install, organize, and invoke skills, then continue:
|
|
|
14
14
|
|
|
15
15
|
- [Write a custom skill](/skills/authoring). Learn the directory structure and follow a complete worked example.
|
|
16
16
|
- [Skill format reference](/skills/reference). Check `SKILL.md` frontmatter fields, naming rules, and validation behavior.
|
|
17
|
+
- [SDK skills reference](/sdk/reference#skills). Load or override skills programmatically from `@bastani/atomic`.
|
|
18
|
+
|
|
19
|
+
## Quick start
|
|
20
|
+
|
|
21
|
+
Invoke a bundled skill directly in chat:
|
|
22
|
+
|
|
23
|
+
```text
|
|
24
|
+
/skill:tdd Write a failing regression test before fixing the parser bug.
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Create a project skill in `.atomic/skills/my-skill/SKILL.md`:
|
|
28
|
+
|
|
29
|
+
```markdown
|
|
30
|
+
---
|
|
31
|
+
name: my-skill
|
|
32
|
+
description: Check release readiness before tagging
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
Run `npm run check` and report any failing checks with file paths.
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Run `/reload` in an active session, then invoke `/skill:my-skill`. See [Write a custom skill](/skills/authoring) for directory layout, scripts, and reference files.
|
|
17
39
|
|
|
18
40
|
## Locations
|
|
19
41
|
|
|
@@ -30,8 +52,8 @@ Atomic loads skills from these sources:
|
|
|
30
52
|
- `.atomic/skills/` (legacy `.pi/skills/`)
|
|
31
53
|
- `.agents/skills/` in `cwd` and ancestor directories up to the Git repository root, or the filesystem root when outside a repository
|
|
32
54
|
- **Packages:** `skills/` directories, `atomic.skills`, or legacy `pi.skills` entries in `package.json`
|
|
33
|
-
- **Settings:** `skills` array in global or project `settings.json
|
|
34
|
-
- **CLI:** `--skill <path>` (repeatable; still loads even with `--no-skills` / `-ns
|
|
55
|
+
- **Settings:** `skills` array in global or project [`settings.json`](/settings), which accepts files, directories, and filter patterns (`!glob`, `+path`, `-path` with `~` expansion; see [Package filtering](/packages/reference#package-filtering))
|
|
56
|
+
- **CLI:** `--skill <path>` (repeatable; still loads even with `--no-skills` / `-ns`; see [CLI resource options](/reference/cli#resource-options))
|
|
35
57
|
|
|
36
58
|
### Discovery rules
|
|
37
59
|
|
|
@@ -82,6 +104,28 @@ For project-level shared skill directories, add a relative path to `.atomic/sett
|
|
|
82
104
|
}
|
|
83
105
|
```
|
|
84
106
|
|
|
107
|
+
### Using skills from the SDK
|
|
108
|
+
|
|
109
|
+
Configure skill discovery programmatically with `DefaultResourceLoader` and pass it to `createAgentSession()`:
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
import { createAgentSession, DefaultResourceLoader } from "@bastani/atomic";
|
|
113
|
+
|
|
114
|
+
const loader = new DefaultResourceLoader({
|
|
115
|
+
additionalSkillPaths: ["/path/to/extra-skills"],
|
|
116
|
+
noSkills: false,
|
|
117
|
+
skillsOverride: (current) => ({
|
|
118
|
+
skills: current.skills.filter((skill) => skill.name !== "unwanted"),
|
|
119
|
+
diagnostics: current.diagnostics,
|
|
120
|
+
}),
|
|
121
|
+
});
|
|
122
|
+
await loader.reload();
|
|
123
|
+
|
|
124
|
+
const { session } = await createAgentSession({ resourceLoader: loader });
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Setting `builtins: { subagents: false }` on `createAgentSession()` removes the 21 bundled skills shipped by `@bastani/subagents`. Keep those 21 skills without exposing the `subagent` tool by leaving `builtins.subagents` enabled and passing `excludedTools: ["subagent"]`. See [SDK skills](/sdk/reference#skills) and [SDK tools](/sdk/reference#tools).
|
|
128
|
+
|
|
85
129
|
## How skills work
|
|
86
130
|
|
|
87
131
|
1. At startup, Atomic scans skill locations and reads each skill's name and description.
|
|
@@ -177,7 +221,7 @@ References are relative to /path/to/brave-search.
|
|
|
177
221
|
|
|
178
222
|
Any arguments after the command are trimmed and appended after the closing `</skill>` tag separated by a blank line, without a `User:` prefix.
|
|
179
223
|
|
|
180
|
-
Toggle `/skill:` autocomplete suggestions via `/settings` in interactive mode or in `settings.json` (default `true`):
|
|
224
|
+
Toggle `/skill:` autocomplete suggestions via `/settings` in interactive mode or in [`settings.json`](/settings) (default `true`):
|
|
181
225
|
|
|
182
226
|
```json
|
|
183
227
|
{
|
package/docs/storage.md
CHANGED
|
@@ -6,12 +6,16 @@ description: "Configure local SQLite, PostgreSQL, or Turso/libSQL storage, expor
|
|
|
6
6
|
|
|
7
7
|
Atomic saves sessions in a local SQLite database (`~/.atomic/workflows/journal.sqlite`) by default. You can switch to another SQLite file, a JSONL directory, an in-memory store, PostgreSQL, Turso/libSQL, or a custom database adapter through [storage settings](/settings#sessions) or [per-process overrides](#selecting-storage-per-process).
|
|
8
8
|
|
|
9
|
+
| Track | Start with |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| **CLI and operator setup** | [Which store to choose](#which-store-to-choose), [PostgreSQL](#postgresql), [Turso and libSQL](#turso-and-libsql), [Sharing storage across hosts](#sharing-storage-across-hosts) |
|
|
12
|
+
| **Node.js and TypeScript SDK** | [SDK session storage](/sdk/storage), [SDK and local SQLite API](#sdk-and-local-sqlite-api), [SessionManager API](/session-format#sessionmanager-api) |
|
|
13
|
+
| **Custom adapters and SQL drivers** | [Selecting an adapter](#selecting-an-adapter), [Bring your own driver](#bring-your-own-driver), [Adapter conformance](#adapter-conformance) |
|
|
14
|
+
|
|
9
15
|
- A configured persistent store never silently falls back to memory when it fails to open.
|
|
10
16
|
- A subagent keeps its session in its launching parent's store unless the launch specifies a `sessionDir` for a fresh subagent. Fresh subagent sessions are marked internal and hidden from normal session lists. See [Subagents](/subagents).
|
|
11
17
|
- Workflow data written by releases before 0.10.0 stays untouched on disk. See [Workflow data from earlier releases](#workflow-data-from-earlier-releases).
|
|
12
18
|
|
|
13
|
-
Sections through [Workflow data from earlier releases](#workflow-data-from-earlier-releases) cover user and operator setup. The later sections cover the SDK SQLite API, custom adapters, and typed errors.
|
|
14
|
-
|
|
15
19
|
## Which store to choose
|
|
16
20
|
|
|
17
21
|
| Situation | Choose | Why |
|
|
@@ -162,7 +166,7 @@ atomic storage status
|
|
|
162
166
|
}
|
|
163
167
|
```
|
|
164
168
|
|
|
165
|
-
You can also edit this configuration directly. `secrets.password`
|
|
169
|
+
You can also edit this configuration directly. For password authentication in adapter configurations (including `settings.json`, `ATOMIC_STORAGE`, `--storage`, and SDK `{ kind: "adapter" }` selections), set `secrets.password` to `{ "file": "..." }` or `{ "env": "<variable>" }`. Because the adapter declares `liveSecrets: ["password"]`, Atomic rereads `secrets.password` for each new connection and ignores `options.password`, throwing `StorageConfigError` (`reason: "secret-missing"`) when `secrets.password` is omitted.
|
|
166
170
|
|
|
167
171
|
| Option | Default | Description |
|
|
168
172
|
| --- | --- | --- |
|
|
@@ -170,11 +174,11 @@ You can also edit this configuration directly. `secrets.password` accepts `{ "fi
|
|
|
170
174
|
| `auth` | `"password"` | `"azure-entra"`, `"aws-iam"`, or `"gcp-iam"` for [cloud identities](#cloud-identities) |
|
|
171
175
|
| `maxConnections` | `8` | Maximum pooled connections per Atomic process |
|
|
172
176
|
| `statementTimeoutMs` | `30000` | Maximum runtime for one statement before server cancellation (client cancels the connection 5,000 ms later if the server stops answering; idle connections close after 10,000 ms, and connect/pool-wait timeout is 10,000 ms) |
|
|
173
|
-
| `listenUrl` | `url` | Direct endpoint for [wake-ups](#wake-ups) when `url` uses a transaction pooler |
|
|
177
|
+
| `listenUrl` | `url` | Direct endpoint for [wake-ups](#wake-ups) when `url` uses a transaction pooler. Enforces the same URL, TLS, proxy, and no-embedded-password rules as `url` (`credential-in-url`) |
|
|
174
178
|
| `schema` | `"atomic"` | Schema name starting with a lowercase ASCII letter or `_`, followed by lowercase letters, digits, or `_` (1 to 63 characters) |
|
|
175
179
|
| `proxy` | From environment | `http://` or `https://` proxy URL for all connections, or `"none"` to connect directly |
|
|
176
180
|
|
|
177
|
-
`atomic team join` supports libSQL URLs only. Use `atomic storage join` for PostgreSQL. SDK
|
|
181
|
+
`atomic team join` supports libSQL URLs only. Use `atomic storage join` for PostgreSQL. For Node.js and TypeScript SDK apps, install `@bastani/atomic-storage-postgres` with `npm install` and import `openPostgresDatabase` directly. See [`@bastani/atomic-storage-postgres`](/libraries/storage-postgres) and [SDK session storage](/sdk/storage).
|
|
178
182
|
|
|
179
183
|
### TLS
|
|
180
184
|
|
|
@@ -256,7 +260,7 @@ Map the cloud identity to a PostgreSQL role on your provider:
|
|
|
256
260
|
- **AWS.** Enable IAM database authentication, run `CREATE USER atomic; GRANT rds_iam TO atomic;`, and grant the IAM identity `rds-db:connect` on `arn:aws:rds-db:<region>:<account>:dbuser:<DbiResourceId>/atomic`.
|
|
257
261
|
- **Google Cloud.** Set `cloudsql.iam_authentication=on`, add the service account as an IAM database user, and grant `roles/cloudsql.instanceUser`. Use the service account email without `.gserviceaccount.com` as the URL username. Compute Engine VMs need the `cloud-platform` scope.
|
|
258
262
|
|
|
259
|
-
Grant the mapped identity the runtime privileges from [Set up the database](#set-up-the-database), and run `atomic storage migrate` as the owner role. See
|
|
263
|
+
Grant the mapped identity the runtime privileges from [Set up the database](#set-up-the-database), and run `atomic storage migrate` as the owner role. See [`@bastani/atomic-storage-postgres`](/libraries/storage-postgres) for service-specific details and [SDK session storage](/sdk/storage) for SDK integration recipes.
|
|
260
264
|
|
|
261
265
|
Running `atomic install npm:@azure/identity` (or the AWS or Google SDK) installs the package under `~/.atomic/agent/npm`. The PostgreSQL adapter searches both its own directory and `~/.atomic/agent/npm`, so adapters installed from local paths find the SDK too.
|
|
262
266
|
|
|
@@ -308,7 +312,7 @@ atomic install npm:@bastani/atomic-storage-libsql
|
|
|
308
312
|
- **Tokens and local files.** Save a Turso token with `turso db tokens create <db> > turso-token && chmod 600 turso-token` (one trailing line ending is stripped when read from `secrets.authToken.file`, and relative paths resolve against [storage home](#storage-home)), or reference `{ "env": "TURSO_TOKEN" }`. Absolute `file:` URLs need no `secrets`. Add `prefix` to isolate projects or teams.
|
|
309
313
|
- **Retries and WebSockets.** Transient outages, expired streams, and 30-second unanswered requests report `StorageTransientError`. Calls that failed before writing retry up to 5 times over about 4 seconds. Writes with an uncertain outcome fail immediately with `outcome: "unknown"` and are not retried automatically. Over `ws:` or `wss:`, a batch whose `COMMIT` does not run reports `StorageUnavailableError` (`TRANSACTION_CLOSED`).
|
|
310
314
|
|
|
311
|
-
|
|
315
|
+
For Node.js and TypeScript SDK apps, install `@bastani/atomic-storage-libsql` with `npm install` and import `openLibsqlDatabase` directly as plain ESM with TypeScript declarations. See [`@bastani/atomic-storage-libsql`](/libraries/storage-libsql) and [SDK session storage](/sdk/storage). To wrap another driver, see [Bring your own driver](#bring-your-own-driver).
|
|
312
316
|
|
|
313
317
|
## Sharing storage across hosts
|
|
314
318
|
|
|
@@ -331,11 +335,13 @@ atomic intercom restart
|
|
|
331
335
|
atomic storage status
|
|
332
336
|
```
|
|
333
337
|
|
|
334
|
-
**PostgreSQL:**
|
|
338
|
+
**PostgreSQL (PostgreSQL 16 or newer for sessions):**
|
|
339
|
+
|
|
340
|
+
In two-role deployments, run `atomic storage migrate --db 'postgresql://atomic_owner@db.example.com:5432/atomic' --password-file ~/atomic-owner-password` once as the owner role, and after Atomic upgrades, before joining machines with the runtime role. See [Set up the database](#set-up-the-database).
|
|
335
341
|
|
|
336
342
|
```bash
|
|
337
343
|
atomic install npm:@bastani/atomic-storage-postgres
|
|
338
|
-
atomic storage join
|
|
344
|
+
atomic storage join postgresql://atomic_runtime@db.example.com:5432/atomic?sslmode=verify-full --password-file ~/pg-password
|
|
339
345
|
atomic intercom restart
|
|
340
346
|
atomic storage status
|
|
341
347
|
```
|
|
@@ -388,16 +394,17 @@ One Intercom broker serves every session in an agent directory and keeps the sto
|
|
|
388
394
|
|
|
389
395
|
Precedence for sessions, highest first:
|
|
390
396
|
|
|
391
|
-
1. SDK `
|
|
392
|
-
2. SDK `
|
|
393
|
-
3.
|
|
394
|
-
4. `--
|
|
395
|
-
5. `
|
|
396
|
-
6. `
|
|
397
|
-
7. `
|
|
398
|
-
8. `
|
|
399
|
-
9.
|
|
400
|
-
10.
|
|
397
|
+
1. Explicit SDK `sessionManager` (bypasses store selection)
|
|
398
|
+
2. SDK `sessionStore`
|
|
399
|
+
3. SDK `createAgentSession({ storage })`
|
|
400
|
+
4. `--session-store`, `--no-session`, or `--session-dir`
|
|
401
|
+
5. `--storage` or `--storage-file`
|
|
402
|
+
6. `ATOMIC_SESSIONS_STORAGE` or `ATOMIC_CODING_AGENT_SESSION_DIR`
|
|
403
|
+
7. `ATOMIC_STORAGE`
|
|
404
|
+
8. `ATOMIC_PROFILE=ci`
|
|
405
|
+
9. `sessions.storage` setting
|
|
406
|
+
10. Shared `storage` setting
|
|
407
|
+
11. Default local SQLite file (`~/.atomic/workflows/journal.sqlite`)
|
|
401
408
|
|
|
402
409
|
Override conflicts and path rules:
|
|
403
410
|
|
|
@@ -538,9 +545,9 @@ To run an older workflow definition with this release, see [Migrating workflows]
|
|
|
538
545
|
|
|
539
546
|
## SDK and local SQLite API
|
|
540
547
|
|
|
541
|
-
|
|
548
|
+
For full SDK recipes covering `createAgentSession`, `createAgentSessionRuntime`, `SqlSessionStore`, `JsonlSessionStore`, `MemorySessionStore`, `openPostgresDatabase`, `openLibsqlDatabase`, and store ownership rules, see [SDK session storage](/sdk/storage). For direct session reading, branching, and listing, see [SessionManager API](/session-format#sessionmanager-api).
|
|
542
549
|
|
|
543
|
-
`@bastani/atomic` and `@bastani/atomic/storage
|
|
550
|
+
This section covers the low-level local SQLite API and storage path helpers exported from `@bastani/atomic` and `@bastani/atomic/storage`, followed by custom adapter and driver authoring:
|
|
544
551
|
|
|
545
552
|
```typescript
|
|
546
553
|
import { openNodeSqliteDatabase } from "@bastani/atomic/storage";
|
|
@@ -590,11 +597,18 @@ export default {
|
|
|
590
597
|
} satisfies StorageAdapterModule;
|
|
591
598
|
```
|
|
592
599
|
|
|
593
|
-
Select an adapter in `sessions.storage` or top-level `storage` in [settings](/settings#sessions), or pass `sessionStore: { kind: "adapter", module, options, secrets, prefix }` in the SDK. Relative module paths resolve from the agent directory (`~/.atomic/agent` by default)
|
|
600
|
+
Select an adapter in `sessions.storage` or top-level `storage` in [settings](/settings#sessions), or pass `sessionStore: { kind: "adapter", module, options, secrets, prefix }` in the SDK. Relative module paths resolve from the agent directory (`~/.atomic/agent` by default). Bare package names resolve from user-scope [Atomic packages](#adapters-from-atomic-packages), host extension directories, or the agent directory, never from an embedding application's `node_modules`. Project settings follow the project trust boundary, and adapter code runs with Atomic's privileges.
|
|
601
|
+
|
|
602
|
+
Choose the installation method that matches how you open the adapter:
|
|
603
|
+
|
|
604
|
+
- **Direct SDK database handles (`{ kind: "database", database }`).** Install the package in your project with `npm install`, call `openPostgresDatabase()` or `openLibsqlDatabase()`, and pass the handle to `sessionStore: { kind: "database", database, prefix? }` or `SqlSessionStore.open(database, { prefix? })`. See [SDK session storage](/sdk/storage).
|
|
605
|
+
- **Adapter-resolved selections (`{ kind: "adapter", module }`, `settings.json`, `ATOMIC_STORAGE`, `ATOMIC_PROFILE=ci`).** Install the package in user scope with `atomic install npm:<package>` (without `-l`), or register a local package directory with `DefaultResourceLoader({ additionalExtensionPaths })` or `--extension`.
|
|
594
606
|
|
|
595
607
|
Adapter modules can import `@bastani/atomic/storage` and `@bastani/atomic` directly in both npm installs and standalone binaries. This works for the adapter entry file and any ES module or TypeScript file it imports relatively (including `.mjs` files and `.js` files in `"type": "module"` packages). CommonJS files outside the entry file resolve from `node_modules` instead. List `@bastani/atomic` under `peerDependencies`, not `dependencies`.
|
|
596
608
|
|
|
597
|
-
`options` holds SQLite scalar values or booleans. `secrets` maps
|
|
609
|
+
`options` holds SQLite scalar values or booleans. `secrets` maps secret names to `{ env }`, `{ file }`, or (in the SDK only) `inMemorySecret(value)` (`{ value }`), overriding same-named keys in `options`. Atomic strips one trailing `\n` or `\r\n` from `{ file }` secrets and keeps other whitespace intact. `inMemorySecret()` serializes as `[redacted]` and is refused outside the SDK (`in-memory-secret-unsupported`).
|
|
610
|
+
|
|
611
|
+
`context` provides `agentDir`, `domain: "sessions" | "intercom"`, an optional `signal`, and `secret(name)` to reread `secrets[name]` on demand. An adapter that reads fresh credentials for each new connection (such as a rotated password file) declares `liveSecrets` on its `StorageAdapterModule` (for example `liveSecrets: ["password"]`). Atomic omits names listed in `liveSecrets` from `options` and expects the adapter to call `context.secret(name)`, which throws `StorageConfigError` (`reason: "secret-missing"`) when the secret is missing from `secrets`.
|
|
598
612
|
|
|
599
613
|
Adapter hooks and lifecycle:
|
|
600
614
|
|
|
@@ -602,7 +616,7 @@ Adapter hooks and lifecycle:
|
|
|
602
616
|
- Implement `openSessionStore(options, context, { prefix? })` for non-SQL session stores. When both hooks exist, `openSessionStore` takes priority for sessions.
|
|
603
617
|
- Missing hooks raise `StorageConfigError` (`reason: "adapter-domain-unsupported"`). Load failures raise `StorageAdapterLoadError`, and driver open failures raise `StorageUnavailableError`.
|
|
604
618
|
- `new StorageProvider().openSessionStore(selection, context)` opens stores programmatically (`kind`: `"memory"`, `"jsonl"`, `"sqlite"`, `"database"`, or `"adapter"`). `loadStorageAdapter(module, context, hostModules)` loads an adapter module.
|
|
605
|
-
-
|
|
619
|
+
- `StorageProvider` instances share one process-wide map of provider-owned databases across matching selections and close each owned database when its last returned store closes. Caller-owned `database` handles passed through `{ kind: "database", database }` are never closed by the provider.
|
|
606
620
|
- If opening storage fails and closing its owned database also fails, Atomic throws the original opening error with a `cleanupCause` field holding the cleanup failure.
|
|
607
621
|
|
|
608
622
|
### Adapters from Atomic packages
|
|
@@ -6,6 +6,8 @@ description: "Define custom Markdown subagents, configure YAML frontmatter field
|
|
|
6
6
|
|
|
7
7
|
Define a custom subagent as a Markdown file with YAML frontmatter and a self-contained system prompt body. Run `/reload` after adding or editing files on disk so Atomic picks up your changes.
|
|
8
8
|
|
|
9
|
+
Looking for another subagents page? Start with [Subagents overview](/guides/subagents) for concepts, [Run subagents](/subagents) for launching, worktrees, and run control, [Subagent reference](/subagents/reference) for precedence and `config.json`, or [Subagent children in the SDK](/sdk#subagent-children) for programmatic setup.
|
|
10
|
+
|
|
9
11
|
## Where agent files live {#custom-agents}
|
|
10
12
|
|
|
11
13
|
Atomic discovers `.md` files recursively (`**/*.md`, following symlinks and sorted lexicographically) across four scopes. Later scopes and later directories inside a scope override earlier ones on matching names. Project scopes resolve from the nearest ancestor directory containing `.atomic/`, `.pi/`, or `.agents/` (not necessarily the Git root). See [Agent discovery](/subagents/reference#agent-discovery) for complete rules.
|
|
@@ -166,7 +168,7 @@ Override or disable bundled agents in user (`~/.atomic/agent/settings.json`) or
|
|
|
166
168
|
- `systemPromptMode` (`"replace"` or `"append"`)
|
|
167
169
|
- `inheritProjectContext` (boolean)
|
|
168
170
|
- `inheritSkills` (boolean)
|
|
169
|
-
- `defaultContext` (`"fresh"
|
|
171
|
+
- `defaultContext` (`"fresh"`, `"fork"`, or `false` to clear)
|
|
170
172
|
- `disabled` (boolean)
|
|
171
173
|
- `systemPrompt` (string)
|
|
172
174
|
- `skills` (string array, or `false` to clear)
|
|
@@ -4,6 +4,8 @@ sidebarTitle: "Subagents"
|
|
|
4
4
|
description: "Discovery precedence, model selection, fallback rules, reasoning levels, configuration keys, and SDK integration."
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
+
This page is the exact reference for subagent discovery, model resolution, `config.json`, tool parameters, and SDK contracts. For concepts, see [Subagents overview](/guides/subagents). For day-to-day usage, worktrees, and run control, see [Run subagents](/subagents). For writing custom agent files, see [Create custom subagents](/subagents/authoring). For programmatic child configuration, see [Subagent children in the SDK](/sdk#subagent-children).
|
|
8
|
+
|
|
7
9
|
## Agent discovery
|
|
8
10
|
|
|
9
11
|
Atomic loads agent definitions recursively (`**/*.md`, sorted lexicographically, following symlinks) from four sources. When two definitions share the same full name, the later source wins:
|
|
@@ -160,9 +162,13 @@ Global subagent runtime configuration lives at `~/.atomic/agent/extensions/subag
|
|
|
160
162
|
|
|
161
163
|
## SDK integration and errors
|
|
162
164
|
|
|
165
|
+
For programmatic child inheritance, startup timeout errors, and task supervision in embedded hosts, see [Subagent children in the SDK](/sdk#subagent-children), [Session start errors](/sdk/reference#session-start-errors), and [Owner-bound task supervisor](/sdk/reference#owner-bound-task-supervisor).
|
|
166
|
+
|
|
167
|
+
Import `OwnerTaskStore`, `bindOwnerTaskStore`, `SessionStartError`, and `SessionStartTimeoutError` from `@bastani/atomic`.
|
|
168
|
+
|
|
163
169
|
### `ReleasedChildError` codes
|
|
164
170
|
|
|
165
|
-
When tracking or waking a [released subagent](/subagents#released-subagents) fails, `status` and notices
|
|
171
|
+
When tracking or waking a [released subagent](/subagents#released-subagents) fails, the built-in subagents extension reports a typed `ReleasedChildError` in `status` output and failure notices. `ReleasedChildError` is not exported as a top-level class from `@bastani/atomic`; inspect its serialized `name` (`"ReleasedChildError"`), `code`, `subject`, `hint`, `retryable`, and `fields` in reported results and notices:
|
|
166
172
|
|
|
167
173
|
| Code | Cause | Action |
|
|
168
174
|
| --- | --- | --- |
|
|
@@ -180,7 +186,7 @@ Extension authors integrating with `worktree: true` cleanup can subscribe to `at
|
|
|
180
186
|
|
|
181
187
|
### Owner-bound task projection
|
|
182
188
|
|
|
183
|
-
This section describes an SDK host integration API for custom frontends. SDK host adapters bind task observation to a live session in three steps:
|
|
189
|
+
This section describes an SDK host integration API for custom frontends. Import `OwnerTaskStore` and `bindOwnerTaskStore` from `@bastani/atomic`, and see [Owner-bound task supervisor](/sdk/reference#owner-bound-task-supervisor) for creating the host and lease. SDK host adapters bind task observation to a live session in three steps:
|
|
184
190
|
|
|
185
191
|
1. Construct an `OwnerTaskStore` from the supervisor and owner lease.
|
|
186
192
|
2. Check `store.connect()`.
|
package/docs/subagents.md
CHANGED
|
@@ -12,7 +12,7 @@ When to delegate:
|
|
|
12
12
|
- Keep interactive, exploratory, or immediately blocking tasks in your main chat unless specialist focus or context isolation adds value.
|
|
13
13
|
- Every subagent runs in the background. Let completion notices report back instead of polling, and call `subagent({ action: "wait", id })` only when the next step depends on a subagent's result.
|
|
14
14
|
|
|
15
|
-
See [Manage background tasks](/background-tasks) for the agent panel, `/tasks`, shell output, cancellation, and completion notices. For defining custom agents, see [Create custom subagents](/subagents/authoring). For discovery precedence, fallback chains, and configuration keys, see [Subagent reference](/subagents/reference).
|
|
15
|
+
New to subagents? Start with [Subagents overview](/guides/subagents). See [Manage background tasks](/background-tasks) for the agent panel, `/tasks`, shell output, cancellation, and completion notices. For defining custom agents, see [Create custom subagents](/subagents/authoring). For discovery precedence, fallback chains, and configuration keys, see [Subagent reference](/subagents/reference). For embedding subagents in an app, see [Subagent children in the SDK](/sdk#subagent-children).
|
|
16
16
|
|
|
17
17
|
## Start with natural language
|
|
18
18
|
|
|
@@ -90,7 +90,7 @@ Use `fork` when a subagent needs the main conversation's decisions and context.
|
|
|
90
90
|
|
|
91
91
|
In a fork, `inheritProjectContext` and `inheritSkills` do not hide what the main session already sent; those frontmatter flags apply to fresh subagents. The subagent's own tool allowlist still applies: calling a tool outside its allowed list fails with an error naming the allowed tools. Where the provider supports mid-conversation tool changes, removed or child-only tools are declared after the main conversation; otherwise child-only tools run through `codemode` restricted strictly to the subagent's own tools.
|
|
92
92
|
|
|
93
|
-
Fresh subagents inherit the main session's model registry, authentication, and workspace discovery settings. A subagent's tool list can narrow permissions, but it cannot re-enable tools or packages excluded by the main session. See [SDK
|
|
93
|
+
Fresh subagents inherit the main session's model registry, authentication, and workspace discovery settings. A subagent's tool list can narrow permissions, but it cannot re-enable tools or packages excluded by the main session. See [Subagent children in the SDK](/sdk#subagent-children) for programmatic child configuration.
|
|
94
94
|
|
|
95
95
|
### Temporary worktrees
|
|
96
96
|
|
|
@@ -111,7 +111,7 @@ Key rules for `worktree: true`:
|
|
|
111
111
|
- **Parallel mode only.** `worktree: true` creates temporary isolated worktrees only for parallel `tasks: [...]` runs (or multiple single-agent calls combined in one assistant message). On a standalone single-agent `{ agent, task }` call, `worktree: true` has no effect and the subagent runs in the main checkout; use `worktree: { branch }` for an isolated single-agent worktree.
|
|
112
112
|
- **Clean tracked working tree required.** Launch fails before starting any subagent if tracked files have staged or unstaged edits (`git status --porcelain --untracked-files=no`). Untracked files do not block launch.
|
|
113
113
|
- **Base branch.** Temporary worktrees branch from `origin/<default-branch>` (fetching if needed) and fall back to `HEAD` only if no origin default branch is found, rather than branching from your current local `HEAD`.
|
|
114
|
-
- **Automatic post-creation setup.** After creating each temporary worktree, Atomic automatically copies `.atomic/settings.local.json` and any untracked `.atomic/settings.json`, configures Git `core.hooksPath` to share `.husky` or `.git/hooks`, symlinks (or creates a junction on Windows for) `node_modules`, copies gitignored files listed in `.worktreeinclude`, and runs `worktreeSetupHook` if configured in
|
|
114
|
+
- **Automatic post-creation setup.** After creating each temporary worktree, Atomic automatically copies `.atomic/settings.local.json` and any untracked `.atomic/settings.json`, configures Git `core.hooksPath` to share `.husky` or `.git/hooks`, symlinks (or creates a junction on Windows for) `node_modules`, copies gitignored files listed in `.worktreeinclude`, and runs `worktreeSetupHook` if configured in [config.json](/subagents/reference#subagent-config-json-reference).
|
|
115
115
|
- **No per-task `cwd` overrides.** All tasks in a `worktree: true` batch must share the same `cwd`; per-task `cwd` overrides that differ from the shared `cwd` are rejected.
|
|
116
116
|
- **Patch capture and cleanup.** Once every subagent in the batch finishes, Atomic saves each subagent's changes as a patch under `worktree-diffs/<run-id>` and removes the temporary worktrees and branches. If capturing a worktree's patch fails, Atomic keeps that worktree on disk and reports it in the diff summary so changes are not lost.
|
|
117
117
|
- **Paused, quit, and cancelled subagents.** Paused, quit, or session-closed subagents keep their temporary worktree only if it has uncommitted changes, untracked files, or new commits. Clean worktrees are removed; `resume` recreates them from base plus the saved patch and writes later patches as `task-<n>-<agent>.<execution>.patch`. Permanently cancelled subagents release their worktrees, and unresumed stopped worktrees with changes remain under `.atomic/worktrees/`.
|
|
@@ -222,9 +222,9 @@ If Atomic exits, crashes, or you switch sessions (`/new`, `/resume`, `/fork`), r
|
|
|
222
222
|
|
|
223
223
|
Inbound Intercom messages wait while a subagent restores (see [Connection states and recovery](/intercom/operations#connection-states-and-recovery)). Finished, paused, quit, and permanently cancelled subagents do not auto-relaunch, and session forks (`/fork`, `--fork`) never relaunch the original session's subagents. If a subagent cannot be restored (for example, its session or agent definition is missing), Atomic posts one recovery notice with its IDs, worktree or branch, `git` inspection commands, and relaunch call, then marks it gone.
|
|
224
224
|
|
|
225
|
-
A subagent stores its session in the launching session's storage backend
|
|
225
|
+
A subagent stores its session in the launching session's [storage backend](/storage). It uses SQLite by default, or your configured libSQL or PostgreSQL database. Subagents resume, wake, and export wherever their launching session opens, including [another machine sharing the same database](/guides/resume-on-any-machine).
|
|
226
226
|
|
|
227
|
-
- **JSONL and custom directories.** A JSONL-backed session keeps each subagent's session file beside its own. Setting `sessionDir` (or `defaultSessionDir` in
|
|
227
|
+
- **JSONL and custom directories.** A JSONL-backed session keeps each subagent's session file beside its own. Setting `sessionDir` (or `defaultSessionDir` in [config.json](/subagents/reference#subagent-config-json-reference)) stores fresh subagents as JSONL files in that directory. Older sessions under `~/.atomic/agent/subagent-sessions/` remain readable in `/tasks` and restorable.
|
|
228
228
|
- **Unsaved sessions.** A session started with `--no-session` or in-memory storage keeps subagent sessions in memory; a finished subagent's history moves to a temporary file that Atomic deletes on exit.
|
|
229
229
|
- **Session list visibility.** Fresh subagent sessions are marked internal so `/resume`, `atomic -r`, `-c`, and `history://sessions` omit them, while `context: "fork"` sessions appear as forks of the main session. Each result names its session file or `history://sessions/<id>`.
|
|
230
230
|
- **Worktree snapshots.** In a blob-capable store, subagents record [worktree snapshots](/worktree-snapshots) of checkouts they modify. Reopening the main session restores each shared checkout from the newest capture among the main session and its finished subagents, while named worktrees and restored active subagents continue from their own snapshots.
|
|
@@ -233,7 +233,7 @@ A subagent stores its session in the launching session's storage backend: SQLite
|
|
|
233
233
|
|
|
234
234
|
### Supervisor coordination
|
|
235
235
|
|
|
236
|
-
By default (`intercomBridge.mode: "always"` in
|
|
236
|
+
By default (`intercomBridge.mode: "always"` in [config.json](/subagents/reference#subagent-config-json-reference)), Atomic injects **both** `intercom` and `contact_supervisor` into **every** subagent whose launching session has Intercom active. Tool frontmatter declarations alone control Intercom tool availability only when `intercomBridge.mode` is `"off"` (or `"fork-only"` for fresh subagents). Main-session tool allowlists, exclusions, `noTools`, and disabled Intercom still apply. A subagent without `read` or `search` receives a read-only `session_history` tool after compaction so it can recover its own history (see [Agents without read or search](/compaction#agents-without-read-or-search)).
|
|
237
237
|
|
|
238
238
|
- **Supervisor decision waits vs. `intercom` `ask`.** `contact_supervisor({ reason: "need_decision", message })` and `interview_request` wait inside the requesting subagent and continue that same subagent when you reply via `intercom({ action: "reply", message: "..." })` (use `pending` and `replyTo` when multiple asks are open). Never relaunch the subagent to answer it. By contrast, `intercom` `ask` never blocks: it returns at delivery (after any `wait` budget) and delivers late replies as messages.
|
|
239
239
|
- **Non-blocking updates.** `intercom` `send` and `contact_supervisor({ reason: "progress_update", message })` return immediately without cancelling or disrupting siblings or worktrees.
|
|
@@ -348,6 +348,35 @@ Exceeding the budget fails with `SessionStartTimeoutError` (shown in `status` an
|
|
|
348
348
|
|
|
349
349
|
For SDK error rehydration (`isSessionStartTimeoutError`, `rehydrateSessionStartError`), see [Session start errors](/sdk/reference#session-start-errors).
|
|
350
350
|
|
|
351
|
+
### Using subagents from the SDK
|
|
352
|
+
|
|
353
|
+
`createAgentSession()` enables the bundled subagents package by default. Control subagents and child host behavior directly from `@bastani/atomic`:
|
|
354
|
+
|
|
355
|
+
```typescript
|
|
356
|
+
import { createAgentSession } from "@bastani/atomic";
|
|
357
|
+
|
|
358
|
+
// Disable the bundled subagents package (also removes its 21 bundled skills)
|
|
359
|
+
const withoutPackage = await createAgentSession({
|
|
360
|
+
builtins: { subagents: false },
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
// Hide only the subagent tool while keeping the 21 bundled skills available
|
|
364
|
+
const skillsOnly = await createAgentSession({
|
|
365
|
+
excludedTools: ["subagent"],
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
// Route subagent ask_user_question and extension dialogs without a terminal
|
|
369
|
+
const headless = await createAgentSession({
|
|
370
|
+
extensionBindings: {
|
|
371
|
+
humanInput: myHostInput,
|
|
372
|
+
},
|
|
373
|
+
});
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
- **Child inheritance.** Subagents inherit the parent session's `ModelRuntime`, settings, `agentDir`, `scopedModels`, `fallbackModels`, `customTools`, `resourceAdmission`, and `humanInput`. See [Subagent children in the SDK](/sdk#subagent-children).
|
|
377
|
+
- **Human input.** Implement `extensionBindings.humanInput` so dialogs triggered inside a child session route cleanly by `sessionId`. See [Human input without a terminal](/sdk#human-input-without-a-terminal).
|
|
378
|
+
- **Background task supervision.** Bind `AgentTaskHost` and `OwnerTaskStore` to observe and control background subagents in custom hosts. See [Owner-bound task supervisor](/sdk/reference#owner-bound-task-supervisor) and [Owner-bound task projection](/subagents/reference#owner-bound-task-projection).
|
|
379
|
+
|
|
351
380
|
## Delegation boundaries and migration
|
|
352
381
|
|
|
353
382
|
Delegation is fixed at one level: subagents cannot launch, `pause`, `resume`, or `quit` other subagents, and restricted subagents cannot `create`, `update`, or `delete` agent definitions. Subagents can still run background shells (nested under the subagent in the agent panel) and inspect status with `list`, `get`, `status`, and `wait`. Subagent prompts omit parent orchestration artifacts and prior control traffic.
|
package/docs/terminal-setup.md
CHANGED
|
@@ -171,7 +171,7 @@ Atomic detects terminal capabilities automatically:
|
|
|
171
171
|
|
|
172
172
|
| Terminal | Inline images | OSC 8 hyperlinks | Color mode |
|
|
173
173
|
| --- | --- | --- | --- |
|
|
174
|
-
| Kitty, Ghostty, WezTerm, Warp, Herdr, Rex, Orca (`ORCA_IMAGE_PROTOCOL=kitty`) | Kitty protocol | Yes | Truecolor |
|
|
174
|
+
| Kitty, Ghostty, WezTerm, Warp, [Herdr](/herdr), Rex, Orca (`ORCA_IMAGE_PROTOCOL=kitty`) | Kitty protocol | Yes | Truecolor |
|
|
175
175
|
| iTerm2 | iTerm2 protocol | Yes | Truecolor |
|
|
176
176
|
| Windows Terminal (`WT_SESSION`), Alacritty, VS Code, Zed | No | Yes | Truecolor |
|
|
177
177
|
| IntelliJ IDEA (`JetBrains-JediTerm`), Windows consoles without `WT_SESSION` | No | No | Truecolor |
|