@brunosps00/dev-workflow 2.2.0 → 2.4.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 (154) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +121 -0
  3. package/README.md +25 -15
  4. package/lib/constants.js +39 -36
  5. package/lib/doctor.js +1 -1
  6. package/lib/init.js +8 -0
  7. package/lib/instruction-health.js +38 -0
  8. package/lib/post-update.js +2 -1
  9. package/lib/validate.js +3 -1
  10. package/package.json +1 -1
  11. package/scaffold/agent-registry.json +17 -1
  12. package/scaffold/agents/core/dw-finding-refuter.md +55 -0
  13. package/scaffold/config/routing.json +61 -23
  14. package/scaffold/en/agent-instructions.md +32 -137
  15. package/scaffold/en/commands/dw-analyze-project.md +2 -0
  16. package/scaffold/en/commands/dw-autopilot.md +36 -241
  17. package/scaffold/en/commands/dw-brainstorm.md +1 -1
  18. package/scaffold/en/commands/dw-bugfix.md +10 -35
  19. package/scaffold/en/commands/dw-claude-run.md +47 -45
  20. package/scaffold/en/commands/dw-codex-run.md +48 -45
  21. package/scaffold/en/commands/dw-context-budget.md +6 -14
  22. package/scaffold/en/commands/dw-copilot-run.md +47 -41
  23. package/scaffold/en/commands/dw-find-skills.md +3 -1
  24. package/scaffold/en/commands/dw-generate-pr.md +2 -2
  25. package/scaffold/en/commands/dw-goal.md +25 -5
  26. package/scaffold/en/commands/dw-help.md +3 -3
  27. package/scaffold/en/commands/dw-install-aws-skills.md +2 -0
  28. package/scaffold/en/commands/dw-install-azure-skills.md +2 -0
  29. package/scaffold/en/commands/dw-plan.md +15 -8
  30. package/scaffold/en/commands/dw-qa.md +3 -0
  31. package/scaffold/en/commands/dw-resume.md +5 -11
  32. package/scaffold/en/commands/dw-review.md +154 -10
  33. package/scaffold/en/commands/dw-run.md +47 -177
  34. package/scaffold/en/commands/dw-secure-audit.md +4 -0
  35. package/scaffold/en/commands/dw-skill-health.md +39 -0
  36. package/scaffold/en/commands/dw-triage.md +8 -0
  37. package/scaffold/en/commands/dw-update.md +18 -4
  38. package/scaffold/en/references/automode.md +71 -0
  39. package/scaffold/en/references/command-routing.md +54 -0
  40. package/scaffold/en/references/execution-contract.md +55 -0
  41. package/scaffold/en/references/invariants.md +88 -0
  42. package/scaffold/en/references/untrusted-input.md +69 -0
  43. package/scaffold/en/templates/constitution-template.md +1 -0
  44. package/scaffold/en/templates/frontend-quality-template.md +43 -0
  45. package/scaffold/en/templates/task-template.md +20 -40
  46. package/scaffold/en/templates/tasks-template.md +9 -6
  47. package/scaffold/en/templates/techspec-template.md +4 -0
  48. package/scaffold/en/templates/triage-record-template.md +5 -0
  49. package/scaffold/pt-br/agent-instructions.md +32 -137
  50. package/scaffold/pt-br/commands/dw-analyze-project.md +3 -1
  51. package/scaffold/pt-br/commands/dw-autopilot.md +36 -241
  52. package/scaffold/pt-br/commands/dw-brainstorm.md +1 -1
  53. package/scaffold/pt-br/commands/dw-bugfix.md +10 -35
  54. package/scaffold/pt-br/commands/dw-claude-run.md +47 -46
  55. package/scaffold/pt-br/commands/dw-codex-run.md +48 -45
  56. package/scaffold/pt-br/commands/dw-context-budget.md +6 -14
  57. package/scaffold/pt-br/commands/dw-copilot-run.md +47 -43
  58. package/scaffold/pt-br/commands/dw-find-skills.md +3 -1
  59. package/scaffold/pt-br/commands/dw-generate-pr.md +2 -2
  60. package/scaffold/pt-br/commands/dw-goal.md +25 -5
  61. package/scaffold/pt-br/commands/dw-help.md +3 -3
  62. package/scaffold/pt-br/commands/dw-install-aws-skills.md +2 -0
  63. package/scaffold/pt-br/commands/dw-install-azure-skills.md +2 -0
  64. package/scaffold/pt-br/commands/dw-plan.md +15 -8
  65. package/scaffold/pt-br/commands/dw-qa.md +3 -0
  66. package/scaffold/pt-br/commands/dw-resume.md +7 -11
  67. package/scaffold/pt-br/commands/dw-review.md +154 -10
  68. package/scaffold/pt-br/commands/dw-run.md +47 -177
  69. package/scaffold/pt-br/commands/dw-secure-audit.md +5 -1
  70. package/scaffold/pt-br/commands/dw-skill-health.md +39 -0
  71. package/scaffold/pt-br/commands/dw-triage.md +8 -0
  72. package/scaffold/pt-br/commands/dw-update.md +18 -4
  73. package/scaffold/pt-br/references/automode.md +72 -0
  74. package/scaffold/pt-br/references/command-routing.md +54 -0
  75. package/scaffold/pt-br/references/execution-contract.md +55 -0
  76. package/scaffold/pt-br/references/invariants.md +88 -0
  77. package/scaffold/pt-br/references/untrusted-input.md +70 -0
  78. package/scaffold/pt-br/templates/constitution-template.md +1 -0
  79. package/scaffold/pt-br/templates/frontend-quality-template.md +43 -0
  80. package/scaffold/pt-br/templates/task-template.md +20 -40
  81. package/scaffold/pt-br/templates/tasks-template.md +9 -6
  82. package/scaffold/pt-br/templates/techspec-template.md +4 -0
  83. package/scaffold/pt-br/templates/triage-record-template.md +5 -0
  84. package/scaffold/scripts/hooks/git-guardrails.mjs +12 -0
  85. package/scaffold/scripts/hooks/session-cost.mjs +122 -7
  86. package/scaffold/scripts/lib/workflow-contract.mjs +101 -0
  87. package/scaffold/skill-registry.json +35 -23
  88. package/scaffold/skills/dw-chaos-engineering/SKILL.md +126 -0
  89. package/scaffold/skills/dw-chaos-engineering/references/vector-catalog.md +43 -0
  90. package/scaffold/skills/dw-cli-run/SKILL.md +39 -215
  91. package/scaffold/skills/dw-cli-run/references/dispatch-tuning.md +14 -72
  92. package/scaffold/skills/dw-codebase-intel/SKILL.md +5 -39
  93. package/scaffold/skills/dw-codebase-intel/agents/intel-updater.md +1 -1
  94. package/scaffold/skills/dw-codebase-intel/references/agents-detail.md +7 -0
  95. package/scaffold/skills/dw-codebase-intel/references/files-in-dw-intel-detail.md +16 -0
  96. package/scaffold/skills/dw-codebase-intel/references/how-dw-intel-reads-this-detail.md +12 -0
  97. package/scaffold/skills/dw-codebase-intel/references/how-to-compose-the-typical-flow-detail.md +11 -0
  98. package/scaffold/skills/dw-council/SKILL.md +2 -17
  99. package/scaffold/skills/dw-council/references/integration-with-other-dw-commands-detail.md +7 -0
  100. package/scaffold/skills/dw-council/references/phase-2-tensions-and-rebuttals-detail.md +15 -0
  101. package/scaffold/skills/dw-debug-protocol/references/six-step-triage.md +1 -0
  102. package/scaffold/skills/dw-domain-modeling/SKILL.md +1 -1
  103. package/scaffold/skills/dw-execute-phase/SKILL.md +12 -32
  104. package/scaffold/skills/dw-execute-phase/agents/executor.md +15 -252
  105. package/scaffold/skills/dw-execute-phase/agents/plan-checker.md +4 -207
  106. package/scaffold/skills/dw-execute-phase/references/atomic-commits.md +8 -18
  107. package/scaffold/skills/dw-execute-phase/references/de-sloppify-pass-optional-cleanup-task-detail.md +12 -0
  108. package/scaffold/skills/dw-execute-phase/references/deviation-rules-during-execution-detail.md +8 -0
  109. package/scaffold/skills/dw-execute-phase/references/how-the-two-agents-compose-detail.md +7 -0
  110. package/scaffold/skills/dw-execute-phase/references/plan-verification.md +9 -155
  111. package/scaffold/skills/dw-execute-phase/references/wave-coordination.md +6 -97
  112. package/scaffold/skills/dw-git-discipline/SKILL.md +2 -2
  113. package/scaffold/skills/dw-grilling/SKILL.md +1 -1
  114. package/scaffold/skills/dw-incident-response/SKILL.md +1 -64
  115. package/scaffold/skills/dw-incident-response/references/the-five-phases-detail.md +66 -0
  116. package/scaffold/skills/dw-llm-eval/SKILL.md +6 -53
  117. package/scaffold/skills/dw-llm-eval/references/agent-tool-use-evaluation-detail.md +23 -0
  118. package/scaffold/skills/dw-llm-eval/references/anti-patterns-will-block-in-dw-review-code-only-detail.md +9 -0
  119. package/scaffold/skills/dw-llm-eval/references/bounded-decisions.md +76 -0
  120. package/scaffold/skills/dw-llm-eval/references/consistency-run-to-run-stability-detail.md +10 -0
  121. package/scaffold/skills/dw-llm-eval/references/integration-with-dev-workflow-commands-detail.md +6 -0
  122. package/scaffold/skills/dw-llm-eval/references/judge-calibration.md +5 -0
  123. package/scaffold/skills/dw-llm-eval/references/the-oracle-ladder-detail.md +15 -0
  124. package/scaffold/skills/dw-memory/SKILL.md +4 -50
  125. package/scaffold/skills/dw-memory/references/context-budget.md +8 -56
  126. package/scaffold/skills/dw-memory/references/promotion-decision-test-detail.md +30 -0
  127. package/scaffold/skills/dw-minimalism/SKILL.md +4 -5
  128. package/scaffold/skills/dw-review-rigor/SKILL.md +31 -88
  129. package/scaffold/skills/dw-review-rigor/references/composition-audit.md +160 -0
  130. package/scaffold/skills/dw-review-rigor/references/refutation-pass.md +124 -0
  131. package/scaffold/skills/dw-review-rigor/references/the-five-rules-detail.md +56 -0
  132. package/scaffold/skills/dw-simplification/SKILL.md +2 -55
  133. package/scaffold/skills/dw-simplification/references/pattern-recognition-detail.md +11 -0
  134. package/scaffold/skills/dw-simplification/references/the-five-rules-detail.md +48 -0
  135. package/scaffold/skills/dw-source-grounding/SKILL.md +21 -56
  136. package/scaffold/skills/dw-source-grounding/references/the-protocol-detect-fetch-implement-cite-detail.md +58 -0
  137. package/scaffold/skills/dw-testing-discipline/SKILL.md +25 -177
  138. package/scaffold/skills/dw-testing-discipline/references/agent-guardrails.md +9 -167
  139. package/scaffold/skills/dw-testing-discipline/references/core-rules.md +3 -3
  140. package/scaffold/skills/dw-testing-discipline/references/mutation-testing.md +19 -0
  141. package/scaffold/skills/dw-testing-discipline/references/patterns.md +3 -12
  142. package/scaffold/skills/dw-ui-discipline/SKILL.md +2 -59
  143. package/scaffold/skills/dw-ui-discipline/references/frontend-engineering.md +46 -0
  144. package/scaffold/skills/dw-ui-discipline/references/the-four-grounding-questions-detail.md +61 -0
  145. package/scaffold/skills/dw-verify/SKILL.md +26 -148
  146. package/scaffold/skills/dw-verify/references/verification-discovery-and-attribution.md +2 -2
  147. package/scaffold/skills/humanizer/SKILL.md +2 -1
  148. package/scaffold/skills/security-review/SKILL.md +6 -184
  149. package/scaffold/skills/security-review/references/do-not-flag-detail.md +49 -0
  150. package/scaffold/skills/security-review/references/modern-threats.md +5 -0
  151. package/scaffold/skills/security-review/references/quick-patterns-reference-detail.md +56 -0
  152. package/scaffold/skills/security-review/references/review-process-detail.md +112 -0
  153. package/scaffold/skills/vercel-react-best-practices/SKILL.md +1 -90
  154. package/scaffold/skills/vercel-react-best-practices/references/quick-reference-detail.md +92 -0
@@ -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.
@@ -1,158 +1,12 @@
1
- # Plan verification — the 6-dimension goal-backward analysis
1
+ # Plan verification — six dimensions
2
2
 
3
- The `dw-plan-checker` agent verifies that a `tasks.md` will achieve the PRD goal BEFORE execution starts. This document details each dimension's checks, examples, and pass/fail criteria.
3
+ Read when validating a planned execution. Verify expected outcomes, not literal headings or arbitrary task/file quotas. Relevant evidence may appear in the task, approved TechSpec sections or execution matrix.
4
4
 
5
- ## Why pre-execution verification
5
+ 1. **Requirement coverage:** extract `<REQ-ID>` verbatim (`FR-N.M` in English, `RF-N.M` in Portuguese). Every required outcome must be addressed by one or more tasks; an existing implementation may satisfy it when explicitly verified.
6
+ 2. **Task completeness:** identify affected surfaces, intended behavior, verification and acceptance criteria. Schema 1.1 uses Implementation, Verification and success criteria, and Relevant files and decisions (or translated headings). These concepts are required; exact header spelling is not. Check the execution assignment and rationale, including concrete external model/effort and approved alternatives.
7
+ 3. **Dependencies:** validate `Depends on:` and execution-plan.json agree, all IDs exist, and the graph is acyclic. Queue ready tasks to respect at most 3 workers and actual host capacity. No synthetic dependencies to limit concurrency. One writer per worktree; dependent work sees dependency commits on its execution branch.
8
+ 4. **Artifact wiring:** produced services, endpoints, schemas and UI elements must be connected to their intended consumers or deliverable. Check the planned wiring, not just file existence.
9
+ 5. **Execution feasibility:** task packets should be bounded with relevant context and durable checkpoints. Large task/file counts are a reason to inspect feasibility, not an automatic failure. Parallelism is optional. Separate worktrees need an approved integration path before dependent work; otherwise execute serially on the shared execution branch.
10
+ 6. **Constraints:** check relevant project rules and locked architecture decisions within actual instruction precedence. Do not scan every skill. Security and constitution exceptions follow the project's established process.
6
11
 
7
- Mid-execution discovery of plan flaws is expensive: context burned, partial commits to revert, deviation logs to resolve. Pre-execution verification catches the same flaws at zero implementation cost. The trade-off: 1-2 minutes of plan-checker time vs. potentially 30+ minutes of mid-execution rework.
8
-
9
- ## The 6 dimensions
10
-
11
- ### 1. Requirement Coverage
12
-
13
- **Goal:** every PRD requirement (`<REQ-ID>`) has at least one task addressing it.
14
-
15
- <critical>`<REQ-ID>` is language-dependent: `FR-N.M` in English projects, `RF-N.M` in Portuguese ones. This skill is shared by both — extract the IDs verbatim from `prd.md` and match those exact strings downstream; never hardcode a prefix.</critical>
16
-
17
- **Steps:**
18
- 1. Extract numbered requirements from `prd.md`. Pattern: `### <REQ-ID>` or `**<REQ-ID>:**` or numbered list under "Functional Requirements" / "Requisitos Funcionais".
19
- 2. Build `Set<REQ-ID>` of expected requirements.
20
- 3. Scan `tasks.md` and `<NN>_task.md` files for `Closes <REQ-ID>` / the `FRs`/`RFs` table column / `Requirement: <REQ-ID>` markers.
21
- 4. Compute `uncovered = expected - addressed`.
22
-
23
- **Pass:** `uncovered` is empty.
24
- **Revise:** uncovered non-empty AND fixable by adding tasks.
25
- **Block:** PRD has no numbered requirements (`expected` is empty) — verifying intent is impossible.
26
-
27
- **Common failures:**
28
- - Planner forgot a non-obvious requirement (e.g., audit logging) buried in PRD prose
29
- - Compound requirement ("user can sign up AND verify email") only addressed for one half
30
- - Requirement covered indirectly but no task explicitly marks the closure
31
-
32
- ### 2. Task Completeness
33
-
34
- **Goal:** each task has all four parts: files, action, verification, done criteria.
35
-
36
- **Steps:**
37
- For each task in `tasks.md`:
38
- - Open `<NN>_task.md` (or inline section)
39
- - Check for required sections:
40
- - `## Files` (or `Files to create/modify:`) — explicit paths
41
- - `## Action` (or `Implement:`) — what to do, concrete
42
- - `## Verification` (or `Verify:`) — how to know it worked (linter, tests, build, manual)
43
- - `## Done` (or `Done when:`) — criteria for marking `[x]`
44
-
45
- **Pass:** all four sections present in every task.
46
- **Revise:** ≥1 task missing one section.
47
-
48
- **Common failures:**
49
- - "Files: TBD" or "Files: see techspec" — too vague
50
- - No verification → executor can't decide when to commit
51
- - Done criteria absent → executor commits but can't mark `[x]` confidently
52
-
53
- ### 3. Dependency Soundness
54
-
55
- **Goal:** `Depends on:` graph is acyclic, references valid, waves are reasonable.
56
-
57
- **Steps:**
58
- 1. Parse every task's `Depends on:` field (none / comma-separated task numbers).
59
- 2. Build directed graph (node = task, edge = depends-on relation).
60
- 3. Topological sort:
61
- - Cycle → BLOCK with the cycle path
62
- - Reference to non-existent task number → REVISE with the dangling ref
63
- 4. Compute wave widths. Any wave > 8 tasks → REVISE (split with synthetic barrier).
64
-
65
- **Pass:** topological sort succeeds, all refs valid, waves ≤ 8 wide.
66
-
67
- **Common failures:**
68
- - Bidirectional dependency (`02 depends on 03; 03 depends on 02`) — likely planner confusion; needs re-think
69
- - Typo in `Depends on: 02` when the task is actually numbered `2.5` or `03`
70
- - 10 independent test files all in wave 1 → split into smaller waves
71
-
72
- ### 4. Artifact Wiring
73
-
74
- **Goal:** every artifact produced by a task is consumed by a downstream task OR is a leaf deliverable referenced in PRD's user stories.
75
-
76
- **Steps:**
77
- 1. For each task, identify what it PRODUCES:
78
- - New files (from `Files: + src/foo.ts`)
79
- - New exports (from `Implement: export function bar()`)
80
- - New endpoints (from `Action: add POST /api/baz`)
81
- 2. For each downstream task (later in topo order), identify what it CONSUMES:
82
- - Imports (from `Files: src/quux.ts (modify) — imports bar`)
83
- - References (from `Action: call /api/baz`)
84
- 3. Cross-reference: every produced artifact should be either consumed downstream OR explicitly mentioned in PRD as a user-facing deliverable.
85
-
86
- **Pass:** zero orphan artifacts.
87
- **Revise:** ≥1 artifact created without consumer or PRD reference — likely incomplete plan.
88
-
89
- **Common failures:**
90
- - Task creates a service but no task wires it into the router
91
- - Task creates a migration file but no task runs it (`prisma migrate deploy`)
92
- - Task creates a config but no task reads it
93
-
94
- ### 5. Context Budget
95
-
96
- **Goal:** the phase fits in a practical execution window.
97
-
98
- **Steps:**
99
- 1. Count tasks. Practical limit: 12 tasks per phase before quality degrades.
100
- 2. Estimate aggregate file changes: sum of files mentioned in `Files:` across all tasks. Limit: 30 files per phase.
101
- 3. Check parallelism setup: are wave-1 tasks running in parallel? (frontmatter `parallel: true` or default).
102
-
103
- **Pass:** ≤12 tasks, ≤30 aggregate files, wave 1 has parallel execution if multi-task.
104
-
105
- **Revise:** > 12 tasks → suggest splitting into 2 phases. > 30 files → reduce scope or split.
106
-
107
- **Common failures:**
108
- - Mega-phase with 20 tasks because the planner couldn't decompose
109
- - Single-task waves where parallelism was forgotten
110
-
111
- ### 6. Constraint Compliance
112
-
113
- **Goal:** tasks honor locked decisions and project conventions.
114
-
115
- **Steps:**
116
- 1. Read `.dw/rules/index.md` and `.dw/rules/<module>.md` for relevant modules.
117
- 2. Read `CONTEXT.md` if exists; extract `## Decisions` (LOCKED) section.
118
- 3. Read `./CLAUDE.md` for project hard constraints.
119
- 4. For each task, check if its `Action` or `Files` violate:
120
- - A locked decision
121
- - A project rule (forbidden pattern, mandated tool)
122
- - A CLAUDE.md directive
123
-
124
- **Pass:** zero violations.
125
- **Block:** ≥1 hard violation. The plan must change before execution.
126
-
127
- **Common failures:**
128
- - Locked decision says "framework: Fastify" but task says "use Express"
129
- - Project rules forbid raw SQL; task uses `pg.query()` directly
130
- - CLAUDE.md says "no env files committed"; task adds `.env.production`
131
-
132
- ## Verdict resolution
133
-
134
- After running all 6 dimensions:
135
-
136
- | Outcome | Verdict |
137
- |---------|---------|
138
- | All 6 PASS | PASS — proceed to execution |
139
- | Any REVISE, no BLOCK | REVISE — re-plan |
140
- | Any BLOCK | BLOCK — surface to user, no auto-replan |
141
-
142
- `PASS` is the only state that allows `/dw-execute-phase` to proceed.
143
-
144
- ## Bounded revision loop
145
-
146
- The plan-checker is part of a bounded quality loop:
147
-
148
- 1. `/dw-plan tasks` produces v1 of `tasks.md`
149
- 2. `/dw-plan-checker` runs → REVISE
150
- 3. `/dw-plan tasks --revise` produces v2 (consumes plan-checker's issues as input)
151
- 4. `/dw-plan-checker` runs → PASS or REVISE again
152
- 5. After 3 revisions without reaching PASS → escalate to user (something fundamental is wrong)
153
-
154
- The escalation cap prevents infinite loops where the planner can't satisfy the verifier. At 3 strikes, the user sees the diff between PRD and the failing tasks.md and decides next step.
155
-
156
- ## Time budget
157
-
158
- Plan-checker target: 1-2 minutes. The 6 dimensions are mostly file reads and grep operations; no heavy analysis. If plan-checker exceeds 5 minutes, it's a sign the agent is over-thinking — bias toward issuing REVISE for ambiguous cases rather than analyzing them deeply.
12
+ Return PASS when all dimensions are supported; REVISE for fixable draft inconsistencies; BLOCK for unresolved material decisions, conflicts, cycles or unavailable required capabilities. The parent repairs REVISE findings within approved scope and rechecks affected dimensions. Do not restart product interviews for discoverable facts or repeat a valid plan check without changed inputs. At a real repeated impasse report evidence and the exact missing decision, preserving the draft.
@@ -1,102 +1,11 @@
1
- # Wave coordination — how the executor parallelizes tasks
1
+ # Dependency scheduling
2
2
 
3
- Tasks within a phase have dependencies. Some can run in parallel; others must wait. The executor groups tasks into **waves** and runs each wave as parallel subagent dispatches, with sequential ordering between waves.
3
+ Read for multi-task execution. Parse `Depends on:` from tasks.md and cross-check execution-plan.json. Topologically order tasks; reject cycles and missing task IDs. The installed workflow-contract helper can validate the JSON graph and return ready tasks.
4
4
 
5
- ## Wave computation
5
+ A wave is a set of ready tasks, not a requirement to spawn parallel agents. Run at most 3 approved workers per workstream, limited further by host capacity. Serialize writers sharing a worktree. Do not introduce fake dependencies to enforce a concurrency limit; queue ready work instead.
6
6
 
7
- Input: `tasks.md` with each task carrying a `Depends on:` field (none, or comma-separated task IDs).
7
+ Dependent tasks use the same execution branch and see dependency commits before starting, even when successive tasks use different CLIs. Independent worktrees require a planned integration path before dependent work and authorization for that integration. Without it, run sequentially on the execution branch. Do not merge into the owner's branch solely to progress.
8
8
 
9
- Algorithm: topological sort.
9
+ Each writer owns scoped task changes and its commit. Parent updates consolidated state after handoffs; avoid concurrent edits to shared tasks.md. Commit IDs need not follow numeric task order when tasks are independent. A failed task blocks its dependents; independent authorized tasks can continue.
10
10
 
11
- 1. Build dependency graph: node per task, edge from each `Depends on:` to the dependent task.
12
- 2. Cycle check: if a cycle exists → abort with `EXEC-FAILED: dependency cycle`.
13
- 3. Wave assignment:
14
- - Wave 1 = tasks with zero dependencies
15
- - Wave N = tasks whose all dependencies are in waves 1..N-1
16
- 4. Output: ordered list of waves, each wave a list of task IDs.
17
-
18
- ## Example
19
-
20
- ```
21
- tasks.md:
22
- - 1.0 Create user schema Depends on: none
23
- - 2.0 Create user model Depends on: 1.0
24
- - 3.0 Create order schema Depends on: none
25
- - 4.0 Wire auth middleware Depends on: 2.0
26
- - 5.0 Add login endpoint Depends on: 4.0
27
- - 6.0 Add order endpoint Depends on: 2.0, 3.0
28
- - 7.0 Wire validation rules Depends on: 4.0, 6.0
29
-
30
- Computed waves:
31
- Wave 1: [1.0, 3.0] (no deps; can run in parallel)
32
- Wave 2: [2.0] (depends on 1.0)
33
- Wave 3: [4.0, 6.0] (depend on wave 2)
34
- Wave 4: [5.0, 7.0] (depend on wave 3)
35
- ```
36
-
37
- ## Parallel execution within a wave
38
-
39
- Within a wave, the executor dispatches tasks in parallel via subagent calls (one subagent per task). Each subagent:
40
-
41
- 1. Reads its `<NN>_task.md`
42
- 2. Implements
43
- 3. Verifies (lint/tests/build)
44
- 4. Commits atomically (per `atomic-commits.md`)
45
- 5. Marks `[x]` in `tasks.md`
46
- 6. Returns success or deviation status to the orchestrating executor
47
-
48
- The orchestrating executor:
49
-
50
- - Spawns N subagents in parallel (single message, N tool calls)
51
- - Waits for all to return
52
- - If all PASS → proceed to next wave
53
- - If ANY return deviation/blocked → resolve before next wave (see deviation rules in `agents/executor.md`)
54
-
55
- ## Wave width limits
56
-
57
- Practical caps to keep context budget sane:
58
-
59
- - **Soft cap: 5 tasks per wave** — tested as the upper bound where parallel execution stays efficient
60
- - **Hard cap: 8 tasks per wave** — beyond this, the orchestrator's context fills with subagent results faster than tasks complete
61
-
62
- If a wave exceeds the hard cap, the planner should split: introduce a synthetic dependency to bisect the wave. Example: if Wave 3 has 10 independent tasks, force tasks 06-10 to depend on a "wave 3a barrier" so they go to Wave 3.5.
63
-
64
- The plan-checker (Dimension 5) flags wide waves before execution.
65
-
66
- ## Cross-wave atomicity
67
-
68
- Each wave is a checkpoint:
69
-
70
- - After all tasks in a wave commit, run a `git status` check — should be clean (everything committed).
71
- - If any task in a wave failed permanently (Rule 3 deviation), abort BEFORE starting the next wave. Leave the partial work committed; surface to user via `EXEC-BLOCKED`.
72
- - Don't run waves N+1 with broken commits in wave N. The dependencies aren't satisfied.
73
-
74
- ## Order within a wave
75
-
76
- Within a wave, order doesn't matter logically (no deps between same-wave tasks). But for **commit history readability**, the executor should commit in numeric order of task ID (1.0 commit before 2.0 even if both are wave 1). The parallel subagent results may arrive out of order; the executor collects and commits sequentially.
77
-
78
- This means: subagents return their changes (files written, but NOT committed). The executor commits them in numeric order.
79
-
80
- (Alternative: subagents commit independently and accept commit interleaving. Pick this if commit-order doesn't matter for the project; the orchestrator sets a flag.)
81
-
82
- ## When to NOT use waves
83
-
84
- Single-task changes (`/dw-quick`, `/dw-run`) bypass waves entirely. Waves are for `/dw-run` and `/dw-execute-phase` — phase-scale execution.
85
-
86
- ## Verification of wave structure (pre-execution)
87
-
88
- The plan-checker (Dimension 3 in `plan-checker.md`) verifies:
89
- - Topological sort succeeds (no cycles)
90
- - All `Depends on:` references point to existing tasks
91
- - No wave exceeds the hard cap (8 tasks)
92
-
93
- If these fail, plan-checker returns REVISE before any code is touched.
94
-
95
- ## Resume after checkpoint
96
-
97
- If the executor checkpoints mid-phase, `active-session.md` records:
98
- - `last_completed_task`
99
- - `last_wave_completed`
100
- - `remaining_tasks`
101
-
102
- `/dw-resume` reads this, recomputes waves from `tasks.md`, skips already-committed tasks, and resumes from the wave containing `last_completed_task + 1`.
11
+ Resume from execution-state.json and actual completed commits, not `last_completed_task + 1`: tasks may finish out of order. Revalidate dependency/evidence state and preserve approved assignments. See `.dw/references/execution-contract.md` for session identity and bookkeeping.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: dw-git-discipline
3
- description: Use when committing or opening a PR. Atomic commits (one intent), Conventional Commits, trunk-based pattern, branch hygiene. Triggers before /dw-commit, /dw-generate-pr, or any git operation.
3
+ description: Use when committing or opening a PR. Atomic commits (one intent), Conventional Commits, trunk-based pattern, branch hygiene. Use for /dw-commit or /dw-generate-pr, not ordinary Git inspection.
4
4
  allowed-tools:
5
5
  - Read
6
6
  - Bash
@@ -54,7 +54,7 @@ See `references/branch-hygiene.md` for naming conventions and rebase-vs-merge gu
54
54
  When wired into `/dw-commit`, every commit must:
55
55
 
56
56
  1. Have a single logical intent (one feature, one fix, one refactor — not mixed).
57
- 2. Pass lint + tests + build BEFORE the commit is created.
57
+ 2. Have valid evidence for applicable project-required checks before commit, using `dw-verify`; reuse equivalent evidence without repeating checks solely for a new stage.
58
58
  3. Use Conventional Commits format with correct type/scope.
59
59
  4. Have a body that explains WHY for non-trivial changes.
60
60
  5. NOT skip pre-commit hooks (`--no-verify` is forbidden unless user explicitly authorizes).
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: dw-grilling
3
- description: "Internal decision-tree interview protocol for the native Grill flow. Loaded by /dw-brainstorm (grill mode) and /dw-plan to stress-test a plan or PRD to shared understanding: build a dependency-ordered decision tree, ask exactly ONE unresolved decision per turn with a recommended answer plus rationale and a real alternative, discover facts from the repo/docs instead of asking, leave decisions to the user, and gate alignment on explicit confirmation. Pipeline-internal, never exported, never implements code."
3
+ description: Internal decision-tree interview protocol for the native Grill flow.
4
4
  allowed-tools:
5
5
  - Read
6
6
  - Grep
@@ -55,70 +55,7 @@ Before starting any phase:
55
55
 
56
56
  ## The five phases
57
57
 
58
- Each phase writes to `.dw/incidents/<YYYY-MM-DD>-<slug>/`. Slug is auto-generated from incident title (kebab-case, ≤30 chars).
59
-
60
- ### Phase 1 — Detection & Triage
61
-
62
- **Output:** `.dw/incidents/<date>-<slug>/01-triage.md`
63
-
64
- Steps:
65
- 1. Classify severity using the table above.
66
- 2. Assess blast radius: which services, how many users affected, revenue impact if known.
67
- 3. Identify immediate mitigation: rollback, feature flag toggle, traffic redirect.
68
-
69
- See `references/severity-and-triage.md` for diagnostic commands per stack (Kubernetes, Docker, generic HTTP).
70
-
71
- **Checkpoint:** present triage summary. Wait for user confirmation before moving to investigation.
72
-
73
- ### Phase 2 — Investigation & Root Cause
74
-
75
- **Output:** `.dw/incidents/<date>-<slug>/02-investigation.md`
76
-
77
- Steps:
78
- 1. Build timeline: when did it start? What changed?
79
- 2. Correlate signals: metrics spike + deploy + error logs.
80
- 3. Hypothesis testing: one theory at a time; verify each before moving on.
81
- 4. Identify root cause: not the first symptom, but the underlying assumption that broke.
82
-
83
- Common forensic tools:
84
- - `git bisect` for regressions.
85
- - Recent deploy log: `git log --oneline --since="24 hours ago"`.
86
- - For live monitoring during investigation, `/dw-debug-protocol` flaky-investigation patterns apply.
87
-
88
- **Checkpoint:** present root-cause hypothesis. Wait for user confirmation before applying fix.
89
-
90
- ### Phase 3 — Resolution & Recovery
91
-
92
- **Output:** `.dw/incidents/<date>-<slug>/03-resolution.md`
93
-
94
- Steps:
95
- 1. Apply fix: hotfix branch → fast PR (via `/dw-generate-pr`) → deploy.
96
- 2. Verify: health checks green, error rate back to baseline.
97
- 3. Monitor 30 minutes post-fix for SEV-1/2 to confirm stability.
98
-
99
- **Checkpoint:** confirm full recovery before drafting communications.
100
-
101
- ### Phase 4 — Communication
102
-
103
- **Output:** `.dw/incidents/<date>-<slug>/04-communication.md`
104
-
105
- Two communications generated using the templates in `references/communication-templates.md`:
106
- - **Initial notification** (sent during the incident; updated every 30 min for SEV-1/2).
107
- - **Resolution notification** (sent when phase 3 confirms recovery).
108
-
109
- ### Phase 5 — Postmortem
110
-
111
- **Output:** `.dw/incidents/<date>-<slug>/05-postmortem.md`
112
-
113
- Generate a **blameless** postmortem using `references/postmortem-template.md`. Sections:
114
- - Summary (2–3 sentences).
115
- - Timeline (per-minute events from alert to all-clear).
116
- - Root cause (technical, no blame).
117
- - Impact (users affected, revenue, error-budget consumed).
118
- - What went well / What went wrong.
119
- - Action items (owner + due date + priority — see `references/blameless-discipline.md` for the quality bar).
120
-
121
- **Quality bar for action items:** see `references/blameless-discipline.md`. "Improve monitoring" does NOT count. "Add Datadog SLO alert at p99 > 800ms with on-call routing by 2026-06-01, owner: @bruno" counts.
58
+ For the five phases, read `references/the-five-phases-detail.md`. Load only when this part of the task applies.
122
59
 
123
60
  ## Required reading by context
124
61
 
@@ -0,0 +1,66 @@
1
+ ## The five phases
2
+
3
+ Each phase writes to `.dw/incidents/<YYYY-MM-DD>-<slug>/`. Slug is auto-generated from incident title (kebab-case, ≤30 chars).
4
+
5
+ ### Phase 1 — Detection & Triage
6
+
7
+ **Output:** `.dw/incidents/<date>-<slug>/01-triage.md`
8
+
9
+ Steps:
10
+ 1. Classify severity using the table above.
11
+ 2. Assess blast radius: which services, how many users affected, revenue impact if known.
12
+ 3. Identify immediate mitigation: rollback, feature flag toggle, traffic redirect.
13
+
14
+ See `severity-and-triage.md` for diagnostic commands per stack (Kubernetes, Docker, generic HTTP).
15
+
16
+ **Checkpoint:** present triage summary. Wait for user confirmation before moving to investigation.
17
+
18
+ ### Phase 2 — Investigation & Root Cause
19
+
20
+ **Output:** `.dw/incidents/<date>-<slug>/02-investigation.md`
21
+
22
+ Steps:
23
+ 1. Build timeline: when did it start? What changed?
24
+ 2. Correlate signals: metrics spike + deploy + error logs.
25
+ 3. Hypothesis testing: one theory at a time; verify each before moving on.
26
+ 4. Identify root cause: not the first symptom, but the underlying assumption that broke.
27
+
28
+ Common forensic tools:
29
+ - `git bisect` for regressions.
30
+ - Recent deploy log: `git log --oneline --since="24 hours ago"`.
31
+ - For live monitoring during investigation, `/dw-debug-protocol` flaky-investigation patterns apply.
32
+
33
+ **Checkpoint:** present root-cause hypothesis. Wait for user confirmation before applying fix.
34
+
35
+ ### Phase 3 — Resolution & Recovery
36
+
37
+ **Output:** `.dw/incidents/<date>-<slug>/03-resolution.md`
38
+
39
+ Steps:
40
+ 1. Apply fix: hotfix branch → fast PR (via `/dw-generate-pr`) → deploy.
41
+ 2. Verify: health checks green, error rate back to baseline.
42
+ 3. Monitor 30 minutes post-fix for SEV-1/2 to confirm stability.
43
+
44
+ **Checkpoint:** confirm full recovery before drafting communications.
45
+
46
+ ### Phase 4 — Communication
47
+
48
+ **Output:** `.dw/incidents/<date>-<slug>/04-communication.md`
49
+
50
+ Two communications generated using the templates in `communication-templates.md`:
51
+ - **Initial notification** (sent during the incident; updated every 30 min for SEV-1/2).
52
+ - **Resolution notification** (sent when phase 3 confirms recovery).
53
+
54
+ ### Phase 5 — Postmortem
55
+
56
+ **Output:** `.dw/incidents/<date>-<slug>/05-postmortem.md`
57
+
58
+ Generate a **blameless** postmortem using `postmortem-template.md`. Sections:
59
+ - Summary (2–3 sentences).
60
+ - Timeline (per-minute events from alert to all-clear).
61
+ - Root cause (technical, no blame).
62
+ - Impact (users affected, revenue, error-budget consumed).
63
+ - What went well / What went wrong.
64
+ - Action items (owner + due date + priority — see `blameless-discipline.md` for the quality bar).
65
+
66
+ **Quality bar for action items:** see `blameless-discipline.md`. "Improve monitoring" does NOT count. "Add Datadog SLO alert at p99 > 800ms with on-call routing by 2026-06-01, owner: @bruno" counts.