@brunosps00/dev-workflow 2.2.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +46 -0
  3. package/README.md +12 -4
  4. package/lib/constants.js +24 -24
  5. package/lib/init.js +8 -0
  6. package/lib/instruction-health.js +38 -0
  7. package/lib/post-update.js +2 -1
  8. package/lib/validate.js +3 -1
  9. package/package.json +1 -1
  10. package/scaffold/config/routing.json +61 -23
  11. package/scaffold/en/agent-instructions.md +31 -137
  12. package/scaffold/en/commands/dw-analyze-project.md +2 -0
  13. package/scaffold/en/commands/dw-autopilot.md +22 -245
  14. package/scaffold/en/commands/dw-bugfix.md +9 -35
  15. package/scaffold/en/commands/dw-claude-run.md +29 -45
  16. package/scaffold/en/commands/dw-codex-run.md +30 -45
  17. package/scaffold/en/commands/dw-context-budget.md +6 -14
  18. package/scaffold/en/commands/dw-copilot-run.md +29 -41
  19. package/scaffold/en/commands/dw-generate-pr.md +2 -2
  20. package/scaffold/en/commands/dw-goal.md +11 -5
  21. package/scaffold/en/commands/dw-help.md +2 -2
  22. package/scaffold/en/commands/dw-plan.md +14 -7
  23. package/scaffold/en/commands/dw-qa.md +2 -0
  24. package/scaffold/en/commands/dw-resume.md +5 -11
  25. package/scaffold/en/commands/dw-review.md +4 -3
  26. package/scaffold/en/commands/dw-run.md +19 -166
  27. package/scaffold/en/commands/dw-skill-health.md +7 -0
  28. package/scaffold/en/commands/dw-update.md +18 -4
  29. package/scaffold/en/references/command-routing.md +53 -0
  30. package/scaffold/en/references/execution-contract.md +55 -0
  31. package/scaffold/en/templates/frontend-quality-template.md +43 -0
  32. package/scaffold/en/templates/task-template.md +20 -40
  33. package/scaffold/en/templates/tasks-template.md +9 -6
  34. package/scaffold/en/templates/techspec-template.md +4 -0
  35. package/scaffold/pt-br/agent-instructions.md +31 -137
  36. package/scaffold/pt-br/commands/dw-analyze-project.md +2 -0
  37. package/scaffold/pt-br/commands/dw-autopilot.md +22 -245
  38. package/scaffold/pt-br/commands/dw-bugfix.md +9 -35
  39. package/scaffold/pt-br/commands/dw-claude-run.md +29 -46
  40. package/scaffold/pt-br/commands/dw-codex-run.md +30 -45
  41. package/scaffold/pt-br/commands/dw-context-budget.md +6 -14
  42. package/scaffold/pt-br/commands/dw-copilot-run.md +29 -43
  43. package/scaffold/pt-br/commands/dw-generate-pr.md +2 -2
  44. package/scaffold/pt-br/commands/dw-goal.md +11 -5
  45. package/scaffold/pt-br/commands/dw-help.md +2 -2
  46. package/scaffold/pt-br/commands/dw-plan.md +14 -7
  47. package/scaffold/pt-br/commands/dw-qa.md +2 -0
  48. package/scaffold/pt-br/commands/dw-resume.md +7 -11
  49. package/scaffold/pt-br/commands/dw-review.md +4 -3
  50. package/scaffold/pt-br/commands/dw-run.md +19 -166
  51. package/scaffold/pt-br/commands/dw-skill-health.md +7 -0
  52. package/scaffold/pt-br/commands/dw-update.md +18 -4
  53. package/scaffold/pt-br/references/command-routing.md +53 -0
  54. package/scaffold/pt-br/references/execution-contract.md +55 -0
  55. package/scaffold/pt-br/templates/frontend-quality-template.md +43 -0
  56. package/scaffold/pt-br/templates/task-template.md +20 -40
  57. package/scaffold/pt-br/templates/tasks-template.md +9 -6
  58. package/scaffold/pt-br/templates/techspec-template.md +4 -0
  59. package/scaffold/scripts/lib/workflow-contract.mjs +101 -0
  60. package/scaffold/skill-registry.json +23 -23
  61. package/scaffold/skills/dw-cli-run/SKILL.md +33 -217
  62. package/scaffold/skills/dw-cli-run/references/dispatch-tuning.md +14 -72
  63. package/scaffold/skills/dw-codebase-intel/SKILL.md +5 -39
  64. package/scaffold/skills/dw-codebase-intel/agents/intel-updater.md +1 -1
  65. package/scaffold/skills/dw-codebase-intel/references/agents-detail.md +7 -0
  66. package/scaffold/skills/dw-codebase-intel/references/files-in-dw-intel-detail.md +16 -0
  67. package/scaffold/skills/dw-codebase-intel/references/how-dw-intel-reads-this-detail.md +12 -0
  68. package/scaffold/skills/dw-codebase-intel/references/how-to-compose-the-typical-flow-detail.md +11 -0
  69. package/scaffold/skills/dw-council/SKILL.md +2 -17
  70. package/scaffold/skills/dw-council/references/integration-with-other-dw-commands-detail.md +7 -0
  71. package/scaffold/skills/dw-council/references/phase-2-tensions-and-rebuttals-detail.md +15 -0
  72. package/scaffold/skills/dw-domain-modeling/SKILL.md +1 -1
  73. package/scaffold/skills/dw-execute-phase/SKILL.md +12 -32
  74. package/scaffold/skills/dw-execute-phase/agents/executor.md +15 -252
  75. package/scaffold/skills/dw-execute-phase/agents/plan-checker.md +4 -207
  76. package/scaffold/skills/dw-execute-phase/references/atomic-commits.md +8 -18
  77. package/scaffold/skills/dw-execute-phase/references/de-sloppify-pass-optional-cleanup-task-detail.md +12 -0
  78. package/scaffold/skills/dw-execute-phase/references/deviation-rules-during-execution-detail.md +8 -0
  79. package/scaffold/skills/dw-execute-phase/references/how-the-two-agents-compose-detail.md +7 -0
  80. package/scaffold/skills/dw-execute-phase/references/plan-verification.md +9 -155
  81. package/scaffold/skills/dw-execute-phase/references/wave-coordination.md +6 -97
  82. package/scaffold/skills/dw-git-discipline/SKILL.md +2 -2
  83. package/scaffold/skills/dw-grilling/SKILL.md +1 -1
  84. package/scaffold/skills/dw-incident-response/SKILL.md +1 -64
  85. package/scaffold/skills/dw-incident-response/references/the-five-phases-detail.md +66 -0
  86. package/scaffold/skills/dw-llm-eval/SKILL.md +5 -53
  87. package/scaffold/skills/dw-llm-eval/references/agent-tool-use-evaluation-detail.md +23 -0
  88. package/scaffold/skills/dw-llm-eval/references/anti-patterns-will-block-in-dw-review-code-only-detail.md +9 -0
  89. package/scaffold/skills/dw-llm-eval/references/consistency-run-to-run-stability-detail.md +10 -0
  90. package/scaffold/skills/dw-llm-eval/references/integration-with-dev-workflow-commands-detail.md +6 -0
  91. package/scaffold/skills/dw-llm-eval/references/the-oracle-ladder-detail.md +15 -0
  92. package/scaffold/skills/dw-memory/SKILL.md +4 -50
  93. package/scaffold/skills/dw-memory/references/context-budget.md +8 -56
  94. package/scaffold/skills/dw-memory/references/promotion-decision-test-detail.md +30 -0
  95. package/scaffold/skills/dw-minimalism/SKILL.md +4 -5
  96. package/scaffold/skills/dw-review-rigor/SKILL.md +1 -54
  97. package/scaffold/skills/dw-review-rigor/references/the-five-rules-detail.md +56 -0
  98. package/scaffold/skills/dw-simplification/SKILL.md +2 -55
  99. package/scaffold/skills/dw-simplification/references/pattern-recognition-detail.md +11 -0
  100. package/scaffold/skills/dw-simplification/references/the-five-rules-detail.md +48 -0
  101. package/scaffold/skills/dw-source-grounding/SKILL.md +1 -56
  102. package/scaffold/skills/dw-source-grounding/references/the-protocol-detect-fetch-implement-cite-detail.md +58 -0
  103. package/scaffold/skills/dw-testing-discipline/SKILL.md +25 -177
  104. package/scaffold/skills/dw-testing-discipline/references/agent-guardrails.md +9 -167
  105. package/scaffold/skills/dw-testing-discipline/references/core-rules.md +3 -3
  106. package/scaffold/skills/dw-testing-discipline/references/mutation-testing.md +19 -0
  107. package/scaffold/skills/dw-testing-discipline/references/patterns.md +3 -12
  108. package/scaffold/skills/dw-ui-discipline/SKILL.md +2 -59
  109. package/scaffold/skills/dw-ui-discipline/references/frontend-engineering.md +46 -0
  110. package/scaffold/skills/dw-ui-discipline/references/the-four-grounding-questions-detail.md +61 -0
  111. package/scaffold/skills/dw-verify/SKILL.md +26 -148
  112. package/scaffold/skills/dw-verify/references/verification-discovery-and-attribution.md +2 -2
  113. package/scaffold/skills/humanizer/SKILL.md +2 -1
  114. package/scaffold/skills/security-review/SKILL.md +3 -183
  115. package/scaffold/skills/security-review/references/do-not-flag-detail.md +49 -0
  116. package/scaffold/skills/security-review/references/quick-patterns-reference-detail.md +56 -0
  117. package/scaffold/skills/security-review/references/review-process-detail.md +84 -0
  118. package/scaffold/skills/vercel-react-best-practices/SKILL.md +1 -90
  119. package/scaffold/skills/vercel-react-best-practices/references/quick-reference-detail.md +92 -0
@@ -1,156 +1,50 @@
1
1
  <!-- dev-workflow:start -->
2
- # dev-workflow — AI Agent Instructions
3
-
4
- This project uses [`@brunosps00/dev-workflow`](https://www.npmjs.com/package/@brunosps00/dev-workflow) (`dw-*` commands) for structured AI-driven development. The commands compose into a PRD → TechSpec → Tasks → Implement → Review → Commit → PR pipeline with hard gates for security, constitution compliance, and verification.
5
-
6
- **The whole point of this file:** when the user states an intent that matches the Trigger Map below, run the matching `dw-*` command **without asking permission first** — unless the change is genuinely trivial (see Escape Hatches).
7
-
8
- ## Auto-Sizing Matrix
9
-
10
- Before picking a command from the Trigger Map, gauge the change's actual scope. The same intent ("fix this", "add this") can mean very different amounts of work; the matrix names four sizes and routes each to a different entry point. **Pick the smallest one that fits — under-routing wastes ceremony, over-routing hides scope.**
11
-
12
- | Size | What it looks like | Route to |
13
- |------|---------------------|----------|
14
- | **Small** | ≤3 files, no migration, no new endpoint, can be summarized in one sentence. Examples: typo, log message, single-line config, dependency bump, version pin. | Just do it inline. No `dw-*` command. |
15
- | **Medium** | Clear feature or bug, <10 numbered tasks expected, single component or single service, no architectural decisions. Examples: add a form field with validation, fix a regression in a known module, wire a new API endpoint into an existing handler. | `/dw-bugfix` (for bugs) or `/dw-plan` (for features) — straight, not via `/dw-autopilot`. |
16
- | **Large** | Multi-component feature, ≥10 tasks expected, touches multiple modules, has user-visible UX surface AND backend. Examples: add a new entity end-to-end (model + migration + API + UI), introduce a third-party integration, redesign a flow. | `/dw-autopilot "<wish>"` — first invocation plans and stops; second invocation resumes via `/dw-goal` for Run → Review → QA/Fix → Review, then Commit → PR. |
17
- | **Complex** | New domain, ambiguous requirements, architectural decision required, regulatory or compliance surface, or scope that spans multiple PRDs. Examples: introduce event sourcing, rebuild auth, multi-tenancy, a new product line. | `/dw-opportunities` first if the idea is not yet known; otherwise `/dw-brainstorm "<idea>"` (auto-dispatches research/council modes), then `/dw-plan --council` so the techspec stage runs the multi-advisor debate. |
18
-
19
- **Safety valve:** if you start in Small or Medium but the work reveals it's actually Large (the inline listing exceeds 5 steps, or `/dw-bugfix` triggers its `Step 5.0` valve), STOP and escalate. There is no flag to bypass. Escalation is the correct outcome.
20
-
21
- **Adapted 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). The four-size matrix is theirs; the mapping to `dw-*` commands is dev-workflow-specific.
22
-
23
- ## Trigger Map
24
-
25
- | User intent (literal or paraphrased) | Auto-trigger |
26
- |--------------------------------------|--------------|
27
- | "Implement X" / "Build Y" / "Add feature Z" / "I need ..." / "Create ..." | `/dw-autopilot "X"` |
28
- | "Autopilot this PRD" / "Take this PRD to PR" / continue a bugfix escalation autonomously | `/dw-autopilot --from-prd <slug>` (existing PRD at `.dw/spec/<slug>/`) |
29
- | "Resume autopilot" / "continue after plan" / `autopilot-state.json` has `status: plan_complete` | `/dw-autopilot` (or `/dw-goal --from-autopilot <slug>` if the user specifically asks for the goal step) |
30
- | Pasted error / "X is broken" / "Bug in Y" / failing test screenshot | `/dw-bugfix "X"` |
31
- | "Plan this feature" / "Write a PRD + techspec + tasks" | `/dw-plan "X"` |
32
- | "Write a PRD for X" / "Spec out Y" | `/dw-plan prd "X"` |
33
- | "Design the architecture" / "Make the techspec" | `/dw-plan techspec` |
34
- | "Break this into tasks" | `/dw-plan tasks` |
35
- | "Run this task" (with task ID) | `/dw-run <ID>` |
36
- | "Run all pending tasks" / "Execute the plan" | `/dw-run` |
37
- | "Run this as a goal" / "durable goal" / "long-running objective" | `/dw-goal "<objective>"` |
38
- | "Continue where I left off" | `/dw-run --resume` |
39
- | "Pause work" / "End the session" / "Save where we are" | `/dw-pause` |
40
- | "Report every N minutes" / "Keep me posted while this runs" / "Give me status reports" | `/dw-report [--every <N>m]` |
41
- | "Create a worktree for X" / "Clean up the worktrees" / "Merge worktree X" / "How many worktrees are left?" | `/dw-worktree create <slug>` / `/dw-worktree clean --apply` / `/dw-worktree merge <slug>` / `/dw-worktree list` |
42
- | "Resume" / "Where did we stop?" / "Pick up where we left off" | `/dw-resume` |
43
- | "QA this feature" / "Run the test plan" | `/dw-qa` |
44
- | "Fix the QA bugs" | `/dw-qa --fix` |
45
- | "Evaluate the AI feature" / "Test the RAG / classifier" | `/dw-qa --ai` |
46
- | "Walk me through this feature" / "UAT this with me" / "Let's do a manual run-through" | `/dw-qa --uat` |
47
- | "Review this bugfix" / "Code-review fix `<slug>`" | `/dw-review --bugfix <slug>` |
48
- | "QA this bugfix" / "Validate fix `<slug>`" | `/dw-qa --bugfix <slug>` |
49
- | "Review my PR" / "Check code quality" / "Is this ready to ship?" | `/dw-review` |
50
- | "Just the PRD coverage check" | `/dw-review --coverage-only` |
51
- | "Just the code quality review" | `/dw-review --code-only` |
52
- | "Time to commit" / changes are validated and ready | `/dw-commit` |
53
- | "Open a PR" / "Ship this" | `/dw-generate-pr` |
54
- | "Suggest new ideas" / "What should we build next?" / "Find opportunities" / "Roadmap ideas" | `/dw-opportunities` |
55
- | "What security improvements should we consider?" / "Find security opportunities" | `/dw-opportunities "security"` |
56
- | "Brainstorm X" / "Explore this idea" / "Research X" | `/dw-brainstorm "X"` (auto-dispatches grill / prototype / council / research / onepager based on signals) |
57
- | "Code-health audit" / "Find tech debt" / "Refactor opportunities" / "Smells in X" | `/dw-refactor "X"` |
58
- | "Where is X?" / "What uses Y?" / "How is Z structured?" | `/dw-intel "<question>"` |
59
- | "Rebuild the codebase index" / "Refresh intel" | `/dw-intel --build` |
60
- | "Context is heavy" / "Audit token usage" / "Why is the agent slow?" | `/dw-context-budget` |
61
- | "Check dev-workflow install" / "Are agents/wrappers healthy?" | `/dw-harness-audit` |
62
- | "Audit skills" / "Skills feel duplicated or bloated" | `/dw-skill-health` |
63
- | "Redesign this UI" / "Audit and ship a new design" | `/dw-redesign-ui "<target>"` |
64
- | "Audit dependencies" / "Are we behind on packages?" | `/dw-secure-audit --plan` |
65
- | "Scan for vulnerabilities" / "Security check" | `/dw-secure-audit` |
66
- | "Analyze this project" / "Generate rules" | `/dw-analyze-project` |
67
- | "Open a new project" / "Bootstrap a stack" | `/dw-new-project` |
68
- | "Dockerize this" / "Add docker-compose" | `/dw-dockerize` |
69
- | "Functional doc" / "Map screens and flows" | `/dw-functional-doc` |
70
- | "Install Azure skills" / "Setup Microsoft docs MCP" / "Add Azure expertise" / "I'm going to work on Azure" | `/dw-install-azure-skills` |
71
- | "Install AWS skills" / "Setup AWS MCP" / "Add AWS expertise" / "I'm going to work on AWS" | `/dw-install-aws-skills` |
2
+ # dev-workflow — Agent instructions
72
3
 
73
- **Priority:** when in doubt between two commands, `/dw-autopilot` is the safest default for any non-trivial feature request. If a planned autopilot has already stopped with `status: plan_complete`, resume it instead of starting a new plan; the execution phase is owned by `/dw-goal`.
4
+ Use the smallest workflow that satisfies the user's intent and risk. Continue authorized work through implementation, relevant verification, and correction of failures. User instructions and existing authorization take precedence over workflow defaults; platform permissions still apply.
74
5
 
75
- ## Hard Gates (the commands enforce these — don't bypass)
6
+ ## Routing
76
7
 
77
- - **`.dw/constitution.md`**: principles with `severity: high` or `critical` block PRs / techspecs without an ADR justifying the deviation. Missing constitution? Commands auto-install defaults at `severity: info` (non-blocking) and continue — never blocks on absence.
78
- - **`.dw/spec/<prd>/tasks-validation.md`**: auto-generated at the end of `/dw-plan tasks`. Any FAIL dimension blocks user approval until resolved or explicitly overridden.
79
- - **Verification**: `/dw-generate-pr` requires a fresh `dw-verify` PASS (tests + lint + build) after the last edit.
80
- - **Security**: TS / Python / C# / Rust projects must pass `/dw-secure-audit` (OWASP + Semgrep + gitleaks + Trivy + lockfile audit) before the PR opens.
8
+ | Intent and scope | Action |
9
+ |---|---|
10
+ | Explanation, code lookup, or exploration | Inspect relevant sources and answer directly. |
11
+ | Small, clear, low-risk edit | Implement directly and verify proportionally. |
12
+ | Bug requiring investigation | `/dw-bugfix`; a known small fix can stay inline. |
13
+ | Feature needing specification | `/dw-plan`; for an end-to-end implementation request, continue after task approval. |
14
+ | Multi-component implementation through validation | `/dw-autopilot`; approve the task/execution plan, then continue in the same invocation. |
15
+ | Unresolved product or architecture decisions | `/dw-brainstorm`, then `/dw-plan` when aligned. Use council only when multiple perspectives help the decision. |
16
+ | Execute approved tasks | `/dw-run`; `/dw-goal` for durable execution. |
17
+ | Resume existing work | `/dw-resume` or `/dw-run --resume`; reuse saved decisions and evidence. |
18
+ | Review / QA / commit / PR explicitly requested | `/dw-review` / `/dw-qa` / `/dw-commit` / `/dw-generate-pr`. |
81
19
 
82
- ## Escape Hatches — do NOT auto-trigger
20
+ Do not start a second pipeline inside an active workflow. A request only to plan or investigate ends with the requested artifact. Increased file count or effort is not itself a reason to stop: reorganize within approved scope and ask only about material new scope, conflicting requirements, or missing decisions.
83
21
 
84
- When any of these apply, answer directly and do **not** invoke a `dw-*` command:
22
+ For specialized commands consult `.dw/references/command-routing.md` or `/dw-help`. Do not load the full catalog for routine work.
85
23
 
86
- - One-line typo, rename, import sort, comment fix.
87
- - Pure exploration: "how does this work?", "show me X", "explain Y".
88
- - Aesthetic preference: "I prefer this style" — apply, don't run a pipeline.
89
- - User explicitly says "do this directly" / "skip autopilot" / "no need for a PRD" — honor it.
90
- - The conversation is already inside a `dw-*` flow (you're already executing tasks; don't start a new pipeline).
24
+ ## Planning and delegation
91
25
 
92
- ## Zoom-out pattern (for unfamiliar code areas)
26
+ During task breakdown, propose local or cross-tool development and a model, effort, and agent assignment for each task based on ambiguity, dependencies, risk, and scope. Read `.dw/references/execution-contract.md` at this stage and when executing/resuming the plan. Approval covers these assignments and declared fallbacks for the run.
93
27
 
94
- When you land in an area of the codebase you don't know and orientation costs more than the task itself, **don't dive into files first** — ask `dw-code-explorer` to produce a map. Give it the project's domain glossary (`.dw/rules/index.md`) and tell it: "zoom out one level — show me the relevant modules, their public surfaces, who calls them, and the data flow between them, using domain glossary vocabulary." Get the lay of the land, then dive. This avoids the trap of reading the deepest file first and reconstructing the architecture from leaves upward.
28
+ Claude can delegate implementation through `/dw-codex-run`; Codex can use `/dw-claude-run`. The parent owns review, corrections, and continuation. Local agents inherit the session model unless the approved task overrides it. Delegate bounded independent work when it improves quality or time; keep tightly coupled or small work local. At most 3 workers per workstream, and never concurrent writers in the same worktree.
95
29
 
96
- Adapted from [`mattpocock/skills/zoom-out`](https://github.com/mattpocock/skills/tree/main/zoom-out) (MIT).
30
+ Read relevant files first. Use `.dw/intel/` or a code-explorer for broad or unfamiliar flows when useful, checking index claims against current source. Load skill entrypoints only for matching tasks, and references only for the selected mode. Subagents receive a compact packet and return evidence and decisions, not full logs.
97
31
 
98
- ## Subagent Dispatch Discipline
32
+ ## Completion and boundaries
99
33
 
100
- Project agents are installed in `.claude/agents/`, `.opencode/agent/`, `.agents/agents/`, and `.github/agents/` when supported. Claude Code and OpenCode can use native subagents. Copilot receives custom agents. Codex should treat `.agents/agents/` as delegable profiles when subagents are available, or as a manual prompt pack otherwise.
34
+ An approved implementation plan continues through implementation, review, QA where applicable, and fixes. Do not stop merely because the first implementation is ready or an external runner returned. Reuse decisions already resolved in the conversation. Preserve partial work and durable checkpoints on interruption.
101
35
 
102
- Use a subagent when:
36
+ A ready delivery meets acceptance criteria, has no unresolved blocking finding, and has valid verification evidence. Evidence stays valid while its inputs, environment, and scope remain equivalent; a new message does not invalidate it. Follow `dw-verify` at delivery gates. Do not add tests for low-impact edits just to satisfy a template.
103
37
 
104
- - The task will generate verbose output: logs, tests, broad grep, QA evidence, browser traces, or research notes.
105
- - The task is read-only, parallelizable, and has a clear boundary.
106
- - The task has a compact return value: findings, map, changed files, verification result, or blockers.
107
- - You need an independent review: security, silent failure, language-specific correctness, or PR readiness.
108
-
109
- Do not use a subagent when:
110
-
111
- - The task needs frequent user dialogue.
112
- - Planning, implementation, and testing share too much live context.
113
- - The change is small enough to do inline.
114
- - The subagent would need the full parent transcript to avoid guessing.
115
- - The delegated task would itself need to spawn other subagents.
116
-
117
- Limits:
38
+ Merge, push, publication, and destructive operations require applicable authorization; do not ask again when already authorized. Prepare and validate the concrete result before requesting a missing final authorization. A worktree isolates Git changes, not operating-system permissions.
118
39
 
119
- - Run at most 3 subagents concurrently per workstream.
120
- - Default output should stay near the registry budget, usually 900-1200 words.
121
- - Subagents summarize logs; they return failing lines, paths, commands, decisions, and risks, not full transcripts.
122
- - The parent is the only final synthesizer.
123
- - The parent passes an input packet, not raw conversation history. Use `/dw-subtask-start`, `/dw-subtask-complete`, and `/dw-subtask-resume` for local handoffs.
124
-
125
- Claude-only: prefer named subagents for isolated research, review, build, and QA work. Use forks only when the subtask genuinely needs the parent context.
126
-
127
- Agent routing:
128
-
129
- - Use `dw-code-explorer` before planning or debugging unfamiliar areas.
130
- - Use `dw-build-fixer` only after an actual build/typecheck/lint failure.
131
- - Use `dw-code-reviewer`, `dw-security-reviewer`, and `dw-silent-failure-hunter` during `/dw-review`.
132
- - Use language-specific agents when their module is installed and the diff matches the language.
40
+ ## Project contracts
133
41
 
134
- ## Skill Loading Discipline
42
+ - Respect `.dw/constitution.md`; high/critical deviations need the defined ADR process. Missing constitution does not block: use non-blocking defaults.
43
+ - Approved task plans need valid dependencies and `tasks-validation.md`; repair internal inconsistencies before asking for approval.
44
+ - Complete project-required checks. Security and PR gates remain applicable; secrets and unresolved blocking findings cannot be hidden by a score or a green build.
45
+ - Formal task execution retains scoped atomic commits and requirement traceability. Direct small edits do not imply a commit or PR request.
135
46
 
136
- Skills are compact protocols first. Read the `SKILL.md` entrypoint, then load files under `references/`, `assets/`, `rules/`, or `scripts/` only when the trigger, task, or output requires that deeper material. If a skill feels duplicated, too broad, or expensive for the current task, run `/dw-skill-health`.
47
+ ## Customization
137
48
 
138
- ## Workflow Reference
139
-
140
- ```
141
- /dw-autopilot "wish" ────► First invocation plans: PRD → TechSpec → Tasks → STOP
142
- /dw-autopilot ────► Second invocation resumes: /dw-goal → Commit → PR
143
-
144
- --- OR step-by-step ---
145
-
146
- /dw-brainstorm ─► /dw-plan ─► /dw-goal ─► /dw-commit ─► /dw-generate-pr
147
- ```
148
-
149
- Full command list and contextual help: `/dw-help`.
150
-
151
- ## Editing this section
152
-
153
- This block lives between `<!-- dev-workflow:start -->` and `<!-- dev-workflow:end -->` markers. Anything you write **outside** these markers in `CLAUDE.md` / `AGENTS.md` is preserved on every `dev-workflow update`. Anything **inside** is refreshed from the package — your edits inside the block will be overwritten.
154
-
155
- To customize the trigger map permanently, copy the block content to outside the markers (or to a separate file like `.dw/agent-instructions-custom.md`) and edit there.
49
+ This managed block lives between `<!-- dev-workflow:start -->` and `<!-- dev-workflow:end -->` markers and is refreshed on update. Put project-specific instructions outside the markers; do not duplicate the entire block. Configuration and explicit project overrides remain authoritative for their scope.
156
50
  <!-- dev-workflow:end -->
@@ -344,6 +344,8 @@ Document the traced flows with file paths at each step. This reveals the actual
344
344
 
345
345
  ### Step 5: Detect Anti-patterns
346
346
 
347
+ For a frontend module, read `dw-ui-discipline/references/frontend-engineering.md` from the installed skills location. Use `.dw/templates/frontend-quality-template.md` to include observed controls, gaps and adoption proposals in that module's `.dw/rules/<module>.md`. Inspect actual scripts/configuration and CI; record unexecuted checks explicitly. Preserve existing policy and distinguish it from recommendations. This documentation-only command does not install tools, change source/configuration or enable new CI gates.
348
+
347
349
  Look for common issues:
348
350
 
349
351
  | Anti-pattern | Detection method | Severity |
@@ -1,259 +1,36 @@
1
1
  <system_instructions>
2
- You are the full pipeline orchestrator. This command receives a user's wish and drives the PRD-to-PR workflow in two invocations:
2
+ # Continuous implementation orchestrator
3
3
 
4
- 1. **Planning invocation:** research/brainstorm when needed, PRD, TechSpec, Tasks, then STOP.
5
- 2. **Execution invocation:** resume from `autopilot-state.json`, run `/dw-goal --from-autopilot <prd-slug>`, then commit and PR gate.
4
+ `/dw-autopilot "<wish>"` plans and carries approved work through implementation and validation. `/dw-autopilot --from-prd <slug>` starts from `.dw/spec/<slug>/prd.md`; missing PRD blocks with its path. `/dw-autopilot` without a wish resumes saved state. Do not impose a second invocation after task approval. A user request only to plan or an active platform Plan mode still ends at the planning artifact.
6
5
 
7
- <critical>The first invocation MUST stop after the planning artifacts are complete. Do not run implementation, QA, review, commit, or PR in the first invocation.</critical>
8
- <critical>The second invocation MUST resume from the saved state and delegate Run → Review → QA/Fix → Review to `/dw-goal --from-autopilot <prd-slug>`.</critical>
9
- <critical>Each step that invokes a `/dw-*` command MUST follow the complete instructions from `.dw/commands/`. Read and execute the full command, not a summarized version.</critical>
6
+ ## Planning
10
7
 
11
- ## When to Use
12
- - Use when you want to go from an idea to a PR with minimal manual intervention but a hard planning stop.
13
- - Use for complete features that require planning, execution, quality gates, and PR readiness.
14
- - Do NOT use for small, well-scoped one-off tasks; use `/dw-run` with an existing plan.
15
- - Do NOT use for surgical bug fixes; use `/dw-bugfix`.
16
- - Do NOT use when the user wants manual control between every phase; use individual commands.
8
+ 1. Inspect relevant source/rules and existing decisions. Use `.dw/intel/` when useful; research only unknown technologies/domains/integrations. Brainstorm only unresolved choices, not a mandatory three-option interview.
9
+ 2. Invoke `/dw-plan` or its relevant stages to produce PRD, TechSpec, tasks and tasks-validation.md. Reuse answered decisions and aligned handoffs. Ask material uncovered questions with the available interview tool; do not re-ask discovered facts.
10
+ 3. At task breakdown present local/cross-tool development, concrete model/effort and relevant agents by task complexity. Follow `.dw/references/execution-contract.md`, write/validate execution-plan.json, and obtain approval of the same task/assignment matrix. Existing stage approvals remain honored; do not repeat them.
11
+ 4. Save `autopilot-state.json` with `status: plan_complete`, `current_step: goal`, planning artifacts, approved assignments path and `next_command: /dw-goal --from-autopilot <slug>`. In an implementation request continue immediately to execution. In a planning-only request report the plan and preserve this resume point.
17
12
 
18
- ## Pipeline Position
19
- **Predecessor:** user wish | **Successor:** `/dw-goal`, `/dw-commit`, `/dw-generate-pr`
13
+ ## Execution and delivery
20
14
 
21
- ## Complementary Skills / Commands
15
+ Arm `/dw-report` once (idempotent, skipped when `DW_REPORT_AUTO=off`). Invoke `/dw-goal --from-autopilot <slug>` to own `/dw-run` → full `/dw-review` → applicable `/dw-qa` → `/dw-qa --fix` for Open bugs → post-QA review when edits or new findings invalidate the prior review. Do not substitute coverage-only review for the full review. External runners return to the parent for corrections and continuation; they do not end the goal.
22
16
 
23
- | Skill or command | Trigger |
24
- |------------------|---------|
25
- | `dw-memory` | ALWAYS — preserve decisions across planning, goal execution, QA, review, and PR. |
26
- | `dw-verify` | ALWAYS — invoked by gates and downstream commands before approval/commit/PR claims. |
27
- | `/dw-goal` | ALWAYS on the second invocation — durable execution-quality objective. |
17
+ Use `dw-memory` for durable decisions and `dw-verify` for valid evidence. Security Gate remains mandatory where applicable: `/dw-secure-audit` produces `.dw/secure-audit/audit-summary.md`; missing/invalid evidence is regenerated and blocking findings are fixed. SECRET findings always block (no ADR escape). Reuse a valid scan instead of repeating it solely at another checkpoint.
28
18
 
29
- ## Input Variables
19
+ The goal completes only with acceptance criteria met, required review/QA artifacts and valid checks, and no unresolved blocking finding. For escalated `prd-bugfix-*`, find the originating `.dw/bugfixes/*/escalated.md`, produce missing SUMMARY.md from evidence, and close the index.
30
20
 
31
- | Variable | Description | Example |
32
- |----------|-------------|---------|
33
- | `{{WISH}}` | Description of what the user wants to build in default mode. | `"push notification preferences"` |
34
- | `{{PRD_SLUG}}` | Existing PRD slug when `--from-prd` is used. | `prd-bugfix-stripe-webhook-retry` |
35
- | `{{MODE}}` | Optional invocation flag. | `--from-prd <slug>` |
21
+ Inspect scoped task commits and remaining bookkeeping; `/dw-commit` handles an authorized final commit when needed. Do not create empty commits or demand an extra commit for already committed work. Prepare the validated branch/worktree and delivery summary. Merge, push and PR publication proceed only within existing authorization. If final authorization is absent, present the concrete result and request only that action; do not re-ask permission already granted.
36
22
 
37
- ## Invocation Modes
23
+ ## Durable state
38
24
 
39
- | Invocation | Behavior |
40
- |------------|----------|
41
- | `/dw-autopilot "<wish>"` | Planning invocation from scratch. Runs Codebase Intelligence → optional Research → Brainstorm → PRD → TechSpec → Tasks, writes state, then stops. |
42
- | `/dw-autopilot --from-prd <slug>` | Planning invocation from an existing PRD. Starts at PRD approval, then TechSpec → Tasks, writes state, then stops. |
43
- | `/dw-autopilot` on a PRD with `autopilot-state.json status=plan_complete` | Execution invocation. Runs `/dw-goal --from-autopilot <slug>`, then commit and PR gate. |
25
+ Preserve `autopilot-state.json` fields: mode, wish, prd_path, from_prd_slug, current_step, completed_steps, skipped_steps, skip_reasons, gates_passed, step_artifacts, goal_slug, next_command, started_at, last_updated. Add `execution_plan` and `execution_state` paths. Record evidence, not merely file existence, before marking a step complete.
44
26
 
45
- ## Required Pause Points
46
-
47
- Autopilot pauses at:
48
-
49
- 1. **PRD approval** before TechSpec.
50
- 2. **Tasks approval** before marking planning complete.
51
- 3. **Mandatory planning stop** after Tasks are approved and state is saved.
52
- 4. **PR gate** after the execution goal and commit complete.
53
-
54
- Between these points, execute automatically while still respecting blocking questions required by the underlying command.
55
-
56
- ## Session Resumption
57
-
58
- If this command is re-invoked on the same PRD:
59
-
60
- <critical>Read `.dw/spec/<prd-slug>/autopilot-state.json` first. If `status` is `plan_complete`, do not repeat planning. Start the execution invocation by formally invoking `/dw-goal --from-autopilot <prd-slug>`.</critical>
61
-
62
- State meanings:
63
-
64
- | Status | Action |
65
- |--------|--------|
66
- | missing state | Start normal planning invocation. |
67
- | `planning` | Resume from `current_step`, respecting completed/skipped steps. |
68
- | `plan_complete` | Start execution invocation via `/dw-goal --from-autopilot <prd-slug>`. |
69
- | `goal_active` | Continue `/dw-goal resume` or `/dw-goal --from-autopilot <prd-slug>` according to `.dw/goals/autopilot-<prd-slug>/status.json`. |
70
- | `goal_complete` | Continue to commit and PR gate. |
71
- | `completed` | Report already completed and show PR/commit summary if available. |
72
-
73
- ## Planning Invocation
74
-
75
- ### Step 0: Resolve Invocation Mode
76
-
77
- 1. If `--from-prd <slug>` is present:
78
- - Resolve to `.dw/spec/<slug>/`.
79
- - Verify `prd.md` exists; otherwise STOP with: `--from-prd target .dw/spec/<slug>/prd.md not found. Run /dw-plan prd or fix the slug.`
80
- - Create or update `autopilot-state.json` with `mode: "from-prd"`, `status: "planning"`, `skipped_steps: [1,2,3,4]`, and `skip_reasons["1-4"] = "from-prd-mode"`.
81
- - Jump to PRD approval using the existing PRD.
82
- 2. Otherwise:
83
- - Create or update `autopilot-state.json` with `mode: "autopilot"`, `status: "planning"`, original wish, and `current_step: 1`.
84
-
85
- ### Step 1: Codebase Intelligence
86
-
87
- <critical>If `.dw/intel/` exists, query it via `/dw-intel` before planning. Fall back to `.dw/rules/` and direct grep if absent.</critical>
88
-
89
- - Identify tech stack, existing patterns, related features, and project constraints.
90
- - If `.dw/intel/` is absent, suggest `/dw-intel --build` for richer future context, but continue with `.dw/rules/` and direct inspection.
91
-
92
- ### Step 2: Research (Conditional)
93
-
94
- Run `/dw-brainstorm --research` when the feature involves new technology, unknown domain, external APIs, regulation, or high-impact architecture. Otherwise skip and record the reason in `skip_reasons`.
95
-
96
- ### Step 3: Brainstorm (Interactive)
97
-
98
- Run `/dw-brainstorm` with accumulated context. Present three directions and wait for the user to choose one before continuing.
99
-
100
- ### Step 4: PRD
101
-
102
- Run `/dw-plan prd` using brainstorm/research findings.
103
-
104
- <critical>The PRD stage must use the structured interview tool when available. If unavailable, ask the required questions in chat and record the fallback. The user must answer; do not infer answers.</critical>
105
-
106
- After `prd.md` exists, present PRD summary and wait for explicit approval. If the user requests edits, update and re-present.
107
-
108
- ### Step 5: TechSpec
109
-
110
- Run `/dw-plan techspec` from the approved PRD.
111
-
112
- <critical>The TechSpec stage must use the structured interview tool when available. If unavailable, ask the required questions in chat and record the fallback. The user must answer; do not infer answers.</critical>
113
-
114
- After `techspec.md` exists, present TechSpec summary and wait for explicit approval.
115
-
116
- ### Step 6: Tasks
117
-
118
- Run `/dw-plan tasks` from PRD + TechSpec. Verify:
119
- - `tasks.md` exists.
120
- - per-task files exist.
121
- - `tasks-validation.md` exists and passes or has an explicit user override.
122
-
123
- ### Step 7: Tasks Approval and Mandatory Stop
124
-
125
- Present task summary, dependencies, and total effort. Wait for explicit approval.
126
-
127
- After approval:
128
-
129
- 1. Save `.dw/spec/<prd-slug>/autopilot-state.json` with:
130
-
131
- ```json
132
- {
133
- "status": "plan_complete",
134
- "current_step": "goal",
135
- "next_command": "/dw-goal --from-autopilot <prd-slug>"
136
- }
137
- ```
138
-
139
- 2. Include `completed_steps` for all completed planning steps and `step_artifacts` for `prd.md`, `techspec.md`, `tasks.md`, per-task files, and `tasks-validation.md`.
140
- 3. STOP and tell the user the planning phase is complete. Do not run implementation in this invocation.
141
-
142
- ## Execution Invocation
143
-
144
- ### Step 8: Durable Execution Goal
145
-
146
- First arm the progress loop: invoke `/dw-report` (auto-arm contract — idempotent, skipped when `DW_REPORT_AUTO=off`). It reports done / doing / remaining every 10 minutes through the goal, the Security Gate, commit, and PR, and disarms itself with a final report at the PR gate.
147
-
148
- When `autopilot-state.json status=plan_complete`, formally invoke:
149
-
150
- ```text
151
- /dw-goal --from-autopilot <prd-slug>
152
- ```
153
-
154
- The goal owns this sequence:
155
-
156
- 1. `/dw-run <prd-path>`
157
- 2. `/dw-review <prd-path>` (full review: coverage, quality, conventions, constitution, verify)
158
- 3. `/dw-qa <prd-path>`
159
- 4. `/dw-qa --fix <prd-path>` if QA found Open bugs
160
- 5. `/dw-review <prd-path>` again after QA/fixes
161
- 6. **Security Gate** — the post-QA `/dw-review` (step 5) triggers `/dw-secure-audit`, producing a fresh `.dw/secure-audit/audit-summary.md`. This step **ensures** that verdict is APPROVED: if it is missing/stale/REJECTED, run `/dw-secure-audit <prd-path>` standalone, then loop back to `/dw-bugfix` per finding and re-check. SECRET findings always block (no ADR escape). Do not force a second full scan when a fresh APPROVED summary already exists.
162
-
163
- <critical>Do not substitute `/dw-review --coverage-only` for the goal reviews. The autopilot quality goal requires full `/dw-review` before QA and after QA fixes.</critical>
164
-
165
- After `/dw-goal` completes, verify `.dw/goals/autopilot-<prd-slug>/status.json` has `status: "complete"`, then set `autopilot-state.json status: "goal_complete"`.
166
-
167
- ### Step 9: Bugfix Loop Close (Conditional)
168
-
169
- If `mode == "from-prd"` and the PRD slug matches `prd-bugfix-*`, close the bugfix index before commit:
170
- - Find `.dw/bugfixes/*/escalated.md` that references the PRD slug.
171
- - If `SUMMARY.md` is missing, write it from available PRD, TechSpec, QA, and diff evidence using `.dw/templates/bugfix-summary-template.md`.
172
- - Never fabricate verification evidence.
173
- - Record artifacts in `autopilot-state.json`.
174
-
175
- ### Step 10: Pre-Commit Audit
176
-
177
- Before `/dw-commit`, verify:
178
- - `.dw/goals/autopilot-<prd-slug>/status.json` is complete.
179
- - `<prd-path>/QA/review-consolidated.md` exists from the final post-QA review.
180
- - `<prd-path>/QA/qa-report.md` and `<prd-path>/QA/bugs.md` exist.
181
- - **Security Gate passed:** `.dw/secure-audit/audit-summary.md` exists, is fresh (post-last-edit), and status is APPROVED. If missing/stale/REJECTED → STOP (do not commit).
182
- - `autopilot-state.json` records planning artifacts and the completed goal.
183
-
184
- If anything is missing, STOP and re-run the missing formal command. Do not commit partial work.
185
-
186
- ### Step 11: Commit
187
-
188
- Run `/dw-commit` automatically. Do not wait for approval after the goal is complete.
189
-
190
- ### Step 12: Pull Request Gate
191
-
192
- Ask: **"Commits completed. Do you want to generate the Pull Request?"**
193
-
194
- - YES: run `/dw-generate-pr`.
195
- - NO: report that commits are ready and PR can be generated later.
196
-
197
- Mark `autopilot-state.json status: "completed"` after commit, and include PR link if generated.
198
-
199
- ## State Persistence
200
-
201
- `autopilot-state.json` must include:
202
-
203
- ```json
204
- {
205
- "mode": "autopilot",
206
- "status": "planning",
207
- "wish": "original user description",
208
- "prd_path": ".dw/spec/prd-name",
209
- "from_prd_slug": null,
210
- "current_step": 1,
211
- "completed_steps": [],
212
- "skipped_steps": [],
213
- "skip_reasons": {},
214
- "gates_passed": [],
215
- "step_artifacts": {},
216
- "goal_slug": null,
217
- "next_command": null,
218
- "started_at": "2026-05-20T00:00:00Z",
219
- "last_updated": "2026-05-20T00:00:00Z"
220
- }
221
- ```
222
-
223
- Update state after each completed or skipped step. A step is complete only after required artifacts exist.
224
-
225
- ## Progress Format
226
-
227
- Report progress after each step:
228
-
229
- ```text
230
- === AUTOPILOT =====================================
231
- OK [1] Codebase Intelligence
232
- OK [2] Research (skipped — known domain)
233
- OK [3] Brainstorm
234
- OK [4] PRD
235
- OK [5] TechSpec
236
- OK [6] Tasks
237
- STOP [PLAN COMPLETE] Next: /dw-goal --from-autopilot prd-name
238
- ===================================================
239
- ```
240
-
241
- During execution invocation:
242
-
243
- ```text
244
- === AUTOPILOT =====================================
245
- OK [PLAN] Already complete
246
- RUN [GOAL] /dw-goal --from-autopilot prd-name
247
- NEXT [COMMIT] after goal status=complete
248
- ===================================================
249
- ```
250
-
251
- ## Anti-patterns
252
-
253
- - Do not continue into implementation during the first invocation.
254
- - Do not skip `/dw-goal` during the second invocation.
255
- - Do not replace full `/dw-review` with a narrower review in the execution goal.
256
- - Do not mark state complete from manual validation alone.
257
- - Do not re-run planning when `status=plan_complete`; resume the goal.
27
+ | status | Resume action |
28
+ |---|---|
29
+ | missing / planning | Continue only unfinished planning; preserve resolved decisions. |
30
+ | plan_complete | Execute approved plan through `/dw-goal --from-autopilot <slug>` when implementation is requested. |
31
+ | goal_active | `/dw-goal resume` using saved task/executor state. |
32
+ | goal_complete | Prepare delivery and remaining authorized commit/publication actions. |
33
+ | completed | Report validated delivery and links/branch; publication may still be pending authorization. |
258
34
 
35
+ Update state after each checkpoint. Report current task, evidence and remaining work compactly. Preserve checkpoints on user pause or actual blocker; fix recoverable in-scope failures and continue.
259
36
  </system_instructions>
@@ -264,11 +264,11 @@
264
264
  | Question | If YES -> |
265
265
  |----------|-----------|
266
266
  | Needs migration/schema change? | Redirect to PRD |
267
- | Affects more than 5 files? | Redirect to PRD |
267
+ | Broader file scope? | Reassess organization and actual risk; no automatic stop |
268
268
  | Requires new endpoint? | Redirect to PRD |
269
269
  | Changes existing API contract? | Redirect to PRD |
270
270
  | Affects multiple projects? | Redirect to PRD |
271
- | Estimate > 2 hours of implementation? | Redirect to PRD |
271
+ | Larger implementation estimate? | Reorganize/checkpoint within approved scope |
272
272
 
273
273
  **If excessive scope detected:**
274
274
  ```
@@ -300,45 +300,19 @@
300
300
  - With `--analysis`: Go to step 6
301
301
  - Without `--analysis`: Continue to step 5
302
302
 
303
- ### 5.0. Safety Valve (MANDATORY before step 5)
303
+ ### 5.0. Safety Valve (before implementation)
304
304
 
305
- <critical>
306
- BEFORE drafting the numbered task list in step 5, sketch the inline steps you intend to write.
307
- If that sketch reveals **more than 5 distinct numbered tasks**, OR **any cross-file dependency that means tasks must be executed in a specific order**, OR **a task that requires running database migration / refactor / new endpoint / API contract change**, then the bugfix scope was UNDERESTIMATED and you MUST escalate.
308
- </critical>
309
-
310
- **Why this exists:** the triage at step 0 catches scope problems from the symptom description. The checkpoint at 4.1 catches them after root cause analysis. This valve catches the remaining case — when the fix itself, once laid out, reveals more complexity than triage and root cause analysis predicted. There is NO bypass flag. Escalation is the correct outcome.
311
-
312
- **Escalation procedure:**
313
-
314
- 1. Allocate `NNN` for `.dw/bugfixes/NNN-<slug>/`. Write `TASK.md` with the triage, clarifications, root cause, and the would-be plan.
315
- 2. Create `.dw/spec/prd-bugfix-<slug>/` and write `prd.md` there (use `.dw/templates/bugfix-template.md`). This is the path `/dw-plan` expects.
316
- 3. Write `.dw/bugfixes/NNN-<slug>/escalated.md` with: `Escalated to /dw-plan on <YYYY-MM-DD> — reason: <which valve criterion tripped> → see .dw/spec/prd-bugfix-<slug>/`.
317
- 4. Report to the user:
318
-
319
- ```
320
- ## Scope larger than a bugfix
321
-
322
- Listing the fix produced [N] tasks / [cross-file deps] / [forbidden change type].
323
- Per the safety valve, this is no longer a surgical bugfix.
324
-
325
- Bugfix index preserved at `.dw/bugfixes/NNN-<slug>/{TASK.md, escalated.md}`.
326
- PRD created at `.dw/spec/prd-bugfix-<slug>/prd.md`.
327
-
328
- Next — pick one:
329
- - Manual chain: `/dw-plan techspec prd-bugfix-<slug>` → `/dw-plan tasks prd-bugfix-<slug>` → `/dw-run` → `/dw-qa` → `/dw-review` → `/dw-commit` → `/dw-generate-pr`.
330
- - Hand off to autopilot: `/dw-autopilot --from-prd prd-bugfix-<slug>` — runs the planning phase from the existing PRD, stops after Tasks, then a later autopilot invocation resumes through `/dw-goal`.
331
- ```
305
+ Inspect the proposed fix for material scope or architecture changes. Task count, file count, ordering dependencies and larger estimates are signals to organize work, not automatic blockers. Refactoring required to fix approved behavior can remain in scope. A new product contract, sensitive migration or unresolved architecture decision needs a concrete proposal before dependent implementation.
332
306
 
333
- 5. Stop this command. Do not proceed to step 5. The user (or autopilot) invokes `/dw-plan` or `/dw-autopilot --from-prd` next.
307
+ When a structured plan is needed, preserve `.dw/bugfixes/NNN-<slug>/TASK.md`, create `.dw/spec/prd-bugfix-<slug>/prd.md` using the bugfix template, and record the cross-reference in `escalated.md`. Continue through `/dw-plan` or `/dw-autopilot --from-prd prd-bugfix-<slug>` according to existing user intent. The task breakdown proposes executor/model/agents; after approval continue in the same invocation. Do not re-ask permission to organize an already authorized fix. An analysis-only request still ends with its report.
334
308
 
335
- **If the valve does NOT trip:** Continue to step 5.
309
+ If no material new decision or structured plan is needed, continue to step 5.
336
310
 
337
311
  ### 5. Propose Numbered Tasks (Required)
338
312
 
339
313
  <critical>
340
314
  List ALL necessary tasks, numbered sequentially.
341
- Wait for approval before executing.
315
+ Use existing approval for the same task scope; ask only for new material decisions before executing.
342
316
  </critical>
343
317
 
344
318
  **Format:**
@@ -425,8 +399,8 @@
425
399
 
426
400
  Option B (hand off to autopilot):
427
401
  1. Run: `/dw-autopilot --from-prd prd-bugfix-<slug>`
428
- 2. Autopilot runs PRD approval, TechSpec, and Tasks, then stops with `status: plan_complete`.
429
- 3. A later autopilot invocation resumes via `/dw-goal --from-autopilot prd-bugfix-<slug>` for Run, full Review, QA/Fix, and post-QA full Review before commit/PR.
402
+ 2. Autopilot runs PRD approval, TechSpec, and Tasks, records `status: plan_complete` and continues after task/execution approval.
403
+ 3. The same invocation continues via `/dw-goal --from-autopilot prd-bugfix-<slug>` for Run, full Review, QA/Fix, and post-QA full Review before commit/PR.
430
404
 
431
405
  The bugfix index entry stays queryable via `/dw-intel "bugfix history in <module>"`. Downstream `/dw-review --bugfix <slug>` and `/dw-qa --bugfix <slug>` still target `.dw/bugfixes/NNN-<slug>/` when you want a focused review of just the eventual surgical patch.
432
406
  ```