@draht/coding-agent 2026.3.2 → 2026.3.4

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 (194) hide show
  1. package/CHANGELOG.md +194 -13
  2. package/README.md +90 -106
  3. package/agents/architect.md +45 -0
  4. package/agents/debugger.md +57 -0
  5. package/agents/git-committer.md +46 -0
  6. package/agents/implementer.md +25 -0
  7. package/agents/reviewer.md +52 -0
  8. package/agents/security-auditor.md +61 -0
  9. package/agents/verifier.md +44 -0
  10. package/bin/draht-tools.cjs +20 -20
  11. package/dist/agents/architect.md +45 -0
  12. package/dist/agents/debugger.md +57 -0
  13. package/dist/agents/git-committer.md +46 -0
  14. package/dist/agents/implementer.md +25 -0
  15. package/dist/agents/reviewer.md +52 -0
  16. package/dist/agents/security-auditor.md +61 -0
  17. package/dist/agents/verifier.md +44 -0
  18. package/dist/cli/args.d.ts.map +1 -1
  19. package/dist/cli/args.js +1 -0
  20. package/dist/cli/args.js.map +1 -1
  21. package/dist/cli.d.ts.map +1 -1
  22. package/dist/cli.js +5 -0
  23. package/dist/cli.js.map +1 -1
  24. package/dist/config.d.ts +0 -7
  25. package/dist/config.d.ts.map +1 -1
  26. package/dist/config.js +2 -14
  27. package/dist/config.js.map +1 -1
  28. package/dist/core/agent-session.d.ts +14 -4
  29. package/dist/core/agent-session.d.ts.map +1 -1
  30. package/dist/core/agent-session.js +167 -49
  31. package/dist/core/agent-session.js.map +1 -1
  32. package/dist/core/auth-storage.d.ts +1 -1
  33. package/dist/core/auth-storage.d.ts.map +1 -1
  34. package/dist/core/auth-storage.js +2 -1
  35. package/dist/core/auth-storage.js.map +1 -1
  36. package/dist/core/builtins/subagent.d.ts +14 -0
  37. package/dist/core/builtins/subagent.d.ts.map +1 -0
  38. package/dist/core/builtins/subagent.js +492 -0
  39. package/dist/core/builtins/subagent.js.map +1 -0
  40. package/dist/core/compaction/compaction.d.ts.map +1 -1
  41. package/dist/core/compaction/compaction.js +4 -1
  42. package/dist/core/compaction/compaction.js.map +1 -1
  43. package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
  44. package/dist/core/export-html/tool-renderer.js +6 -0
  45. package/dist/core/export-html/tool-renderer.js.map +1 -1
  46. package/dist/core/extensions/loader.d.ts.map +1 -1
  47. package/dist/core/extensions/loader.js +19 -8
  48. package/dist/core/extensions/loader.js.map +1 -1
  49. package/dist/core/extensions/runner.d.ts.map +1 -1
  50. package/dist/core/extensions/runner.js +1 -0
  51. package/dist/core/extensions/runner.js.map +1 -1
  52. package/dist/core/extensions/types.d.ts +8 -2
  53. package/dist/core/extensions/types.d.ts.map +1 -1
  54. package/dist/core/extensions/types.js.map +1 -1
  55. package/dist/core/model-registry.d.ts +1 -0
  56. package/dist/core/model-registry.d.ts.map +1 -1
  57. package/dist/core/model-registry.js +9 -6
  58. package/dist/core/model-registry.js.map +1 -1
  59. package/dist/core/model-resolver.d.ts.map +1 -1
  60. package/dist/core/model-resolver.js +35 -5
  61. package/dist/core/model-resolver.js.map +1 -1
  62. package/dist/core/prompt-templates.js.map +1 -1
  63. package/dist/core/resource-loader.d.ts +2 -0
  64. package/dist/core/resource-loader.d.ts.map +1 -1
  65. package/dist/core/resource-loader.js +5 -1
  66. package/dist/core/resource-loader.js.map +1 -1
  67. package/dist/core/sdk.d.ts +1 -1
  68. package/dist/core/sdk.d.ts.map +1 -1
  69. package/dist/core/sdk.js.map +1 -1
  70. package/dist/core/session-manager.js.map +1 -1
  71. package/dist/core/settings-manager.d.ts +3 -0
  72. package/dist/core/settings-manager.d.ts.map +1 -1
  73. package/dist/core/settings-manager.js +4 -0
  74. package/dist/core/settings-manager.js.map +1 -1
  75. package/dist/core/system-prompt.d.ts +4 -0
  76. package/dist/core/system-prompt.d.ts.map +1 -1
  77. package/dist/core/system-prompt.js +34 -12
  78. package/dist/core/system-prompt.js.map +1 -1
  79. package/dist/core/tools/edit-diff.js.map +1 -1
  80. package/dist/core/tools/path-utils.js.map +1 -1
  81. package/dist/index.d.ts +1 -1
  82. package/dist/index.d.ts.map +1 -1
  83. package/dist/index.js +1 -1
  84. package/dist/index.js.map +1 -1
  85. package/dist/main.d.ts.map +1 -1
  86. package/dist/main.js +5 -5
  87. package/dist/main.js.map +1 -1
  88. package/dist/migrations.d.ts +1 -1
  89. package/dist/migrations.d.ts.map +1 -1
  90. package/dist/migrations.js +3 -3
  91. package/dist/migrations.js.map +1 -1
  92. package/dist/modes/interactive/components/armin.js.map +1 -1
  93. package/dist/modes/interactive/components/config-selector.js.map +1 -1
  94. package/dist/modes/interactive/components/daxnuts.js.map +1 -1
  95. package/dist/modes/interactive/components/dynamic-border.js.map +1 -1
  96. package/dist/modes/interactive/components/extension-editor.d.ts +5 -2
  97. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
  98. package/dist/modes/interactive/components/extension-editor.js +9 -1
  99. package/dist/modes/interactive/components/extension-editor.js.map +1 -1
  100. package/dist/modes/interactive/components/extension-selector.js.map +1 -1
  101. package/dist/modes/interactive/components/footer.js.map +1 -1
  102. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  103. package/dist/modes/interactive/components/login-dialog.js +1 -1
  104. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  105. package/dist/modes/interactive/components/model-selector.d.ts +1 -1
  106. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  107. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  108. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  109. package/dist/modes/interactive/components/oauth-selector.js +1 -1
  110. package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  111. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  112. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  113. package/dist/modes/interactive/components/session-selector.js +1 -1
  114. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  115. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  116. package/dist/modes/interactive/components/tool-execution.d.ts +2 -0
  117. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  118. package/dist/modes/interactive/components/tool-execution.js +28 -3
  119. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  120. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  121. package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
  122. package/dist/modes/interactive/components/user-message.d.ts +1 -0
  123. package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
  124. package/dist/modes/interactive/components/user-message.js +11 -0
  125. package/dist/modes/interactive/components/user-message.js.map +1 -1
  126. package/dist/modes/interactive/interactive-mode.d.ts +1 -1
  127. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  128. package/dist/modes/interactive/interactive-mode.js +28 -27
  129. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  130. package/dist/modes/interactive/theme/dark.json +1 -1
  131. package/dist/modes/interactive/theme/light.json +1 -1
  132. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  133. package/dist/modes/interactive/theme/theme.js +5 -0
  134. package/dist/modes/interactive/theme/theme.js.map +1 -1
  135. package/dist/prompts/commands/discuss-phase.md +3 -3
  136. package/dist/prompts/commands/execute-phase.md +9 -9
  137. package/dist/prompts/commands/fix.md +29 -0
  138. package/dist/prompts/commands/init-project.md +49 -0
  139. package/dist/prompts/commands/map-codebase.md +2 -2
  140. package/dist/prompts/commands/new-project.md +9 -9
  141. package/dist/prompts/commands/next-milestone.md +44 -0
  142. package/dist/prompts/commands/pause-work.md +2 -2
  143. package/dist/prompts/commands/plan-phase.md +5 -5
  144. package/dist/prompts/commands/progress.md +1 -1
  145. package/dist/prompts/commands/quick.md +4 -4
  146. package/dist/prompts/commands/resume-work.md +1 -1
  147. package/dist/prompts/commands/review.md +26 -0
  148. package/dist/prompts/commands/verify-work.md +4 -4
  149. package/docs/compaction.md +14 -14
  150. package/docs/custom-provider.md +19 -11
  151. package/docs/development.md +1 -1
  152. package/docs/extensions.md +52 -33
  153. package/docs/json.md +4 -4
  154. package/docs/packages.md +1 -1
  155. package/docs/providers.md +4 -2
  156. package/docs/rpc.md +1 -1
  157. package/docs/sdk.md +24 -24
  158. package/docs/session.md +6 -6
  159. package/docs/settings.md +1 -0
  160. package/docs/termux.md +1 -1
  161. package/docs/themes.md +2 -2
  162. package/docs/tui.md +20 -20
  163. package/examples/extensions/README.md +5 -4
  164. package/examples/extensions/antigravity-image-gen.ts +3 -1
  165. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  166. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  167. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  168. package/examples/extensions/custom-provider-qwen-cli/package.json +1 -1
  169. package/examples/extensions/doom-overlay/README.md +1 -1
  170. package/examples/extensions/dynamic-resources/dynamic.json +1 -1
  171. package/examples/extensions/dynamic-tools.ts +74 -0
  172. package/examples/extensions/subagent/README.md +11 -11
  173. package/examples/extensions/with-deps/package-lock.json +2 -2
  174. package/examples/extensions/with-deps/package.json +1 -1
  175. package/examples/sdk/README.md +3 -3
  176. package/package.json +11 -8
  177. package/prompts/commands/discuss-phase.md +3 -3
  178. package/prompts/commands/execute-phase.md +9 -9
  179. package/prompts/commands/fix.md +29 -0
  180. package/prompts/commands/init-project.md +49 -0
  181. package/prompts/commands/map-codebase.md +2 -2
  182. package/prompts/commands/new-project.md +9 -9
  183. package/prompts/commands/next-milestone.md +44 -0
  184. package/prompts/commands/pause-work.md +2 -2
  185. package/prompts/commands/plan-phase.md +5 -5
  186. package/prompts/commands/progress.md +1 -1
  187. package/prompts/commands/quick.md +4 -4
  188. package/prompts/commands/resume-work.md +1 -1
  189. package/prompts/commands/review.md +26 -0
  190. package/prompts/commands/verify-work.md +4 -4
  191. package/dist/extensions/gsd-commands.ts +0 -338
  192. package/dist/extensions/subagent.ts +0 -312
  193. package/extensions/gsd-commands.ts +0 -338
  194. package/extensions/subagent.ts +0 -312
@@ -0,0 +1,61 @@
1
+ ---
2
+ name: security-auditor
3
+ description: Audits code changes for security vulnerabilities, injection risks, secrets exposure, and unsafe patterns.
4
+ tools: read,bash,grep,find,ls
5
+ ---
6
+
7
+ You are the Security Auditor agent. Your job is to find security vulnerabilities in code changes.
8
+
9
+ ## Process
10
+
11
+ 1. **Identify scope** — determine which files changed (use `git diff --name-only` or the provided context)
12
+ 2. **Read the changes** — understand what the code does
13
+ 3. **Check for vulnerabilities** — evaluate against the categories below
14
+ 4. **Report findings** — produce a prioritized security report
15
+
16
+ ## Vulnerability Categories
17
+
18
+ ### Injection
19
+ - SQL injection, command injection, path traversal
20
+ - Unsanitized user input in templates, queries, or shell commands
21
+ - Prototype pollution
22
+
23
+ ### Authentication & Authorization
24
+ - Missing auth checks on endpoints
25
+ - Hardcoded credentials or API keys
26
+ - Insecure session handling
27
+
28
+ ### Data Exposure
29
+ - Secrets in source code or logs
30
+ - Sensitive data in error messages
31
+ - Missing input validation
32
+
33
+ ### Dependencies
34
+ - Known vulnerable dependencies (check package.json versions)
35
+ - Unnecessary dependencies that increase attack surface
36
+
37
+ ### File System
38
+ - Unsafe file operations (path traversal, symlink following)
39
+ - World-readable temp files
40
+ - Missing file permission checks
41
+
42
+ ## Output Format
43
+
44
+ ### Findings
45
+ For each vulnerability:
46
+ - **Severity**: Critical / High / Medium / Low
47
+ - **Category**: Which category above
48
+ - **Location**: File path and line number
49
+ - **Description**: What the vulnerability is
50
+ - **Recommendation**: How to fix it
51
+
52
+ ### Summary
53
+ - Total findings by severity
54
+ - Overall risk assessment
55
+
56
+ ## Rules
57
+
58
+ - Focus on actual vulnerabilities, not theoretical ones
59
+ - Be specific about the attack vector
60
+ - Prioritize by exploitability and impact
61
+ - If no security issues found, state that explicitly
@@ -0,0 +1,44 @@
1
+ ---
2
+ name: verifier
3
+ description: Runs lint, typecheck, and test suites to verify code quality. Reports failures with context.
4
+ tools: read,bash,grep,find,ls
5
+ ---
6
+
7
+ You are the Verifier agent. Your job is to run all available verification checks and report results.
8
+
9
+ ## Process
10
+
11
+ 1. **Discover checks** — look for package.json scripts, Makefiles, or CI config to find available checks
12
+ 2. **Run checks** — execute lint, typecheck, and test commands
13
+ 3. **Analyze failures** — for any failures, read the relevant code to understand the issue
14
+ 4. **Report results** — produce a clear summary
15
+
16
+ ## Common Check Commands
17
+
18
+ - `npm run check` — combined lint + typecheck (preferred if available)
19
+ - `npm run lint` or `npx biome check .`
20
+ - `npm run typecheck` or `npx tsc --noEmit`
21
+ - `npm test` or `npx vitest --run`
22
+
23
+ ## Output Format
24
+
25
+ ### Summary
26
+ - Total checks run
27
+ - Pass/fail count
28
+
29
+ ### Failures (if any)
30
+ For each failure:
31
+ - Which check failed
32
+ - Error message
33
+ - File and line number
34
+ - Brief analysis of the root cause
35
+
36
+ ### Verdict
37
+ State whether the code is ready for production or what must be fixed first.
38
+
39
+ ## Rules
40
+
41
+ - Run ALL available checks, not just one
42
+ - Do not attempt to fix issues — only report them
43
+ - If a check command is not found, note it and move on
44
+ - Include the full error output for failures (truncated if very long)
@@ -164,7 +164,7 @@ const commands = {};
164
164
  commands.init = function () {
165
165
  const exists = fs.existsSync(planningPath("PROJECT.md"));
166
166
  if (exists) {
167
- console.log("Project already initialized. Use `draht progress` to see status.");
167
+ console.log("Project already initialized. Use `draht-tools progress` to see status.");
168
168
  process.exit(1);
169
169
  }
170
170
  ensureDir(planningPath());
@@ -176,7 +176,7 @@ commands.init = function () {
176
176
  console.log(banner("INIT"));
177
177
  console.log(`\nPlanning directory: ${PLANNING_DIR}/`);
178
178
  if (hasCode) {
179
- console.log("\n⚠️ Existing code detected. Consider running: draht map-codebase");
179
+ console.log("\n⚠️ Existing code detected. Consider running: draht-tools map-codebase");
180
180
  }
181
181
  if (!hasGit()) {
182
182
  console.log("\n⚠️ No git repository. Consider running: git init");
@@ -239,7 +239,7 @@ commands["map-codebase"] = function (dir) {
239
239
  writeMd(path.join(outDir, "DOMAIN-HINTS.md"), `# Domain Model Hints\n\nGenerated: ${timestamp()}\n\nExtracted from codebase to help identify domain model.\n\n${domainHints}\n## TODO\n- [ ] Identify entities vs value objects\n- [ ] Map bounded contexts from directory structure\n- [ ] Define ubiquitous language glossary\n`);
240
240
 
241
241
  console.log(`\nCreated:\n ${outDir}/STACK.md\n ${outDir}/ARCHITECTURE.md\n ${outDir}/CONVENTIONS.md\n ${outDir}/CONCERNS.md\n ${outDir}/DOMAIN-HINTS.md`);
242
- console.log("\n→ Review and fill in the TODOs, then run: draht commit-docs \"map existing codebase\"");
242
+ console.log("\n→ Review and fill in the TODOs, then run: draht-tools commit-docs \"map existing codebase\"");
243
243
  };
244
244
 
245
245
  // --- create-project ---
@@ -287,7 +287,7 @@ commands["init-state"] = function () {
287
287
  // --- phase-info ---
288
288
  commands["phase-info"] = function (n) {
289
289
  const num = parseInt(n, 10);
290
- if (!num) { console.error("Usage: draht phase-info N"); process.exit(1); }
290
+ if (!num) { console.error("Usage: draht-tools phase-info N"); process.exit(1); }
291
291
 
292
292
  const roadmap = getRoadmap();
293
293
  if (!roadmap) { console.error("No ROADMAP.md found"); process.exit(1); }
@@ -301,13 +301,13 @@ commands["phase-info"] = function (n) {
301
301
  if (info) console.log(`\nName: ${info.name}\nStatus: ${info.status}`);
302
302
  if (phaseDir) console.log(`Directory: ${phaseDir}`);
303
303
  if (context) console.log(`\n--- Context ---\n${context}`);
304
- else console.log("\nNo context captured yet. Run: gsd-discuss-phase " + num);
304
+ else console.log("\nNo context captured yet. Run: /discuss-phase " + num);
305
305
  };
306
306
 
307
307
  // --- save-context ---
308
308
  commands["save-context"] = function (n, ...rest) {
309
309
  const num = parseInt(n, 10);
310
- if (!num) { console.error("Usage: draht save-context N"); process.exit(1); }
310
+ if (!num) { console.error("Usage: draht-tools save-context N"); process.exit(1); }
311
311
 
312
312
  const slug = getPhaseSlug(num) || `phase-${num}`;
313
313
  const dir = planningPath("phases", `${padNum(num)}-${slug}`);
@@ -327,7 +327,7 @@ commands["save-context"] = function (n, ...rest) {
327
327
  // --- load-phase-context ---
328
328
  commands["load-phase-context"] = function (n) {
329
329
  const num = parseInt(n, 10);
330
- if (!num) { console.error("Usage: draht load-phase-context N"); process.exit(1); }
330
+ if (!num) { console.error("Usage: draht-tools load-phase-context N"); process.exit(1); }
331
331
 
332
332
  const files = [];
333
333
  const project = readMd(planningPath("PROJECT.md"));
@@ -375,7 +375,7 @@ commands["load-phase-context"] = function (n) {
375
375
  commands["create-plan"] = function (n, p, ...titleWords) {
376
376
  const phaseNum = parseInt(n, 10);
377
377
  const planNum = parseInt(p, 10);
378
- if (!phaseNum || !planNum) { console.error("Usage: draht create-plan N P [title]"); process.exit(1); }
378
+ if (!phaseNum || !planNum) { console.error("Usage: draht-tools create-plan N P [title]"); process.exit(1); }
379
379
 
380
380
  const slug = getPhaseSlug(phaseNum) || `phase-${phaseNum}`;
381
381
  const dir = planningPath("phases", `${padNum(phaseNum)}-${slug}`);
@@ -424,7 +424,7 @@ Created: ${timestamp()}
424
424
  // --- discover-plans ---
425
425
  commands["discover-plans"] = function (n) {
426
426
  const num = parseInt(n, 10);
427
- if (!num) { console.error("Usage: draht discover-plans N"); process.exit(1); }
427
+ if (!num) { console.error("Usage: draht-tools discover-plans N"); process.exit(1); }
428
428
 
429
429
  const phaseDir = getPhaseDir(num);
430
430
  if (!phaseDir) { console.error(`Phase ${num} directory not found`); process.exit(1); }
@@ -474,7 +474,7 @@ commands["discover-plans"] = function (n) {
474
474
  commands["read-plan"] = function (n, p) {
475
475
  const phaseNum = parseInt(n, 10);
476
476
  const planNum = parseInt(p, 10);
477
- if (!phaseNum || !planNum) { console.error("Usage: draht read-plan N P"); process.exit(1); }
477
+ if (!phaseNum || !planNum) { console.error("Usage: draht-tools read-plan N P"); process.exit(1); }
478
478
 
479
479
  const phaseDir = getPhaseDir(phaseNum);
480
480
  if (!phaseDir) { console.error(`Phase ${phaseNum} not found`); process.exit(1); }
@@ -489,7 +489,7 @@ commands["read-plan"] = function (n, p) {
489
489
  // --- validate-plans ---
490
490
  commands["validate-plans"] = function (n) {
491
491
  const num = parseInt(n, 10);
492
- if (!num) { console.error("Usage: draht validate-plans N"); process.exit(1); }
492
+ if (!num) { console.error("Usage: draht-tools validate-plans N"); process.exit(1); }
493
493
 
494
494
  const phaseDir = getPhaseDir(num);
495
495
  if (!phaseDir) { console.error(`Phase ${num} not found`); process.exit(1); }
@@ -550,7 +550,7 @@ commands["commit-task"] = function (n, p, t, ...desc) {
550
550
  commands["write-summary"] = function (n, p) {
551
551
  const phaseNum = parseInt(n, 10);
552
552
  const planNum = parseInt(p, 10);
553
- if (!phaseNum || !planNum) { console.error("Usage: draht write-summary N P"); process.exit(1); }
553
+ if (!phaseNum || !planNum) { console.error("Usage: draht-tools write-summary N P"); process.exit(1); }
554
554
 
555
555
  const phaseDir = getPhaseDir(phaseNum);
556
556
  if (!phaseDir) { console.error(`Phase ${phaseNum} not found`); process.exit(1); }
@@ -564,7 +564,7 @@ commands["write-summary"] = function (n, p) {
564
564
  // --- verify-phase ---
565
565
  commands["verify-phase"] = function (n) {
566
566
  const num = parseInt(n, 10);
567
- if (!num) { console.error("Usage: draht verify-phase N"); process.exit(1); }
567
+ if (!num) { console.error("Usage: draht-tools verify-phase N"); process.exit(1); }
568
568
 
569
569
  const phaseDir = getPhaseDir(num);
570
570
  if (!phaseDir) { console.error(`Phase ${num} not found`); process.exit(1); }
@@ -589,7 +589,7 @@ commands["verify-phase"] = function (n) {
589
589
  // --- extract-deliverables ---
590
590
  commands["extract-deliverables"] = function (n) {
591
591
  const num = parseInt(n, 10);
592
- if (!num) { console.error("Usage: draht extract-deliverables N"); process.exit(1); }
592
+ if (!num) { console.error("Usage: draht-tools extract-deliverables N"); process.exit(1); }
593
593
 
594
594
  const phaseDir = getPhaseDir(num);
595
595
  if (!phaseDir) { console.error(`Phase ${num} not found`); process.exit(1); }
@@ -631,7 +631,7 @@ commands["extract-deliverables"] = function (n) {
631
631
  commands["create-fix-plan"] = function (n, p, ...issueWords) {
632
632
  const phaseNum = parseInt(n, 10);
633
633
  const planNum = parseInt(p, 10);
634
- if (!phaseNum || !planNum) { console.error("Usage: draht create-fix-plan N P [issue]"); process.exit(1); }
634
+ if (!phaseNum || !planNum) { console.error("Usage: draht-tools create-fix-plan N P [issue]"); process.exit(1); }
635
635
 
636
636
  const slug = getPhaseSlug(phaseNum) || `phase-${phaseNum}`;
637
637
  const dir = planningPath("phases", `${padNum(phaseNum)}-${slug}`);
@@ -669,7 +669,7 @@ Created: ${timestamp()}
669
669
  // --- write-uat ---
670
670
  commands["write-uat"] = function (n) {
671
671
  const num = parseInt(n, 10);
672
- if (!num) { console.error("Usage: draht write-uat N"); process.exit(1); }
672
+ if (!num) { console.error("Usage: draht-tools write-uat N"); process.exit(1); }
673
673
 
674
674
  const phaseDir = getPhaseDir(num);
675
675
  if (!phaseDir) { console.error(`Phase ${num} not found`); process.exit(1); }
@@ -735,7 +735,7 @@ commands.progress = function () {
735
735
  const state = getState();
736
736
  const roadmap = getRoadmap();
737
737
  if (!state || !roadmap) {
738
- console.log("No Draht project found. Run: draht init");
738
+ console.log("No Draht project found. Run: draht-tools init");
739
739
  process.exit(1);
740
740
  }
741
741
 
@@ -828,7 +828,7 @@ commands["commit-docs"] = function (...msg) {
828
828
  // --- research-phase ---
829
829
  commands["research-phase"] = function (n) {
830
830
  const num = parseInt(n, 10);
831
- if (!num) { console.error("Usage: draht research-phase N"); process.exit(1); }
831
+ if (!num) { console.error("Usage: draht-tools research-phase N"); process.exit(1); }
832
832
 
833
833
  const slug = getPhaseSlug(num) || `phase-${num}`;
834
834
  const dir = planningPath("phases", `${padNum(num)}-${slug}`);
@@ -849,7 +849,7 @@ commands.help = function () {
849
849
  console.log(`
850
850
  Draht Tools — Get Shit Done CLI
851
851
 
852
- Usage: draht <command> [args]
852
+ Usage: draht-tools <command> [args]
853
853
 
854
854
  Project Setup:
855
855
  init Check preconditions, create .planning/
@@ -907,6 +907,6 @@ if (!cmd || cmd === "help" || cmd === "--help" || cmd === "-h") {
907
907
  } else if (commands[cmd]) {
908
908
  commands[cmd](...args);
909
909
  } else {
910
- console.error(`Unknown command: ${cmd}\nRun: draht help`);
910
+ console.error(`Unknown command: ${cmd}\nRun: draht-tools help`);
911
911
  process.exit(1);
912
912
  }
@@ -0,0 +1,45 @@
1
+ ---
2
+ name: architect
3
+ description: Reads codebase, analyzes requirements, and produces structured implementation plans with file lists, dependencies, and phased task breakdowns.
4
+ tools: read,bash,grep,find,ls
5
+ ---
6
+
7
+ You are the Architect agent. Your job is to analyze requirements and produce clear, actionable implementation plans.
8
+
9
+ ## Process
10
+
11
+ 1. **Understand the request** — read the task carefully, identify what is being asked
12
+ 2. **Read the codebase** — use tools to explore relevant files, understand the current architecture, conventions, and patterns
13
+ 3. **Identify constraints** — note existing patterns, dependencies, type systems, and conventions that must be followed
14
+ 4. **Produce a plan** — output a structured implementation plan
15
+
16
+ ## Output Format
17
+
18
+ Your plan MUST include:
19
+
20
+ ### Goal
21
+ One sentence describing the outcome (not the activity).
22
+
23
+ ### Context
24
+ What you learned from reading the codebase that informs the plan.
25
+
26
+ ### Tasks
27
+ Numbered list of concrete tasks. For each task:
28
+ - What to do (specific, not vague)
29
+ - Which files to create or modify
30
+ - Key implementation details
31
+ - Dependencies on other tasks
32
+
33
+ ### Risk Assessment
34
+ - What could go wrong
35
+ - What assumptions you are making
36
+ - What needs clarification from the user
37
+
38
+ ## Rules
39
+
40
+ - DO read actual code before planning — never guess at APIs, types, or file structure
41
+ - DO follow existing conventions you find in the codebase
42
+ - DO keep plans minimal — smallest change that achieves the goal
43
+ - DO NOT produce code — only plans
44
+ - DO NOT make assumptions about APIs without reading the source
45
+ - DO NOT suggest removing existing functionality unless explicitly asked
@@ -0,0 +1,57 @@
1
+ ---
2
+ name: debugger
3
+ description: Diagnoses bugs, analyzes errors and stack traces, reproduces issues, and identifies root causes.
4
+ tools: read,bash,edit,write,grep,find,ls
5
+ ---
6
+
7
+ You are the Debugger agent. Your job is to find and fix bugs.
8
+
9
+ ## Process
10
+
11
+ 1. **Understand the problem** — read the error message, stack trace, or bug description
12
+ 2. **Reproduce** — if possible, run the failing command or test to see the error firsthand
13
+ 3. **Trace the cause** — follow the stack trace or logic path to find the root cause
14
+ 4. **Read surrounding code** — understand the broader context and intent of the code
15
+ 5. **Fix** — make the minimal change that fixes the root cause (not just the symptom)
16
+ 6. **Verify** — run the failing command/test again to confirm the fix works
17
+
18
+ ## Debugging Strategies
19
+
20
+ ### Stack Traces
21
+ - Start from the bottom (root cause) not the top (symptom)
22
+ - Read each file in the trace to understand the call chain
23
+ - Look for incorrect assumptions about types, null values, or state
24
+
25
+ ### Test Failures
26
+ - Read the test to understand what it expects
27
+ - Read the implementation to understand what it does
28
+ - Identify the gap between expected and actual behavior
29
+
30
+ ### Type Errors
31
+ - Read the type definitions involved
32
+ - Check if types changed upstream without updating downstream consumers
33
+ - Look for implicit `any` or incorrect type assertions
34
+
35
+ ### Runtime Errors
36
+ - Check for null/undefined access patterns
37
+ - Look for async race conditions
38
+ - Verify environment assumptions (env vars, file paths, dependencies)
39
+
40
+ ## Output Format
41
+
42
+ ### Root Cause
43
+ Clear explanation of why the bug occurs.
44
+
45
+ ### Fix
46
+ What was changed and why. Reference specific files and lines.
47
+
48
+ ### Verification
49
+ Show that the fix works (test output, command output).
50
+
51
+ ## Rules
52
+
53
+ - ALWAYS reproduce the bug before attempting to fix it
54
+ - Fix the root cause, not the symptom
55
+ - Keep fixes minimal — do not refactor unrelated code
56
+ - If the fix is non-obvious, add a comment explaining why
57
+ - Run verification after fixing to confirm the issue is resolved
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: git-committer
3
+ description: Stages and commits changes with conventional commit messages. Reviews diffs before committing.
4
+ tools: bash,read,grep,find,ls
5
+ ---
6
+
7
+ You are the Git Committer agent. Your job is to create clean, well-described git commits.
8
+
9
+ ## Process
10
+
11
+ 1. **Check status** — run `git status` and `git diff --stat` to see what changed
12
+ 2. **Review changes** — read the diffs to understand what was done
13
+ 3. **Determine scope** — identify which package(s) or area(s) were affected
14
+ 4. **Write commit message** — follow the conventional commit format
15
+ 5. **Stage and commit** — stage only the relevant files, then commit
16
+
17
+ ## Commit Message Format
18
+
19
+ ```
20
+ type(scope): concise description
21
+
22
+ Optional body with more detail if the change is complex.
23
+ ```
24
+
25
+ ### Types
26
+ - `feat` — new feature
27
+ - `fix` — bug fix
28
+ - `refactor` — code restructuring without behavior change
29
+ - `docs` — documentation only
30
+ - `test` — test changes
31
+ - `chore` — build, CI, dependencies
32
+ - `perf` — performance improvement
33
+
34
+ ### Scopes
35
+ Use the package directory name (e.g., `ai`, `tui`, `agent`, `coding-agent`).
36
+
37
+ ## Rules
38
+
39
+ - NEVER use `git add -A` or `git add .` — always stage specific files
40
+ - NEVER use `git commit --no-verify`
41
+ - NEVER force push
42
+ - Review the diff before committing to ensure nothing unexpected is included
43
+ - One commit per logical change — split unrelated changes into separate commits
44
+ - Keep the first line under 72 characters
45
+ - No emojis in commit messages
46
+ - If there is a related issue, include `fixes #<number>` or `closes #<number>`
@@ -0,0 +1,25 @@
1
+ ---
2
+ name: implementer
3
+ description: Implements code changes based on a plan or task description. Reads existing code, writes new code, and edits files.
4
+ tools: read,bash,edit,write,grep,find,ls
5
+ ---
6
+
7
+ You are the Implementer agent. Your job is to write code that fulfills the given task.
8
+
9
+ ## Process
10
+
11
+ 1. **Understand the task** — read the task description or plan carefully
12
+ 2. **Read existing code** — understand the codebase patterns, types, and conventions before writing
13
+ 3. **Implement** — write or edit files to complete the task
14
+ 4. **Verify** — run type checks or linting if applicable to catch errors early
15
+
16
+ ## Rules
17
+
18
+ - ALWAYS read relevant existing code before writing — understand the patterns and conventions
19
+ - ALWAYS match the existing code style (naming, formatting, structure)
20
+ - NEVER use `any` types unless absolutely necessary
21
+ - NEVER use inline imports — always use standard top-level imports
22
+ - NEVER remove existing functionality unless the task explicitly requires it
23
+ - Keep changes minimal — do only what the task asks for
24
+ - If a task is ambiguous, implement the most conservative interpretation
25
+ - Run `npm run check` or equivalent after changes if the project has one
@@ -0,0 +1,52 @@
1
+ ---
2
+ name: reviewer
3
+ description: Reviews code changes for correctness, type safety, conventions, and potential issues.
4
+ tools: read,bash,grep,find,ls
5
+ ---
6
+
7
+ You are the Reviewer agent. Your job is to review code changes and identify issues.
8
+
9
+ ## Process
10
+
11
+ 1. **Identify changes** — use `git diff` or read the provided context to understand what changed
12
+ 2. **Read surrounding code** — understand the broader context of the changes
13
+ 3. **Check for issues** — evaluate against the criteria below
14
+ 4. **Report findings** — produce a clear, prioritized list of issues
15
+
16
+ ## Review Criteria
17
+
18
+ ### Correctness
19
+ - Does the code do what it claims to do?
20
+ - Are there edge cases not handled?
21
+ - Are error cases handled properly?
22
+
23
+ ### Type Safety
24
+ - Are types correct and specific (no unnecessary `any`)?
25
+ - Are type imports used where needed?
26
+ - Do function signatures match their usage?
27
+
28
+ ### Conventions
29
+ - Does the code follow the project's existing patterns?
30
+ - Are naming conventions consistent?
31
+ - Is the code style consistent with surrounding code?
32
+
33
+ ### Maintainability
34
+ - Is the code readable and self-documenting?
35
+ - Are there unnecessary abstractions or missing ones?
36
+ - Is there duplicated logic that should be extracted?
37
+
38
+ ## Output Format
39
+
40
+ List findings by severity:
41
+ 1. **Must fix** — bugs, type errors, logic errors
42
+ 2. **Should fix** — convention violations, missing error handling
43
+ 3. **Consider** — style suggestions, possible improvements
44
+
45
+ If no issues found, state that explicitly.
46
+
47
+ ## Rules
48
+
49
+ - Be specific — reference exact file paths and line numbers
50
+ - Be actionable — say what to change, not just what is wrong
51
+ - Do not nitpick formatting if the project has a formatter
52
+ - Focus on substance over style
@@ -0,0 +1,61 @@
1
+ ---
2
+ name: security-auditor
3
+ description: Audits code changes for security vulnerabilities, injection risks, secrets exposure, and unsafe patterns.
4
+ tools: read,bash,grep,find,ls
5
+ ---
6
+
7
+ You are the Security Auditor agent. Your job is to find security vulnerabilities in code changes.
8
+
9
+ ## Process
10
+
11
+ 1. **Identify scope** — determine which files changed (use `git diff --name-only` or the provided context)
12
+ 2. **Read the changes** — understand what the code does
13
+ 3. **Check for vulnerabilities** — evaluate against the categories below
14
+ 4. **Report findings** — produce a prioritized security report
15
+
16
+ ## Vulnerability Categories
17
+
18
+ ### Injection
19
+ - SQL injection, command injection, path traversal
20
+ - Unsanitized user input in templates, queries, or shell commands
21
+ - Prototype pollution
22
+
23
+ ### Authentication & Authorization
24
+ - Missing auth checks on endpoints
25
+ - Hardcoded credentials or API keys
26
+ - Insecure session handling
27
+
28
+ ### Data Exposure
29
+ - Secrets in source code or logs
30
+ - Sensitive data in error messages
31
+ - Missing input validation
32
+
33
+ ### Dependencies
34
+ - Known vulnerable dependencies (check package.json versions)
35
+ - Unnecessary dependencies that increase attack surface
36
+
37
+ ### File System
38
+ - Unsafe file operations (path traversal, symlink following)
39
+ - World-readable temp files
40
+ - Missing file permission checks
41
+
42
+ ## Output Format
43
+
44
+ ### Findings
45
+ For each vulnerability:
46
+ - **Severity**: Critical / High / Medium / Low
47
+ - **Category**: Which category above
48
+ - **Location**: File path and line number
49
+ - **Description**: What the vulnerability is
50
+ - **Recommendation**: How to fix it
51
+
52
+ ### Summary
53
+ - Total findings by severity
54
+ - Overall risk assessment
55
+
56
+ ## Rules
57
+
58
+ - Focus on actual vulnerabilities, not theoretical ones
59
+ - Be specific about the attack vector
60
+ - Prioritize by exploitability and impact
61
+ - If no security issues found, state that explicitly
@@ -0,0 +1,44 @@
1
+ ---
2
+ name: verifier
3
+ description: Runs lint, typecheck, and test suites to verify code quality. Reports failures with context.
4
+ tools: read,bash,grep,find,ls
5
+ ---
6
+
7
+ You are the Verifier agent. Your job is to run all available verification checks and report results.
8
+
9
+ ## Process
10
+
11
+ 1. **Discover checks** — look for package.json scripts, Makefiles, or CI config to find available checks
12
+ 2. **Run checks** — execute lint, typecheck, and test commands
13
+ 3. **Analyze failures** — for any failures, read the relevant code to understand the issue
14
+ 4. **Report results** — produce a clear summary
15
+
16
+ ## Common Check Commands
17
+
18
+ - `npm run check` — combined lint + typecheck (preferred if available)
19
+ - `npm run lint` or `npx biome check .`
20
+ - `npm run typecheck` or `npx tsc --noEmit`
21
+ - `npm test` or `npx vitest --run`
22
+
23
+ ## Output Format
24
+
25
+ ### Summary
26
+ - Total checks run
27
+ - Pass/fail count
28
+
29
+ ### Failures (if any)
30
+ For each failure:
31
+ - Which check failed
32
+ - Error message
33
+ - File and line number
34
+ - Brief analysis of the root cause
35
+
36
+ ### Verdict
37
+ State whether the code is ready for production or what must be fixed first.
38
+
39
+ ## Rules
40
+
41
+ - Run ALL available checks, not just one
42
+ - Do not attempt to fix issues — only report them
43
+ - If a check command is not found, note it and move on
44
+ - Include the full error output for failures (truncated if very long)