@draht/coding-agent 2026.5.12 → 2026.7.7-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (680) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +1 -4
  3. package/bin/draht-tools.cjs +3756 -1
  4. package/dist/bun/cli.d.ts.map +1 -1
  5. package/dist/bun/cli.js +4 -2
  6. package/dist/bun/cli.js.map +1 -1
  7. package/dist/bun/register-bedrock.d.ts.map +1 -1
  8. package/dist/bun/register-bedrock.js +1 -1
  9. package/dist/bun/register-bedrock.js.map +1 -1
  10. package/dist/bun/restore-sandbox-env.d.ts +17 -0
  11. package/dist/bun/restore-sandbox-env.d.ts.map +1 -0
  12. package/dist/bun/restore-sandbox-env.js +36 -0
  13. package/dist/bun/restore-sandbox-env.js.map +1 -0
  14. package/dist/cli/args.d.ts +9 -4
  15. package/dist/cli/args.d.ts.map +1 -1
  16. package/dist/cli/args.js +91 -38
  17. package/dist/cli/args.js.map +1 -1
  18. package/dist/cli/config-selector.d.ts +5 -3
  19. package/dist/cli/config-selector.d.ts.map +1 -1
  20. package/dist/cli/config-selector.js +1 -1
  21. package/dist/cli/config-selector.js.map +1 -1
  22. package/dist/cli/file-processor.d.ts.map +1 -1
  23. package/dist/cli/file-processor.js +13 -26
  24. package/dist/cli/file-processor.js.map +1 -1
  25. package/dist/cli/initial-message.d.ts +1 -1
  26. package/dist/cli/initial-message.d.ts.map +1 -1
  27. package/dist/cli/initial-message.js.map +1 -1
  28. package/dist/cli/list-models.d.ts +1 -1
  29. package/dist/cli/list-models.d.ts.map +1 -1
  30. package/dist/cli/list-models.js +7 -1
  31. package/dist/cli/list-models.js.map +1 -1
  32. package/dist/cli/project-trust.d.ts +10 -0
  33. package/dist/cli/project-trust.d.ts.map +1 -0
  34. package/dist/cli/project-trust.js +48 -0
  35. package/dist/cli/project-trust.js.map +1 -0
  36. package/dist/cli/session-picker.d.ts +3 -2
  37. package/dist/cli/session-picker.d.ts.map +1 -1
  38. package/dist/cli/session-picker.js +5 -4
  39. package/dist/cli/session-picker.js.map +1 -1
  40. package/dist/cli/startup-ui.d.ts +20 -0
  41. package/dist/cli/startup-ui.d.ts.map +1 -0
  42. package/dist/cli/startup-ui.js +184 -0
  43. package/dist/cli/startup-ui.js.map +1 -0
  44. package/dist/cli.d.ts.map +1 -1
  45. package/dist/cli.js +7 -4
  46. package/dist/cli.js.map +1 -1
  47. package/dist/config.d.ts +27 -13
  48. package/dist/config.d.ts.map +1 -1
  49. package/dist/config.js +284 -63
  50. package/dist/config.js.map +1 -1
  51. package/dist/core/agent-session-runtime.d.ts +45 -9
  52. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  53. package/dist/core/agent-session-runtime.js +100 -33
  54. package/dist/core/agent-session-runtime.js.map +1 -1
  55. package/dist/core/agent-session-services.d.ts +6 -4
  56. package/dist/core/agent-session-services.d.ts.map +1 -1
  57. package/dist/core/agent-session-services.js +7 -4
  58. package/dist/core/agent-session-services.js.map +1 -1
  59. package/dist/core/agent-session.d.ts +55 -33
  60. package/dist/core/agent-session.d.ts.map +1 -1
  61. package/dist/core/agent-session.js +560 -492
  62. package/dist/core/agent-session.js.map +1 -1
  63. package/dist/core/auth-guidance.d.ts +5 -0
  64. package/dist/core/auth-guidance.d.ts.map +1 -0
  65. package/dist/core/auth-guidance.js +21 -0
  66. package/dist/core/auth-guidance.js.map +1 -0
  67. package/dist/core/auth-storage.d.ts +21 -13
  68. package/dist/core/auth-storage.d.ts.map +1 -1
  69. package/dist/core/auth-storage.js +48 -28
  70. package/dist/core/auth-storage.js.map +1 -1
  71. package/dist/core/bash-executor.d.ts +1 -15
  72. package/dist/core/bash-executor.d.ts.map +1 -1
  73. package/dist/core/bash-executor.js +10 -24
  74. package/dist/core/bash-executor.js.map +1 -1
  75. package/dist/core/builtins/subagent.d.ts.map +1 -1
  76. package/dist/core/builtins/subagent.js +1 -2
  77. package/dist/core/builtins/subagent.js.map +1 -1
  78. package/dist/core/compaction/branch-summarization.d.ts +9 -5
  79. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  80. package/dist/core/compaction/branch-summarization.js +10 -4
  81. package/dist/core/compaction/branch-summarization.js.map +1 -1
  82. package/dist/core/compaction/compaction.d.ts +8 -7
  83. package/dist/core/compaction/compaction.d.ts.map +1 -1
  84. package/dist/core/compaction/compaction.js +56 -47
  85. package/dist/core/compaction/compaction.js.map +1 -1
  86. package/dist/core/compaction/index.d.ts +3 -3
  87. package/dist/core/compaction/index.d.ts.map +1 -1
  88. package/dist/core/compaction/index.js.map +1 -1
  89. package/dist/core/compaction/utils.d.ts +1 -1
  90. package/dist/core/compaction/utils.d.ts.map +1 -1
  91. package/dist/core/compaction/utils.js +1 -1
  92. package/dist/core/compaction/utils.js.map +1 -1
  93. package/dist/core/exec.d.ts.map +1 -1
  94. package/dist/core/exec.js.map +1 -1
  95. package/dist/core/experimental.d.ts +2 -0
  96. package/dist/core/experimental.d.ts.map +1 -0
  97. package/dist/core/experimental.js +4 -0
  98. package/dist/core/experimental.js.map +1 -0
  99. package/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
  100. package/dist/core/export-html/ansi-to-html.js +1 -1
  101. package/dist/core/export-html/ansi-to-html.js.map +1 -1
  102. package/dist/core/export-html/index.d.ts +1 -1
  103. package/dist/core/export-html/index.d.ts.map +1 -1
  104. package/dist/core/export-html/index.js +13 -11
  105. package/dist/core/export-html/index.js.map +1 -1
  106. package/dist/core/export-html/template.css +69 -4
  107. package/dist/core/export-html/template.js +231 -57
  108. package/dist/core/export-html/tool-renderer.d.ts +0 -6
  109. package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
  110. package/dist/core/export-html/tool-renderer.js +15 -2
  111. package/dist/core/export-html/tool-renderer.js.map +1 -1
  112. package/dist/core/export-html/vendor/marked.min.js +75 -3
  113. package/dist/core/extensions/index.d.ts +8 -8
  114. package/dist/core/extensions/index.d.ts.map +1 -1
  115. package/dist/core/extensions/index.js.map +1 -1
  116. package/dist/core/extensions/loader.d.ts +5 -6
  117. package/dist/core/extensions/loader.d.ts.map +1 -1
  118. package/dist/core/extensions/loader.js +98 -43
  119. package/dist/core/extensions/loader.js.map +1 -1
  120. package/dist/core/extensions/runner.d.ts +31 -12
  121. package/dist/core/extensions/runner.d.ts.map +1 -1
  122. package/dist/core/extensions/runner.js +248 -33
  123. package/dist/core/extensions/runner.js.map +1 -1
  124. package/dist/core/extensions/types.d.ts +191 -36
  125. package/dist/core/extensions/types.d.ts.map +1 -1
  126. package/dist/core/extensions/types.js.map +1 -1
  127. package/dist/core/extensions/wrapper.d.ts.map +1 -1
  128. package/dist/core/extensions/wrapper.js +2 -2
  129. package/dist/core/extensions/wrapper.js.map +1 -1
  130. package/dist/core/footer-data-provider.d.ts +7 -1
  131. package/dist/core/footer-data-provider.d.ts.map +1 -1
  132. package/dist/core/footer-data-provider.js +78 -54
  133. package/dist/core/footer-data-provider.js.map +1 -1
  134. package/dist/core/http-dispatcher.d.ts +22 -0
  135. package/dist/core/http-dispatcher.d.ts.map +1 -0
  136. package/dist/core/http-dispatcher.js +91 -0
  137. package/dist/core/http-dispatcher.js.map +1 -0
  138. package/dist/core/index.d.ts +9 -8
  139. package/dist/core/index.d.ts.map +1 -1
  140. package/dist/core/index.js +2 -1
  141. package/dist/core/index.js.map +1 -1
  142. package/dist/core/keybindings.d.ts +67 -2
  143. package/dist/core/keybindings.d.ts.map +1 -1
  144. package/dist/core/keybindings.js +59 -7
  145. package/dist/core/keybindings.js.map +1 -1
  146. package/dist/core/model-registry.d.ts +24 -5
  147. package/dist/core/model-registry.d.ts.map +1 -1
  148. package/dist/core/model-registry.js +188 -51
  149. package/dist/core/model-registry.js.map +1 -1
  150. package/dist/core/model-resolver.d.ts +12 -1
  151. package/dist/core/model-resolver.d.ts.map +1 -1
  152. package/dist/core/model-resolver.js +84 -39
  153. package/dist/core/model-resolver.js.map +1 -1
  154. package/dist/core/output-guard.d.ts +1 -0
  155. package/dist/core/output-guard.d.ts.map +1 -1
  156. package/dist/core/output-guard.js +52 -22
  157. package/dist/core/output-guard.js.map +1 -1
  158. package/dist/core/package-manager.d.ts +22 -4
  159. package/dist/core/package-manager.d.ts.map +1 -1
  160. package/dist/core/package-manager.js +455 -157
  161. package/dist/core/package-manager.js.map +1 -1
  162. package/dist/core/project-trust.d.ts +15 -0
  163. package/dist/core/project-trust.d.ts.map +1 -0
  164. package/dist/core/project-trust.js +59 -0
  165. package/dist/core/project-trust.js.map +1 -0
  166. package/dist/core/prompt-templates.d.ts +13 -11
  167. package/dist/core/prompt-templates.d.ts.map +1 -1
  168. package/dist/core/prompt-templates.js +67 -76
  169. package/dist/core/prompt-templates.js.map +1 -1
  170. package/dist/core/provider-attribution.d.ts +4 -0
  171. package/dist/core/provider-attribution.d.ts.map +1 -0
  172. package/dist/core/provider-attribution.js +72 -0
  173. package/dist/core/provider-attribution.js.map +1 -0
  174. package/dist/core/provider-display-names.d.ts +2 -0
  175. package/dist/core/provider-display-names.d.ts.map +1 -0
  176. package/dist/core/provider-display-names.js +36 -0
  177. package/dist/core/provider-display-names.js.map +1 -0
  178. package/dist/core/resolve-config-value.d.ts +13 -6
  179. package/dist/core/resolve-config-value.d.ts.map +1 -1
  180. package/dist/core/resolve-config-value.js +143 -22
  181. package/dist/core/resolve-config-value.js.map +1 -1
  182. package/dist/core/resource-loader.d.ts +36 -15
  183. package/dist/core/resource-loader.d.ts.map +1 -1
  184. package/dist/core/resource-loader.js +178 -79
  185. package/dist/core/resource-loader.js.map +1 -1
  186. package/dist/core/sdk.d.ts +34 -18
  187. package/dist/core/sdk.d.ts.map +1 -1
  188. package/dist/core/sdk.js +47 -16
  189. package/dist/core/sdk.js.map +1 -1
  190. package/dist/core/session-manager.d.ts +32 -14
  191. package/dist/core/session-manager.d.ts.map +1 -1
  192. package/dist/core/session-manager.js +366 -209
  193. package/dist/core/session-manager.js.map +1 -1
  194. package/dist/core/settings-manager.d.ts +62 -6
  195. package/dist/core/settings-manager.d.ts.map +1 -1
  196. package/dist/core/settings-manager.js +230 -40
  197. package/dist/core/settings-manager.js.map +1 -1
  198. package/dist/core/skills.d.ts +10 -10
  199. package/dist/core/skills.d.ts.map +1 -1
  200. package/dist/core/skills.js +13 -35
  201. package/dist/core/skills.js.map +1 -1
  202. package/dist/core/slash-commands.d.ts +1 -1
  203. package/dist/core/slash-commands.d.ts.map +1 -1
  204. package/dist/core/slash-commands.js +7 -4
  205. package/dist/core/slash-commands.js.map +1 -1
  206. package/dist/core/source-info.d.ts +1 -1
  207. package/dist/core/source-info.d.ts.map +1 -1
  208. package/dist/core/source-info.js.map +1 -1
  209. package/dist/core/system-prompt.d.ts +4 -4
  210. package/dist/core/system-prompt.d.ts.map +1 -1
  211. package/dist/core/system-prompt.js +20 -16
  212. package/dist/core/system-prompt.js.map +1 -1
  213. package/dist/core/telemetry.d.ts +3 -0
  214. package/dist/core/telemetry.d.ts.map +1 -0
  215. package/dist/core/telemetry.js +9 -0
  216. package/dist/core/telemetry.js.map +1 -0
  217. package/dist/core/timings.d.ts +4 -2
  218. package/dist/core/timings.d.ts.map +1 -1
  219. package/dist/core/timings.js +24 -14
  220. package/dist/core/timings.js.map +1 -1
  221. package/dist/core/tools/bash.d.ts +11 -16
  222. package/dist/core/tools/bash.d.ts.map +1 -1
  223. package/dist/core/tools/bash.js +187 -178
  224. package/dist/core/tools/bash.js.map +1 -1
  225. package/dist/core/tools/edit-diff.d.ts +26 -5
  226. package/dist/core/tools/edit-diff.d.ts.map +1 -1
  227. package/dist/core/tools/edit-diff.js +110 -23
  228. package/dist/core/tools/edit-diff.js.map +1 -1
  229. package/dist/core/tools/edit.d.ts +22 -24
  230. package/dist/core/tools/edit.d.ts.map +1 -1
  231. package/dist/core/tools/edit.js +201 -113
  232. package/dist/core/tools/edit.js.map +1 -1
  233. package/dist/core/tools/file-mutation-queue.d.ts.map +1 -1
  234. package/dist/core/tools/file-mutation-queue.js +27 -12
  235. package/dist/core/tools/file-mutation-queue.js.map +1 -1
  236. package/dist/core/tools/find.d.ts +7 -18
  237. package/dist/core/tools/find.d.ts.map +1 -1
  238. package/dist/core/tools/find.js +148 -101
  239. package/dist/core/tools/find.js.map +1 -1
  240. package/dist/core/tools/grep.d.ts +11 -30
  241. package/dist/core/tools/grep.d.ts.map +1 -1
  242. package/dist/core/tools/grep.js +23 -12
  243. package/dist/core/tools/grep.js.map +1 -1
  244. package/dist/core/tools/index.d.ts +26 -101
  245. package/dist/core/tools/index.d.ts.map +1 -1
  246. package/dist/core/tools/index.js +78 -52
  247. package/dist/core/tools/index.js.map +1 -1
  248. package/dist/core/tools/ls.d.ts +6 -15
  249. package/dist/core/tools/ls.d.ts.map +1 -1
  250. package/dist/core/tools/ls.js +12 -17
  251. package/dist/core/tools/ls.js.map +1 -1
  252. package/dist/core/tools/output-accumulator.d.ts +52 -0
  253. package/dist/core/tools/output-accumulator.d.ts.map +1 -0
  254. package/dist/core/tools/output-accumulator.js +184 -0
  255. package/dist/core/tools/output-accumulator.js.map +1 -0
  256. package/dist/core/tools/path-utils.d.ts +2 -0
  257. package/dist/core/tools/path-utils.d.ts.map +1 -1
  258. package/dist/core/tools/path-utils.js +40 -22
  259. package/dist/core/tools/path-utils.js.map +1 -1
  260. package/dist/core/tools/read.d.ts +7 -18
  261. package/dist/core/tools/read.d.ts.map +1 -1
  262. package/dist/core/tools/read.js +103 -52
  263. package/dist/core/tools/read.js.map +1 -1
  264. package/dist/core/tools/render-utils.d.ts +5 -2
  265. package/dist/core/tools/render-utils.d.ts.map +1 -1
  266. package/dist/core/tools/render-utils.js +18 -2
  267. package/dist/core/tools/render-utils.js.map +1 -1
  268. package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
  269. package/dist/core/tools/tool-definition-wrapper.js +2 -0
  270. package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
  271. package/dist/core/tools/truncate.d.ts.map +1 -1
  272. package/dist/core/tools/truncate.js +12 -2
  273. package/dist/core/tools/truncate.js.map +1 -1
  274. package/dist/core/tools/write.d.ts +5 -14
  275. package/dist/core/tools/write.d.ts.map +1 -1
  276. package/dist/core/tools/write.js +27 -46
  277. package/dist/core/tools/write.js.map +1 -1
  278. package/dist/core/trust-manager.d.ts +36 -0
  279. package/dist/core/trust-manager.d.ts.map +1 -0
  280. package/dist/core/trust-manager.js +202 -0
  281. package/dist/core/trust-manager.js.map +1 -0
  282. package/dist/index.d.ts +33 -29
  283. package/dist/index.d.ts.map +1 -1
  284. package/dist/index.js +12 -9
  285. package/dist/index.js.map +1 -1
  286. package/dist/main.d.ts +5 -1
  287. package/dist/main.d.ts.map +1 -1
  288. package/dist/main.js +208 -93
  289. package/dist/main.js.map +1 -1
  290. package/dist/migrations.d.ts +2 -2
  291. package/dist/migrations.d.ts.map +1 -1
  292. package/dist/migrations.js +4 -4
  293. package/dist/migrations.js.map +1 -1
  294. package/dist/modes/index.d.ts +5 -5
  295. package/dist/modes/index.d.ts.map +1 -1
  296. package/dist/modes/index.js.map +1 -1
  297. package/dist/modes/interactive/assets/clankolas.png +0 -0
  298. package/dist/modes/interactive/components/assistant-message.d.ts +5 -1
  299. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  300. package/dist/modes/interactive/components/assistant-message.js +37 -15
  301. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  302. package/dist/modes/interactive/components/bash-execution.d.ts +1 -1
  303. package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
  304. package/dist/modes/interactive/components/bash-execution.js +3 -3
  305. package/dist/modes/interactive/components/bash-execution.js.map +1 -1
  306. package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -1
  307. package/dist/modes/interactive/components/bordered-loader.js +3 -0
  308. package/dist/modes/interactive/components/bordered-loader.js.map +1 -1
  309. package/dist/modes/interactive/components/config-selector.d.ts +36 -5
  310. package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
  311. package/dist/modes/interactive/components/config-selector.js +318 -36
  312. package/dist/modes/interactive/components/config-selector.js.map +1 -1
  313. package/dist/modes/interactive/components/countdown-timer.d.ts +2 -2
  314. package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -1
  315. package/dist/modes/interactive/components/countdown-timer.js +2 -2
  316. package/dist/modes/interactive/components/countdown-timer.js.map +1 -1
  317. package/dist/modes/interactive/components/custom-editor.d.ts +1 -1
  318. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
  319. package/dist/modes/interactive/components/custom-editor.js.map +1 -1
  320. package/dist/modes/interactive/components/custom-entry.d.ts +19 -0
  321. package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -0
  322. package/dist/modes/interactive/components/custom-entry.js +52 -0
  323. package/dist/modes/interactive/components/custom-entry.js.map +1 -0
  324. package/dist/modes/interactive/components/custom-message.d.ts +2 -2
  325. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  326. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  327. package/dist/modes/interactive/components/diff.d.ts.map +1 -1
  328. package/dist/modes/interactive/components/diff.js.map +1 -1
  329. package/dist/modes/interactive/components/earendil-announcement.d.ts.map +1 -1
  330. package/dist/modes/interactive/components/earendil-announcement.js.map +1 -1
  331. package/dist/modes/interactive/components/extension-editor.d.ts +3 -1
  332. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
  333. package/dist/modes/interactive/components/extension-editor.js +26 -9
  334. package/dist/modes/interactive/components/extension-editor.js.map +1 -1
  335. package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
  336. package/dist/modes/interactive/components/extension-input.js.map +1 -1
  337. package/dist/modes/interactive/components/extension-selector.d.ts +2 -0
  338. package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
  339. package/dist/modes/interactive/components/extension-selector.js +8 -3
  340. package/dist/modes/interactive/components/extension-selector.js.map +1 -1
  341. package/dist/modes/interactive/components/first-time-setup.d.ts +25 -0
  342. package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -0
  343. package/dist/modes/interactive/components/first-time-setup.js +103 -0
  344. package/dist/modes/interactive/components/first-time-setup.js.map +1 -0
  345. package/dist/modes/interactive/components/footer.d.ts +4 -3
  346. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  347. package/dist/modes/interactive/components/footer.js +27 -7
  348. package/dist/modes/interactive/components/footer.js.map +1 -1
  349. package/dist/modes/interactive/components/index.d.ts +33 -31
  350. package/dist/modes/interactive/components/index.d.ts.map +1 -1
  351. package/dist/modes/interactive/components/index.js +2 -0
  352. package/dist/modes/interactive/components/index.js.map +1 -1
  353. package/dist/modes/interactive/components/keybinding-hints.d.ts +5 -0
  354. package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
  355. package/dist/modes/interactive/components/keybinding-hints.js +19 -5
  356. package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
  357. package/dist/modes/interactive/components/login-dialog.d.ts +12 -2
  358. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  359. package/dist/modes/interactive/components/login-dialog.js +45 -11
  360. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  361. package/dist/modes/interactive/components/model-selector.d.ts +2 -2
  362. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  363. package/dist/modes/interactive/components/model-selector.js +10 -6
  364. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  365. package/dist/modes/interactive/components/oauth-selector.d.ts +18 -6
  366. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  367. package/dist/modes/interactive/components/oauth-selector.js +93 -25
  368. package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  369. package/dist/modes/interactive/components/scoped-models-selector.d.ts +5 -12
  370. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  371. package/dist/modes/interactive/components/scoped-models-selector.js +49 -31
  372. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  373. package/dist/modes/interactive/components/session-selector.d.ts +2 -2
  374. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  375. package/dist/modes/interactive/components/session-selector.js +33 -14
  376. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  377. package/dist/modes/interactive/components/settings-selector.d.ts +17 -0
  378. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  379. package/dist/modes/interactive/components/settings-selector.js +301 -20
  380. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  381. package/dist/modes/interactive/components/skill-invocation-message.d.ts +1 -1
  382. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
  383. package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
  384. package/dist/modes/interactive/components/status-indicator.d.ts +28 -0
  385. package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -0
  386. package/dist/modes/interactive/components/status-indicator.js +60 -0
  387. package/dist/modes/interactive/components/status-indicator.js.map +1 -0
  388. package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
  389. package/dist/modes/interactive/components/thinking-selector.js +1 -1
  390. package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
  391. package/dist/modes/interactive/components/tool-execution.d.ts +6 -1
  392. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  393. package/dist/modes/interactive/components/tool-execution.js +57 -14
  394. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  395. package/dist/modes/interactive/components/tree-selector.d.ts +1 -1
  396. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  397. package/dist/modes/interactive/components/tree-selector.js +137 -13
  398. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  399. package/dist/modes/interactive/components/trust-selector.d.ts +23 -0
  400. package/dist/modes/interactive/components/trust-selector.d.ts.map +1 -0
  401. package/dist/modes/interactive/components/trust-selector.js +91 -0
  402. package/dist/modes/interactive/components/trust-selector.js.map +1 -0
  403. package/dist/modes/interactive/components/user-message-selector.d.ts +2 -2
  404. package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
  405. package/dist/modes/interactive/components/user-message-selector.js +8 -7
  406. package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
  407. package/dist/modes/interactive/components/user-message.d.ts +6 -1
  408. package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
  409. package/dist/modes/interactive/components/user-message.js +22 -8
  410. package/dist/modes/interactive/components/user-message.js.map +1 -1
  411. package/dist/modes/interactive/interactive-mode.d.ts +76 -19
  412. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  413. package/dist/modes/interactive/interactive-mode.js +1294 -494
  414. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  415. package/dist/modes/interactive/model-search.d.ts +12 -0
  416. package/dist/modes/interactive/model-search.d.ts.map +1 -0
  417. package/dist/modes/interactive/model-search.js +15 -0
  418. package/dist/modes/interactive/model-search.js.map +1 -0
  419. package/dist/modes/interactive/theme/dark.json +5 -4
  420. package/dist/modes/interactive/theme/light.json +5 -4
  421. package/dist/modes/interactive/theme/theme-controller.d.ts +29 -0
  422. package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -0
  423. package/dist/modes/interactive/theme/theme-controller.js +102 -0
  424. package/dist/modes/interactive/theme/theme-controller.js.map +1 -0
  425. package/dist/modes/interactive/theme/theme-schema.json +2 -1
  426. package/dist/modes/interactive/theme/theme.d.ts +41 -3
  427. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  428. package/dist/modes/interactive/theme/theme.js +183 -106
  429. package/dist/modes/interactive/theme/theme.js.map +1 -1
  430. package/dist/modes/print-mode.d.ts.map +1 -1
  431. package/dist/modes/print-mode.js +40 -20
  432. package/dist/modes/print-mode.js.map +1 -1
  433. package/dist/modes/rpc/rpc-client.d.ts +30 -5
  434. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  435. package/dist/modes/rpc/rpc-client.js +87 -8
  436. package/dist/modes/rpc/rpc-client.js.map +1 -1
  437. package/dist/modes/rpc/rpc-mode.d.ts +2 -2
  438. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  439. package/dist/modes/rpc/rpc-mode.js +113 -31
  440. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  441. package/dist/modes/rpc/rpc-types.d.ts +42 -4
  442. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  443. package/dist/modes/rpc/rpc-types.js.map +1 -1
  444. package/dist/package-manager-cli.d.ts +6 -2
  445. package/dist/package-manager-cli.d.ts.map +1 -1
  446. package/dist/package-manager-cli.js +504 -25
  447. package/dist/package-manager-cli.js.map +1 -1
  448. package/dist/prompts/agents/build.md +38 -0
  449. package/dist/prompts/agents/plan.md +36 -0
  450. package/dist/prompts/agents/verify.md +36 -4
  451. package/dist/prompts/commands/brainstorm.md +162 -0
  452. package/dist/prompts/commands/discuss-phase.md +1 -1
  453. package/dist/prompts/commands/execute-phase.md +4 -1
  454. package/dist/prompts/commands/fix.md +12 -0
  455. package/dist/prompts/commands/init-project.md +1 -0
  456. package/dist/prompts/commands/map-codebase.md +15 -1
  457. package/dist/prompts/commands/new-project.md +1 -0
  458. package/dist/prompts/commands/next-milestone.md +2 -0
  459. package/dist/prompts/commands/orchestrate.md +4 -4
  460. package/dist/prompts/commands/plan-phase.md +5 -0
  461. package/dist/prompts/commands/quick.md +4 -0
  462. package/dist/prompts/commands/review.md +4 -1
  463. package/dist/prompts/commands/verify-work.md +10 -8
  464. package/dist/rpc-entry.d.ts +3 -0
  465. package/dist/rpc-entry.d.ts.map +1 -0
  466. package/dist/rpc-entry.js +10 -0
  467. package/dist/rpc-entry.js.map +1 -0
  468. package/dist/utils/ansi.d.ts +2 -0
  469. package/dist/utils/ansi.d.ts.map +1 -0
  470. package/dist/utils/ansi.js +52 -0
  471. package/dist/utils/ansi.js.map +1 -0
  472. package/dist/utils/changelog.d.ts +2 -1
  473. package/dist/utils/changelog.d.ts.map +1 -1
  474. package/dist/utils/changelog.js +78 -0
  475. package/dist/utils/changelog.js.map +1 -1
  476. package/dist/utils/child-process.d.ts +12 -5
  477. package/dist/utils/child-process.d.ts.map +1 -1
  478. package/dist/utils/child-process.js +33 -5
  479. package/dist/utils/child-process.js.map +1 -1
  480. package/dist/utils/clipboard-image.d.ts.map +1 -1
  481. package/dist/utils/clipboard-image.js +2 -2
  482. package/dist/utils/clipboard-image.js.map +1 -1
  483. package/dist/utils/clipboard-native.d.ts +3 -1
  484. package/dist/utils/clipboard-native.d.ts.map +1 -1
  485. package/dist/utils/clipboard-native.js +14 -8
  486. package/dist/utils/clipboard-native.js.map +1 -1
  487. package/dist/utils/clipboard.d.ts.map +1 -1
  488. package/dist/utils/clipboard.js +84 -45
  489. package/dist/utils/clipboard.js.map +1 -1
  490. package/dist/utils/deprecation.d.ts +4 -0
  491. package/dist/utils/deprecation.d.ts.map +1 -0
  492. package/dist/utils/deprecation.js +13 -0
  493. package/dist/utils/deprecation.js.map +1 -0
  494. package/dist/utils/exif-orientation.d.ts +1 -1
  495. package/dist/utils/exif-orientation.d.ts.map +1 -1
  496. package/dist/utils/exif-orientation.js.map +1 -1
  497. package/dist/utils/fs-watch.d.ts +5 -0
  498. package/dist/utils/fs-watch.d.ts.map +1 -0
  499. package/dist/utils/fs-watch.js +25 -0
  500. package/dist/utils/fs-watch.js.map +1 -0
  501. package/dist/utils/git.d.ts.map +1 -1
  502. package/dist/utils/git.js +54 -22
  503. package/dist/utils/git.js.map +1 -1
  504. package/dist/utils/html.d.ts +7 -0
  505. package/dist/utils/html.d.ts.map +1 -0
  506. package/dist/utils/html.js +40 -0
  507. package/dist/utils/html.js.map +1 -0
  508. package/dist/utils/image-convert.d.ts +1 -0
  509. package/dist/utils/image-convert.d.ts.map +1 -1
  510. package/dist/utils/image-convert.js +21 -15
  511. package/dist/utils/image-convert.js.map +1 -1
  512. package/dist/utils/image-process.d.ts +18 -0
  513. package/dist/utils/image-process.d.ts.map +1 -0
  514. package/dist/utils/image-process.js +83 -0
  515. package/dist/utils/image-process.js.map +1 -0
  516. package/dist/utils/image-resize-core.d.ts +30 -0
  517. package/dist/utils/image-resize-core.d.ts.map +1 -0
  518. package/dist/utils/image-resize-core.js +124 -0
  519. package/dist/utils/image-resize-core.js.map +1 -0
  520. package/dist/utils/image-resize-worker.d.ts +2 -0
  521. package/dist/utils/image-resize-worker.d.ts.map +1 -0
  522. package/dist/utils/image-resize-worker.js +31 -0
  523. package/dist/utils/image-resize-worker.js.map +1 -0
  524. package/dist/utils/image-resize.d.ts +7 -27
  525. package/dist/utils/image-resize.d.ts.map +1 -1
  526. package/dist/utils/image-resize.js +75 -115
  527. package/dist/utils/image-resize.js.map +1 -1
  528. package/dist/utils/json.d.ts +3 -0
  529. package/dist/utils/json.d.ts.map +1 -0
  530. package/dist/utils/json.js +7 -0
  531. package/dist/utils/json.js.map +1 -0
  532. package/dist/utils/mime.d.ts +1 -0
  533. package/dist/utils/mime.d.ts.map +1 -1
  534. package/dist/utils/mime.js +100 -16
  535. package/dist/utils/mime.js.map +1 -1
  536. package/dist/utils/open-browser.d.ts +9 -0
  537. package/dist/utils/open-browser.d.ts.map +1 -0
  538. package/dist/utils/open-browser.js +22 -0
  539. package/dist/utils/open-browser.js.map +1 -0
  540. package/dist/utils/paths.d.ts +25 -1
  541. package/dist/utils/paths.d.ts.map +1 -1
  542. package/dist/utils/paths.js +75 -2
  543. package/dist/utils/paths.js.map +1 -1
  544. package/dist/utils/pi-user-agent.d.ts +2 -0
  545. package/dist/utils/pi-user-agent.d.ts.map +1 -0
  546. package/dist/utils/pi-user-agent.js +5 -0
  547. package/dist/utils/pi-user-agent.js.map +1 -0
  548. package/dist/utils/shell.d.ts +11 -6
  549. package/dist/utils/shell.d.ts.map +1 -1
  550. package/dist/utils/shell.js +42 -26
  551. package/dist/utils/shell.js.map +1 -1
  552. package/dist/utils/syntax-highlight.d.ts +12 -0
  553. package/dist/utils/syntax-highlight.d.ts.map +1 -0
  554. package/dist/utils/syntax-highlight.js +118 -0
  555. package/dist/utils/syntax-highlight.js.map +1 -0
  556. package/dist/utils/tools-manager.d.ts.map +1 -1
  557. package/dist/utils/tools-manager.js +86 -10
  558. package/dist/utils/tools-manager.js.map +1 -1
  559. package/dist/utils/version-check.d.ts +15 -0
  560. package/dist/utils/version-check.d.ts.map +1 -0
  561. package/dist/utils/version-check.js +59 -0
  562. package/dist/utils/version-check.js.map +1 -0
  563. package/dist/utils/windows-self-update.d.ts +3 -0
  564. package/dist/utils/windows-self-update.d.ts.map +1 -0
  565. package/dist/utils/windows-self-update.js +77 -0
  566. package/dist/utils/windows-self-update.js.map +1 -0
  567. package/docs/compaction.md +12 -12
  568. package/docs/containerization.md +111 -0
  569. package/docs/custom-provider.md +187 -47
  570. package/docs/development.md +5 -5
  571. package/docs/docs.json +156 -0
  572. package/docs/extensions.md +520 -79
  573. package/docs/index.md +82 -0
  574. package/docs/json.md +4 -4
  575. package/docs/keybindings.md +24 -2
  576. package/docs/models.md +119 -17
  577. package/docs/packages.md +19 -11
  578. package/docs/prompt-templates.md +30 -2
  579. package/docs/providers.md +85 -23
  580. package/docs/quickstart.md +165 -0
  581. package/docs/rpc.md +99 -10
  582. package/docs/sdk.md +118 -50
  583. package/docs/security.md +55 -0
  584. package/docs/{session.md → session-format.md} +29 -19
  585. package/docs/sessions.md +145 -0
  586. package/docs/settings.md +71 -11
  587. package/docs/skills.md +16 -17
  588. package/docs/terminal-setup.md +44 -2
  589. package/docs/termux.md +4 -4
  590. package/docs/themes.md +3 -3
  591. package/docs/tmux.md +4 -2
  592. package/docs/tui.md +44 -4
  593. package/docs/usage.md +305 -0
  594. package/examples/extensions/README.md +1 -0
  595. package/examples/extensions/border-status-editor.ts +145 -0
  596. package/examples/extensions/built-in-tool-renderer.ts +3 -0
  597. package/examples/extensions/custom-compaction.ts +2 -1
  598. package/examples/extensions/custom-header.ts +1 -1
  599. package/examples/extensions/custom-provider-anthropic/index.ts +2 -2
  600. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  601. package/examples/extensions/custom-provider-anthropic/package.json +2 -2
  602. package/examples/extensions/custom-provider-gitlab-duo/index.ts +63 -8
  603. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  604. package/examples/extensions/custom-provider-gitlab-duo/test.ts +2 -2
  605. package/examples/extensions/doom-overlay/doom-component.ts +2 -2
  606. package/examples/extensions/doom-overlay/index.ts +1 -1
  607. package/examples/extensions/dynamic-resources/dynamic.json +1 -1
  608. package/examples/extensions/dynamic-tools.ts +2 -2
  609. package/examples/extensions/entry-renderer.ts +41 -0
  610. package/examples/extensions/git-merge-and-resolve.ts +115 -0
  611. package/examples/extensions/github-issue-autocomplete.ts +185 -0
  612. package/examples/extensions/gondolin/index.ts +531 -0
  613. package/examples/extensions/gondolin/package-lock.json +185 -0
  614. package/examples/extensions/gondolin/package.json +19 -0
  615. package/examples/extensions/handoff.ts +52 -14
  616. package/examples/extensions/input-transform-streaming.ts +39 -0
  617. package/examples/extensions/interactive-shell.ts +1 -1
  618. package/examples/extensions/notify.ts +2 -9
  619. package/examples/extensions/overlay-qa-tests.ts +240 -138
  620. package/examples/extensions/overlay-test.ts +7 -4
  621. package/examples/extensions/plan-mode/index.ts +87 -37
  622. package/examples/extensions/plan-mode/utils.ts +1 -1
  623. package/examples/extensions/preset.ts +46 -7
  624. package/examples/extensions/project-trust.ts +64 -0
  625. package/examples/extensions/prompt-customizer.ts +97 -0
  626. package/examples/extensions/provider-payload.ts +8 -4
  627. package/examples/extensions/qna.ts +3 -3
  628. package/examples/extensions/question.ts +34 -20
  629. package/examples/extensions/questionnaire.ts +43 -30
  630. package/examples/extensions/reload-runtime.ts +1 -1
  631. package/examples/extensions/sandbox/index.ts +6 -6
  632. package/examples/extensions/sandbox/package-lock.json +5 -5
  633. package/examples/extensions/sandbox/package.json +2 -2
  634. package/examples/extensions/shutdown-command.ts +1 -1
  635. package/examples/extensions/snake.ts +1 -1
  636. package/examples/extensions/space-invaders.ts +1 -1
  637. package/examples/extensions/structured-output.ts +65 -0
  638. package/examples/extensions/subagent/agents.ts +2 -2
  639. package/examples/extensions/subagent/index.ts +58 -29
  640. package/examples/extensions/summarize.ts +3 -2
  641. package/examples/extensions/tic-tac-toe.ts +1008 -0
  642. package/examples/extensions/titlebar-spinner.ts +2 -2
  643. package/examples/extensions/todo.ts +2 -2
  644. package/examples/extensions/tool-override.ts +1 -1
  645. package/examples/extensions/tools.ts +5 -0
  646. package/examples/extensions/truncated-tool.ts +1 -1
  647. package/examples/extensions/with-deps/index.ts +1 -1
  648. package/examples/extensions/with-deps/package-lock.json +2 -2
  649. package/examples/extensions/with-deps/package.json +3 -3
  650. package/examples/extensions/working-indicator.ts +123 -0
  651. package/examples/extensions/working-message-test.ts +25 -0
  652. package/examples/sdk/01-minimal.ts +14 -10
  653. package/examples/sdk/02-custom-model.ts +13 -9
  654. package/examples/sdk/03-custom-prompt.ts +32 -17
  655. package/examples/sdk/04-skills.ts +5 -2
  656. package/examples/sdk/05-tools.ts +23 -31
  657. package/examples/sdk/06-extensions.ts +14 -8
  658. package/examples/sdk/07-context-files.ts +5 -3
  659. package/examples/sdk/08-prompt-templates.ts +5 -2
  660. package/examples/sdk/09-api-keys-and-oauth.ts +8 -4
  661. package/examples/sdk/10-settings.ts +8 -6
  662. package/examples/sdk/11-sessions.ts +4 -0
  663. package/examples/sdk/12-full-control.ts +15 -19
  664. package/package.json +22 -16
  665. package/prompts/agents/build.md +38 -0
  666. package/prompts/agents/plan.md +36 -0
  667. package/prompts/agents/verify.md +36 -4
  668. package/prompts/commands/brainstorm.md +162 -0
  669. package/prompts/commands/discuss-phase.md +1 -1
  670. package/prompts/commands/execute-phase.md +4 -1
  671. package/prompts/commands/fix.md +12 -0
  672. package/prompts/commands/init-project.md +1 -0
  673. package/prompts/commands/map-codebase.md +15 -1
  674. package/prompts/commands/new-project.md +1 -0
  675. package/prompts/commands/next-milestone.md +2 -0
  676. package/prompts/commands/orchestrate.md +4 -4
  677. package/prompts/commands/plan-phase.md +5 -0
  678. package/prompts/commands/quick.md +4 -0
  679. package/prompts/commands/review.md +4 -1
  680. package/prompts/commands/verify-work.md +10 -8
@@ -32,13 +32,20 @@ Before analyzing, decompose codebase understanding into atomic reasoning units:
32
32
  ## Steps
33
33
  1. Run `draht-tools map-codebase $1`
34
34
  2. Tool generates: STACK.md, ARCHITECTURE.md, CONVENTIONS.md, CONCERNS.md
35
+ 2a. Run `draht-tools map-graph $1` to produce the **living architecture map**:
36
+ - `.planning/codebase/MAP.json` — machine-readable map with **entry points** (CLI bins, HTTP routes, library main exports), **sinks** (FS / net / DB / stdout / exec calls), **bounded contexts** (packages), **cross-package dataflow edges**, **symbol-resolved call edges**, **flows** (which sinks each entry point reaches and through which intermediate module), per-module **layer** (presentation / application / domain / infrastructure / support), and exports/imports per file. Agents starting a new task should read MAP.json first instead of re-scanning the tree.
37
+ - `.planning/codebase/MAP.html` — interactive layered visualization with three views:
38
+ - **System** — packages drawn as containers in architectural layers, with cross-package dataflow arrows. Thickness encodes import count.
39
+ - **Modules** — every file inside its package container, import edges between them; click a package or sink to highlight.
40
+ - **Flows** — entry points on top, sinks on bottom, intermediate modules ranked by depth from entry. Click an entry point to trace which sinks it reaches.
41
+ Open directly, or run `draht-tools map-serve` for a live-reloading dev view (regenerates on every file save).
35
42
  3. **Run parallel deep analysis via subagents:**
36
43
  Use the `subagent` tool in **parallel mode** with these tasks:
37
44
  - `architect` agent: "Analyze the codebase at $1. Identify bounded contexts from directory structure — look for top-level src/ subdirectories, packages, or modules that encapsulate coherent domain concepts. Note any cross-directory coupling suggesting blurred context boundaries. Extract domain language: collect PascalCase class/interface/type names, key function names, database table/collection names. Look for repeated nouns representing core domain concepts. Output a structured list of: bounded contexts (name + description), domain terms (glossary), aggregates per context, and context relationships (upstream/downstream, shared kernel, ACL). End with `STATUS: DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED`. Do NOT run draht, draht-tools, or pi commands."
38
45
  - `verifier` agent: "Analyze the test infrastructure at $1. Discover: test framework(s) in use, test directory conventions, existing coverage configuration and goals, which layers have tests (unit, integration, e2e), gaps and recommendations. Output a structured test strategy report. End with `STATUS: ...`. Do NOT run draht, draht-tools, or pi commands."
39
46
 
40
47
  4. Read each subagent's `STATUS:` line. `BLOCKED` or `NEEDS_CONTEXT` from either means STOP — partial output here corrupts downstream phases. Collect subagent results and merge with the draht-tools output.
41
- 5. Create `.planning/DOMAIN.md` (if it doesn't exist) with:
48
+ 5. Create `.planning/DOMAIN.md` (if it doesn't exist). Everything in it is **inferred from code, not confirmed by the user** — mark uncertain context boundaries and ambiguous terms as `(inferred)` so later commands know to confirm rather than build on them. With:
42
49
  - `## Bounded Contexts` — one entry per discovered context with a brief description
43
50
  - `## Ubiquitous Language` — glossary of extracted domain terms
44
51
  - `## Context Map` — how bounded contexts relate (upstream/downstream, shared kernel, ACL)
@@ -51,3 +58,10 @@ Before analyzing, decompose codebase understanding into atomic reasoning units:
51
58
  - `## Testing Levels` — what is tested at unit level vs integration vs e2e, with examples
52
59
  - `## Excluded` — what is explicitly not tested and why
53
60
  7. Commit: `draht-tools commit-docs "map existing codebase"`
61
+
62
+ ## Living map for agents
63
+
64
+ The `MAP.json` produced in step 2a is the single source of truth for "what's in this codebase":
65
+ - Subagents that need orientation should read `.planning/codebase/MAP.json` before walking the file tree.
66
+ - It is regenerated every time `map-codebase`, `map-graph`, or `map-serve` runs, so it stays current with the code.
67
+ - Developers can keep `draht-tools map-serve` running in a terminal — the HTML visualization updates live as files change, so architecture documentation is never stale.
@@ -70,5 +70,6 @@ Each step runs in its own session (`/new` between steps). Do NOT suggest `/next-
70
70
  - Follow threads based on answers
71
71
  - Use examples ("Like Stripe Checkout, or custom?")
72
72
  - Confirm, don't assume
73
+ - When the description names a solution ("an app with X"), ask what problem it solves — requirements record problems and outcomes; mechanisms stay candidates
73
74
  - 3-7 follow-up rounds typical
74
75
  - Stop when you have: problem, audience, MVP scope, constraints, success criteria
@@ -62,5 +62,7 @@ Before planning the next milestone, decompose progress into atomic reasoning uni
62
62
 
63
63
  ## Rules
64
64
  - Always review what was actually built, not just what was planned
65
+ - Distinguish **verified-complete** (a UAT report shows observed passes) from **believed-complete** (someone said so) — only the former counts toward requirement satisfaction; the latter goes back on the list
65
66
  - Be honest about requirements that slipped or changed scope
66
67
  - Each phase goal must be testable — "user can X" not "implement Y"
68
+ - Order the new phases risk-first: the phase carrying the highest uncertainty × blast radius comes earliest, so a wrong bet invalidates the least downstream work
@@ -15,9 +15,9 @@ Task: $ARGUMENTS
15
15
 
16
16
  Before delegating, decompose the task into atomic work units:
17
17
 
18
- 1. **State the logical components** — What sub-tasks make up this work? Which are independent?
18
+ 1. **State the logical components** — What sub-tasks make up this work? Which are independent? A sub-task is well-cut only if its success can be checked without reference to the others.
19
19
  2. **Match agents to work** — Which specialist is right for each sub-task?
20
- 3. **Determine order** — What can run in parallel vs what must be sequential?
20
+ 3. **Determine order** — What can run in parallel vs what must be sequential? Among independent sub-tasks, dispatch the riskiest first (highest uncertainty × blast radius): its failure invalidates the rest of the graph most cheaply, before effort is sunk into work it would obsolete.
21
21
  4. **Define success** — What does "done" look like for each sub-task, and for the whole?
22
22
 
23
23
  ## Agent Selection Guide
@@ -61,7 +61,7 @@ Never run quality review on a spec-non-compliant diff. This is the per-task loop
61
61
 
62
62
  Every draht agent ends its response with one of four status lines. Branch on it:
63
63
 
64
- - `STATUS: DONE` — proceed to the next step in the chain.
64
+ - `STATUS: DONE` — check the evidence before proceeding: a `DONE` that quotes no verification output (test counts, command results) is treated as `DONE_WITH_CONCERNS` — re-run the decisive check yourself. Subagent claims are inputs, not verdicts.
65
65
  - `STATUS: DONE_WITH_CONCERNS` — note the concerns. If correctness-related, address before moving on; otherwise log and continue.
66
66
  - `STATUS: NEEDS_CONTEXT` — provide the missing info and re-dispatch the same agent. Do NOT skip ahead with a guess.
67
67
  - `STATUS: BLOCKED` — STOP. Report the blocker. Do not retry the same agent on the same input — adjust inputs (more context, decompose further, different agent) or surface to the user.
@@ -72,7 +72,7 @@ Every draht agent ends its response with one of four status lines. Branch on it:
72
72
  3. Decide parallel vs chain vs fan-out vs two-stage based on dependencies
73
73
  4. Dispatch via the `subagent` tool accordingly
74
74
  5. Read each subagent's final `STATUS:` line and branch per the protocol above
75
- 6. Collect results, handle failures, report the final outcome to the user
75
+ 6. Collect results, handle failures, report to the user — outcome first (what happened, in one line), evidence second (what each agent verified, quoted), risk last (what remains unverified or assumed)
76
76
 
77
77
  ## Rules
78
78
  - Prefer parallel dispatch when possible — it's faster and each subagent has its own context
@@ -23,6 +23,7 @@ A plan is only as good as the tasks inside it. STOP and revise instead of saving
23
23
  - A task takes more than ~5 minutes — break it down further
24
24
  - The plan introduces new domain terms that are NOT in `.planning/DOMAIN.md` — update DOMAIN.md first
25
25
  - A plan touches more than one bounded context without explicit ACL — split per context
26
+ - The first plan is scaffolding/boilerplate while an unproven risk (new integration, unfamiliar API, untested pattern) sits in a later plan — reorder so the risk is proven first
26
27
 
27
28
  Run `draht-tools validate-plans $1` after saving. Fix any issues it reports before commit.
28
29
 
@@ -35,11 +36,15 @@ Before creating plans, decompose this phase goal into atomic reasoning units:
35
36
  2. **Validate independence** — Which artifacts (files, endpoints, schemas) prove this truth exists? Can it be built independently?
36
37
  3. **Verify correctness** — What test scenarios would prove this observable truth? What are the specific inputs → expected outputs?
37
38
 
39
+ **Atomicity test:** a task is atomic only if its `<verify>` can fail while every other task passes. If two tasks can only be checked together, they are one task.
40
+
38
41
  **Synthesize planning strategy:**
39
42
  - Group related observable truths into cohesive plans (2-5 tasks each)
40
43
  - Identify which plans can be created in parallel vs sequentially
41
44
  - Map each plan to specific bounded contexts and domain concepts
42
45
  - Ensure each plan produces testable, verifiable outcomes
46
+ - **Order risk-first**: score each truth by uncertainty (has this codebase done it before?) × blast radius (how much becomes invalid if it's wrong?). The plan proving the highest-scoring truth executes first; boilerplate goes last. Boilerplate never invalidates a phase — the risky part regularly does.
47
+ - Write every assumption a plan rests on as an explicit `Assumes:` line (with how to confirm it) in the plan header. Unwritten assumptions become the executor's bugs.
43
48
 
44
49
  ## Steps
45
50
  1. Run `draht-tools load-phase-context $1` to gather all context
@@ -13,6 +13,10 @@ Execute a small ad-hoc task with tracking.
13
13
 
14
14
  Task: $ARGUMENTS
15
15
 
16
+ ## "Small" Is a Claim, Not a Fact
17
+
18
+ Before planning, verify the task is actually quick: grep the blast radius (callers, imports, tests touching the target). If the change reaches further than the description implies, say so and recommend `/plan-phase`-level treatment instead of forcing it through. And if the description names a solution ("add a flag"), confirm the problem it solves — a smaller fix may exist. A "quick task" that silently grows is how untracked complexity enters a codebase.
19
+
16
20
  ## Atomic Reasoning
17
21
 
18
22
  Before executing, decompose this task into atomic reasoning units:
@@ -47,11 +47,14 @@ Before reviewing, decompose code changes into atomic reasoning units:
47
47
 
48
48
  5. Read each subagent's final `STATUS:` line.
49
49
  6. Collect and merge results.
50
- 7. Produce a unified, prioritized findings report:
50
+ 7. **Refute before reporting.** For each Critical or Important finding, attempt to kill it yourself before it reaches the report: read the code path that would make it a false positive — an upstream guard clause, a type constraint, an existing test that covers the case. A finding that survives an honest refutation attempt is **confirmed** (you traced the failing path); one you couldn't confirm is downgraded and labeled **suspected**. Reporting unattacked findings trains readers to ignore the report.
51
+ 8. Produce a unified, prioritized findings report. Verdict first: one line — mergeable or not, and why. Then findings:
51
52
  - **Critical** — must fix before merge (security `BLOCKED`, spec gaps for required deliverables, correctness issues that cause data loss / crashes)
52
53
  - **Important** — should fix (bugs, type issues, spec over-builds, missing error handling)
53
54
  - **Minor** — style, naming, optional improvements
54
55
 
56
+ Each finding carries its label (confirmed/suspected). End with residual risk: what the review did NOT cover (files skipped, paths not traced) — a review that claims total coverage it doesn't have is worse than a scoped one.
57
+
55
58
  ## Reading STATUS
56
59
  - Any `STATUS: BLOCKED` → its findings escalate to Critical in the merged report
57
60
  - `STATUS: NEEDS_CONTEXT` → provide missing info and re-dispatch that one agent
@@ -38,23 +38,25 @@ Before verifying, decompose phase acceptance into atomic reasoning units:
38
38
  - `reviewer` agent: "Review the recent code changes for this phase. Check domain language compliance against `.planning/DOMAIN.md` if it exists — scan for identifiers not in the glossary and cross-context boundary violations. Report Must fix / Should fix / Consider. End with `STATUS: ...`. Do NOT run draht, draht-tools, or pi commands."
39
39
  - `spec-reviewer` agent: "Phase-level spec compliance check for phase $1. The phase has these plan files (each is a spec): <list of .planning/phases/<N>-*/<N>-NN-PLAN.md paths>. For each plan, evaluate whether the phase's commits implement exactly what the plan's <task> elements asked — no missing tasks, no over-builds. Use git log and git diff against the phase commit range. Output a per-plan compliance verdict with omissions and over-builds. End with `STATUS: ...`."
40
40
 
41
- 4. **Read each subagent's `STATUS:` line.** Treat the phase as failed if any of these is `BLOCKED`:
41
+ 4. **Spot-check before aggregating.** Subagent claims are inputs, not verdicts. Before accepting the verifier's `DONE`, re-run the test suite headline yourself and read the counts. Before accepting the spec-reviewer's compliance verdict, read one plan's diff yourself. A pass you only heard about is an "assumed pass" — and an assumed pass is not a pass. This costs two commands and catches the most expensive failure mode this command has: trust laundered into evidence.
42
+
43
+ 5. **Read each subagent's `STATUS:` line.** Treat the phase as failed if any of these is `BLOCKED`:
42
44
  - `verifier` (tests / lint / typecheck failed)
43
45
  - `security-auditor` (Critical or High findings)
44
46
  - `spec-reviewer` (any plan non-compliant)
45
47
  - `reviewer` (Must-fix correctness issues)
46
48
 
47
- 5. Collect results and walk user through each deliverable, incorporating findings.
48
- 6. Record results (pass/fail/partially/skip).
49
- 7. For failures: diagnose and create fix plans via `draht-tools create-fix-plan $1 P`
49
+ 6. Collect results and walk user through each deliverable, incorporating findings.
50
+ 7. Record results (pass/fail/partially/skip). Label each: **observed** (you or a subagent ran it and quoted output), **derived** (follows necessarily from something observed), or **assumed** (unchecked). Verdicts inherit the weakest label they rest on.
51
+ 8. For failures: diagnose and create fix plans via `draht-tools create-fix-plan $1 P`
50
52
  - Fix plans MUST include a reproducing test that demonstrates the failure before any implementation
51
53
  - Spec-reviewer omissions become explicit fix-plan tasks (one task per omission)
52
- 8. Write UAT report: `draht-tools write-uat $1`
53
- - Report must include: test health summary (pass/fail/coverage), security audit results, **spec compliance summary per plan**, domain model status (any glossary violations), deliverable results
54
- 9. If all passed: mark phase complete.
54
+ 9. Write UAT report: `draht-tools write-uat $1`
55
+ - Order: **verdict first** (phase pass/fail, X/Y deliverables, in the first line), **evidence second** (test health summary with pass/fail/coverage, security audit results, spec compliance summary per plan, domain model status, deliverable results with labels), **risk last** (what was NOT tested and how it could bite). Never bury a failure under passes.
56
+ 10. If all passed: mark phase complete.
55
57
  - If more phases remain in the milestone: tell the user to start a new session and run `/discuss-phase N+1`.
56
58
  - If ALL phases in the milestone are complete: tell the user to start a new session and run `/next-milestone`.
57
- 10. If failures: route to `execute-phase $1 --gaps-only`
59
+ 11. If failures: route to `execute-phase $1 --gaps-only`
58
60
 
59
61
  ## Why a phase-level spec-reviewer
60
62