@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
@@ -44,6 +44,8 @@ When available under `./.agents/skills/`, use these as planning support:
44
44
 
45
45
  ## Agent Dispatch
46
46
 
47
+ Use these roles only when bounded delegation improves the task; they may be performed locally. Do not spawn every listed agent or override inherited models automatically.
48
+
47
49
  When project agents are installed, use:
48
50
 
49
51
  - `dw-code-explorer` before TechSpec and Tasks to trace existing flows and reusable patterns.
@@ -92,7 +94,7 @@ For each stage: build the matrix, mark each dimension `covered` (fact discovered
92
94
 
93
95
  ## Codebase Intelligence
94
96
 
95
- <critical>If `.dw/intel/` exists, query it via `/dw-intel` before each stage. MANDATORY for TechSpec stage.</critical>
97
+ Query `.dw/intel/` when it helps locate current patterns; inspect relevant source directly and validate index freshness. Reuse evidence already gathered across stages.
96
98
  - PRD stage: `/dw-intel "existing features in the <topic> domain"` to avoid duplicate functionality.
97
99
  - TechSpec stage: `/dw-intel "architectural patterns, API conventions, technical decisions"` to align with existing project shape.
98
100
  - Tasks stage: `/dw-intel "test patterns, build pipeline, deployment cadence"` for accurate task sizing.
@@ -141,8 +143,9 @@ Runs when default mode (after PRD approval) OR `plan techspec` OR `plan --from t
141
143
  5. **Constitution gate.** Each architectural decision lists `Respects: P-NNN` or `Deviates: P-NNN — justification: <ADR slug or rationale>`. Deviations from `severity: high/critical` principles without ADR → STOP.
142
144
  6. **API design discipline.** When defining endpoints, consult `dw-codebase-intel/references/api-design-discipline.md` for Hyrum's Law, error semantics, versioning.
143
145
  7. **UI sections** (when feature has UI): the 4 grounding questions from `dw-ui-discipline` must be answered in the techspec; state matrix + scene sentence required.
146
+ - For frontend data flow, dependencies or tooling, read `dw-ui-discipline/references/frontend-engineering.md` from the installed skills location. Reuse the module's quality baseline; add only affected decisions from `.dw/templates/frontend-quality-template.md`. Distinguish existing required checks from advisory/proposed controls. Include accepted configuration work and its validation in the task breakdown and execution matrix.
144
147
  8. **Branch name section:** `feat/prd-<feature-slug>`.
145
- 9. **Testing strategy section:** explicit tests-per-method, mock setup, coverage targets (80% services, 70% controllers), E2E flows.
148
+ 9. **Testing strategy section:** behavior/risk coverage, lowest effective test layers, existing suites, justified mocks and applicable E2E flows. Project-required thresholds apply; no universal percentage target.
146
149
  10. **Output location:** `.dw/spec/prd-<feature-slug>/techspec.md` (same dir as PRD).
147
150
 
148
151
  ### Optional: `--council` flag
@@ -162,7 +165,7 @@ Runs when default mode (after TechSpec approval) OR `plan tasks`.
162
165
  ### Required behavior
163
166
 
164
167
  1. **Feature branch instruction:** include the `feat/prd-<feature-slug>` branch creation in the tasks summary.
165
- 2. **Decompose** PRD + TechSpec into tasks. Target ~6 tasks per feature. **NEVER exceed 2 FRs per task.**
168
+ 2. **Decompose** PRD + TechSpec into tasks. Use coherent, independently verifiable slices; preserve complete requirement coverage without a fixed task or FR quota.
166
169
  3. **End-to-end coverage:** every user-facing flow has backend + frontend + functional UI subtasks if applicable.
167
170
  4. **Test placement (`dw-testing-discipline`):** every test-adding subtask names its invariant per the placement doctrine. Owning layer specified.
168
171
  5. **Constitution alignment:** every task lists `Constitution: respects P-NNN` or `Constitution: deviates P-NNN — ADR planned: <slug>` or `Constitution: n/a — reason: <one-liner>`.
@@ -172,20 +175,24 @@ Runs when default mode (after TechSpec approval) OR `plan tasks`.
172
175
  - Summary: `.dw/spec/prd-<feature-slug>/tasks.md`
173
176
  - Per-task files: `.dw/spec/prd-<feature-slug>/<N>_task.md`
174
177
 
175
- ### Final Consistency Check (auto-invoked before user approval)
178
+ ### Task execution matrix
179
+
180
+ At Stage 3 read `.dw/references/execution-contract.md`. Propose local or cross-tool development per task, choosing model, effort and installed agents from actual complexity and risk. Write schema 1.1 task templates and `execution-plan.json`, validate with `node .dw/scripts/lib/workflow-contract.mjs validate <plan.json>`, and check assignment IDs/dependencies against tasks.md. Present choices with rationale for approval; never silently pick another provider during execution. Legacy schema 1.0 plans remain valid and default to local execution.
181
+
182
+ ## Final Consistency Check (auto-invoked before user approval)
176
183
 
177
184
  Run 5-dimension check, write `.dw/spec/prd-<feature-slug>/tasks-validation.md`:
178
185
 
179
186
  1. **FR coverage:** every numbered FR maps to ≥1 task.
180
187
  2. **Task grounding:** every task references ≥1 FR.
181
- 3. **Test coverage:** every user-facing FR has ≥1 test-adding task.
188
+ 3. **Test coverage:** every user-facing FR has a meaningful verification path, reusing existing tests when sufficient.
182
189
  4. **Dependency graph:** topological order valid, no cycles.
183
190
  5. **Constitution alignment:** every task has the alignment line (only if `.dw/constitution.md` exists).
184
191
 
185
- Any FAIL → STOP. Show the dimension table in chat. Three options: auto-fix (regenerate affected tasks), manual edit, explicit override with reason.
192
+ Repair internal consistency failures and rerun the check. Ask only for material missing decisions or an explicit override with reason; do not request permission to repair the draft.
186
193
 
187
194
  ### Checkpoint
188
- Present tasks.md summary + per-task list. User approves to allow `/dw-run` execution.
195
+ Present tasks.md plus the execution matrix (local/cross-tool, model, effort, agents and approved fallbacks). Approval authorizes these assignments. For an implementation request continue to `/dw-run` or the invoking `/dw-goal`; a planning-only request ends with the approved plan.
189
196
 
190
197
  ## Output Files Summary
191
198
 
@@ -81,6 +81,8 @@ When available under `./.agents/skills/`, these are invoked operationally:
81
81
 
82
82
  ### Behavior — UI mode
83
83
 
84
+ Read the affected module's quality baseline/TechSpec. Reuse valid required-check evidence through `dw-verify`; keep browser behavior, contract validation and diagnostic reports distinct. When critical logic or weak assertions warrant mutation analysis, read `dw-testing-discipline/references/mutation-testing.md`. Do not introduce a score threshold or install a new suite for unrelated UI edits. Record unavailable/not-run diagnostics and investigated findings in `qa-report.md`.
85
+
84
86
  1. **Pre-flight**: confirm the project dev server can run. Confirm `.dw/spec/<prd>/` has the PRD + TechSpec + tasks.
85
87
  2. **Map FRs to test plan**: for each FR, identify the user-facing flow that exercises it.
86
88
  3. **Drive Playwright MCP** (if unavailable or blocked — common on WSL — fall back to the WSL-resilient local capture `node .dw/scripts/lib/capture-screenshots.mjs`, which picks the browser via `.dw/scripts/lib/resolve-browser.mjs`; see the "Browser on WSL" section of `dw-testing-discipline/references/playwright-recipes.md`):
@@ -0,0 +1,169 @@
1
+ <system_instructions>
2
+ You are the progress-report loop. While long work is running in this session, you emit a detailed, timestamped report at a fixed cadence (default every 10 minutes) saying **what is already done, what is being done right now, and what is still left** — without the user having to ask "any news?". Each report goes to the chat AND is appended to a daily log under `.dw/reports/`. The loop disarms itself when the work is finished.
3
+
4
+ ## When to Use
5
+ - Use when the user says "report every N minutes", "keep me posted while this runs", "give me status reports", "I want to know where we are every 10 minutes".
6
+ - Auto-armed by `/dw-run` (all-tasks and `--resume` modes), by `/dw-autopilot` (execution invocation), and by the `dw-cli-run` adapters (`/dw-codex-run`, `/dw-claude-run`, `/dw-copilot-run`) when they dispatch long work. Auto-arm is idempotent and can be disabled with `DW_REPORT_AUTO=off`.
7
+ - Do NOT use as a substitute for `/dw-pause` (mental-state handoff) or `/dw-goal status` (goal contract state). This is a heartbeat about work in flight, not durable project state.
8
+ - Do NOT use to poll a background task the harness already notifies you about — the loop reports *around* those notifications; it never replaces them.
9
+
10
+ ## Pipeline Position
11
+ **Predecessor:** any long-running command (`/dw-run`, `/dw-autopilot`, `/dw-goal`, `/dw-codex-run`, builds, deploys) | **Successor:** none — the loop ends with a final report; `/dw-pause` may consume the day's log.
12
+
13
+ ## Modes
14
+
15
+ | Invocation | Behavior |
16
+ |------------|----------|
17
+ | `/dw-report` | Arm the loop at the default cadence (**10 minutes**). If already armed, print the current state and do nothing else. |
18
+ | `/dw-report --every <N>m` | Arm (or re-arm) the loop at `N` minutes (`5m`, `10m`, `15m`, `30m`; `--every 600s` also accepted). Minimum `1m`. |
19
+ | `/dw-report now` | Emit one report immediately, without touching the cadence. Works armed or not. |
20
+ | `/dw-report status` | Show whether the loop is armed, the cadence, when it was armed, the last report time, how many reports were emitted, and the log path. |
21
+ | `/dw-report stop` | Disarm. Emits a final report first if there is unreported progress. |
22
+
23
+ ## Inputs
24
+
25
+ | Variable | Description | Example |
26
+ |----------|-------------|---------|
27
+ | `{{EVERY}}` | Cadence. Optional; defaults to `10m`. | `--every 5m` |
28
+ | `DW_REPORT_AUTO` | Env var. `off` disables auto-arm from other commands (manual `/dw-report` still works). | `DW_REPORT_AUTO=off` |
29
+ | `DW_REPORT_BELL` | Env var. Optional shell command executed right before each report is written (local sound, desktop notification, etc.). Silent when unset. | `DW_REPORT_BELL="paplay /usr/share/sounds/freedesktop/stereo/message.oga"` |
30
+
31
+ `report.bell` in `.dw/config.json` is the file-based equivalent of `DW_REPORT_BELL` (env var wins). Because the bell is machine-specific, prefer the env var over committing it.
32
+
33
+ ## State and Artifacts
34
+
35
+ ```
36
+ .dw/reports/
37
+ ├── .gitignore # ????-??-??.md and .active.json are machine-local (created by init/update)
38
+ ├── .active.json # loop state — exists only while armed
39
+ └── YYYY-MM-DD.md # append-only daily log; one entry per emitted report
40
+ ```
41
+
42
+ `.active.json` schema:
43
+
44
+ ```json
45
+ {
46
+ "schema_version": "1.0",
47
+ "armed_at": "2026-08-24 15:10:02",
48
+ "every_seconds": 600,
49
+ "vehicle": "wakeup | background-bash",
50
+ "armed_by": "user | dw-run | dw-autopilot | dw-cli-run",
51
+ "seq": 3,
52
+ "last_report_at": "2026-08-24 15:40:12",
53
+ "last_state": "working | blocked | finished"
54
+ }
55
+ ```
56
+
57
+ Timestamps are **real** — always taken from `date '+%Y-%m-%d %H:%M:%S'`, never estimated.
58
+
59
+ ## Vehicle — how the loop stays alive
60
+
61
+ <critical>The main thread never sleeps in the foreground. Pick ONE vehicle, record it in `.active.json`, and never claim "loop armed" unless that vehicle is actually scheduled.</critical>
62
+
63
+ 1. **Native wakeup (PREFERRED — Claude Code).** Use the harness's scheduled-wakeup facility (the same mechanism as `/loop` in self-paced mode): after every tick, schedule the next wake-up in `every_seconds`. Pass `noop: true` on a silent tick and `noop: false` on a tick that reported. The `reason` is `dw-report tick every <N>m`. The loop dies with the session — no orphan.
64
+ 2. **Background shell timer (FALLBACK — Codex, Copilot, OpenCode, or any harness without wakeups).** Run, in the background, `sleep <every_seconds>; date '+%Y-%m-%d %H:%M:%S'`. When its completion notification arrives, run the tick, then start the next timer. One timer at a time; never chain sleeps in the foreground.
65
+ 3. **Never a system cron.** A cron does not know when the work ended and keeps firing (and ringing the bell) for days. If the harness only offers cron-style scheduling, use it but treat `/dw-report stop` and the auto-disarm rule as mandatory cleanup.
66
+
67
+ If the work changes vehicle mid-way (e.g. the session is resumed elsewhere), `/dw-report status` must say so honestly: `armed in state file, but no wake-up is scheduled in this session — run /dw-report to re-arm`.
68
+
69
+ ## Tick Protocol (every fire)
70
+
71
+ 1. **Timestamp.** `date '+%Y-%m-%d %H:%M:%S'`.
72
+ 2. **Assess from the session.** The source of truth is the session's own work — what you did, what you started, what came back. Use cheap observable checks as evidence, not as archaeology: `git log --oneline` since the last report, `git status --short | wc -l`, the tail of a log or stream this session started, the number of completed steps in a CLI stream (`grep -c '"type":"item.completed"' <stream>.jsonl`), a background task's last notification. Do NOT go mining `.dw/spec/`, `.dw/goals/`, or `STATE.md` to reconstruct history you were not part of.
73
+ 3. **Classify the moment.**
74
+ - **working** — something is in flight (a command, a subagent, a workflow, a CLI run, a build, a deploy) or you are actively implementing.
75
+ - **blocked** — nothing is running because the work is waiting on the user (a decision, an approval, a credential).
76
+ - **finished** — the work the loop was armed for is complete (or failed terminally) and nothing else is queued.
77
+ 4. **Decide whether to speak.**
78
+ - `working` → **REPORT**. Always. Even when nothing changed since the last tick ("build still at step 6/9, ~4 min left" is a valid, expected report).
79
+ - `blocked` → report **once** when the state changes to blocked (that is news); afterwards, on every tick where nothing changed, **stay silent**: no chat line, no log entry, no bell. The check happens; the output does not.
80
+ - `finished` → **FINAL REPORT immediately** (do not wait for the cadence when you notice completion outside a tick), then **disarm**: delete `.active.json`, cancel the pending wake-up/timer, and say so in the final report.
81
+ 5. **Bell (optional).** If `DW_REPORT_BELL` (or `report.bell`) is set, run it *before* writing. Never on a silent tick.
82
+ 6. **Write.** The report goes to the chat and is appended verbatim to `.dw/reports/YYYY-MM-DD.md` (create the file with a `# Reports — YYYY-MM-DD` heading if missing). Update `.active.json` (`seq`, `last_report_at`, `last_state`).
83
+ 7. **Re-arm** the vehicle — unless step 4 disarmed the loop.
84
+
85
+ ## Report Format — cumulative with delta highlighted
86
+
87
+ The user asked for a **detailed** report. Detailed means: every item carries evidence, every in-flight item carries a measurable progress figure, and the remaining list is ordered with the next milestone first.
88
+
89
+ ```markdown
90
+ 📊 Report — 2026-08-24 15:40:12 (#3 · every 10m · armed 15:10)
91
+
92
+ ## ✅ Done (cumulative)
93
+ - ➕ Task 3/7 — import parser handles quoted fields — `src/import/parser.ts`, commit `a1b2c3d`, 14 tests green
94
+ - ➕ Task 2/7 — CSV schema validation — commit `9f8e7d6`, `npm test` 41/41
95
+ - Task 1/7 — fixture set for imports — commit `1234abc`
96
+
97
+ ## 🔄 Doing
98
+ - Task 4/7 — batch upsert endpoint — 6 files touched, last command `npm test -- import` (running 1m40s); codex stream: 23 steps completed, last `command_execution: pnpm build`
99
+
100
+ ## ⏳ Remaining
101
+ 1. Task 5/7 — error report download (next milestone, blocked on Task 4)
102
+ 2. Task 6/7 — UI wiring
103
+ 3. Task 7/7 — E2E for the happy path
104
+ 4. Level 2 review + QA + security gate
105
+
106
+ ## ⚠️ Blockers / decisions needed
107
+ - none
108
+ ```
109
+
110
+ Rules:
111
+ - **`➕` marks items completed since the previous report.** Older items stay in the list without the marker, so each report is self-contained and still shows the pace.
112
+ - **Evidence or it did not happen:** a file path, a commit SHA, a test count, a log line. "Implemented X" without evidence is not allowed.
113
+ - **Measurable progress in Doing:** a step counter, a file count, a running command with its elapsed time, a percentage from a real progress line. Never a bare "in progress".
114
+ - **Remaining is ordered:** the next milestone first, then the rest; include the pipeline gates that still lie ahead (review, QA, security audit, commit, PR) when they apply.
115
+ - **Blockers section only when there is something to say** — otherwise write `- none` or omit it.
116
+ - **Header counts are real:** `#n` is `seq`, the cadence and the arm time come from `.active.json`.
117
+ - When the loop was armed by another command, the first report says so: `armed by /dw-run (all pending tasks)`.
118
+
119
+ ### Final report
120
+
121
+ Same shape, with the header `📊 FINAL Report — <timestamp> (#n · loop disarmed)`, an explicit outcome line under Done (`Outcome: all 7 tasks committed, review APPROVED` or `Outcome: FAILED at task 4 — see blockers`), and `Remaining` listing what the user still has to do by hand (open the PR, approve the gate, merge).
122
+
123
+ ### Chat output for arm / status / stop
124
+
125
+ ```
126
+ 📊 Report loop armed — every 10m · vehicle: wakeup · log: .dw/reports/2026-08-24.md
127
+ First report at ~15:20. Silent while blocked; final report + auto-disarm when the work ends. Stop with /dw-report stop.
128
+ ```
129
+
130
+ ```
131
+ 📊 Report loop — ARMED · every 10m · since 15:10 · 3 reports · last 15:40 · state: working · log: .dw/reports/2026-08-24.md
132
+ ```
133
+
134
+ ```
135
+ 📊 Report loop — NOT armed. Arm with /dw-report [--every <N>m].
136
+ ```
137
+
138
+ ## Cadence Discipline
139
+
140
+ <critical>The cadence is the user's, not yours. Never stretch the interval to "wait for the build to finish" or "avoid noise" — a report that says "nothing changed, ~X min left" is the product while work is running. Change the interval only on an explicit user instruction (`--every`).</critical>
141
+
142
+ <critical>Never claim the loop is active without a scheduled wake-up or a live background timer. `/dw-report status` reads `.active.json` AND checks the vehicle; if they disagree, say so.</critical>
143
+
144
+ <critical>Silence is only for the blocked/idle state. Working state always reports; the transition to blocked reports once; completion reports immediately.</critical>
145
+
146
+ ## Auto-arm Contract (for the commands that call this)
147
+
148
+ When `/dw-run` (Mode 2 / Mode 3), `/dw-autopilot` (execution invocation), or a `dw-cli-run` adapter starts long work, it invokes `/dw-report` **before** dispatching:
149
+
150
+ - **Idempotent:** if `.dw/reports/.active.json` exists and the vehicle is live, do nothing (keep the existing cadence). If the file exists but the vehicle is dead, re-arm and say so.
151
+ - **Respects opt-out:** if `DW_REPORT_AUTO=off`, skip silently (one line in the caller's output: `report loop: auto-arm disabled by DW_REPORT_AUTO`).
152
+ - **Records the caller:** `armed_by` in `.active.json`, echoed in the first report.
153
+ - **Ends with the caller's work:** the caller's completion (all tasks done + final review, goal complete + PR gate, CLI run gated) is the `finished` state — final report, then disarm. The caller does not need to call `/dw-report stop`.
154
+ - **Never blocks the caller:** arming takes one tool call; if the vehicle is unavailable, the caller proceeds and prints `report loop: no wake-up vehicle available in this harness — run /dw-report manually if you want a background timer`.
155
+
156
+ ## Anti-patterns
157
+ - Reporting "in progress" without a number, a command, or a file.
158
+ - Inventing a timestamp, a commit SHA, or a test count.
159
+ - Emitting `idle` / `no news` lines while nothing is running — that is exactly the noise this loop exists to prevent.
160
+ - Stretching or skipping a tick while work is running.
161
+ - Leaving a system cron behind after the work ended.
162
+ - Reading `.dw/spec/` or `.dw/goals/` to narrate work this session did not do.
163
+ - Ringing the bell on a silent tick.
164
+
165
+ ## Structured Return
166
+
167
+ After arming, stopping, or each report, the command's own status is fully described by the chat line plus `.dw/reports/.active.json`. Other commands only need to know: **armed (bool), every_seconds, seq, last_state**.
168
+
169
+ </system_instructions>
@@ -15,8 +15,8 @@ You are a session-resumption agent. Your job is to read `.dw/STATE.md`, orient y
15
15
  ## Workflow
16
16
 
17
17
  ### 1. Read STATE.md
18
- - If `.dw/STATE.md` is missing, report: "No paused state found — this looks like a fresh session. Run `/dw-help` for next steps." Stop here.
19
- - If `STATE.md` exists but every section is `_none_`, report: "STATE.md is empty — nothing to resume. Tell me what you want to do."
18
+ - If `.dw/STATE.md` is missing or empty, inspect `.dw/goals/*/status.json`, `.dw/spec/*/execution-state.json` and `active-session.md`. Use the explicit target or unique active workflow; ask only if multiple candidates remain. Report no resumable work only after checking these sources.
19
+ - Cross-check any recovered checkpoint against actual files and evidence.
20
20
 
21
21
  ### 2. Cross-reference with disk
22
22
  Verify that the state still matches the filesystem:
@@ -63,13 +63,7 @@ Based on the TLDR, route to a concrete command. Use these heuristics:
63
63
  | Blocker waiting on external input | Suggest the user resolve the blocker first |
64
64
  | Only Todos and Decisions, no active work | Ask the user what they want to start |
65
65
 
66
- Phrase the suggestion as a question, not an order:
67
-
68
- ```
69
- Want me to <suggested command>?
70
- - yes → I'll run it
71
- - no, <other intent> → tell me what instead
72
- ```
66
+ For a request to continue, execute the identified next step using existing authorization and saved task assignments. A status-only question receives the summary and suggested next step without execution.
73
67
 
74
68
  ### 5. Update STATE.md frontmatter
75
69
 
@@ -77,7 +71,7 @@ Set `last_resumed` to today's date (YYYY-MM-DD). Do not modify section content
77
71
 
78
72
  ## Required Behavior
79
73
 
80
- <critical>NEVER auto-execute the suggested command. `/dw-resume` only proposes; the user confirms before any `/dw-run`, `/dw-plan`, or `/dw-bugfix` fires.</critical>
74
+ <critical>Honor the requested intent: continue authorized work on resume; report only for status questions. Read `.dw/references/execution-contract.md` for assignment/session recovery and evidence invalidation.</critical>
81
75
 
82
76
  <critical>NEVER fabricate stale-detection results. If you didn't run `ls`, don't report the file exists or doesn't exist.</critical>
83
77
 
@@ -85,6 +79,6 @@ Set `last_resumed` to today's date (YYYY-MM-DD). Do not modify section content
85
79
 
86
80
  ## Inspired by
87
81
 
88
- This command adapts the session-handoff pattern from [`tech-leads-club/agent-skills/tlc-spec-driven`](https://github.com/tech-leads-club/agent-skills/tree/main/packages/skills-catalog/skills/(development)/tlc-spec-driven) (CC-BY-4.0, Felipe Rodrigues). Adaptations: routing heuristics map STATE.md content to specific `dw-*` commands; cross-reference with `.dw/spec/` and `.dw/bugfixes/` to detect staleness; never auto-execute.
82
+ This command adapts the session-handoff pattern from [`tech-leads-club/agent-skills/tlc-spec-driven`](https://github.com/tech-leads-club/agent-skills/tree/main/packages/skills-catalog/skills/(development)/tlc-spec-driven) (CC-BY-4.0, Felipe Rodrigues). Adaptations: routing heuristics map STATE.md content to specific `dw-*` commands; cross-reference with `.dw/spec/` and `.dw/bugfixes/` to detect staleness; intent-aware continuation after an authorized resume request.
89
83
 
90
84
  </system_instructions>
@@ -173,10 +173,11 @@ If MISSING > 0, the verdict suggests revisiting `/dw-plan tasks` to scope or `/d
173
173
  - Cyclomatic / cognitive complexity (with `dw-simplification` thresholds).
174
174
  - DRY violations (only when impact is meaningful — not premature deduplication).
175
175
  - Code smells (Fowler taxonomy).
176
+ - For frontend data flow, dependency or quality-tooling changes, read `dw-ui-discipline/references/frontend-engineering.md` and the module's quality baseline/TechSpec. Inspect API generation/validation, import boundaries, duplicated business behavior, unreachable code and newly widened ignores. Execute adopted checks under `dw-verify`; an absent optional tool is a proposal, not an automatic rejection. Investigate mutation survivors when analysis is in scope; do not approve from a score alone. Report changes to CI enforcement separately from local test results.
176
177
 
177
178
  5. **Test execution:**
178
- - Run the project's test command.
179
- - Verify coverage targets per TechSpec (80% services, 70% controllers).
179
+ - Use `dw-verify` to inspect valid test evidence; run missing or invalidated required checks.
180
+ - Verify the approved testing strategy and project-required thresholds; no universal coverage target.
180
181
 
181
182
  6. **Apply `dw-review-rigor`:**
182
183
  - De-duplicate findings.
@@ -184,7 +185,7 @@ If MISSING > 0, the verdict suggests revisiting `/dw-plan tasks` to scope or `/d
184
185
  - Verify intent before flagging (the linter already catches some — those don't repeat).
185
186
 
186
187
  7. **Final verification (`dw-verify`):**
187
- - Run dw-verify to produce a VERIFICATION REPORT (test + lint + build all GREEN).
188
+ - Use dw-verify to produce a VERIFICATION REPORT for applicable required checks, reusing equivalent evidence.
188
189
  - Without PASS, verdict cannot be APPROVED.
189
190
 
190
191
  8. **Security Gate (`dw-secure-audit` for TS/Python/C#/Rust):**
@@ -1,179 +1,33 @@
1
1
  <system_instructions>
2
- You are the task execution orchestrator. Two modes: execute ONE specific task, or execute ALL pending tasks in dependency order. Both modes apply the same task-level guarantees (atomic commit per task, mandatory tests, verify before commit, deviation handling).
2
+ # Execute approved tasks
3
3
 
4
- ## When to Use
5
- - Use `run` after `/dw-plan` has produced `tasks.md` + per-task files and the tasks are approved.
6
- - Use to execute a single targeted task during incremental development.
7
- - Do NOT use for bug fixes — `/dw-bugfix` handles those.
8
- - Do NOT use without an approved tasks breakdown — tasks files MUST exist.
4
+ Use `/dw-run` for all pending tasks, `/dw-run <task-id>` for one, and `/dw-run --resume` to continue. Inputs are the task ID and active `.dw/spec/<prd>/` directory. Tasks and dependencies must exist and be approved. For investigation without a plan use `/dw-bugfix`.
9
5
 
10
- ## Pipeline Position
11
- **Predecessor:** `/dw-plan` (with tasks approved) | **Successor:** `/dw-review` then `/dw-commit` + `/dw-generate-pr`
6
+ ## Assignment and preparation
12
7
 
13
- ## Modes
8
+ Read `.dw/references/execution-contract.md` and the relevant task file. Consume `execution-plan.json` when present; validate it with `node .dw/scripts/lib/workflow-contract.mjs validate <plan.json>`. Cross-check IDs/dependencies against tasks.md. Legacy schema 1.0 tasks without assignments execute locally. Never infer cross-tool authorization from installed CLIs alone.
14
9
 
15
- | Invocation | Behavior |
16
- |------------|----------|
17
- | `/dw-run` | **Default.** Executes ALL pending tasks from `tasks.md` in dependency order. Wave-based parallel dispatch for independent tasks. Atomic commit per task. After all complete, runs Level 2 review (PRD compliance). |
18
- | `/dw-run <task-id>` | Executes ONE specific task by ID (e.g., `1.0`, `2.3`). Includes Level 1 validation. Atomic commit on success. |
19
- | `/dw-run --resume` | Resumes an interrupted multi-task plan from where it stopped. Reads `.dw/spec/<prd>/active-session.md` if present; otherwise continues from first pending task. |
10
+ Respect applicable constitution decisions and the task's requirement IDs (`FR-N.M` / `RF-N.M`). Missing constitution uses non-blocking defaults. Inspect relevant source and project rules; query `.dw/intel/` only when useful and check freshness. Do not require a full repository map before every task.
20
11
 
21
- ## Inputs
12
+ Load skills by need: `dw-verify` for evidence, `dw-memory` for relevant durable decisions/checkpoints, `dw-testing-discipline` when designing tests, `dw-ui-discipline` for UI, `dw-llm-eval` for AI behavior, `dw-execute-phase` for dependency/plan checks. Use `dw-search-first` for new dependencies and `dw-minimalism` for a concrete abstraction/scope decision, not before each new function. Use `dw-simplification` for an explicitly scoped cleanup after verification. For explicitly requested TDD/test first/red-green-refactor, use `dw-testing-discipline/references/tdd-loop.md` for that task.
22
13
 
23
- | Variable | Description | Example |
24
- |----------|-------------|---------|
25
- | `{{TASK_ID}}` | Specific task identifier (optional — defaults to all pending) | `1.0`, `2.3`, `5.1` |
26
- | `{{PRD_PATH}}` | Path to PRD directory containing tasks (optional — auto-detect from active branch) | `.dw/spec/prd-invoice-export` |
14
+ ## Execution loop
27
15
 
28
- ## Complementary Skills
16
+ 1. Arm `/dw-report` once (idempotent, skipped when `DW_REPORT_AUTO=off`). Validate task coverage, dependency graph and acceptance checks using `dw-execute-phase`; repair internal inconsistencies before execution, ask only for missing material decisions.
17
+ 2. Choose the next task whose dependencies are complete on the execution branch. Independent tasks may run concurrently only with approved agents/worktrees and a defined integration path. One writer per worktree; coupled tasks stay sequential.
18
+ 3. Use the approved task executor/model/effort/agents. Local assignments execute in the current workflow. Cross-tool assignments invoke `/dw-codex-run`, `/dw-claude-run`, or `/dw-copilot-run` with the prepared task packet. The parent owns the objective throughout.
19
+ 4. Implement acceptance criteria with project patterns, tests from the approved strategy and necessary failure handling. When a worker returns, independently inspect diff and criteria; inspect/reuse valid evidence or run affected checks through `dw-verify`. Fix in-scope failures automatically, using the same external session when applicable.
20
+ 5. Commit only scoped task changes after valid verification; retain atomic commits and requirement IDs. Include task status in the commit, then record its SHA in the `Commit` column of tasks.md and run-log.md. Commit remaining bookkeeping in the next task or final metadata commit; never `git add .` across unrelated changes.
21
+ 6. Update `execution-state.json`, `active-session.md` and run-log.md with completed tasks, assignments, branch/worktree, exact sessions, verification and next step. Continue remaining approved tasks; `--checkpoint` explicitly requests a pause between waves.
22
+ 7. After all tasks, run `/dw-review` for requirement coverage and code quality. Correct in-scope findings automatically; user decisions are needed only for scope changes or deferrals. Full implementation workflows continue to applicable `/dw-qa` and fixes under `/dw-goal` or the invoking orchestrator. A single-task request ends after that task's validated handoff.
29
23
 
30
- When available under `./.agents/skills/`, these skills are invoked per task:
24
+ ## Resume and blockers
31
25
 
32
- - `dw-verify`: **ALWAYS** — before each task's commit, produces a Verification Report (test + lint + build all GREEN). Without PASS, no commit. The Iron Law of verification.
33
- - `dw-memory`: **ALWAYS** — reads workflow memory at task start; updates at task end with the promotion test (lessons that apply to next task get promoted to shared MEMORY.md).
34
- - Instincts (lazy): at task start, also load any high-confidence instinct (`.dw/memory/instincts/`, confidence ≥0.7) whose `trigger` matches the task — learned project conventions promoted by `/dw-learn`. Match by trigger only; never bulk-load the set.
35
- - `dw-execute-phase`: provides `plan-checker` (6-dimension goal-backward verification before any code is touched in plan mode) and `executor` (atomic commit + deviation handling) agents.
36
- - `dw-testing-discipline`: applies the placement doctrine, 6 agent guardrails, and 25 anti-patterns when adding tests during the task.
37
- - `dw-testing-discipline` test-first mode: ONLY when the task text or user explicitly says `TDD`, `test first`, or `red-green-refactor`, execute that task through `references/tdd-loop.md` (confirm public seams with the user → write ONE red test → run and observe red → implement minimum green → run and observe green → next slice; refactor only after the loop via `dw-simplification`). This is not the default `/dw-run` mode.
38
- - `dw-ui-discipline`: when the task touches UI, the 4 grounding questions must be answered before any visual decision lands.
39
- - `dw-llm-eval`: when the task touches AI feature code paths, the reference dataset + oracle ladder rules apply.
40
- - `dw-minimalism`: **before writing new code** — climb the YAGNI decision ladder (need it? reuse? stdlib? native? installed dep? one line?) at the active intensity, then write the minimum. Hands new dependencies to `dw-search-first`.
41
- - `vercel-react-best-practices`: when the task touches React/Next.js performance.
26
+ A resume request already authorizes continuation. Inspect saved state and actual worktree rather than asking “continue?” again. Keep completed tasks and approved assignments; validate dependencies and prior evidence. Recover missing session IDs only from task-specific logs with identity checks; otherwise reconstruct a new session in the same worktree without discarding changes. See execution-contract for cross-provider limitations.
42
27
 
43
- ## Constitution Gate
28
+ Missing dependency: finish its pending approved task first; ask only if it is outside the plan. Verification failure: diagnose, fix and rerun invalidated checks. Missing test framework: discover the configured runner before asking. Increased complexity: record a deviation and split/reorder within approved scope. New product behavior, architectural conflict or unapproved dependency: propose the material change and wait only on dependent work. Preserve checkpoints at a real impasse or user pause.
44
29
 
45
- <critical>BEFORE executing any task, check `.dw/constitution.md`. If MISSING, auto-install defaults via the v0.11 pattern. If PRESENT, the task's `Constitution Alignment` line (set during `/dw-plan` Stage 3) is consulted as the task executes — code must respect the claimed principles.</critical>
46
-
47
- ## Codebase Intelligence
48
-
49
- <critical>If `.dw/intel/` exists, query it via `/dw-intel` before implementation to align with existing patterns.</critical>
50
- - Per-task: `/dw-intel "patterns for <task topic>"` to surface relevant conventions.
51
-
52
- ## Mode 1: ONE task (`run <task-id>`)
53
-
54
- ### Prerequisites
55
- - `tasks.md` + per-task files exist in `.dw/spec/<prd>/`.
56
- - The target task's dependencies are completed (check `task.md` "Depends on" section).
57
-
58
- ### Behavior
59
-
60
- 1. **Read the task file:** `.dw/spec/<prd>/<task-id>_task.md`. Understand inputs, FRs covered, acceptance criteria, subtasks.
61
- 2. **Plan implementation:**
62
- - List files to create/modify.
63
- - Identify test additions per subtask.
64
- - Confirm dependencies (if missing, STOP and surface).
65
- 3. **Implement:**
66
- - Follow project patterns from `.dw/rules/` and `.dw/intel/`.
67
- - Apply complementary skills (UI gate, test discipline, etc.).
68
- - Mandatory unit tests for backend/services per testspec.
69
- - Match the testing framework specified in `.dw/rules/`.
70
- 4. **Validate (Level 1):**
71
- - Run the project's test command.
72
- - Check acceptance criteria from the task file.
73
- - Run `dw-verify` to produce the Verification Report (test + lint + build GREEN).
74
- - For interactive frontend, also validate real behavior via `dw-testing-discipline` Playwright recipes if regression risk is meaningful.
75
- 5. **Commit:**
76
- - Atomic commit message: `feat(<scope>): <task title> (#<task-id>)`.
77
- - Reference the FRs covered.
78
- - One task = one commit (unless the task explicitly has subtask milestones that earn separate commits).
79
- 6. **Update tasks.md:** set this task's `Status` to `Done` and write the short SHA (`git rev-parse --short HEAD`) into its `Commit` column. This is the only record linking a task to its diff — do not skip it.
80
- 7. **Report:** what was done, what tests were added, what was validated.
81
-
82
- ### STOP CONDITIONS
83
- - Dependencies not satisfied → ask user how to proceed.
84
- - Verification Report FAIL → do not commit; report what's broken.
85
- - Task scope creep detected mid-implementation → STOP and ask user to scope.
86
-
87
- ## Mode 2: ALL pending tasks (default `run`)
88
-
89
- ### Prerequisites
90
- - `tasks.md` + per-task files exist with declared dependencies.
91
- - `tasks-validation.md` shows PASS (or explicit override).
92
- - The branch is created: `feat/prd-<feature-slug>`.
93
-
94
- ### Behavior
95
-
96
- 1. **Plan check (via `dw-execute-phase/plan-checker` agent):**
97
- - 6-dimension goal-backward verification: are these tasks actually going to deliver what the PRD promises?
98
- - If FAIL on any dimension, STOP and report to user before any code is touched.
99
- 2. **Build dependency graph:**
100
- - Topological sort of tasks.
101
- - Identify independent tasks that can run in parallel waves.
102
- 3. **Wave-based parallel dispatch (via `dw-execute-phase/executor` agent):**
103
- - Each wave contains tasks with no inter-dependencies.
104
- - Execute waves serially; within a wave, tasks dispatch in parallel.
105
- - Per-task: same Level 1 flow as Mode 1 (implement → validate → atomic commit).
106
- 4. **Deviation handling:**
107
- - If a task encounters scope creep, STOP that task, surface to user.
108
- - If a task fails verification, the wave halts. No subsequent waves run until resolved.
109
- 5. **Checkpoint between waves:**
110
- - Print wave summary: tasks completed, commits, any deviations.
111
- - Continue automatically unless `--checkpoint` was passed (then wait for user OK).
112
- 6. **Final Level 2 review:**
113
- - After all tasks complete, automatically invoke `/dw-review` (the merged review command — runs both PRD compliance check and code quality review).
114
- - Present consolidated review report.
115
- - Interactive corrections cycle: review surfaces gaps → user decides to fix, defer, or accept.
116
-
117
- ### Output
118
-
119
- ```
120
- .dw/spec/<prd>/
121
- ├── active-session.md # written at checkpoint; consumed by --resume
122
- ├── run-log.md # per-wave execution log with commit SHAs
123
- └── review-consolidated.md # final L2+L3 review (from /dw-review)
124
- ```
125
-
126
- ## Mode 3: Resume (`run --resume`)
127
-
128
- ### Prerequisites
129
- - Previous `run` (Mode 2) was interrupted.
130
- - `active-session.md` exists in the current PRD's `.dw/spec/<prd>/` directory.
131
-
132
- ### Behavior
133
-
134
- 1. Read `active-session.md` to determine which task/wave the session stopped at.
135
- 2. Surface to user: "Resuming from wave N, task X.0. Previously completed: <list>. Continue?"
136
- 3. On confirmation, resume from the next pending task with the same Mode 2 behavior.
137
-
138
- If `active-session.md` doesn't exist but uncompleted tasks remain, treat as Mode 2 fresh start.
139
-
140
- ## Across all modes: deviation handling
141
-
142
- When implementation cannot proceed as planned:
143
-
144
- | Deviation | Action |
145
- |-----------|--------|
146
- | Task requires new dependency not in TechSpec | STOP. Suggest `/dw-plan techspec --update` to revise. |
147
- | Acceptance criterion is ambiguous | STOP. Ask user for clarification. |
148
- | Test framework decision missing | STOP. Use `dw-testing-discipline` placement doctrine to propose; ask for sign-off. |
149
- | Pattern from `.dw/rules/` doesn't fit cleanly | STOP. Surface the friction; propose either an ADR-justified deviation or a rules update. |
150
- | Hidden complexity emerges (task estimated 2h, looks like 8h) | STOP. Surface; either split the task via `/dw-plan tasks --update` or accept the delay with note. |
151
-
152
- ## Reporting
153
-
154
- After every run (Mode 1, 2, or 3 completion), print:
155
-
156
- - Tasks completed with commit SHAs.
157
- - Files touched count.
158
- - Tests added (unit + E2E if applicable).
159
- - Verification Report verdict per task.
160
- - For Mode 2: final consolidated review status.
161
- - For Mode 2: any deviations encountered and how they were resolved.
162
-
163
- ## Anti-patterns
164
-
165
- - Skipping `dw-verify` to "save time before commit" — produces commits that don't build.
166
- - Running tasks without dependency satisfaction — produces commits that won't work in isolation.
167
- - Letting wave-based parallel run without watching for deviations — silent scope creep compounds.
168
- - Committing multiple tasks in one commit — breaks bisect, breaks revert granularity.
169
- - Skipping the final Level 2 review in Mode 2 — ships features that don't fully match the PRD.
170
-
171
- ## Final Guidelines
172
-
173
- - Atomic commits are non-negotiable. One task = one commit (or one subtask-bundle if explicit).
174
- - Tests are mandatory per the testing strategy section of the TechSpec.
175
- - Verification Report PASS is the gate, not the goal — never weaken assertions to make tests pass.
176
- - Deviation surfacing is a feature, not a bug. Stop and ask. The user prefers an interruption to a wrong implementation.
177
- - For multi-day plans, `--resume` is your friend. Don't restart from zero.
30
+ ## Completion report
178
31
 
32
+ Return completed task IDs and commit SHAs, affected files, valid checks, unresolved findings and next step. `/dw-review` writes `<prd-path>/QA/review-consolidated.md`. Durable state and logs remain in the spec directory; worker audit/session files stay outside disposable worktrees. A passed gate proves its scope only; never weaken assertions or hide a blocking finding. Merge, push and publication require applicable authorization.
179
33
  </system_instructions>
@@ -24,7 +24,14 @@ You are the dev-workflow skill and agent health auditor.
24
24
 
25
25
  `SKILL.md` should be a short router/protocol. Long rules, examples, palettes, recipes, services, and assets must stay in references/assets/rules/recipes and be loaded lazily.
26
26
 
27
+ ## Discovery and context budgets
28
+
29
+ Check managed instructions ≤6000 bytes, skill entrypoints ≤8000 bytes and descriptions ≤250 characters. In package source run `npm run validate`; in consumers inspect installed files. Distinguish discovery metadata from on-demand bodies. Flag unconditional reference loading and broad overlapping triggers, not every platform copy as duplicate live context. Check routed reference paths and preserve attribution/Structured Return when compacting. Model candidates may be stale: propose updates to routing.json after verifying availability; never overwrite owner choices silently.
30
+
27
31
  ## Output
32
+
33
+ When `.dw/config/routing-defaults.json` exists, compare its current candidates with the owner's `.dw/config/routing.json`. Report relevant differences and validate proposed models/capabilities before adoption. Different values can be intentional; do not treat them as failed migration or overwrite them automatically. Approved task assignments take precedence over either candidate file.
34
+
28
35
  Return a concise health report with a structured-return section. Do not delete files.
29
36
 
30
37
  Include:
@@ -38,7 +38,7 @@ Keep only the 3 most recent snapshots (remove older ones) to avoid buildup.
38
38
  Before updating, capture the installed version so you can report the delta:
39
39
 
40
40
  ```bash
41
- node -e "try { console.log(require('@brunosps00/dev-workflow/package.json').version) } catch(e) { console.log('not-cached-locally') }" 2>/dev/null
41
+ node -e 'try { const s = JSON.parse(require("node:fs").readFileSync(".dw/install-state.json", "utf8")); console.log(s.version || "unknown"); } catch { console.log("unknown"); }'
42
42
  ```
43
43
 
44
44
  ### 2. Detect Language of Installed Commands (Required)
@@ -71,7 +71,7 @@ Rules:
71
71
 
72
72
  ### 3. Run the Update (Required)
73
73
 
74
- <critical>Use `npx -y @brunosps00/dev-workflow@latest` to FORCE fetching the latest version from npm (bypass local cache). Pass `--lang=<DETECTED_LANG>` to skip the interactive prompt.</critical>
74
+ <critical>Use `npx -y @brunosps00/dev-workflow@latest` to select the version tagged `latest` on npm. Pass `--lang=<DETECTED_LANG>` to skip the interactive prompt.</critical>
75
75
 
76
76
  ```bash
77
77
  npx -y @brunosps00/dev-workflow@latest update --lang=$DETECTED_LANG
@@ -90,9 +90,23 @@ If the update fails (network error, permission, package unavailable): report the
90
90
  ### 4. Capture New Version
91
91
 
92
92
  ```bash
93
- node -e "console.log(require('@brunosps00/dev-workflow/package.json').version)" 2>/dev/null
93
+ node -e 'const s = JSON.parse(require("node:fs").readFileSync(".dw/install-state.json", "utf8")); if (s.package !== "@brunosps00/dev-workflow" || !s.version) process.exit(1); console.log(s.version);'
94
94
  ```
95
95
 
96
+ ### Upgrade compatibility checks
97
+
98
+ Read the refreshed `.dw/commands/dw-update.md` after the CLI completes. Use `.dw/install-state.json` and the CLI's `Installed version` output for the version delta: an `npx` package need not be resolvable from the consumer's `node_modules`. A missing or invalid new install state is a failed verification; do not claim the update succeeded.
99
+
100
+ For an upgrade from before 2.3.0 (or an unknown legacy version):
101
+
102
+ - Verify `.dw/references/execution-contract.md`, `.dw/scripts/lib/workflow-contract.mjs` and `.dw/templates/frontend-quality-template.md` were delivered. Managed commands, skills, wrappers and instruction blocks refresh through normal `update`; no `--force` is needed.
103
+ - Compare `.dw/config/routing.json` with the newly managed `.dw/config/routing-defaults.json` during `/dw-skill-health`. Keep active owner choices and approved assignments. Propose specific model/effort changes after checking capabilities; updating scaffold files alone does not authorize changing providers.
104
+ - Preserve `.dw/spec/`, `.dw/goals/`, `.dw/STATE.md`, execution/session state, rules and `.dw/templates/overrides/`. Schema 1.0 plans remain valid and local by default. For an active `execution-plan.json`, run `node .dw/scripts/lib/workflow-contract.mjs validate <plan-path>`; report invalid plans without rewriting approvals or resetting progress. New task plans use schema 1.1.
105
+ - Inspect task template overrides for old schemas/routing rules and report any differences that shadow the new managed templates; do not replace owner overrides automatically.
106
+ - If frontend quality documentation is relevant and missing, have `/dw-analyze-project` add the baseline to the existing module rules, scoped to that documentation. Preserve existing gates; propose tooling separately. Skip this action for `update files only`.
107
+
108
+ Do not force-convert active work or globally regenerate product documentation to adopt the release. Record compatibility findings and retain session reload as the final step.
109
+
96
110
  ### 5. Report Result
97
111
 
98
112
  Present to the user:
@@ -156,7 +170,7 @@ E.g.: `npx -y @brunosps00/dev-workflow@0.4.5 update --lang=en`
156
170
  ## Notes
157
171
 
158
172
  - `npx -y` skips the "OK to install" prompt when the package is not cached
159
- - `@latest` bypasses the npx cache and pulls the `latest` tag from the registry
173
+ - `@latest` selects the registry tag; verify the installed result rather than assuming a local package lookup identifies the executed CLI
160
174
  - `--lang=...` skips the interactive language prompt; the value comes from the auto-detection in step 2
161
175
  - This command does NOT update the user project's Node dependencies — only the dev-workflow scaffold
162
176