@bastani/atomic 0.8.26-alpha.6 → 0.8.26-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/README.md +5 -5
- package/dist/builtin/intercom/CHANGELOG.md +12 -0
- package/dist/builtin/intercom/package.json +2 -2
- package/dist/builtin/mcp/CHANGELOG.md +12 -0
- package/dist/builtin/mcp/package.json +3 -3
- package/dist/builtin/subagents/CHANGELOG.md +12 -0
- package/dist/builtin/subagents/agents/codebase-online-researcher.md +9 -9
- package/dist/builtin/subagents/agents/debugger.md +6 -6
- package/dist/builtin/subagents/package.json +4 -4
- package/dist/builtin/subagents/prompts/parallel-handoff-plan.md +1 -1
- package/dist/builtin/subagents/skills/browser/EXAMPLES.md +151 -0
- package/dist/builtin/subagents/skills/browser/LICENSE.txt +21 -0
- package/dist/builtin/subagents/skills/browser/REFERENCE.md +451 -0
- package/dist/builtin/subagents/skills/browser/SKILL.md +170 -0
- package/dist/builtin/subagents/skills/subagent/SKILL.md +4 -4
- package/dist/builtin/web-access/CHANGELOG.md +12 -0
- package/dist/builtin/web-access/package.json +2 -2
- package/dist/builtin/workflows/CHANGELOG.md +17 -0
- package/dist/builtin/workflows/builtin/deep-research-codebase.ts +4 -1
- package/dist/builtin/workflows/builtin/goal.ts +127 -99
- package/dist/builtin/workflows/builtin/open-claude-design.ts +224 -147
- package/dist/builtin/workflows/builtin/ralph.ts +160 -197
- package/dist/builtin/workflows/package.json +2 -2
- package/dist/builtin/workflows/skills/research-codebase/SKILL.md +1 -1
- package/dist/builtin/workflows/src/extension/wiring.ts +13 -1
- package/dist/builtin/workflows/src/runs/foreground/executor.ts +12 -6
- package/dist/builtin/workflows/src/runs/foreground/stage-runner.ts +2 -2
- package/dist/builtin/workflows/src/shared/authoring-contract.d.ts +2 -2
- package/dist/builtin/workflows/src/shared/types.ts +3 -3
- package/dist/builtin/workflows/src/tui/stage-chat-view.ts +2 -1
- package/dist/core/agent-session.d.ts +33 -6
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +155 -182
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/atomic-guide-command.d.ts.map +1 -1
- package/dist/core/atomic-guide-command.js +1 -1
- package/dist/core/atomic-guide-command.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts +1 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +6 -3
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +23 -10
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/context-compaction.d.ts +61 -0
- package/dist/core/compaction/context-compaction.d.ts.map +1 -0
- package/dist/core/compaction/context-compaction.js +602 -0
- package/dist/core/compaction/context-compaction.js.map +1 -0
- package/dist/core/compaction/index.d.ts +1 -0
- package/dist/core/compaction/index.d.ts.map +1 -1
- package/dist/core/compaction/index.js +1 -0
- package/dist/core/compaction/index.js.map +1 -1
- package/dist/core/extensions/types.d.ts +3 -2
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/session-manager.d.ts +41 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +146 -7
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +1 -1
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/modes/index.d.ts +1 -1
- package/dist/modes/index.d.ts.map +1 -1
- package/dist/modes/index.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.js +17 -0
- package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
- package/dist/modes/interactive/components/context-compaction-summary-message.d.ts +17 -0
- package/dist/modes/interactive/components/context-compaction-summary-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/context-compaction-summary-message.js +83 -0
- package/dist/modes/interactive/components/context-compaction-summary-message.js.map +1 -0
- package/dist/modes/interactive/components/index.d.ts +1 -0
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js +1 -0
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +72 -8
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +13 -8
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +8 -1
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +4 -0
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +14 -3
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/docs/compaction.md +89 -37
- package/docs/custom-provider.md +11 -9
- package/docs/extensions.md +44 -40
- package/docs/index.md +2 -9
- package/docs/json.md +15 -12
- package/docs/packages.md +2 -0
- package/docs/providers.md +4 -1
- package/docs/quickstart.md +5 -12
- package/docs/rpc.md +38 -23
- package/docs/sdk.md +3 -10
- package/docs/session-format.md +26 -13
- package/docs/sessions.md +3 -3
- package/docs/settings.md +2 -2
- package/docs/skills.md +1 -15
- package/docs/termux.md +9 -10
- package/docs/themes.md +2 -2
- package/docs/tmux.md +3 -3
- package/docs/tui.md +19 -32
- package/docs/usage.md +2 -2
- package/docs/workflows.md +44 -2
- package/package.json +4 -12
- package/dist/builtin/subagents/skills/browser-use/SKILL.md +0 -234
- package/dist/builtin/subagents/skills/browser-use/references/cdp-python.md +0 -76
- package/dist/builtin/subagents/skills/browser-use/references/multi-session.md +0 -92
- package/node_modules/@earendil-works/pi-tui/README.md +0 -779
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts +0 -54
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js +0 -632
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/box.d.ts +0 -22
- package/node_modules/@earendil-works/pi-tui/dist/components/box.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/box.js +0 -104
- package/node_modules/@earendil-works/pi-tui/dist/components/box.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.d.ts +0 -22
- package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.js +0 -35
- package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts +0 -249
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.js +0 -1857
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/image.d.ts +0 -28
- package/node_modules/@earendil-works/pi-tui/dist/components/image.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/image.js +0 -89
- package/node_modules/@earendil-works/pi-tui/dist/components/image.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts +0 -37
- package/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/input.js +0 -378
- package/node_modules/@earendil-works/pi-tui/dist/components/input.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/loader.d.ts +0 -31
- package/node_modules/@earendil-works/pi-tui/dist/components/loader.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/loader.js +0 -69
- package/node_modules/@earendil-works/pi-tui/dist/components/loader.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts +0 -96
- package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js +0 -644
- package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/select-list.d.ts +0 -50
- package/node_modules/@earendil-works/pi-tui/dist/components/select-list.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/select-list.js +0 -159
- package/node_modules/@earendil-works/pi-tui/dist/components/select-list.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts +0 -50
- package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js +0 -185
- package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/spacer.d.ts +0 -12
- package/node_modules/@earendil-works/pi-tui/dist/components/spacer.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/spacer.js +0 -23
- package/node_modules/@earendil-works/pi-tui/dist/components/spacer.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/text.d.ts +0 -19
- package/node_modules/@earendil-works/pi-tui/dist/components/text.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/text.js +0 -89
- package/node_modules/@earendil-works/pi-tui/dist/components/text.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.d.ts +0 -13
- package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.js +0 -51
- package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/editor-component.d.ts +0 -39
- package/node_modules/@earendil-works/pi-tui/dist/editor-component.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/editor-component.js +0 -2
- package/node_modules/@earendil-works/pi-tui/dist/editor-component.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/fuzzy.d.ts +0 -16
- package/node_modules/@earendil-works/pi-tui/dist/fuzzy.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/fuzzy.js +0 -110
- package/node_modules/@earendil-works/pi-tui/dist/fuzzy.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.d.ts +0 -23
- package/node_modules/@earendil-works/pi-tui/dist/index.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.js +0 -32
- package/node_modules/@earendil-works/pi-tui/dist/index.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts +0 -193
- package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/keybindings.js +0 -174
- package/node_modules/@earendil-works/pi-tui/dist/keybindings.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/keys.d.ts +0 -184
- package/node_modules/@earendil-works/pi-tui/dist/keys.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/keys.js +0 -1173
- package/node_modules/@earendil-works/pi-tui/dist/keys.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/kill-ring.d.ts +0 -28
- package/node_modules/@earendil-works/pi-tui/dist/kill-ring.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/kill-ring.js +0 -44
- package/node_modules/@earendil-works/pi-tui/dist/kill-ring.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.d.ts +0 -3
- package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.js +0 -53
- package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.d.ts +0 -50
- package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.js +0 -361
- package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts +0 -90
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +0 -366
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts +0 -113
- package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal.js +0 -472
- package/node_modules/@earendil-works/pi-tui/dist/terminal.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts +0 -227
- package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui.js +0 -1106
- package/node_modules/@earendil-works/pi-tui/dist/tui.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/undo-stack.d.ts +0 -17
- package/node_modules/@earendil-works/pi-tui/dist/undo-stack.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/undo-stack.js +0 -25
- package/node_modules/@earendil-works/pi-tui/dist/undo-stack.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts +0 -84
- package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/utils.js +0 -1029
- package/node_modules/@earendil-works/pi-tui/dist/utils.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/word-navigation.d.ts +0 -25
- package/node_modules/@earendil-works/pi-tui/dist/word-navigation.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/word-navigation.js +0 -96
- package/node_modules/@earendil-works/pi-tui/dist/word-navigation.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/native/darwin/prebuilds/darwin-arm64/darwin-modifiers.node +0 -0
- package/node_modules/@earendil-works/pi-tui/native/darwin/prebuilds/darwin-x64/darwin-modifiers.node +0 -0
- package/node_modules/@earendil-works/pi-tui/native/win32/prebuilds/win32-arm64/win32-console-mode.node +0 -0
- package/node_modules/@earendil-works/pi-tui/native/win32/prebuilds/win32-x64/win32-console-mode.node +0 -0
- package/node_modules/@earendil-works/pi-tui/package.json +0 -47
- package/node_modules/get-east-asian-width/index.d.ts +0 -60
- package/node_modules/get-east-asian-width/index.js +0 -30
- package/node_modules/get-east-asian-width/license +0 -9
- package/node_modules/get-east-asian-width/lookup-data.js +0 -21
- package/node_modules/get-east-asian-width/lookup.js +0 -138
- package/node_modules/get-east-asian-width/package.json +0 -71
- package/node_modules/get-east-asian-width/readme.md +0 -65
- package/node_modules/get-east-asian-width/utilities.js +0 -24
- package/node_modules/marked/LICENSE.md +0 -44
- package/node_modules/marked/README.md +0 -106
- package/node_modules/marked/bin/main.js +0 -282
- package/node_modules/marked/bin/marked.js +0 -15
- package/node_modules/marked/lib/marked.cjs +0 -2211
- package/node_modules/marked/lib/marked.cjs.map +0 -7
- package/node_modules/marked/lib/marked.d.cts +0 -728
- package/node_modules/marked/lib/marked.d.ts +0 -728
- package/node_modules/marked/lib/marked.esm.js +0 -2189
- package/node_modules/marked/lib/marked.esm.js.map +0 -7
- package/node_modules/marked/lib/marked.umd.js +0 -2213
- package/node_modules/marked/lib/marked.umd.js.map +0 -7
- package/node_modules/marked/man/marked.1 +0 -111
- package/node_modules/marked/man/marked.1.md +0 -92
- package/node_modules/marked/marked.min.js +0 -69
- package/node_modules/marked/package.json +0 -111
package/docs/compaction.md
CHANGED
|
@@ -1,28 +1,32 @@
|
|
|
1
1
|
# Compaction & Branch Summarization
|
|
2
2
|
|
|
3
|
-
LLMs have limited context windows. When conversations grow too long, Atomic uses
|
|
3
|
+
LLMs have limited context windows. When conversations grow too long, Atomic uses a deletion-only form of Context Compaction called **Verbatim Compaction**: it deletes safe older transcript objects while preserving every retained object byte-for-byte. This page covers auto-compaction, manual compaction, and branch summarization.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
- [`packages/coding-agent/src/core/compaction/
|
|
9
|
-
- [`packages/coding-agent/src/core/
|
|
10
|
-
- [`packages/coding-agent/src/core/
|
|
5
|
+
Atomic's default compaction design and terminology are informed by Morph's Context Compaction work: <https://www.morphllm.com/context-compaction>. In particular, Atomic follows the same core idea that coding agents benefit from deleting low-signal context instead of rewriting high-signal details like file paths, line numbers, and error strings into a lossy summary.
|
|
6
|
+
|
|
7
|
+
**Source files** ([atomic](https://github.com/bastani-inc/atomic)):
|
|
8
|
+
- [`packages/coding-agent/src/core/compaction/compaction.ts`](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/src/core/compaction/compaction.ts) - Summary compaction logic
|
|
9
|
+
- [`packages/coding-agent/src/core/compaction/context-compaction.ts`](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/src/core/compaction/context-compaction.ts) - Verbatim context compaction
|
|
10
|
+
- [`packages/coding-agent/src/core/compaction/branch-summarization.ts`](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/src/core/compaction/branch-summarization.ts) - Branch summarization
|
|
11
|
+
- [`packages/coding-agent/src/core/compaction/utils.ts`](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/src/core/compaction/utils.ts) - Shared utilities (file tracking, serialization)
|
|
12
|
+
- [`packages/coding-agent/src/core/session-manager.ts`](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/src/core/session-manager.ts) - Entry types (`ContextCompactionEntry`, `CompactionEntry`, `BranchSummaryEntry`)
|
|
13
|
+
- [`packages/coding-agent/src/core/extensions/types.ts`](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/src/core/extensions/types.ts) - Extension event types
|
|
11
14
|
|
|
12
15
|
For TypeScript definitions in your project, inspect `node_modules/@bastani/atomic/dist/`.
|
|
13
16
|
|
|
14
17
|
## Overview
|
|
15
18
|
|
|
16
|
-
Atomic has
|
|
19
|
+
Atomic has three compaction/summarization mechanisms:
|
|
17
20
|
|
|
18
21
|
| Mechanism | Trigger | Purpose |
|
|
19
22
|
|-----------|---------|---------|
|
|
20
|
-
| Compaction | Context exceeds threshold, or `/compact` |
|
|
23
|
+
| Default context compaction (Verbatim Compaction) | Context exceeds threshold, context overflow, or `/compact` | Delete safe old transcript objects while retaining surviving content verbatim |
|
|
24
|
+
| Summary compaction internals | Core APIs and legacy extension hooks | Summarize old messages into replacement context |
|
|
21
25
|
| Branch summarization | `/tree` navigation | Preserve context when switching branches |
|
|
22
26
|
|
|
23
|
-
|
|
27
|
+
`/compact` has no user-facing arguments. It uses a fixed internal prompt, validates model-proposed deletion targets locally, and stores logical deletions in a `context_compaction` entry. Auto-compaction uses the same deletion-only path.
|
|
24
28
|
|
|
25
|
-
## Compaction
|
|
29
|
+
## Default Context Compaction (Verbatim Compaction)
|
|
26
30
|
|
|
27
31
|
### When It Triggers
|
|
28
32
|
|
|
@@ -34,18 +38,66 @@ contextTokens > contextWindow - reserveTokens
|
|
|
34
38
|
|
|
35
39
|
By default, `reserveTokens` is 16384 tokens. Configure it in `~/.atomic/agent/settings.json` or `<project-dir>/.atomic/settings.json`; legacy `.pi` paths are also supported. This leaves room for the LLM's response.
|
|
36
40
|
|
|
37
|
-
You can also trigger manually with `/compact
|
|
41
|
+
You can also trigger manually with `/compact`. Custom summary instructions are no longer accepted because retained transcript content stays verbatim.
|
|
38
42
|
|
|
39
43
|
### How It Works
|
|
40
44
|
|
|
41
|
-
1.
|
|
42
|
-
2.
|
|
43
|
-
3.
|
|
44
|
-
4.
|
|
45
|
-
5.
|
|
45
|
+
1. Build a compactable transcript for the active branch with stable entry IDs and content-block indexes.
|
|
46
|
+
2. Ask the selected model, with a fixed internal prompt, for JSON deletion targets only.
|
|
47
|
+
3. Validate the plan locally: unknown IDs, protected user messages, recent operations, unresolved errors, and tool-call/tool-result orphaning fail closed.
|
|
48
|
+
4. Write a backup snapshot for persisted sessions.
|
|
49
|
+
5. Append a `context_compaction` entry containing validated logical deletion targets and stats.
|
|
50
|
+
6. Rebuild active LLM context by filtering those targets. Retained entries/content blocks are reused unchanged.
|
|
51
|
+
|
|
52
|
+
Tradeoff: compaction performs logical deletion during session rebuild instead of physically rewriting JSONL. The full raw history remains in the session file and backup, while the active LLM context is reduced.
|
|
53
|
+
|
|
54
|
+
### Verbatim Compaction Diagram
|
|
55
|
+
|
|
56
|
+
Unlike legacy summary compaction, Verbatim Compaction does not add a generated summary or rewrite retained messages. It appends a `context_compaction` entry that records exactly which older transcript objects should be hidden from future active context rebuilds.
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
Before verbatim compaction:
|
|
60
|
+
|
|
61
|
+
entry: 0 1 2 3 4 5 6 7
|
|
62
|
+
┌─────┬─────┬─────┬──────┬─────┬──────┬──────┬─────┐
|
|
63
|
+
│ hdr │ usr │ ass │ tool │ usr │ ass │ tool │ ass │
|
|
64
|
+
└─────┴─────┴─────┴──────┴─────┴──────┴──────┴─────┘
|
|
65
|
+
│ │ │ │
|
|
66
|
+
└──────┴────────────┴──────┘
|
|
67
|
+
planner may mark low-signal old objects
|
|
68
|
+
|
|
69
|
+
Validated deletion plan:
|
|
70
|
+
|
|
71
|
+
delete entry 2 (older assistant text)
|
|
72
|
+
delete entry 3 (superseded tool output)
|
|
73
|
+
keep entries 0,1,4,5,6,7 unchanged
|
|
74
|
+
|
|
75
|
+
After compaction (new entry appended; JSONL remains append-only):
|
|
76
|
+
|
|
77
|
+
entry: 0 1 2 3 4 5 6 7 8
|
|
78
|
+
┌─────┬─────┬─────┬──────┬─────┬──────┬──────┬─────┬─────┐
|
|
79
|
+
│ hdr │ usr │ ass │ tool │ usr │ ass │ tool │ ass │ ctx │
|
|
80
|
+
└─────┴─────┴─────┴──────┴─────┴──────┴──────┴─────┴─────┘
|
|
81
|
+
╳ ╳ ↑
|
|
82
|
+
logical deletions context_compaction entry
|
|
83
|
+
|
|
84
|
+
What the LLM sees after rebuild:
|
|
85
|
+
|
|
86
|
+
┌────────┬─────┬─────┬──────┬──────┬─────┐
|
|
87
|
+
│ system │ usr │ usr │ ass │ tool │ ass │
|
|
88
|
+
└────────┴─────┴─────┴──────┴──────┴─────┘
|
|
89
|
+
entry 1 entry 4 entry 5 entry 6 entry 7
|
|
90
|
+
|
|
91
|
+
No generated summary is inserted. Every surviving entry/content block is reused
|
|
92
|
+
verbatim; deleted objects are simply omitted from the active LLM context.
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Summary Compaction Internals
|
|
96
|
+
|
|
97
|
+
The older summarization pipeline still exists in the core compaction module and for legacy extension hook types, but `/compact` and auto-compaction no longer use it by default.
|
|
46
98
|
|
|
47
99
|
```
|
|
48
|
-
Before compaction:
|
|
100
|
+
Before summary compaction:
|
|
49
101
|
|
|
50
102
|
entry: 0 1 2 3 4 5 6 7 8 9
|
|
51
103
|
┌─────┬─────┬─────┬─────┬──────┬─────┬─────┬──────┬──────┬─────┐
|
|
@@ -76,7 +128,7 @@ What the LLM sees:
|
|
|
76
128
|
prompt from cmp messages from firstKeptEntryId
|
|
77
129
|
```
|
|
78
130
|
|
|
79
|
-
On repeated compactions, the summarized span starts at the previous compaction's kept boundary (`firstKeptEntryId`), not at the compaction entry itself, falling back to the entry after the previous compaction if that kept entry cannot be found in the path. This preserves messages that survived the earlier compaction by including them in the next summarization pass as well.
|
|
131
|
+
On repeated compactions, the summarized span starts at the previous compaction's kept boundary (`firstKeptEntryId`), not at the compaction entry itself, falling back to the entry after the previous compaction if that kept entry cannot be found in the path. This preserves messages that survived the earlier compaction by including them in the next summarization pass as well. Atomic also recalculates `tokensBefore` from the rebuilt session context before writing the new `CompactionEntry`, so the token count reflects the actual pre-compaction context being replaced.
|
|
80
132
|
|
|
81
133
|
### Split Turns
|
|
82
134
|
|
|
@@ -102,7 +154,7 @@ Split turn (one huge turn exceeds budget):
|
|
|
102
154
|
turnPrefixMessages = [usr, ass, tool, ass, tool, tool]
|
|
103
155
|
```
|
|
104
156
|
|
|
105
|
-
For split turns,
|
|
157
|
+
For split turns, Atomic generates two summaries and merges them:
|
|
106
158
|
1. **History summary**: Previous context (if any)
|
|
107
159
|
2. **Turn prefix summary**: The early part of the split turn
|
|
108
160
|
|
|
@@ -118,14 +170,14 @@ Never cut at tool results (they must stay with their tool call).
|
|
|
118
170
|
|
|
119
171
|
### CompactionEntry Structure
|
|
120
172
|
|
|
121
|
-
Defined in [`session-manager.ts`](https://github.com/
|
|
173
|
+
Defined in [`session-manager.ts`](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/src/core/session-manager.ts):
|
|
122
174
|
|
|
123
175
|
```typescript
|
|
124
176
|
interface CompactionEntry<T = unknown> {
|
|
125
177
|
type: "compaction";
|
|
126
178
|
id: string;
|
|
127
|
-
parentId: string;
|
|
128
|
-
timestamp:
|
|
179
|
+
parentId: string | null;
|
|
180
|
+
timestamp: string; // ISO timestamp
|
|
129
181
|
summary: string;
|
|
130
182
|
firstKeptEntryId: string;
|
|
131
183
|
tokensBefore: number;
|
|
@@ -133,22 +185,22 @@ interface CompactionEntry<T = unknown> {
|
|
|
133
185
|
details?: T; // implementation-specific data
|
|
134
186
|
}
|
|
135
187
|
|
|
136
|
-
//
|
|
188
|
+
// Legacy summary compaction uses this for details (from compaction.ts):
|
|
137
189
|
interface CompactionDetails {
|
|
138
190
|
readFiles: string[];
|
|
139
191
|
modifiedFiles: string[];
|
|
140
192
|
}
|
|
141
193
|
```
|
|
142
194
|
|
|
143
|
-
Extensions can store any JSON-serializable data in `details`. The
|
|
195
|
+
Extensions can store any JSON-serializable data in `details`. The legacy summary compaction pipeline tracks file operations, but custom extension implementations can use their own structure.
|
|
144
196
|
|
|
145
|
-
See [`prepareCompaction()`](https://github.com/
|
|
197
|
+
See [`prepareCompaction()`](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/src/core/compaction/compaction.ts) and [`compact()`](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/src/core/compaction/compaction.ts) for the implementation.
|
|
146
198
|
|
|
147
199
|
## Branch Summarization
|
|
148
200
|
|
|
149
201
|
### When It Triggers
|
|
150
202
|
|
|
151
|
-
When you use `/tree` to navigate to a different branch,
|
|
203
|
+
When you use `/tree` to navigate to a different branch, Atomic offers to summarize the work you're leaving. This injects context from the left branch into the new branch.
|
|
152
204
|
|
|
153
205
|
### How It Works
|
|
154
206
|
|
|
@@ -177,7 +229,7 @@ After navigation with summary:
|
|
|
177
229
|
|
|
178
230
|
### Cumulative File Tracking
|
|
179
231
|
|
|
180
|
-
Both compaction and branch summarization track files cumulatively. When generating a summary,
|
|
232
|
+
Both compaction and branch summarization track files cumulatively. When generating a summary, Atomic extracts file operations from:
|
|
181
233
|
- Tool calls in the messages being summarized
|
|
182
234
|
- Previous compaction or branch summary `details` (if any)
|
|
183
235
|
|
|
@@ -185,14 +237,14 @@ This means file tracking accumulates across multiple compactions or nested branc
|
|
|
185
237
|
|
|
186
238
|
### BranchSummaryEntry Structure
|
|
187
239
|
|
|
188
|
-
Defined in [`session-manager.ts`](https://github.com/
|
|
240
|
+
Defined in [`session-manager.ts`](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/src/core/session-manager.ts):
|
|
189
241
|
|
|
190
242
|
```typescript
|
|
191
243
|
interface BranchSummaryEntry<T = unknown> {
|
|
192
244
|
type: "branch_summary";
|
|
193
245
|
id: string;
|
|
194
|
-
parentId: string;
|
|
195
|
-
timestamp:
|
|
246
|
+
parentId: string | null;
|
|
247
|
+
timestamp: string; // ISO timestamp
|
|
196
248
|
summary: string;
|
|
197
249
|
fromId: string; // Entry we navigated from
|
|
198
250
|
fromHook?: boolean; // true if provided by extension (legacy field name)
|
|
@@ -208,7 +260,7 @@ interface BranchSummaryDetails {
|
|
|
208
260
|
|
|
209
261
|
Same as compaction, extensions can store custom data in `details`.
|
|
210
262
|
|
|
211
|
-
See [`collectEntriesForBranchSummary()`](https://github.com/
|
|
263
|
+
See [`collectEntriesForBranchSummary()`](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/src/core/compaction/branch-summarization.ts), [`prepareBranchEntries()`](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/src/core/compaction/branch-summarization.ts), and [`generateBranchSummary()`](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/src/core/compaction/branch-summarization.ts) for the implementation.
|
|
212
264
|
|
|
213
265
|
## Summary Format
|
|
214
266
|
|
|
@@ -252,7 +304,7 @@ path/to/changed.ts
|
|
|
252
304
|
|
|
253
305
|
### Message Serialization
|
|
254
306
|
|
|
255
|
-
Before summarization, messages are serialized to text via [`serializeConversation()`](https://github.com/
|
|
307
|
+
Before summarization, messages are serialized to text via [`serializeConversation()`](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/src/core/compaction/utils.ts):
|
|
256
308
|
|
|
257
309
|
```
|
|
258
310
|
[User]: What they said
|
|
@@ -268,11 +320,11 @@ Tool results are truncated to 2000 characters during serialization. Content beyo
|
|
|
268
320
|
|
|
269
321
|
## Custom Summarization via Extensions
|
|
270
322
|
|
|
271
|
-
Extensions can
|
|
323
|
+
Extensions can still customize the legacy summary compaction pipeline and branch summarization. Default `/compact` and auto-compaction use deletion-only context compaction and do not call summary customization hooks. See [`extensions/types.ts`](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/src/core/extensions/types.ts) for event type definitions.
|
|
272
324
|
|
|
273
325
|
### session_before_compact
|
|
274
326
|
|
|
275
|
-
Fired before
|
|
327
|
+
Fired before legacy summary compaction. Can cancel or provide custom summary. See `SessionBeforeCompactEvent` and `CompactionPreparation` in the types file.
|
|
276
328
|
|
|
277
329
|
```typescript
|
|
278
330
|
pi.on("session_before_compact", async (event, ctx) => {
|
|
@@ -387,8 +439,8 @@ Configure compaction in `~/.atomic/agent/settings.json` or `<project-dir>/.atomi
|
|
|
387
439
|
|
|
388
440
|
| Setting | Default | Description |
|
|
389
441
|
|---------|---------|-------------|
|
|
390
|
-
| `enabled` | `true` | Enable
|
|
442
|
+
| `enabled` | `true` | Enable automatic Verbatim Compaction |
|
|
391
443
|
| `reserveTokens` | `16384` | Tokens to reserve for LLM response |
|
|
392
|
-
| `keepRecentTokens` | `20000` | Recent tokens to
|
|
444
|
+
| `keepRecentTokens` | `20000` | Recent tokens to protect from deletion |
|
|
393
445
|
|
|
394
446
|
Disable auto-compaction with `"enabled": false`. You can still compact manually with `/compact`.
|
package/docs/custom-provider.md
CHANGED
|
@@ -208,7 +208,7 @@ models: [{
|
|
|
208
208
|
id: "custom-model",
|
|
209
209
|
// ...
|
|
210
210
|
reasoning: true,
|
|
211
|
-
thinkingLevelMap: { // map
|
|
211
|
+
thinkingLevelMap: { // map Atomic thinking levels to provider values; null hides unsupported levels
|
|
212
212
|
minimal: null,
|
|
213
213
|
low: null,
|
|
214
214
|
medium: null,
|
|
@@ -345,12 +345,14 @@ interface OAuthCredentials {
|
|
|
345
345
|
For providers with non-standard APIs, implement `streamSimple`. Study the existing provider implementations before writing your own:
|
|
346
346
|
|
|
347
347
|
**Reference implementations:**
|
|
348
|
-
|
|
349
|
-
-
|
|
350
|
-
-
|
|
351
|
-
-
|
|
352
|
-
-
|
|
353
|
-
-
|
|
348
|
+
|
|
349
|
+
Atomic uses provider implementations from its installed `@earendil-works/pi-ai` dependency. Inspect the compiled declarations and JavaScript under `node_modules/@earendil-works/pi-ai/dist/providers/`, including:
|
|
350
|
+
- `anthropic.d.ts` / `anthropic.js` - Anthropic Messages API
|
|
351
|
+
- `mistral.d.ts` / `mistral.js` - Mistral Conversations API
|
|
352
|
+
- `openai-completions.d.ts` / `openai-completions.js` - OpenAI Chat Completions
|
|
353
|
+
- `openai-responses.d.ts` / `openai-responses.js` - OpenAI Responses API
|
|
354
|
+
- `google.d.ts` / `google.js` - Google Generative AI
|
|
355
|
+
- `amazon-bedrock.d.ts` / `amazon-bedrock.js` - AWS Bedrock
|
|
354
356
|
|
|
355
357
|
### Stream Pattern
|
|
356
358
|
|
|
@@ -522,7 +524,7 @@ pi.registerProvider("my-provider", {
|
|
|
522
524
|
|
|
523
525
|
## Testing Your Implementation
|
|
524
526
|
|
|
525
|
-
Test your provider against
|
|
527
|
+
Test your provider against focused tests that mirror Atomic's provider contract. If you are working from the source checkout, note that provider internals come from `@earendil-works/pi-ai`; this monorepo does not contain a `packages/ai/test` directory to copy from directly:
|
|
526
528
|
|
|
527
529
|
| Test | Purpose |
|
|
528
530
|
|------|---------|
|
|
@@ -602,7 +604,7 @@ interface ProviderModelConfig {
|
|
|
602
604
|
/** Whether the model supports extended thinking. */
|
|
603
605
|
reasoning: boolean;
|
|
604
606
|
|
|
605
|
-
/** Maps
|
|
607
|
+
/** Maps Atomic thinking levels to provider/model-specific values; null marks a level unsupported. */
|
|
606
608
|
thinkingLevelMap?: Partial<Record<"off" | "minimal" | "low" | "medium" | "high" | "xhigh", string | null>>;
|
|
607
609
|
|
|
608
610
|
/** Supported input types. */
|
package/docs/extensions.md
CHANGED
|
@@ -144,17 +144,10 @@ To share extensions via npm or git as Atomic packages, see [Atomic packages](/pa
|
|
|
144
144
|
| `@earendil-works/pi-ai` | AI utilities (`StringEnum` for Google-compatible enums) |
|
|
145
145
|
| `@earendil-works/pi-tui` | TUI components for custom rendering |
|
|
146
146
|
|
|
147
|
-
|
|
147
|
+
Registry dependencies work too. Add a `package.json` next to your extension (or in a parent directory), then install dependencies with Bun:
|
|
148
148
|
|
|
149
149
|
```bash
|
|
150
|
-
# npm
|
|
151
|
-
npm install
|
|
152
|
-
|
|
153
|
-
# Bun
|
|
154
150
|
bun install
|
|
155
|
-
|
|
156
|
-
# pnpm
|
|
157
|
-
pnpm install
|
|
158
151
|
```
|
|
159
152
|
|
|
160
153
|
Imports from `node_modules/` are resolved automatically.
|
|
@@ -175,7 +168,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
175
168
|
pi.on("event_name", async (event, ctx) => {
|
|
176
169
|
// ctx.ui for user interaction
|
|
177
170
|
const ok = await ctx.ui.confirm("Title", "Are you sure?");
|
|
178
|
-
ctx.ui.notify("Done!", "
|
|
171
|
+
ctx.ui.notify("Done!", "info");
|
|
179
172
|
ctx.ui.setStatus("my-ext", "Processing..."); // Footer status
|
|
180
173
|
ctx.ui.setWidget("my-ext", ["Line 1", "Line 2"]); // Widget above editor (default)
|
|
181
174
|
});
|
|
@@ -254,7 +247,7 @@ This pattern makes the fetched models available during normal startup and to `at
|
|
|
254
247
|
~/.atomic/agent/extensions/
|
|
255
248
|
└── my-extension/
|
|
256
249
|
├── package.json # Declares dependencies and entry points
|
|
257
|
-
├──
|
|
250
|
+
├── bun.lock
|
|
258
251
|
├── node_modules/ # After dependency install
|
|
259
252
|
└── src/
|
|
260
253
|
└── index.ts
|
|
@@ -274,7 +267,7 @@ This pattern makes the fetched models available during normal startup and to `at
|
|
|
274
267
|
}
|
|
275
268
|
```
|
|
276
269
|
|
|
277
|
-
The manifest key is the configured Atomic app name (`atomic` here, from the running Atomic package/config), not the extension package's own `"name"` field. The legacy `pi` key is still accepted as a compatibility shim. Run `
|
|
270
|
+
The manifest key is the configured Atomic app name (`atomic` here, from the running Atomic package/config), not the extension package's own `"name"` field. The legacy `pi` key is still accepted as a compatibility shim. Run `bun install` in the extension directory, then imports from `node_modules/` work automatically.
|
|
278
271
|
|
|
279
272
|
## Events
|
|
280
273
|
|
|
@@ -329,6 +322,9 @@ user sends another prompt ◄─────────────────
|
|
|
329
322
|
└─► resources_discover { reason: "startup" }
|
|
330
323
|
|
|
331
324
|
/compact or auto-compaction
|
|
325
|
+
└─► compaction_start / compaction_end (deletion-only context compaction)
|
|
326
|
+
|
|
327
|
+
legacy summary compaction APIs
|
|
332
328
|
├─► session_before_compact (can cancel or customize)
|
|
333
329
|
└─► session_compact
|
|
334
330
|
|
|
@@ -398,7 +394,7 @@ pi.on("session_before_switch", async (event, ctx) => {
|
|
|
398
394
|
});
|
|
399
395
|
```
|
|
400
396
|
|
|
401
|
-
After a successful switch or new-session action,
|
|
397
|
+
After a successful switch or new-session action, Atomic emits `session_shutdown` for the old extension instance, reloads and rebinds extensions for the new session, then emits `session_start` with `reason: "new" | "resume"` and `previousSessionFile`.
|
|
402
398
|
Do cleanup work in `session_shutdown`, then reestablish any in-memory state in `session_start`.
|
|
403
399
|
|
|
404
400
|
#### session_before_fork
|
|
@@ -415,12 +411,12 @@ pi.on("session_before_fork", async (event, ctx) => {
|
|
|
415
411
|
});
|
|
416
412
|
```
|
|
417
413
|
|
|
418
|
-
After a successful fork or clone,
|
|
414
|
+
After a successful fork or clone, Atomic emits `session_shutdown` for the old extension instance, reloads and rebinds extensions for the new session, then emits `session_start` with `reason: "fork"` and `previousSessionFile`.
|
|
419
415
|
Do cleanup work in `session_shutdown`, then reestablish any in-memory state in `session_start`.
|
|
420
416
|
|
|
421
417
|
#### session_before_compact / session_compact
|
|
422
418
|
|
|
423
|
-
Fired on compaction. See [Compaction](/compaction) for details.
|
|
419
|
+
Fired by the legacy summary compaction pipeline. `/compact` and auto-compaction now use deletion-only context compaction by default, so extensions should not rely on these events for default compaction. See [Compaction](/compaction) for details.
|
|
424
420
|
|
|
425
421
|
```typescript
|
|
426
422
|
pi.on("session_before_compact", async (event, ctx) => {
|
|
@@ -509,7 +505,7 @@ pi.on("before_agent_start", async (event, ctx) => {
|
|
|
509
505
|
});
|
|
510
506
|
```
|
|
511
507
|
|
|
512
|
-
The `systemPromptOptions` field gives extensions access to the same structured data
|
|
508
|
+
The `systemPromptOptions` field gives extensions access to the same structured data Atomic uses to build the system prompt. This lets you inspect what Atomic has loaded — custom prompts, guidelines, tool snippets, context files, skills — without re-discovering resources or re-parsing flags. Use it when your extension needs to make deep, informed changes to the system prompt while respecting user-provided configuration.
|
|
513
509
|
|
|
514
510
|
Inside `before_agent_start`, `event.systemPrompt` and `ctx.getSystemPrompt()` both reflect the chained system prompt as of the current handler. Later `before_agent_start` handlers can still modify it again.
|
|
515
511
|
|
|
@@ -904,7 +900,7 @@ Use this for abort-aware nested work started by extension handlers, for example:
|
|
|
904
900
|
- file or process helpers that accept `AbortSignal`
|
|
905
901
|
|
|
906
902
|
`ctx.signal` is typically defined during active turn events such as `tool_call`, `tool_result`, `message_update`, and `turn_end`.
|
|
907
|
-
It is usually `undefined` in idle or non-turn contexts such as session events, extension commands, and shortcuts fired while
|
|
903
|
+
It is usually `undefined` in idle or non-turn contexts such as session events, extension commands, and shortcuts fired while Atomic is idle.
|
|
908
904
|
|
|
909
905
|
```typescript
|
|
910
906
|
pi.on("tool_result", async (event, ctx) => {
|
|
@@ -925,7 +921,7 @@ Control flow helpers.
|
|
|
925
921
|
|
|
926
922
|
### ctx.shutdown()
|
|
927
923
|
|
|
928
|
-
Request a graceful shutdown of
|
|
924
|
+
Request a graceful shutdown of Atomic.
|
|
929
925
|
|
|
930
926
|
- **Interactive mode:** Deferred until the agent becomes idle (after processing all queued steering and follow-up messages).
|
|
931
927
|
- **RPC mode:** Deferred until the next idle state (after completing the current command response, when waiting for the next command).
|
|
@@ -954,13 +950,12 @@ if (usage && usage.tokens > 100_000) {
|
|
|
954
950
|
|
|
955
951
|
### ctx.compact()
|
|
956
952
|
|
|
957
|
-
Trigger
|
|
953
|
+
Trigger Atomic's default Verbatim Compaction without awaiting completion. This is deletion-only Context Compaction: retained transcript content stays unchanged, and older low-signal objects are omitted by validated logical deletion. The approach is informed by Morph's Context Compaction write-up: <https://www.morphllm.com/context-compaction>. Use `onComplete` and `onError` for follow-up actions.
|
|
958
954
|
|
|
959
955
|
```typescript
|
|
960
956
|
ctx.compact({
|
|
961
|
-
customInstructions: "Focus on recent changes",
|
|
962
957
|
onComplete: (result) => {
|
|
963
|
-
ctx.ui.notify(
|
|
958
|
+
ctx.ui.notify(`Compaction deleted ${result.stats.objectsDeleted} objects`, "info");
|
|
964
959
|
},
|
|
965
960
|
onError: (error) => {
|
|
966
961
|
ctx.ui.notify(`Compaction failed: ${error.message}`, "error");
|
|
@@ -968,6 +963,8 @@ ctx.compact({
|
|
|
968
963
|
});
|
|
969
964
|
```
|
|
970
965
|
|
|
966
|
+
`customInstructions` is deprecated and ignored for default compaction because Verbatim Compaction never asks the model to write a custom summary.
|
|
967
|
+
|
|
971
968
|
### ctx.getSystemPrompt()
|
|
972
969
|
|
|
973
970
|
Returns Atomic's current system prompt string.
|
|
@@ -1389,7 +1386,7 @@ Labels persist in the session and survive restarts. Use them to mark important p
|
|
|
1389
1386
|
|
|
1390
1387
|
Register a command.
|
|
1391
1388
|
|
|
1392
|
-
If multiple extensions register the same command name,
|
|
1389
|
+
If multiple extensions register the same command name, Atomic keeps them all and assigns numeric invocation suffixes in load order, for example `/review:1` and `/review:2`.
|
|
1393
1390
|
|
|
1394
1391
|
```typescript
|
|
1395
1392
|
pi.registerCommand("stats", {
|
|
@@ -1790,7 +1787,7 @@ async execute(toolCallId, params) {
|
|
|
1790
1787
|
|
|
1791
1788
|
**Important:** Use `StringEnum` from `@earendil-works/pi-ai` for string enums. `Type.Union`/`Type.Literal` doesn't work with Google's API.
|
|
1792
1789
|
|
|
1793
|
-
**Argument preparation:** `prepareArguments(args)` is optional. If defined, it runs before schema validation and before `execute()`. Use it to mimic an older accepted input shape when
|
|
1790
|
+
**Argument preparation:** `prepareArguments(args)` is optional. If defined, it runs before schema validation and before `execute()`. Use it to mimic an older accepted input shape when Atomic resumes an older session whose stored tool call arguments no longer match the current schema. Return the object you want validated against `parameters`. Keep the public schema strict. Do not add deprecated compatibility fields to `parameters` just to keep old resumed sessions working.
|
|
1794
1791
|
|
|
1795
1792
|
Example: an older session may contain an `edit` tool call with top-level `oldText` and `newText`, while the current schema only accepts `edits: [{ oldText, newText }]`.
|
|
1796
1793
|
|
|
@@ -1861,13 +1858,13 @@ See [examples/extensions/tool-override.ts](https://github.com/bastani-inc/atomic
|
|
|
1861
1858
|
**Your implementation must match the exact result shape**, including the `details` type. The UI and session logic depend on these shapes for rendering and state tracking.
|
|
1862
1859
|
|
|
1863
1860
|
Built-in tool implementations:
|
|
1864
|
-
- [read.ts](https://github.com/
|
|
1865
|
-
- [bash.ts](https://github.com/
|
|
1866
|
-
- [edit.ts](https://github.com/
|
|
1867
|
-
- [write.ts](https://github.com/
|
|
1868
|
-
- [grep.ts](https://github.com/
|
|
1869
|
-
- [find.ts](https://github.com/
|
|
1870
|
-
- [ls.ts](https://github.com/
|
|
1861
|
+
- [read.ts](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/src/core/tools/read.ts) - `ReadToolDetails`
|
|
1862
|
+
- [bash.ts](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/src/core/tools/bash.ts) - `BashToolDetails`
|
|
1863
|
+
- [edit.ts](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/src/core/tools/edit.ts)
|
|
1864
|
+
- [write.ts](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/src/core/tools/write.ts)
|
|
1865
|
+
- [grep.ts](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/src/core/tools/grep.ts) - `GrepToolDetails`
|
|
1866
|
+
- [find.ts](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/src/core/tools/find.ts) - `FindToolDetails`
|
|
1867
|
+
- [ls.ts](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/src/core/tools/ls.ts) - `LsToolDetails`
|
|
1871
1868
|
|
|
1872
1869
|
### Remote Execution
|
|
1873
1870
|
|
|
@@ -1990,7 +1987,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
1990
1987
|
|
|
1991
1988
|
### Custom Rendering
|
|
1992
1989
|
|
|
1993
|
-
Tools can provide `renderCall` and `renderResult` for custom TUI display. See [TUI components](/tui) for the full component API and [tool-execution.ts](https://github.com/
|
|
1990
|
+
Tools can provide `renderCall` and `renderResult` for custom TUI display. See [TUI components](/tui) for the full component API and [tool-execution.ts](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/src/modes/interactive/components/tool-execution.ts) for how tool rows are composed.
|
|
1994
1991
|
|
|
1995
1992
|
By default, tool output is wrapped in a `Box` that handles padding and background. A defined `renderCall` or `renderResult` must return a `Component`. If a slot renderer is not defined, `tool-execution.ts` uses fallback rendering for that slot.
|
|
1996
1993
|
|
|
@@ -2345,18 +2342,25 @@ See [github-issue-autocomplete.ts](https://github.com/bastani-inc/atomic/blob/ma
|
|
|
2345
2342
|
For complex UI, use `ctx.ui.custom()`. This temporarily replaces the editor with your component until `done()` is called:
|
|
2346
2343
|
|
|
2347
2344
|
```typescript
|
|
2348
|
-
import { Text, Component } from "@earendil-works/pi-tui";
|
|
2345
|
+
import { Text, type Component } from "@earendil-works/pi-tui";
|
|
2349
2346
|
|
|
2350
|
-
|
|
2351
|
-
|
|
2347
|
+
class ConfirmPrompt implements Component {
|
|
2348
|
+
render(width: number): string[] {
|
|
2349
|
+
return new Text("Enter Confirm · Escape Cancel", 1, 1).render(width);
|
|
2350
|
+
}
|
|
2352
2351
|
|
|
2353
|
-
|
|
2354
|
-
if (key === "return") done(true);
|
|
2355
|
-
if (key === "escape") done(false);
|
|
2356
|
-
return true;
|
|
2357
|
-
};
|
|
2352
|
+
invalidate(): void {}
|
|
2358
2353
|
|
|
2359
|
-
|
|
2354
|
+
handleInput(data: string): void {
|
|
2355
|
+
if (data === "\r") this.done(true);
|
|
2356
|
+
if (data === "\x1b") this.done(false);
|
|
2357
|
+
}
|
|
2358
|
+
|
|
2359
|
+
constructor(private readonly done: (value: boolean) => void) {}
|
|
2360
|
+
}
|
|
2361
|
+
|
|
2362
|
+
const result = await ctx.ui.custom<boolean>((_tui, _theme, _keybindings, done) => {
|
|
2363
|
+
return new ConfirmPrompt(done);
|
|
2360
2364
|
});
|
|
2361
2365
|
|
|
2362
2366
|
if (result) {
|
|
@@ -2568,7 +2572,7 @@ All examples in [examples/extensions/](https://github.com/bastani-inc/atomic/tre
|
|
|
2568
2572
|
| `prompt-customizer.ts` | Add context-aware tool guidance using `systemPromptOptions` | `on("before_agent_start")`, `BuildSystemPromptOptions` |
|
|
2569
2573
|
| `file-trigger.ts` | File watcher triggers messages | `sendMessage` |
|
|
2570
2574
|
| **Compaction & Sessions** |||
|
|
2571
|
-
| `custom-compaction.ts` |
|
|
2575
|
+
| `custom-compaction.ts` | Legacy custom compaction summary | `on("session_before_compact")` |
|
|
2572
2576
|
| `trigger-compact.ts` | Trigger compaction manually | `compact()` |
|
|
2573
2577
|
| `git-checkpoint.ts` | Git stash on turns | `on("turn_start")`, `on("session_before_fork")`, `exec` |
|
|
2574
2578
|
| `auto-commit-on-exit.ts` | Commit on shutdown | `on("session_shutdown")`, `exec` |
|
package/docs/index.md
CHANGED
|
@@ -9,17 +9,10 @@ Atomic is a minimal terminal coding harness. It is designed to stay small at the
|
|
|
9
9
|
|
|
10
10
|
## Quick start
|
|
11
11
|
|
|
12
|
-
Install Atomic with
|
|
12
|
+
Install Atomic with Bun:
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
|
-
# npm
|
|
16
|
-
npm install -g @bastani/atomic
|
|
17
|
-
|
|
18
|
-
# Bun
|
|
19
15
|
bun install -g @bastani/atomic
|
|
20
|
-
|
|
21
|
-
# pnpm
|
|
22
|
-
pnpm add -g @bastani/atomic
|
|
23
16
|
```
|
|
24
17
|
|
|
25
18
|
Atomic does not require package install scripts. If you want to disable dependency lifecycle scripts during the Atomic install, you can add `--ignore-scripts` to the install command.
|
|
@@ -44,7 +37,7 @@ For the full first-run flow, see [Quickstart](/quickstart).
|
|
|
44
37
|
- [Settings](/settings) - global and project settings.
|
|
45
38
|
- [Keybindings](/keybindings) - default shortcuts and custom keybindings.
|
|
46
39
|
- [Sessions](/sessions) - session management, branching, and tree navigation.
|
|
47
|
-
- [Compaction](/compaction) - context
|
|
40
|
+
- [Compaction](/compaction) - Verbatim Compaction, context management, and branch summarization.
|
|
48
41
|
|
|
49
42
|
## Customization
|
|
50
43
|
|
package/docs/json.md
CHANGED
|
@@ -1,28 +1,31 @@
|
|
|
1
1
|
# JSON Event Stream Mode
|
|
2
2
|
|
|
3
3
|
```bash
|
|
4
|
-
|
|
4
|
+
atomic --mode json "Your prompt"
|
|
5
5
|
```
|
|
6
6
|
|
|
7
|
-
Outputs all session events as JSON lines to stdout. Useful for integrating
|
|
7
|
+
Outputs all session events as JSON lines to stdout. Useful for integrating Atomic into other tools or custom UIs.
|
|
8
8
|
|
|
9
9
|
## Event Types
|
|
10
10
|
|
|
11
|
-
Events are defined in [`AgentSessionEvent`](https://github.com/
|
|
11
|
+
Events are defined in [`AgentSessionEvent`](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/src/core/agent-session.ts#L152):
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
14
|
type AgentSessionEvent =
|
|
15
15
|
| AgentEvent
|
|
16
16
|
| { type: "queue_update"; steering: readonly string[]; followUp: readonly string[] }
|
|
17
17
|
| { type: "compaction_start"; reason: "manual" | "threshold" | "overflow" }
|
|
18
|
-
| { type: "
|
|
18
|
+
| { type: "session_info_changed"; name: string | undefined }
|
|
19
|
+
| { type: "model_changed"; model: Model<Api>; previousModel: Model<Api> | undefined; source: "set" | "cycle" | "restore" }
|
|
20
|
+
| { type: "thinking_level_changed"; level: ThinkingLevel }
|
|
21
|
+
| { type: "compaction_end"; reason: "manual" | "threshold" | "overflow"; result: ContextCompactionResult | undefined; aborted: boolean; willRetry: boolean; errorMessage?: string }
|
|
19
22
|
| { type: "auto_retry_start"; attempt: number; maxAttempts: number; delayMs: number; errorMessage: string }
|
|
20
23
|
| { type: "auto_retry_end"; success: boolean; attempt: number; finalError?: string };
|
|
21
24
|
```
|
|
22
25
|
|
|
23
|
-
`queue_update` emits the full pending steering and follow-up queues whenever they change. `compaction_start` and `compaction_end` cover both manual and automatic compaction
|
|
26
|
+
`queue_update` emits the full pending steering and follow-up queues whenever they change. `session_info_changed`, `model_changed`, and `thinking_level_changed` report interactive session metadata changes. `compaction_start` and `compaction_end` cover both manual and automatic Verbatim Compaction, Atomic's deletion-only Context Compaction approach inspired by <https://www.morphllm.com/context-compaction>.
|
|
24
27
|
|
|
25
|
-
Base events from
|
|
28
|
+
Base events come from `AgentEvent` in `@earendil-works/pi-agent-core` (installed as an Atomic dependency):
|
|
26
29
|
|
|
27
30
|
```typescript
|
|
28
31
|
type AgentEvent =
|
|
@@ -44,12 +47,12 @@ type AgentEvent =
|
|
|
44
47
|
|
|
45
48
|
## Message Types
|
|
46
49
|
|
|
47
|
-
Base messages from
|
|
48
|
-
- `UserMessage`
|
|
49
|
-
- `AssistantMessage`
|
|
50
|
-
- `ToolResultMessage`
|
|
50
|
+
Base messages come from `@earendil-works/pi-ai` (installed as an Atomic dependency):
|
|
51
|
+
- `UserMessage`
|
|
52
|
+
- `AssistantMessage`
|
|
53
|
+
- `ToolResultMessage`
|
|
51
54
|
|
|
52
|
-
Extended messages from [`packages/coding-agent/src/core/messages.ts`](https://github.com/
|
|
55
|
+
Extended messages from [`packages/coding-agent/src/core/messages.ts`](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/src/core/messages.ts#L29):
|
|
53
56
|
- `BashExecutionMessage` (line 29)
|
|
54
57
|
- `CustomMessage` (line 46)
|
|
55
58
|
- `BranchSummaryMessage` (line 55)
|
|
@@ -78,5 +81,5 @@ Followed by events as they occur:
|
|
|
78
81
|
## Example
|
|
79
82
|
|
|
80
83
|
```bash
|
|
81
|
-
|
|
84
|
+
atomic --mode json "List files" 2>/dev/null | jq -c 'select(.type == "message_end")'
|
|
82
85
|
```
|