@brunosps00/dev-workflow 1.7.1 → 2.1.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 (114) hide show
  1. package/.claude-plugin/marketplace.json +1 -0
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +305 -0
  4. package/README.md +7 -5
  5. package/lib/agents.js +6 -1
  6. package/lib/build-plugin.js +4 -1
  7. package/lib/constants.js +4 -2
  8. package/lib/init.js +14 -0
  9. package/lib/install-state.js +8 -4
  10. package/lib/validate.js +21 -0
  11. package/package.json +2 -1
  12. package/scaffold/agents/core/dw-build-fixer.md +0 -1
  13. package/scaffold/agents/core/dw-code-explorer.md +0 -1
  14. package/scaffold/agents/core/dw-code-reviewer.md +0 -1
  15. package/scaffold/agents/core/dw-planner.md +0 -1
  16. package/scaffold/agents/core/dw-test-author.md +0 -1
  17. package/scaffold/agents/csharp/dw-csharp-reviewer.md +0 -1
  18. package/scaffold/agents/csharp/dw-dotnet-build-fixer.md +0 -1
  19. package/scaffold/agents/frontend/dw-qa-runner.md +0 -1
  20. package/scaffold/agents/python/dw-python-build-fixer.md +0 -1
  21. package/scaffold/agents/python/dw-python-reviewer.md +0 -1
  22. package/scaffold/agents/rust/dw-rust-build-fixer.md +0 -1
  23. package/scaffold/agents/rust/dw-rust-reviewer.md +0 -1
  24. package/scaffold/agents/security/dw-security-reviewer.md +0 -1
  25. package/scaffold/agents/security/dw-silent-failure-hunter.md +0 -1
  26. package/scaffold/agents/typescript/dw-typescript-build-fixer.md +0 -1
  27. package/scaffold/agents/typescript/dw-typescript-reviewer.md +0 -1
  28. package/scaffold/config/routing.json +60 -0
  29. package/scaffold/en/commands/dw-brainstorm.md +12 -8
  30. package/scaffold/en/commands/dw-bugfix.md +4 -2
  31. package/scaffold/en/commands/dw-claude-run.md +5 -1
  32. package/scaffold/en/commands/dw-codex-run.md +5 -1
  33. package/scaffold/en/commands/dw-dockerize.md +14 -7
  34. package/scaffold/en/commands/dw-generate-pr.md +13 -0
  35. package/scaffold/en/commands/dw-new-project.md +14 -13
  36. package/scaffold/en/commands/dw-plan.md +2 -2
  37. package/scaffold/en/commands/dw-refactor.md +1 -0
  38. package/scaffold/en/commands/dw-review.md +33 -2
  39. package/scaffold/en/commands/dw-run.md +2 -1
  40. package/scaffold/en/commands/dw-triage.md +220 -0
  41. package/scaffold/en/templates/idea-onepager.md +28 -0
  42. package/scaffold/en/templates/project-onepager.md +6 -5
  43. package/scaffold/en/templates/task-template.md +2 -1
  44. package/scaffold/en/templates/tasks-template.md +11 -8
  45. package/scaffold/en/templates/triage-needs-info-template.md +23 -0
  46. package/scaffold/en/templates/triage-out-of-scope-template.md +36 -0
  47. package/scaffold/en/templates/triage-record-template.md +88 -0
  48. package/scaffold/pt-br/commands/dw-autopilot.md +81 -81
  49. package/scaffold/pt-br/commands/dw-brainstorm.md +12 -9
  50. package/scaffold/pt-br/commands/dw-bugfix.md +4 -2
  51. package/scaffold/pt-br/commands/dw-claude-run.md +23 -19
  52. package/scaffold/pt-br/commands/dw-codex-run.md +22 -18
  53. package/scaffold/pt-br/commands/dw-context-budget.md +10 -10
  54. package/scaffold/pt-br/commands/dw-copilot-run.md +20 -20
  55. package/scaffold/pt-br/commands/dw-dockerize.md +106 -99
  56. package/scaffold/pt-br/commands/dw-find-skills.md +52 -52
  57. package/scaffold/pt-br/commands/dw-generate-pr.md +13 -0
  58. package/scaffold/pt-br/commands/dw-goal.md +41 -41
  59. package/scaffold/pt-br/commands/dw-harness-audit.md +11 -11
  60. package/scaffold/pt-br/commands/dw-intel.md +70 -70
  61. package/scaffold/pt-br/commands/dw-learn.md +24 -24
  62. package/scaffold/pt-br/commands/dw-new-project.md +93 -92
  63. package/scaffold/pt-br/commands/dw-open-design.md +53 -53
  64. package/scaffold/pt-br/commands/dw-opportunities.md +45 -45
  65. package/scaffold/pt-br/commands/dw-pause.md +39 -39
  66. package/scaffold/pt-br/commands/dw-plan.md +3 -3
  67. package/scaffold/pt-br/commands/dw-refactor.md +31 -30
  68. package/scaffold/pt-br/commands/dw-resume.md +22 -22
  69. package/scaffold/pt-br/commands/dw-review.md +33 -2
  70. package/scaffold/pt-br/commands/dw-run.md +2 -1
  71. package/scaffold/pt-br/commands/dw-skill-health.md +10 -10
  72. package/scaffold/pt-br/commands/dw-subtask-complete.md +4 -4
  73. package/scaffold/pt-br/commands/dw-subtask-start.md +4 -4
  74. package/scaffold/pt-br/commands/dw-triage.md +220 -0
  75. package/scaffold/pt-br/templates/bugfix-summary-template.md +20 -20
  76. package/scaffold/pt-br/templates/concerns-template.md +20 -20
  77. package/scaffold/pt-br/templates/idea-onepager.md +28 -0
  78. package/scaffold/pt-br/templates/project-onepager.md +35 -34
  79. package/scaffold/pt-br/templates/state-template.md +13 -13
  80. package/scaffold/pt-br/templates/task-template.md +2 -1
  81. package/scaffold/pt-br/templates/tasks-template.md +11 -8
  82. package/scaffold/pt-br/templates/triage-needs-info-template.md +23 -0
  83. package/scaffold/pt-br/templates/triage-out-of-scope-template.md +36 -0
  84. package/scaffold/pt-br/templates/triage-record-template.md +88 -0
  85. package/scaffold/scripts/hooks/git-guardrails.mjs +41 -24
  86. package/scaffold/skills/docker-compose-recipes/SKILL.md +2 -4
  87. package/scaffold/skills/docker-compose-recipes/references/compose-composition.md +2 -2
  88. package/scaffold/skills/docker-compose-recipes/references/env-conventions.md +16 -9
  89. package/scaffold/skills/docker-compose-recipes/references/healthcheck-patterns.md +0 -1
  90. package/scaffold/skills/docker-compose-recipes/references/prod-vs-dev.md +7 -2
  91. package/scaffold/skills/docker-compose-recipes/services/elasticsearch.yml +3 -3
  92. package/scaffold/skills/docker-compose-recipes/services/meilisearch.yml +2 -2
  93. package/scaffold/skills/docker-compose-recipes/services/minio.yml +8 -4
  94. package/scaffold/skills/docker-compose-recipes/services/mysql.yml +4 -4
  95. package/scaffold/skills/docker-compose-recipes/services/postgres.yml +2 -2
  96. package/scaffold/skills/docker-compose-recipes/services/rabbitmq.yml +3 -3
  97. package/scaffold/skills/docker-compose-recipes/services/typesense.yml +3 -3
  98. package/scaffold/skills/dw-cli-run/SKILL.md +42 -38
  99. package/scaffold/skills/dw-cli-run/references/dispatch-tuning.md +85 -0
  100. package/scaffold/skills/dw-debug-protocol/SKILL.md +2 -0
  101. package/scaffold/skills/dw-debug-protocol/references/six-step-triage.md +60 -1
  102. package/scaffold/skills/dw-execute-phase/SKILL.md +4 -2
  103. package/scaffold/skills/dw-execute-phase/agents/executor.md +4 -2
  104. package/scaffold/skills/dw-execute-phase/agents/plan-checker.md +9 -7
  105. package/scaffold/skills/dw-execute-phase/references/atomic-commits.md +12 -8
  106. package/scaffold/skills/dw-execute-phase/references/plan-verification.md +6 -4
  107. package/scaffold/skills/dw-execute-phase/references/wave-coordination.md +14 -14
  108. package/scaffold/skills/dw-grilling/SKILL.md +17 -7
  109. package/scaffold/skills/dw-grilling/references/decision-tree.md +30 -7
  110. package/scaffold/skills/dw-simplification/references/deep-modules.md +50 -0
  111. package/scaffold/skills/dw-testing-discipline/SKILL.md +3 -1
  112. package/scaffold/skills/dw-testing-discipline/references/tdd-loop.md +83 -0
  113. package/scaffold/skills/docker-compose-recipes/services/mailhog.yml +0 -23
  114. package/scaffold/skills/docker-compose-recipes/services/postgres-pgvector.yml +0 -31
@@ -2,7 +2,6 @@
2
2
  name: dw-rust-build-fixer
3
3
  description: Fix Rust cargo check/test/clippy failures with minimal changes.
4
4
  tools: Read, Write, Edit, Bash, Grep, Glob
5
- model: sonnet
6
5
  mode: subagent
7
6
  ---
8
7
 
@@ -2,7 +2,6 @@
2
2
  name: dw-rust-reviewer
3
3
  description: Review Rust changes for ownership, error handling, concurrency, unsafe, and API design risks.
4
4
  tools: Read, Grep, Glob, Bash
5
- model: sonnet
6
5
  mode: subagent
7
6
  ---
8
7
 
@@ -2,7 +2,6 @@
2
2
  name: dw-security-reviewer
3
3
  description: Review auth, authorization, secrets, input handling, uploads, SQL, SSRF, XSS, and supply-chain risk.
4
4
  tools: Read, Grep, Glob, Bash
5
- model: sonnet
6
5
  mode: subagent
7
6
  ---
8
7
 
@@ -2,7 +2,6 @@
2
2
  name: dw-silent-failure-hunter
3
3
  description: Find swallowed errors, dangerous fallbacks, lost stack traces, and missing error propagation.
4
4
  tools: Read, Grep, Glob, Bash
5
- model: sonnet
6
5
  mode: subagent
7
6
  ---
8
7
 
@@ -2,7 +2,6 @@
2
2
  name: dw-typescript-build-fixer
3
3
  description: Fix TypeScript and JavaScript build/type errors with minimal changes.
4
4
  tools: Read, Write, Edit, Bash, Grep, Glob
5
- model: sonnet
6
5
  mode: subagent
7
6
  ---
8
7
 
@@ -2,7 +2,6 @@
2
2
  name: dw-typescript-reviewer
3
3
  description: Review TypeScript and JavaScript changes for type safety, async correctness, and web or Node risks.
4
4
  tools: Read, Grep, Glob, Bash
5
- model: sonnet
6
5
  mode: subagent
7
6
  ---
8
7
 
@@ -0,0 +1,60 @@
1
+ {
2
+ "_note": "Dispatch routing for the CLI runners (/dw-claude-run, /dw-codex-run) via the dw-cli-run skill. Maps a task's Conventional-Commit type to a tier, and a tier to a concrete model + effort per brand. Seeded once on init and NEVER overwritten on update — model availability differs per account, so this file is yours to edit. Verify the model ids against `claude --help` / `codex --help` before trusting them; the shipped values are conservative defaults, not a guarantee that your account has access.",
3
+ "schema_version": "1.0",
4
+
5
+ "brands": {
6
+ "claude": { "detect": "claude --version" },
7
+ "codex": { "detect": "codex --version" }
8
+ },
9
+
10
+ "tiers": {
11
+ "light": {
12
+ "_use": "mechanical, low-ambiguity work; the answer is obvious and the diff is small",
13
+ "claude": { "model": "haiku", "effort": "low" },
14
+ "codex": { "model": "gpt-5.4-mini", "effort": "low" }
15
+ },
16
+ "standard": {
17
+ "_use": "normal feature and fix work",
18
+ "claude": { "model": "sonnet", "effort": "medium" },
19
+ "codex": { "model": "gpt-5.3-codex", "effort": "medium" }
20
+ },
21
+ "heavy": {
22
+ "_use": "architectural, security-sensitive, or wide-blast-radius work",
23
+ "claude": { "model": "opus", "effort": "high" },
24
+ "codex": { "model": "gpt-5.5", "effort": "high" }
25
+ }
26
+ },
27
+
28
+ "by_commit_type": {
29
+ "_note": "The task's type is already declared in tasks.md and in the atomic commit subject — no new inference needed.",
30
+ "chore": "light",
31
+ "docs": "light",
32
+ "style": "light",
33
+ "ci": "light",
34
+ "test": "standard",
35
+ "fix": "standard",
36
+ "feat": "standard",
37
+ "build": "standard",
38
+ "refactor": "standard",
39
+ "perf": "heavy"
40
+ },
41
+
42
+ "escalate_on_surface": {
43
+ "_note": "If the task's fence touches any of these, override the type-derived tier upward. Match against file paths and the task title.",
44
+ "tier": "heavy",
45
+ "patterns": ["auth", "session", "token", "credential", "migration", "payment", "billing", "invoice", "tenant", "crypto", "permission"]
46
+ },
47
+
48
+ "validation": {
49
+ "_note": "The worker never signs off on its own exam. Cross-brand is the default because a second vendor fails differently.",
50
+ "cross_brand": "preferred",
51
+ "degrade": "When only one brand is installed, validate in a SEPARATE dispatch at a different tier — never reuse the executing session.",
52
+ "acceptance_score": 9
53
+ },
54
+
55
+ "defaults": {
56
+ "_note": "Applied to every dispatch unless the prompt names a capability that needs otherwise.",
57
+ "no_mcp": true,
58
+ "read_only_skips_worktree": true
59
+ }
60
+ }
@@ -181,7 +181,7 @@ At the end, always leave the user in one of these situations:
181
181
  - With better questions to decide
182
182
  - With a next workspace command to follow
183
183
  - With the one-pager at `.dw/spec/ideas/<slug>.md` (if **onepager** mode fired)
184
- - With the research report at `~/Documents/<Topic>_Research_<date>/` (if **research** mode fired)
184
+ - With the research report at `.dw/spec/<prd-slug>/research/<topic-slug>-<YYYYMMDD>/research.md` when a PRD is active, `.dw/spec/ideas/<idea-slug>-research-<YYYYMMDD>/research.md` when an idea one-pager is active, or `.dw/spec/research/<topic-slug>-<YYYYMMDD>/research.md` for standalone research (if **research** mode fired)
185
185
  - With the refactor plan at `<target>/refactor-plan.md` (if **refactor-audit** mode fired)
186
186
  - With canonical glossary entries in `.dw/domain/**` and an aligned idea one-pager (if **grill** ran with authorization)
187
187
  - With a runnable throwaway prototype + verdict template (if **prototype** mode fired)
@@ -237,7 +237,7 @@ Complementary skill **`dw-source-grounding`**: **ALWAYS** — apply Detect → F
237
237
 
238
238
  ### Output
239
239
 
240
- Saved to `~/Documents/<Topic>_Research_<YYYYMMDD>/`. Mandatory sections:
240
+ Save `research.md` inside the repo: `.dw/spec/<prd-slug>/research/<topic-slug>-<YYYYMMDD>/research.md` when a PRD is active, `.dw/spec/ideas/<idea-slug>-research-<YYYYMMDD>/research.md` when an idea one-pager is active, or `.dw/spec/research/<topic-slug>-<YYYYMMDD>/research.md` for standalone research. Mandatory sections:
241
241
  1. Executive Summary (200-400 words)
242
242
  2. Introduction (scope, methodology, assumptions)
243
243
  3. Main Analysis (4-8 findings, 600-2000 words each, all cited)
@@ -364,9 +364,12 @@ When these signals appear during auto-dispatch, **recommend** Grill in one line
364
364
 
365
365
  ### The session (after authorization)
366
366
 
367
- 1. **Build the decision tree first.** Before the first question, inspect project facts — current PRDs/TechSpecs,
368
- `.dw/rules/`, `.dw/intel/` (via `/dw-intel`), `.dw/constitution.md`, `.dw/domain/**`, and recent git activity —
369
- and build a decision tree **ordered by dependencies** (never ask a downstream decision before its blocker).
367
+ 1. **Resume or build the decision tree first.** Before the first question, read the active one-pager for an
368
+ existing **Decision Map**. If present, resume from its `Depends on:` graph, `State` values, explicit
369
+ **Frontier**, and `Decision Fog`; do not re-ask nodes already `resolved`. If no map exists, inspect project
370
+ facts — current PRDs/TechSpecs, `.dw/rules/`, `.dw/intel/` (via `/dw-intel`), `.dw/constitution.md`,
371
+ `.dw/domain/**`, and recent git activity — and build a decision tree **ordered by dependencies** (never ask a
372
+ downstream decision before its blocker).
370
373
  2. **Ask exactly one unresolved decision per interaction and wait.** Each question includes: evidence when
371
374
  available (with source), the recommended answer, a short rationale, and a meaningful alternative/trade-off.
372
375
  Follow `dw-grilling` (`references/interview-loop.md`, `references/decision-tree.md`).
@@ -403,9 +406,10 @@ reads and links `.dw/domain/**` and must preserve it, never regenerate it.
403
406
 
404
407
  ### Aligned handoff — the idea one-pager (schema `1.1`)
405
408
 
406
- Grill extends `.dw/spec/ideas/<slug>.md` to schema `1.1`, adding: **Resolved Decisions** (each with the recommended
407
- answer, the user's choice, and the alternative rejected), **Evidence** (facts discovered with sources),
408
- **Canonical Vocabulary** (links into `.dw/domain/**`), **Remaining Decisions**, and **Alignment State**.
409
+ Grill extends `.dw/spec/ideas/<slug>.md` to schema `1.1`, adding: **Decision Map** (nodes, `Depends on:`, `State`,
410
+ explicit **Frontier**, and `Decision Fog` for unclear future nodes), **Resolved Decisions** (each with the
411
+ recommended answer, the user's choice, and the alternative rejected), **Evidence** (facts discovered with
412
+ sources), **Canonical Vocabulary** (links into `.dw/domain/**`), **Remaining Decisions**, and **Alignment State**.
409
413
 
410
414
  Set `status: aligned` **only when all** of these hold: every dependency branch is resolved, glossary/code
411
415
  contradictions are closed, no blocking open decision remains, AND the user **explicitly confirms** shared
@@ -38,7 +38,7 @@
38
38
 
39
39
  When available in the project at `./.agents/skills/`, use these skills as contextual support without replacing this command:
40
40
 
41
- - `dw-debug-protocol`: **ALWAYS** — runs the bug through the six-step triage (Reproduce → Localize → Reduce → Fix Root Cause → Guard → Verify End-to-End). Stop-the-line discipline; root-cause over symptom; regression test committed in the same atomic commit. Non-reproducible bugs follow the instrument-first sub-protocol — no guess fixes without explicit acknowledgement.
41
+ - `dw-debug-protocol`: **ALWAYS** — runs the bug through the six-step triage (Reproduce → Localize → Reduce → Fix Root Cause → Guard → Verify End-to-End). Stop-the-line discipline; root-cause over symptom; regression test committed in the same atomic commit. For non-trivial bugs, or after a first fix fails, Step 1 must establish a red-capable feedback loop before theorizing. Non-reproducible bugs follow the instrument-first sub-protocol — no guess fixes without explicit acknowledgement.
42
42
  - `dw-verify`: **ALWAYS** — in Direct mode, invoked before committing the fix. The VERIFICATION REPORT must show the original bug symptom no longer reproduces (not just that tests pass).
43
43
  - `vercel-react-best-practices`: use when the bug affects React/Next.js and there is suspicion of render, hydration, fetching, waterfall, bundle, or re-render issues
44
44
  - `dw-testing-discipline`: use when the fix requires a reproducible E2E/retest flow in a web app — `references/playwright-recipes.md` for recipes, core rules + 6 agent guardrails for any test the fix adds, flaky-discipline if the bug surfaces intermittently.
@@ -214,6 +214,7 @@
214
214
  - Stack traces
215
215
  - Recently modified files
216
216
  - If the bug is UI-related or depends on browser flow, supplement collection with `dw-testing-discipline` (playwright-recipes + three-workflow-patterns to pick the right verification mode)
217
+ - For non-trivial bugs, or when the first fix attempt failed, build the `dw-debug-protocol` red-capable feedback loop before proposing a cause: one loop command/artifact, deterministic enough, fast, agent-runnable, and observed red. If no agent-runnable loop is possible, record attempts and ask the user for the missing artifact/access with the HITL template from `references/six-step-triage.md`.
217
218
 
218
219
  ### 3. Clarification Questions (MANDATORY - EXACTLY 3)
219
220
 
@@ -384,7 +385,7 @@
384
385
  1. Discover the next `NNN` (see File Locations section).
385
386
  2. Create `.dw/bugfixes/NNN-<slug>/` if not yet created in step 5.0.
386
387
  3. Write `TASK.md` with the triage, clarifications, root cause, and the approved plan as executed (use `.dw/templates/bugfix-template.md` as the base structure).
387
- 4. Write `fix-report.md` with the verbatim `dw-verify` VERIFICATION REPORT plus the before/after reproduction trace.
388
+ 4. Write `fix-report.md` with the verbatim `dw-verify` VERIFICATION REPORT plus the before/after reproduction trace. The report MUST include `Loop command before fix` and `Loop command after fix` (or the exact HITL blocker, attempts made, and artifact/access requested when no loop was possible).
388
389
  5. Write `SUMMARY.md` using `.dw/templates/bugfix-summary-template.md`. Fill in slug, date, status `Fixed`, severity, related_concerns (from step 1.5), Symptom (verbatim), Root Cause (one sentence), Resolution (2-4 bullets), Files Touched, Verification, Related, Followups.
389
390
  6. If the fix touched a concern listed in `.dw/rules/concerns.md`, append a line to that concern's row's `Last incident` column (or add a new row under Known Bug History) — preserve hand-written entries between `<!-- preserved:start -->` markers.
390
391
  7. Report paths of all three files in chat before the commit step.
@@ -494,6 +495,7 @@
494
495
  - [ ] **Maximum 5 affected files**
495
496
  - [ ] **No migrations**
496
497
  - [ ] **Test task included (correct project framework)**
498
+ - [ ] **Non-trivial bug loop recorded: command before fix + command after fix, or HITL blocker with attempts + requested artifact/access**
497
499
  - [ ] Awaiting approval before executing
498
500
  - [ ] **`.dw/bugfixes/NNN-<slug>/{TASK,fix-report,SUMMARY}.md` written after verify PASS**
499
501
 
@@ -13,7 +13,11 @@ session**, score the delivery 0–10, escalate on failure, and **STOP for the ga
13
13
  |---|---|
14
14
  | `DISPATCH` | `UUID=$(cat /proc/sys/kernel/random/uuid); cd <WORKTREE> && claude -p --session-id "$UUID" --model <MODEL> --effort <EFFORT> --output-format stream-json --include-partial-messages --verbose --dangerously-skip-permissions "$(cat <PROMPT>)" </dev/null > <AUDIT>/<slug>.log 2>&1` |
15
15
  | `STREAM` | `--output-format stream-json --include-partial-messages --verbose` (`--verbose` is **required** with `stream-json` in `-p` mode) |
16
- | `AUTO` | `--dangerously-skip-permissions` (headless auto-approve; justified because the worktree is isolated). Read-only/analysis: drop it and pass `--permission-mode plan` (or restrict `--allowedTools`). |
16
+ | `MODEL` | `--model <MODEL>` — `opus` · `sonnet` · `haiku` · `fable`, or a full id (`claude-opus-5`) |
17
+ | `EFFORT` | `--effort <EFFORT>` — `low` · `medium` · `high` · `xhigh` · `max` |
18
+ | `AUTO` | `--dangerously-skip-permissions` (headless auto-approve for a **WRITE** dispatch; justified because the worktree is isolated) |
19
+ | `AUTO_READONLY` | `--permission-mode plan` (optionally `--allowedTools <list>`). Never combine with `AUTO`. |
20
+ | `NO_MCP` | `--strict-mcp-config` with no `--mcp-config` → boots zero MCP servers |
17
21
  | `RESUME <id>` | `cd <WORKTREE> && claude --resume "$UUID" -p --effort <EFFORT> --output-format stream-json --include-partial-messages --verbose --dangerously-skip-permissions "$(cat <FOLLOWUP_PROMPT>)" </dev/null >> <AUDIT>/<slug>.log 2>&1` |
18
22
  | `RESUME_LAST` | `claude -c -p …` (continue the most recent conversation in this cwd) |
19
23
  | `SESSION_ID` | **FIXED by you** — you pass `--session-id "$UUID"` on the first run, so the id is known up front. Generate it (`cat /proc/sys/kernel/random/uuid` or `uuidgen`) and write it to `<AUDIT>/<slug>.session` BEFORE/at dispatch. No stream-scraping needed — Claude is the easy case. |
@@ -13,7 +13,11 @@ the delivery 0–10, escalate on failure, and **STOP for the gate**.
13
13
  |---|---|
14
14
  | `DISPATCH` | `cd <WORKTREE> && codex exec --skip-git-repo-check -m <MODEL> --config model_reasoning_effort="<EFFORT>" --dangerously-bypass-approvals-and-sandbox --json -o <AUDIT>/<slug>.last.md "$(cat <PROMPT>)" </dev/null > <AUDIT>/<slug>.log 2>&1` |
15
15
  | `STREAM` | `--json` (JSONL events) |
16
- | `AUTO` | `--dangerously-bypass-approvals-and-sandbox` (no sandbox + no approvals = full access **with network** so the CLI can run the gate; justified because the worktree is isolated). Edits without a network gate: `--sandbox workspace-write --full-auto`. Read-only/analysis: `--sandbox read-only` (drop `--full-auto`). |
16
+ | `MODEL` | `-m <MODEL>` — `gpt-5.5` · `gpt-5.3-codex` · `gpt-5.4` · `gpt-5.3-codex-spark` · `gpt-5.4-mini` |
17
+ | `EFFORT` | `--config model_reasoning_effort="<EFFORT>"` — `low` · `medium` · `high` · `xhigh` |
18
+ | `AUTO` | `--dangerously-bypass-approvals-and-sandbox` (no sandbox + no approvals = full access **with network** so the CLI can run the gate; **WRITE** dispatch only, justified because the worktree is isolated). Edits without a network gate: `--sandbox workspace-write --full-auto`. |
19
+ | `AUTO_READONLY` | `--sandbox read-only` (drop `--full-auto`). Never combine with `AUTO`. |
20
+ | `NO_MCP` | `-c mcp_servers='{}'` → boots zero MCP servers, keeps auth and the rest of `config.toml`. Blunter alternative: `--ignore-user-config` (also drops model defaults — then `MODEL` + `EFFORT` are mandatory). |
17
21
  | `RESUME <id>` | `cd <WORKTREE> && codex exec resume <THREAD_ID> --skip-git-repo-check --dangerously-bypass-approvals-and-sandbox --json "$(cat <FOLLOWUP_PROMPT>)" </dev/null >> <AUDIT>/<slug>.log 2>&1` |
18
22
  | `RESUME_LAST` | `codex exec resume --last …` (filters by cwd = the worktree) |
19
23
  | `SESSION_ID` | Codex has **no flag to fix** the id → **capture** the thread id from the first run's stream: `grep -oE '"thread_id":"[^"]*"' <AUDIT>/<slug>.log \| head -1` (from the `thread.started` event) → write to `<AUDIT>/<slug>.session`. |
@@ -129,10 +129,12 @@ Each option lists final-image-size estimate, attack-surface notes, debug-ability
129
129
 
130
130
  Present the services detected in Phase 0.3 as a checklist. The user can:
131
131
  - **Accept** — include all detected services in `docker-compose.dev.yml`
132
- - **Add** — include additional services they want for dev (e.g., MailHog if SMTP is used in app code, Jaeger if OTel is used)
132
+ - **Add** — include additional services they want for dev (e.g., Mailpit if SMTP is used in app code, Jaeger if OTel is used)
133
133
  - **Remove** — drop a detected service (e.g., they have managed Postgres in dev too)
134
134
 
135
- Always offer MailHog if any email-sending library is detected and no email service is already in dev.
135
+ Always offer Mailpit if any email-sending library is detected and no email service is already in dev.
136
+
137
+ If pgvector is detected in the project, there is no bundled recipe to reach for — it was removed because the image carried CVEs with no upstream fix. Keep whatever image the project already uses, and tell the user plainly that it needs its own review: a rebuilt image, or a managed Postgres with the `vector` extension enabled. Do not substitute an image on the user's behalf.
136
138
 
137
139
  #### 1.4 File tree preview
138
140
 
@@ -163,8 +165,11 @@ Without approval: write report (Phase 3 with `status: PLANNED`) and stop.
163
165
  **`docker-compose.dev.yml`**:
164
166
  - Compose service blocks from `.agents/skills/docker-compose-recipes/services/*.yml` per `references/compose-composition.md`.
165
167
  - Add app service(s) at the end: `build: { context: ., dockerfile: Dockerfile.dev }`, `volumes` for hot reload (bind mount source, anonymous volume for `node_modules`/`__pycache__`), `env_file: .env`, `depends_on` with `condition: service_healthy` per `references/healthcheck-patterns.md`.
168
+ - Preserve each recipe's image tag (do NOT convert any of them to a digest — a digest freezes the base and never picks up a security rebuild), the required credential vars, and the `127.0.0.1` binds. The loopback ports intentionally keep the `apps on host` topology working.
166
169
  - Header comment: `# Generated by /dw-dockerize on YYYY-MM-DD`.
167
170
 
171
+ **`.env.example`**: emit every credential var with no working value (the recipes use `${VAR:?}`, so Compose refuses to start without one). After copying to `.env`, require the user to set unique generated local values before running Compose. Application URLs use `localhost` when apps run on the host and service DNS when they run in Compose.
172
+
168
173
  **`Dockerfile.dev`** (multi-stage NOT required for dev — single stage is fine):
169
174
 
170
175
  | Stack | Shape |
@@ -176,7 +181,7 @@ Without approval: write report (Phase 3 with `status: PLANNED`) and stop.
176
181
 
177
182
  **`.dockerignore`** for dev: exclude `.git`, `node_modules`, `target`, `dist`, `.dw`, `.agents`, `*.md` (except README.md).
178
183
 
179
- **README.md "Local Dev" section** (appended): port table for selected services, default credentials from `.env.example`, the four `dev:*` script commands.
184
+ **README.md "Local Dev" section** (appended): port table for selected services, credential requirements from `.env.example` without working passwords, the four `dev:*` script commands.
180
185
 
181
186
  #### 2.2 `--prod` artifacts
182
187
 
@@ -217,7 +222,8 @@ Key requirements (apply to every language):
217
222
  - `restart: always`.
218
223
  - Internal network. NO public ports except via reverse proxy.
219
224
  - Secrets via `secrets:` block or external manager.
220
- - Drop dev-only services (no MailHog, Mailpit, smtp4dev, LocalStack, MinIO unless explicitly needed in prod).
225
+ - Drop dev-only services (no Mailpit, smtp4dev, LocalStack, MinIO unless explicitly needed in prod).
226
+ - For vector search, use a separately reviewed image or a managed Postgres service with the `vector` extension; this project ships no vetted pgvector image.
221
227
 
222
228
  **`.dockerignore`** for prod: stricter than dev. Exclude tests, `tests/`, `.github/`, `.dw/`, `.agents/`, all markdown except license.
223
229
 
@@ -234,6 +240,7 @@ Read existing `Dockerfile` and compose files. Apply `security-review/infrastruct
234
240
  - Compose: missing healthchecks on services? (flag)
235
241
  - Compose: services missing `restart` policy? (flag)
236
242
  - Compose: bind mounts in prod compose? (flag CRITICAL if `prod` in filename)
243
+ - Compose: any image pinned by digest, or a credential with a working default? (flag CRITICAL — both block base-image rebuilds or ship a usable credential)
237
244
 
238
245
  Apply `dw-review-rigor`: dedup repeated patterns, signal-over-volume on style nits.
239
246
 
@@ -257,7 +264,7 @@ mode: <dev|prod|both|audit|dry-run>
257
264
  languages: [...]
258
265
  frameworks: { web: '...', api: '...' }
259
266
  services_detected: [postgres, redis, ...]
260
- services_added: [mailhog, ...]
267
+ services_added: [mailpit, ...]
261
268
  base_image_strategy: <conservative|balanced|bold>
262
269
  ---
263
270
  ```
@@ -272,7 +279,7 @@ Sections:
272
279
  6. **Files Created** — table with path + bytes + role.
273
280
  7. **Audit Findings** (only `--audit` mode) — table of issues with severity, file:line, recommendation.
274
281
  8. **Next Steps:**
275
- - For `--dev`: `cp .env.example .env` (if missing), `docker compose -f docker-compose.dev.yml up -d`, then smoke test the app.
282
+ - For `--dev`: `cp .env.example .env` (if missing), set every required secret such as `POSTGRES_PASSWORD` to a unique local value, run `docker compose -f docker-compose.dev.yml up -d`, then smoke test the app.
276
283
  - For `--prod`: build the image locally first (`docker build -t <name>:dev .`), run `/dw-secure-audit` on the Dockerfile and compose, then push to registry.
277
284
  - For `--audit`: apply suggested fixes manually or run with `--mode=force-overwrite`.
278
285
  - Always: run `/dw-secure-audit --plan` against the project before promoting the image to production.
@@ -293,7 +300,7 @@ Sections:
293
300
  - <critical>Never silently overwrite. If `Dockerfile`/`docker-compose.*.yml`/`.dockerignore` exists, default to `--audit`.</critical>
294
301
  - <critical>Prod images NEVER include secrets, dev SDK tooling, source code that wasn't compiled, or test fixtures.</critical>
295
302
  - <critical>Prod images ALWAYS run as a non-root user.</critical>
296
- - <critical>Prod compose files NEVER include MailHog, Mailpit, smtp4dev, LocalStack, or development-only services.</critical>
303
+ - <critical>Prod compose files NEVER include Mailpit, smtp4dev, LocalStack, or development-only services.</critical>
297
304
  - <critical>If `--audit` finds CRITICAL severity issues (secrets in ENV, root user, public ports on data tier), the report's Next Steps must list the fix as REQUIRED before deploy.</critical>
298
305
  - Do NOT use `:latest` tags anywhere.
299
306
  - Do NOT exec compose commands from this command — produce files, the user runs `docker compose up`.
@@ -109,6 +109,19 @@ Build the body following the template below, filling in with collected informati
109
109
 
110
110
  3. **Instruct the user** to paste the body (Ctrl+V) in the description field
111
111
 
112
+ ### 6. Record the PR back into the spec
113
+
114
+ The PR URL only exists after the user clicks "Create". Once it does, write it back — otherwise nothing on the `.dw/` side ever records which PR delivered the work, and the trail ends at the branch.
115
+
116
+ ```bash
117
+ # Fast path: resolves once the PR exists. Needs the GitHub CLI; skip silently if absent.
118
+ gh pr view --json url -q .url 2>/dev/null
119
+ ```
120
+
121
+ - If a URL resolves, append it to the PRD's `## Related` section as `- PR: <url>`.
122
+ - If `gh` is unavailable or the PR isn't created yet, print the exact line for the user to paste and move on. **Never block the command on this** — it is a record, not a gate.
123
+ - For bugfix branches, append the same line to `.dw/bugfixes/<NNN-slug>/SUMMARY.md` under `## Related` instead.
124
+
112
125
  ## PR Template (copy to clipboard)
113
126
 
114
127
  ```markdown
@@ -79,10 +79,10 @@ Use `AskUserQuestion` when available; otherwise plain numbered prompts. Ask in *
79
79
 
80
80
  #### Layer B — Infra (only ask what fits the shape)
81
81
 
82
- 6. **Database**: Postgres / Postgres + pgvector / MySQL / SQLite (file, no service) / MongoDB (out of scope for compose recipes — note and skip if chosen) / none. For Postgres + pgvector, select an explicit supported recipe/version.
82
+ 6. **Database**: Postgres / MySQL / SQLite (file, no service) / MongoDB (out of scope for compose recipes — note and skip if chosen) / none. There is no bundled pgvector recipe: the image carried unfixed upstream CVEs and no bundled artifact could clear them. If the project needs vector search, note it and let the user pick a separately reviewed image or a managed Postgres with the extension enabled.
83
83
  7. **Cache**: Redis / Memcached / none
84
84
  8. **Queue / message broker**: pg-boss (Node + Postgres, no extra service), BullMQ (Node + Redis), Celery (Python only), RabbitMQ (any), LocalStack SQS (any), none. If chosen, also ask whether the project will have async workers.
85
- 9. **Email — dev capture** (default: **Mailpit**, ask only if user wants to override): Mailpit / MailHog / smtp4dev / skip
85
+ 9. **Email — dev capture** (default: **Mailpit**, ask only if user wants to override): Mailpit / smtp4dev / skip
86
86
  10. **Email — prod target** (only ask if user wants email at all): SMTP relay / SendGrid / Resend / Postmark / SES / skip
87
87
  11. **Object storage**: S3 (real, no service in compose) / MinIO (dev) / GCS (no service) / none
88
88
  12. **Search**: Meilisearch / Typesense / Elasticsearch / none
@@ -112,7 +112,7 @@ Save all answers in memory for Phase 2.
112
112
 
113
113
  ### Phase 2 — One-Pager + Plan + Approval Gate
114
114
 
115
- 1. Render `.dw/spec/projects/{{PROJECT_NAME}}.md` from `.dw/templates/project-onepager.md`. Fill every section: shape, languages, frameworks, services table (name + port + default credentials), architecture diagram (ASCII), generated-files list, open questions.
115
+ 1. Render `.dw/spec/projects/{{PROJECT_NAME}}.md` from `.dw/templates/project-onepager.md`. Fill every section: shape, languages, frameworks, services table (name + port + credential requirements, never a working password), architecture diagram (ASCII), generated-files list, open questions.
116
116
  2. Build a plan:
117
117
  - Commands to run (in order, with arguments)
118
118
  - Files to create (with paths under `{{TARGET_DIR}}`)
@@ -163,11 +163,12 @@ If fullstack:
163
163
  - Aggregate named volumes under `volumes:`.
164
164
  - Resolve port collisions if any.
165
165
  - For `everything in Compose`, add the app service(s) at the end (build context = `apps/<name>` or root, Dockerfile.dev, env_file, volumes, depends_on with `condition: service_healthy`). For `apps on host`, compose infrastructure only and use `localhost` endpoints in app-facing environment variables.
166
+ - Preserve each recipe's image tag (do NOT convert any of them to a digest — a digest freezes the base image and never picks up a security rebuild), the required credential vars, and the `127.0.0.1` port binds. Those loopback mappings intentionally support `apps on host`; do not remove them from local dev.
166
167
  3. Add a header comment: `# Generated by /dw-new-project on YYYY-MM-DD`.
167
168
 
168
169
  #### 3.4 Generate `.env.example`
169
170
 
170
- Consolidate every env var referenced by selected services (per `references/env-conventions.md`). Group by service. Always include the application-side derived URLs (`DATABASE_URL`, `REDIS_URL`, `AMQP_URL`, `SMTP_HOST`/`SMTP_PORT`, `AWS_ENDPOINT_URL`, etc.).
171
+ Consolidate every env var referenced by selected services (per `references/env-conventions.md`). Group by service. Always include the application-side derived URLs (`DATABASE_URL`, `REDIS_URL`, `AMQP_URL`, `SMTP_HOST`/`SMTP_PORT`, `AWS_ENDPOINT_URL`, etc.). Every credential var is emitted empty in `.env.example` (the recipes use `${VAR:?}`, so Compose refuses to start without a real value). Require the user to set unique generated values in the gitignored `.env` before running Compose. Never emit a reusable password.
171
172
 
172
173
  #### 3.5 Generate scripts
173
174
 
@@ -217,7 +218,7 @@ Minimal scaffold:
217
218
  | Database | <db or n/a> |
218
219
  | Cache | <cache or n/a> |
219
220
  | Queue | <queue or n/a> |
220
- | Email (dev) | <mailpit|mailhog|smtp4dev|none> |
221
+ | Email (dev) | <mailpit|smtp4dev|none> |
221
222
  | Search | <search or n/a> |
222
223
  | Observability | <observability or n/a> |
223
224
  | Reverse proxy | <traefik|none> |
@@ -228,7 +229,7 @@ Minimal scaffold:
228
229
 
229
230
  ## Services in docker-compose.dev.yml
230
231
 
231
- (table of selected services with ports and default credentials)
232
+ (table of selected services with ports and credential requirements; never include a working password)
232
233
 
233
234
  ## Conventions
234
235
 
@@ -241,8 +242,8 @@ Minimal scaffold:
241
242
 
242
243
  Generate a starter README with:
243
244
  - Project name + 1-line purpose
244
- - Quick Start (`cp .env.example .env && pnpm install && pnpm dev:up`)
245
- - Local Dev (port table for selected services + UI URLs + default credentials)
245
+ - Quick Start (`cp .env.example .env`, set every required secret to a unique local value, then `pnpm install && pnpm dev:up`)
246
+ - Local Dev (port table for selected services + UI URLs + credential requirements; never publish a working password)
246
247
  - Architecture diagram (ASCII from the one-pager)
247
248
  - Project layout (tree of top-level dirs)
248
249
  - Dev-workflow integration (mentions `/dw-plan prd`, `/dw-run`, `/dw-qa`, `/dw-secure-audit --plan`, `/dw-secure-audit`)
@@ -276,7 +277,7 @@ date: YYYY-MM-DD
276
277
  shape: <frontend|backend|fullstack>
277
278
  languages: [typescript, python, ...]
278
279
  frameworks: { web: '...', api: '...' }
279
- services: [postgres-pgvector, mailpit, minio, ...]
280
+ services: [postgres, mailpit, minio, ...]
280
281
  package_manager: <pnpm|npm|yarn|poetry|uv|cargo|dotnet>
281
282
  monorepo: <pnpm-workspaces|turborepo|nx|none>
282
283
  ---
@@ -299,10 +300,10 @@ monorepo: <pnpm-workspaces|turborepo|nx|none>
299
300
  | ... | ... | ... |
300
301
 
301
302
  ## Services Composed
302
- <table of services with port + UI URL + default credentials, sourced from .agents/skills/docker-compose-recipes/>
303
+ <table of services with port + UI URL + credential requirements, sourced from .agents/skills/docker-compose-recipes/>
303
304
 
304
305
  ## Next Steps
305
- 1. `cp .env.example .env` and review credentials.
306
+ 1. `cp .env.example .env`, generate unique local secrets, and set every required value such as `POSTGRES_PASSWORD`.
306
307
  2. `pnpm install` (or your chosen package manager).
307
308
  3. `pnpm dev:up` to bring up all services. Wait for healthchecks.
308
309
  4. Open Mailpit UI at http://localhost:8025 to confirm email capture is wired.
@@ -323,10 +324,10 @@ monorepo: <pnpm-workspaces|turborepo|nx|none>
323
324
 
324
325
  - <critical>NEVER bypass the Phase 2 approval gate. If invoked in a non-interactive context, abort with: "/dw-new-project requires an interactive approval; rerun with --dry-run to plan-only."</critical>
325
326
  - <critical>NEVER run `create-*` tools outside `{{TARGET_DIR}}`. Each command's CWD is the target dir.</critical>
326
- - <critical>If MailHog/Mailpit/smtp4dev was selected, NEVER also wire a real SMTP into dev. The dev compose ALWAYS captures.</critical>
327
+ - <critical>If Mailpit/smtp4dev was selected, NEVER also wire a real SMTP into dev. The dev compose ALWAYS captures.</critical>
327
328
  - <critical>If a `create-*` tool fails, STOP execution. Do not skip ahead to compose generation — partial scaffolds confuse later commands.</critical>
328
329
  - Do NOT pin Node/Python/.NET/Rust SDK versions inside the project unless the user asks; rely on `package.json` engines / `pyproject.toml` / `global.json` / `rust-toolchain.toml` to express intent without forcing.
329
- - Do NOT bake secrets into any generated file. `.env.example` has dev defaults only; real values live in untracked `.env`.
330
+ - Do NOT bake secrets into any generated file. `.env.example` has non-secret dev defaults and empty required secret keys; real values live in untracked `.env`.
330
331
 
331
332
  ## Error Handling
332
333
 
@@ -69,7 +69,7 @@ Before Stage 1, check for an idea one-pager at `.dw/spec/ideas/<slug>.md` and th
69
69
  - `schema_version: "1.1"`;
70
70
  - `status: aligned`;
71
71
  - `alignment.confirmed_by_user: true`;
72
- - every dependency branch is resolved (no open decision node);
72
+ - the **Decision Map** has every dependency branch resolved (no open decision node and `Frontier: none`);
73
73
  - glossary/code contradictions are closed;
74
74
  - no **blocking** entry remains under Remaining Decisions.
75
75
  If ANY check fails — or the file is malformed, internally inconsistent, `draft`, or `paused` — the one-pager is **input, not a trusted handoff**: read it for context, but treat all its decisions as **uncovered** and ask them normally. Never suppress a product question on the strength of `status: aligned` alone; `alignment.confirmed_by_user: true` and a resolved, non-blocking, contradiction-free tree are required too.</critical>
@@ -167,7 +167,7 @@ Runs when default mode (after TechSpec approval) OR `plan tasks`.
167
167
  4. **Test placement (`dw-testing-discipline`):** every test-adding subtask names its invariant per the placement doctrine. Owning layer specified.
168
168
  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>`.
169
169
  6. **LLM-eval subtask (when applicable):** if the PRD has an AI feature, one task must include an Eval Plan subtask (reference dataset path, oracle rungs, judge calibration, target metrics).
170
- 7. **Dependency declaration:** each task explicitly lists which previous tasks it depends on. Validation rejects cycles.
170
+ 7. **Dependency declaration:** each task explicitly lists which previous tasks it depends on. Write the field as `Depends on: none` or `Depends on: 1.0, 2.0` in `tasks.md` and each `<N>_task.md`. Validation rejects cycles.
171
171
  8. **Output locations:**
172
172
  - Summary: `.dw/spec/prd-<feature-slug>/tasks.md`
173
173
  - Per-task files: `.dw/spec/prd-<feature-slug>/<N>_task.md`
@@ -29,6 +29,7 @@ You are the dev-workflow refactor audit entrypoint. This command restores an exp
29
29
  - Using Fowler smell taxonomy.
30
30
  - Loading `dw-review-rigor` and `dw-simplification` when available.
31
31
  - Applying Chesterton's Fence and deep-modules analysis before proposing a refactor.
32
+ - Loading the advanced deep-modules sections (`Dependency categories decide seam tests` and `Design It Twice for interface findings`) only when the surviving finding is a shallow interface, interface leak, or seam in the wrong place.
32
33
  - De-duplicating findings and severity-ordering P0-P3.
33
34
  - Saving the output to `<target>/refactor-plan.md`.
34
35
  5. If the target does not exist or is too broad, use the clarification questions to narrow it before scanning.
@@ -19,6 +19,7 @@ You are the review orchestrator. Runs both Level 2 (PRD compliance / coverage) a
19
19
  | `/dw-review --coverage-only` | Only Level 2 — maps every PRD requirement (or bugfix scope) to the code that delivers it. Skips code quality. |
20
20
  | `/dw-review --code-only` | Only Level 3 — code quality / convention / security checks. Skips PRD/scope mapping. |
21
21
  | `/dw-review --bugfix <NNN-slug>` | Targets a bugfix at `.dw/bugfixes/NNN-slug/` instead of a PRD. Level 2 maps the bugfix scope (TASK.md + fix-report.md + SUMMARY.md) to the code that delivers the fix; Level 3 checks the diff. Output: `.dw/bugfixes/NNN-slug/review/`. |
22
+ | `/dw-review --since <ref>` | Ad-hoc review against a verified comparison point. Runs the normal selected levels, but the diff is computed from `<ref>` after the `--since` preflight below. |
22
23
 
23
24
  ## Inputs
24
25
 
@@ -26,7 +27,8 @@ You are the review orchestrator. Runs both Level 2 (PRD compliance / coverage) a
26
27
  |----------|-------------|---------|
27
28
  | `{{PRD_PATH}}` | Path to PRD directory (auto-detect from active branch if omitted; ignored when `--bugfix` is used) | `.dw/spec/prd-invoice-export` |
28
29
  | `{{BUGFIX_SLUG}}` | Bugfix slug when `--bugfix` flag is used | `001-login-not-working` |
29
- | `{{MODE}}` | `--coverage-only` / `--code-only` / `--bugfix <slug>` (optional; default = both, target = PRD) | — |
30
+ | `{{SINCE_REF}}` | Git ref used when `--since <ref>` is passed | `v2.0.0`, `HEAD~3`, `main` |
31
+ | `{{MODE}}` | `--coverage-only` / `--code-only` / `--bugfix <slug>` / `--since <ref>` (optional; default = both, target = PRD) | — |
30
32
 
31
33
  ## Target Resolution
32
34
 
@@ -38,6 +40,24 @@ The review runs against one of two target kinds. Compute `<target>` ONCE at the
38
40
 
39
41
  When the bugfix target is used, the Coverage mapping (Level 2) operates on the numbered tasks from `TASK.md` (not FR-N.M); a task is DELIVERED when (a) the files it claimed to touch are in the diff and (b) the regression test referenced in `fix-report.md` exists and runs. Orphan code in bugfix mode is anything in the diff that does not correspond to a numbered task — a strong signal the safety valve should have escalated to `/dw-plan`.
40
42
 
43
+ ## `--since <ref>` Preflight
44
+
45
+ `--since` is opt-in. The default PRD/bugfix review keeps using the PRD branch creation point / base branch flow unchanged.
46
+
47
+ When `--since <ref>` is passed, run this preflight before any Level 2 or Level 3 analysis:
48
+
49
+ 1. Resolve the fixed point:
50
+ - Run `git rev-parse --verify --quiet <ref>^{commit}`.
51
+ - If it fails, abort with: `REJECTED: --since ref '<ref>' does not resolve to a commit. Pass a valid commit, tag, or branch, then rerun /dw-review --since <ref>.`
52
+ 2. Build the review range:
53
+ - Diff command: `git diff <ref>...HEAD`.
54
+ - Commit command: `git log <ref>..HEAD --oneline`.
55
+ - Choice: three-dot diff is used so the reviewed patch is what `HEAD` changed since the merge-base with the verified ref, matching PR review semantics and avoiding changes that exist only on `<ref>`.
56
+ 3. Confirm the diff is not empty:
57
+ - Run `git diff --name-only <ref>...HEAD`.
58
+ - If it returns no paths, abort with: `APPROVED: no changes to review for git diff <ref>...HEAD. Pick an earlier --since ref or use the default PRD/base-branch review.`
59
+ 4. Record the resolved ref, the diff command, and the commit command in every generated review report so the review is reproducible.
60
+
41
61
  ## Complementary Skills
42
62
 
43
63
  When available under `./.agents/skills/`, these are invoked as analytical support:
@@ -107,6 +127,9 @@ Saved to `<target>/QA/review-coverage.md` (PRD target) or `<target>/review/revie
107
127
  ```markdown
108
128
  # Coverage Review
109
129
 
130
+ **Diff command:** git diff <effective-base-or-ref>...HEAD
131
+ **Commit range:** git log <effective-base-or-ref>..HEAD --oneline
132
+
110
133
  ## Status by Functional Requirement
111
134
 
112
135
  | FR | Description | Status | Evidence | Commit |
@@ -133,7 +156,7 @@ If MISSING > 0, the verdict suggests revisiting `/dw-plan tasks` to scope or `/d
133
156
 
134
157
  ### Behavior
135
158
 
136
- 1. **Diff analysis:** identify what changed since the PRD branch was created (`git diff <base-branch>...HEAD`).
159
+ 1. **Diff analysis:** identify what changed since the PRD branch was created (`git diff <base-branch>...HEAD`). If `--since <ref>` is used, use the preflight diff command instead.
137
160
 
138
161
  2. **Rules conformance** (against `.dw/rules/`):
139
162
  - General patterns: no `any` types in TS, no `console.log` in prod, error handling, multi-tenancy.
@@ -176,6 +199,13 @@ Saved to `<target>/QA/dw-code-review.md` (PRD target) or `<target>/review/dw-cod
176
199
  - **APPROVED WITH CAVEATS** — green but findings worth fixing in follow-up (filed with severities).
177
200
  - **REJECTED** — at least one hard gate failed. Specify which.
178
201
 
202
+ The report MUST include:
203
+
204
+ ```markdown
205
+ **Diff command:** git diff <effective-base-or-ref>...HEAD
206
+ **Commit range:** git log <effective-base-or-ref>..HEAD --oneline
207
+ ```
208
+
179
209
  ## Consolidated output (default mode)
180
210
 
181
211
  When both levels run, a consolidated report at `<target>/QA/review-consolidated.md` (PRD target) or `<target>/review/review-consolidated.md` (bugfix target):
@@ -188,6 +218,7 @@ When both levels run, a consolidated report at `<target>/QA/review-consolidated.
188
218
  **Verification Report:** PASS
189
219
  **Security Audit:** PASS (or REJECTED with reasons)
190
220
  **Constitution Compliance:** PASS (or violations listed)
221
+ **Diff command:** git diff <effective-base-or-ref>...HEAD
191
222
 
192
223
  ## Overall Verdict
193
224
  <line>
@@ -34,6 +34,7 @@ When available under `./.agents/skills/`, these skills are invoked per task:
34
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
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
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.
37
38
  - `dw-ui-discipline`: when the task touches UI, the 4 grounding questions must be answered before any visual decision lands.
38
39
  - `dw-llm-eval`: when the task touches AI feature code paths, the reference dataset + oracle ladder rules apply.
39
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`.
@@ -75,7 +76,7 @@ When available under `./.agents/skills/`, these skills are invoked per task:
75
76
  - Atomic commit message: `feat(<scope>): <task title> (#<task-id>)`.
76
77
  - Reference the FRs covered.
77
78
  - One task = one commit (unless the task explicitly has subtask milestones that earn separate commits).
78
- 6. **Update tasks.md:** mark this task as `Done` with the commit SHA.
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.
79
80
  7. **Report:** what was done, what tests were added, what was validated.
80
81
 
81
82
  ### STOP CONDITIONS