@draht/coding-agent 2026.3.4 → 2026.3.6

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 (112) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/agents/architect.md +1 -0
  3. package/agents/debugger.md +1 -0
  4. package/agents/git-committer.md +1 -0
  5. package/agents/implementer.md +1 -0
  6. package/agents/reviewer.md +1 -0
  7. package/agents/security-auditor.md +1 -0
  8. package/agents/verifier.md +1 -0
  9. package/dist/agents/architect.md +1 -0
  10. package/dist/agents/debugger.md +1 -0
  11. package/dist/agents/git-committer.md +1 -0
  12. package/dist/agents/implementer.md +1 -0
  13. package/dist/agents/reviewer.md +1 -0
  14. package/dist/agents/security-auditor.md +1 -0
  15. package/dist/agents/verifier.md +1 -0
  16. package/dist/config.d.ts +7 -0
  17. package/dist/config.d.ts.map +1 -1
  18. package/dist/config.js +15 -0
  19. package/dist/config.js.map +1 -1
  20. package/dist/core/package-manager.d.ts.map +1 -1
  21. package/dist/core/package-manager.js +7 -7
  22. package/dist/core/package-manager.js.map +1 -1
  23. package/dist/core/prompt-templates.d.ts.map +1 -1
  24. package/dist/core/prompt-templates.js +8 -6
  25. package/dist/core/prompt-templates.js.map +1 -1
  26. package/dist/core/resource-loader.d.ts.map +1 -1
  27. package/dist/core/resource-loader.js +9 -8
  28. package/dist/core/resource-loader.js.map +1 -1
  29. package/dist/core/settings-manager.d.ts.map +1 -1
  30. package/dist/core/settings-manager.js +2 -2
  31. package/dist/core/settings-manager.js.map +1 -1
  32. package/dist/core/skills.d.ts.map +1 -1
  33. package/dist/core/skills.js +3 -3
  34. package/dist/core/skills.js.map +1 -1
  35. package/dist/gsd/domain-validator.d.ts +18 -0
  36. package/dist/gsd/domain-validator.d.ts.map +1 -0
  37. package/dist/gsd/domain-validator.js +61 -0
  38. package/dist/gsd/domain-validator.js.map +1 -0
  39. package/dist/gsd/domain.d.ts +12 -0
  40. package/dist/gsd/domain.d.ts.map +1 -0
  41. package/dist/gsd/domain.js +113 -0
  42. package/dist/gsd/domain.js.map +1 -0
  43. package/dist/gsd/git.d.ts +20 -0
  44. package/dist/gsd/git.d.ts.map +1 -0
  45. package/dist/gsd/git.js +59 -0
  46. package/dist/gsd/git.js.map +1 -0
  47. package/dist/gsd/hook-utils.d.ts +22 -0
  48. package/dist/gsd/hook-utils.d.ts.map +1 -0
  49. package/dist/gsd/hook-utils.js +100 -0
  50. package/dist/gsd/hook-utils.js.map +1 -0
  51. package/dist/gsd/index.d.ts +9 -0
  52. package/dist/gsd/index.d.ts.map +1 -0
  53. package/dist/gsd/index.js +8 -0
  54. package/dist/gsd/index.js.map +1 -0
  55. package/dist/gsd/planning.d.ts +20 -0
  56. package/dist/gsd/planning.d.ts.map +1 -0
  57. package/dist/gsd/planning.js +167 -0
  58. package/dist/gsd/planning.js.map +1 -0
  59. package/dist/hooks/gsd/draht-post-task.js +44 -11
  60. package/dist/hooks/gsd/draht-quality-gate.js +99 -57
  61. package/dist/index.d.ts +2 -0
  62. package/dist/index.d.ts.map +1 -1
  63. package/dist/index.js +2 -0
  64. package/dist/index.js.map +1 -1
  65. package/dist/migrations.d.ts.map +1 -1
  66. package/dist/migrations.js +2 -2
  67. package/dist/migrations.js.map +1 -1
  68. package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
  69. package/dist/modes/interactive/components/config-selector.js +3 -3
  70. package/dist/modes/interactive/components/config-selector.js.map +1 -1
  71. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  72. package/dist/modes/interactive/interactive-mode.js +2 -2
  73. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  74. package/dist/prompts/agents/build.md +5 -1
  75. package/dist/prompts/agents/plan.md +5 -1
  76. package/dist/prompts/agents/verify.md +5 -1
  77. package/dist/prompts/commands/atomic-commit.md +8 -16
  78. package/dist/prompts/commands/discuss-phase.md +19 -3
  79. package/dist/prompts/commands/execute-phase.md +59 -35
  80. package/dist/prompts/commands/fix.md +14 -6
  81. package/dist/prompts/commands/init-project.md +21 -3
  82. package/dist/prompts/commands/map-codebase.md +24 -19
  83. package/dist/prompts/commands/new-project.md +20 -2
  84. package/dist/prompts/commands/next-milestone.md +8 -2
  85. package/dist/prompts/commands/pause-work.md +4 -0
  86. package/dist/prompts/commands/plan-phase.md +35 -7
  87. package/dist/prompts/commands/progress.md +4 -0
  88. package/dist/prompts/commands/quick.md +20 -7
  89. package/dist/prompts/commands/resume-work.md +4 -0
  90. package/dist/prompts/commands/review.md +16 -10
  91. package/dist/prompts/commands/verify-work.md +37 -17
  92. package/hooks/gsd/draht-post-task.js +44 -11
  93. package/hooks/gsd/draht-quality-gate.js +99 -57
  94. package/package.json +5 -5
  95. package/prompts/agents/build.md +5 -1
  96. package/prompts/agents/plan.md +5 -1
  97. package/prompts/agents/verify.md +5 -1
  98. package/prompts/commands/atomic-commit.md +8 -16
  99. package/prompts/commands/discuss-phase.md +19 -3
  100. package/prompts/commands/execute-phase.md +59 -35
  101. package/prompts/commands/fix.md +14 -6
  102. package/prompts/commands/init-project.md +21 -3
  103. package/prompts/commands/map-codebase.md +24 -19
  104. package/prompts/commands/new-project.md +20 -2
  105. package/prompts/commands/next-milestone.md +8 -2
  106. package/prompts/commands/pause-work.md +4 -0
  107. package/prompts/commands/plan-phase.md +35 -7
  108. package/prompts/commands/progress.md +4 -0
  109. package/prompts/commands/quick.md +20 -7
  110. package/prompts/commands/resume-work.md +4 -0
  111. package/prompts/commands/review.md +16 -10
  112. package/prompts/commands/verify-work.md +37 -17
@@ -1,6 +1,10 @@
1
+ ---
2
+ description: "Execution agent that implements plans precisely"
3
+ ---
4
+
1
5
  # Draht Build Agent
2
6
 
3
- You are an execution agent for the Get Shit Done methodology. Your job is to implement plans precisely.
7
+ You are an execution agent. Your job is to implement plans precisely.
4
8
 
5
9
  ## Core Rules
6
10
  1. Read the plan FIRST — it is your instruction set
@@ -1,6 +1,10 @@
1
+ ---
2
+ description: "Planning agent that creates atomic, executable plans"
3
+ ---
4
+
1
5
  # Draht Plan Agent
2
6
 
3
- You are a planning agent for the Get Shit Done methodology. Your job is to create atomic, executable plans.
7
+ You are a planning agent. Your job is to create atomic, executable plans.
4
8
 
5
9
  ## Core Rules
6
10
  1. Plans are prompts — they tell the executor EXACTLY what to build
@@ -1,6 +1,10 @@
1
+ ---
2
+ description: "Verification agent that tests work against acceptance criteria"
3
+ ---
4
+
1
5
  # Draht Verify Agent
2
6
 
3
- You are a verification agent for the Get Shit Done methodology. Your job is to test completed work against acceptance criteria.
7
+ You are a verification agent. Your job is to test completed work against acceptance criteria.
4
8
 
5
9
  ## Core Rules
6
10
  1. Test from the USER's perspective, not the developer's
@@ -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,25 @@ 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"`
23
+
24
+ ## Workflow
25
+ This is one step in the per-phase cycle. Each step runs in its own session (`/new` between steps):
26
+
27
+ ```
28
+ /discuss-phase N → /new → /plan-phase N → /new → /execute-phase N → /new → /verify-work N → /new → /discuss-phase N+1 → ...
29
+ ```
30
+
31
+ After completing this command, tell the user to start a new session and run `/plan-phase $1`.
32
+ Do NOT suggest `/next-milestone` — that is only after ALL phases in the milestone are verified.
17
33
 
18
34
  ## Gray Area Categories
19
35
  - **Visual features** → Layout, density, interactions, empty states
@@ -1,43 +1,62 @@
1
+ ---
2
+ description: "Execute all plans in a phase with atomic commits"
3
+ ---
4
+
1
5
  # /execute-phase
2
6
 
3
- Execute all plans in a phase with atomic commits.
7
+ Execute all plans in a phase with atomic commits, parallelizing independent plans via subagents.
4
8
 
5
9
  ## Usage
6
10
  ```
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
12
- 2. For each plan in dependency order:
13
- a. Load plan: `draht-tools read-plan N P`
14
- b. Execute each task in strict TDD cycle:
15
-
16
- **🔴 RED Write failing tests first**
17
- - Write the test cases from `<test>`
18
- - 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"`
20
-
21
- **🟢 GREEN Minimal implementation**
22
- - Write the minimum code from `<action>` to make tests pass
23
- - Use domain language from `<context>` and `<domain>` for all names
24
- - Run tests confirm they PASS
25
- - Commit: `draht-tools commit-task N P T "green: task name"`
26
-
27
- **🔵 REFACTOR Clean up with safety net**
28
- - Apply improvements from `<refactor>` (if any)
29
- - Run tests after each change — must stay green
30
- - Verify domain language compliance (names match DOMAIN.md)
31
- - Commit: `draht-tools commit-task N P T "refactor: description"`
32
-
33
- **✅ VERIFY**
34
- - Run the `<verify>` step
35
- - Confirm `<done>` criteria met
36
-
37
- c. Write summary: `draht-tools write-summary N P`
38
- 3. Phase verification: `draht-tools verify-phase N`
39
- 4. Update state: `draht-tools update-state`
40
- 5. Final commit: `draht-tools commit-docs "complete phase N execution"`
18
+ 1. Run `draht-tools discover-plans $1` to find and order plans
19
+ 2. Read each plan file yourself (from `.planning/phases/`) and analyze dependencies to identify which plans can run in parallel vs sequential
20
+ 3. **Delegate execution to subagents:**
21
+ - For independent plans (no shared files, no dependency chain): use the `subagent` tool in **parallel mode** with `implementer` agents, one per plan.
22
+ - For dependent plans: execute them sequentially, each via a **single** `subagent` call to `implementer`, waiting for the previous to complete before starting the next.
23
+ - Each subagent task must include:
24
+ - The full plan content (paste it into the task the subagent cannot run draht-tools)
25
+ - The TDD cycle instructions (see template below)
26
+ - Instructions to commit with `git add <files> && git commit -m "description"`
27
+
28
+ 4. After all subagents complete, collect results and check for failures
29
+ 5. Run `draht-tools verify-phase $1` yourself (not the subagent)
30
+ 6. Run `draht-tools update-state` yourself
31
+ 7. Final commit: `draht-tools commit-docs "complete phase $1 execution"`
32
+ 8. After execution, tell the user to start a new session and run `/verify-work $1`.
33
+
34
+ ## Subagent Task Template
35
+
36
+ Each implementer subagent receives a task like:
37
+
38
+ ```
39
+ Execute this plan. Here is the full plan content:
40
+
41
+ <paste full plan XML here>
42
+
43
+ For each <task> in the plan, follow this TDD cycle:
44
+ 1. RED — Write failing tests from <test>. Run the test runner, confirm they FAIL. Commit with: git add <test-files> && git commit -m "red: <description>"
45
+ 2. GREEN — Write minimal implementation from <action> to make tests pass. Run tests, confirm PASS. Commit with: git add <files> && git commit -m "green: <task name>"
46
+ 3. REFACTOR — Apply <refactor> improvements if any. Tests must stay green after each change. Commit with: git add <files> && git commit -m "refactor: <description>"
47
+ 4. VERIFY Run the <verify> step, confirm <done> criteria are met.
48
+
49
+ Domain rules: Use ubiquitous language from .planning/DOMAIN.md (read it). Do not import across bounded context boundaries.
50
+ Checkpoint handling: type="auto" → execute silently. type="checkpoint:human-verify" → stop and report back what was built. type="checkpoint:decision" → stop and report the options.
51
+
52
+ Important: Do NOT run draht, draht-tools, draht help, or pi commands. Use only standard tools (read, bash, edit, write, grep, find, ls).
53
+ ```
54
+
55
+ ## Parallelization Rules
56
+ - Plans sharing no files and having no dependency edges can run in parallel
57
+ - If plan B depends on output of plan A, plan B must wait for A to complete
58
+ - Maximum parallel subagents: follow the subagent tool limits (max 8 tasks, 4 concurrent)
59
+ - If a parallel subagent fails, report which plan failed and continue with independent plans
41
60
 
42
61
  ## TDD Rules
43
62
  - Never write implementation before a failing test exists
@@ -50,10 +69,15 @@ Execute all plans in a phase with atomic commits.
50
69
  - Do not import across bounded context boundaries directly — use domain events or ACL adapters
51
70
  - If implementation reveals a missing domain term, stop and update DOMAIN.md before continuing
52
71
 
53
- ## Checkpoint Handling
54
- - `type="auto"` execute without pausing
55
- - `type="checkpoint:human-verify"` → pause, show user, wait for confirmation
56
- - `type="checkpoint:decision"` → pause, present options, wait for choice
72
+ ## Workflow
73
+ This is one step in the per-phase cycle. Each step runs in its own session (`/new` between steps):
74
+
75
+ ```
76
+ /discuss-phase N → /new → /plan-phase N → /new → /execute-phase N → /new → /verify-work N → /new → /discuss-phase N+1 → ...
77
+ ```
78
+
79
+ After completing this command, tell the user to start a new session and run `/verify-work $1`.
80
+ Do NOT suggest `/next-milestone` — that is only after ALL phases in the milestone are verified.
57
81
 
58
82
  ## Flags
59
83
  - `--gaps-only` → only execute FIX-PLAN.md files from failed verification
@@ -1,26 +1,34 @@
1
+ ---
2
+ description: "Diagnose and fix a bug with TDD discipline"
3
+ ---
4
+
1
5
  # /fix
2
6
 
3
- Diagnose and fix a specific bug or failing task with TDD discipline.
7
+ Diagnose and fix a specific bug or failing task with TDD discipline, using a subagent for diagnosis.
4
8
 
5
9
  ## Usage
6
10
  ```
7
11
  /fix [description of what's broken]
8
12
  ```
9
13
 
14
+ Issue: $ARGUMENTS
15
+
10
16
  ## Steps
11
- 1. **Diagnose**: Read the relevant code and error output to identify the root cause
12
- - If a test is failing, run it first to see the actual error
13
- - If a runtime bug, reproduce it and capture the error
14
- 2. **Write a reproducing test**: Before touching any implementation:
15
- - Write a test that demonstrates the bug (it must fail)
17
+ 1. **Diagnose via subagent**: Use the `subagent` tool in **single mode** with the `debugger` agent:
18
+ "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."
19
+
20
+ 2. **Write a reproducing test**: Based on the diagnosis, write a test that demonstrates the bug (it must fail)
16
21
  - Commit: `draht-tools commit-docs "red: reproduce bug"`
22
+
17
23
  3. **Minimal fix**: Write the smallest change that makes the test pass
18
24
  - Do not refactor or add features — just fix the bug
19
25
  - Run the full test suite to check for regressions
20
26
  - Commit: `draht-tools commit-docs "green: fix description"`
27
+
21
28
  4. **Refactor** (if needed): Clean up without changing behavior
22
29
  - Tests must stay green after every change
23
30
  - Commit: `draht-tools commit-docs "refactor: description"`
31
+
24
32
  5. **Update state**: `draht-tools update-state`
25
33
 
26
34
  ## Rules
@@ -1,13 +1,19 @@
1
+ ---
2
+ description: "Initialize planning for an existing project"
3
+ ---
4
+
1
5
  # /init-project
2
6
 
3
- Initialize GSD planning framework for an existing project: codebase mapping → questioning → domain model → requirements → roadmap.
7
+ Initialize planning framework for an existing project: codebase mapping → questioning → domain model → requirements → roadmap.
4
8
 
5
9
  ## Usage
6
10
  ```
7
11
  /init-project [focus area or goal]
8
12
  ```
9
13
 
10
- Use this when you have an existing codebase and want to add GSD methodology.
14
+ Focus: $ARGUMENTS
15
+
16
+ Use this when you have an existing codebase and want to add structured planning.
11
17
  For greenfield projects, use `/new-project` instead.
12
18
 
13
19
  ## Steps
@@ -37,7 +43,19 @@ For greenfield projects, use `/new-project` instead.
37
43
  10. Run `draht-tools create-requirements` with v1/v2/out-of-scope (map requirements to bounded contexts)
38
44
  11. Run `draht-tools create-roadmap` with phases
39
45
  12. Run `draht-tools init-state`
40
- 13. Git commit via `draht-tools commit-docs "initialize GSD planning"`
46
+ 13. Git commit via `draht-tools commit-docs "initialize project planning"`
47
+
48
+ ## Workflow
49
+ After project initialization, phases are executed one at a time in new sessions:
50
+
51
+ ```
52
+ /init-project → /new → /discuss-phase 1 → /new → /plan-phase 1 → /new → /execute-phase 1 → /new → /verify-work 1
53
+ → /new → /discuss-phase 2 → /new → /plan-phase 2 → /new → /execute-phase 2 → /new → /verify-work 2
54
+ → ... (repeat for all phases in the milestone)
55
+ → /new → /next-milestone (only after ALL phases are complete)
56
+ ```
57
+
58
+ Each step runs in its own session (`/new` between steps). Do NOT suggest `/next-milestone` until every phase in the milestone is verified.
41
59
 
42
60
  ## Rules
43
61
  - Ask 1-2 questions at a time, never dump 10 at once
@@ -1,32 +1,37 @@
1
+ ---
2
+ description: "Analyze existing codebase before planning"
3
+ ---
4
+
1
5
  # /map-codebase
2
6
 
3
- Analyze existing codebase before planning.
7
+ Analyze existing codebase before planning, using subagents for parallel analysis.
4
8
 
5
9
  ## Usage
6
10
  ```
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
- 3. Review output, supplement with your own analysis if needed
14
- 4. Identify implicit bounded contexts from directory structure:
15
- - Look for top-level `src/` subdirectories, packages, or modules that encapsulate a coherent domain concept
16
- - Note any cross-directory coupling that suggests context boundaries are blurred
17
- 5. Extract domain language from existing code:
18
- - Collect PascalCase class/interface/type names, key function names, and database table/collection names
19
- - Look for repeated nouns that represent core domain concepts (e.g., `Order`, `Invoice`, `Subscription`)
20
- 6. If `.planning/DOMAIN.md` does not already exist, create it with:
19
+ 3. **Run parallel deep analysis via subagents:**
20
+ Use the `subagent` tool in **parallel mode** with these tasks:
21
+ - `architect` agent: "Analyze the codebase at $1. Identify bounded contexts from directory structure — look for top-level src/ subdirectories, packages, or modules that encapsulate coherent domain concepts. Note any cross-directory coupling suggesting blurred context boundaries. Extract domain language: collect PascalCase class/interface/type names, key function names, database table/collection names. Look for repeated nouns representing core domain concepts. Output a structured list of: bounded contexts (name + description), domain terms (glossary), aggregates per context, and context relationships (upstream/downstream, shared kernel, ACL). Do NOT run draht, draht-tools, or pi commands."
22
+ - `verifier` agent: "Analyze the test infrastructure at $1. Discover: test framework(s) in use (check package.json, config files), test directory conventions (co-located, __tests__/, test/), existing coverage configuration and goals, which layers have tests (unit, integration, e2e), gaps and recommendations. Output a structured test strategy report. Do NOT run draht, draht-tools, or pi commands."
23
+
24
+ 4. Collect subagent results and merge with the draht-tools output
25
+ 5. Create `.planning/DOMAIN.md` (if it doesn't exist) with:
21
26
  - `## Bounded Contexts` — one entry per discovered context with a brief description
22
27
  - `## Ubiquitous Language` — glossary of extracted domain terms
23
- - `## Context Map` — rough diagram or list showing how contexts relate
24
- - `## Aggregates` — list aggregates and their root entities per context
28
+ - `## Context Map` — how bounded contexts relate (upstream/downstream, shared kernel, ACL)
29
+ - `## Aggregates` — aggregates and their root entities per context
25
30
  - `## Domain Events` — any existing event names or patterns discovered
26
- 7. Discover test infrastructure and document findings in `.planning/TEST-STRATEGY.md`:
27
- - Test framework(s) in use (Jest, Vitest, Bun test, Mocha, etc.)
28
- - Test directory conventions (co-located, `__tests__/`, `test/`, etc.)
29
- - Existing coverage configuration and goals (if any)
30
- - Which layers have tests today (unit, integration, e2e)
31
- - Gaps and recommendations
32
- 8. Commit: `draht-tools commit-docs "map existing codebase"`
31
+ 6. Create `.planning/TEST-STRATEGY.md` with:
32
+ - `## Test Framework` chosen framework and rationale
33
+ - `## Directory Conventions` where test files live relative to source
34
+ - `## Coverage Goals` — target coverage percentage and which paths are critical
35
+ - `## Testing Levels` what is tested at unit level vs integration vs e2e, with examples
36
+ - `## Excluded` — what is explicitly not tested and why
37
+ 7. Commit: `draht-tools commit-docs "map existing codebase"`
@@ -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,19 @@ 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"`
39
+
40
+ ## Workflow
41
+ After project initialization, phases are executed one at a time in new sessions:
42
+
43
+ ```
44
+ /new-project → /new → /discuss-phase 1 → /new → /plan-phase 1 → /new → /execute-phase 1 → /new → /verify-work 1
45
+ → /new → /discuss-phase 2 → /new → /plan-phase 2 → /new → /execute-phase 2 → /new → /verify-work 2
46
+ → ... (repeat for all phases in the milestone)
47
+ → /new → /next-milestone (only after ALL phases are complete)
48
+ ```
49
+
50
+ Each step runs in its own session (`/new` between steps). Do NOT suggest `/next-milestone` until every phase in the milestone is verified.
33
51
 
34
52
  ## Rules
35
53
  - Ask 1-2 questions at a time, never dump 10 at once
@@ -1,6 +1,10 @@
1
+ ---
2
+ description: "Plan the next milestone after ALL phases in the current milestone are complete"
3
+ ---
4
+
1
5
  # /next-milestone
2
6
 
3
- Plan the next milestone after the current one is complete.
7
+ Plan the next milestone after ALL phases in the current one are complete.
4
8
 
5
9
  ## Usage
6
10
  ```
@@ -9,7 +13,9 @@ Plan the next milestone after the current one is complete.
9
13
 
10
14
  ## Prerequisites
11
15
  - `.planning/ROADMAP.md` must exist
12
- - Current milestone should be complete or nearly complete
16
+ - ALL phases in the current milestone must be complete (verified via /verify-work)
17
+ - This command is ONLY for milestone transitions — NOT for moving between phases within a milestone
18
+ - Between phases, use `/discuss-phase`, `/plan-phase`, `/execute-phase`, `/verify-work` — never `/next-milestone`
13
19
 
14
20
  ## Steps
15
21
  1. Load project context:
@@ -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,24 +1,42 @@
1
+ ---
2
+ description: "Create atomic execution plans for a roadmap phase"
3
+ ---
4
+
1
5
  # /plan-phase
2
6
 
3
- Create atomic execution plans for a roadmap phase.
7
+ Create atomic execution plans for a roadmap phase, using subagents for parallel plan creation.
4
8
 
5
9
  ## Usage
6
10
  ```
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
- 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"`
24
+ e. Break into plan groups of 2-5 tasks each
25
+ 4. Identify which plans are independent (no shared files, no dependency edges)
26
+ 5. **Delegate plan creation to subagents:**
27
+ - For independent plans: use the `subagent` tool in **parallel mode** with `architect` agents, one per plan. Each task should include the phase context, the specific observable truths, target files, and the XML task format (below).
28
+ - For dependent plans: create them sequentially, each via a **single** `subagent` call to `architect`, passing the outputs of predecessor plans as context.
29
+ - Each subagent task must include:
30
+ - The phase context summary (paste it — subagents cannot run draht-tools)
31
+ - The specific observable truths this plan must satisfy
32
+ - The target files/artifacts
33
+ - The XML task format specification (below)
34
+ - Instruction to output the plan as XML (you will save it via `draht-tools create-plan`)
35
+
36
+ 6. Collect all plan outputs from subagents
37
+ 7. Save plans yourself: `draht-tools create-plan $1 P` for each plan
38
+ 8. Validate: `draht-tools validate-plans $1`
39
+ 9. Commit: `draht-tools commit-docs "create phase $1 plans"`
22
40
 
23
41
  ## Plan Format
24
42
  Plans use XML task format:
@@ -54,6 +72,16 @@ Plans use XML task format:
54
72
 
55
73
  Task types: `auto`, `checkpoint:human-verify`, `checkpoint:decision`
56
74
 
75
+ ## Workflow
76
+ This is one step in the per-phase cycle. Each step runs in its own session (`/new` between steps):
77
+
78
+ ```
79
+ /discuss-phase N → /new → /plan-phase N → /new → /execute-phase N → /new → /verify-work N → /new → /discuss-phase N+1 → ...
80
+ ```
81
+
82
+ After completing this command, tell the user to start a new session and run `/execute-phase $1`.
83
+ Do NOT suggest `/next-milestone` — that is only after ALL phases in the milestone are verified.
84
+
57
85
  ## Domain Rules for Plans
58
86
  - File/module structure should mirror bounded contexts (e.g., `src/billing/`, `src/catalog/`)
59
87
  - Never scatter one aggregate's logic across multiple contexts without an explicit ACL
@@ -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,19 +1,32 @@
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"`
13
- 3. Execute tasks following the TDD cycle:
14
- - **🔴 RED** — Write a failing test that describes the desired behaviour
15
- - **🟢 GREEN** — Write the minimum implementation to make it pass
16
- - **🔵 REFACTOR** — Clean up while keeping the test green
17
- - *Exception: skip the TDD cycle only for pure config or documentation-only tasks that have no testable behaviour*
18
+ 2. Create quick plan: `draht-tools create-quick-plan NNN "$ARGUMENTS"`
19
+ 3. **Delegate execution to subagent**: Use the `subagent` tool in **single mode** with the `implementer` agent:
20
+ "Execute this task: $ARGUMENTS
21
+
22
+ Follow the TDD cycle:
23
+ - RED Write a failing test that describes the desired behaviour
24
+ - GREEN — Write the minimum implementation to make it pass
25
+ - REFACTOR — Clean up while keeping the test green
26
+ Exception: skip the TDD cycle only for pure config or documentation-only tasks that have no testable behaviour.
27
+
28
+ After completion, report: files changed, tests written, and verification results.
29
+ Do NOT run draht, draht-tools, draht help, or pi commands — use only standard tools."
30
+
18
31
  4. Write summary: `draht-tools write-quick-summary NNN`
19
32
  5. Update state: `draht-tools update-state`
@@ -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.
@@ -1,26 +1,32 @@
1
+ ---
2
+ description: "Code review and security audit of recent changes"
3
+ ---
4
+
1
5
  # /review
2
6
 
3
- Ad-hoc code review and security audit of recent changes or a specific scope.
7
+ Code review and security audit of recent changes, using subagents for parallel analysis.
4
8
 
5
9
  ## Usage
6
10
  ```
7
11
  /review [scope]
8
12
  ```
9
13
 
14
+ Scope: $ARGUMENTS
15
+
10
16
  If no scope given, reviews all recent uncommitted changes.
11
17
 
12
18
  ## Steps
13
19
  1. Identify the scope:
14
- - If argument given: review those files/directories/description
20
+ - If argument given: use those files/directories/description as scope
15
21
  - If no argument: run `git diff --stat` and `git diff --cached --stat` to find changes
16
- 2. For each changed file, examine:
17
- - Correctness: logic errors, off-by-one, null handling, error paths
18
- - Type safety: any `as` casts, `any` types, missing null checks
19
- - Conventions: naming, file organization, import style
20
- - Security: injection risks, auth bypasses, secrets in code, unsafe deserialization
21
- - Performance: unnecessary allocations, missing indexes, N+1 queries
22
- 3. Produce a prioritized findings report:
22
+ 2. Determine the list of changed files and produce a scope summary
23
+ 3. **Delegate to subagents in parallel:**
24
+ Use the `subagent` tool in **parallel mode** with these tasks:
25
+ - `reviewer` agent: "Review the following code changes for correctness, type safety, conventions, and potential issues. Scope: <scope summary and file list>. Read each changed file to understand the changes. For each finding: cite the exact file and line, explain the issue, suggest the fix. Prioritize: Critical (must fix) > Important (should fix) > Minor (style/optional). Do NOT run draht, draht-tools, or pi commands."
26
+ - `security-auditor` agent: "Audit the following code changes for security vulnerabilities. Scope: <scope summary and file list>. Read each changed file. Check for: injection risks, auth bypasses, secrets in code, unsafe deserialization, path traversal, prototype pollution. Report findings with severity, file, line, and recommendation. Do NOT run draht, draht-tools, or pi commands."
27
+
28
+ 4. Collect and merge results from both subagents
29
+ 5. Produce a unified, prioritized findings report:
23
30
  - **Critical** — must fix before merge (security, data loss, crashes)
24
31
  - **Important** — should fix (bugs, type issues, missing error handling)
25
32
  - **Minor** — style, naming, or optional improvements
26
- 4. For each finding: cite the exact file and line, explain the issue, suggest the fix