@brunosps00/dev-workflow 2.1.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 (129) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +118 -0
  3. package/README.md +17 -6
  4. package/lib/constants.js +24 -20
  5. package/lib/init.js +34 -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 -135
  12. package/scaffold/en/commands/dw-analyze-project.md +2 -0
  13. package/scaffold/en/commands/dw-autopilot.md +22 -243
  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-harness-audit.md +2 -0
  22. package/scaffold/en/commands/dw-help.md +8 -4
  23. package/scaffold/en/commands/dw-pause.md +1 -0
  24. package/scaffold/en/commands/dw-plan.md +14 -7
  25. package/scaffold/en/commands/dw-qa.md +2 -0
  26. package/scaffold/en/commands/dw-report.md +169 -0
  27. package/scaffold/en/commands/dw-resume.md +5 -11
  28. package/scaffold/en/commands/dw-review.md +4 -3
  29. package/scaffold/en/commands/dw-run.md +19 -165
  30. package/scaffold/en/commands/dw-skill-health.md +7 -0
  31. package/scaffold/en/commands/dw-update.md +18 -4
  32. package/scaffold/en/commands/dw-worktree.md +100 -0
  33. package/scaffold/en/references/command-routing.md +53 -0
  34. package/scaffold/en/references/execution-contract.md +55 -0
  35. package/scaffold/en/templates/frontend-quality-template.md +43 -0
  36. package/scaffold/en/templates/task-template.md +20 -40
  37. package/scaffold/en/templates/tasks-template.md +9 -6
  38. package/scaffold/en/templates/techspec-template.md +4 -0
  39. package/scaffold/pt-br/agent-instructions.md +31 -135
  40. package/scaffold/pt-br/commands/dw-analyze-project.md +2 -0
  41. package/scaffold/pt-br/commands/dw-autopilot.md +22 -243
  42. package/scaffold/pt-br/commands/dw-bugfix.md +9 -35
  43. package/scaffold/pt-br/commands/dw-claude-run.md +29 -46
  44. package/scaffold/pt-br/commands/dw-codex-run.md +30 -45
  45. package/scaffold/pt-br/commands/dw-context-budget.md +6 -14
  46. package/scaffold/pt-br/commands/dw-copilot-run.md +29 -43
  47. package/scaffold/pt-br/commands/dw-generate-pr.md +2 -2
  48. package/scaffold/pt-br/commands/dw-goal.md +11 -5
  49. package/scaffold/pt-br/commands/dw-harness-audit.md +2 -0
  50. package/scaffold/pt-br/commands/dw-help.md +8 -4
  51. package/scaffold/pt-br/commands/dw-pause.md +1 -0
  52. package/scaffold/pt-br/commands/dw-plan.md +14 -7
  53. package/scaffold/pt-br/commands/dw-qa.md +2 -0
  54. package/scaffold/pt-br/commands/dw-report.md +169 -0
  55. package/scaffold/pt-br/commands/dw-resume.md +7 -11
  56. package/scaffold/pt-br/commands/dw-review.md +4 -3
  57. package/scaffold/pt-br/commands/dw-run.md +19 -165
  58. package/scaffold/pt-br/commands/dw-skill-health.md +7 -0
  59. package/scaffold/pt-br/commands/dw-update.md +18 -4
  60. package/scaffold/pt-br/commands/dw-worktree.md +100 -0
  61. package/scaffold/pt-br/references/command-routing.md +53 -0
  62. package/scaffold/pt-br/references/execution-contract.md +55 -0
  63. package/scaffold/pt-br/templates/frontend-quality-template.md +43 -0
  64. package/scaffold/pt-br/templates/task-template.md +20 -40
  65. package/scaffold/pt-br/templates/tasks-template.md +9 -6
  66. package/scaffold/pt-br/templates/techspec-template.md +4 -0
  67. package/scaffold/scripts/hooks/git-guardrails.mjs +1 -0
  68. package/scaffold/scripts/lib/workflow-contract.mjs +101 -0
  69. package/scaffold/scripts/lib/worktree-gc.mjs +460 -0
  70. package/scaffold/skill-registry.json +23 -23
  71. package/scaffold/skills/dw-cli-run/SKILL.md +33 -208
  72. package/scaffold/skills/dw-cli-run/references/dispatch-tuning.md +14 -72
  73. package/scaffold/skills/dw-codebase-intel/SKILL.md +5 -39
  74. package/scaffold/skills/dw-codebase-intel/agents/intel-updater.md +1 -1
  75. package/scaffold/skills/dw-codebase-intel/references/agents-detail.md +7 -0
  76. package/scaffold/skills/dw-codebase-intel/references/files-in-dw-intel-detail.md +16 -0
  77. package/scaffold/skills/dw-codebase-intel/references/how-dw-intel-reads-this-detail.md +12 -0
  78. package/scaffold/skills/dw-codebase-intel/references/how-to-compose-the-typical-flow-detail.md +11 -0
  79. package/scaffold/skills/dw-council/SKILL.md +2 -17
  80. package/scaffold/skills/dw-council/references/integration-with-other-dw-commands-detail.md +7 -0
  81. package/scaffold/skills/dw-council/references/phase-2-tensions-and-rebuttals-detail.md +15 -0
  82. package/scaffold/skills/dw-domain-modeling/SKILL.md +1 -1
  83. package/scaffold/skills/dw-execute-phase/SKILL.md +12 -32
  84. package/scaffold/skills/dw-execute-phase/agents/executor.md +15 -252
  85. package/scaffold/skills/dw-execute-phase/agents/plan-checker.md +4 -207
  86. package/scaffold/skills/dw-execute-phase/references/atomic-commits.md +8 -18
  87. package/scaffold/skills/dw-execute-phase/references/de-sloppify-pass-optional-cleanup-task-detail.md +12 -0
  88. package/scaffold/skills/dw-execute-phase/references/deviation-rules-during-execution-detail.md +8 -0
  89. package/scaffold/skills/dw-execute-phase/references/how-the-two-agents-compose-detail.md +7 -0
  90. package/scaffold/skills/dw-execute-phase/references/plan-verification.md +9 -155
  91. package/scaffold/skills/dw-execute-phase/references/wave-coordination.md +6 -97
  92. package/scaffold/skills/dw-git-discipline/SKILL.md +2 -2
  93. package/scaffold/skills/dw-grilling/SKILL.md +1 -1
  94. package/scaffold/skills/dw-incident-response/SKILL.md +1 -64
  95. package/scaffold/skills/dw-incident-response/references/the-five-phases-detail.md +66 -0
  96. package/scaffold/skills/dw-llm-eval/SKILL.md +5 -53
  97. package/scaffold/skills/dw-llm-eval/references/agent-tool-use-evaluation-detail.md +23 -0
  98. package/scaffold/skills/dw-llm-eval/references/anti-patterns-will-block-in-dw-review-code-only-detail.md +9 -0
  99. package/scaffold/skills/dw-llm-eval/references/consistency-run-to-run-stability-detail.md +10 -0
  100. package/scaffold/skills/dw-llm-eval/references/integration-with-dev-workflow-commands-detail.md +6 -0
  101. package/scaffold/skills/dw-llm-eval/references/the-oracle-ladder-detail.md +15 -0
  102. package/scaffold/skills/dw-memory/SKILL.md +4 -50
  103. package/scaffold/skills/dw-memory/references/context-budget.md +8 -56
  104. package/scaffold/skills/dw-memory/references/promotion-decision-test-detail.md +30 -0
  105. package/scaffold/skills/dw-minimalism/SKILL.md +4 -5
  106. package/scaffold/skills/dw-review-rigor/SKILL.md +1 -54
  107. package/scaffold/skills/dw-review-rigor/references/the-five-rules-detail.md +56 -0
  108. package/scaffold/skills/dw-simplification/SKILL.md +2 -55
  109. package/scaffold/skills/dw-simplification/references/pattern-recognition-detail.md +11 -0
  110. package/scaffold/skills/dw-simplification/references/the-five-rules-detail.md +48 -0
  111. package/scaffold/skills/dw-source-grounding/SKILL.md +1 -56
  112. package/scaffold/skills/dw-source-grounding/references/the-protocol-detect-fetch-implement-cite-detail.md +58 -0
  113. package/scaffold/skills/dw-testing-discipline/SKILL.md +25 -177
  114. package/scaffold/skills/dw-testing-discipline/references/agent-guardrails.md +9 -167
  115. package/scaffold/skills/dw-testing-discipline/references/core-rules.md +3 -3
  116. package/scaffold/skills/dw-testing-discipline/references/mutation-testing.md +19 -0
  117. package/scaffold/skills/dw-testing-discipline/references/patterns.md +3 -12
  118. package/scaffold/skills/dw-ui-discipline/SKILL.md +2 -59
  119. package/scaffold/skills/dw-ui-discipline/references/frontend-engineering.md +46 -0
  120. package/scaffold/skills/dw-ui-discipline/references/the-four-grounding-questions-detail.md +61 -0
  121. package/scaffold/skills/dw-verify/SKILL.md +26 -148
  122. package/scaffold/skills/dw-verify/references/verification-discovery-and-attribution.md +2 -2
  123. package/scaffold/skills/humanizer/SKILL.md +2 -1
  124. package/scaffold/skills/security-review/SKILL.md +3 -183
  125. package/scaffold/skills/security-review/references/do-not-flag-detail.md +49 -0
  126. package/scaffold/skills/security-review/references/quick-patterns-reference-detail.md +56 -0
  127. package/scaffold/skills/security-review/references/review-process-detail.md +84 -0
  128. package/scaffold/skills/vercel-react-best-practices/SKILL.md +1 -90
  129. package/scaffold/skills/vercel-react-best-practices/references/quick-reference-detail.md +92 -0
@@ -26,7 +26,7 @@ Read this skill when:
26
26
 
27
27
  - `/dw-execute-phase` is invoked to run a batch of tasks in parallel waves.
28
28
  - `/dw-plan-checker` is invoked to verify a `tasks.md` file will achieve its PRD goal before execution.
29
- - `/dw-run` is invoked (it spawns the executor agent for each wave).
29
+ - `/dw-run` needs dependency or plan verification for approved tasks.
30
30
  - `/dw-autopilot` enters the execution stage (it gates on plan-checker before invoking the executor).
31
31
 
32
32
  Do NOT use when:
@@ -35,6 +35,8 @@ Do NOT use when:
35
35
  - The user is exploring/brainstorming, not executing (use `/dw-brainstorm`).
36
36
  - The plan hasn't been created yet (use `/dw-plan tasks` first).
37
37
 
38
+ Read `.dw/references/execution-contract.md` for approved tool/model/agent assignments and durable state. Agent profiles below are available protocols, not mandatory additional dispatches.
39
+
38
40
  ## Agents
39
41
 
40
42
  | Agent | Responsibility | Spawn from |
@@ -44,40 +46,27 @@ Do NOT use when:
44
46
 
45
47
  ## How the Two Agents Compose
46
48
 
47
- The expected flow:
48
-
49
- 1. `/dw-plan tasks` produces `.dw/spec/prd-<slug>/tasks.md` from PRD + TechSpec.
50
- 2. **Plan-checker GATE** — `/dw-plan-checker .dw/spec/prd-<slug>/` spawns the plan-checker agent. The agent reads PRD/TechSpec/tasks.md and verifies tasks WILL achieve the goal. Returns one of: `PASS` (proceed), `REVISE` (issues found, planner re-runs), `BLOCK` (fundamental gap, abort).
51
- 3. `/dw-execute-phase` spawns the executor agent ONLY if plan-checker returned `PASS`. The executor runs tasks in waves, commits atomically, handles deviations.
52
- 4. `/dw-qa` runs after all waves complete to validate the implementation against PRD.
53
-
54
- `/dw-autopilot` orchestrates this entire flow with hard gates between stages.
49
+ For how the two agents compose, read `references/how-the-two-agents-compose-detail.md`. Load only when this part of the task applies.
55
50
 
56
51
  ## Wave Concept
57
52
 
58
53
  Tasks in `tasks.md` are grouped into **waves** by their `Depends on:` frontmatter:
59
54
 
60
- - Wave 1: tasks with no dependencies → run in parallel
55
+ - Wave 1: tasks with no dependencies → ready to run
61
56
  - Wave 2: tasks that depend on Wave 1 → run after Wave 1 commits land
62
57
  - Wave N: ...
63
58
 
64
- Within a wave, tasks run in parallel via subagent dispatch. Across waves, sequential.
59
+ Within a wave, concurrency is optional and follows approved assignments. One writer per worktree, at most 3 workers; dependent tasks share the execution branch sequentially.
65
60
 
66
61
  The executor calculates waves automatically by topologically sorting task dependencies. See `references/wave-coordination.md`.
67
62
 
68
63
  ## Deviation Rules (during execution)
69
64
 
70
- Mid-task, the executor may discover the plan is incomplete or contradicted by reality. Three rules:
71
-
72
- 1. **Auto-add missing critical functionality** — if a task says "create endpoint" but no validation is specified and the project's CLAUDE.md/rules require it, add the validation as part of the same task. Note in the task's commit message.
73
- 2. **Surface ambiguity, don't guess** — if the plan says "use the existing service" and 3 services match, STOP, write a deviation entry to `.dw/spec/prd-<slug>/deviations.md`, and ask the user.
74
- 3. **Block on architectural conflicts** — if the task as planned would violate a locked decision in CONTEXT.md / project rules, abort the task and surface the conflict for re-planning.
75
-
76
- Detail in `references/atomic-commits.md` (deviation entry format) and `references/plan-verification.md` (what plan-checker should catch BEFORE execution to prevent deviations).
65
+ For deviation rules (during execution), read `references/deviation-rules-during-execution-detail.md`. Load only when this part of the task applies.
77
66
 
78
67
  ## Atomic Commit Protocol
79
68
 
80
- Every task ends with exactly one git commit:
69
+ Formal tasks use scoped atomic commits, with approved subtask milestones when specified:
81
70
 
82
71
  ```
83
72
  feat(<scope>): <task title> (#<task-id>)
@@ -98,16 +87,7 @@ The commit message format is consistent across waves so `/dw-generate-pr` can bu
98
87
 
99
88
  ## De-Sloppify Pass (optional cleanup task)
100
89
 
101
- 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.
102
-
103
- 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:
104
-
105
- - Remove tests that assert language/framework behavior rather than business logic.
106
- - Remove type checks and guards the type system or a prior validation already guarantees.
107
- - Remove `console.log`/debug prints and commented-out code.
108
- - Keep every business-logic test and every real error path — when unsure, keep it.
109
-
110
- 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.
90
+ For de-sloppify pass (optional cleanup task), read `references/de-sloppify-pass-optional-cleanup-task-detail.md`. Load only when this part of the task applies.
111
91
 
112
92
  ## Checkpoint Protocol
113
93
 
@@ -137,11 +117,11 @@ If the executor exhausts its context budget mid-phase OR the user signals stop:
137
117
 
138
118
  ## Rules
139
119
 
140
- - **No execution without plan-checker PASS.** `/dw-execute-phase` and `/dw-run` must call plan-checker first; if it returns REVISE or BLOCK, abort.
141
- - **One commit per task, no exceptions.** Even trivial tasks commit. This drives traceability and revert safety.
120
+ - **No execution without plan-checker PASS.** `/dw-execute-phase` and `/dw-run` must call plan-checker first; repair internal REVISE findings; BLOCK only when a material decision or invalid dependency remains.
121
+ - **Scoped atomic commits for formal tasks.** Follow approved subtask milestones when specified; direct small edits do not invoke this protocol. This drives traceability and revert safety.
142
122
  - **Deviations are recorded, not silenced.** Every adjustment beyond the plan goes in `deviations.md` with reason.
143
123
  - **Checkpoint > timeout.** When context budget is low, checkpoint cleanly rather than running tasks half-way.
144
- - **Wave order is topological, not user-defined.** The executor computes wave boundaries from `Depends on:` fields; users can't override.
124
+ - **Wave order is topological, not user-defined.** The executor computes wave boundaries from `Depends on:` fields; concurrency limits queue ready tasks without inventing dependencies.
145
125
 
146
126
  ## Inspired by
147
127
 
@@ -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.