@brunosps00/dev-workflow 2.2.0 → 2.3.0

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 (119) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +46 -0
  3. package/README.md +12 -4
  4. package/lib/constants.js +24 -24
  5. package/lib/init.js +8 -0
  6. package/lib/instruction-health.js +38 -0
  7. package/lib/post-update.js +2 -1
  8. package/lib/validate.js +3 -1
  9. package/package.json +1 -1
  10. package/scaffold/config/routing.json +61 -23
  11. package/scaffold/en/agent-instructions.md +31 -137
  12. package/scaffold/en/commands/dw-analyze-project.md +2 -0
  13. package/scaffold/en/commands/dw-autopilot.md +22 -245
  14. package/scaffold/en/commands/dw-bugfix.md +9 -35
  15. package/scaffold/en/commands/dw-claude-run.md +29 -45
  16. package/scaffold/en/commands/dw-codex-run.md +30 -45
  17. package/scaffold/en/commands/dw-context-budget.md +6 -14
  18. package/scaffold/en/commands/dw-copilot-run.md +29 -41
  19. package/scaffold/en/commands/dw-generate-pr.md +2 -2
  20. package/scaffold/en/commands/dw-goal.md +11 -5
  21. package/scaffold/en/commands/dw-help.md +2 -2
  22. package/scaffold/en/commands/dw-plan.md +14 -7
  23. package/scaffold/en/commands/dw-qa.md +2 -0
  24. package/scaffold/en/commands/dw-resume.md +5 -11
  25. package/scaffold/en/commands/dw-review.md +4 -3
  26. package/scaffold/en/commands/dw-run.md +19 -166
  27. package/scaffold/en/commands/dw-skill-health.md +7 -0
  28. package/scaffold/en/commands/dw-update.md +18 -4
  29. package/scaffold/en/references/command-routing.md +53 -0
  30. package/scaffold/en/references/execution-contract.md +55 -0
  31. package/scaffold/en/templates/frontend-quality-template.md +43 -0
  32. package/scaffold/en/templates/task-template.md +20 -40
  33. package/scaffold/en/templates/tasks-template.md +9 -6
  34. package/scaffold/en/templates/techspec-template.md +4 -0
  35. package/scaffold/pt-br/agent-instructions.md +31 -137
  36. package/scaffold/pt-br/commands/dw-analyze-project.md +2 -0
  37. package/scaffold/pt-br/commands/dw-autopilot.md +22 -245
  38. package/scaffold/pt-br/commands/dw-bugfix.md +9 -35
  39. package/scaffold/pt-br/commands/dw-claude-run.md +29 -46
  40. package/scaffold/pt-br/commands/dw-codex-run.md +30 -45
  41. package/scaffold/pt-br/commands/dw-context-budget.md +6 -14
  42. package/scaffold/pt-br/commands/dw-copilot-run.md +29 -43
  43. package/scaffold/pt-br/commands/dw-generate-pr.md +2 -2
  44. package/scaffold/pt-br/commands/dw-goal.md +11 -5
  45. package/scaffold/pt-br/commands/dw-help.md +2 -2
  46. package/scaffold/pt-br/commands/dw-plan.md +14 -7
  47. package/scaffold/pt-br/commands/dw-qa.md +2 -0
  48. package/scaffold/pt-br/commands/dw-resume.md +7 -11
  49. package/scaffold/pt-br/commands/dw-review.md +4 -3
  50. package/scaffold/pt-br/commands/dw-run.md +19 -166
  51. package/scaffold/pt-br/commands/dw-skill-health.md +7 -0
  52. package/scaffold/pt-br/commands/dw-update.md +18 -4
  53. package/scaffold/pt-br/references/command-routing.md +53 -0
  54. package/scaffold/pt-br/references/execution-contract.md +55 -0
  55. package/scaffold/pt-br/templates/frontend-quality-template.md +43 -0
  56. package/scaffold/pt-br/templates/task-template.md +20 -40
  57. package/scaffold/pt-br/templates/tasks-template.md +9 -6
  58. package/scaffold/pt-br/templates/techspec-template.md +4 -0
  59. package/scaffold/scripts/lib/workflow-contract.mjs +101 -0
  60. package/scaffold/skill-registry.json +23 -23
  61. package/scaffold/skills/dw-cli-run/SKILL.md +33 -217
  62. package/scaffold/skills/dw-cli-run/references/dispatch-tuning.md +14 -72
  63. package/scaffold/skills/dw-codebase-intel/SKILL.md +5 -39
  64. package/scaffold/skills/dw-codebase-intel/agents/intel-updater.md +1 -1
  65. package/scaffold/skills/dw-codebase-intel/references/agents-detail.md +7 -0
  66. package/scaffold/skills/dw-codebase-intel/references/files-in-dw-intel-detail.md +16 -0
  67. package/scaffold/skills/dw-codebase-intel/references/how-dw-intel-reads-this-detail.md +12 -0
  68. package/scaffold/skills/dw-codebase-intel/references/how-to-compose-the-typical-flow-detail.md +11 -0
  69. package/scaffold/skills/dw-council/SKILL.md +2 -17
  70. package/scaffold/skills/dw-council/references/integration-with-other-dw-commands-detail.md +7 -0
  71. package/scaffold/skills/dw-council/references/phase-2-tensions-and-rebuttals-detail.md +15 -0
  72. package/scaffold/skills/dw-domain-modeling/SKILL.md +1 -1
  73. package/scaffold/skills/dw-execute-phase/SKILL.md +12 -32
  74. package/scaffold/skills/dw-execute-phase/agents/executor.md +15 -252
  75. package/scaffold/skills/dw-execute-phase/agents/plan-checker.md +4 -207
  76. package/scaffold/skills/dw-execute-phase/references/atomic-commits.md +8 -18
  77. package/scaffold/skills/dw-execute-phase/references/de-sloppify-pass-optional-cleanup-task-detail.md +12 -0
  78. package/scaffold/skills/dw-execute-phase/references/deviation-rules-during-execution-detail.md +8 -0
  79. package/scaffold/skills/dw-execute-phase/references/how-the-two-agents-compose-detail.md +7 -0
  80. package/scaffold/skills/dw-execute-phase/references/plan-verification.md +9 -155
  81. package/scaffold/skills/dw-execute-phase/references/wave-coordination.md +6 -97
  82. package/scaffold/skills/dw-git-discipline/SKILL.md +2 -2
  83. package/scaffold/skills/dw-grilling/SKILL.md +1 -1
  84. package/scaffold/skills/dw-incident-response/SKILL.md +1 -64
  85. package/scaffold/skills/dw-incident-response/references/the-five-phases-detail.md +66 -0
  86. package/scaffold/skills/dw-llm-eval/SKILL.md +5 -53
  87. package/scaffold/skills/dw-llm-eval/references/agent-tool-use-evaluation-detail.md +23 -0
  88. package/scaffold/skills/dw-llm-eval/references/anti-patterns-will-block-in-dw-review-code-only-detail.md +9 -0
  89. package/scaffold/skills/dw-llm-eval/references/consistency-run-to-run-stability-detail.md +10 -0
  90. package/scaffold/skills/dw-llm-eval/references/integration-with-dev-workflow-commands-detail.md +6 -0
  91. package/scaffold/skills/dw-llm-eval/references/the-oracle-ladder-detail.md +15 -0
  92. package/scaffold/skills/dw-memory/SKILL.md +4 -50
  93. package/scaffold/skills/dw-memory/references/context-budget.md +8 -56
  94. package/scaffold/skills/dw-memory/references/promotion-decision-test-detail.md +30 -0
  95. package/scaffold/skills/dw-minimalism/SKILL.md +4 -5
  96. package/scaffold/skills/dw-review-rigor/SKILL.md +1 -54
  97. package/scaffold/skills/dw-review-rigor/references/the-five-rules-detail.md +56 -0
  98. package/scaffold/skills/dw-simplification/SKILL.md +2 -55
  99. package/scaffold/skills/dw-simplification/references/pattern-recognition-detail.md +11 -0
  100. package/scaffold/skills/dw-simplification/references/the-five-rules-detail.md +48 -0
  101. package/scaffold/skills/dw-source-grounding/SKILL.md +1 -56
  102. package/scaffold/skills/dw-source-grounding/references/the-protocol-detect-fetch-implement-cite-detail.md +58 -0
  103. package/scaffold/skills/dw-testing-discipline/SKILL.md +25 -177
  104. package/scaffold/skills/dw-testing-discipline/references/agent-guardrails.md +9 -167
  105. package/scaffold/skills/dw-testing-discipline/references/core-rules.md +3 -3
  106. package/scaffold/skills/dw-testing-discipline/references/mutation-testing.md +19 -0
  107. package/scaffold/skills/dw-testing-discipline/references/patterns.md +3 -12
  108. package/scaffold/skills/dw-ui-discipline/SKILL.md +2 -59
  109. package/scaffold/skills/dw-ui-discipline/references/frontend-engineering.md +46 -0
  110. package/scaffold/skills/dw-ui-discipline/references/the-four-grounding-questions-detail.md +61 -0
  111. package/scaffold/skills/dw-verify/SKILL.md +26 -148
  112. package/scaffold/skills/dw-verify/references/verification-discovery-and-attribution.md +2 -2
  113. package/scaffold/skills/humanizer/SKILL.md +2 -1
  114. package/scaffold/skills/security-review/SKILL.md +3 -183
  115. package/scaffold/skills/security-review/references/do-not-flag-detail.md +49 -0
  116. package/scaffold/skills/security-review/references/quick-patterns-reference-detail.md +56 -0
  117. package/scaffold/skills/security-review/references/review-process-detail.md +84 -0
  118. package/scaffold/skills/vercel-react-best-practices/SKILL.md +1 -90
  119. package/scaffold/skills/vercel-react-best-practices/references/quick-reference-detail.md +92 -0
@@ -1,266 +1,29 @@
1
1
  ---
2
2
  name: dw-executor
3
- description: Executes a phase (set of tasks for one PRD) with wave-based parallel dispatch, atomic commits, deviation handling, and checkpoint protocol.
3
+ description: Execute approved dependent tasks with scoped commits, valid evidence and durable checkpoints.
4
4
  tools: Read, Write, Edit, Bash, Grep, Glob
5
5
  color: yellow
6
6
  ---
7
7
 
8
- <required_reading>
9
- CRITICAL: If your spawn prompt contains a required_reading block, you MUST Read every listed file BEFORE any other action. Skipping this causes hallucinated context and broken output.
10
- </required_reading>
8
+ # Task executor
11
9
 
12
- # dw-executor
10
+ Read the approved task packet and `.dw/references/execution-contract.md`. Follow `/dw-run` for the execution loop; do not introduce another orchestration policy. Load only relevant project instructions, task/PRD/TechSpec sections and skill references. User instructions take precedence over workflow defaults within platform permissions.
13
11
 
14
- <role>
15
- You are **dw-executor**, the phase execution agent for dev-workflow. You execute the tasks in `.dw/spec/prd-<slug>/tasks.md` atomically, in waves, with one git commit per task. You handle deviations mid-execution per the three deviation rules. You checkpoint cleanly when context budget gets tight.
12
+ Use saved executor/model/effort assignments. When delegated as a worker, implement only the assigned task; return to the parent rather than recursively launching implementation CLIs or subagents. The parent owns scheduling, independent review and follow-through.
16
13
 
17
- Spawned by `/dw-execute-phase` or `/dw-run` orchestrator with a PRD path.
14
+ Respect `Depends on:` and completed dependency commits on the execution branch. One writer per worktree. Scoped task commits preserve `<REQ-ID>` verbatim (`FR-N.M` / `RF-N.M`); stage only task files. Include task status before committing, record SHA afterward and include remaining bookkeeping in a later scoped/final metadata commit.
18
15
 
19
- Your job: run every task in the phase to completion, commit each one, write `SUMMARY.md` at the end, update `active-session.md` for resume.
20
- </role>
16
+ Use `dw-verify` to select checks and validate reusable evidence. Correct in-scope failures and rerun invalidated checks. Record material deviations in deviations.md; inspect discoverable facts before asking. Block only dependent work when a product/architecture decision or permission is missing. Increased task effort does not itself require a stop.
21
17
 
22
- <project_context>
23
- Before executing, discover project context:
18
+ On interruption preserve diff, session identity and checkpoints in execution-state.json and active-session.md. Do not discard partial work or stop at an invented fixed context percentage. When completion cannot fit, save enough evidence for continuation. At the end write SUMMARY.md with task IDs, commits, valid verification, deviations and outstanding work. No push or merge is implied.
24
19
 
25
- **`./CLAUDE.md`**: read if present. Treat its directives as hard constraints during execution. Before committing each task, verify code changes do not violate CLAUDE.md rules (forbidden patterns, required conventions, mandated tools). If a task action would contradict CLAUDE.md, apply the CLAUDE.md rule — it takes precedence over plan instructions. Document the adjustment as a Rule-1 deviation.
20
+ ## Status markers
26
21
 
27
- **Project skills**: list `.agents/skills/` and `.claude/skills/` if present. Read `SKILL.md` for each (lightweight). Load specific reference files as needed during implementation. Apply skill rules.
22
+ Emit one marker compatible with the existing orchestrator:
28
23
 
29
- **`.dw/rules/`**: project conventions (from `/dw-analyze-project`). Read `index.md` first; load module-specific rules as relevant per task.
30
-
31
- **`.dw/intel/`**: machine-readable codebase intel (from `/dw-intel --build`). Read `arch.md` for architecture overview; query `files.json`/`apis.json` when implementing.
32
- </project_context>
33
-
34
- ## Execution Flow
35
-
36
- ### Step 1: Load context
37
-
38
- ```
39
- Inputs from spawn prompt:
40
- - prd_path: .dw/spec/prd-<slug>/
41
- - start_from: <NN> (optional — resume from this task number, default 01)
42
- - mode: full | wave-only | up-to-task <NN>
43
- ```
44
-
45
- Read:
46
- - `<prd_path>/prd.md` — the goal
47
- - `<prd_path>/techspec.md` — the architecture
48
- - `<prd_path>/tasks.md` — the task list with dependencies
49
- - `<prd_path>/active-session.md` if it exists — last position from a previous checkpoint
50
-
51
- Verify `tasks.md` parses (frontmatter + numbered task list). If malformed, abort with `EXEC-FAILED: malformed tasks.md`.
52
-
53
- ### Step 2: Compute waves
54
-
55
- Parse each task's `Depends on:` field (none, or comma-separated task numbers).
56
-
57
- Topological sort:
58
- - Wave 1 = tasks with no dependencies
59
- - Wave N = tasks whose dependencies are all in waves 1..N-1
60
- - If a cycle is detected → abort with `EXEC-FAILED: dependency cycle in tasks.md`
61
-
62
- Skip tasks already marked `[x]` in `tasks.md`. Skip tasks before `start_from` if specified.
63
-
64
- Print the wave plan:
65
-
66
- ```
67
- Wave 1: tasks 01, 02, 03 (parallel)
68
- Wave 2: tasks 04, 05 (parallel, depends on wave 1)
69
- Wave 3: tasks 06 (depends on wave 2)
70
- ```
71
-
72
- ### Step 3: Execute each wave
73
-
74
- For each wave:
75
-
76
- 1. For each task in the wave (parallel within wave):
77
- - Read `<prd_path>/<NN>_task.md` for the task detail
78
- - Read CLAUDE.md if present (re-read each task in case it changed)
79
- - Implement the task per its spec
80
- - Run the task's verification (linter, tests, build)
81
- - If verification PASSES → atomic commit (Step 4)
82
- - If verification FAILS → deviation handling (Step 5)
83
- 2. Wait for all tasks in the wave to complete before starting the next wave.
84
- 3. After each task commits, mark it `[x]` in `tasks.md` (atomic edit).
85
-
86
- ### Step 4: Atomic commit per task
87
-
88
- Format (per `references/atomic-commits.md`):
89
-
90
- ```
91
- <type>(<scope>): <task title> (#<task-id>)
92
-
93
- <one-line summary>
94
-
95
- - Files added: <list>
96
- - Files modified: <list>
97
- - Tests added/updated: <list>
98
- - Deviations: <link or "none">
99
-
100
- Closes <REQ-ID> (partial — full close on tasks.md completion).
101
- ```
102
-
103
- `<REQ-ID>` is copied verbatim from `tasks.md` (`FR-N.M` in English projects, `RF-N.M` in Portuguese ones) — never assume a prefix.
104
-
105
- Type from Conventional Commits (`feat`, `fix`, `refactor`, `test`, `docs`, `chore`). Scope from task domain. Run `git add -A && git commit` once.
106
-
107
- ### Step 5: Deviation handling (when implementation diverges from plan)
108
-
109
- Three rules:
110
-
111
- **Rule 1 — Auto-add missing critical functionality**
112
-
113
- If implementing the task naturally requires something the plan didn't specify but the project rules / CLAUDE.md require it (e.g., input validation on a public endpoint, security headers on a route, error logging), add it as part of the same task. Document in `<prd_path>/deviations.md`:
114
-
115
- ```markdown
116
- ## DEVIATION-<NN>-1 (Rule 1): <one-line title>
117
-
118
- - **Task:** <NN> — <task title>
119
- - **What was added:** <description>
120
- - **Why:** <which rule / CLAUDE.md directive triggered>
121
- - **Files affected:** <list>
122
- - **Commit:** <will be filled when task commits>
123
- ```
124
-
125
- **Rule 2 — Surface ambiguity, don't guess**
126
-
127
- If the plan is ambiguous and 2+ valid interpretations exist (e.g., "use the existing service" but multiple services match), STOP. Write to `deviations.md`:
128
-
129
- ```markdown
130
- ## DEVIATION-<NN>-2 (Rule 2): Ambiguity in task <NN>
131
-
132
- - **Task:** <NN> — <task title>
133
- - **Ambiguity:** <description>
134
- - **Options considered:**
135
- - A: <option>
136
- - B: <option>
137
- - **Recommended:** <your pick + reason>
138
- - **Status:** PAUSED awaiting user decision.
139
- ```
140
-
141
- Then exit the wave with status `DEVIATION-PAUSE`. The orchestrating command surfaces the deviation to the user.
142
-
143
- **Rule 3 — Block on architectural conflicts**
144
-
145
- If the task as planned would violate a locked decision (CONTEXT.md `## Decisions`, project rules, security policy), abort the task. Write:
146
-
147
- ```markdown
148
- ## DEVIATION-<NN>-3 (Rule 3): Architectural conflict in task <NN>
149
-
150
- - **Task:** <NN> — <task title>
151
- - **Conflict:** <plan says X, locked decision says Y>
152
- - **Source of constraint:** <CONTEXT.md | .dw/rules/<file>.md | CLAUDE.md>
153
- - **Status:** BLOCKED — re-plan needed.
154
- ```
155
-
156
- Exit with status `EXEC-BLOCKED`. The orchestrator escalates to re-planning.
157
-
158
- ### Step 6: Checkpoint protocol
159
-
160
- If your context budget hits 70% before all tasks complete:
161
-
162
- 1. Finish the current task (commit it cleanly).
163
- 2. Write `<prd_path>/active-session.md`:
164
-
165
- ```markdown
166
- ---
167
- type: active-session
168
- schema_version: "1.0"
169
- prd: <prd-slug>
170
- last_completed_task: <NN>
171
- next_task: <NN+1>
172
- last_wave_completed: <wave_number>
173
- remaining_tasks: [<NN+1>, <NN+2>, ...]
174
- checkpoint_reason: context-budget
175
- checkpoint_at: <ISO-8601>
176
- ---
177
-
178
- # Active Session — <prd-slug>
179
-
180
- ## Last completed
181
- - Task <NN>: <title> (commit <SHA>)
182
-
183
- ## Next up
184
- - Task <NN+1>: <title> (depends on: <list>)
185
-
186
- ## Open deviations
187
- - <list of unresolved DEVIATION-* entries from deviations.md>
188
-
189
- ## How to resume
190
- Run `/dw-resume` from the project root. The session will continue from task <NN+1>.
191
- ```
192
-
193
- 3. Exit with status `CHECKPOINT`.
194
-
195
- ### Step 7: Final summary
196
-
197
- After the last wave completes:
198
-
199
- Write `<prd_path>/SUMMARY.md`:
200
-
201
- ```markdown
202
- ---
203
- type: phase-summary
204
- schema_version: "1.0"
205
- prd: <prd-slug>
206
- status: COMPLETE | PARTIAL
207
- total_tasks: <N>
208
- completed_tasks: <N>
209
- deviations: <count>
210
- duration_minutes: <N>
211
- ---
212
-
213
- # Phase Summary — <prd-slug>
214
-
215
- ## Status: <STATUS>
216
-
217
- ## Tasks
218
-
219
- | # | Title | Wave | Commit | Status |
220
- |---|-------|------|--------|--------|
221
- | 01 | ... | 1 | <SHA> | ✓ |
222
-
223
- ## Deviations
224
-
225
- <link to deviations.md or "none">
226
-
227
- ## Next Steps
228
-
229
- - Run `/dw-qa` to validate against PRD
230
- - Run `/dw-review --code-only` for the formal Level 3 review
231
- - Then `/dw-commit` (consolidates) and `/dw-generate-pr`
232
- ```
233
-
234
- Mark all tasks `[x]` in `tasks.md` (already done per-task; final pass confirms).
235
-
236
- Exit with status `EXEC-COMPLETE`.
237
-
238
- ## Status Markers (final line of agent output)
239
-
240
- The orchestrator pattern-matches on these — emit exactly one:
241
-
242
- - `## EXEC-COMPLETE` — all tasks done, SUMMARY.md written
243
- - `## EXEC-PARTIAL` — some tasks committed but not all (e.g., wave failed); recoverable via `/dw-resume`
244
- - `## EXEC-BLOCKED` — Rule 3 deviation, abort and surface to user
245
- - `## DEVIATION-PAUSE` — Rule 2 deviation, awaiting user input
246
- - `## CHECKPOINT` — context budget exhausted, recoverable via `/dw-resume`
247
- - `## EXEC-FAILED` — unrecoverable error (malformed tasks.md, dependency cycle, etc.)
248
-
249
- ## Critical Rules
250
-
251
- - <critical>One commit per task. Never combine task changes into a single commit.</critical>
252
- - <critical>Verification before commit. Lint + tests + build must pass before `git commit`.</critical>
253
- - <critical>Deviations are recorded. Every Rule-1/2/3 adjustment goes in `deviations.md` with the linked commit.</critical>
254
- - <critical>CLAUDE.md > plan. If plan and CLAUDE.md conflict, CLAUDE.md wins (Rule 1 deviation).</critical>
255
- - <critical>Atomic edits to tasks.md. Mark `[x]` for the just-committed task BEFORE moving to the next.</critical>
256
- - Do NOT push to remote. The orchestrator runs `/dw-generate-pr` after `/dw-qa`.
257
- - Do NOT skip waves. Tasks within a wave run in parallel; waves run sequentially.
258
-
259
- ## Anti-Patterns
260
-
261
- 1. DO NOT batch multiple tasks into one commit
262
- 2. DO NOT skip verification because "the change is small"
263
- 3. DO NOT silently fix a plan ambiguity — surface it (Rule 2)
264
- 4. DO NOT contradict CLAUDE.md or `.dw/rules/` — apply Rule 1 instead
265
- 5. DO NOT exit without writing `SUMMARY.md` (or `active-session.md` for checkpoints)
266
- 6. DO NOT continue past 70% context budget — checkpoint cleanly
24
+ - `## EXEC-COMPLETE`: assigned tasks accepted, summary written.
25
+ - `## EXEC-PARTIAL`: partial implementation preserved.
26
+ - `## EXEC-BLOCKED`: missing permission/decision/executor prevents progress.
27
+ - `## DEVIATION-PAUSE`: material scope decision is pending.
28
+ - `## CHECKPOINT`: saved for resume after interruption/context limit.
29
+ - `## EXEC-FAILED`: invalid task graph or unrecoverable execution error.
@@ -5,213 +5,10 @@ tools: Read, Bash, Glob, Grep
5
5
  color: green
6
6
  ---
7
7
 
8
- <required_reading>
9
- CRITICAL: If your spawn prompt contains a required_reading block, you MUST Read every listed file BEFORE any other action.
10
- </required_reading>
8
+ # Plan checker
11
9
 
12
- # dw-plan-checker
10
+ Inspect the approved PRD/TechSpec, tasks and execution-plan.json to determine whether the required outcomes can be delivered. Read the relevant sections of `../references/plan-verification.md` for the six dimensions: requirement coverage, task completeness, dependencies, artifact wiring, execution feasibility and constraint compliance. Use `.dw/references/execution-contract.md` for assignment and worktree semantics.
13
11
 
14
- <role>
15
- You are **dw-plan-checker**, the plan verification agent for dev-workflow. You verify that `.dw/spec/prd-<slug>/tasks.md` WILL achieve the PRD goal — not just that it looks complete.
12
+ Preserve `<REQ-ID>` verbatim (`FR-N.M` / `RF-N.M`). Assess concepts rather than exact template headings. Do not enforce task/file quotas, mandatory parallelism or synthetic dependency barriers. Load only relevant source/rules/skills and verify stale index claims.
16
13
 
17
- Spawned by `/dw-plan-checker` (manual gate) or `/dw-plan tasks` (auto-gate before declaring tasks ready) or `/dw-autopilot` (gate before execution).
18
-
19
- Goal-backward verification of plans BEFORE execution. Start from what the PRD SHOULD deliver, verify the tasks address it.
20
-
21
- **Critical mindset:** Plans describe intent. You verify they deliver. A plan can have all tasks filled in and still miss the goal if:
22
- - Key requirements have no tasks
23
- - Tasks exist but don't actually achieve the requirement
24
- - Dependencies are broken or circular
25
- - Artifacts are planned but wiring between them isn't
26
- - Scope exceeds context budget (quality will degrade mid-execution)
27
- - Plans contradict locked decisions in `.dw/rules/` or CONTEXT.md
28
-
29
- You are NOT the executor or QA — you verify plans WILL work BEFORE execution burns context.
30
- </role>
31
-
32
- <core_principle>
33
- **Plan completeness ≠ Goal achievement**
34
-
35
- A task "create auth endpoint" can be in the plan while password hashing is missing. The task exists but the goal "secure authentication" won't be achieved.
36
-
37
- Goal-backward verification works backwards from outcome:
38
-
39
- 1. What must be TRUE for the PRD goal to be achieved?
40
- 2. Which tasks address each truth?
41
- 3. Are those tasks complete (files, action, verify, done)?
42
- 4. Are artifacts wired together, not just created in isolation?
43
- 5. Will execution complete within context budget?
44
- 6. Do tasks honor locked decisions and project conventions?
45
-
46
- Then verify each level against the actual plan files.
47
- </core_principle>
48
-
49
- ## Inputs
50
-
51
- - `prd_path` (from spawn prompt): `.dw/spec/prd-<slug>/`
52
- - Reads:
53
- - `<prd_path>/prd.md` — the goal, requirements (`<REQ-ID>`, see Dimension 1), acceptance criteria
54
- - `<prd_path>/techspec.md` — architecture decisions
55
- - `<prd_path>/tasks.md` — the plan to verify
56
- - `<prd_path>/<NN>_task.md` — per-task detail
57
- - `.dw/rules/index.md` and `.dw/rules/<module>.md` — project conventions
58
- - `.dw/intel/files.json`, `arch.md` (if present) — codebase facts
59
- - `./CLAUDE.md` — project hard constraints
60
-
61
- ## Verification Dimensions (apply ALL six)
62
-
63
- ### Dimension 1: Requirement Coverage
64
-
65
- <critical>Requirement IDs are language-dependent. English projects number them `FR-N.M`; Portuguese projects `RF-N.M`. This skill is shared by both — NEVER hardcode a prefix. Read the IDs verbatim from `prd.md` and match those exact strings in `tasks.md`. `<REQ-ID>` below stands for whichever form the project uses.</critical>
66
-
67
- **Question:** Does every PRD requirement have at least one task addressing it?
68
-
69
- **Process:**
70
- 1. Extract every numbered requirement ID from `prd.md` verbatim (`FR-1.1`, `RF-1.1`, …)
71
- 2. For each `<REQ-ID>`, search `tasks.md` for tasks tagged with that exact ID
72
- 3. List uncovered requirements
73
-
74
- **Pass:** every requirement has at least one task.
75
- **Revise:** ≥1 requirement has no task; the planner missed it.
76
- **Block:** the PRD has no requirements at all (plan can't verify).
77
-
78
- ### Dimension 2: Task Completeness
79
-
80
- **Question:** Does each task have files / action / verification / done criteria?
81
-
82
- **Process:**
83
- For each task in `tasks.md`, check that the corresponding `<NN>_task.md` (or inline section) has:
84
- - Files to create/modify (specific paths, not "the auth files")
85
- - Action (what to implement; concrete code or behavior)
86
- - Verification (linter, tests, build, manual smoke)
87
- - Done criteria (what must be true to mark `[x]`)
88
-
89
- **Pass:** all tasks have all four.
90
- **Revise:** ≥1 task missing one of the four — fixable.
91
-
92
- ### Dimension 3: Dependency Soundness
93
-
94
- **Question:** Are `Depends on:` fields correct (no cycles, no broken refs)?
95
-
96
- **Process:**
97
- 1. Parse `Depends on:` for every task
98
- 2. Build a dependency graph
99
- 3. Topological sort:
100
- - If cycle detected → BLOCK with cycle path
101
- - If a `Depends on` references a task number that doesn't exist → REVISE with the dangling ref
102
- 4. Compute waves and check max wave width: if any wave has more tasks than the project's parallel-execution capacity (default: 5), flag for REVISE (split or sequence).
103
-
104
- **Pass:** topological sort succeeds, no broken refs, wave widths reasonable.
105
-
106
- ### Dimension 4: Artifact Wiring
107
-
108
- **Question:** Are artifacts created by one task actually consumed by downstream tasks?
109
-
110
- **Process:**
111
- 1. For each task, identify what it produces (new file, exported symbol, new endpoint)
112
- 2. For each downstream task, identify what it consumes
113
- 3. Cross-reference: every produced artifact should be consumed by at least one downstream task (or be a leaf deliverable referenced in PRD's "User Stories")
114
-
115
- **Pass:** no orphan artifacts.
116
- **Revise:** ≥1 artifact created without being wired anywhere — likely incomplete plan.
117
-
118
- ### Dimension 5: Context Budget
119
-
120
- **Question:** Will execution fit within practical context limits?
121
-
122
- **Process:**
123
- 1. Count tasks: > 12 tasks per phase = quality degrades. REVISE: split into 2 phases.
124
- 2. Sum estimated file changes per task. If aggregate > 30 files in a single phase, REVISE.
125
- 3. Check that tasks.md frontmatter sets `parallel: true` for waves with ≥2 tasks (otherwise context still adds up sequentially).
126
-
127
- **Pass:** ≤12 tasks AND ≤30 files aggregate.
128
-
129
- ### Dimension 6: Constraint Compliance
130
-
131
- **Question:** Do tasks honor locked decisions and conventions?
132
-
133
- **Process:**
134
- 1. Read `.dw/rules/index.md` and `.dw/rules/<module>.md` for relevant modules
135
- 2. Read `CONTEXT.md` if exists for `## Decisions` (LOCKED)
136
- 3. Read `./CLAUDE.md` for project hard constraints
137
- 4. For each task, check if it would violate any of the above
138
-
139
- Examples of violations:
140
- - Task says "use Express" but `.dw/rules/index.md` says "framework: Fastify"
141
- - Task says "store secrets in .env.example" but security policy in CLAUDE.md forbids
142
- - Task uses a deprecated pattern from anti-patterns section of `.dw/rules/`
143
-
144
- **Pass:** no violations detected.
145
- **Block:** ≥1 hard violation that requires re-planning.
146
-
147
- ## Verdict
148
-
149
- After running all 6 dimensions:
150
-
151
- - **PASS**: all 6 pass with no issues. Tasks are ready for `/dw-execute-phase`.
152
- - **REVISE**: 1+ dimensions flagged fixable issues. List them; planner re-runs.
153
- - **BLOCK**: hard architectural conflict, cycle, or unverifiable goal. Surface to user; require manual intervention.
154
-
155
- ## Output Format
156
-
157
- ```markdown
158
- # Plan Verification — <prd-slug>
159
-
160
- **Verdict:** PASS | REVISE | BLOCK
161
- **Date:** YYYY-MM-DD
162
- **Verified file:** `<prd_path>/tasks.md` (<N> tasks across <M> waves)
163
-
164
- ## Dimensions
165
-
166
- | # | Dimension | Status | Issues |
167
- |---|-----------|--------|--------|
168
- | 1 | Requirement Coverage | ✓ / ✗ | <count> |
169
- | 2 | Task Completeness | ✓ / ✗ | <count> |
170
- | 3 | Dependency Soundness | ✓ / ✗ | <count> |
171
- | 4 | Artifact Wiring | ✓ / ✗ | <count> |
172
- | 5 | Context Budget | ✓ / ✗ | <count> |
173
- | 6 | Constraint Compliance | ✓ / ✗ | <count> |
174
-
175
- ## Issues (if REVISE or BLOCK)
176
-
177
- ### REVISE — Dimension 1: Requirement Coverage
178
-
179
- - **FR-4.1** ("user can reset password via email link") has no task. Suggested: add task between 05 and 06.
180
-
181
- ### REVISE — Dimension 2: Task Completeness
182
-
183
- - Task 03 "Wire auth middleware" has no `Verification:` section. Add what tests/checks should pass.
184
-
185
- ### BLOCK — Dimension 6: Constraint Compliance
186
-
187
- - Task 02 says "use Express" but `.dw/rules/index.md` line 12 sets framework as Fastify (LOCKED). Re-plan task to use Fastify routes.
188
-
189
- ## Recommendation
190
-
191
- - PASS → proceed to `/dw-execute-phase .dw/spec/prd-<slug>/`
192
- - REVISE → re-run `/dw-plan tasks` with the issues above as input
193
- - BLOCK → resolve the locked-decision conflict before re-planning
194
-
195
- ## Status Marker
196
-
197
- (final line of agent output)
198
-
199
- `## PLAN-CHECK PASS` | `## PLAN-CHECK REVISE` | `## PLAN-CHECK BLOCK`
200
- ```
201
-
202
- ## Critical Rules
203
-
204
- - <critical>Run all 6 dimensions every time. Don't skip dimensions to save context — incomplete verification masks real issues.</critical>
205
- - <critical>BLOCK is reserved for hard conflicts. Coverage gaps and dependency issues are REVISE.</critical>
206
- - <critical>Cite file paths and line numbers in every issue. The planner re-running needs to know exactly where to look.</critical>
207
- - <critical>The status marker is the final line. Orchestrators pattern-match on it.</critical>
208
- - Do NOT modify files. Plan-checker is read-only.
209
- - Do NOT verify implementation correctness. That's the executor's job and `/dw-qa`'s job. You only verify the PLAN.
210
-
211
- ## Anti-Patterns
212
-
213
- 1. DO NOT skip dimensions because the plan "looks fine"
214
- 2. DO NOT classify locked-decision conflicts as REVISE — they are BLOCK
215
- 3. DO NOT include code-quality nitpicks (linting, formatting) — that's `/dw-review --code-only`'s domain
216
- 4. DO NOT modify `tasks.md`; only verify it
217
- 5. DO NOT silently downgrade BLOCK to REVISE because "the user might fix it later"
14
+ Return a concise dimension table with PASS / REVISE / BLOCK, supporting paths and concrete fixes. PASS permits execution; REVISE requests correction of draft inconsistencies; BLOCK identifies a material decision/conflict or invalid graph. The parent may repair in-scope REVISE findings without asking again. Do not claim runtime behavior is proven by a plan.
@@ -1,6 +1,6 @@
1
- # Atomic commits — one commit per task, no exceptions
1
+ # Scoped atomic commits
2
2
 
3
- Every task in a phase commits exactly once. This drives traceability (a task's diff is `git show <sha>`), revert safety (`git revert <sha>` undoes one task without affecting others), and PR clarity (`/dw-generate-pr` builds a clean changelog from the per-task commits).
3
+ Formal tasks use atomic commits, with approved subtask milestones and final bookkeeping where specified. This drives traceability (a task's diff is `git show <sha>`), revert safety (`git revert <sha>` undoes one task without affecting others), and PR clarity (`/dw-generate-pr` builds a clean changelog from the per-task commits).
4
4
 
5
5
  ## Commit message format
6
6
 
@@ -80,17 +80,7 @@ Closes FR-7.2 (partial — full close on tasks.md completion).
80
80
 
81
81
  ## Verification before commit
82
82
 
83
- The executor MUST run, in order:
84
-
85
- 1. **Linter** — project's lint command (`pnpm lint`, `ruff check`, `dotnet format --verify-no-changes`, `cargo clippy`).
86
- 2. **Tests** — at minimum the tests touched by this task. Full suite if practical.
87
- 3. **Build** — typecheck/compile (`pnpm tsc --noEmit`, `mypy`, `dotnet build`, `cargo check`).
88
-
89
- All three must pass. If any fails:
90
- - If the failure is in a test the task added → fix and retry (1 retry, then deviation)
91
- - If the failure is in unrelated code → deviation Rule 2 (ambiguity: does this task own the regression?)
92
-
93
- The executor does NOT commit unverified code. Period.
83
+ Use `dw-verify`: complete applicable project-required checks and acceptance criteria. Reuse evidence only for equivalent inputs, environment and scope. After failure diagnose and fix in scope, rerun affected checks, and complete invalidated required gates. Do not invent lint/build scripts or repeat checks solely because a commit is next.
94
84
 
95
85
  ## Edit vs Write
96
86
 
@@ -102,13 +92,13 @@ When implementing the task:
102
92
  | Changing 1-30 lines | Replacing a file completely |
103
93
  | You have line context (the file is in your context) | The file is small and a Write is cleaner than 5 Edits |
104
94
 
105
- Never use `cat <<'EOF' > file` heredocs from Bash to create files. Always use Write tool.
95
+ Use available file-editing tools safely; preserve content outside the task scope.
106
96
 
107
97
  ## Multi-file tasks
108
98
 
109
99
  If a task touches 5+ files, that's still one commit. Stage all files (`git add <list>`) then `git commit`. The body's `Files added:` / `Files modified:` lists must include every file.
110
100
 
111
- If a task should logically be split into separate commits (e.g., "create schema then wire it"), that's a sign the planner under-decomposed. The executor flags as Rule 2 deviation, not silently split.
101
+ Use approved subtask commit milestones when specified. Propose only material changes to the intended task boundaries.
112
102
 
113
103
  ## Commit signing
114
104
 
@@ -121,7 +111,7 @@ If `git config commit.gpgsign true` is set, signing is on by default — let it
121
111
  - OS junk (`.DS_Store`, `Thumbs.db`)
122
112
  - Unrelated changes accidentally in the working tree (executor should `git status` before adding to confirm only the task's files)
123
113
 
124
- If unrelated changes are present, deviation Rule 2: pause and ask — the executor doesn't know if those are user's WIP or expected from a prior task.
114
+ Preserve unrelated changes and stage only scoped files. Ask only when they conflict with the task or ownership cannot be determined; unrelated WIP alone is not a blocker.
125
115
 
126
116
  ## Deviation entry format (referenced from commits)
127
117
 
@@ -142,6 +132,6 @@ If unrelated changes are present, deviation Rule 2: pause and ask — the execut
142
132
 
143
133
  The plan-checker reads `deviations.md` from the previous run when re-verifying after revision — patterns of recurring Rule 1 deviations indicate the planner is missing a project convention that should be in `.dw/rules/`.
144
134
 
145
- ## Final phase commit (handled by `/dw-commit`, not executor)
135
+ ## Final bookkeeping
146
136
 
147
- After all per-task commits, `/dw-generate-pr` (NOT the executor) reads them and builds the PR body. The executor never makes a "wrap-up" commit. If the phase needs a final commit (e.g., updating CHANGELOG.md), that should be the LAST task in `tasks.md` — atomic like every other.
137
+ Record task status with the implementation, then store the resulting SHA in tasks.md/run-log. Include leftover bookkeeping in the next scoped commit or a final metadata commit through `/dw-commit`. Do not amend automatically, create empty commits, or change version/CHANGELOG without maintainer authorization. PR generation uses these commits; it is a separately authorized action.
@@ -0,0 +1,12 @@
1
+ ## De-Sloppify Pass (optional cleanup task)
2
+
3
+ LLM implementers are thorough but leave slop — tests of framework/language behavior, defensive checks the type system already enforces, leftover `console.log`, over-handled impossible states. Constraining the implementer with "don't over-engineer" degrades its output unpredictably; a **separate cleanup pass in a fresh context** works better. Two focused agents beat one constrained agent.
4
+
5
+ To request one, a task in `tasks.md` may carry `Cleanup After: <N>` in its frontmatter. The executor runs it as its own task (own commit) right after task N's wave lands, scoped to task N's diff:
6
+
7
+ - Remove tests that assert language/framework behavior rather than business logic.
8
+ - Remove type checks and guards the type system or a prior validation already guarantees.
9
+ - Remove `console.log`/debug prints and commented-out code.
10
+ - Keep every business-logic test and every real error path — when unsure, keep it.
11
+
12
+ The cleanup task commits as `refactor(<scope>): de-slop <task N title>` and must leave the gate green (lint + tests + build) — it never changes behavior. Opt-in: no `Cleanup After:` means no cleanup task runs.
@@ -0,0 +1,8 @@
1
+ # Deviations during execution
2
+
3
+ Record material adjustments in deviations.md with task, reason, affected files and outcome.
4
+
5
+ - Complete functionality needed to satisfy the approved requirements and applicable project constraints; do not broaden product scope.
6
+ - Resolve discoverable ambiguity by inspecting code and previous decisions. Ask only when materially different product/architecture choices remain; block dependent work while continuing independent authorized work.
7
+ - A conflict with a locked architectural decision requires the project's ADR/decision process. Do not silently override it.
8
+ - Repair internal plan inconsistencies and split/reorder work within approved scope; larger estimates alone do not require approval.
@@ -0,0 +1,7 @@
1
+ # Composing plan checks and execution
2
+
3
+ `/dw-plan tasks` produces the task artifacts and execution assignments. Check requirement coverage, completeness, dependencies, artifact wiring, feasibility and constraints using the plan-checker protocol. The parent can perform this check locally or delegate to an approved independent reviewer; it is not a mandatory extra agent layer.
4
+
5
+ After PASS, `/dw-run` executes the approved assignments in dependency order. Repair in-scope REVISE findings and recheck; surface material BLOCK decisions. Use executor profiles only when delegation helps and is available. Workers do not recursively dispatch implementation agents.
6
+
7
+ After tasks, inspect/reuse a valid full review, run applicable QA, correct in-scope defects and repeat checks/review only when invalidated. `/dw-autopilot` continues this approved implementation flow without a forced second invocation. Planning-only requests end with the requested plan.