@draht/coding-agent 2026.3.3 → 2026.3.5

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 (201) hide show
  1. package/CHANGELOG.md +144 -0
  2. package/README.md +1 -0
  3. package/dist/cli/args.d.ts.map +1 -1
  4. package/dist/cli/args.js +1 -0
  5. package/dist/cli/args.js.map +1 -1
  6. package/dist/cli.d.ts.map +1 -1
  7. package/dist/cli.js +5 -0
  8. package/dist/cli.js.map +1 -1
  9. package/dist/config.d.ts +0 -7
  10. package/dist/config.d.ts.map +1 -1
  11. package/dist/config.js +0 -12
  12. package/dist/config.js.map +1 -1
  13. package/dist/core/agent-session.d.ts +14 -4
  14. package/dist/core/agent-session.d.ts.map +1 -1
  15. package/dist/core/agent-session.js +167 -49
  16. package/dist/core/agent-session.js.map +1 -1
  17. package/dist/core/auth-storage.d.ts +1 -1
  18. package/dist/core/auth-storage.d.ts.map +1 -1
  19. package/dist/core/auth-storage.js +2 -1
  20. package/dist/core/auth-storage.js.map +1 -1
  21. package/dist/core/builtins/subagent.d.ts +14 -0
  22. package/dist/core/builtins/subagent.d.ts.map +1 -0
  23. package/dist/core/builtins/subagent.js +492 -0
  24. package/dist/core/builtins/subagent.js.map +1 -0
  25. package/dist/core/compaction/compaction.d.ts.map +1 -1
  26. package/dist/core/compaction/compaction.js +4 -1
  27. package/dist/core/compaction/compaction.js.map +1 -1
  28. package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
  29. package/dist/core/export-html/tool-renderer.js +6 -0
  30. package/dist/core/export-html/tool-renderer.js.map +1 -1
  31. package/dist/core/extensions/loader.d.ts.map +1 -1
  32. package/dist/core/extensions/loader.js +19 -8
  33. package/dist/core/extensions/loader.js.map +1 -1
  34. package/dist/core/extensions/runner.d.ts.map +1 -1
  35. package/dist/core/extensions/runner.js +1 -0
  36. package/dist/core/extensions/runner.js.map +1 -1
  37. package/dist/core/extensions/types.d.ts +8 -2
  38. package/dist/core/extensions/types.d.ts.map +1 -1
  39. package/dist/core/extensions/types.js.map +1 -1
  40. package/dist/core/model-registry.d.ts +1 -0
  41. package/dist/core/model-registry.d.ts.map +1 -1
  42. package/dist/core/model-registry.js +9 -6
  43. package/dist/core/model-registry.js.map +1 -1
  44. package/dist/core/model-resolver.d.ts.map +1 -1
  45. package/dist/core/model-resolver.js +35 -5
  46. package/dist/core/model-resolver.js.map +1 -1
  47. package/dist/core/package-manager.d.ts.map +1 -1
  48. package/dist/core/package-manager.js +1 -10
  49. package/dist/core/package-manager.js.map +1 -1
  50. package/dist/core/prompt-templates.d.ts.map +1 -1
  51. package/dist/core/prompt-templates.js +4 -2
  52. package/dist/core/prompt-templates.js.map +1 -1
  53. package/dist/core/resource-loader.d.ts +2 -0
  54. package/dist/core/resource-loader.d.ts.map +1 -1
  55. package/dist/core/resource-loader.js +5 -1
  56. package/dist/core/resource-loader.js.map +1 -1
  57. package/dist/core/sdk.d.ts +1 -1
  58. package/dist/core/sdk.d.ts.map +1 -1
  59. package/dist/core/sdk.js.map +1 -1
  60. package/dist/core/session-manager.js.map +1 -1
  61. package/dist/core/settings-manager.d.ts +3 -0
  62. package/dist/core/settings-manager.d.ts.map +1 -1
  63. package/dist/core/settings-manager.js +4 -0
  64. package/dist/core/settings-manager.js.map +1 -1
  65. package/dist/core/system-prompt.d.ts +4 -0
  66. package/dist/core/system-prompt.d.ts.map +1 -1
  67. package/dist/core/system-prompt.js +34 -12
  68. package/dist/core/system-prompt.js.map +1 -1
  69. package/dist/core/tools/edit-diff.js.map +1 -1
  70. package/dist/core/tools/path-utils.js.map +1 -1
  71. package/dist/gsd/domain-validator.d.ts +18 -0
  72. package/dist/gsd/domain-validator.d.ts.map +1 -0
  73. package/dist/gsd/domain-validator.js +61 -0
  74. package/dist/gsd/domain-validator.js.map +1 -0
  75. package/dist/gsd/domain.d.ts +12 -0
  76. package/dist/gsd/domain.d.ts.map +1 -0
  77. package/dist/gsd/domain.js +113 -0
  78. package/dist/gsd/domain.js.map +1 -0
  79. package/dist/gsd/git.d.ts +20 -0
  80. package/dist/gsd/git.d.ts.map +1 -0
  81. package/dist/gsd/git.js +59 -0
  82. package/dist/gsd/git.js.map +1 -0
  83. package/dist/gsd/hook-utils.d.ts +22 -0
  84. package/dist/gsd/hook-utils.d.ts.map +1 -0
  85. package/dist/gsd/hook-utils.js +100 -0
  86. package/dist/gsd/hook-utils.js.map +1 -0
  87. package/dist/gsd/index.d.ts +9 -0
  88. package/dist/gsd/index.d.ts.map +1 -0
  89. package/dist/gsd/index.js +8 -0
  90. package/dist/gsd/index.js.map +1 -0
  91. package/dist/gsd/planning.d.ts +20 -0
  92. package/dist/gsd/planning.d.ts.map +1 -0
  93. package/dist/gsd/planning.js +167 -0
  94. package/dist/gsd/planning.js.map +1 -0
  95. package/dist/hooks/gsd/draht-post-task.js +44 -11
  96. package/dist/hooks/gsd/draht-quality-gate.js +99 -57
  97. package/dist/index.d.ts +2 -0
  98. package/dist/index.d.ts.map +1 -1
  99. package/dist/index.js +2 -0
  100. package/dist/index.js.map +1 -1
  101. package/dist/main.d.ts.map +1 -1
  102. package/dist/main.js +5 -5
  103. package/dist/main.js.map +1 -1
  104. package/dist/migrations.js.map +1 -1
  105. package/dist/modes/interactive/components/armin.js.map +1 -1
  106. package/dist/modes/interactive/components/config-selector.js.map +1 -1
  107. package/dist/modes/interactive/components/daxnuts.js.map +1 -1
  108. package/dist/modes/interactive/components/dynamic-border.js.map +1 -1
  109. package/dist/modes/interactive/components/extension-editor.d.ts +5 -2
  110. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
  111. package/dist/modes/interactive/components/extension-editor.js +9 -1
  112. package/dist/modes/interactive/components/extension-editor.js.map +1 -1
  113. package/dist/modes/interactive/components/extension-selector.js.map +1 -1
  114. package/dist/modes/interactive/components/footer.js.map +1 -1
  115. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  116. package/dist/modes/interactive/components/login-dialog.js +1 -1
  117. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  118. package/dist/modes/interactive/components/model-selector.d.ts +1 -1
  119. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  120. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  121. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  122. package/dist/modes/interactive/components/oauth-selector.js +1 -1
  123. package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  124. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  125. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  126. package/dist/modes/interactive/components/session-selector.js +1 -1
  127. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  128. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  129. package/dist/modes/interactive/components/tool-execution.d.ts +2 -0
  130. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  131. package/dist/modes/interactive/components/tool-execution.js +28 -3
  132. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  133. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  134. package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
  135. package/dist/modes/interactive/components/user-message.d.ts +1 -0
  136. package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
  137. package/dist/modes/interactive/components/user-message.js +11 -0
  138. package/dist/modes/interactive/components/user-message.js.map +1 -1
  139. package/dist/modes/interactive/interactive-mode.d.ts +1 -1
  140. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  141. package/dist/modes/interactive/interactive-mode.js +29 -28
  142. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  143. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  144. package/dist/modes/interactive/theme/theme.js +5 -0
  145. package/dist/modes/interactive/theme/theme.js.map +1 -1
  146. package/dist/prompts/agents/build.md +5 -1
  147. package/dist/prompts/agents/plan.md +5 -1
  148. package/dist/prompts/agents/verify.md +5 -1
  149. package/dist/prompts/commands/atomic-commit.md +8 -16
  150. package/dist/prompts/commands/discuss-phase.md +9 -3
  151. package/dist/prompts/commands/execute-phase.md +15 -8
  152. package/dist/prompts/commands/fix.md +35 -0
  153. package/dist/prompts/commands/init-project.md +55 -0
  154. package/dist/prompts/commands/map-codebase.md +7 -1
  155. package/dist/prompts/commands/new-project.md +8 -2
  156. package/dist/prompts/commands/next-milestone.md +48 -0
  157. package/dist/prompts/commands/pause-work.md +4 -0
  158. package/dist/prompts/commands/plan-phase.md +11 -5
  159. package/dist/prompts/commands/progress.md +4 -0
  160. package/dist/prompts/commands/quick.md +8 -2
  161. package/dist/prompts/commands/resume-work.md +4 -0
  162. package/dist/prompts/commands/review.md +32 -0
  163. package/dist/prompts/commands/verify-work.md +10 -4
  164. package/docs/custom-provider.md +10 -2
  165. package/docs/extensions.md +20 -1
  166. package/docs/providers.md +3 -1
  167. package/docs/settings.md +1 -0
  168. package/examples/extensions/README.md +1 -0
  169. package/examples/extensions/antigravity-image-gen.ts +3 -1
  170. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  171. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  172. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  173. package/examples/extensions/custom-provider-qwen-cli/package.json +1 -1
  174. package/examples/extensions/dynamic-tools.ts +74 -0
  175. package/examples/extensions/with-deps/package-lock.json +2 -2
  176. package/examples/extensions/with-deps/package.json +1 -1
  177. package/hooks/gsd/draht-post-task.js +44 -11
  178. package/hooks/gsd/draht-quality-gate.js +99 -57
  179. package/package.json +9 -8
  180. package/prompts/agents/build.md +5 -1
  181. package/prompts/agents/plan.md +5 -1
  182. package/prompts/agents/verify.md +5 -1
  183. package/prompts/commands/atomic-commit.md +8 -16
  184. package/prompts/commands/discuss-phase.md +9 -3
  185. package/prompts/commands/execute-phase.md +15 -8
  186. package/prompts/commands/fix.md +35 -0
  187. package/prompts/commands/init-project.md +55 -0
  188. package/prompts/commands/map-codebase.md +7 -1
  189. package/prompts/commands/new-project.md +8 -2
  190. package/prompts/commands/next-milestone.md +48 -0
  191. package/prompts/commands/pause-work.md +4 -0
  192. package/prompts/commands/plan-phase.md +11 -5
  193. package/prompts/commands/progress.md +4 -0
  194. package/prompts/commands/quick.md +8 -2
  195. package/prompts/commands/resume-work.md +4 -0
  196. package/prompts/commands/review.md +32 -0
  197. package/prompts/commands/verify-work.md +10 -4
  198. package/dist/extensions/gsd-commands.ts +0 -403
  199. package/dist/extensions/subagent.ts +0 -515
  200. package/extensions/gsd-commands.ts +0 -403
  201. package/extensions/subagent.ts +0 -515
@@ -4,19 +4,13 @@ description: "Analyze changes and create atomic commits"
4
4
 
5
5
  # Git Atomic Commit Analysis
6
6
 
7
- First, check the current status:
7
+ First, gather the current state:
8
8
 
9
- *! git status*
9
+ 1. Run `git status` to see what changed
10
+ 2. Run `git diff` to see unstaged changes
11
+ 3. Run `git diff --cached` to see staged changes
10
12
 
11
- Now get the full diff of all changes:
12
-
13
- *! git diff*
14
-
15
- And staged changes:
16
-
17
- *! git diff --cached*
18
-
19
- Based on the changes shown above, analyze and group them into logical, ATOMIC commits. Each commit should:
13
+ Based on the changes, analyze and group them into logical, ATOMIC commits. Each commit should:
20
14
 
21
15
  1. Contain ONE logical change only
22
16
  2. Be self-contained and complete
@@ -27,13 +21,11 @@ For each group of changes you identify:
27
21
  - Generate a clear, descriptive commit message following conventional commits format
28
22
  - Explain WHY these changes belong in one commit
29
23
 
30
- Then provide the exact `git add` and `git commit` commands to execute for each atomic commit in the order they should be applied.
24
+ Then execute the `git add` and `git commit` commands for each atomic commit in the order they should be applied.
31
25
 
32
26
  Format each commit message as:
27
+ ```
33
28
  type(scope): brief description
34
- - Detailed explanation of what changed
35
- - Why the change was necessary
36
-
29
+ ```
37
30
 
38
31
  Common types: feat, fix, refactor, docs, test, chore, style, perf
39
-
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "Capture implementation decisions before planning a phase"
3
+ ---
4
+
1
5
  # /discuss-phase
2
6
 
3
7
  Capture implementation decisions before planning a phase.
@@ -7,13 +11,15 @@ Capture implementation decisions before planning a phase.
7
11
  /discuss-phase [N]
8
12
  ```
9
13
 
14
+ Phase: $1
15
+
10
16
  ## Steps
11
- 1. Run `draht-tools phase-info N` to load phase context
17
+ 1. Run `draht-tools phase-info $1` to load phase context
12
18
  2. Identify gray areas based on what's being built
13
19
  3. Present 1-2 questions at a time about preferences
14
20
  4. If `.planning/DOMAIN.md` exists, load it and validate discovered terms against the glossary. Add any new domain terms found during discussion.
15
- 5. Record decisions with `draht-tools save-context N`
16
- 6. Commit: `draht-tools commit-docs "capture phase N context"`
21
+ 5. Record decisions with `draht-tools save-context $1`
22
+ 6. Commit: `draht-tools commit-docs "capture phase $1 context"`
17
23
 
18
24
  ## Gray Area Categories
19
25
  - **Visual features** → Layout, density, interactions, empty states
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "Execute all plans in a phase with atomic commits"
3
+ ---
4
+
1
5
  # /execute-phase
2
6
 
3
7
  Execute all plans in a phase with atomic commits.
@@ -7,37 +11,40 @@ Execute all plans in a phase with atomic commits.
7
11
  /execute-phase [N] [--gaps-only]
8
12
  ```
9
13
 
14
+ Phase: $1
15
+ Arguments: $ARGUMENTS
16
+
10
17
  ## Steps
11
- 1. Run `draht-tools discover-plans N` to find and order plans
18
+ 1. Run `draht-tools discover-plans $1` to find and order plans
12
19
  2. For each plan in dependency order:
13
- a. Load plan: `draht-tools read-plan N P`
20
+ a. Load plan: `draht-tools read-plan $1 P`
14
21
  b. Execute each task in strict TDD cycle:
15
22
 
16
23
  **🔴 RED — Write failing tests first**
17
24
  - Write the test cases from `<test>`
18
25
  - Run tests — confirm they FAIL (if they pass, the test is wrong)
19
- - Commit failing tests: `draht-tools commit-task N P T "red: test description"`
26
+ - Commit failing tests: `draht-tools commit-task $1 P T "red: test description"`
20
27
 
21
28
  **🟢 GREEN — Minimal implementation**
22
29
  - Write the minimum code from `<action>` to make tests pass
23
30
  - Use domain language from `<context>` and `<domain>` for all names
24
31
  - Run tests — confirm they PASS
25
- - Commit: `draht-tools commit-task N P T "green: task name"`
32
+ - Commit: `draht-tools commit-task $1 P T "green: task name"`
26
33
 
27
34
  **🔵 REFACTOR — Clean up with safety net**
28
35
  - Apply improvements from `<refactor>` (if any)
29
36
  - Run tests after each change — must stay green
30
37
  - Verify domain language compliance (names match DOMAIN.md)
31
- - Commit: `draht-tools commit-task N P T "refactor: description"`
38
+ - Commit: `draht-tools commit-task $1 P T "refactor: description"`
32
39
 
33
40
  **✅ VERIFY**
34
41
  - Run the `<verify>` step
35
42
  - Confirm `<done>` criteria met
36
43
 
37
- c. Write summary: `draht-tools write-summary N P`
38
- 3. Phase verification: `draht-tools verify-phase N`
44
+ c. Write summary: `draht-tools write-summary $1 P`
45
+ 3. Phase verification: `draht-tools verify-phase $1`
39
46
  4. Update state: `draht-tools update-state`
40
- 5. Final commit: `draht-tools commit-docs "complete phase N execution"`
47
+ 5. Final commit: `draht-tools commit-docs "complete phase $1 execution"`
41
48
 
42
49
  ## TDD Rules
43
50
  - Never write implementation before a failing test exists
@@ -0,0 +1,35 @@
1
+ ---
2
+ description: "Diagnose and fix a bug with TDD discipline"
3
+ ---
4
+
5
+ # /fix
6
+
7
+ Diagnose and fix a specific bug or failing task with TDD discipline.
8
+
9
+ ## Usage
10
+ ```
11
+ /fix [description of what's broken]
12
+ ```
13
+
14
+ Issue: $ARGUMENTS
15
+
16
+ ## Steps
17
+ 1. **Diagnose**: Read the relevant code and error output to identify the root cause
18
+ - If a test is failing, run it first to see the actual error
19
+ - If a runtime bug, reproduce it and capture the error
20
+ 2. **Write a reproducing test**: Before touching any implementation:
21
+ - Write a test that demonstrates the bug (it must fail)
22
+ - Commit: `draht-tools commit-docs "red: reproduce bug"`
23
+ 3. **Minimal fix**: Write the smallest change that makes the test pass
24
+ - Do not refactor or add features — just fix the bug
25
+ - Run the full test suite to check for regressions
26
+ - Commit: `draht-tools commit-docs "green: fix description"`
27
+ 4. **Refactor** (if needed): Clean up without changing behavior
28
+ - Tests must stay green after every change
29
+ - Commit: `draht-tools commit-docs "refactor: description"`
30
+ 5. **Update state**: `draht-tools update-state`
31
+
32
+ ## Rules
33
+ - Always reproduce before fixing — a fix without a test is a guess
34
+ - One bug, one fix, one commit. Do not bundle unrelated changes.
35
+ - If the root cause spans multiple files, explain the chain in the commit message
@@ -0,0 +1,55 @@
1
+ ---
2
+ description: "Initialize planning for an existing project"
3
+ ---
4
+
5
+ # /init-project
6
+
7
+ Initialize planning framework for an existing project: codebase mapping → questioning → domain model → requirements → roadmap.
8
+
9
+ ## Usage
10
+ ```
11
+ /init-project [focus area or goal]
12
+ ```
13
+
14
+ Focus: $ARGUMENTS
15
+
16
+ Use this when you have an existing codebase and want to add structured planning.
17
+ For greenfield projects, use `/new-project` instead.
18
+
19
+ ## Steps
20
+ 1. Run `draht-tools init` to check preconditions (git repo, etc.)
21
+ 2. Run `draht-tools map-codebase` to build a structural map of the existing code
22
+ 3. Analyze the codebase map to understand architecture, tech stack, and conventions
23
+ 4. Deep questioning phase (3-7 rounds, 1-2 questions at a time):
24
+ - What is this project? Who uses it?
25
+ - What are the current pain points or goals?
26
+ - What is MVP vs aspirational scope?
27
+ - What constraints exist (infra, team size, deadlines)?
28
+ 5. Run `draht-tools create-project` with gathered info
29
+ 6. Run `draht-tools create-domain-model` to define bounded contexts, entities, and ubiquitous language
30
+ 7. Create `.planning/DOMAIN.md` with:
31
+ - `## Bounded Contexts` — each context with name, responsibility, and brief description
32
+ - `## Ubiquitous Language` — glossary of domain terms agreed with the user (term → definition)
33
+ - `## Context Map` — how bounded contexts relate to each other (upstream/downstream, shared kernel, ACL)
34
+ - `## Aggregates` — aggregates and their root entities per context
35
+ - `## Domain Events` — named events that cross context boundaries
36
+ 8. Create `.planning/TEST-STRATEGY.md` with:
37
+ - `## Test Framework` — chosen framework and rationale
38
+ - `## Directory Conventions` — where test files live relative to source
39
+ - `## Coverage Goals` — target coverage percentage and which paths are critical
40
+ - `## Testing Levels` — what is tested at unit level vs integration vs e2e, with examples
41
+ - `## Excluded` — what is explicitly not tested and why (config files, generated code, etc.)
42
+ 9. Optional research phase via `draht-tools research`
43
+ 10. Run `draht-tools create-requirements` with v1/v2/out-of-scope (map requirements to bounded contexts)
44
+ 11. Run `draht-tools create-roadmap` with phases
45
+ 12. Run `draht-tools init-state`
46
+ 13. Git commit via `draht-tools commit-docs "initialize project planning"`
47
+
48
+ ## Rules
49
+ - Ask 1-2 questions at a time, never dump 10 at once
50
+ - Follow threads based on answers
51
+ - Use examples ("Like Stripe Checkout, or custom?")
52
+ - Confirm, don't assume
53
+ - 3-7 follow-up rounds typical
54
+ - Respect what already exists — do not propose rewriting working code
55
+ - Stop when you have: current state, goals, MVP scope, constraints, success criteria
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "Analyze existing codebase before planning"
3
+ ---
4
+
1
5
  # /map-codebase
2
6
 
3
7
  Analyze existing codebase before planning.
@@ -7,8 +11,10 @@ Analyze existing codebase before planning.
7
11
  /map-codebase [directory]
8
12
  ```
9
13
 
14
+ Directory: $1
15
+
10
16
  ## Steps
11
- 1. Run `draht-tools map-codebase [dir]`
17
+ 1. Run `draht-tools map-codebase $1`
12
18
  2. Tool generates: STACK.md, ARCHITECTURE.md, CONVENTIONS.md, CONCERNS.md
13
19
  3. Review output, supplement with your own analysis if needed
14
20
  4. Identify implicit bounded contexts from directory structure:
@@ -1,12 +1,18 @@
1
+ ---
2
+ description: "Initialize a new project with structured planning"
3
+ ---
4
+
1
5
  # /new-project
2
6
 
3
- Initialize a new GSD project: questioning → research → requirements → roadmap.
7
+ Initialize a new project: questioning → research → requirements → roadmap.
4
8
 
5
9
  ## Usage
6
10
  ```
7
11
  /new-project [description]
8
12
  ```
9
13
 
14
+ Description: $ARGUMENTS
15
+
10
16
  ## Steps
11
17
  1. Run `draht-tools init` to check preconditions
12
18
  2. If existing code detected, run `draht-tools map-codebase` first
@@ -29,7 +35,7 @@ Initialize a new GSD project: questioning → research → requirements → road
29
35
  9. Run `draht-tools create-requirements` with v1/v2/out-of-scope (map requirements to bounded contexts)
30
36
  10. Run `draht-tools create-roadmap` with phases
31
37
  11. Run `draht-tools init-state`
32
- 12. Git commit via `draht-tools commit-docs "initialize GSD project"`
38
+ 12. Git commit via `draht-tools commit-docs "initialize project planning"`
33
39
 
34
40
  ## Rules
35
41
  - Ask 1-2 questions at a time, never dump 10 at once
@@ -0,0 +1,48 @@
1
+ ---
2
+ description: "Plan the next milestone after current one completes"
3
+ ---
4
+
5
+ # /next-milestone
6
+
7
+ Plan the next milestone after the current one is complete.
8
+
9
+ ## Usage
10
+ ```
11
+ /next-milestone
12
+ ```
13
+
14
+ ## Prerequisites
15
+ - `.planning/ROADMAP.md` must exist
16
+ - Current milestone should be complete or nearly complete
17
+
18
+ ## Steps
19
+ 1. Load project context:
20
+ - Read `.planning/ROADMAP.md` — identify the completed milestone and its phases
21
+ - Read `.planning/STATE.md` — understand current status
22
+ - Read `.planning/REQUIREMENTS.md` — check which requirements are satisfied
23
+ - Read `.planning/DOMAIN.md` (if exists) — review domain model for evolution needs
24
+ 2. Review completed work:
25
+ - Scan `.planning/phases/` for all UAT reports (`*-UAT.md`) and summaries (`*-SUMMARY.md`)
26
+ - Note what was built, what worked well, what had issues
27
+ 3. Assess requirements:
28
+ - Which v1 requirements are now satisfied?
29
+ - Which v1 requirements remain?
30
+ - Should any v2 requirements be promoted based on what we learned?
31
+ - Are there new requirements discovered during implementation?
32
+ 4. Propose next milestone:
33
+ - Define 3-5 phases, each with a clear goal (outcome, not activity)
34
+ - Order phases by dependency
35
+ - Map each phase to specific requirements
36
+ - Estimate relative complexity
37
+ 5. Present the proposed milestone for user approval before writing files
38
+ 6. After approval:
39
+ - Update `ROADMAP.md` with the new milestone and phases
40
+ - Update `STATE.md` to reflect milestone transition
41
+ - Update `REQUIREMENTS.md` if requirements changed
42
+ - Update `DOMAIN.md` if domain model needs evolution
43
+ - Commit: `draht-tools commit-docs "plan next milestone"`
44
+
45
+ ## Rules
46
+ - Always review what was actually built, not just what was planned
47
+ - Be honest about requirements that slipped or changed scope
48
+ - Each phase goal must be testable — "user can X" not "implement Y"
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "Create a handoff document for session continuity"
3
+ ---
4
+
1
5
  # /pause-work
2
6
 
3
7
  Create a handoff document for session continuity.
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "Create atomic execution plans for a roadmap phase"
3
+ ---
4
+
1
5
  # /plan-phase
2
6
 
3
7
  Create atomic execution plans for a roadmap phase.
@@ -7,18 +11,20 @@ Create atomic execution plans for a roadmap phase.
7
11
  /plan-phase [N]
8
12
  ```
9
13
 
14
+ Phase: $1
15
+
10
16
  ## Steps
11
- 1. Run `draht-tools load-phase-context N` to gather all context
12
- 2. Optional: `draht-tools research-phase N` for domain research
17
+ 1. Run `draht-tools load-phase-context $1` to gather all context
18
+ 2. Optional: `draht-tools research-phase $1` for domain research
13
19
  3. Goal-backward planning:
14
20
  a. State the goal (outcome, not activity)
15
21
  b. Derive observable truths (3-7 from user perspective)
16
22
  c. From each observable truth, derive the test scenarios that would prove it (specific inputs → expected outputs or state changes)
17
23
  d. Map to required artifacts (files, endpoints, schemas)
18
24
  e. Break into atomic tasks (2-5 per plan)
19
- 4. Write plans: `draht-tools create-plan N P`
20
- 5. Validate: `draht-tools validate-plans N`
21
- 6. Commit: `draht-tools commit-docs "create phase N plans"`
25
+ 4. Write plans: `draht-tools create-plan $1 P`
26
+ 5. Validate: `draht-tools validate-plans $1`
27
+ 6. Commit: `draht-tools commit-docs "create phase $1 plans"`
22
28
 
23
29
  ## Plan Format
24
30
  Plans use XML task format:
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "Show current project status"
3
+ ---
4
+
1
5
  # /progress
2
6
 
3
7
  Show current project status.
@@ -1,15 +1,21 @@
1
+ ---
2
+ description: "Execute a small ad-hoc task with tracking"
3
+ ---
4
+
1
5
  # /quick
2
6
 
3
- Execute a small ad-hoc task with GSD tracking.
7
+ Execute a small ad-hoc task with tracking.
4
8
 
5
9
  ## Usage
6
10
  ```
7
11
  /quick [description]
8
12
  ```
9
13
 
14
+ Task: $ARGUMENTS
15
+
10
16
  ## Steps
11
17
  1. Run `draht-tools next-quick-number` to get task number
12
- 2. Create quick plan: `draht-tools create-quick-plan NNN "description"`
18
+ 2. Create quick plan: `draht-tools create-quick-plan NNN "$ARGUMENTS"`
13
19
  3. Execute tasks following the TDD cycle:
14
20
  - **🔴 RED** — Write a failing test that describes the desired behaviour
15
21
  - **🟢 GREEN** — Write the minimum implementation to make it pass
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "Resume from last session state"
3
+ ---
4
+
1
5
  # /resume-work
2
6
 
3
7
  Resume from last session state.
@@ -0,0 +1,32 @@
1
+ ---
2
+ description: "Code review and security audit of recent changes"
3
+ ---
4
+
5
+ # /review
6
+
7
+ Ad-hoc code review and security audit of recent changes or a specific scope.
8
+
9
+ ## Usage
10
+ ```
11
+ /review [scope]
12
+ ```
13
+
14
+ Scope: $ARGUMENTS
15
+
16
+ If no scope given, reviews all recent uncommitted changes.
17
+
18
+ ## Steps
19
+ 1. Identify the scope:
20
+ - If argument given: review those files/directories/description
21
+ - If no argument: run `git diff --stat` and `git diff --cached --stat` to find changes
22
+ 2. For each changed file, examine:
23
+ - Correctness: logic errors, off-by-one, null handling, error paths
24
+ - Type safety: any `as` casts, `any` types, missing null checks
25
+ - Conventions: naming, file organization, import style
26
+ - Security: injection risks, auth bypasses, secrets in code, unsafe deserialization
27
+ - Performance: unnecessary allocations, missing indexes, N+1 queries
28
+ 3. Produce a prioritized findings report:
29
+ - **Critical** — must fix before merge (security, data loss, crashes)
30
+ - **Important** — should fix (bugs, type issues, missing error handling)
31
+ - **Minor** — style, naming, or optional improvements
32
+ 4. For each finding: cite the exact file and line, explain the issue, suggest the fix
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "Acceptance testing of completed phase work"
3
+ ---
4
+
1
5
  # /verify-work
2
6
 
3
7
  Walk through acceptance testing of completed phase work.
@@ -7,6 +11,8 @@ Walk through acceptance testing of completed phase work.
7
11
  /verify-work [N]
8
12
  ```
9
13
 
14
+ Phase: $1
15
+
10
16
  ## Steps
11
17
  1. Run full test suite and capture results:
12
18
  - Execute all tests (`bun test` or project-specific runner)
@@ -16,12 +22,12 @@ Walk through acceptance testing of completed phase work.
16
22
  - Scan source files for PascalCase identifiers not present in the glossary
17
23
  - Flag any bounded context boundary violations (cross-context direct imports)
18
24
  3. Run quality gate: `draht-tools quality-gate --strict`
19
- 4. Run `draht-tools extract-deliverables N` to get testable items
25
+ 4. Run `draht-tools extract-deliverables $1` to get testable items
20
26
  5. Walk user through each deliverable one at a time
21
27
  6. Record results (pass/fail/partially/skip)
22
- 7. For failures: diagnose and create fix plans via `draht-tools create-fix-plan N P`
28
+ 7. For failures: diagnose and create fix plans via `draht-tools create-fix-plan $1 P`
23
29
  - Fix plans MUST include a reproducing test that demonstrates the failure before any implementation
24
- 8. Write UAT report: `draht-tools write-uat N`
30
+ 8. Write UAT report: `draht-tools write-uat $1`
25
31
  - Report must include: test health summary (pass/fail/coverage), domain model status (any glossary violations), deliverable results
26
32
  9. If all passed: mark phase complete
27
- 10. If failures: route to `execute-phase N --gaps-only`
33
+ 10. If failures: route to `execute-phase $1 --gaps-only`
@@ -172,10 +172,17 @@ models: [{
172
172
  // ...
173
173
  compat: {
174
174
  supportsDeveloperRole: false, // use "system" instead of "developer"
175
- supportsReasoningEffort: false, // disable reasoning_effort param
175
+ supportsReasoningEffort: true,
176
+ reasoningEffortMap: { // map pi-ai levels to provider values
177
+ minimal: "default",
178
+ low: "default",
179
+ medium: "default",
180
+ high: "default",
181
+ xhigh: "default"
182
+ },
176
183
  maxTokensField: "max_tokens", // instead of "max_completion_tokens"
177
184
  requiresToolResultName: true, // tool results need name field
178
- requiresMistralToolIds: true // tool IDs must be 9 alphanumeric chars
185
+ requiresMistralToolIds: true,
179
186
  thinkingFormat: "qwen" // uses enable_thinking: true
180
187
  }
181
188
  }]
@@ -568,6 +575,7 @@ interface ProviderModelConfig {
568
575
  supportsStore?: boolean;
569
576
  supportsDeveloperRole?: boolean;
570
577
  supportsReasoningEffort?: boolean;
578
+ reasoningEffortMap?: Partial<Record<"minimal" | "low" | "medium" | "high" | "xhigh", string>>;
571
579
  supportsUsageInStreaming?: boolean;
572
580
  maxTokensField?: "max_completion_tokens" | "max_tokens";
573
581
  requiresToolResultName?: boolean;
@@ -880,6 +880,14 @@ Subscribe to events. See [Events](#events) for event types and return values.
880
880
 
881
881
  Register a custom tool callable by the LLM. See [Custom Tools](#custom-tools) for full details.
882
882
 
883
+ `pi.registerTool()` works both during extension load and after startup. You can call it inside `session_start`, command handlers, or other event handlers. New tools are refreshed immediately in the same session, so they appear in `pi.getAllTools()` and are callable by the LLM without `/reload`.
884
+
885
+ Use `pi.setActiveTools()` to enable or disable tools (including dynamically added tools) at runtime.
886
+
887
+ Use `promptSnippet` to customize that tool's one-line entry in `Available tools`, and `promptGuidelines` to append tool-specific bullets to the default `Guidelines` section when the tool is active.
888
+
889
+ See [dynamic-tools.ts](../examples/extensions/dynamic-tools.ts) for a full example.
890
+
883
891
  ```typescript
884
892
  import { Type } from "@sinclair/typebox";
885
893
  import { StringEnum } from "@draht/ai";
@@ -888,6 +896,8 @@ pi.registerTool({
888
896
  name: "my_tool",
889
897
  label: "My Tool",
890
898
  description: "What this tool does",
899
+ promptSnippet: "Summarize or transform text according to action",
900
+ promptGuidelines: ["Use this tool when the user asks to summarize previously generated text."],
891
901
  parameters: Type.Object({
892
902
  action: StringEnum(["list", "add"] as const),
893
903
  text: Type.Optional(Type.String()),
@@ -1116,7 +1126,7 @@ const result = await pi.exec("git", ["status"], { signal, timeout: 5000 });
1116
1126
 
1117
1127
  ### pi.getActiveTools() / pi.getAllTools() / pi.setActiveTools(names)
1118
1128
 
1119
- Manage active tools.
1129
+ Manage active tools. This works for both built-in tools and dynamically registered tools.
1120
1130
 
1121
1131
  ```typescript
1122
1132
  const active = pi.getActiveTools(); // ["read", "bash", "edit", "write"]
@@ -1276,6 +1286,10 @@ export default function (pi: ExtensionAPI) {
1276
1286
 
1277
1287
  Register tools the LLM can call via `pi.registerTool()`. Tools appear in the system prompt and can have custom rendering.
1278
1288
 
1289
+ Use `promptSnippet` for a short one-line entry in the `Available tools` section in the default system prompt. If omitted, pi falls back to `description`.
1290
+
1291
+ Use `promptGuidelines` to add tool-specific bullets to the default system prompt `Guidelines` section. These bullets are included only while the tool is active (for example, after `pi.setActiveTools([...])`).
1292
+
1279
1293
  Note: Some models are idiots and include the @ prefix in tool path arguments. Built-in tools strip a leading @ before resolving paths. If your custom tool accepts a path, normalize a leading @ as well.
1280
1294
 
1281
1295
  ### Tool Definition
@@ -1289,6 +1303,10 @@ pi.registerTool({
1289
1303
  name: "my_tool",
1290
1304
  label: "My Tool",
1291
1305
  description: "What this tool does (shown to LLM)",
1306
+ promptSnippet: "List or add items in the project todo list",
1307
+ promptGuidelines: [
1308
+ "Use this tool for todo planning instead of direct file edits when the user asks for a task list."
1309
+ ],
1292
1310
  parameters: Type.Object({
1293
1311
  action: StringEnum(["list", "add"] as const), // Use StringEnum for Google compatibility
1294
1312
  text: Type.Optional(Type.String()),
@@ -1886,6 +1904,7 @@ All examples in [examples/extensions/](../examples/extensions/).
1886
1904
  | `question.ts` | Tool with user interaction | `registerTool`, `ui.select` |
1887
1905
  | `questionnaire.ts` | Multi-step wizard tool | `registerTool`, `ui.custom` |
1888
1906
  | `todo.ts` | Stateful tool with persistence | `registerTool`, `appendEntry`, `renderResult`, session events |
1907
+ | `dynamic-tools.ts` | Register tools after startup and during commands | `registerTool`, `session_start`, `registerCommand` |
1889
1908
  | `truncated-tool.ts` | Output truncation example | `registerTool`, `truncateHead` |
1890
1909
  | `tool-override.ts` | Override built-in read tool | `registerTool` (same name as built-in) |
1891
1910
  | **Commands** |||
package/docs/providers.md CHANGED
@@ -65,6 +65,7 @@ pi
65
65
  | Vercel AI Gateway | `AI_GATEWAY_API_KEY` | `vercel-ai-gateway` |
66
66
  | ZAI | `ZAI_API_KEY` | `zai` |
67
67
  | OpenCode Zen | `OPENCODE_API_KEY` | `opencode` |
68
+ | OpenCode Go | `OPENCODE_API_KEY` | `opencode-go` |
68
69
  | Hugging Face | `HF_TOKEN` | `huggingface` |
69
70
  | Kimi For Coding | `KIMI_API_KEY` | `kimi-coding` |
70
71
  | MiniMax | `MINIMAX_API_KEY` | `minimax` |
@@ -81,7 +82,8 @@ Store credentials in `~/.pi/agent/auth.json`:
81
82
  "anthropic": { "type": "api_key", "key": "sk-ant-..." },
82
83
  "openai": { "type": "api_key", "key": "sk-..." },
83
84
  "google": { "type": "api_key", "key": "..." },
84
- "opencode": { "type": "api_key", "key": "..." }
85
+ "opencode": { "type": "api_key", "key": "..." },
86
+ "opencode-go": { "type": "api_key", "key": "..." }
85
87
  }
86
88
  ```
87
89
 
package/docs/settings.md CHANGED
@@ -69,6 +69,7 @@ Edit directly or use `/settings` for common options.
69
69
  | Setting | Type | Default | Description |
70
70
  |---------|------|---------|-------------|
71
71
  | `branchSummary.reserveTokens` | number | `16384` | Tokens reserved for branch summarization |
72
+ | `branchSummary.skipPrompt` | boolean | `false` | Skip "Summarize branch?" prompt on `/tree` navigation (defaults to no summary) |
72
73
 
73
74
  ### Retry
74
75
 
@@ -33,6 +33,7 @@ cp permission-gate.ts ~/.draht/agent/extensions/
33
33
  | `question.ts` | Demonstrates `ctx.ui.select()` for asking the user questions with custom UI |
34
34
  | `questionnaire.ts` | Multi-question input with tab bar navigation between questions |
35
35
  | `tool-override.ts` | Override built-in tools (e.g., add logging/access control to `read`) |
36
+ | `dynamic-tools.ts` | Register tools after startup (`session_start`) and at runtime via command, with prompt snippets and tool-specific prompt guidelines |
36
37
  | `built-in-tool-renderer.ts` | Custom compact rendering for built-in tools (read, bash, edit, write) while keeping original behavior |
37
38
  | `minimal-mode.ts` | Override built-in tool rendering for minimal display (only tool calls, no output in collapsed mode) |
38
39
  | `truncated-tool.ts` | Wraps ripgrep with proper output truncation (50KB/2000 lines) |
@@ -49,8 +49,10 @@ type SaveMode = (typeof SAVE_MODES)[number];
49
49
 
50
50
  const ANTIGRAVITY_ENDPOINT = "https://daily-cloudcode-pa.sandbox.googleapis.com";
51
51
 
52
+ const DEFAULT_ANTIGRAVITY_VERSION = "1.18.3";
53
+
52
54
  const ANTIGRAVITY_HEADERS = {
53
- "User-Agent": "antigravity/1.15.8 darwin/arm64",
55
+ "User-Agent": `antigravity/${process.env.PI_AI_ANTIGRAVITY_VERSION || DEFAULT_ANTIGRAVITY_VERSION} darwin/arm64`,
54
56
  "X-Goog-Api-Client": "google-cloud-sdk vscode_cloudshelleditor/0.1",
55
57
  "Client-Metadata": JSON.stringify({
56
58
  ideType: "IDE_UNSPECIFIED",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider",
3
- "version": "1.6.3",
3
+ "version": "1.7.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-custom-provider",
9
- "version": "1.6.3",
9
+ "version": "1.7.0",
10
10
  "dependencies": {
11
11
  "@anthropic-ai/sdk": "^0.52.0"
12
12
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider-anthropic",
3
3
  "private": true,
4
- "version": "1.6.3",
4
+ "version": "1.7.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider-gitlab-duo",
3
3
  "private": true,
4
- "version": "1.6.3",
4
+ "version": "1.7.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider-qwen-cli",
3
3
  "private": true,
4
- "version": "1.5.3",
4
+ "version": "1.6.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",