@bastani/atomic 0.10.10-alpha.1 → 0.10.10-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (289) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +22 -15
  3. package/dist/_shared/dist-KOELCESV.js +2 -2
  4. package/dist/_shared/fork-row-index-UAUAQRD5.js +2 -2
  5. package/dist/_shared/lib-4PES5P4V.js +2 -2
  6. package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js +2 -2
  7. package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +2 -2
  8. package/dist/_shared/mode-shared-2QJSCUM6.js +2 -2
  9. package/dist/_shared/p1a-prewarm-XIU57JHF.js +3 -3
  10. package/dist/_shared/sdk-RRLVN7ER.js +2 -2
  11. package/dist/_shared/session-data-AHTU7IS6.js +2 -2
  12. package/dist/_shared/startup-0-0-4VG2G44V.js +2 -2
  13. package/dist/_shared/startup-0-1-XTIL65D4.js +2 -2
  14. package/dist/_shared/startup-0-2-27OWFHV6.js +7 -6
  15. package/dist/_shared/startup-0-2-27OWFHV6.js.map +1 -1
  16. package/dist/_shared/startup-0-3-T4DVFYWX.js +2 -2
  17. package/dist/_shared/startup-0-4-ZMJV547D.js +2 -2
  18. package/dist/_shared/startup-0-5-FD2P735I.js +2 -2
  19. package/dist/_shared/startup-10-0-TDQNBDDL.js +2 -2
  20. package/dist/_shared/startup-15-1-4S7FLMNG.js +2 -2
  21. package/dist/_shared/startup-8-0-34CBHPZH.js +2 -2
  22. package/dist/_shared/startup-8-1-4KANEHRA.js +2 -2
  23. package/dist/_shared/storage-command-7MGXLJGZ.js +2 -2
  24. package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +2 -2
  25. package/dist/_shared/tree-outline-MUEPK5B7.js +2 -2
  26. package/dist/builtin/intercom/README.md +4 -4
  27. package/dist/builtin/intercom/index.bundle.mjs +1 -1
  28. package/dist/builtin/intercom/package.json +1 -1
  29. package/dist/builtin/mcp/README.md +28 -4
  30. package/dist/builtin/mcp/index.bundle.mjs +1 -1
  31. package/dist/builtin/mcp/package.json +1 -1
  32. package/dist/builtin/subagents/README.md +3 -3
  33. package/dist/builtin/subagents/package.json +1 -1
  34. package/dist/builtin/subagents/src/extension/index.bundle.mjs +1 -1
  35. package/dist/builtin/web-access/README.md +2 -2
  36. package/dist/builtin/web-access/index.bundle.mjs +1 -1
  37. package/dist/builtin/web-access/package.json +1 -1
  38. package/dist/cli/auth-cli.impl.js +3 -3
  39. package/dist/cli/auth-cli.js +3 -3
  40. package/dist/cli/blueprint-command.impl.js +3 -3
  41. package/dist/cli/blueprint-command.js +3 -3
  42. package/dist/cli/intercom-command.code.js +2 -2
  43. package/dist/cli/intercom-command.impl.js +3 -3
  44. package/dist/cli/intercom-command.js +3 -3
  45. package/dist/cli/list-models.impl.js +3 -3
  46. package/dist/cli/list-models.js +3 -3
  47. package/dist/cli/session-picker.impl.js +3 -3
  48. package/dist/cli/session-picker.js +3 -3
  49. package/dist/cli/startup-ui.impl.js +3 -3
  50. package/dist/cli/startup-ui.js +3 -3
  51. package/dist/cli/storage-command.impl.js +3 -3
  52. package/dist/cli/storage-command.js +3 -3
  53. package/dist/cli/storage-search-session.impl.js +3 -3
  54. package/dist/cli/storage-search-session.js +3 -3
  55. package/dist/cli/team-command.impl.js +3 -3
  56. package/dist/cli/team-command.js +3 -3
  57. package/dist/cli.js +2 -2
  58. package/dist/core/debug.impl.js +3 -3
  59. package/dist/core/debug.js +3 -3
  60. package/dist/core/export-html/card-projection.impl.js +3 -3
  61. package/dist/core/export-html/card-projection.js +3 -3
  62. package/dist/core/export-html/index.code.js +2 -2
  63. package/dist/core/export-html/index.impl.js +3 -3
  64. package/dist/core/export-html/index.js +3 -3
  65. package/dist/core/export-html/json-spans.impl.js +3 -3
  66. package/dist/core/export-html/json-spans.js +3 -3
  67. package/dist/core/export-html/oversized-render-inputs.impl.js +3 -3
  68. package/dist/core/export-html/oversized-render-inputs.js +3 -3
  69. package/dist/core/export-html/tool-renderer.impl.js +3 -3
  70. package/dist/core/export-html/tool-renderer.js +3 -3
  71. package/dist/core/extensions/jiti-loader.impl.js +3 -3
  72. package/dist/core/extensions/jiti-loader.js +3 -3
  73. package/dist/core/extensions/jiti-static-loader.impl.js +3 -3
  74. package/dist/core/extensions/jiti-static-loader.js +3 -3
  75. package/dist/core/extensions/loader-host-modules.impl.js +3 -3
  76. package/dist/core/extensions/loader-host-modules.js +3 -3
  77. package/dist/core/intercom-broker-control-host.impl.js +3 -3
  78. package/dist/core/intercom-broker-control-host.js +3 -3
  79. package/dist/core/intercom-broker-control.code.js +2 -2
  80. package/dist/core/intercom-broker-control.impl.js +3 -3
  81. package/dist/core/intercom-broker-control.js +3 -3
  82. package/dist/core/package-manager-storage-adapters.impl.js +3 -3
  83. package/dist/core/package-manager-storage-adapters.js +3 -3
  84. package/dist/core/sdk.impl.js +3 -3
  85. package/dist/core/sdk.js +3 -3
  86. package/dist/core/session-manager-core.js +2 -2
  87. package/dist/core/session-manager-list.impl.js +3 -3
  88. package/dist/core/session-manager-list.js +3 -3
  89. package/dist/core/session-manager.impl.js +3 -3
  90. package/dist/core/session-manager.js +3 -3
  91. package/dist/core/session-storage.impl.js +3 -3
  92. package/dist/core/session-storage.js +3 -3
  93. package/dist/core/storage/index.js +2 -2
  94. package/dist/core/storage/node-sqlite-thread.js +2 -2
  95. package/dist/core/storage/node-sqlite.js +2 -2
  96. package/dist/core/storage/offline-snapshot-file.impl.js +3 -3
  97. package/dist/core/storage/offline-snapshot-file.js +3 -3
  98. package/dist/core/storage/provider.js +2 -2
  99. package/dist/core/storage/selection.js +2 -2
  100. package/dist/core/storage/session/branch-fork-source.code.js +2 -2
  101. package/dist/core/storage/session/branch-fork-source.impl.js +3 -3
  102. package/dist/core/storage/session/branch-fork-source.js +3 -3
  103. package/dist/core/storage/session/card-view.impl.js +3 -3
  104. package/dist/core/storage/session/card-view.js +3 -3
  105. package/dist/core/storage/session/child-reader.code.js +2 -2
  106. package/dist/core/storage/session/child-reader.impl.js +3 -3
  107. package/dist/core/storage/session/child-reader.js +3 -3
  108. package/dist/core/storage/session/chunked-resume-projection.impl.js +3 -3
  109. package/dist/core/storage/session/chunked-resume-projection.js +3 -3
  110. package/dist/core/storage/session/expanded-child-details.code.js +2 -2
  111. package/dist/core/storage/session/expanded-child-details.impl.js +3 -3
  112. package/dist/core/storage/session/expanded-child-details.js +3 -3
  113. package/dist/core/storage/session/fork-row-bytes.impl.js +3 -3
  114. package/dist/core/storage/session/fork-row-bytes.js +3 -3
  115. package/dist/core/storage/session/fork-row-index.impl.js +3 -3
  116. package/dist/core/storage/session/fork-row-index.js +3 -3
  117. package/dist/core/storage/session/fork-staging.impl.js +3 -3
  118. package/dist/core/storage/session/fork-staging.js +3 -3
  119. package/dist/core/storage/session/fork-window.code.js +2 -2
  120. package/dist/core/storage/session/fork-window.impl.js +3 -3
  121. package/dist/core/storage/session/fork-window.js +3 -3
  122. package/dist/core/storage/session/history-pages.impl.js +3 -3
  123. package/dist/core/storage/session/history-pages.js +3 -3
  124. package/dist/core/storage/session/jsonl-entry-projection.impl.js +3 -3
  125. package/dist/core/storage/session/jsonl-entry-projection.js +3 -3
  126. package/dist/core/storage/session/jsonl-session-store.impl.js +3 -3
  127. package/dist/core/storage/session/jsonl-session-store.js +3 -3
  128. package/dist/core/storage/session/memory-session-store.impl.js +3 -3
  129. package/dist/core/storage/session/memory-session-store.js +3 -3
  130. package/dist/core/storage/session/pinned-branch-resume.code.js +2 -2
  131. package/dist/core/storage/session/pinned-branch-resume.impl.js +3 -3
  132. package/dist/core/storage/session/pinned-branch-resume.js +3 -3
  133. package/dist/core/storage/session/released-history-files.impl.js +3 -3
  134. package/dist/core/storage/session/released-history-files.js +3 -3
  135. package/dist/core/storage/session/resident-fork-rows.impl.js +3 -3
  136. package/dist/core/storage/session/resident-fork-rows.js +3 -3
  137. package/dist/core/storage/session/session-resume.impl.js +3 -3
  138. package/dist/core/storage/session/session-resume.js +3 -3
  139. package/dist/core/storage/session/snapshot-cut.impl.js +3 -3
  140. package/dist/core/storage/session/snapshot-cut.js +3 -3
  141. package/dist/core/storage/session/snapshot-history.code.js +2 -2
  142. package/dist/core/storage/session/snapshot-history.impl.js +3 -3
  143. package/dist/core/storage/session/snapshot-history.js +3 -3
  144. package/dist/core/storage/session/sql-session-store.impl.js +3 -3
  145. package/dist/core/storage/session/sql-session-store.js +3 -3
  146. package/dist/core/storage/session/tree-outline.impl.js +3 -3
  147. package/dist/core/storage/session/tree-outline.js +3 -3
  148. package/dist/core/storage/session/tree-presentation.impl.js +3 -3
  149. package/dist/core/storage/session/tree-presentation.js +3 -3
  150. package/dist/core/storage/storage-status.impl.js +3 -3
  151. package/dist/core/storage/storage-status.js +3 -3
  152. package/dist/core/storage/team.impl.js +3 -3
  153. package/dist/core/storage/team.js +3 -3
  154. package/dist/core/structured-output/index.impl.js +3 -3
  155. package/dist/core/structured-output/index.js +3 -3
  156. package/dist/core/tasks/task-completion-entry.impl.js +3 -3
  157. package/dist/core/tasks/task-completion-entry.js +3 -3
  158. package/dist/core/tasks/task-file-history.code.js +2 -2
  159. package/dist/core/tasks/task-file-history.impl.js +3 -3
  160. package/dist/core/tasks/task-file-history.js +3 -3
  161. package/dist/core/tasks/task-reference-archive.code.js +2 -2
  162. package/dist/core/tasks/task-reference-archive.js +3 -3
  163. package/dist/core/tasks/task-reference-identity.js +3 -3
  164. package/dist/core/tasks/task-reference-stream.impl.js +3 -3
  165. package/dist/core/tasks/task-reference-stream.js +3 -3
  166. package/dist/core/tasks/task-unsaved-answer.impl.js +3 -3
  167. package/dist/core/tasks/task-unsaved-answer.js +3 -3
  168. package/dist/core/tasks/task-view-source.impl.js +3 -3
  169. package/dist/core/tasks/task-view-source.js +3 -3
  170. package/dist/core/tools/read-url.impl.js +3 -3
  171. package/dist/core/tools/read-url.js +3 -3
  172. package/dist/core/worktree-snapshot/blob-store.js +2 -2
  173. package/dist/core/worktree-snapshot/errors.impl.js +3 -3
  174. package/dist/core/worktree-snapshot/errors.js +3 -3
  175. package/dist/core/worktree-snapshot/session-index-reset.impl.js +3 -3
  176. package/dist/core/worktree-snapshot/session-index-reset.js +3 -3
  177. package/dist/extensions/codemode/execute.impl.js +3 -3
  178. package/dist/extensions/codemode/execute.js +3 -3
  179. package/dist/extensions/codemode/renderer.impl.js +3 -3
  180. package/dist/extensions/codemode/renderer.js +3 -3
  181. package/dist/extensions/mcp/cli.impl.js +3 -3
  182. package/dist/extensions/mcp/cli.js +3 -3
  183. package/dist/extensions/mcp/cli.lazy.code.js +2 -2
  184. package/dist/extensions/mcp/cli.lazy.impl.js +3 -3
  185. package/dist/extensions/mcp/cli.lazy.js +3 -3
  186. package/dist/extensions/mcp/runtime.impl.js +3 -3
  187. package/dist/extensions/mcp/runtime.js +3 -3
  188. package/dist/main-first-time-setup.impl.js +3 -3
  189. package/dist/main-first-time-setup.js +3 -3
  190. package/dist/modes/interactive/components/stored-tree-view.code.js +2 -2
  191. package/dist/modes/interactive/components/stored-tree-view.impl.js +3 -3
  192. package/dist/modes/interactive/components/stored-tree-view.js +3 -3
  193. package/dist/modes/interactive/components/user-message-selector-archive.impl.js +3 -3
  194. package/dist/modes/interactive/components/user-message-selector-archive.js +3 -3
  195. package/dist/package-manager-cli.code.js +2 -2
  196. package/dist/package-manager-cli.impl.js +3 -3
  197. package/dist/package-manager-cli.js +3 -3
  198. package/dist/startup-files.json +1 -1
  199. package/dist/utils/startup-database-spare.impl.js +3 -3
  200. package/dist/utils/startup-database-spare.js +3 -3
  201. package/dist/utils/tools-manager.impl.js +3 -3
  202. package/dist/utils/tools-manager.js +3 -3
  203. package/docs/background-tasks.md +8 -5
  204. package/docs/build.md +11 -6
  205. package/docs/changelog.mdx +1 -1
  206. package/docs/codemode.md +10 -2
  207. package/docs/compaction/reference.md +6 -4
  208. package/docs/compaction.md +3 -3
  209. package/docs/containerization.md +13 -5
  210. package/docs/custom-provider/api-reference.md +8 -6
  211. package/docs/custom-provider/oauth.md +4 -4
  212. package/docs/custom-provider/registration.md +3 -3
  213. package/docs/custom-provider.md +8 -8
  214. package/docs/development.md +40 -5
  215. package/docs/docs.json +21 -5
  216. package/docs/environment-variables.md +20 -18
  217. package/docs/extensions/api-reference.md +8 -6
  218. package/docs/extensions/authoring.md +4 -4
  219. package/docs/extensions.md +43 -6
  220. package/docs/guides/configuration.md +21 -1
  221. package/docs/guides/intercom.md +4 -0
  222. package/docs/guides/non-interactive.md +4 -2
  223. package/docs/guides/orchestration.md +4 -2
  224. package/docs/guides/resume-on-any-machine.md +12 -6
  225. package/docs/guides/subagents.md +4 -0
  226. package/docs/guides/team-setup.md +13 -2
  227. package/docs/guides.md +10 -4
  228. package/docs/herdr.md +4 -4
  229. package/docs/index.md +12 -4
  230. package/docs/intercom/operations.md +26 -4
  231. package/docs/intercom/reference.md +25 -3
  232. package/docs/intercom.md +13 -5
  233. package/docs/json.md +2 -0
  234. package/docs/keybindings.md +17 -4
  235. package/docs/libraries/agent-core.md +4 -2
  236. package/docs/libraries/ai.md +71 -53
  237. package/docs/libraries/codemode.md +3 -2
  238. package/docs/libraries/schema.md +5 -2
  239. package/docs/libraries/storage-libsql.md +92 -0
  240. package/docs/libraries/storage-postgres.md +119 -0
  241. package/docs/libraries/telemetry.md +35 -2
  242. package/docs/libraries.md +23 -6
  243. package/docs/llama-cpp.md +2 -2
  244. package/docs/mcp-servers.md +50 -4
  245. package/docs/models/reference.md +13 -9
  246. package/docs/models-configuration.md +7 -7
  247. package/docs/models.md +18 -8
  248. package/docs/orchestration/migrating-workflows.md +2 -2
  249. package/docs/orchestration/patterns.md +8 -8
  250. package/docs/orchestration.md +5 -3
  251. package/docs/packages/authoring.md +3 -1
  252. package/docs/packages/reference.md +3 -1
  253. package/docs/packages.md +5 -3
  254. package/docs/programmatic.md +14 -8
  255. package/docs/prompt-templates.md +5 -3
  256. package/docs/providers/reference.md +7 -7
  257. package/docs/providers.md +22 -10
  258. package/docs/quickstart.md +13 -11
  259. package/docs/reference/cli.md +10 -5
  260. package/docs/reference.md +8 -4
  261. package/docs/rpc/examples.md +47 -0
  262. package/docs/rpc/extension-ui.md +7 -1
  263. package/docs/rpc/protocol.md +3 -2
  264. package/docs/rpc.md +3 -1
  265. package/docs/sdk/reference.md +144 -38
  266. package/docs/sdk/storage.md +614 -0
  267. package/docs/sdk/structured-decisions.md +77 -4
  268. package/docs/sdk/web-server.md +3 -2
  269. package/docs/sdk.md +26 -115
  270. package/docs/security.md +17 -7
  271. package/docs/session-format.md +38 -24
  272. package/docs/sessions.md +21 -15
  273. package/docs/settings.md +17 -14
  274. package/docs/skills.md +47 -3
  275. package/docs/storage.md +38 -24
  276. package/docs/subagents/authoring.md +3 -1
  277. package/docs/subagents/reference.md +8 -2
  278. package/docs/subagents.md +35 -6
  279. package/docs/terminal-setup.md +1 -1
  280. package/docs/themes.md +5 -3
  281. package/docs/tmux.md +4 -4
  282. package/docs/tools.md +11 -0
  283. package/docs/usage.md +25 -15
  284. package/docs/web-access.md +35 -0
  285. package/docs/windows.md +9 -6
  286. package/docs/worktree-snapshots.md +22 -11
  287. package/examples/sdk/11-sessions.ts +4 -4
  288. package/package.json +8 -8
  289. package/schemas/models.schema.json +7 -7
@@ -79,7 +79,7 @@ For example, to turn off a user-level server in one project:
79
79
 
80
80
  ### Servers from packages and extensions
81
81
 
82
- Installed [packages](/packages/authoring#mcp-servers) and extensions can contribute MCP servers using the same configuration shape. File-configured servers take precedence over package or extension contributions with the same normalized name. Project packages load only after project trust is granted.
82
+ Installed [packages](/packages/authoring#mcp-servers) and [extensions](/extensions/api-reference#atomic-registermcpserver-name-config) can contribute MCP servers using the same configuration shape. File-configured servers take precedence over package or extension contributions with the same normalized name. Project packages load only after project trust is granted.
83
83
 
84
84
  `/mcp` shows each server's source. Enabled-state and exposure changes to file-configured servers save back to `mcp.json` while preserving formatting and unrelated settings (setting a full entry back to the defaults `enabled: true` or `exposure: "codemode"` omits those default keys on disk, while project overrides keep explicit keys). In a trusted project, **Enable in this project** and **Disable in this project** create or update a project override for a user-level server, and `atomic mcp list` displays the override. Changes to extension-contributed servers apply to the current session only.
85
85
 
@@ -104,7 +104,7 @@ When you resume a session, its previously used MCP tools remain available and ke
104
104
 
105
105
  ### Shell commands
106
106
 
107
- CLI subcommands operate on file-configured servers and do not load extensions:
107
+ CLI subcommands operate on file-configured servers and do not load extensions (see [MCP CLI commands](/reference/cli#mcp-commands)):
108
108
 
109
109
  ```bash
110
110
  atomic mcp add <server> [options] -- <command> [args...]
@@ -131,8 +131,8 @@ MCP tools register as `mcp__<server>__<tool>` with punctuation replaced by `_`.
131
131
 
132
132
  | Exposure | Behavior |
133
133
  | --- | --- |
134
- | `codemode` (default) | Callable from codemode scripts, but not declared directly to the model or listed in codemode's inline catalog. Discover with `await searchTools()`, `await describeTool()`, or `ALL_TOOLS`. |
135
- | `deferred` | Not declared until `tool_search` activates matching tools for the next model turn. |
134
+ | `codemode` (default) | Callable from [codemode](/codemode) scripts, but not declared directly to the model or listed in codemode's inline catalog. Discover with `await searchTools()`, `await describeTool()`, or `ALL_TOOLS`. |
135
+ | `deferred` | Not declared until [`tool_search`](/tools#tool_search) activates matching tools for the next model turn. |
136
136
  | `direct` | Declared like a built-in tool and also callable from codemode. |
137
137
  | `hidden` | Unreachable. |
138
138
 
@@ -252,6 +252,44 @@ Provider-token authentication enforces these restrictions:
252
252
  - Requires HTTPS, except for HTTP on `localhost`, `127.0.0.1`, or `[::1]`.
253
253
  - Sends tokens only to the server's configured origin. Atomic follows same-origin `301`, `302`, `303`, `307`, and `308` redirects up to 10 hops (rewriting `POST` to `GET` on `301` and `302`, and non-`HEAD` requests to `GET` on `303`). Cross-origin redirects are rejected.
254
254
 
255
+ ## Using MCP from the SDK
256
+
257
+ `createAgentSession()` enables built-in MCP support by default and loads servers from `mcp.json`, installed packages, and extensions. Control MCP behavior programmatically from `@bastani/atomic`:
258
+
259
+ ```typescript
260
+ import { createAgentSession, DefaultResourceLoader } from "@bastani/atomic";
261
+
262
+ // Disable built-in MCP support completely
263
+ const noMcp = await createAgentSession({
264
+ builtins: { mcp: false },
265
+ });
266
+
267
+ // Allow only specific MCP tools, or exclude a server's tools
268
+ const filtered = await createAgentSession({
269
+ tools: ["read", "codemode", "mcp__docs__*"],
270
+ excludedTools: ["mcp__docs__delete_*"],
271
+ });
272
+
273
+ // Register an MCP server dynamically at runtime via an inline extension factory
274
+ const loader = new DefaultResourceLoader({
275
+ extensionFactories: [
276
+ (atomic) => {
277
+ atomic.registerMcpServer("local-service", {
278
+ url: "http://127.0.0.1:4321/mcp",
279
+ exposure: "direct",
280
+ });
281
+ },
282
+ ],
283
+ });
284
+ await loader.reload();
285
+
286
+ const { session } = await createAgentSession({ resourceLoader: loader });
287
+ ```
288
+
289
+ - **Tool filtering.** When `tools` is a non-empty allowlist with no `mcp__*` entry, MCP tools stay registered for `codemode` and `tool_search`. Adding any `mcp__*` entry switches MCP tools to explicit allowlisting. See [SDK tools](/sdk/reference#tools).
290
+ - **Dynamic registration.** Call [`atomic.registerMcpServer()`](/extensions/api-reference#atomic-registermcpserver-name-config) inside an inline extension factory when a server URL or port is computed at runtime.
291
+ - **Custom resource loaders.** Implement `getMcpServerContributions()` on a custom `ResourceLoader` to supply `McpServerContribution[]` directly under your own trust policy. See [ResourceLoader](/sdk/reference#resourceloader).
292
+
255
293
  ## Supported configuration and limits
256
294
 
257
295
  - Atomic reads only `~/.atomic/agent/mcp.json`, trusted `.atomic/mcp.json`, and package or extension contributions. External MCP client config files and third-party credential stores are not imported.
@@ -267,3 +305,11 @@ Provider-token authentication enforces these restrictions:
267
305
  - **Temporary authorization server outage.** Stored tokens stay intact and Atomic retries automatically; run `/mcp reconnect my-server` once the authorization server recovers. You are asked to sign in again only when credentials are rejected or revoked.
268
306
  - **Issuer mismatch.** Verify the authorization server's metadata and callback configuration before retrying rather than bypassing issuer validation.
269
307
  - **Slow tool calls.** Increase `timeout` (in seconds). Server progress notifications reset this inactivity timer.
308
+
309
+ ## Related docs
310
+
311
+ - [SDK tools](/sdk/reference#tools) and [ResourceLoader](/sdk/reference#resourceloader) cover `builtins.mcp`, `tools`, `excludedTools`, and `getMcpServerContributions()`.
312
+ - [Extensions API reference](/extensions/api-reference#atomic-registermcpserver-name-config) documents `atomic.registerMcpServer()`.
313
+ - [Codemode reference](/codemode) and [`tool_search`](/tools#tool_search) cover discovering and calling `codemode` and `deferred` MCP tools.
314
+ - [Tool and MCP allowlists](/subagents/authoring#tool-and-mcp-allowlists) explains `mcp:<server>` and `mcp:<server>/<tool>` syntax in custom subagents.
315
+ - [CLI reference](/reference/cli#mcp-commands) lists all `atomic mcp` subcommands and `--no-mcp`.
@@ -4,7 +4,9 @@ sidebarTitle: "Model overrides"
4
4
  description: "Supported APIs, value resolution, overrides, pricing tiers, thinking maps, derived fast variants, and API compatibility rules."
5
5
  ---
6
6
 
7
- This page covers provider and model behavior, compatibility rules, and built-in model details. For the complete schema-generated field list for `models.json`, see [`models.json` schema reference](/models-configuration).
7
+ This page covers provider and model behavior, compatibility rules, and built-in model details. For the complete schema-generated field list for `models.json`, see [`models.json` field reference](/models-configuration). For custom streaming APIs or OAuth flows, see [Build custom providers](/custom-provider).
8
+
9
+ Jump to: [Supported APIs](#supported-apis) · [Provider configuration](#provider-configuration) · [Model configuration](#model-configuration) · [Overriding built-in providers](#overriding-built-in-providers) · [Per-model overrides](#per-model-overrides) · [Derived fast model variants](#derived-fast-model-variants) · [Anthropic messages compatibility](#anthropic-messages-compatibility) · [OpenAI compatibility](#openai-compatibility) · [Catalog freshness and precedence](#catalog-freshness-and-precedence).
8
10
 
9
11
  ## Supported APIs
10
12
 
@@ -15,9 +17,11 @@ This page covers provider and model behavior, compatibility rules, and built-in
15
17
  | `anthropic-messages` | Anthropic Messages API |
16
18
  | `google-generative-ai` | Google Generative AI |
17
19
 
18
- Set `api` at provider level (default for all models) or model level (override per model).
20
+ Set `api` at provider level (default for chat and compactor models) or model level (override per model).
21
+
22
+ Atomic also registers six provider-specific chat APIs (`mistral-conversations`, `azure-openai-responses`, `openai-codex-responses`, `bedrock-converse-stream`, `google-vertex`, and `pi-messages`). You can use them in `models.json` when connecting to a compatible gateway or proxy, such as `"api": "pi-messages"` for a gateway speaking the `pi-messages` protocol or `"api": "mistral-conversations"` for a native Mistral endpoint.
19
23
 
20
- Built-in providers also use provider-specific APIs (`mistral-conversations`, `azure-openai-responses`, `openai-codex-responses`, `bedrock-converse-stream`, `google-vertex`, and `pi-messages`). These are built-in only and are not supported as generic custom provider APIs in `models.json`.
24
+ Models with `"type": "compactor"` declare their own compactor `api` string (such as `"custom-compact"` or `"morph-compact"`). See [Customize Morph or add a remote compactor](/compaction#customize-morph-or-add-a-remote-compactor).
21
25
 
22
26
  ## Provider configuration
23
27
 
@@ -71,11 +75,11 @@ In `models.json`, every header value must be a string. A `null` header value sup
71
75
 
72
76
  ## Model configuration
73
77
 
74
- See [Models fields](/models-configuration#models) for the complete schema table (`id`, `name`, `api`, `baseUrl`, `reasoning`, `thinkingLevelMap`, `input`, `inputLimits`, `cost`, `promptCache`, `contextWindow`, `maxTokens`, `samplingParams`, `samplingParamsByThinkingLevel`, `headers`, and `compat`).
78
+ See [Models fields](/models-configuration#models) for the complete schema table (`id`, `name`, `type`, `api`, `baseUrl`, `endpointPath`, `reasoning`, `thinkingLevelMap`, `input`, `inputLimits`, `cost`, `promptCache`, `contextWindow`, `maxTokens`, `timeoutMs`, `samplingParams`, `samplingParamsByThinkingLevel`, `compactionParams`, `headers`, and `compat`).
75
79
 
76
80
  Key display and modality rules:
77
81
 
78
- - `/model`, `--list-models`, the footer, fallback notices, and subagent labels show the raw `provider/id` (or `id` when the provider is clear) followed by the active thinking level, such as `anthropic/claude-sonnet-4-5 high`. That is the exact value `--model provider/id:level` accepts.
82
+ - `/model`, [`--list-models`](/reference/cli#model-options), the footer, fallback notices, and subagent labels show the raw `provider/id` (or `id` when the provider is clear) followed by the active thinking level, such as `anthropic/claude-sonnet-4-5 high`. That is the exact value `--model provider/id:level` accepts.
79
83
  - `name` is used for `--model` and `enabledModels` fuzzy matching and secondary text in `/model`; it never replaces `id`.
80
84
  - `input` declares the modalities Atomic sends: `["text"]`, `["text", "image"]`, or `["text", "image", "pdf"]`.
81
85
 
@@ -367,7 +371,7 @@ Merge rules:
367
371
 
368
372
  ## Per-model overrides
369
373
 
370
- Use `modelOverrides` to patch specific built-in, custom, or extension-registered chat models without replacing the provider's model list. See [Model overrides fields](/models-configuration#model-overrides) for all supported fields.
374
+ Use `modelOverrides` to patch specific built-in, custom, or extension-registered chat and compactor models without replacing the provider's model list. See [Model overrides fields](/models-configuration#model-overrides) for all supported fields.
371
375
 
372
376
  ```json
373
377
  {
@@ -392,8 +396,8 @@ Override rules:
392
396
 
393
397
  - Atomic reads a single `models.json` from the active agent directory and never merges `.pi` and `.atomic` model files.
394
398
  - Atomic retains parsed `modelOverrides` for models registered later by extensions through `atomic.registerProvider()`; unknown IDs are ignored otherwise.
395
- - `modelOverrides` runs after `models` and extension registrations, so it applies to built-in, extension-registered, and same-ID custom chat models (as well as derived `-fast` and `-ultrafast` variants).
396
- - Nested objects merge per key rather than wiping siblings: `compat` (including `openRouterRouting`, `vercelGatewayRouting`, `chatTemplateKwargs`, and `chatTemplateArgs`), `inputLimits` (including `images` and `images.resize`), `promptCache`, `thinkingLevelMap`, `samplingParams`, and `samplingParamsByThinkingLevel` (per level).
399
+ - `modelOverrides` runs after `models` and extension registrations, so it applies to built-in, extension-registered, and same-ID custom chat and compactor models (as well as derived `-fast` and `-ultrafast` variants). Image and classifier models are unaffected.
400
+ - Nested objects merge per key rather than wiping siblings: `compat` (including `openRouterRouting`, `vercelGatewayRouting`, `chatTemplateKwargs`, and `chatTemplateArgs`), `inputLimits` (including `images` and `images.resize`), `promptCache`, `thinkingLevelMap`, `samplingParams`, `samplingParamsByThinkingLevel` (per level), and `compactionParams` (on compactor models).
397
401
  - `headers` shallow-merges (when both a custom `models` entry and `modelOverrides` set the same header key, the custom `models` entry's header wins). Provider-level headers stay separate and combine at request time.
398
402
  - Scalar `cost` overrides preserve inherited `tiers`; providing `cost.tiers` replaces the entire array (`[]` clears it).
399
403
 
@@ -612,6 +616,6 @@ Atomic checks explicit model capability metadata rather than guessing from provi
612
616
 
613
617
  ### Catalog freshness and precedence
614
618
 
615
- Atomic caches remote catalogs in `~/.atomic/agent/models-store.json`, keeps each provider's last usable snapshot on refresh failure, and prefers newer built-in data over stale remote caches. Final resolution layers built-in catalogs, fresh persisted/remote data, the active agent directory's single `models.json`, and extension provider registrations/overrides. Project `.atomic`/`.pi` model files and legacy agent-directory model files are never merged.
619
+ Atomic caches remote catalogs in `~/.atomic/agent/models-store.json`, keeps each provider's last usable snapshot on refresh failure, and prefers newer built-in data over stale remote caches. Final resolution layers built-in catalogs, fresh persisted or remote data, the active agent directory's single `models.json`, and extension provider registrations and overrides. Project `.atomic`/`.pi` model files and legacy agent-directory model files are never merged. For catalog URL and offline variables, see [Environment variables](/environment-variables); for programmatic catalog control, see [SDK](/sdk) and [Model catalog persistence and refresh](/sdk/reference#model-catalog-persistence-and-refresh).
616
620
 
617
621
  Built-in Claude Opus 5 entries on Anthropic and Amazon Bedrock carry adaptive-thinking, prompt-caching, strict-tool, and `xhigh` metadata where advertised. Custom entries for similar models must declare matching `compat` capabilities explicitly rather than relying on the display name.
@@ -38,7 +38,7 @@ Each `models` entry adds a model to the provider. An entry whose `id` matches an
38
38
  | `api` | string | | Overrides the provider api. |
39
39
  | `baseUrl` | string | | Overrides the provider baseUrl. |
40
40
  | `endpointPath` | string | | Endpoint path appended to baseUrl for compactor requests (default "/compact"). Set to "" to POST directly to baseUrl. Applies only to compactor models. |
41
- | `reasoning` | boolean | `false` | Whether the model supports thinking. |
41
+ | `reasoning` | boolean | `false` | Whether the model supports thinking. Applies only to chat models. |
42
42
  | `thinkingLevelMap` | object | | Provider value sent for each thinking level. null marks a level unsupported. Levels the model does not map use the provider's default value through high; xhigh and max are unsupported. |
43
43
  | `input` | `("text" \| "image" \| "pdf")[]` | `["text"]` | |
44
44
  | `inputLimits` | [object](#input-limits) | | |
@@ -54,8 +54,8 @@ Each `models` entry adds a model to the provider. An entry whose `id` matches an
54
54
  | `cost.tiers[].cacheRead` | number | | Required. Cache-read cost in USD per million tokens. |
55
55
  | `cost.tiers[].cacheWrite` | number | | Required. Cache-write cost in USD per million tokens. |
56
56
  | `promptCache` | object | | Best-effort prompt cache lifetime in seconds for the short and long retention tiers. Atomic warms only tiers with a known lifetime. |
57
- | `contextWindow` | number | `128000` | Context window in tokens. |
58
- | `maxTokens` | number | `16384` | Maximum output tokens. |
57
+ | `contextWindow` | number | `128000` | Context window in tokens. Applies only to chat models. |
58
+ | `maxTokens` | number | `16384` | Maximum output tokens. Defaults to 16384 for chat models. When omitted on compactor models, defaults to 32000 estimated tokens, capped at 50% of the automatic trigger. |
59
59
  | `timeoutMs` | number | | Wall-clock timeout in milliseconds for one compactor request (default 120000). Applies only to compactor models. |
60
60
  | `samplingParams` | object | | Fields merged into every request body. Applies only to OpenAI-compatible APIs. |
61
61
  | `samplingParamsByThinkingLevel` | object | | samplingParams per thinking level, merged over samplingParams. |
@@ -72,7 +72,7 @@ Each `modelOverrides` key is the ID of a built-in or extension model. Unknown ID
72
72
  | `name` | string | | Display name, also matched by --model patterns. |
73
73
  | `baseUrl` | string | | Overrides the model baseUrl. |
74
74
  | `endpointPath` | string | | Endpoint path appended to baseUrl for compactor requests (default "/compact"). Set to "" to POST directly to baseUrl. Applies only to compactor models. |
75
- | `reasoning` | boolean | | Whether the model supports thinking. |
75
+ | `reasoning` | boolean | | Whether the model supports thinking. Applies only to chat models. |
76
76
  | `thinkingLevelMap` | object | | Provider value sent for each thinking level. null marks a level unsupported. Levels the model does not map use the provider's default value through high; xhigh and max are unsupported. |
77
77
  | `input` | `("text" \| "image" \| "pdf")[]` | | |
78
78
  | `inputLimits` | [object](#input-limits) | | |
@@ -88,8 +88,8 @@ Each `modelOverrides` key is the ID of a built-in or extension model. Unknown ID
88
88
  | `cost.tiers[].cacheRead` | number | | Required. Cache-read cost in USD per million tokens. |
89
89
  | `cost.tiers[].cacheWrite` | number | | Required. Cache-write cost in USD per million tokens. |
90
90
  | `promptCache` | object | | Best-effort prompt cache lifetime in seconds for the short and long retention tiers. Atomic warms only tiers with a known lifetime. |
91
- | `contextWindow` | number | | Context window in tokens. |
92
- | `maxTokens` | number | | Maximum output tokens. |
91
+ | `contextWindow` | number | | Context window in tokens. Applies only to chat models. |
92
+ | `maxTokens` | number | | Maximum output tokens. On compactor models, sets the upper bound on compacted output in estimated tokens, capped at 50% of the automatic trigger. |
93
93
  | `timeoutMs` | number | | Wall-clock timeout in milliseconds for one compactor request (default 120000). Applies only to compactor models. |
94
94
  | `samplingParams` | object | | Fields merged into every request body. Applies only to OpenAI-compatible APIs. |
95
95
  | `samplingParamsByThinkingLevel` | object | | samplingParams per thinking level, merged over samplingParams. |
@@ -215,7 +215,7 @@ Also applies to `cloudflare-workers-ai-system-one`.
215
215
 
216
216
  | Field | Type | Default | Description |
217
217
  |---|---|---|---|
218
- | `imageInput` | `"assets" \| "images" \| "state-image-urls"` | | How the service takes classifier images. "assets" sends TypeSafe's assets map (PNG and JPEG) and references the images from the state, as TypeSafe and Jev on Workers AI expect. "images" sends Clef's images list of data URLs (PNG, JPEG, and WebP, at most four), as Clef on Workers AI expects. "state-image-urls" places image_url parts before the state, as OpenRouter expects; OpenRouter drops assets without an error. Auto-detected from the provider, baseUrl, and model ID. Classifier models read it from the provider-level compat; models and modelOverrides entries apply to chat models only. |
218
+ | `imageInput` | `"assets" \| "images" \| "state-image-urls"` | | How the service takes classifier images. "assets" sends TypeSafe's assets map (PNG and JPEG) and references the images from the state, as TypeSafe and Jev on Workers AI expect. "images" sends Clef's images list of data URLs (PNG, JPEG, and WebP, at most four), as Clef on Workers AI expects. "state-image-urls" places image_url parts before the state, as OpenRouter expects; OpenRouter drops assets without an error. Auto-detected from the provider, baseUrl, and model ID. Classifier models read it from the provider-level compat; models and modelOverrides entries apply to chat and compactor models. |
219
219
  | `sendImageOptInHeader` | boolean | | Whether requests with images send the TypeSafe-Danger-Zone-Images: true header, which TypeSafe's own API requires for its experimental image input. Defaults to true for the typesafe-system-one API unless the model is detected as OpenRouter. |
220
220
 
221
221
  ### Atomic compatibility aliases
package/docs/models.md CHANGED
@@ -1,16 +1,23 @@
1
1
  ---
2
2
  title: "Configure custom models"
3
3
  sidebarTitle: "Custom models"
4
- description: "Add local or proxied models in models.json, override built-in providers, and use built-in classifier models."
4
+ description: "Add local or proxied models and remote compactors in models.json, override built-in providers, and use classifier models."
5
5
  ---
6
6
 
7
- Add custom providers and models (such as Ollama, vLLM, LM Studio, and API proxies) through `~/.atomic/agent/models.json`. Set `ATOMIC_CODING_AGENT_DIR` (or legacy `PI_CODING_AGENT_DIR`) to use another directory.
7
+ Add custom providers, chat models, and remote compactors (such as Ollama, vLLM, LM Studio, and API proxies) through `~/.atomic/agent/models.json`. Set `ATOMIC_CODING_AGENT_DIR` (or legacy `PI_CODING_AGENT_DIR`) to use another directory.
8
+
9
+ | If you want to | Edit or use | Read |
10
+ | --- | --- | --- |
11
+ | Add custom chat or compactor models, proxy endpoints, headers, or `modelOverrides` | `~/.atomic/agent/models.json` | This page and [Model configuration reference](/models/reference) |
12
+ | Choose default models, model scopes (`enabledModels`), `fallbackModels`, `decisionModel`, or `compactionModel` | `settings.json` or CLI flags (`--model`, `--models`) | [Settings reference](/settings#models-and-thinking) and [CLI model options](/reference/cli#model-options) |
13
+ | Configure subscriptions, API keys, or cloud credentials | `/login`, `~/.atomic/agent/auth.json`, or env vars | [Model providers](/providers) |
14
+ | Register custom streaming, image, classifier, or compactor APIs, OAuth flows, dynamic discovery, or account aliases | Extension calling `atomic.registerProvider()` | [Build custom providers](/custom-provider) |
8
15
 
9
16
  - **Single file, no merging.** Atomic reads only `models.json` from the active agent directory. It does not read project-scoped `.atomic/models.json`, fall back to `~/.pi/agent/models.json`, or merge `.pi` and `.atomic` model files (unlike files that fall back to `~/.pi/agent/`, such as `settings.json` and `auth.json`).
10
17
  - **Syntax and schema.** `models.json` allows `//` line comments, trailing commas, and leading UTF-8 BOMs (`/* */` block comments are not supported). Add `"$schema": "https://raw.githubusercontent.com/bastani-inc/atomic/main/packages/coding-agent/schemas/models.schema.json"` for editor completion and validation.
11
18
  - **Reloading and errors.** Open `/model`, open `/scoped-models`, or run `/reload` after saving `models.json` to reload changes without restarting. If `models.json` has a JSON or schema error, Atomic ignores the file, keeps built-in providers working, and shows the error banner in `/model`.
12
19
 
13
- This page gives minimal and full `models.json` examples. For every schema field, see [`models.json` schema reference](/models-configuration). For compatibility rules, value resolution, overrides, pricing tiers, and derived fast variants, see [Model configuration reference](/models/reference).
20
+ This page gives minimal and full `models.json` examples. For every schema field, see [`models.json` field reference](/models-configuration). For compatibility rules, value resolution, overrides, pricing tiers, and derived fast variants, see [Model configuration reference](/models/reference). For SDK catalog persistence and `modelsPath`, see [Model catalog persistence and refresh](/sdk/reference#model-catalog-persistence-and-refresh).
14
21
 
15
22
  ## Minimal example
16
23
 
@@ -34,7 +41,7 @@ For local servers (Ollama, LM Studio, vLLM), only `id` is required per model:
34
41
  ```
35
42
 
36
43
  - **`apiKey` is optional in `models.schema.json`.** You can omit `apiKey` on a custom provider and save a key later via `/login <provider>` in `auth.json`. However, Atomic lists a provider's models as available only when some credential is configured, which is why local servers like Ollama use a placeholder such as `"apiKey": "ollama"`.
37
- - **Non-empty provider entries.** Every provider object in `models.json` must include at least one of `baseUrl`, `headers`, `compat`, `modelOverrides`, `models`, `apiKey`, or `authHeader`; an empty `{}` entry fails validation.
44
+ - **Non-empty provider entries.** Every provider object in `models.json` must include at least one of `baseUrl`, `headers`, `compat`, non-empty `models` or `modelOverrides`, `apiKey`, or `authHeader`. An empty `{}` entry, or an entry with only `"models": []` or `"modelOverrides": {}`, fails validation.
38
45
 
39
46
  ### Proxy a built-in provider
40
47
 
@@ -130,7 +137,7 @@ Any custom provider that defines `models` requires a `baseUrl` (unless overridin
130
137
 
131
138
  ## Catalog refresh and startup defaults
132
139
 
133
- `/model` and `/scoped-models` show the cached authenticated catalog immediately while refreshing network-backed catalogs in the background for up to 15 seconds. Closing either selector cancels the refresh.
140
+ `/model` and `/scoped-models` show the cached authenticated catalog immediately while refreshing network-backed catalogs in the background for up to 15 seconds. Closing either selector cancels the refresh. From the shell, use [`--model`, `--models`, `--list-models`](/reference/cli#model-options), and `atomic update --models` to inspect or refresh catalogs; SDK hosts can configure `ModelRuntime` and `modelsPath` (see [Model catalog persistence and refresh](/sdk/reference#model-catalog-persistence-and-refresh)).
134
141
 
135
142
  - **Direct `/model <model_name>`:** When no model scope (`enabledModels` / `--models`) is active, `/model <model_name>` checks the cache first and waits for refresh only on a miss. When a model scope is active, `/model <model_name>` searches only the scoped models and does not trigger a refresh.
136
143
  - **Failed or slow refreshes:** If a refresh times out or fails, the selector reports that it is using cached models; you do not need to reset `auth.json` or `~/.atomic`. Login and logout changes stay in effect even if an earlier refresh finishes afterward.
@@ -178,7 +185,7 @@ Every custom compactor requires `"api"` at the provider or model level (just lik
178
185
 
179
186
  ## Use classifier models
180
187
 
181
- Classifier models answer typed questions about JSON state instead of chatting and do not appear in `/model`. In [codemode](/tools#codemode), list them with `models.getAvailableOfType("classifier")` and call `models.classify(model, { state, questions })`. See [Codemode](/codemode#classify) for question and answer shapes.
188
+ Classifier models answer typed questions about JSON state instead of chatting and do not appear in `/model`. Configure one for `structured_output` and `decide()` with [`decisionModel`](/settings#decisionmodel) (see [Structured decisions](/sdk/structured-decisions)), or call classifiers from [codemode](/tools#codemode) using `models.getAvailableOfType("classifier")` and `models.classify(model, { state, questions })` (see [Codemode](/codemode#classify)).
182
189
 
183
190
  Built-in classifiers:
184
191
 
@@ -197,9 +204,12 @@ A model chain starts with a pinned model followed by `fallbackModels` in a sessi
197
204
  - A provider that rejects credentials (HTTP 401 or an invalid, expired, revoked, or restricted key/token) is skipped for the rest of that chain. A model-scoped HTTP 403 skips only that model.
198
205
  - A chain with no usable candidate fails immediately and names each skipped model and provider. A single pinned model with no fallbacks is never replaced.
199
206
 
200
- For full fallback rules, see [`fallbackModels`](/settings#fallbackmodels).
207
+ For full fallback, model-scope, and subagent selection rules, see [`fallbackModels`](/settings#fallbackmodels), [`enabledModels`](/settings#enabledmodels), [CLI model options](/reference/cli#model-options), and [Automatic model selection](/subagents/reference#automatic-model-selection).
201
208
 
202
209
  ## Related reference
203
210
 
204
- - [`models.json` schema reference](/models-configuration): every provider, model, override, and compatibility field.
211
+ - [`models.json` field reference](/models-configuration): every provider, model, override, and compatibility field.
205
212
  - [Model configuration reference](/models/reference): supported APIs, value resolution, custom headers, OpenAI built-in models, image limits, sampling parameters, cost tiers, thinking level maps, overrides, fast variants, and API compatibility rules.
213
+ - [Model providers](/providers): subscription sign-ins, API keys, `auth.json`, and credential precedence.
214
+ - [Build custom providers](/custom-provider): register custom streaming, image, classifier, or compactor APIs and OAuth flows in an extension.
215
+ - [Model catalog persistence and refresh](/sdk/reference#model-catalog-persistence-and-refresh): programmatic `ModelRuntime` and `modelsPath` configuration.
@@ -37,7 +37,7 @@ After reviewing the generated skill and scripts, run `/reload`, then invoke `/sk
37
37
  | --- | --- |
38
38
  | `ctx.stage`, `ctx.task`, model and thinking | Codemode `tools.subagent()` launches in the main chat that keep prompts, inputs, and model pins. |
39
39
  | Stage `fallbackModels`, `tools`, `mcp` | Named [custom subagent](/subagents/authoring) launched without per-call `model` ([Pinned stages](#pinned-stages)). |
40
- | `ctx.parallel`, loops, retries | `tasks` batches, explicit round caps, and checks between notices (plus Intercom `group` for peers). |
40
+ | `ctx.parallel`, loops, retries | `tasks` batches, explicit round caps, and checks between notices (plus [Intercom](/intercom) `group` for peers). |
41
41
  | `ctx.tool`, deterministic helpers | Reviewed scripts in `scripts/` with validated args, timeouts, and exit checks. |
42
42
  | Inputs, `ctx.ui`, approvals | Skill arguments and defaults plus `ask_user_question` steps (an unanswered approval is never a pass). |
43
43
  | Nested `ctx.workflow` | Separately converted skill called by name (the main session still owns all subagent launches). |
@@ -83,5 +83,5 @@ Old workflow data is safe to leave alone. To reclaim space, back it up and stop
83
83
  - Safe to delete if unused: `runs/`, `pool/`, and `journal/`.
84
84
 
85
85
  <Warning>
86
- Do not delete `~/.atomic/workflows/journal.sqlite` or its sidecar files (they store your Atomic sessions), the entire `~/.atomic/workflows/` directory, shared databases, or your workflow source files. Custom storage paths may differ.
86
+ Do not delete `~/.atomic/workflows/journal.sqlite` or its sidecar files (they store your Atomic sessions), the entire `~/.atomic/workflows/` directory, shared databases, or your workflow source files. Custom storage paths may differ. See [Workflow data from earlier releases](/storage#workflow-data-from-earlier-releases) for details on what Atomic keeps and ignores.
87
87
  </Warning>
@@ -6,7 +6,7 @@ description: "Seven reusable patterns for splitting work across subagents, isola
6
6
 
7
7
  Give each subagent one concrete deliverable, explicit inputs, clear edit rules, and a verification check. Put conflicting edits in separate worktrees, and run final verification in your main session. A subagent claiming "done" is not proof.
8
8
 
9
- Each snippet below is a short codemode call from the main chat, not a long-lived script. After any restart, reconcile `status` with [saved task IDs](/orchestration#what-survives-interruption) before launching more subagents.
9
+ Each snippet below is a short [codemode](/codemode) call from the main chat, not a long-lived script. After any restart, reconcile `status` with [saved task IDs](/orchestration#what-survives-interruption) persisted via [the codemode store](/codemode#store-values) before launching more subagents. For background and mechanics behind these patterns, see [Orchestrate with codemode and subagents](/orchestration), [Run subagents](/subagents), and [Manage background tasks](/background-tasks).
10
10
 
11
11
  ## Prompt anatomy
12
12
 
@@ -73,7 +73,7 @@ Synthesize only after every required subagent settles, and reconcile contradicti
73
73
 
74
74
  ## Adversarial verification
75
75
 
76
- Give a fresh read-only subagent the acceptance criteria and candidate, without the author's conclusion, and ask for a failing input:
76
+ Give a [fresh](/subagents#fresh-vs-forked-context) read-only subagent the acceptance criteria and candidate, without the author's conclusion, and ask for a failing input:
77
77
 
78
78
  ```js
79
79
  const r = await tools.subagent({
@@ -85,11 +85,11 @@ store("date:review", r.tasks);
85
85
  return r.tasks;
86
86
  ```
87
87
 
88
- Verify reported failures in the main session by checking real exit codes before requesting repairs. With multiple reviewers, collect independent verdicts first, then allow one bounded Intercom debate. A reproducible failing case beats a majority vote. For user interfaces, [exercise the real interface](/computer-use).
88
+ Verify reported failures in the main session by checking real exit codes before requesting repairs. With multiple reviewers, collect independent verdicts first, then allow one bounded [Intercom](/intercom) debate. A reproducible failing case beats a majority vote. For user interfaces, [exercise the real interface](/computer-use).
89
89
 
90
90
  ## Generate-and-filter
91
91
 
92
- Ask subagents for concrete candidates, then filter all of them with one deterministic check in codemode. Pass `context: "fresh"` (or use a read-only agent) so generators do not inherit the main chat's history (`worker` defaults to forked context and edit tools):
92
+ Ask subagents for concrete candidates, then filter all of them with one deterministic check in codemode. Pass `context: "fresh"` (or use a read-only agent) so generators do not inherit the main chat's history (`worker` defaults to [forked context](/subagents#fresh-vs-forked-context) and edit tools):
93
93
 
94
94
  ```js
95
95
  const r = await tools.subagent({
@@ -107,7 +107,7 @@ Parse each result as data, drop malformed or duplicate entries, and keep only va
107
107
 
108
108
  ## Tournament
109
109
 
110
- Compare competing approaches on identical fixtures with pre-agreed scoring and tie-breaking rules, and isolate edits in named worktrees:
110
+ Compare competing approaches on identical fixtures with pre-agreed scoring and tie-breaking rules, and isolate edits in [named worktrees](/subagents#named-worktrees):
111
111
 
112
112
  ```js
113
113
  const r = await tools.subagent({
@@ -124,14 +124,14 @@ return r.tasks;
124
124
 
125
125
  Note two details when running `worker` in named worktrees:
126
126
 
127
- - `worker` defaults to `context: "fork"`, so pass `context: "fresh"` when you want independent attempts without the main chat's prior reasoning.
127
+ - `worker` defaults to `context: "fork"`, so pass `context: "fresh"` when you want independent attempts without the main chat's prior reasoning ([Fresh vs. forked context](/subagents#fresh-vs-forked-context)).
128
128
  - Named worktrees (`worktree: { branch }`) are never deleted automatically and do not symlink `node_modules`. Have each competitor install dependencies if its test command needs them, or remove finished branches and worktrees manually when the tournament ends.
129
129
 
130
130
  Record scores, commit SHAs, and round numbers so restarts never double-advance a candidate. Never pick a winner that fails a required check.
131
131
 
132
132
  ## Loop-until-done
133
133
 
134
- Run the project's verification command in the main session between bounded repair rounds. Pass a foreground `wait` budget suited to your test suite, and handle the string return value in case the command yields to the background:
134
+ Run the project's verification command in the main session between bounded repair rounds. Pass a foreground `wait` budget suited to your test suite, and handle the string return value in case the command yields to a [background shell](/background-tasks#background-shells):
135
135
 
136
136
  ```js
137
137
  const check = await tools.bash({
@@ -174,4 +174,4 @@ store("cli-slice", r.tasks);
174
174
  return r.tasks;
175
175
  ```
176
176
 
177
- Because `worker` defaults to `context: "fork"`, each slice sees the main chat's verified decisions unless you pass `context: "fresh"`. Named worktrees keep their branches and do not symlink `node_modules`. Verify each slice against its base and run full integration checks at the tip. Run independent slices in parallel instead.
177
+ Because `worker` defaults to `context: "fork"`, each slice sees the main chat's verified decisions unless you pass `context: "fresh"` ([Fresh vs. forked context](/subagents#fresh-vs-forked-context)). [Named worktrees](/subagents#named-worktrees) keep their branches and do not symlink `node_modules`. Verify each slice against its base and run full integration checks at the tip. Run independent slices in parallel instead.
@@ -8,6 +8,8 @@ Describe the outcome you want and how to verify it. For example: "Review the ins
8
8
 
9
9
  Your main session decides whether to answer directly, run checks in [codemode](/codemode), or split work across [subagents](/subagents).
10
10
 
11
+ Delegating in plain language without codemode scripts? See [Plan multi-step work](/guides/orchestration). For seven concrete recipes, see [Orchestration patterns](/orchestration/patterns). For exact subagent parameters and `config.json`, see [Subagent reference](/subagents/reference).
12
+
11
13
  ## Launch now, use the result later
12
14
 
13
15
  The snippet below is JavaScript that your main session runs inside `codemode`, not a file you install. Run `/tools` if your session uses a custom tool list to confirm `codemode` and `subagent` are active.
@@ -23,7 +25,7 @@ store("guide-review", launch.tasks);
23
25
  return launch.tasks;
24
26
  ```
25
27
 
26
- - **Launch, not completion.** `await` resolves as soon as subagents start or enter the queue. Started or queued slots return `{ taskId, childId, agent, state: "admitted" | "queued", intercomTarget? }` (`intercomTarget` is included when Intercom is enabled for the subagent). Refused slots return `{ agent, state: "refused", reason }` with no running subagent. Your main session can continue working or end its turn while completion notices return results automatically, and `/tasks` lets you inspect subagents directly.
28
+ - **Launch, not completion.** `await` resolves as soon as subagents start or enter the queue. Started or queued slots return `{ taskId, childId, agent, state: "admitted" | "queued", intercomTarget? }` (`intercomTarget` is included when Intercom is enabled for the subagent). Refused slots return `{ agent, state: "refused", reason }` with no running subagent. Your main session can continue working or end its turn while completion notices return results automatically, and `/tasks` lets you inspect subagents directly ([Manage background tasks](/background-tasks)).
27
29
  - **Explicit parallel batches.** Separate `tools.subagent()` calls inside codemode are not merged into one burst. Pass `tasks: [...]` when you want a parallel batch.
28
30
  - **Explicit wait.** When a later step needs a result immediately, wait briefly without launching a second subagent. The `// @options` comment sets per-script [codemode options](/codemode) such as `timeout_ms` (codemode scripts have a 256 MiB memory limit and no default timeout):
29
31
 
@@ -37,13 +39,13 @@ return await tools.subagent({ action: "wait", id: task.taskId, budgetMs: 2000 })
37
39
  Inside codemode, `tools.subagent({ action: "wait" })` defaults to a 30-second budget even when a host configures unlimited foreground waits.
38
40
  - **Cancellation and evidence.** Hitting `budgetMs`, returning early, or interrupting the script never stops an already-launched subagent (unawaited tool calls are cancelled when the script returns, while already-launched background subagents keep running). Use `tools.subagent({ action: "quit", id: childId })` to stop one. Treat actual subagent results and status, not launch receipts, as evidence, and account for every required subagent in joint reviews.
39
41
  - **One-level delegation.** Only the main session launches subagents. If a subagent uncovers follow-up work, it reports back so the main session can launch the next batch.
40
- - **Peer messaging.** Pass `group: true` to create a unique shared Intercom group for that batch, or pass a shared named `group`. Peer isolation keeps unrelated sessions out while `contact_supervisor` still reaches the main session across groups. Address subagents with the exact `intercomTarget` from the launch result ([Intercom from codemode](/intercom/reference#from-codemode-scripts)). A delivery acknowledgement is not a task result.
42
+ - **Peer messaging.** Pass `group: true` to create a unique shared [Intercom](/intercom) group for that batch, or pass a shared named `group`. Peer isolation keeps unrelated sessions out while `contact_supervisor` still reaches the main session across groups. Address subagents with the exact `intercomTarget` from the launch result ([Intercom from codemode](/intercom/reference#from-codemode-scripts)). A delivery acknowledgement is not a task result.
41
43
 
42
44
  ## What survives interruption
43
45
 
44
46
  Subagents are persisted sessions; codemode scripts are not checkpointed programs.
45
47
 
46
- - Reopening the original main session automatically restores running subagents. Paused or quit subagents resume from `/tasks` or `tools.subagent({ action: "resume", id: childId })`.
48
+ - Reopening the original main session automatically restores running subagents. Paused or quit subagents resume from [`/tasks`](/background-tasks) or `tools.subagent({ action: "resume", id: childId })`.
47
49
  - Your main session resumes in chat from completion notices, saved results, and decisions instead of re-entering an old JavaScript loop.
48
50
  - Save small handoff state, such as task IDs, round count, and next checks, with [the codemode store](/codemode#store-values), which persists per branch only when a script succeeds. If a script throws or times out, all `store()` writes from that script are discarded, even though any `tools.subagent()` launches already started. Inspect `/tasks`, chat, and changed files before retrying.
49
51
  - On recovery, call `await tools.subagent({ action: "status" })` and reconcile `children` against stored `childId` values. Collect finished results, resume paused work that is still needed, and relaunch missing subagents only after checking what they left behind.
@@ -6,6 +6,8 @@ description: "Declare Atomic package manifests for extensions, skills, subagents
6
6
 
7
7
  <div id="creating-an-atomic-package" />
8
8
 
9
+ To install and update packages, see [Install and manage packages](/packages) and [Package CLI commands](/reference/cli#package-commands). For filtering and precedence rules, see [Package reference](/packages/reference) and [Settings](/settings). For project trust requirements, see [Security](/security).
10
+
9
11
  Declare package resources under the `atomic` key in `package.json` (legacy `pi` is also supported), and include `"atomic-package"` in `keywords`:
10
12
 
11
13
  ```json
@@ -110,7 +112,7 @@ Expose [storage adapters](/storage#selecting-an-adapter) via `storageAdapters` (
110
112
 
111
113
  - Select an adapter by package name (`"storage": { "adapter": "@example/atomic-libsql" }`), which selects the first entry in `storageAdapters` when a package lists multiple adapters.
112
114
  - Select a specific adapter from a multi-adapter package with `<package>/<file-stem>`, where `<file-stem>` is the filename without its extension (for example `"@example/atomic-libsql/libsql-adapter"`).
113
- - Storage adapters load only from user-settings packages or explicit extension paths (`--extension <dir>` or `additionalExtensionPaths`, which take precedence over settings). Project-installed packages cannot supply storage adapters, and global npm adapter lookup checks `~/.atomic/agent/npm/` only (not the system global npm root). See [Adapters from Atomic packages](/storage#adapters-from-atomic-packages).
115
+ - Storage adapters load only from user-settings packages or explicit extension paths (`--extension <dir>` in [CLI resource options](/reference/cli#resource-options) or [`DefaultResourceLoader({ additionalExtensionPaths })`](/sdk/reference#extensions), which take precedence over settings). Project-installed packages cannot supply storage adapters, and global npm adapter lookup checks `~/.atomic/agent/npm/` only (not the system global npm root). See [Adapters from Atomic packages](/storage#adapters-from-atomic-packages).
114
116
 
115
117
  ## Gallery metadata
116
118
 
@@ -4,9 +4,11 @@ sidebarTitle: "Packages"
4
4
  description: "Reference for package resource filtering patterns, glob vs exact matching, autoload overrides, precedence, and deduplication."
5
5
  ---
6
6
 
7
+ This page is the reference for package filtering, `autoload: false`, precedence, and deduplication. To install and manage packages, see [Install and manage packages](/packages) and [Package CLI commands](/reference/cli#package-commands). To publish a package, see [Create and publish packages](/packages/authoring). For project trust rules, see [Security](/security). To load local packages programmatically in the SDK, use [`DefaultResourceLoader({ additionalExtensionPaths })`](/sdk/reference#extensions).
8
+
7
9
  ## Package filtering
8
10
 
9
- Use the object form in `settings.json` to filter which resources load from a package:
11
+ Use the object form in [`settings.json`](/settings) to filter which resources load from a package:
10
12
 
11
13
  ```json
12
14
  {
package/docs/packages.md CHANGED
@@ -13,7 +13,7 @@ Atomic packages bundle extensions, skills, [subagents](/packages/authoring#subag
13
13
 
14
14
  ## Install and manage
15
15
 
16
- > **Security:** Atomic packages run with full system access. Extensions execute arbitrary code and skills instruct the agent. Review source code before installing third-party packages.
16
+ > **Security:** Atomic packages run with full system access. Extensions execute arbitrary code and skills instruct the agent. Review source code before installing third-party packages. See [Security](/security) for project trust rules and [Package CLI commands](/reference/cli#package-commands) for the full command list.
17
17
 
18
18
  ```bash
19
19
  atomic install npm:@foo/bar@1.0.0
@@ -37,8 +37,8 @@ atomic update npm:@foo/bar # Update one package (or --ex
37
37
 
38
38
  Install, trust, and update behavior:
39
39
 
40
- - **Global and project scope.** `install` and `remove` edit `~/.atomic/agent/settings.json` by default. Pass `-l` or `--local` to write to `.atomic/settings.json` (legacy `.pi/settings.json` is also read). Missing project packages install automatically on startup once you trust the project.
41
- - **Project trust gate.** In an untrusted project, `atomic install -l` and `atomic remove -l` exit with code 1 (`Project is not trusted. Use --approve to modify local package config.`) unless you trust the project first or pass `-a` / `--approve`. Both `-a` / `--approve` and `-na` / `--no-approve` are accepted on `install`, `remove`, `update`, `list`, and `config`.
40
+ - **Global and project scope.** `install` and `remove` edit `~/.atomic/agent/settings.json` by default ([Settings](/settings)). Pass `-l` or `--local` to write to `.atomic/settings.json` (legacy `.pi/settings.json` is also read). Missing project packages install automatically on startup once you trust the project.
41
+ - **Project trust gate.** In an untrusted project, `atomic install -l` and `atomic remove -l` exit with code 1 (`Project is not trusted. Use --approve to modify local package config.`) unless you trust the project first ([Security](/security)) or pass `-a` / `--approve`. Both `-a` / `--approve` and `-na` / `--no-approve` are accepted on `install`, `remove`, `update`, `list`, and `config`.
42
42
  - **Update output.** Atomic lists each updated npm version or git commit (for example `npm:@foo/bar 1.2.0 -> 1.3.0`), prints `Packages are already up to date` when nothing changed, prints warnings when no package upgraded, and reports skipped updates in offline mode.
43
43
  - **Offline mode.** Pass `--offline` or set `ATOMIC_OFFLINE=1` to skip automatic startup installs and package updates.
44
44
  - **Self-update safety.** Atomic installs the exact advertised version (showing any release note first) and only modifies installations managed and writable by the detected global package manager. On Windows, automatic self-update supports `npm` and `pnpm` installs only unless you override the command. Override auto-detection with `selfUpdateCommand` in global `settings.json` or the `ATOMIC_SELF_UPDATE_COMMAND` environment variable; otherwise Atomic prints the manual update command. To uninstall Atomic itself, see [Uninstall](/getting-started/installation#uninstall).
@@ -120,3 +120,5 @@ Run `atomic config` to toggle extensions, skills, prompt templates, and themes i
120
120
 
121
121
  - [Create and publish packages](/packages/authoring#creating-an-atomic-package). Review manifest fields, [subagents](/packages/authoring#subagents), [MCP servers](/packages/authoring#mcp-servers), [storage adapters](/packages/authoring#storage-adapters), [gallery metadata](/packages/authoring#gallery-metadata), [convention directories](/packages/authoring#convention-directories), and [dependencies](/packages/authoring#dependencies).
122
122
  - [Package reference](/packages/reference). Review [package filtering](/packages/reference#package-filtering) and [scope and deduplication](/packages/reference#scope-and-deduplication).
123
+ - [SDK extensions](/sdk/reference#extensions). Load local packages and extensions programmatically with `DefaultResourceLoader({ additionalExtensionPaths })`.
124
+ - [Package CLI commands](/reference/cli#package-commands), [Settings](/settings), and [Security](/security). Review CLI subcommands, `settings.json` keys, and project trust gates.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: "Programmatic integration"
3
- sidebarTitle: "Overview"
4
- description: "Choose between JSON event stream mode, RPC mode, the TypeScript SDK, and TUI component APIs, then follow a minimal integration."
3
+ sidebarTitle: "Programmatic modes"
4
+ description: "Choose between JSON event stream mode, RPC mode, the TypeScript SDK, storage adapters, and TUI component APIs, then follow a minimal integration."
5
5
  ---
6
6
 
7
7
  Atomic provides three programmatic integration modes plus a component API for interactive extension interfaces. Choose the smallest mode that fits your integration, run its minimal example, and continue to its reference.
@@ -16,18 +16,24 @@ Atomic provides three programmatic integration modes plus a component API for in
16
16
 
17
17
  - **JSON event stream** executes one or more positional prompts in sequence, writes newline-delimited session events to stdout, and exits.
18
18
  - **RPC mode** keeps an Atomic subprocess running over stdin/stdout JSON Lines so you can send follow-up prompts, steer or abort turns, switch models, and answer extension dialogs and OAuth prompts.
19
- - **TypeScript SDK** runs the same agent runtime as a library inside your Node.js application, with direct control over extensions, skills, tools, models, workspaces, and session storage.
19
+ - **TypeScript SDK** runs the same agent runtime as a library inside your Node.js application, with direct control over extensions, skills, tools, models, workspaces, and [session storage backends](/sdk/storage).
20
20
 
21
- ## Protocol and API references
21
+ ## SDK guides and APIs
22
+
23
+ - [SDK overview](/sdk): create sessions, bind workspaces, configure Intercom policies, and handle lifecycle events.
24
+ - [SDK storage backends](/sdk/storage): configure SQLite, JSONL, in-memory, libSQL/Turso, and PostgreSQL for `createAgentSession()`, `createAgentSessionRuntime()`, and `SessionManager`.
25
+ - [Structured decisions API](/sdk/structured-decisions): run typed classifier or chat decisions with `decide()` and `generateStructuredOutput()`.
26
+ - [Embed Atomic in a web server](/sdk/web-server): build a streaming HTTP API with Next.js App Router and `createAgentSession()`.
27
+ - [SDK API reference](/sdk/reference): complete session options, loaders, tool status, task supervision, run modes, and exports.
28
+ - [Remote compaction models](/models#remote-compaction-models) and [Environment blueprints](/guides/resume-on-any-machine#set-the-environment-up-with-a-blueprint): plug in custom remote compactors and repeatable worktree setup for cross-machine resume.
29
+
30
+ ## RPC protocol and client guides
22
31
 
23
32
  - [RPC protocol reference](/rpc/protocol): every RPC command, streamed event, error shape, and JSON type.
24
33
  - [RPC extension UI protocol](/rpc/extension-ui): handle extension dialogs, widgets, questionnaires, and OAuth flows over RPC.
25
34
  - [RPC client examples](/rpc/examples): connect with the typed `RpcClient` or a standalone Node.js script.
26
- - [SDK API reference](/sdk/reference): complete session options, loaders, tool status, task supervision, run modes, and exports.
27
- - [Structured decisions API](/sdk/structured-decisions): run typed classifier or chat decisions with `decide()` and `generateStructuredOutput()`.
28
- - [Embed Atomic in a web server](/sdk/web-server): build a streaming HTTP API with Next.js App Router and `createAgentSession()`.
29
35
 
30
36
  ## Terminal UI and standalone libraries
31
37
 
32
38
  - [Build TUI components](/tui) walks through custom interactive components and common patterns, and [TUI API reference](/tui/reference) documents the component, focus, input, and rendering contracts.
33
- - [Standalone libraries](/libraries) covers the six `@bastani/atomic-*` packages (`ai`, `agent-core`, `tui`, `codemode`, `schema`, and `telemetry`) that you can install independently of the CLI.
39
+ - [Standalone libraries](/libraries) covers the six core `@bastani/atomic-*` packages (`ai`, `agent-core`, `tui`, `codemode`, `schema`, and `telemetry`) plus the optional storage adapter packages ([`@bastani/atomic-storage-postgres`](/libraries/storage-postgres) and [`@bastani/atomic-storage-libsql`](/libraries/storage-libsql)).
@@ -15,10 +15,10 @@ Use prompt templates when you repeat the same instructions and want a slash comm
15
15
  Atomic loads prompt templates from these sources:
16
16
 
17
17
  - **Global:** `~/.atomic/agent/prompts/*.md` (legacy `~/.pi/agent/prompts/*.md`)
18
- - **Project** (only after you trust the project): `.atomic/prompts/*.md` (legacy `.pi/prompts/*.md`)
18
+ - **Project** (only after you grant [project trust](/security#project-trust)): `.atomic/prompts/*.md` (legacy `.pi/prompts/*.md`)
19
19
  - **Packages:** `prompts/` directories, `atomic.prompts`, or legacy `pi.prompts` entries in `package.json`
20
- - **Settings:** `prompts` array in global or project `settings.json`, which accepts files, directories, and filter patterns (`!glob`, `+path`, `-path` with `~` expansion; see [Package filtering](/packages/reference#package-filtering))
21
- - **CLI:** `--prompt-template <path>` (repeatable; accepts either a `.md` file or a directory, and still loads with `--no-prompt-templates`)
20
+ - **Settings:** `prompts` array in global or project `settings.json` ([Resource settings](/settings#resources)), which accepts files, directories, and filter patterns (`!glob`, `+path`, `-path` with `~` expansion; see [Package filtering](/packages/reference#package-filtering))
21
+ - **CLI:** `--prompt-template <path>` (repeatable; accepts either a `.md` file or a directory, and still loads with `--no-prompt-templates`; see [CLI resource options](/reference/cli#resource-options))
22
22
 
23
23
  Disable default discovery with `--no-prompt-templates` (short flag `-np`). Explicit `--prompt-template` paths and `-e` package prompts still load.
24
24
 
@@ -87,6 +87,8 @@ Type `/` followed by the template name in the editor. Autocomplete shows availab
87
87
 
88
88
  The template name ends at the first space, tab, or line break, so arguments can also start on a new line with Shift+Enter. Line breaks inside the arguments are preserved. The same rule applies to extension commands and `/skill:name` commands.
89
89
 
90
+ Run `/reload` after adding or editing `.md` template files to pick up changes without restarting Atomic. While viewing a subagent, invoking a prompt template expands and sends the prompt to that viewed subagent rather than `main` ([Commands while viewing a subagent](/background-tasks#commands-while-viewing-a-subagent)).
91
+
90
92
  ## Arguments and placeholders
91
93
 
92
94
  Templates support bash-style positional arguments, defaults, and slicing. Substitution is single-pass (not recursive), so argument values containing `$1` or `$@` remain literal text.
@@ -4,16 +4,16 @@ sidebarTitle: "Providers"
4
4
  description: "Credential resolution order, provider stop reasons, and GitHub Copilot error classes and helpers."
5
5
  ---
6
6
 
7
- This reference covers credential precedence, terminal stop reasons, and GitHub Copilot's typed error classes. For setup steps, subscriptions, and API keys, see [Model providers](/providers).
7
+ This reference covers credential precedence, terminal stop reasons, and GitHub Copilot's typed error classes. For setup steps, subscriptions, and API keys, see [Authentication](/getting-started/authentication) and [Model providers](/providers).
8
8
 
9
9
  ## Credential resolution order {#resolution-order}
10
10
 
11
11
  Atomic resolves provider credentials from highest to lowest priority:
12
12
 
13
- 1. **CLI `--api-key` flag** (or SDK runtime API key override).
13
+ 1. **CLI [`--api-key`](/reference/cli#model-options) flag** (or [SDK runtime API key override](/sdk/reference#api-keys-and-oauth)).
14
14
  2. **Stored credential in `~/.atomic/agent/auth.json`** (API key or OAuth token; falls back to legacy `~/.pi/agent/auth.json`).
15
- 3. **Provider configuration `apiKey`** from an extension's `registerProvider()` call, then from `~/.atomic/agent/models.json`.
16
- 4. **Built-in environment variable or ambient credentials** (such as `ANTHROPIC_API_KEY`, AWS profiles/IAM/IRSA, Google Application Default Credentials, or Anthropic Workload Identity Federation).
15
+ 3. **Provider configuration `apiKey`** from an extension's [`registerProvider()`](/custom-provider) call, then from [`~/.atomic/agent/models.json`](/models).
16
+ 4. **Built-in [environment variable](/environment-variables#provider-credentials) or ambient credentials** (such as `ANTHROPIC_API_KEY`, AWS profiles/IAM/IRSA, Google Application Default Credentials, or Anthropic Workload Identity Federation).
17
17
 
18
18
  Watch out for two precedence rules:
19
19
 
@@ -22,7 +22,7 @@ Watch out for two precedence rules:
22
22
 
23
23
  ### SDK login options
24
24
 
25
- Applications calling `@bastani/atomic-ai` directly can pass `{ agentName: "my-app" }` as the fourth argument to `models.login()` to set the OpenAI ChatGPT sign-in name hint or Codex login originator. ChatGPT sign-in defaults to `Atomic`.
25
+ Applications calling [`@bastani/atomic-ai`](/libraries/ai) directly can pass `{ agentName: "my-app" }` as the fourth argument to `models.login()` to set the OpenAI ChatGPT sign-in name hint or Codex login originator. ChatGPT sign-in defaults to `Atomic`. For host session authentication helpers, see [SDK API keys and OAuth](/sdk/reference#api-keys-and-oauth).
26
26
 
27
27
  ## Stop reasons
28
28
 
@@ -34,7 +34,7 @@ A streaming partial message carries `pending` until a terminal reason replaces i
34
34
 
35
35
  ## GitHub Copilot errors
36
36
 
37
- Atomic classifies failed GitHub Copilot requests into typed error classes so retries and [model fallback](/settings#retry) react to the failure cause rather than message text. Each message states what failed, the model, the error code, the next step, and Copilot's response excerpt.
37
+ Atomic classifies failed GitHub Copilot requests into typed error classes so [retries](/settings#retry) and [model fallback](/settings#fallbackmodels) react to the failure cause rather than message text. Each message states what failed, the model, the error code, the next step, and Copilot's response excerpt.
38
38
 
39
39
  Every `GitHubCopilotError` carries `code`, `retryable`, `hint`, `modelId`, `api`, `status`, `providerCode` (Copilot's error code), `requestId` (Copilot's `x-request-id`), `detail` (a response excerpt truncated to 300 characters, which may quote parts of the request), and `cause`.
40
40
 
@@ -56,7 +56,7 @@ All 11 classes extend `GitHubCopilotError`. The same retry and fallback rules ap
56
56
 
57
57
  ### GitHub Copilot error helpers
58
58
 
59
- SDK callers can inspect, classify, and serialize Copilot errors using functions exported from `@bastani/atomic` and `@bastani/atomic-ai`:
59
+ SDK callers can inspect, classify, and serialize Copilot errors using functions exported from [`@bastani/atomic`](/sdk) and [`@bastani/atomic-ai`](/libraries/ai):
60
60
 
61
61
  - **Extract or classify errors:**
62
62
  - `getGitHubCopilotError(message)`: reads the typed error from a failed assistant message's `diagnostics`.