@draht/coding-agent 2026.4.5 → 2026.4.25

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 (234) hide show
  1. package/CHANGELOG.md +792 -625
  2. package/README.md +24 -15
  3. package/dist/cli/args.d.ts +7 -10
  4. package/dist/cli/args.d.ts.map +1 -1
  5. package/dist/cli/args.js +44 -46
  6. package/dist/cli/args.js.map +1 -1
  7. package/dist/cli.d.ts.map +1 -1
  8. package/dist/cli.js +1 -0
  9. package/dist/cli.js.map +1 -1
  10. package/dist/config.d.ts +9 -0
  11. package/dist/config.d.ts.map +1 -1
  12. package/dist/config.js +18 -0
  13. package/dist/config.js.map +1 -1
  14. package/dist/core/agent-session-runtime.d.ts +53 -106
  15. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  16. package/dist/core/agent-session-runtime.js +116 -147
  17. package/dist/core/agent-session-runtime.js.map +1 -1
  18. package/dist/core/agent-session-services.d.ts +86 -0
  19. package/dist/core/agent-session-services.d.ts.map +1 -0
  20. package/dist/core/agent-session-services.js +116 -0
  21. package/dist/core/agent-session-services.js.map +1 -0
  22. package/dist/core/agent-session.d.ts +8 -12
  23. package/dist/core/agent-session.d.ts.map +1 -1
  24. package/dist/core/agent-session.js +134 -45
  25. package/dist/core/agent-session.js.map +1 -1
  26. package/dist/core/bash-executor.d.ts.map +1 -1
  27. package/dist/core/bash-executor.js +19 -7
  28. package/dist/core/bash-executor.js.map +1 -1
  29. package/dist/core/compaction/compaction.d.ts +1 -1
  30. package/dist/core/compaction/compaction.d.ts.map +1 -1
  31. package/dist/core/compaction/compaction.js +18 -17
  32. package/dist/core/compaction/compaction.js.map +1 -1
  33. package/dist/core/extensions/index.d.ts +1 -1
  34. package/dist/core/extensions/index.d.ts.map +1 -1
  35. package/dist/core/extensions/index.js.map +1 -1
  36. package/dist/core/extensions/loader.d.ts.map +1 -1
  37. package/dist/core/extensions/loader.js +7 -7
  38. package/dist/core/extensions/loader.js.map +1 -1
  39. package/dist/core/extensions/runner.d.ts +1 -0
  40. package/dist/core/extensions/runner.d.ts.map +1 -1
  41. package/dist/core/extensions/runner.js +4 -0
  42. package/dist/core/extensions/runner.js.map +1 -1
  43. package/dist/core/extensions/types.d.ts +15 -14
  44. package/dist/core/extensions/types.d.ts.map +1 -1
  45. package/dist/core/extensions/types.js.map +1 -1
  46. package/dist/core/index.d.ts +2 -1
  47. package/dist/core/index.d.ts.map +1 -1
  48. package/dist/core/index.js +2 -1
  49. package/dist/core/index.js.map +1 -1
  50. package/dist/core/keybindings.d.ts +14 -1
  51. package/dist/core/keybindings.d.ts.map +1 -1
  52. package/dist/core/keybindings.js +13 -14
  53. package/dist/core/keybindings.js.map +1 -1
  54. package/dist/core/model-registry.d.ts.map +1 -1
  55. package/dist/core/model-registry.js +31 -1
  56. package/dist/core/model-registry.js.map +1 -1
  57. package/dist/core/package-manager.d.ts +21 -1
  58. package/dist/core/package-manager.d.ts.map +1 -1
  59. package/dist/core/package-manager.js +108 -43
  60. package/dist/core/package-manager.js.map +1 -1
  61. package/dist/core/prompt-templates.d.ts.map +1 -1
  62. package/dist/core/prompt-templates.js +22 -21
  63. package/dist/core/prompt-templates.js.map +1 -1
  64. package/dist/core/resource-loader.d.ts +0 -2
  65. package/dist/core/resource-loader.d.ts.map +1 -1
  66. package/dist/core/resource-loader.js +26 -8
  67. package/dist/core/resource-loader.js.map +1 -1
  68. package/dist/core/sdk.d.ts +2 -2
  69. package/dist/core/sdk.d.ts.map +1 -1
  70. package/dist/core/sdk.js +2 -2
  71. package/dist/core/sdk.js.map +1 -1
  72. package/dist/core/session-cwd.d.ts +19 -0
  73. package/dist/core/session-cwd.d.ts.map +1 -0
  74. package/dist/core/session-cwd.js +38 -0
  75. package/dist/core/session-cwd.js.map +1 -0
  76. package/dist/core/session-manager.d.ts +5 -1
  77. package/dist/core/session-manager.d.ts.map +1 -1
  78. package/dist/core/session-manager.js +16 -8
  79. package/dist/core/session-manager.js.map +1 -1
  80. package/dist/core/settings-manager.d.ts +6 -4
  81. package/dist/core/settings-manager.d.ts.map +1 -1
  82. package/dist/core/settings-manager.js +5 -1
  83. package/dist/core/settings-manager.js.map +1 -1
  84. package/dist/core/skills.d.ts +1 -1
  85. package/dist/core/skills.d.ts.map +1 -1
  86. package/dist/core/skills.js +3 -3
  87. package/dist/core/skills.js.map +1 -1
  88. package/dist/core/system-prompt.d.ts.map +1 -1
  89. package/dist/core/system-prompt.js +6 -6
  90. package/dist/core/system-prompt.js.map +1 -1
  91. package/dist/core/timings.d.ts +1 -0
  92. package/dist/core/timings.d.ts.map +1 -1
  93. package/dist/core/timings.js +6 -0
  94. package/dist/core/timings.js.map +1 -1
  95. package/dist/core/tools/bash.d.ts.map +1 -1
  96. package/dist/core/tools/bash.js +19 -9
  97. package/dist/core/tools/bash.js.map +1 -1
  98. package/dist/core/tools/edit-diff.d.ts +23 -1
  99. package/dist/core/tools/edit-diff.d.ts.map +1 -1
  100. package/dist/core/tools/edit-diff.js +150 -57
  101. package/dist/core/tools/edit-diff.js.map +1 -1
  102. package/dist/core/tools/edit.d.ts +13 -11
  103. package/dist/core/tools/edit.d.ts.map +1 -1
  104. package/dist/core/tools/edit.js +55 -77
  105. package/dist/core/tools/edit.js.map +1 -1
  106. package/dist/core/tools/file-mutation-queue.d.ts.map +1 -1
  107. package/dist/core/tools/file-mutation-queue.js +4 -4
  108. package/dist/core/tools/file-mutation-queue.js.map +1 -1
  109. package/dist/core/tools/index.d.ts +9 -6
  110. package/dist/core/tools/index.d.ts.map +1 -1
  111. package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
  112. package/dist/core/tools/tool-definition-wrapper.js +2 -0
  113. package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
  114. package/dist/index.d.ts +4 -4
  115. package/dist/index.d.ts.map +1 -1
  116. package/dist/index.js +4 -5
  117. package/dist/index.js.map +1 -1
  118. package/dist/main.d.ts.map +1 -1
  119. package/dist/main.js +252 -451
  120. package/dist/main.js.map +1 -1
  121. package/dist/migrations.d.ts +3 -3
  122. package/dist/migrations.d.ts.map +1 -1
  123. package/dist/migrations.js +25 -5
  124. package/dist/migrations.js.map +1 -1
  125. package/dist/modes/interactive/components/assistant-message.d.ts +3 -1
  126. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  127. package/dist/modes/interactive/components/assistant-message.js +14 -3
  128. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  129. package/dist/modes/interactive/components/earendil-announcement.d.ts +5 -0
  130. package/dist/modes/interactive/components/earendil-announcement.d.ts.map +1 -0
  131. package/dist/modes/interactive/components/earendil-announcement.js +40 -0
  132. package/dist/modes/interactive/components/earendil-announcement.js.map +1 -0
  133. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  134. package/dist/modes/interactive/components/settings-selector.js +1 -0
  135. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  136. package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
  137. package/dist/modes/interactive/components/thinking-selector.js +1 -0
  138. package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
  139. package/dist/modes/interactive/components/tool-execution.d.ts +0 -1
  140. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  141. package/dist/modes/interactive/components/tool-execution.js +2 -7
  142. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  143. package/dist/modes/interactive/components/tree-selector.d.ts +4 -2
  144. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  145. package/dist/modes/interactive/components/tree-selector.js +48 -15
  146. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  147. package/dist/modes/interactive/interactive-mode.d.ts +12 -3
  148. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  149. package/dist/modes/interactive/interactive-mode.js +237 -125
  150. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  151. package/dist/modes/interactive/theme/dark.json +8 -5
  152. package/dist/modes/interactive/theme/light.json +8 -5
  153. package/dist/modes/interactive/theme/theme-schema.json +6 -1
  154. package/dist/modes/interactive/theme/theme.d.ts +2 -2
  155. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  156. package/dist/modes/interactive/theme/theme.js +13 -1
  157. package/dist/modes/interactive/theme/theme.js.map +1 -1
  158. package/dist/modes/print-mode.d.ts +4 -4
  159. package/dist/modes/print-mode.d.ts.map +1 -1
  160. package/dist/modes/print-mode.js +6 -2
  161. package/dist/modes/print-mode.js.map +1 -1
  162. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  163. package/dist/modes/rpc/rpc-client.js +1 -0
  164. package/dist/modes/rpc/rpc-client.js.map +1 -1
  165. package/dist/modes/rpc/rpc-mode.d.ts +2 -2
  166. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  167. package/dist/modes/rpc/rpc-mode.js +26 -15
  168. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  169. package/dist/package-manager-cli.d.ts +4 -0
  170. package/dist/package-manager-cli.d.ts.map +1 -0
  171. package/dist/package-manager-cli.js +234 -0
  172. package/dist/package-manager-cli.js.map +1 -0
  173. package/dist/prompts/commands/atomic-commit.md +17 -0
  174. package/dist/prompts/commands/discuss-phase.md +15 -0
  175. package/dist/prompts/commands/execute-phase.md +14 -0
  176. package/dist/prompts/commands/fix.md +14 -0
  177. package/dist/prompts/commands/init-project.md +16 -0
  178. package/dist/prompts/commands/map-codebase.md +16 -0
  179. package/dist/prompts/commands/new-project.md +16 -0
  180. package/dist/prompts/commands/next-milestone.md +16 -0
  181. package/dist/prompts/commands/orchestrate.md +57 -0
  182. package/dist/prompts/commands/pause-work.md +13 -0
  183. package/dist/prompts/commands/plan-phase.md +15 -0
  184. package/dist/prompts/commands/progress.md +13 -0
  185. package/dist/prompts/commands/quick.md +14 -0
  186. package/dist/prompts/commands/resume-work.md +13 -0
  187. package/dist/prompts/commands/review.md +15 -0
  188. package/dist/prompts/commands/verify-work.md +15 -0
  189. package/dist/utils/paths.d.ts +7 -0
  190. package/dist/utils/paths.d.ts.map +1 -0
  191. package/dist/utils/paths.js +19 -0
  192. package/dist/utils/paths.js.map +1 -0
  193. package/docs/compaction.md +5 -3
  194. package/docs/custom-provider.md +1 -1
  195. package/docs/development.md +3 -1
  196. package/docs/extensions.md +150 -54
  197. package/docs/json.md +5 -2
  198. package/docs/keybindings.md +2 -0
  199. package/docs/models.md +55 -4
  200. package/docs/rpc.md +21 -7
  201. package/docs/sdk.md +116 -48
  202. package/docs/session.md +3 -3
  203. package/docs/settings.md +12 -0
  204. package/docs/skills.md +3 -2
  205. package/docs/tree.md +5 -2
  206. package/examples/README.md +1 -1
  207. package/examples/extensions/README.md +1 -0
  208. package/examples/extensions/antigravity-image-gen.ts +1 -1
  209. package/examples/extensions/custom-provider-gitlab-duo/index.ts +1 -1
  210. package/examples/extensions/doom-overlay/doom/build.sh +2 -2
  211. package/examples/extensions/hidden-thinking-label.ts +53 -0
  212. package/examples/extensions/overlay-qa-tests.ts +2 -2
  213. package/examples/extensions/sandbox/index.ts +8 -4
  214. package/examples/extensions/subagent/index.ts +5 -5
  215. package/examples/extensions/trigger-compact.ts +11 -1
  216. package/examples/sdk/13-session-runtime.ts +30 -12
  217. package/examples/sdk/README.md +4 -2
  218. package/package.json +7 -8
  219. package/prompts/commands/atomic-commit.md +17 -0
  220. package/prompts/commands/discuss-phase.md +15 -0
  221. package/prompts/commands/execute-phase.md +14 -0
  222. package/prompts/commands/fix.md +14 -0
  223. package/prompts/commands/init-project.md +16 -0
  224. package/prompts/commands/map-codebase.md +16 -0
  225. package/prompts/commands/new-project.md +16 -0
  226. package/prompts/commands/next-milestone.md +16 -0
  227. package/prompts/commands/orchestrate.md +57 -0
  228. package/prompts/commands/pause-work.md +13 -0
  229. package/prompts/commands/plan-phase.md +15 -0
  230. package/prompts/commands/progress.md +13 -0
  231. package/prompts/commands/quick.md +14 -0
  232. package/prompts/commands/resume-work.md +13 -0
  233. package/prompts/commands/review.md +15 -0
  234. package/prompts/commands/verify-work.md +15 -0
@@ -1,27 +1,45 @@
1
1
  /**
2
- * Session Runtime Host
2
+ * Session runtime
3
3
  *
4
- * Use the runtime host when you need to replace the active AgentSession,
4
+ * Use AgentSessionRuntime when you need to replace the active AgentSession,
5
5
  * for example for new-session, resume, fork, or import flows.
6
6
  *
7
- * The important pattern is: after the host replaces the runtime, rebind any
8
- * session-local subscriptions and extension bindings to `runtimeHost.session`.
7
+ * The important pattern is: after the runtime replaces the active session,
8
+ * rebind any session-local subscriptions and extension bindings to `runtime.session`.
9
9
  */
10
10
 
11
- import { AgentSessionRuntimeHost, createAgentSessionRuntime, SessionManager } from "@draht/coding-agent";
11
+ import {
12
+ type CreateAgentSessionRuntimeFactory,
13
+ createAgentSessionFromServices,
14
+ createAgentSessionRuntime,
15
+ createAgentSessionServices,
16
+ getAgentDir,
17
+ SessionManager,
18
+ } from "@draht/coding-agent";
12
19
 
13
- const bootstrap = {};
14
- const runtime = await createAgentSessionRuntime(bootstrap, {
20
+ const createRuntime: CreateAgentSessionRuntimeFactory = async ({ cwd, sessionManager, sessionStartEvent }) => {
21
+ const services = await createAgentSessionServices({ cwd });
22
+ return {
23
+ ...(await createAgentSessionFromServices({
24
+ services,
25
+ sessionManager,
26
+ sessionStartEvent,
27
+ })),
28
+ services,
29
+ diagnostics: services.diagnostics,
30
+ };
31
+ };
32
+ const runtime = await createAgentSessionRuntime(createRuntime, {
15
33
  cwd: process.cwd(),
34
+ agentDir: getAgentDir(),
16
35
  sessionManager: SessionManager.create(process.cwd()),
17
36
  });
18
- const runtimeHost = new AgentSessionRuntimeHost(bootstrap, runtime);
19
37
 
20
38
  let unsubscribe: (() => void) | undefined;
21
39
 
22
40
  async function bindSession() {
23
41
  unsubscribe?.();
24
- const session = runtimeHost.session;
42
+ const session = runtime.session;
25
43
  await session.bindExtensions({});
26
44
  unsubscribe = session.subscribe((event) => {
27
45
  if (event.type === "queue_update") {
@@ -35,15 +53,15 @@ let session = await bindSession();
35
53
  const originalSessionFile = session.sessionFile;
36
54
  console.log("Initial session:", originalSessionFile);
37
55
 
38
- await runtimeHost.newSession();
56
+ await runtime.newSession();
39
57
  session = await bindSession();
40
58
  console.log("After newSession():", session.sessionFile);
41
59
 
42
60
  if (originalSessionFile) {
43
- await runtimeHost.switchSession(originalSessionFile);
61
+ await runtime.switchSession(originalSessionFile);
44
62
  session = await bindSession();
45
63
  console.log("After switchSession():", session.sessionFile);
46
64
  }
47
65
 
48
66
  unsubscribe?.();
49
- await runtimeHost.dispose();
67
+ await runtime.dispose();
@@ -1,6 +1,8 @@
1
1
  # SDK Examples
2
2
 
3
- Programmatic usage of @draht/coding-agent via `createAgentSession()` and `createAgentSessionRuntime()`.
3
+ Programmatic usage of draht coding agent via `createAgentSession()` and `createAgentSessionRuntime()`.
4
+
5
+ The runtime example shows how to build a recreate function that closes over process-global fixed inputs and recreates cwd-bound services and sessions as the active session cwd changes.
4
6
 
5
7
  ## Examples
6
8
 
@@ -112,7 +114,7 @@ await session.prompt("Hello");
112
114
  | `authStorage` | `AuthStorage.create()` | Credential storage |
113
115
  | `modelRegistry` | `ModelRegistry.create(authStorage)` | Model registry |
114
116
  | `cwd` | `process.cwd()` | Working directory |
115
- | `agentDir` | `~/.draht/agent` | Config directory |
117
+ | `agentDir` | `~/.pi/agent` | Config directory |
116
118
  | `model` | From settings/first available | Model to use |
117
119
  | `thinkingLevel` | From settings/"off" | off, low, medium, high |
118
120
  | `tools` | `codingTools` | Built-in tools |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draht/coding-agent",
3
- "version": "2026.4.5",
3
+ "version": "2026.4.25",
4
4
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "drahtConfig": {
@@ -38,7 +38,7 @@
38
38
  "clean": "shx rm -rf dist",
39
39
  "dev": "tsgo -p tsconfig.build.json --watch --preserveWatchOutput",
40
40
  "build": "tsgo -p tsconfig.build.json && shx chmod +x dist/cli.js && bun run copy-assets",
41
- "build:binary": "bun run build && bun build --compile ./dist/cli.js --outfile dist/pi && bun run copy-binary-assets",
41
+ "build:binary": "bun run build && bun build --compile ./dist/cli.js --outfile dist/draht && bun run copy-binary-assets",
42
42
  "copy-assets": "shx mkdir -p dist/modes/interactive/theme && shx cp src/modes/interactive/theme/*.json dist/modes/interactive/theme/ && shx mkdir -p dist/core/export-html/vendor && shx cp src/core/export-html/template.html src/core/export-html/template.css src/core/export-html/template.js dist/core/export-html/ && shx cp src/core/export-html/vendor/*.js dist/core/export-html/vendor/ && shx rm -rf dist/prompts dist/hooks dist/agents && shx cp -r prompts dist/prompts && shx cp -r hooks dist/hooks && shx cp -r agents dist/agents",
43
43
  "copy-binary-assets": "shx cp package.json dist/ && shx cp README.md dist/ && shx cp CHANGELOG.md dist/ && shx mkdir -p dist/theme && shx cp src/modes/interactive/theme/*.json dist/theme/ && shx mkdir -p dist/export-html/vendor && shx cp src/core/export-html/template.html dist/export-html/ && shx cp src/core/export-html/vendor/*.js dist/export-html/vendor/ && shx cp -r docs dist/ && shx cp -r examples dist/ && shx cp -r prompts dist/ && shx cp -r hooks dist/ && shx cp -r agents dist/ && shx cp ../../node_modules/@silvia-odwyer/photon-node/photon_rs_bg.wasm dist/",
44
44
  "test": "vitest --run",
@@ -46,12 +46,11 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "@mariozechner/jiti": "^2.6.2",
49
- "@sinclair/typebox": "^0.34.41",
50
- "ajv": "^8.17.1",
51
- "@draht/agent-core": "2026.4.5",
52
- "@draht/ai": "2026.4.5",
53
- "@draht/tui": "2026.4.5",
49
+ "@draht/agent-core": "workspace:*",
50
+ "@draht/ai": "workspace:*",
51
+ "@draht/tui": "workspace:*",
54
52
  "@silvia-odwyer/photon-node": "^0.3.4",
53
+ "ajv": "^8.17.1",
55
54
  "chalk": "^5.5.0",
56
55
  "cli-highlight": "^2.1.11",
57
56
  "diff": "^8.0.2",
@@ -94,7 +93,7 @@
94
93
  "tui",
95
94
  "agent"
96
95
  ],
97
- "author": "Oskar Freye",
96
+ "author": "Mario Zechner",
98
97
  "license": "MIT",
99
98
  "publishConfig": {
100
99
  "access": "public"
@@ -4,6 +4,23 @@ description: "Analyze changes and create atomic commits"
4
4
 
5
5
  # Git Atomic Commit Analysis
6
6
 
7
+ ## Atomic Reasoning
8
+
9
+ Before creating commits, decompose changes into atomic reasoning units:
10
+
11
+ **For each file change:**
12
+ 1. **State the logical component** — What does this change do? What is its purpose? Does it complete a thought?
13
+ 2. **Validate independence** — Can this change be applied independently? Does it depend on other changes? Does it break the build alone?
14
+ 3. **Verify correctness** — Is this change logically complete? Does it mix concerns? Should it be split further?
15
+
16
+ **Synthesize commit strategy:**
17
+ - Group changes by logical concern (one commit = one idea)
18
+ - Order commits so each builds successfully
19
+ - Write clear commit messages that explain WHY, not just WHAT
20
+ - Ensure each commit is self-contained and reviewable
21
+
22
+ ## Gathering Current State
23
+
7
24
  First, gather the current state:
8
25
 
9
26
  1. Run `git status` to see what changed
@@ -13,6 +13,21 @@ Capture implementation decisions before planning a phase.
13
13
 
14
14
  Phase: $1
15
15
 
16
+ ## Atomic Reasoning
17
+
18
+ Before questioning, decompose this phase scope into atomic reasoning units:
19
+
20
+ **For each implementation decision:**
21
+ 1. **State the logical component** — What gray area exists? What choice needs to be made? Why does this matter?
22
+ 2. **Validate independence** — Can this decision be made independently, or does it depend on other choices? What downstream impacts does it have?
23
+ 3. **Verify correctness** — What criteria determine the right answer? What trade-offs exist? What domain terms need clarification?
24
+
25
+ **Synthesize discussion strategy:**
26
+ - Identify critical decisions that block planning
27
+ - Group related decisions (e.g., all API decisions together)
28
+ - Sequence questions from foundational to detailed
29
+ - Ensure domain language is established first
30
+
16
31
  ## Steps
17
32
  1. Run `draht-tools phase-info $1` to load phase context
18
33
  2. Identify gray areas based on what's being built
@@ -14,6 +14,20 @@ Execute all plans in a phase with atomic commits, parallelizing independent plan
14
14
  Phase: $1
15
15
  Arguments: $ARGUMENTS
16
16
 
17
+ ## Atomic Reasoning
18
+
19
+ Before executing, decompose this phase execution into atomic reasoning units:
20
+
21
+ **For each plan in the phase:**
22
+ 1. **State the logical component** — What is this plan's singular purpose? What observable outcome does it produce?
23
+ 2. **Validate independence** — Can this plan execute in parallel with others, or does it depend on their outputs? Which files does it touch?
24
+ 3. **Verify correctness** — What tests will prove this plan works? What failure modes exist?
25
+
26
+ **Synthesize execution strategy:**
27
+ - Identify parallel execution groups (plans with no shared files/dependencies)
28
+ - Order dependent plans (plan B depends on plan A's outputs)
29
+ - Map each plan to a subagent task with clear success criteria
30
+
17
31
  ## Steps
18
32
  1. Run `draht-tools discover-plans $1` to find and order plans
19
33
  2. Read each plan file yourself (from `.planning/phases/`) and analyze dependencies to identify which plans can run in parallel vs sequential
@@ -13,6 +13,20 @@ Diagnose and fix a specific bug or failing task with TDD discipline, using a sub
13
13
 
14
14
  Issue: $ARGUMENTS
15
15
 
16
+ ## Atomic Reasoning
17
+
18
+ Before diagnosing, decompose this bug into atomic reasoning units:
19
+
20
+ 1. **State the logical component** — What is the observed failure? What should happen vs what actually happens?
21
+ 2. **Validate independence** — Which components/files are involved? Can we isolate the failure? Are there related bugs that should be fixed separately?
22
+ 3. **Verify correctness** — What test will reproduce this bug reliably? What would prove it's fixed? What regressions could the fix introduce?
23
+
24
+ **Synthesize fix strategy:**
25
+ - Trace the failure to root cause
26
+ - Write a minimal reproducing test
27
+ - Identify the smallest change that makes the test pass
28
+ - Plan regression checks
29
+
16
30
  ## Steps
17
31
  1. **Diagnose via subagent**: Use the `subagent` tool in **single mode** with the `debugger` agent:
18
32
  "Diagnose this issue: $ARGUMENTS. Reproduce the bug by running the relevant test or command. Trace the root cause by reading the code. Identify the exact files and lines involved. Do NOT fix it yet — only report the diagnosis with: root cause, affected files, and a recommended fix approach. Do NOT run draht, draht-tools, or pi commands."
@@ -16,6 +16,22 @@ Focus: $ARGUMENTS
16
16
  Use this when you have an existing codebase and want to add structured planning.
17
17
  For greenfield projects, use `/new-project` instead.
18
18
 
19
+ ## Atomic Reasoning
20
+
21
+ Before initializing, decompose project understanding into atomic reasoning units:
22
+
23
+ **For each aspect of the existing project:**
24
+ 1. **State the logical component** — What does this project do? Who are the users? What problems does it solve?
25
+ 2. **Validate independence** — What bounded contexts exist in the code? What domain concepts are already present? Can they be separated cleanly?
26
+ 3. **Verify correctness** — What works well that we must preserve? What pain points exist? What constraints limit changes?
27
+
28
+ **Synthesize initialization strategy:**
29
+ - Map existing architecture and conventions
30
+ - Extract domain model from code (bounded contexts, aggregates, ubiquitous language)
31
+ - Identify test strategy and coverage
32
+ - Define requirements that align with existing structure
33
+ - Create roadmap that respects what already works
34
+
19
35
  ## Steps
20
36
  1. Run `draht-tools init` to check preconditions (git repo, etc.)
21
37
  2. Run `draht-tools map-codebase` to build a structural map of the existing code
@@ -13,6 +13,22 @@ Analyze existing codebase before planning, using subagents for parallel analysis
13
13
 
14
14
  Directory: $1
15
15
 
16
+ ## Atomic Reasoning
17
+
18
+ Before analyzing, decompose codebase understanding into atomic reasoning units:
19
+
20
+ **For each architectural layer:**
21
+ 1. **State the logical component** — What is this directory/module's responsibility? What concepts does it encapsulate?
22
+ 2. **Validate independence** — Is this a bounded context? What are its dependencies? Does it leak abstractions across boundaries?
23
+ 3. **Verify correctness** — What domain terms appear in code? What aggregates exist? What test infrastructure is present?
24
+
25
+ **Synthesize analysis strategy:**
26
+ - Map directory structure to bounded contexts
27
+ - Extract domain language from identifiers (classes, functions, types)
28
+ - Identify context relationships (upstream/downstream, shared kernel)
29
+ - Document test strategy and coverage
30
+ - Note architectural concerns and patterns
31
+
16
32
  ## Steps
17
33
  1. Run `draht-tools map-codebase $1`
18
34
  2. Tool generates: STACK.md, ARCHITECTURE.md, CONVENTIONS.md, CONCERNS.md
@@ -13,6 +13,22 @@ Initialize a new project: questioning → research → requirements → roadmap.
13
13
 
14
14
  Description: $ARGUMENTS
15
15
 
16
+ ## Atomic Reasoning
17
+
18
+ Before questioning, decompose project vision into atomic reasoning units:
19
+
20
+ **For each aspect of the new project:**
21
+ 1. **State the logical component** — What problem does this solve? Who are the users? What is core vs peripheral?
22
+ 2. **Validate independence** — What bounded contexts will exist? What domain concepts are central? Can features be built independently?
23
+ 3. **Verify correctness** — What defines MVP success? What constraints exist (time, tech, team)? What is explicitly out of scope?
24
+
25
+ **Synthesize project strategy:**
26
+ - Define bounded contexts and ubiquitous language upfront
27
+ - Establish test strategy before writing code
28
+ - Create requirements mapped to domain contexts
29
+ - Build roadmap with testable phase goals
30
+ - Ensure each phase delivers verifiable user value
31
+
16
32
  ## Steps
17
33
  1. Run `draht-tools init` to check preconditions
18
34
  2. If existing code detected, run `draht-tools map-codebase` first
@@ -11,6 +11,22 @@ Plan the next milestone after ALL phases in the current one are complete.
11
11
  /next-milestone
12
12
  ```
13
13
 
14
+ ## Atomic Reasoning
15
+
16
+ Before planning the next milestone, decompose progress into atomic reasoning units:
17
+
18
+ **For each completed phase:**
19
+ 1. **State the logical component** — What was built? What user value was delivered? What requirements were satisfied?
20
+ 2. **Validate independence** — What worked well? What had issues? What assumptions proved wrong?
21
+ 3. **Verify correctness** — What tests passed? What domain model evolved? What new knowledge emerged?
22
+
23
+ **Synthesize next milestone:**
24
+ - Assess which v1 requirements remain vs are complete
25
+ - Identify requirements that should be promoted or descoped based on learning
26
+ - Define 3-5 new phases with clear, testable goals
27
+ - Order phases by dependency and risk
28
+ - Map each phase to specific requirements and domain contexts
29
+
14
30
  ## Prerequisites
15
31
  - `.planning/ROADMAP.md` must exist
16
32
  - ALL phases in the current milestone must be complete (verified via /verify-work)
@@ -0,0 +1,57 @@
1
+ ---
2
+ description: "Decompose a task and dispatch the right mix of specialist subagents"
3
+ argument-hint: "<task description>"
4
+ ---
5
+
6
+ # /orchestrate
7
+
8
+ Decompose a task and dispatch the right mix of specialist subagents.
9
+
10
+ Task: $ARGUMENTS
11
+
12
+ > **Tool note**: Use the `subagent` tool. Set `agent` to one of: `architect`, `implementer`, `reviewer`, `debugger`, `verifier`, `git-committer`, `security-auditor`. Use `tasks: [...]` for parallel dispatch and `chain: [...]` for sequential pipelines.
13
+
14
+ ## Atomic Reasoning
15
+
16
+ Before delegating, decompose the task into atomic work units:
17
+
18
+ 1. **State the logical components** — What sub-tasks make up this work? Which are independent?
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?
21
+ 4. **Define success** — What does "done" look like for each sub-task, and for the whole?
22
+
23
+ ## Agent Selection Guide
24
+
25
+ | Need | Agent |
26
+ |---|---|
27
+ | Plan structure before coding | `architect` |
28
+ | Write or change code | `implementer` |
29
+ | Find what's broken | `debugger` |
30
+ | Review for correctness / conventions / domain | `reviewer` |
31
+ | Audit for security issues | `security-auditor` |
32
+ | Run lint / typecheck / tests | `verifier` |
33
+ | Create atomic commits | `git-committer` |
34
+
35
+ ## Orchestration Modes
36
+
37
+ ### Parallel
38
+ Use the `subagent` tool with `tasks: [...]` when sub-tasks don't depend on each other. Example: review + security audit of the same change set.
39
+
40
+ ### Chain
41
+ Use the `subagent` tool with `chain: [...]` when later work depends on earlier output. Earlier output is interpolated via `{previous}` in the next task. Example: architect produces plan → implementer executes plan → verifier runs tests → reviewer audits the diff.
42
+
43
+ ### Fan-out / Fan-in
44
+ Architect decomposes into N independent plans → dispatch N implementers in parallel → collect all outputs → single verifier run → single reviewer audit. This is the standard pattern for `/execute-phase` work.
45
+
46
+ ## Steps
47
+ 1. Read the task description and identify sub-tasks
48
+ 2. Map each sub-task to the right agent from the table above
49
+ 3. Decide parallel vs chain vs fan-out based on dependencies
50
+ 4. Dispatch via the `subagent` tool accordingly
51
+ 5. Collect results, handle failures, report the final outcome to the user
52
+
53
+ ## Rules
54
+ - Prefer parallel dispatch when possible — it's faster and each subagent has its own context
55
+ - Pass complete context to subagents — they cannot see the main conversation
56
+ - Do not nest delegations deeply — one level is usually enough
57
+ - If a subagent fails, report the failure and suggest next steps rather than retrying blindly
@@ -11,6 +11,19 @@ Create a handoff document for session continuity.
11
11
  /pause-work
12
12
  ```
13
13
 
14
+ ## Atomic Reasoning
15
+
16
+ Before pausing, decompose session state into atomic reasoning units:
17
+
18
+ 1. **State the logical component** — What was accomplished this session? What is in-progress? What is the current phase/task?
19
+ 2. **Validate independence** — Are there uncommitted changes? Are there blockers? What decisions were made?
20
+ 3. **Verify correctness** — Is the current state stable? Can work resume cleanly? What context needs to be captured?
21
+
22
+ **Synthesize handoff document:**
23
+ - Capture current phase and status
24
+ - Document decisions and blockers
25
+ - Note next steps for resumption
26
+
14
27
  ## Steps
15
28
  1. Run `draht-tools pause` — creates CONTINUE-HERE.md
16
29
  2. Commit: `draht-tools commit-docs "pause work"`
@@ -13,6 +13,21 @@ Create atomic execution plans for a roadmap phase, using subagents for parallel
13
13
 
14
14
  Phase: $1
15
15
 
16
+ ## Atomic Reasoning
17
+
18
+ Before creating plans, decompose this phase goal into atomic reasoning units:
19
+
20
+ **For each observable truth (user-visible outcome):**
21
+ 1. **State the logical component** — What must be true for the user? What can they do/see/verify?
22
+ 2. **Validate independence** — Which artifacts (files, endpoints, schemas) prove this truth exists? Can it be built independently?
23
+ 3. **Verify correctness** — What test scenarios would prove this observable truth? What are the specific inputs → expected outputs?
24
+
25
+ **Synthesize planning strategy:**
26
+ - Group related observable truths into cohesive plans (2-5 tasks each)
27
+ - Identify which plans can be created in parallel vs sequentially
28
+ - Map each plan to specific bounded contexts and domain concepts
29
+ - Ensure each plan produces testable, verifiable outcomes
30
+
16
31
  ## Steps
17
32
  1. Run `draht-tools load-phase-context $1` to gather all context
18
33
  2. Optional: `draht-tools research-phase $1` for domain research
@@ -11,6 +11,19 @@ Show current project status.
11
11
  /progress
12
12
  ```
13
13
 
14
+ ## Atomic Reasoning
15
+
16
+ Before checking progress, decompose project state into atomic reasoning units:
17
+
18
+ 1. **State the logical component** — What milestone are we in? What phase is active? What work is complete vs in-progress?
19
+ 2. **Validate independence** — Are there blockers? Are phases in the correct sequence? Is anything waiting on external input?
20
+ 3. **Verify correctness** — Does the reported state match reality? Are all verified phases truly complete? Are there unreported issues?
21
+
22
+ **Synthesize status understanding:**
23
+ - Identify where we are in the roadmap
24
+ - Assess momentum and blockers
25
+ - Determine next action
26
+
14
27
  ## Steps
15
28
  1. Run `draht-tools progress` — outputs formatted status
16
29
  2. Display the result as-is
@@ -13,6 +13,20 @@ Execute a small ad-hoc task with tracking.
13
13
 
14
14
  Task: $ARGUMENTS
15
15
 
16
+ ## Atomic Reasoning
17
+
18
+ Before executing, decompose this task into atomic reasoning units:
19
+
20
+ 1. **State the logical component** — What is the single, concrete outcome? What files need to change? What behavior needs to work?
21
+ 2. **Validate independence** — Can this be done without touching other features? What dependencies exist? What could break?
22
+ 3. **Verify correctness** — What test proves this works? What edge cases matter? Is this testable behavior or pure config?
23
+
24
+ **Synthesize execution plan:**
25
+ - Define specific files to modify
26
+ - Write failing test (if testable behavior)
27
+ - Implement minimal solution
28
+ - Verify and document
29
+
16
30
  ## Steps
17
31
  1. Run `draht-tools next-quick-number` to get task number
18
32
  2. Analyze the task and write a concrete plan with actual task details (files, actions, verification). Pipe it into `draht-tools create-quick-plan`:
@@ -11,6 +11,19 @@ Resume from last session state.
11
11
  /resume-work
12
12
  ```
13
13
 
14
+ ## Atomic Reasoning
15
+
16
+ Before resuming, decompose handoff context into atomic reasoning units:
17
+
18
+ 1. **State the logical component** — What phase/task was active? What was the last accomplishment? What decisions were made?
19
+ 2. **Validate independence** — Are there blockers? What changed since the pause? Is the codebase in the expected state?
20
+ 3. **Verify correctness** — Is the handoff document complete? Does the current state match what was documented? Can work continue safely?
21
+
22
+ **Synthesize resumption plan:**
23
+ - Understand current context
24
+ - Identify next action
25
+ - Confirm no conflicts or state drift
26
+
14
27
  ## Steps
15
28
  1. Run `draht-tools resume` — loads CONTINUE-HERE.md or STATE.md
16
29
  2. Display context and ask to continue
@@ -15,6 +15,21 @@ Scope: $ARGUMENTS
15
15
 
16
16
  If no scope given, reviews all recent uncommitted changes.
17
17
 
18
+ ## Atomic Reasoning
19
+
20
+ Before reviewing, decompose code changes into atomic reasoning units:
21
+
22
+ **For each changed file:**
23
+ 1. **State the logical component** — What does this change do? What problem does it solve? What behavior does it add/modify?
24
+ 2. **Validate independence** — Does this change have side effects? Does it affect other modules? Are there hidden dependencies?
25
+ 3. **Verify correctness** — Is this change correct? Type-safe? Secure? Does it follow conventions? What could go wrong?
26
+
27
+ **Synthesize review strategy:**
28
+ - Group changes by concern (correctness, security, style)
29
+ - Prioritize findings (critical, important, minor)
30
+ - Identify patterns across multiple files
31
+ - Check domain language compliance and bounded context boundaries
32
+
18
33
  ## Steps
19
34
  1. Identify the scope:
20
35
  - If argument given: use those files/directories/description as scope
@@ -13,6 +13,21 @@ Walk through acceptance testing of completed phase work, using subagents for par
13
13
 
14
14
  Phase: $1
15
15
 
16
+ ## Atomic Reasoning
17
+
18
+ Before verifying, decompose phase acceptance into atomic reasoning units:
19
+
20
+ **For each deliverable:**
21
+ 1. **State the logical component** — What was this deliverable meant to produce? What user value does it provide?
22
+ 2. **Validate independence** — Can this deliverable be tested independently? What are its dependencies?
23
+ 3. **Verify correctness** — What tests prove it works? What edge cases must pass? What security concerns exist?
24
+
25
+ **Synthesize verification strategy:**
26
+ - Group parallel verification tasks (test suite, security audit, code review, domain compliance)
27
+ - Map each deliverable to specific test scenarios and acceptance criteria
28
+ - Identify critical vs optional checks
29
+ - Plan fix strategies for potential failures
30
+
16
31
  ## Steps
17
32
  1. Run `draht-tools extract-deliverables $1` to get testable items
18
33
  2. **Run parallel verification via subagents:**