@bastani/atomic 0.8.25 → 0.8.26-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (332) hide show
  1. package/CHANGELOG.md +84 -0
  2. package/README.md +5 -5
  3. package/dist/builtin/intercom/CHANGELOG.md +60 -0
  4. package/dist/builtin/intercom/index-heavy.ts +1754 -0
  5. package/dist/builtin/intercom/index.ts +374 -1746
  6. package/dist/builtin/intercom/package.json +2 -2
  7. package/dist/builtin/intercom/result-renderers.ts +77 -0
  8. package/dist/builtin/mcp/CHANGELOG.md +64 -0
  9. package/dist/builtin/mcp/index.ts +151 -57
  10. package/dist/builtin/mcp/package.json +3 -3
  11. package/dist/builtin/subagents/CHANGELOG.md +61 -0
  12. package/dist/builtin/subagents/agents/codebase-online-researcher.md +9 -9
  13. package/dist/builtin/subagents/agents/debugger.md +6 -6
  14. package/dist/builtin/subagents/package.json +4 -4
  15. package/dist/builtin/subagents/prompts/parallel-handoff-plan.md +1 -1
  16. package/dist/builtin/subagents/skills/browser/EXAMPLES.md +151 -0
  17. package/dist/builtin/subagents/skills/browser/LICENSE.txt +21 -0
  18. package/dist/builtin/subagents/skills/browser/REFERENCE.md +451 -0
  19. package/dist/builtin/subagents/skills/browser/SKILL.md +170 -0
  20. package/dist/builtin/subagents/skills/subagent/SKILL.md +4 -4
  21. package/dist/builtin/subagents/src/runs/background/subagent-runner.ts +55 -12
  22. package/dist/builtin/subagents/src/runs/foreground/execution.ts +71 -12
  23. package/dist/builtin/subagents/src/runs/shared/acceptance.ts +2 -1
  24. package/dist/builtin/subagents/src/runs/shared/final-drain.ts +34 -0
  25. package/dist/builtin/subagents/src/runs/shared/model-fallback.ts +416 -7
  26. package/dist/builtin/subagents/src/runs/shared/worktree.ts +2 -2
  27. package/dist/builtin/web-access/CHANGELOG.md +60 -0
  28. package/dist/builtin/web-access/index-heavy.ts +2060 -0
  29. package/dist/builtin/web-access/index.ts +182 -2274
  30. package/dist/builtin/web-access/package.json +2 -2
  31. package/dist/builtin/web-access/result-renderers.ts +364 -0
  32. package/dist/builtin/workflows/CHANGELOG.md +75 -0
  33. package/dist/builtin/workflows/README.md +10 -8
  34. package/dist/builtin/workflows/builtin/deep-research-codebase.ts +11 -8
  35. package/dist/builtin/workflows/builtin/goal.ts +137 -109
  36. package/dist/builtin/workflows/builtin/index.d.ts +2 -0
  37. package/dist/builtin/workflows/builtin/open-claude-design.ts +228 -151
  38. package/dist/builtin/workflows/builtin/ralph.d.ts +2 -0
  39. package/dist/builtin/workflows/builtin/ralph.ts +452 -279
  40. package/dist/builtin/workflows/package.json +2 -2
  41. package/dist/builtin/workflows/skills/create-spec/SKILL.md +14 -0
  42. package/dist/builtin/workflows/skills/research-codebase/SKILL.md +29 -10
  43. package/dist/builtin/workflows/src/extension/index.ts +23 -5
  44. package/dist/builtin/workflows/src/extension/runtime.ts +35 -3
  45. package/dist/builtin/workflows/src/extension/wiring.ts +13 -1
  46. package/dist/builtin/workflows/src/runs/background/status.ts +52 -6
  47. package/dist/builtin/workflows/src/runs/foreground/executor.ts +453 -21
  48. package/dist/builtin/workflows/src/runs/foreground/stage-runner.ts +130 -13
  49. package/dist/builtin/workflows/src/runs/shared/model-fallback.ts +402 -8
  50. package/dist/builtin/workflows/src/runs/shared/worktree.ts +2 -2
  51. package/dist/builtin/workflows/src/shared/authoring-contract.d.ts +2 -2
  52. package/dist/builtin/workflows/src/shared/persistence-restore.ts +182 -6
  53. package/dist/builtin/workflows/src/shared/persistence-session-entries.ts +76 -6
  54. package/dist/builtin/workflows/src/shared/stage-prompt.ts +33 -2
  55. package/dist/builtin/workflows/src/shared/store-types.ts +31 -0
  56. package/dist/builtin/workflows/src/shared/store.ts +160 -18
  57. package/dist/builtin/workflows/src/shared/types.ts +3 -3
  58. package/dist/builtin/workflows/src/shared/workflow-failures.ts +758 -132
  59. package/dist/builtin/workflows/src/tui/inline-form-overlay.ts +12 -3
  60. package/dist/builtin/workflows/src/tui/inline-form-store.ts +17 -6
  61. package/dist/builtin/workflows/src/tui/stage-chat-view.ts +39 -3
  62. package/dist/builtin/workflows/src/tui/store-widget-installer.ts +74 -74
  63. package/dist/core/agent-session-services.d.ts.map +1 -1
  64. package/dist/core/agent-session-services.js +13 -0
  65. package/dist/core/agent-session-services.js.map +1 -1
  66. package/dist/core/agent-session.d.ts +33 -6
  67. package/dist/core/agent-session.d.ts.map +1 -1
  68. package/dist/core/agent-session.js +157 -182
  69. package/dist/core/agent-session.js.map +1 -1
  70. package/dist/core/atomic-guide-command.d.ts.map +1 -1
  71. package/dist/core/atomic-guide-command.js +11 -9
  72. package/dist/core/atomic-guide-command.js.map +1 -1
  73. package/dist/core/compaction/branch-summarization.d.ts +1 -1
  74. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  75. package/dist/core/compaction/branch-summarization.js +6 -3
  76. package/dist/core/compaction/branch-summarization.js.map +1 -1
  77. package/dist/core/compaction/compaction.d.ts.map +1 -1
  78. package/dist/core/compaction/compaction.js +23 -10
  79. package/dist/core/compaction/compaction.js.map +1 -1
  80. package/dist/core/compaction/context-compaction.d.ts +175 -0
  81. package/dist/core/compaction/context-compaction.d.ts.map +1 -0
  82. package/dist/core/compaction/context-compaction.js +1636 -0
  83. package/dist/core/compaction/context-compaction.js.map +1 -0
  84. package/dist/core/compaction/index.d.ts +1 -0
  85. package/dist/core/compaction/index.d.ts.map +1 -1
  86. package/dist/core/compaction/index.js +1 -0
  87. package/dist/core/compaction/index.js.map +1 -1
  88. package/dist/core/extensions/loader.d.ts.map +1 -1
  89. package/dist/core/extensions/loader.js +7 -0
  90. package/dist/core/extensions/loader.js.map +1 -1
  91. package/dist/core/extensions/types.d.ts +16 -3
  92. package/dist/core/extensions/types.d.ts.map +1 -1
  93. package/dist/core/extensions/types.js.map +1 -1
  94. package/dist/core/footer-data-provider.d.ts.map +1 -1
  95. package/dist/core/footer-data-provider.js +3 -0
  96. package/dist/core/footer-data-provider.js.map +1 -1
  97. package/dist/core/index.d.ts +1 -1
  98. package/dist/core/index.d.ts.map +1 -1
  99. package/dist/core/index.js.map +1 -1
  100. package/dist/core/package-manager.d.ts.map +1 -1
  101. package/dist/core/package-manager.js +14 -7
  102. package/dist/core/package-manager.js.map +1 -1
  103. package/dist/core/resource-loader.d.ts.map +1 -1
  104. package/dist/core/resource-loader.js +17 -0
  105. package/dist/core/resource-loader.js.map +1 -1
  106. package/dist/core/session-manager.d.ts +41 -1
  107. package/dist/core/session-manager.d.ts.map +1 -1
  108. package/dist/core/session-manager.js +146 -7
  109. package/dist/core/session-manager.js.map +1 -1
  110. package/dist/core/slash-commands.d.ts.map +1 -1
  111. package/dist/core/slash-commands.js +1 -1
  112. package/dist/core/slash-commands.js.map +1 -1
  113. package/dist/core/timings.d.ts +9 -0
  114. package/dist/core/timings.d.ts.map +1 -1
  115. package/dist/core/timings.js +28 -1
  116. package/dist/core/timings.js.map +1 -1
  117. package/dist/core/tools/ask-user-question/tool/format-answer.d.ts +5 -5
  118. package/dist/core/tools/ask-user-question/tool/format-answer.d.ts.map +1 -1
  119. package/dist/core/tools/ask-user-question/tool/format-answer.js +5 -5
  120. package/dist/core/tools/ask-user-question/tool/format-answer.js.map +1 -1
  121. package/dist/core/tools/ask-user-question/tool/response-envelope.d.ts +16 -3
  122. package/dist/core/tools/ask-user-question/tool/response-envelope.d.ts.map +1 -1
  123. package/dist/core/tools/ask-user-question/tool/response-envelope.js +21 -3
  124. package/dist/core/tools/ask-user-question/tool/response-envelope.js.map +1 -1
  125. package/dist/index.d.ts +4 -3
  126. package/dist/index.d.ts.map +1 -1
  127. package/dist/index.js +3 -2
  128. package/dist/index.js.map +1 -1
  129. package/dist/main.d.ts.map +1 -1
  130. package/dist/main.js +4 -2
  131. package/dist/main.js.map +1 -1
  132. package/dist/modes/index.d.ts +1 -1
  133. package/dist/modes/index.d.ts.map +1 -1
  134. package/dist/modes/index.js.map +1 -1
  135. package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
  136. package/dist/modes/interactive/components/chat-session-host.js +17 -0
  137. package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
  138. package/dist/modes/interactive/components/context-compaction-summary-message.d.ts +17 -0
  139. package/dist/modes/interactive/components/context-compaction-summary-message.d.ts.map +1 -0
  140. package/dist/modes/interactive/components/context-compaction-summary-message.js +83 -0
  141. package/dist/modes/interactive/components/context-compaction-summary-message.js.map +1 -0
  142. package/dist/modes/interactive/components/custom-message.d.ts +1 -0
  143. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  144. package/dist/modes/interactive/components/custom-message.js +36 -4
  145. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  146. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  147. package/dist/modes/interactive/components/footer.js +4 -1
  148. package/dist/modes/interactive/components/footer.js.map +1 -1
  149. package/dist/modes/interactive/components/index.d.ts +1 -0
  150. package/dist/modes/interactive/components/index.d.ts.map +1 -1
  151. package/dist/modes/interactive/components/index.js +1 -0
  152. package/dist/modes/interactive/components/index.js.map +1 -1
  153. package/dist/modes/interactive/interactive-mode.d.ts +1 -0
  154. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  155. package/dist/modes/interactive/interactive-mode.js +94 -17
  156. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  157. package/dist/modes/rpc/rpc-client.d.ts +13 -8
  158. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  159. package/dist/modes/rpc/rpc-client.js +8 -1
  160. package/dist/modes/rpc/rpc-client.js.map +1 -1
  161. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  162. package/dist/modes/rpc/rpc-mode.js +4 -0
  163. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  164. package/dist/modes/rpc/rpc-types.d.ts +14 -3
  165. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  166. package/dist/modes/rpc/rpc-types.js.map +1 -1
  167. package/dist/utils/git-env.d.ts +10 -0
  168. package/dist/utils/git-env.d.ts.map +1 -0
  169. package/dist/utils/git-env.js +33 -0
  170. package/dist/utils/git-env.js.map +1 -0
  171. package/docs/compaction.md +185 -50
  172. package/docs/custom-provider.md +11 -9
  173. package/docs/extensions.md +46 -42
  174. package/docs/index.md +13 -6
  175. package/docs/json.md +15 -12
  176. package/docs/packages.md +2 -0
  177. package/docs/providers.md +4 -1
  178. package/docs/quickstart.md +18 -11
  179. package/docs/rpc.md +38 -23
  180. package/docs/sdk.md +17 -8
  181. package/docs/session-format.md +26 -13
  182. package/docs/sessions.md +3 -3
  183. package/docs/settings.md +2 -2
  184. package/docs/skills.md +1 -15
  185. package/docs/termux.md +9 -10
  186. package/docs/themes.md +2 -2
  187. package/docs/tmux.md +3 -3
  188. package/docs/tui.md +19 -32
  189. package/docs/usage.md +2 -2
  190. package/docs/workflows.md +60 -16
  191. package/package.json +6 -12
  192. package/dist/builtin/subagents/skills/browser-use/SKILL.md +0 -234
  193. package/dist/builtin/subagents/skills/browser-use/references/cdp-python.md +0 -76
  194. package/dist/builtin/subagents/skills/browser-use/references/multi-session.md +0 -92
  195. package/node_modules/@earendil-works/pi-tui/README.md +0 -779
  196. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts +0 -54
  197. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts.map +0 -1
  198. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js +0 -632
  199. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js.map +0 -1
  200. package/node_modules/@earendil-works/pi-tui/dist/components/box.d.ts +0 -22
  201. package/node_modules/@earendil-works/pi-tui/dist/components/box.d.ts.map +0 -1
  202. package/node_modules/@earendil-works/pi-tui/dist/components/box.js +0 -104
  203. package/node_modules/@earendil-works/pi-tui/dist/components/box.js.map +0 -1
  204. package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.d.ts +0 -22
  205. package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.d.ts.map +0 -1
  206. package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.js +0 -35
  207. package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.js.map +0 -1
  208. package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts +0 -249
  209. package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts.map +0 -1
  210. package/node_modules/@earendil-works/pi-tui/dist/components/editor.js +0 -1857
  211. package/node_modules/@earendil-works/pi-tui/dist/components/editor.js.map +0 -1
  212. package/node_modules/@earendil-works/pi-tui/dist/components/image.d.ts +0 -28
  213. package/node_modules/@earendil-works/pi-tui/dist/components/image.d.ts.map +0 -1
  214. package/node_modules/@earendil-works/pi-tui/dist/components/image.js +0 -89
  215. package/node_modules/@earendil-works/pi-tui/dist/components/image.js.map +0 -1
  216. package/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts +0 -37
  217. package/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts.map +0 -1
  218. package/node_modules/@earendil-works/pi-tui/dist/components/input.js +0 -378
  219. package/node_modules/@earendil-works/pi-tui/dist/components/input.js.map +0 -1
  220. package/node_modules/@earendil-works/pi-tui/dist/components/loader.d.ts +0 -31
  221. package/node_modules/@earendil-works/pi-tui/dist/components/loader.d.ts.map +0 -1
  222. package/node_modules/@earendil-works/pi-tui/dist/components/loader.js +0 -69
  223. package/node_modules/@earendil-works/pi-tui/dist/components/loader.js.map +0 -1
  224. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts +0 -96
  225. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts.map +0 -1
  226. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js +0 -644
  227. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js.map +0 -1
  228. package/node_modules/@earendil-works/pi-tui/dist/components/select-list.d.ts +0 -50
  229. package/node_modules/@earendil-works/pi-tui/dist/components/select-list.d.ts.map +0 -1
  230. package/node_modules/@earendil-works/pi-tui/dist/components/select-list.js +0 -159
  231. package/node_modules/@earendil-works/pi-tui/dist/components/select-list.js.map +0 -1
  232. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts +0 -50
  233. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts.map +0 -1
  234. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js +0 -185
  235. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js.map +0 -1
  236. package/node_modules/@earendil-works/pi-tui/dist/components/spacer.d.ts +0 -12
  237. package/node_modules/@earendil-works/pi-tui/dist/components/spacer.d.ts.map +0 -1
  238. package/node_modules/@earendil-works/pi-tui/dist/components/spacer.js +0 -23
  239. package/node_modules/@earendil-works/pi-tui/dist/components/spacer.js.map +0 -1
  240. package/node_modules/@earendil-works/pi-tui/dist/components/text.d.ts +0 -19
  241. package/node_modules/@earendil-works/pi-tui/dist/components/text.d.ts.map +0 -1
  242. package/node_modules/@earendil-works/pi-tui/dist/components/text.js +0 -89
  243. package/node_modules/@earendil-works/pi-tui/dist/components/text.js.map +0 -1
  244. package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.d.ts +0 -13
  245. package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.d.ts.map +0 -1
  246. package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.js +0 -51
  247. package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.js.map +0 -1
  248. package/node_modules/@earendil-works/pi-tui/dist/editor-component.d.ts +0 -39
  249. package/node_modules/@earendil-works/pi-tui/dist/editor-component.d.ts.map +0 -1
  250. package/node_modules/@earendil-works/pi-tui/dist/editor-component.js +0 -2
  251. package/node_modules/@earendil-works/pi-tui/dist/editor-component.js.map +0 -1
  252. package/node_modules/@earendil-works/pi-tui/dist/fuzzy.d.ts +0 -16
  253. package/node_modules/@earendil-works/pi-tui/dist/fuzzy.d.ts.map +0 -1
  254. package/node_modules/@earendil-works/pi-tui/dist/fuzzy.js +0 -110
  255. package/node_modules/@earendil-works/pi-tui/dist/fuzzy.js.map +0 -1
  256. package/node_modules/@earendil-works/pi-tui/dist/index.d.ts +0 -23
  257. package/node_modules/@earendil-works/pi-tui/dist/index.d.ts.map +0 -1
  258. package/node_modules/@earendil-works/pi-tui/dist/index.js +0 -32
  259. package/node_modules/@earendil-works/pi-tui/dist/index.js.map +0 -1
  260. package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts +0 -193
  261. package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts.map +0 -1
  262. package/node_modules/@earendil-works/pi-tui/dist/keybindings.js +0 -174
  263. package/node_modules/@earendil-works/pi-tui/dist/keybindings.js.map +0 -1
  264. package/node_modules/@earendil-works/pi-tui/dist/keys.d.ts +0 -184
  265. package/node_modules/@earendil-works/pi-tui/dist/keys.d.ts.map +0 -1
  266. package/node_modules/@earendil-works/pi-tui/dist/keys.js +0 -1173
  267. package/node_modules/@earendil-works/pi-tui/dist/keys.js.map +0 -1
  268. package/node_modules/@earendil-works/pi-tui/dist/kill-ring.d.ts +0 -28
  269. package/node_modules/@earendil-works/pi-tui/dist/kill-ring.d.ts.map +0 -1
  270. package/node_modules/@earendil-works/pi-tui/dist/kill-ring.js +0 -44
  271. package/node_modules/@earendil-works/pi-tui/dist/kill-ring.js.map +0 -1
  272. package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.d.ts +0 -3
  273. package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.d.ts.map +0 -1
  274. package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.js +0 -53
  275. package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.js.map +0 -1
  276. package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.d.ts +0 -50
  277. package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.d.ts.map +0 -1
  278. package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.js +0 -361
  279. package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.js.map +0 -1
  280. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts +0 -90
  281. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts.map +0 -1
  282. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +0 -366
  283. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js.map +0 -1
  284. package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts +0 -113
  285. package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts.map +0 -1
  286. package/node_modules/@earendil-works/pi-tui/dist/terminal.js +0 -472
  287. package/node_modules/@earendil-works/pi-tui/dist/terminal.js.map +0 -1
  288. package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts +0 -227
  289. package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts.map +0 -1
  290. package/node_modules/@earendil-works/pi-tui/dist/tui.js +0 -1106
  291. package/node_modules/@earendil-works/pi-tui/dist/tui.js.map +0 -1
  292. package/node_modules/@earendil-works/pi-tui/dist/undo-stack.d.ts +0 -17
  293. package/node_modules/@earendil-works/pi-tui/dist/undo-stack.d.ts.map +0 -1
  294. package/node_modules/@earendil-works/pi-tui/dist/undo-stack.js +0 -25
  295. package/node_modules/@earendil-works/pi-tui/dist/undo-stack.js.map +0 -1
  296. package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts +0 -84
  297. package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts.map +0 -1
  298. package/node_modules/@earendil-works/pi-tui/dist/utils.js +0 -1029
  299. package/node_modules/@earendil-works/pi-tui/dist/utils.js.map +0 -1
  300. package/node_modules/@earendil-works/pi-tui/dist/word-navigation.d.ts +0 -25
  301. package/node_modules/@earendil-works/pi-tui/dist/word-navigation.d.ts.map +0 -1
  302. package/node_modules/@earendil-works/pi-tui/dist/word-navigation.js +0 -96
  303. package/node_modules/@earendil-works/pi-tui/dist/word-navigation.js.map +0 -1
  304. package/node_modules/@earendil-works/pi-tui/native/darwin/prebuilds/darwin-arm64/darwin-modifiers.node +0 -0
  305. package/node_modules/@earendil-works/pi-tui/native/darwin/prebuilds/darwin-x64/darwin-modifiers.node +0 -0
  306. package/node_modules/@earendil-works/pi-tui/native/win32/prebuilds/win32-arm64/win32-console-mode.node +0 -0
  307. package/node_modules/@earendil-works/pi-tui/native/win32/prebuilds/win32-x64/win32-console-mode.node +0 -0
  308. package/node_modules/@earendil-works/pi-tui/package.json +0 -47
  309. package/node_modules/get-east-asian-width/index.d.ts +0 -60
  310. package/node_modules/get-east-asian-width/index.js +0 -30
  311. package/node_modules/get-east-asian-width/license +0 -9
  312. package/node_modules/get-east-asian-width/lookup-data.js +0 -21
  313. package/node_modules/get-east-asian-width/lookup.js +0 -138
  314. package/node_modules/get-east-asian-width/package.json +0 -71
  315. package/node_modules/get-east-asian-width/readme.md +0 -65
  316. package/node_modules/get-east-asian-width/utilities.js +0 -24
  317. package/node_modules/marked/LICENSE.md +0 -44
  318. package/node_modules/marked/README.md +0 -106
  319. package/node_modules/marked/bin/main.js +0 -282
  320. package/node_modules/marked/bin/marked.js +0 -15
  321. package/node_modules/marked/lib/marked.cjs +0 -2211
  322. package/node_modules/marked/lib/marked.cjs.map +0 -7
  323. package/node_modules/marked/lib/marked.d.cts +0 -728
  324. package/node_modules/marked/lib/marked.d.ts +0 -728
  325. package/node_modules/marked/lib/marked.esm.js +0 -2189
  326. package/node_modules/marked/lib/marked.esm.js.map +0 -7
  327. package/node_modules/marked/lib/marked.umd.js +0 -2213
  328. package/node_modules/marked/lib/marked.umd.js.map +0 -7
  329. package/node_modules/marked/man/marked.1 +0 -111
  330. package/node_modules/marked/man/marked.1.md +0 -92
  331. package/node_modules/marked/marked.min.js +0 -69
  332. package/node_modules/marked/package.json +0 -111
package/docs/sdk.md CHANGED
@@ -39,22 +39,29 @@ await session.prompt("What files are in the current directory?");
39
39
 
40
40
  ## Installation
41
41
 
42
- Choose npm, Bun, or pnpm:
42
+ Install `@bastani/atomic` as a project dependency with npm, pnpm, or Bun:
43
+
44
+ With npm:
43
45
 
44
46
  ```bash
45
- # npm
46
47
  npm install @bastani/atomic
48
+ ```
47
49
 
48
- # Bun
49
- bun add @bastani/atomic
50
+ With pnpm:
50
51
 
51
- # pnpm
52
+ ```bash
52
53
  pnpm add @bastani/atomic
53
54
  ```
54
55
 
56
+ With Bun:
57
+
58
+ ```bash
59
+ bun add @bastani/atomic
60
+ ```
61
+
55
62
  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.
56
63
 
57
- The SDK is included in the main package. No separate installation needed.
64
+ The SDK is included in the main package. No separate SDK package is needed.
58
65
 
59
66
  ## Core Concepts
60
67
 
@@ -116,8 +123,8 @@ interface AgentSession {
116
123
  // In-place tree navigation within the current session file
117
124
  navigateTree(targetId: string, options?: { summarize?: boolean; customInstructions?: string; replaceInstructions?: boolean; label?: string }): Promise<{ editorText?: string; cancelled: boolean }>;
118
125
 
119
- // Compaction
120
- compact(customInstructions?: string): Promise<CompactionResult>;
126
+ // Verbatim Compaction (deletion-only Context Compaction)
127
+ compact(): Promise<ContextCompactionResult>;
121
128
  abortCompaction(): void;
122
129
 
123
130
  // Abort current operation
@@ -128,6 +135,8 @@ interface AgentSession {
128
135
  }
129
136
  ```
130
137
 
138
+ `compact()` accepts no custom summary instructions. It runs the same transcript-bound Verbatim Compaction planner as `/compact`: inspect transcript slices, record exact deletion targets, validate them locally, append a `context_compaction` entry, and rebuild active context with retained content unchanged.
139
+
131
140
  Session replacement APIs such as new-session, resume, fork, and import live on `AgentSessionRuntime`, not on `AgentSession`.
132
141
 
133
142
  ### createAgentSessionRuntime() and AgentSessionRuntime
@@ -28,13 +28,11 @@ Existing sessions are automatically migrated to the current version (v3) when lo
28
28
 
29
29
  ## Source Files
30
30
 
31
- Source on GitHub ([pi-mono](https://github.com/earendil-works/pi-mono)):
32
- - [`packages/coding-agent/src/core/session-manager.ts`](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/session-manager.ts) - Session entry types and SessionManager
33
- - [`packages/coding-agent/src/core/messages.ts`](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/messages.ts) - Extended message types (BashExecutionMessage, CustomMessage, etc.)
34
- - [`packages/ai/src/types.ts`](https://github.com/earendil-works/pi-mono/blob/main/packages/ai/src/types.ts) - Base message types (UserMessage, AssistantMessage, ToolResultMessage)
35
- - [`packages/agent/src/types.ts`](https://github.com/earendil-works/pi-mono/blob/main/packages/agent/src/types.ts) - AgentMessage union type
31
+ Source on GitHub ([atomic](https://github.com/bastani-inc/atomic)):
32
+ - [`packages/coding-agent/src/core/session-manager.ts`](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/src/core/session-manager.ts) - Session entry types and SessionManager
33
+ - [`packages/coding-agent/src/core/messages.ts`](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/src/core/messages.ts) - Extended message types (BashExecutionMessage, CustomMessage, etc.)
36
34
 
37
- For TypeScript definitions in your project, inspect `node_modules/@bastani/atomic/dist/` and `node_modules/@earendil-works/pi-ai/dist/`.
35
+ Base message and agent event types are provided by Atomic's installed runtime dependencies (`@earendil-works/pi-ai` and `@earendil-works/pi-agent-core`), not by separate `packages/ai` or `packages/agent` directories in this monorepo. For TypeScript definitions in your project, inspect `node_modules/@bastani/atomic/dist/`, `node_modules/@earendil-works/pi-ai/dist/`, and `node_modules/@earendil-works/pi-agent-core/dist/`.
38
36
 
39
37
  ## Message Types
40
38
 
@@ -69,7 +67,7 @@ interface ToolCall {
69
67
  }
70
68
  ```
71
69
 
72
- ### Base Message Types (from pi-ai)
70
+ ### Base Message Types (from `@earendil-works/pi-ai`)
73
71
 
74
72
  ```typescript
75
73
  interface UserMessage {
@@ -116,7 +114,7 @@ interface Usage {
116
114
  }
117
115
  ```
118
116
 
119
- ### Extended Message Types (from pi-coding-agent)
117
+ ### Extended Message Types (from Atomic coding-agent)
120
118
 
121
119
  ```typescript
122
120
  interface BashExecutionMessage {
@@ -225,7 +223,7 @@ Emitted when the user changes the thinking/reasoning level.
225
223
 
226
224
  ### CompactionEntry
227
225
 
228
- Created when context is compacted. Stores a summary of earlier messages.
226
+ Legacy summary-compaction entry. Stores a generated summary of earlier messages for older APIs and extension hooks. Default `/compact` and auto-compaction now create `ContextCompactionEntry` records instead.
229
227
 
230
228
  ```json
231
229
  {"type":"compaction","id":"f6g7h8i9","parentId":"e5f6g7h8","timestamp":"2024-12-03T14:10:00.000Z","summary":"User discussed X, Y, Z...","firstKeptEntryId":"c3d4e5f6","tokensBefore":50000}
@@ -233,7 +231,17 @@ Created when context is compacted. Stores a summary of earlier messages.
233
231
 
234
232
  Optional fields:
235
233
  - `details`: Implementation-specific data (e.g., `{ readFiles: string[], modifiedFiles: string[] }` for default, or custom data for extensions)
236
- - `fromHook`: `true` if generated by an extension, `false`/`undefined` if pi-generated (legacy field name)
234
+ - `fromHook`: `true` if generated by an extension, `false`/`undefined` if Atomic-generated (legacy field name)
235
+
236
+ ### ContextCompactionEntry
237
+
238
+ Created by `/compact`, RPC compaction commands, and auto-compaction. Stores Atomic's default **Verbatim Compaction** data: validated logical deletion targets, not replacement text. The internal planner can search/read transcript slices and record exact entry/content-block targets with transcript-bound tools; Atomic validates those targets locally before saving. During `buildSessionContext()`, matching entries/content blocks are filtered from active LLM context while retained content remains verbatim. This deletion-only Context Compaction approach is informed by Morph's write-up at [Morph's Context Compaction](https://www.morphllm.com/context-compaction).
239
+
240
+ ```json
241
+ {"type":"context_compaction","id":"ctx12345","parentId":"f6g7h8i9","timestamp":"2024-12-03T14:12:00.000Z","promptVersion":1,"deletedTargets":[{"kind":"entry","entryId":"b2c3d4e5"}],"protectedEntryIds":["a1b2c3d4"],"stats":{"objectsBefore":20,"objectsAfter":19,"objectsDeleted":1,"tokensBefore":50000,"tokensAfter":43000,"percentReduction":14},"backupPath":"/path/session.jsonl.2024-12-03T14-12-00-000Z.compact.bak"}
242
+ ```
243
+
244
+ `deletedTargets` entries are either whole entries (`{ kind: "entry", entryId }`) or content blocks (`{ kind: "content_block", entryId, blockIndex }`). The JSONL file remains append-only; this is logical deletion for active context rebuild.
237
245
 
238
246
  ### BranchSummaryEntry
239
247
 
@@ -245,7 +253,7 @@ Created when switching branches via `/tree` with an LLM generated summary of the
245
253
 
246
254
  Optional fields:
247
255
  - `details`: File tracking data (`{ readFiles: string[], modifiedFiles: string[] }`) for default, or custom data for extensions
248
- - `fromHook`: `true` if generated by an extension, `false`/`undefined` if pi-generated (legacy field name)
256
+ - `fromHook`: `true` if generated by an extension, `false`/`undefined` if Atomic-generated (legacy field name)
249
257
 
250
258
  ### CustomEntry
251
259
 
@@ -314,7 +322,8 @@ Entries form a tree:
314
322
  - Emits the summary first
315
323
  - Then messages from `firstKeptEntryId` to compaction
316
324
  - Then messages after compaction
317
- 4. Converts `BranchSummaryEntry` and `CustomMessageEntry` to appropriate message formats
325
+ 4. Applies `ContextCompactionEntry` logical deletions recorded after the latest summary compaction
326
+ 5. Converts `BranchSummaryEntry` and `CustomMessageEntry` to appropriate message formats
318
327
 
319
328
  ## Parsing Example
320
329
 
@@ -336,6 +345,9 @@ for (const line of lines) {
336
345
  case "compaction":
337
346
  console.log(`[${entry.id}] Compaction: ${entry.tokensBefore} tokens summarized`);
338
347
  break;
348
+ case "context_compaction":
349
+ console.log(`[${entry.id}] Context compaction: ${entry.stats.objectsDeleted} objects deleted`);
350
+ break;
339
351
  case "branch_summary":
340
352
  console.log(`[${entry.id}] Branch from ${entry.fromId}`);
341
353
  break;
@@ -382,7 +394,8 @@ Key methods for working with sessions programmatically.
382
394
  - `appendMessage(message)` - Add message
383
395
  - `appendThinkingLevelChange(level)` - Record thinking change
384
396
  - `appendModelChange(provider, modelId)` - Record model change
385
- - `appendCompaction(summary, firstKeptEntryId, tokensBefore, details?, fromHook?)` - Add compaction
397
+ - `appendCompaction(summary, firstKeptEntryId, tokensBefore, details?, fromHook?)` - Add summary compaction
398
+ - `appendContextCompaction(deletedTargets, protectedEntryIds, stats, backupPath?)` - Add logical deletion compaction
386
399
  - `appendCustomEntry(customType, data?)` - Extension state (not in context)
387
400
  - `appendSessionInfo(name)` - Set session display name
388
401
  - `appendCustomMessageEntry(customType, content, display, details?)` - Extension message (in context)
package/docs/sessions.md CHANGED
@@ -29,7 +29,7 @@ For the JSONL file format and SessionManager API, see [Session Format](/session-
29
29
  | `/tree` | Navigate the current session tree |
30
30
  | `/fork` | Create a new session from a previous user message |
31
31
  | `/clone` | Duplicate the current active branch into a new session |
32
- | `/compact [prompt]` | Summarize older context; see [Compaction](/compaction) |
32
+ | `/compact` | Apply Verbatim Compaction with transcript-bound, validated logical deletions; see [Compaction](/compaction) |
33
33
  | `/export [file]` | Export session to HTML |
34
34
  | `/share` | Upload as private GitHub gist with shareable HTML link |
35
35
 
@@ -128,10 +128,10 @@ When prompted, choose one of:
128
128
  2. summarize with the default prompt
129
129
  3. summarize with custom focus instructions
130
130
 
131
- See [Compaction](/compaction) for branch summarization internals and extension hooks.
131
+ See [Compaction](/compaction) for Verbatim Compaction, branch summarization internals, and extension hooks.
132
132
 
133
133
  ## Session Format
134
134
 
135
- Session files are JSONL and contain message entries, model changes, thinking-level changes, labels, compactions, branch summaries, and extension entries.
135
+ Session files are JSONL and contain message entries, model changes, thinking-level changes, labels, summary compactions, context compactions, branch summaries, and extension entries.
136
136
 
137
137
  For parsers, extensions, SDK usage, and the full SessionManager API, see [Session Format](/session-format).
package/docs/settings.md CHANGED
@@ -90,9 +90,9 @@ Set `ATOMIC_SKIP_VERSION_CHECK=1` to disable the Atomic version update check. Us
90
90
 
91
91
  | Setting | Type | Default | Description |
92
92
  |---------|------|---------|-------------|
93
- | `compaction.enabled` | boolean | `true` | Enable auto-compaction |
93
+ | `compaction.enabled` | boolean | `true` | Enable automatic Verbatim Compaction |
94
94
  | `compaction.reserveTokens` | number | `16384` | Tokens reserved for LLM response |
95
- | `compaction.keepRecentTokens` | number | `20000` | Recent tokens to keep (not summarized) |
95
+ | `compaction.keepRecentTokens` | number | `20000` | Legacy summary-compaction retained-token budget; default Verbatim Compaction protects recent entries structurally |
96
96
 
97
97
  ```json
98
98
  {
package/docs/skills.md CHANGED
@@ -116,16 +116,9 @@ description: What this skill does and when to use it. Be specific.
116
116
 
117
117
  ## Setup
118
118
 
119
- Run once before first use (choose one):
119
+ Run once before first use:
120
120
  ```bash
121
- # npm
122
- cd /path/to/skill && npm install
123
-
124
- # Bun
125
121
  cd /path/to/skill && bun install
126
-
127
- # pnpm
128
- cd /path/to/skill && pnpm install
129
122
  ```
130
123
 
131
124
  ## Usage
@@ -216,14 +209,7 @@ description: Web search and content extraction via Brave Search API. Use for sea
216
209
  ## Setup
217
210
 
218
211
  ```bash
219
- # npm
220
- cd /path/to/brave-search && npm install
221
-
222
- # Bun
223
212
  cd /path/to/brave-search && bun install
224
-
225
- # pnpm
226
- cd /path/to/brave-search && pnpm install
227
213
  ```
228
214
 
229
215
  ## Search
package/docs/termux.md CHANGED
@@ -16,16 +16,11 @@ pkg update && pkg upgrade
16
16
  # Install dependencies
17
17
  pkg install nodejs termux-api git
18
18
 
19
- # Install Atomic (choose one package manager available in Termux)
20
- # npm is installed by `pkg install nodejs`; Bun and pnpm must be installed separately before using those commands.
21
- # npm
19
+ # Install Atomic with npm (included with Termux's nodejs package)
22
20
  npm install -g @bastani/atomic
23
21
 
24
- # Bun
25
- bun install -g @bastani/atomic
26
-
27
- # pnpm
28
- pnpm add -g @bastani/atomic
22
+ # If you have installed Bun separately in Termux, you can use Bun instead:
23
+ # bun add -g @bastani/atomic
29
24
 
30
25
  # Create config directory
31
26
  mkdir -p ~/.atomic/agent
@@ -129,9 +124,13 @@ Run once to grant storage permissions:
129
124
  termux-setup-storage
130
125
  ```
131
126
 
132
- ### Node.js installation issues
127
+ ### Package installation issues
128
+
129
+ Termux does not currently provide an official `pkg install bun` package. On a fresh Termux install, use npm from the `nodejs` package; use Bun only if you installed it separately for your device.
130
+
131
+ If npm fails, try clearing the cache before retrying:
133
132
 
134
- If npm fails, try clearing the cache:
135
133
  ```bash
136
134
  npm cache clean --force
135
+ npm install -g @bastani/atomic
137
136
  ```
package/docs/themes.md CHANGED
@@ -52,7 +52,7 @@ vim ~/.atomic/agent/themes/my-theme.json
52
52
 
53
53
  ```json
54
54
  {
55
- "$schema": "https://raw.githubusercontent.com/earendil-works/pi/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
55
+ "$schema": "https://raw.githubusercontent.com/bastani-inc/atomic/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
56
56
  "name": "my-theme",
57
57
  "vars": {
58
58
  "primary": "#00aaff",
@@ -122,7 +122,7 @@ vim ~/.atomic/agent/themes/my-theme.json
122
122
 
123
123
  ```json
124
124
  {
125
- "$schema": "https://raw.githubusercontent.com/earendil-works/pi/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
125
+ "$schema": "https://raw.githubusercontent.com/bastani-inc/atomic/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
126
126
  "name": "my-theme",
127
127
  "vars": {
128
128
  "blue": "#0066cc",
package/docs/tmux.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # tmux Setup
2
2
 
3
- Pi works inside tmux, but tmux strips modifier information from certain keys by default. Without configuration, `SHIFT+Enter` and `CTRL+Enter` are usually indistinguishable from plain `Enter`.
3
+ Atomic works inside tmux, but tmux strips modifier information from certain keys by default. Without configuration, `SHIFT+Enter` and `CTRL+Enter` are usually indistinguishable from plain `Enter`.
4
4
 
5
5
  ## Recommended Configuration
6
6
 
@@ -18,7 +18,7 @@ tmux kill-server
18
18
  tmux
19
19
  ```
20
20
 
21
- Pi requests extended key reporting automatically when Kitty keyboard protocol is not available. With `extended-keys-format csi-u`, tmux forwards modified keys in CSI-u format, which is the most reliable configuration.
21
+ Atomic requests extended key reporting automatically when Kitty keyboard protocol is not available. With `extended-keys-format csi-u`, tmux forwards modified keys in CSI-u format, which is the most reliable configuration.
22
22
 
23
23
  ## Why `csi-u` Is Recommended
24
24
 
@@ -40,7 +40,7 @@ With `extended-keys-format csi-u`, the same keys are forwarded as:
40
40
  - `CTRL+D` → `\x1b[100;5u`
41
41
  - `CTRL+Enter` → `\x1b[13;5u`
42
42
 
43
- Pi supports both formats, but `csi-u` is the recommended tmux setup.
43
+ Atomic supports both formats, but `csi-u` is the recommended tmux setup.
44
44
 
45
45
  ## What This Fixes
46
46
 
package/docs/tui.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  Extensions and custom tools can render custom TUI components for interactive user interfaces. This page covers the component system and available building blocks.
6
6
 
7
- **Source:** [`@earendil-works/pi-tui`](https://github.com/earendil-works/pi-mono/tree/main/packages/tui)
7
+ **Source:** TUI components are provided by Atomic's installed `@earendil-works/pi-tui` runtime dependency (`node_modules/@earendil-works/pi-tui/dist/`).
8
8
 
9
9
  ## Component Interface
10
10
 
@@ -86,27 +86,18 @@ Without this propagation, typing with an IME (Chinese, Japanese, Korean, etc.) w
86
86
 
87
87
  ## Using Components
88
88
 
89
- **In extensions** via `ctx.ui.custom()`:
89
+ Use `ctx.ui.custom()` with a component factory. The factory receives `done(result)`, and `ctx.ui.custom()` resolves with that result when the component finishes:
90
90
 
91
91
  ```typescript
92
92
  pi.on("session_start", async (_event, ctx) => {
93
- const handle = ctx.ui.custom(myComponent);
94
- // handle.requestRender() - trigger re-render
95
- // handle.close() - restore normal UI
93
+ const result = await ctx.ui.custom((tui, theme, keybindings, done) => {
94
+ return new MyComponent(done);
95
+ });
96
+ ctx.ui.notify(`Selected: ${result}`, "info");
96
97
  });
97
98
  ```
98
99
 
99
- **In custom tools** via `pi.ui.custom()`:
100
-
101
- ```typescript
102
- async execute(toolCallId, params, onUpdate, ctx, signal) {
103
- const handle = pi.ui.custom(myComponent);
104
- // ...
105
- handle.close();
106
- }
107
- ```
108
-
109
- Pass `{ signal }` to `ctx.ui.custom()` when the UI belongs to an abortable tool or operation. If the signal aborts, Atomic dismisses the custom UI and rejects the returned promise with the signal reason.
100
+ Pass `{ signal }` to `ctx.ui.custom()` when the UI belongs to an abortable operation. If the signal aborts, Atomic dismisses the custom UI and rejects the returned promise with the signal reason. For overlays, use `options.onHandle` to receive an overlay handle for programmatic visibility control.
110
101
 
111
102
  ## Overlays
112
103
 
@@ -371,20 +362,15 @@ pi.registerCommand("pick", {
371
362
  const items = ["Option A", "Option B", "Option C"];
372
363
  const selector = new MySelector(items);
373
364
 
374
- let handle: { close: () => void; requestRender: () => void };
375
-
376
- await new Promise<void>((resolve) => {
377
- selector.onSelect = (item) => {
378
- ctx.ui.notify(`Selected: ${item}`, "info");
379
- handle.close();
380
- resolve();
381
- };
382
- selector.onCancel = () => {
383
- handle.close();
384
- resolve();
385
- };
386
- handle = ctx.ui.custom(selector);
365
+ const selected = await ctx.ui.custom<string | undefined>((_tui, _theme, _keybindings, done) => {
366
+ selector.onSelect = (item) => done(item);
367
+ selector.onCancel = () => done(undefined);
368
+ return selector;
387
369
  });
370
+
371
+ if (selected) {
372
+ ctx.ui.notify(`Selected: ${selected}`, "info");
373
+ }
388
374
  }
389
375
  });
390
376
  ```
@@ -450,10 +436,11 @@ interface MyTheme {
450
436
  Set `PI_TUI_WRITE_LOG` to capture the raw ANSI stream written to stdout.
451
437
 
452
438
  ```bash
453
- # Upstream pi-tui debug env example
454
- PI_TUI_WRITE_LOG=/tmp/tui-ansi.log bunx tsx packages/tui/test/chat-simple.ts
439
+ PI_TUI_WRITE_LOG=/tmp/tui-ansi.log atomic
455
440
  ```
456
441
 
442
+ Atomic vendors TUI components through the installed `@earendil-works/pi-tui` dependency; this monorepo does not include the upstream TUI test source tree.
443
+
457
444
  ## Performance
458
445
 
459
446
  Cache rendered output when possible:
@@ -480,7 +467,7 @@ class CachedComponent {
480
467
  }
481
468
  ```
482
469
 
483
- Call `invalidate()` when state changes, then `handle.requestRender()` to trigger re-render.
470
+ Call `invalidate()` when state changes, then `ctx.ui.requestRender()` from the extension context or `tui.requestRender()` from a `ctx.ui.custom()` factory to trigger re-render.
484
471
 
485
472
  ## Invalidation and Theme Changes
486
473
 
package/docs/usage.md CHANGED
@@ -48,7 +48,7 @@ Type `/` in the editor to open command completion. Extensions can register custo
48
48
  | `/tree` | Jump to any point in the session and continue from there |
49
49
  | `/fork` | Create a new session from a previous user message |
50
50
  | `/clone` | Duplicate the current active branch into a new session |
51
- | `/compact [prompt]` | Manually compact context, optionally with custom instructions |
51
+ | `/compact` | Run Verbatim Compaction with transcript-bound deletion tools |
52
52
  | `/copy` | Copy last assistant message to clipboard |
53
53
  | `/export [file]` | Export session to HTML |
54
54
  | `/share` | Upload as private GitHub gist with shareable HTML link |
@@ -89,7 +89,7 @@ Useful session commands:
89
89
  - `/tree` navigates the in-file session tree and can summarize abandoned branches.
90
90
  - `/fork` creates a new session from an earlier user message.
91
91
  - `/clone` duplicates the current active branch into a new session file.
92
- - `/compact` summarizes older messages to free context.
92
+ - `/compact` uses Verbatim Compaction: a fixed no-argument deletion-only planner searches/reads transcript slices, records exact deletion targets, and applies only locally validated logical deletions. Retained transcript content stays verbatim. Atomic's approach is informed by Morph's Context Compaction article: [Morph's Context Compaction](https://www.morphllm.com/context-compaction).
93
93
 
94
94
  See [Sessions](/sessions) and [Compaction](/compaction) for details.
95
95
 
package/docs/workflows.md CHANGED
@@ -153,8 +153,8 @@ For the builtin result tables below, `deep-research-codebase`, `goal`, and `ralp
153
153
  |---|---|---|
154
154
  | `deep-research-codebase` | Scout + research-history chain → parallel specialist waves → aggregator. Indexes the whole repo and synthesizes findings. | Broad or cross-cutting research before you decide what to change. Prefer `/skill:research-codebase` for one subsystem. |
155
155
  | `goal` | Persisted goal ledger → bounded worker turns → receipts → three-reviewer gate → deterministic reducer → final report. | Small-to-medium scope changes when you can identify the work surface, state the exact outcome, and name the validation that proves it is done — for example tests, lint/typecheck, docs builds, or observable behavior. |
156
- | `ralph` | RFC planning → sub-agent orchestration → simplification → parallel review → PR handoff. | Larger migrations, broad refactors, multi-package changes, and spec-to-PR work where you want Atomic to plan the approach, delegate implementation through sub-agents, simplify, review, iterate, and prepare a pull-request report. |
157
- | `open-claude-design` | Design-system onboarding → reference import → HTML generation → impeccable-driven refinement → quality gate → rich HTML handoff. Renders a live `preview.html` you can iterate against (opens through `browser-use` when available). | UI, page, component, theme, or design-token work that benefits from generation + critique loops. |
156
+ | `ralph` | RFC planning → sub-agent orchestration → simplification → parallel review → optional final-stage PR handoff. | Larger migrations, broad refactors, multi-package changes, and spec-to-reviewed-change work where you want Atomic to plan the approach, delegate implementation through sub-agents, simplify, review, iterate, and optionally allow only the final `pull-request` stage to attempt PR creation with `create_pr=true`. |
157
+ | `open-claude-design` | Design-system onboarding → reference import → HTML generation → impeccable-driven refinement → quality gate → rich HTML handoff. Renders a live `preview.html` you can iterate against (opens through `browser` when available). | UI, page, component, theme, or design-token work that benefits from generation + critique loops. |
158
158
 
159
159
  ### `deep-research-codebase`
160
160
 
@@ -248,20 +248,21 @@ Inputs:
248
248
 
249
249
  | Input | Type | Required | Default | Description |
250
250
  |---|---|---|---|---|
251
- | `prompt` | text | yes | — | Task, feature request, issue summary, or spec path to plan, execute, refine, review, and prepare for PR. |
252
- | `max_loops` | number | no | `10` | Maximum plan/orchestrate/review iterations before the workflow proceeds to PR handoff without reviewer approval. |
253
- | `base_branch` | string | no | `origin/main` | Branch reviewers and the PR-prep stage compare the current code delta against; also used to create a missing worktree. |
251
+ | `prompt` | text | yes | — | Task, feature request, issue summary, or spec path to plan, execute, refine, and review. |
252
+ | `max_loops` | number | no | `10` | Maximum plan/orchestrate/review iterations before the workflow completes or, when enabled, proceeds to final handoff without reviewer approval. |
253
+ | `base_branch` | string | no | `origin/main` | Branch reviewers and the optional final stage compare the current code delta against; also used to create a missing worktree. |
254
254
  | `git_worktree_dir` | string | no | `""` | Optional reusable Git worktree root. Empty runs in the invoking checkout; non-empty values run Ralph stages in the created/reused worktree. |
255
+ | `create_pr` | boolean | no | `false` | Safe-by-default PR creation flag. Omitted or `false` skips the final `pull-request` stage and omits `pr_report`; prompt text alone does not opt in, and only strict `true` authorizes the final `pull-request` stage to attempt provider-appropriate PR/MR/review creation. |
255
256
 
256
257
  Run examples:
257
258
 
258
259
  ```text
259
260
  /workflow ralph prompt="Plan and migrate the database layer to Drizzle" max_loops=3 base_branch=develop
260
- /workflow ralph prompt="Refactor authentication across the API, CLI, and web UI, then prepare the PR"
261
+ /workflow ralph prompt="Refactor authentication across the API, CLI, and web UI" create_pr=true
261
262
  /workflow ralph prompt="Safely implement the API refactor" git_worktree_dir=../atomic-ralph-api-wt base_branch=main
262
263
  ```
263
264
 
264
- Each `ralph` iteration writes an RFC-style technical design document under `specs/`, initializes an OS-temp implementation notes file, delegates implementation through sub-agents, runs a behavior-preserving code simplifier, and asks two reviewers to inspect the patch directly against `base_branch`. Reviewers discover any needed repository infrastructure themselves while inspecting the actual diff; Ralph no longer runs separate `infra-*` discovery stages. The loop stops when every reviewer approves or `max_loops` is reached, then runs a pull-request preparation stage.
265
+ Each `ralph` iteration writes an RFC-style technical design document under `specs/`, initializes an OS-temp implementation notes file, delegates implementation through sub-agents, runs a behavior-preserving code simplifier, and asks two reviewers to inspect the patch directly against `base_branch`. Reviewers discover any needed repository infrastructure themselves while inspecting the actual diff; Ralph no longer runs separate `infra-*` discovery stages. The loop stops when every reviewer approves or `max_loops` is reached. By default Ralph does not start the final `pull-request` stage, and `pr_report` is omitted. Prompt text alone does not opt in. Pass `create_pr=true` only when you explicitly want the final `pull-request` stage to inspect provider credentials and attempt provider-appropriate PR/MR/review creation, such as GitHub `gh`, Azure Repos `az repos pr create`, or Sapling/Phabricator tooling; Ralph's own PR-creation instructions live in that final stage.
265
266
 
266
267
  Set `git_worktree_dir` when you want Ralph's worker stages isolated in a reusable Git worktree. Relative paths resolve from the invoking repository root, existing same-repository worktree roots are reused, and missing paths are created from `base_branch`. Ralph preserves the invoking repo-relative cwd inside the worktree, so launching from `repo/packages/api` with `git_worktree_dir=../repo-wt` runs stages from `../repo-wt/packages/api`.
267
268
 
@@ -273,13 +274,13 @@ Result fields:
273
274
  | `plan` | Latest RFC-style plan text. |
274
275
  | `plan_path` | Path to the latest generated spec under `specs/`. |
275
276
  | `implementation_notes_path` | OS-temp notes file containing decisions, deviations, blockers, and validation notes. |
276
- | `pr_report` | Pull-request preparation report: diff review, PR status, commands, and follow-up steps. |
277
- | `approved` | Whether the reviewer loop approved before PR handoff. |
277
+ | `pr_report` | Pull-request report emitted only when `create_pr=true` and the final `pull-request` stage runs. |
278
+ | `approved` | Whether the reviewer loop approved before completion or optional final handoff. |
278
279
  | `iterations_completed` | Number of plan/orchestrate/review loops completed. |
279
280
  | `review_report` | Compact reference to the latest reviewer payload artifact. |
280
281
  | `review_report_path` | JSON artifact path for the latest Ralph review round. |
281
282
 
282
- A typical end-to-end flow is `/skill:research-codebase` → `/skill:create-spec` → `/workflow goal objective="Implement the researched rate-limit behavior, run the focused tests, and finish when the documented burst behavior is validated"` when you can identify the work surface, state the exact outcome, and name the validation that proves it is done. Keep using `/workflow ralph` for larger migrations, broad refactors, multi-package changes, and spec-to-PR work where you want Atomic to plan, delegate through sub-agents, simplify, review, iterate, and prepare a pull-request report.
283
+ A typical end-to-end flow is `/skill:research-codebase` → `/skill:create-spec` → `/workflow goal objective="Implement the researched rate-limit behavior, run the focused tests, and finish when the documented burst behavior is validated"` when you can identify the work surface, state the exact outcome, and name the validation that proves it is done. Keep using `/workflow ralph` for larger migrations, broad refactors, multi-package changes, and spec-to-reviewed-change work where you want Atomic to plan, delegate through sub-agents, simplify, review, iterate, and optionally allow only the final `pull-request` stage to attempt PR creation with `create_pr=true`.
283
284
 
284
285
  ### `open-claude-design`
285
286
 
@@ -334,7 +335,7 @@ Use the goal workflow to implement specs/2026-03-rate-limit.md, run the focused
334
335
  ```
335
336
 
336
337
  ```text
337
- Use the ralph workflow to plan a database-layer migration, implement it, review it, and prepare a PR.
338
+ Use the ralph workflow to plan a database-layer migration, implement it, review it, and set `create_pr=true` for final-stage PR handoff.
338
339
  ```
339
340
 
340
341
  ```text
@@ -378,7 +379,7 @@ If the task is only deterministic TypeScript with no LLM/session stage, use a sc
378
379
  |-----------|-----|
379
380
  | Run, inspect, attach to, pause, interrupt, resume, or check status for an existing workflow | `/workflow ...` or `workflow({ action: ... })` |
380
381
  | Implement a small-to-medium scope change with an identifiable work surface, exact outcome, and named validation | `/workflow goal objective="..."` so Atomic keeps the run bounded, captures receipts in a goal ledger, gates completion through reviewers, and stops as `complete`, `blocked`, or `needs_human` |
381
- | Plan and execute a larger migration, broad refactor, multi-package change, or spec-to-PR effort | `/workflow ralph prompt="..."` so Atomic can plan the approach, delegate implementation through sub-agents, simplify, review, iterate, and prepare a pull-request report |
382
+ | Plan and execute a larger migration, broad refactor, multi-package change, or spec-to-reviewed-change effort | `/workflow ralph prompt="..."` so Atomic can plan the approach, delegate implementation through sub-agents, simplify, review, and iterate; prompt text alone does not opt in to PR creation, so add `create_pr=true` only when you want the final `pull-request` stage and `pr_report` |
382
383
  | Create or edit reusable automation | a TypeScript workflow definition exported from `defineWorkflow(...).compile()` |
383
384
  | Track one-off work without saving a workflow file | direct `workflow({ task })`, `workflow({ tasks })`, or `workflow({ chain })` calls |
384
385
  | Make a workflow robust | design the stage graph, context handoffs, artifacts, validation gates, model fallbacks, and human approval points before coding |
@@ -1019,6 +1020,25 @@ Builder basics:
1019
1020
 
1020
1021
  Author workflows to create at least one tracked stage by calling `ctx.task()`, `ctx.chain()`, `ctx.parallel()`, `ctx.stage()`, or `ctx.workflow()` in the run body so each run has graph nodes to inspect, attach to, interrupt, resume, and render.
1021
1022
 
1023
+ ### Guiding Principles
1024
+
1025
+ - Stage prompts should be locally scoped: describe only the current stage's objective, inputs, expected outputs, and success criteria.
1026
+ - Avoid references to other stages unless the current stage explicitly receives and needs that information.
1027
+ - Avoid workflow-specific or stage-specific vocabulary that is not explained inside the current prompt.
1028
+ - Use clear software engineering terminology in self-described prompts.
1029
+ - Avoid hard-coded regular expressions for condition matching when gating reviews or model outputs.
1030
+ - Prefer structured output schemas for review/gate decisions whenever model output needs to be evaluated.
1031
+ - Treat atomic workflow units as language model stages, not deterministic tools.
1032
+ - When deterministic gates are needed, create small dedicated stages that instruct a model to run a specific tool or perform a specific check. This keeps gates adaptive to the current codebase while preserving explicit workflow structure.
1033
+
1034
+ ### Context engineering guidance
1035
+
1036
+ Workflow guidance should also cover the context passed between stages:
1037
+
1038
+ - Prefer creating files or artifacts for substantial handoffs, then instruct the next stage to read the file, instead of dumping large text output directly into the next stage prompt or context.
1039
+ - Prefer forked context for non-reviewer stages so long-running implementation work can preserve coherency and continuity.
1040
+ - Prefer a clean context window for reviewer stages so earlier implementation stages do not bias the reviewer. Reviewers should evaluate the supplied artifacts, changed files, tests, and explicit criteria as independently as possible.
1041
+
1022
1042
  ### Inputs
1023
1043
 
1024
1044
  Inputs are declared with TypeBox `Type.*` schemas passed to `.input(key, schema)`. `Type` is re-exported from `@bastani/workflows` (along with the `Static` and `TSchema` type helpers), so you do not import from `typebox` directly in workflow files. Workflow packages still declare `typebox` as a peer dependency so the SDK's shipped types resolve under `tsc` — see [Programmatic Usage](#programmatic-usage). Common input schemas map to picker kinds and accepted runtime values:
@@ -1219,7 +1239,7 @@ Common builtin import targets:
1219
1239
  |---|---|---|---|
1220
1240
  | `deep-research-codebase` | `deepResearchCodebase` | `@bastani/workflows/builtin/deep-research-codebase` | Gather broad repo research before planning, synthesis, or implementation. |
1221
1241
  | `goal` | `goal` | `@bastani/workflows/builtin/goal` | Run a bounded implementation/check loop with receipts and reviewer-gated completion. |
1222
- | `ralph` | `ralph` | `@bastani/workflows/builtin/ralph` | Delegate a larger migration/refactor/spec-to-PR effort to Ralph's plan/orchestrate/review loop. |
1242
+ | `ralph` | `ralph` | `@bastani/workflows/builtin/ralph` | Delegate a larger migration/refactor/spec-to-reviewed-change effort to Ralph's plan/orchestrate/review loop; pass `create_pr=true` to authorize only the final PR-creation stage. |
1223
1243
  | `open-claude-design` | `openClaudeDesign` | `@bastani/workflows/builtin/open-claude-design` | Generate and refine a UI/design artifact and handoff spec. |
1224
1244
 
1225
1245
  Example parent workflow that runs builtin deep research, then chooses either `goal` or `ralph` as the nested implementation runner:
@@ -1234,7 +1254,7 @@ export default defineWorkflow("research-then-implement")
1234
1254
  "runner",
1235
1255
  Type.Union([Type.Literal("goal"), Type.Literal("ralph")], {
1236
1256
  default: "goal",
1237
- description: "Use goal for bounded changes or Ralph for broad spec-to-PR work.",
1257
+ description: "Use goal for bounded changes or Ralph for broad spec-to-reviewed-change work.",
1238
1258
  }),
1239
1259
  )
1240
1260
  .output("research_doc_path", Type.Optional(Type.String({ description: "Path to the deep-research document used for implementation." })))
@@ -1253,7 +1273,8 @@ export default defineWorkflow("research-then-implement")
1253
1273
  if (String(ctx.inputs.runner) === "ralph") {
1254
1274
  const implementation = await ctx.workflow(ralph, {
1255
1275
  inputs: {
1256
- prompt: `Use the research document at ${String(research.outputs.research_doc_path)} to plan, implement, review, and prepare a PR for: ${topic}`,
1276
+ prompt: `Use the research document at ${String(research.outputs.research_doc_path)} to plan, implement, and review: ${topic}`,
1277
+ create_pr: true,
1257
1278
  },
1258
1279
  stageName: "ralph implementation",
1259
1280
  });
@@ -1478,6 +1499,20 @@ registry.get("alpha");
1478
1499
 
1479
1500
  A workflow is an information-flow system, not just a list of prompts. Most workflow failures come from missing, stale, oversized, or poorly-routed context. Design every stage boundary deliberately.
1480
1501
 
1502
+ ### Locally Scoped Stage Prompts
1503
+
1504
+ Stage prompts should be local contracts, not miniature descriptions of the entire workflow runtime. Write prompts as if the stage could be executed independently from a fresh session with only the listed inputs. Include:
1505
+
1506
+ - the stage's current objective and what is out of scope for this stage
1507
+ - the exact files, artifacts, child outputs, or user inputs it may use
1508
+ - the expected output format or structured-output tool/schema it must return
1509
+ - the checks, tools, or deterministic commands it should run when relevant
1510
+ - the success criteria that let this stage stop
1511
+
1512
+ Avoid unrelated workflow internals such as reducer algorithms, future PR stages, sibling reviewer names, loop implementation details, or project-specific nicknames unless they are explicitly part of the current stage contract. If a term such as a gate name, ledger field, or workflow nickname is necessary, define it in the prompt before using it.
1513
+
1514
+ Choose context mode deliberately. Use `context: "fork"` or `forkFromSessionFile` for coherent long-running implementation stages that need continuity from their own earlier work. Use `context: "fresh"` for unbiased reviewer, evaluator, and gate stages so they inspect the current files and explicit artifacts rather than inheriting the implementer's assumptions. When continuity is needed across fresh stages, pass it explicitly through files, declared outputs, and `reads`.
1515
+
1481
1516
  ### Context Fundamentals
1482
1517
 
1483
1518
  Treat context as a finite attention budget. Include only information needed for the current decision, place critical constraints near the beginning or end of prompts, and use progressive disclosure instead of loading every possible reference up front.
@@ -1521,6 +1556,8 @@ A good compressed handoff includes:
1521
1556
 
1522
1557
  Use `output`, `outputMode: "file-only"`, `reads`, and `chainDir` for large research bundles, logs, or reviewer outputs. Keep summaries compact and let downstream stages read full artifacts only when needed. In the downstream stage prompt, explicitly say something like `Read the file at ${artifactPath} before continuing.` Do not inject full session tails, all previous stage outputs, or every prior review round into later prompts by default; pass the latest relevant artifact paths and make older history discoverable from a ledger or index file.
1523
1558
 
1559
+ Substantial handoffs should travel through files or durable artifacts instead of hidden transcript assumptions. This keeps stage prompts small, makes review/audit possible, and lets later stages reread the authoritative material without depending on what a previous model happened to summarize.
1560
+
1524
1561
  ```ts
1525
1562
  const researchPath = ".atomic/workflows/runs/context-demo/research.md";
1526
1563
  await ctx.task("researcher", {
@@ -1584,6 +1621,10 @@ Build validation into the workflow instead of waiting for a final manual check.
1584
1621
  - reviewer stages: fresh-context reviewers that inspect artifacts and current files
1585
1622
  - LLM-as-judge stages: direct scoring, pairwise comparison, or rubric-based grading for subjective outputs
1586
1623
 
1624
+ Prefer structured output schemas or structured-output tools for model review and gate decisions. Do not make correctness depend on brittle regular-expression matching against free-form prose such as “looks good”, “approved”, or “PASS”. A schema with explicit booleans/enums, findings arrays, confidence, evidence fields, and error reporting is easier to validate, replay, and safely default to “not approved” when malformed.
1625
+
1626
+ Use small dedicated model stages for adaptive gates when deterministic code alone cannot decide what to check. For example, a stage can read an artifact, inspect the repo, run a named tool or command, and then emit a structured decision. Keep that stage's prompt narrow: tell it the specific check to perform, the files/tools it may use, and the structured decision it must return.
1627
+
1587
1628
  When using LLM judges, mitigate bias by defining score anchors, asking for evidence, calibrating against examples, and keeping length/order effects in mind. Track pass rates and failures over time for reusable workflows.
1588
1629
 
1589
1630
  ### Tools, MCP, Memory, and Hosted Execution
@@ -1616,12 +1657,13 @@ Before implementing or shipping a non-trivial workflow, answer these questions:
1616
1657
  - **Inputs:** Which values should be declared as inputs? What is the narrowest schema type? Which defaults are safe?
1617
1658
  - **Starter pattern:** Which [workflow starter pattern](#workflow-starter-patterns) best matches the task, and where does the actual design intentionally diverge?
1618
1659
  - **Stage decomposition:** For each stage, what question does it answer, what context does it need, what output should it return, and what model/tool/MCP requirements does it have?
1660
+ - **Local stage contract:** Can this stage prompt stand alone with its current objective, inputs/artifacts, expected outputs, tools/checks, and success criteria, without unexplained workflow internals or future-stage assumptions?
1619
1661
  - **Information flow:** For every edge between stages, is `previous` enough, or should the handoff use structured returns, files, `reads`, `output`, or `outputMode`?
1620
1662
  - **Output contract:** Which outputs should be declared with `.output(...)`, which stage/task/child results should `.run()` return for those keys, and what runtime type must each value have? If another workflow may call this workflow as a child, which non-default outputs should the parent rely on?
1621
1663
  - **Context size:** Can downstream stages succeed from the handoff alone? Should large transcripts, logs, or research bundles be summarized or saved as artifacts?
1622
1664
  - **Control flow:** Should the workflow use `ctx.chain`, `ctx.parallel`, `ctx.ui`, bounded loops, `failFast`, or `fallbackModels`?
1623
1665
  - **User experience:** Are stage names readable in status and graph views? Is the final output compact? Are important artifacts saved with stable paths?
1624
- - **Validation:** What success criteria, review gates, deterministic checks, or evaluator stages prove the workflow did the right thing?
1666
+ - **Validation:** What success criteria, review gates, deterministic checks, or evaluator stages prove the workflow did the right thing? Are model gates schema-backed instead of regex/prose-matched, and do adaptive gates run as focused model stages with explicit tool/check instructions?
1625
1667
 
1626
1668
  Good workflows are information-flow systems, not just prompt sequences. Keep stage prompts focused, preserve evidence with file paths or artifacts, and pass only the context each downstream stage needs.
1627
1669
 
@@ -1637,4 +1679,6 @@ Good workflows are information-flow systems, not just prompt sequences. Keep sta
1637
1679
  - Do not expect named workflow runs to block the chat turn; they are background tasks.
1638
1680
  - Do not call `kill` when the user asks to interrupt or pause resumably.
1639
1681
  - Keep stage names readable because they appear in workflow status and UI.
1682
+ - Do not write stage prompts that depend on hidden workflow-wide awareness; make each model stage locally scoped and self-described.
1683
+ - Do not parse model gate decisions from ad-hoc prose with regular expressions; use structured output schemas/tools or a focused checking stage that returns a structured decision.
1640
1684
  - Return compact structured output and save large artifacts to files.