@brunosps00/dev-workflow 2.1.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +118 -0
  3. package/README.md +17 -6
  4. package/lib/constants.js +24 -20
  5. package/lib/init.js +34 -0
  6. package/lib/instruction-health.js +38 -0
  7. package/lib/post-update.js +2 -1
  8. package/lib/validate.js +3 -1
  9. package/package.json +1 -1
  10. package/scaffold/config/routing.json +61 -23
  11. package/scaffold/en/agent-instructions.md +31 -135
  12. package/scaffold/en/commands/dw-analyze-project.md +2 -0
  13. package/scaffold/en/commands/dw-autopilot.md +22 -243
  14. package/scaffold/en/commands/dw-bugfix.md +9 -35
  15. package/scaffold/en/commands/dw-claude-run.md +29 -45
  16. package/scaffold/en/commands/dw-codex-run.md +30 -45
  17. package/scaffold/en/commands/dw-context-budget.md +6 -14
  18. package/scaffold/en/commands/dw-copilot-run.md +29 -41
  19. package/scaffold/en/commands/dw-generate-pr.md +2 -2
  20. package/scaffold/en/commands/dw-goal.md +11 -5
  21. package/scaffold/en/commands/dw-harness-audit.md +2 -0
  22. package/scaffold/en/commands/dw-help.md +8 -4
  23. package/scaffold/en/commands/dw-pause.md +1 -0
  24. package/scaffold/en/commands/dw-plan.md +14 -7
  25. package/scaffold/en/commands/dw-qa.md +2 -0
  26. package/scaffold/en/commands/dw-report.md +169 -0
  27. package/scaffold/en/commands/dw-resume.md +5 -11
  28. package/scaffold/en/commands/dw-review.md +4 -3
  29. package/scaffold/en/commands/dw-run.md +19 -165
  30. package/scaffold/en/commands/dw-skill-health.md +7 -0
  31. package/scaffold/en/commands/dw-update.md +18 -4
  32. package/scaffold/en/commands/dw-worktree.md +100 -0
  33. package/scaffold/en/references/command-routing.md +53 -0
  34. package/scaffold/en/references/execution-contract.md +55 -0
  35. package/scaffold/en/templates/frontend-quality-template.md +43 -0
  36. package/scaffold/en/templates/task-template.md +20 -40
  37. package/scaffold/en/templates/tasks-template.md +9 -6
  38. package/scaffold/en/templates/techspec-template.md +4 -0
  39. package/scaffold/pt-br/agent-instructions.md +31 -135
  40. package/scaffold/pt-br/commands/dw-analyze-project.md +2 -0
  41. package/scaffold/pt-br/commands/dw-autopilot.md +22 -243
  42. package/scaffold/pt-br/commands/dw-bugfix.md +9 -35
  43. package/scaffold/pt-br/commands/dw-claude-run.md +29 -46
  44. package/scaffold/pt-br/commands/dw-codex-run.md +30 -45
  45. package/scaffold/pt-br/commands/dw-context-budget.md +6 -14
  46. package/scaffold/pt-br/commands/dw-copilot-run.md +29 -43
  47. package/scaffold/pt-br/commands/dw-generate-pr.md +2 -2
  48. package/scaffold/pt-br/commands/dw-goal.md +11 -5
  49. package/scaffold/pt-br/commands/dw-harness-audit.md +2 -0
  50. package/scaffold/pt-br/commands/dw-help.md +8 -4
  51. package/scaffold/pt-br/commands/dw-pause.md +1 -0
  52. package/scaffold/pt-br/commands/dw-plan.md +14 -7
  53. package/scaffold/pt-br/commands/dw-qa.md +2 -0
  54. package/scaffold/pt-br/commands/dw-report.md +169 -0
  55. package/scaffold/pt-br/commands/dw-resume.md +7 -11
  56. package/scaffold/pt-br/commands/dw-review.md +4 -3
  57. package/scaffold/pt-br/commands/dw-run.md +19 -165
  58. package/scaffold/pt-br/commands/dw-skill-health.md +7 -0
  59. package/scaffold/pt-br/commands/dw-update.md +18 -4
  60. package/scaffold/pt-br/commands/dw-worktree.md +100 -0
  61. package/scaffold/pt-br/references/command-routing.md +53 -0
  62. package/scaffold/pt-br/references/execution-contract.md +55 -0
  63. package/scaffold/pt-br/templates/frontend-quality-template.md +43 -0
  64. package/scaffold/pt-br/templates/task-template.md +20 -40
  65. package/scaffold/pt-br/templates/tasks-template.md +9 -6
  66. package/scaffold/pt-br/templates/techspec-template.md +4 -0
  67. package/scaffold/scripts/hooks/git-guardrails.mjs +1 -0
  68. package/scaffold/scripts/lib/workflow-contract.mjs +101 -0
  69. package/scaffold/scripts/lib/worktree-gc.mjs +460 -0
  70. package/scaffold/skill-registry.json +23 -23
  71. package/scaffold/skills/dw-cli-run/SKILL.md +33 -208
  72. package/scaffold/skills/dw-cli-run/references/dispatch-tuning.md +14 -72
  73. package/scaffold/skills/dw-codebase-intel/SKILL.md +5 -39
  74. package/scaffold/skills/dw-codebase-intel/agents/intel-updater.md +1 -1
  75. package/scaffold/skills/dw-codebase-intel/references/agents-detail.md +7 -0
  76. package/scaffold/skills/dw-codebase-intel/references/files-in-dw-intel-detail.md +16 -0
  77. package/scaffold/skills/dw-codebase-intel/references/how-dw-intel-reads-this-detail.md +12 -0
  78. package/scaffold/skills/dw-codebase-intel/references/how-to-compose-the-typical-flow-detail.md +11 -0
  79. package/scaffold/skills/dw-council/SKILL.md +2 -17
  80. package/scaffold/skills/dw-council/references/integration-with-other-dw-commands-detail.md +7 -0
  81. package/scaffold/skills/dw-council/references/phase-2-tensions-and-rebuttals-detail.md +15 -0
  82. package/scaffold/skills/dw-domain-modeling/SKILL.md +1 -1
  83. package/scaffold/skills/dw-execute-phase/SKILL.md +12 -32
  84. package/scaffold/skills/dw-execute-phase/agents/executor.md +15 -252
  85. package/scaffold/skills/dw-execute-phase/agents/plan-checker.md +4 -207
  86. package/scaffold/skills/dw-execute-phase/references/atomic-commits.md +8 -18
  87. package/scaffold/skills/dw-execute-phase/references/de-sloppify-pass-optional-cleanup-task-detail.md +12 -0
  88. package/scaffold/skills/dw-execute-phase/references/deviation-rules-during-execution-detail.md +8 -0
  89. package/scaffold/skills/dw-execute-phase/references/how-the-two-agents-compose-detail.md +7 -0
  90. package/scaffold/skills/dw-execute-phase/references/plan-verification.md +9 -155
  91. package/scaffold/skills/dw-execute-phase/references/wave-coordination.md +6 -97
  92. package/scaffold/skills/dw-git-discipline/SKILL.md +2 -2
  93. package/scaffold/skills/dw-grilling/SKILL.md +1 -1
  94. package/scaffold/skills/dw-incident-response/SKILL.md +1 -64
  95. package/scaffold/skills/dw-incident-response/references/the-five-phases-detail.md +66 -0
  96. package/scaffold/skills/dw-llm-eval/SKILL.md +5 -53
  97. package/scaffold/skills/dw-llm-eval/references/agent-tool-use-evaluation-detail.md +23 -0
  98. package/scaffold/skills/dw-llm-eval/references/anti-patterns-will-block-in-dw-review-code-only-detail.md +9 -0
  99. package/scaffold/skills/dw-llm-eval/references/consistency-run-to-run-stability-detail.md +10 -0
  100. package/scaffold/skills/dw-llm-eval/references/integration-with-dev-workflow-commands-detail.md +6 -0
  101. package/scaffold/skills/dw-llm-eval/references/the-oracle-ladder-detail.md +15 -0
  102. package/scaffold/skills/dw-memory/SKILL.md +4 -50
  103. package/scaffold/skills/dw-memory/references/context-budget.md +8 -56
  104. package/scaffold/skills/dw-memory/references/promotion-decision-test-detail.md +30 -0
  105. package/scaffold/skills/dw-minimalism/SKILL.md +4 -5
  106. package/scaffold/skills/dw-review-rigor/SKILL.md +1 -54
  107. package/scaffold/skills/dw-review-rigor/references/the-five-rules-detail.md +56 -0
  108. package/scaffold/skills/dw-simplification/SKILL.md +2 -55
  109. package/scaffold/skills/dw-simplification/references/pattern-recognition-detail.md +11 -0
  110. package/scaffold/skills/dw-simplification/references/the-five-rules-detail.md +48 -0
  111. package/scaffold/skills/dw-source-grounding/SKILL.md +1 -56
  112. package/scaffold/skills/dw-source-grounding/references/the-protocol-detect-fetch-implement-cite-detail.md +58 -0
  113. package/scaffold/skills/dw-testing-discipline/SKILL.md +25 -177
  114. package/scaffold/skills/dw-testing-discipline/references/agent-guardrails.md +9 -167
  115. package/scaffold/skills/dw-testing-discipline/references/core-rules.md +3 -3
  116. package/scaffold/skills/dw-testing-discipline/references/mutation-testing.md +19 -0
  117. package/scaffold/skills/dw-testing-discipline/references/patterns.md +3 -12
  118. package/scaffold/skills/dw-ui-discipline/SKILL.md +2 -59
  119. package/scaffold/skills/dw-ui-discipline/references/frontend-engineering.md +46 -0
  120. package/scaffold/skills/dw-ui-discipline/references/the-four-grounding-questions-detail.md +61 -0
  121. package/scaffold/skills/dw-verify/SKILL.md +26 -148
  122. package/scaffold/skills/dw-verify/references/verification-discovery-and-attribution.md +2 -2
  123. package/scaffold/skills/humanizer/SKILL.md +2 -1
  124. package/scaffold/skills/security-review/SKILL.md +3 -183
  125. package/scaffold/skills/security-review/references/do-not-flag-detail.md +49 -0
  126. package/scaffold/skills/security-review/references/quick-patterns-reference-detail.md +56 -0
  127. package/scaffold/skills/security-review/references/review-process-detail.md +84 -0
  128. package/scaffold/skills/vercel-react-best-practices/SKILL.md +1 -90
  129. package/scaffold/skills/vercel-react-best-practices/references/quick-reference-detail.md +92 -0
@@ -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
  ```
@@ -1,51 +1,35 @@
1
1
  <system_instructions>
2
- You are the **Claude runner adapter**. You fire `claude -p` (headless) inside a **dedicated git worktree** to
3
- implement a prepared prompt/spec, capture the whole run to a durable audit log, keep a **resumable per-task
4
- session**, score the delivery 0–10, escalate on failure, and **STOP for the gate**.
2
+ # Claude runner
5
3
 
6
- <critical>Load and follow the `dw-cli-run` skill — it holds the full CLI-agnostic protocol (hard worktree rule, pre-flight, vehicle choice, dual 0–10 evaluation, graded escalation, telemetry, kill/detection discipline, Structured Return). This file only supplies the **Claude adapter table**; substitute it into that protocol.</critical>
7
- <critical>NEVER run in the repo's main checkout — only a dedicated worktree off main. ABORT (`BLOCKED`) otherwise.</critical>
8
- <critical>NEVER merge or push. Merge is the owner's decision after the gate.</critical>
4
+ Use `dw-cli-run` for the shared protocol. Consume the approved task assignment and return to the parent for review, corrections and continuation. Standalone invocation accepts an explicitly prepared prompt without requiring a PRD. WRITE requires a dedicated secondary worktree; READ-ONLY follows the skill’s enforced read-only rules. The worker never merges or pushes.
9
5
 
10
- ## Claude adapter table (substitute into `dw-cli-run`)
6
+ Run the examples with cwd set to `<WORKTREE>` by the process launcher. Substitute arguments safely, preferably as a subprocess argument array. Placeholder permission arguments mean the existing approved profile, not a bypass flag. Preserve effective permissions on resume; initial and resume commands may support different flags. Validate both help outputs before dispatch.
11
7
 
12
- | Slot | Claude value |
8
+ ## Claude adapter table
9
+
10
+ | Slot | Value |
13
11
  |---|---|
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
- | `STREAM` | `--output-format stream-json --include-partial-messages --verbose` (`--verbose` is **required** with `stream-json` in `-p` mode) |
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 |
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` |
22
- | `RESUME_LAST` | `claude -c -p …` (continue the most recent conversation in this cwd) |
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. |
24
- | `DONE_SIGNAL` | the final `{"type":"result"}` message in the stream (carries `subtype`, `usage`, `total_cost_usd`, `num_turns`) |
25
- | `USAGE` | the `result` message `usage` → `input_tokens` / `cache_read_input_tokens` / `cache_creation_input_tokens` / `output_tokens`, plus `total_cost_usd`. Extract: `grep -oE '"usage":\{[^}]*\}' <AUDIT>/<slug>.log \| tail -1` |
26
-
27
- **Model + effort:** `--model` selects the tier (`opus` · `sonnet` · `haiku`, or a full id). `--effort` selects the
28
- reasoning budget: `low` · `medium` · `high` · `xhigh` · `max` (supported by the Claude CLI ≥ 2.1.206). Escalate per
29
- `dw-cli-run`: raise `--effort` first (low→medium→high→xhigh→max), then bump `--model` one tier and reset effort.
30
- Start one notch below the ceiling.
31
-
32
- ## Session resume (the heart)
33
- Because you pass `--session-id "$UUID"`, the id is **fixed and known** at dispatch — write it to
34
- `<AUDIT>/<slug>.session` (durable, outside the worktree → survives `git worktree remove`). To come back with the
35
- **same context**, read the id and re-run `RESUME <id>` (`claude --resume "$UUID" -p …`) with the follow-up prompt
36
- — Claude reloads the same conversation (its reasoning + files already touched). Fallback if the sidecar is gone:
37
- `claude -c -p …` from the same worktree (continues the most recent conversation there).
38
-
39
- ## Input Variables
40
- | Variable | Description | Example |
41
- |----------|-------------|---------|
42
- | `<WORKTREE>` | dedicated git worktree (off main) | `~/code/vizzita-billing-s10` |
43
- | `<PROMPT>` | prepared prompt/spec path | `.dw/spec/prd-billing-integrador/codex-prompt.md` |
44
- | `<slug>` | task key for audit/session files | `prd-billing-integrador` |
45
- | `<AUDIT>` | durable audit dir OUTSIDE the worktree | `~/code/vizzita/.dw/cli-run` |
46
- | `<MODEL>` | Claude tier or full model id | `opus` / `sonnet` / `haiku` |
47
- | `<EFFORT>` | reasoning budget (Claude CLI ≥ 2.1.206) | `low` / `medium` / `high` / `xhigh` / `max` |
48
-
49
- Return via the `dw-cli-run` **Structured Return** (Status/Score/Scope/Evidence/Artifacts/Decisions/Risks/Telemetry/
50
- Next Step), including the fixed `session-id` (UUID), its sidecar path, and the exact `RESUME` command to continue.
12
+ | `DISPATCH` | `claude -p --session-id "<SESSION_ID>" --model "<MODEL>" --effort "<EFFORT>" <PERMISSIONS> --output-format stream-json --include-partial-messages --verbose < "<PROMPT>" > "<AUDIT>/<slug>.log" 2>&1` |
13
+ | `STREAM` | `--output-format stream-json --verbose` |
14
+ | `MODEL` | `--model "<MODEL>"` |
15
+ | `EFFORT` | `--effort "<EFFORT>"` |
16
+ | `AUTO` | <PERMISSIONS> — approved non-interactive profile; retain existing configuration |
17
+ | `AUTO_READONLY` | `--permission-mode plan --tools "Read,Grep,Glob" --strict-mcp-config` |
18
+ | `NO_MCP` | Select only capabilities needed, if supported; preserve user configuration otherwise |
19
+ | `RESUME <id>` | `claude --resume "<SESSION_ID>" -p --model "<MODEL>" --effort "<EFFORT>" <RESUME_PERMISSIONS> --output-format stream-json --include-partial-messages --verbose < "<FOLLOWUP_PROMPT>" >> "<AUDIT>/<slug>.log" 2>&1` |
20
+ | `SESSION_ID` | UUID generated before dispatch (`node -e "console.log(require('node:crypto').randomUUID())"`) → `<AUDIT>/<slug>.session` |
21
+ | `DONE_SIGNAL` | `result` with its subtype |
22
+ | `USAGE` | `result.usage` and reported `total_cost_usd` |
23
+
24
+ Create/reuse through `/dw-worktree create <slug>`; after authorized integration, `/dw-worktree merge <slug>` owns merge and safe cleanup. Workers return to the parent and never invoke integration themselves.
25
+
26
+ ## Model selection and resume
27
+
28
+ Resolve concrete model/effort at task breakdown using `.dw/config/routing.json`, current provider metadata and the installed tool. Do not embed a fixed strongest-to-lightest model list in this adapter. Supported effort values depend on model/version; low, medium, high, xhigh and max are candidates only when supported. No mandatory escalation to the ceiling.
29
+
30
+ Store task, provider, worktree, approved assignment, session ID and audit path before handoff. If the session sidecar is absent, recover the exact task session from its log; never blindly continue the latest cwd session. If identity cannot be proven, start a new session from saved state and the actual diff, preserving partial work. Provider sessions are not portable across CLIs.
31
+
32
+ Return the `dw-cli-run` Structured Return with evidence and the exact supported resume command. The parent continues the approved plan; merge/push/publication require applicable authorization.
33
+
34
+ Capability inspection: Claude Code 2.1.265.
51
35
  </system_instructions>
@@ -1,51 +1,36 @@
1
1
  <system_instructions>
2
- You are the **Codex runner adapter**. You fire `codex exec` inside a **dedicated git worktree** to implement a
3
- prepared prompt/spec, capture the whole run to a durable audit log, keep a **resumable per-task session**, score
4
- the delivery 0–10, escalate on failure, and **STOP for the gate**.
2
+ # Codex runner
5
3
 
6
- <critical>Load and follow the `dw-cli-run` skill — it holds the full CLI-agnostic protocol (hard worktree rule, pre-flight, vehicle choice, dual 0–10 evaluation, graded escalation, telemetry, kill/detection discipline, Structured Return). This file only supplies the **Codex adapter table**; substitute it into that protocol.</critical>
7
- <critical>NEVER run in the repo's main checkout — only a dedicated worktree off main. ABORT (`BLOCKED`) otherwise.</critical>
8
- <critical>NEVER merge or push. Merge is the owner's decision after the gate.</critical>
4
+ Use `dw-cli-run` for the shared protocol. Consume the approved task assignment and return to the parent for review, corrections and continuation. Standalone invocation accepts an explicitly prepared prompt without requiring a PRD. WRITE requires a dedicated secondary worktree; READ-ONLY follows the skill’s enforced read-only rules. The worker never merges or pushes.
9
5
 
10
- ## Codex adapter table (substitute into `dw-cli-run`)
6
+ Run the examples with cwd set to `<WORKTREE>` by the process launcher. Substitute arguments safely, preferably as a subprocess argument array. Placeholder permission arguments mean the existing approved profile, not a bypass flag. Preserve effective permissions on resume; initial and resume commands may support different flags. Validate both help outputs before dispatch.
11
7
 
12
- | Slot | Codex value |
8
+ ## Codex adapter table
9
+
10
+ | Slot | Value |
13
11
  |---|---|
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
- | `STREAM` | `--json` (JSONL events) |
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). |
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` |
22
- | `RESUME_LAST` | `codex exec resume --last …` (filters by cwd = the worktree) |
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`. |
24
- | `DONE_SIGNAL` | `{"type":"turn.completed"}` in the stream log |
25
- | `USAGE` | `turn.completed.usage` → `input_tokens` / `cached_input_tokens` / `output_tokens` / `reasoning_output_tokens`. Extract: `grep -oE '"usage":\{[^}]*\}' <AUDIT>/<slug>.log \| tail -1` |
26
-
27
- **Models (strong→light):** `gpt-5.5` · `gpt-5.3-codex` · `gpt-5.4` · `gpt-5.3-codex-spark` · `gpt-5.4-mini`.
28
- **Effort:** `low` · `medium` · `high` · `xhigh`. Start one notch below the ceiling; escalate per `dw-cli-run`.
29
-
30
- **Detailed report (recommended):** add `--output-schema <schema.json>` requiring a rich report
31
- (`summary`/`tasks`/`filesChanged`/`gate`/`fenceViolations`/`uncommitted`/`blockers`/`nextSteps`) — don't accept an
32
- opaque "ok". The `codex-prompt.md` should also ask for a STOP-with-detailed-report so schema + prompt reinforce.
33
-
34
- ## Session resume (the heart)
35
- First run: capture the `thread_id` to `<AUDIT>/<slug>.session` (durable, outside the worktree → survives
36
- `git worktree remove`). To come back with the **same context**, read the id and re-run `RESUME <id>` with the
37
- follow-up prompt — Codex continues the same thread (reasoning + files already touched). Fallback if the sidecar is
38
- gone: `codex exec resume --last` from the same worktree.
39
-
40
- ## Input Variables
41
- | Variable | Description | Example |
42
- |----------|-------------|---------|
43
- | `<WORKTREE>` | dedicated git worktree (off main) | `~/code/vizzita-billing-s10` |
44
- | `<PROMPT>` | prepared prompt/spec path | `.dw/spec/prd-billing-integrador/codex-prompt.md` |
45
- | `<slug>` | task key for audit/session files | `prd-billing-integrador` |
46
- | `<AUDIT>` | durable audit dir OUTSIDE the worktree | `~/code/vizzita/.dw/cli-run` |
47
-
48
- Return via the `dw-cli-run` **Structured Return** (Status/Score/Scope/Evidence/Artifacts/Decisions/Risks/Telemetry/
49
- Next Step), including the captured `thread_id`, its sidecar path, and the exact `RESUME` command to continue.
50
- Tested: codex-cli 0.141.0.
12
+ | `DISPATCH` | `codex exec -m "<MODEL>" -c 'model_reasoning_effort="<EFFORT>"' <PERMISSIONS> --json -o "<AUDIT>/<slug>.last.md" - < "<PROMPT>" > "<AUDIT>/<slug>.log" 2>&1` |
13
+ | `STREAM` | `--json` |
14
+ | `MODEL` | `-m "<MODEL>"` |
15
+ | `EFFORT` | `-c 'model_reasoning_effort="<EFFORT>"'` |
16
+ | `AUTO` | <PERMISSIONS> — approved non-interactive profile; retain existing configuration |
17
+ | `AUTO_READONLY` | `--sandbox read-only` |
18
+ | `NO_MCP` | Select only capabilities needed, if supported; preserve user configuration otherwise |
19
+ | `RESUME <id>` | `codex exec resume "<SESSION_ID>" -m "<MODEL>" -c 'model_reasoning_effort="<EFFORT>"' <RESUME_PERMISSIONS> --json - < "<FOLLOWUP_PROMPT>" >> "<AUDIT>/<slug>.log" 2>&1` |
20
+ | `SESSION_ID` | `thread.started.thread_id` → `<AUDIT>/<slug>.session` |
21
+ | `DONE_SIGNAL` | `turn.completed` |
22
+ | `USAGE` | `turn.completed.usage` |
23
+
24
+ Create/reuse through `/dw-worktree create <slug>`; after authorized integration, `/dw-worktree merge <slug>` owns merge and safe cleanup. Workers return to the parent and never invoke integration themselves.
25
+
26
+ ## Model selection and resume
27
+
28
+ Resolve concrete model/effort at task breakdown using `.dw/config/routing.json`, current provider metadata and the installed tool. Do not embed a fixed strongest-to-lightest model list in this adapter. Supported effort values depend on model/version; low, medium, high, xhigh and max are candidates only when supported. No mandatory escalation to the ceiling.
29
+
30
+ Store task, provider, worktree, approved assignment, session ID and audit path before handoff. If the session sidecar is absent, recover the exact task session from its log; never blindly continue the latest cwd session. If identity cannot be proven, start a new session from saved state and the actual diff, preserving partial work. Provider sessions are not portable across CLIs.
31
+
32
+ Return the `dw-cli-run` Structured Return with evidence and the exact supported resume command. The parent continues the approved plan; merge/push/publication require applicable authorization.
33
+
34
+ Capability inspection: codex-cli 0.153.4.
35
+ The current `exec resume` help lacks `--sandbox`; do not copy initial flags blindly or add bypass to compensate. Use an equivalent supported approved profile/config, otherwise block that resume mode and reconstruct a new restricted session. TOML `mcp_servers='{}'` alone is not proof inherited MCP entries were disabled.
51
36
  </system_instructions>
@@ -7,23 +7,15 @@ You are the context budget auditor for dev-workflow.
7
7
  - Use during `/dw-analyze-project` follow-up when the harness looks bloated.
8
8
 
9
9
  ## Process
10
- 1. Count approximate tokens for `CLAUDE.md`, `AGENTS.md`, `.dw/commands/*.md`, `.agents/skills/*/SKILL.md`, `.agents/agents/*.md`, `.claude/agents/*.md`, `.opencode/agent/*.md`, `.github/agents/*.agent.md`, `.dw/subtasks/pending/*/HANDOFF.md`, and `.claude/settings.json`.
11
- 2. Estimate prose tokens as `words * 1.3`; estimate JSON/tool schemas as `chars / 4`.
12
- 3. Flag:
13
- - command files over 20KB,
14
- - skill `SKILL.md` files over 12KB,
15
- - agent files over 8KB,
16
- - missing agent `output_budget_words` in `.dw/agent-registry.json` or scaffold registry,
17
- - pending handoffs averaging over 1200 words,
18
- - Copilot agents above 30k chars,
19
- - more than 10 MCP servers,
20
- - duplicate agent/skill names across platform folders,
21
- - Claude/OpenCode agent files with provider-incompatible tool or permission fields.
22
- 4. Recommend the top 5 savings with concrete paths.
10
+ 1. Separate three categories: permanent instructions for the active host; discovery metadata (skill/command names and descriptions); and on-demand command bodies, skill bodies, references and handoffs. Disk inventory is not simultaneous context consumption. Count only the active host's surfaces; platform copies alone are not duplicated live context.
11
+ 2. Label prose estimates (`words * 1.3`, schema `chars / 4`) as estimates, not measured tokens. Report each category separately and observed loads only when telemetry exists.
12
+ 3. Check project budgets: installed managed instruction block ≤6000 bytes per locale; skill entrypoints ≤8000 bytes; descriptions ≤250 characters. Commands over 20KB and agent files over 8KB are review signals, not evidence they were loaded. Review overlapping triggers, unconditional reference loads, broken links and incompatible provider metadata.
13
+ 4. In this repository `npm run validate` enforces entrypoint/description budgets and routed references through `lib/instruction-health.js`. In a consumer project inspect installed files; do not require the package source to exist there.
14
+ 5. Report the top concrete savings. Audit `.dw/config/routing.json` candidates against current provider information, noting stale choices without overwriting owner configuration.
23
15
 
24
16
  ## Part B — Runtime spend (actual token cost)
25
17
 
26
- Static overhead (above) is what the harness *loads*; this part is what sessions actually *cost*. Report from `.dw/metrics/costs.jsonl` (appended by the `session-cost` SessionEnd hook — one row per session with per-model token usage + estimated USD):
18
+ The inventory above estimates potential context; this part reports observed session usage. Report from `.dw/metrics/costs.jsonl` (appended by the `session-cost` SessionEnd hook — one row per session with per-model token usage + estimated USD):
27
19
 
28
20
  1. Read `.dw/metrics/costs.jsonl` if present. If absent, note "no runtime cost data yet (hook disabled or no session has ended)" and skip this part — never fail.
29
21
  2. Dedupe by `session_id` (latest row per session wins).
@@ -1,47 +1,35 @@
1
1
  <system_instructions>
2
- You are the **Copilot runner adapter**. You fire the GitHub Copilot CLI (`copilot -p`) inside a **dedicated git
3
- worktree** to implement a prepared prompt/spec, capture the whole run to a durable audit log, keep a **resumable
4
- per-task session**, score the delivery 0–10, escalate on failure, and **STOP for the gate**.
2
+ # Copilot runner
5
3
 
6
- <critical>Load and follow the `dw-cli-run` skill — it holds the full CLI-agnostic protocol (hard worktree rule, pre-flight, vehicle choice, dual 0–10 evaluation, graded escalation, telemetry, kill/detection discipline, Structured Return). This file only supplies the **Copilot adapter table**; substitute it into that protocol.</critical>
7
- <critical>NEVER run in the repo's main checkout — only a dedicated worktree off main. ABORT (`BLOCKED`) otherwise.</critical>
8
- <critical>NEVER merge or push. Merge is the owner's decision after the gate.</critical>
4
+ Use `dw-cli-run` for the shared protocol. Consume the approved task assignment and return to the parent for review, corrections and continuation. Standalone invocation accepts an explicitly prepared prompt without requiring a PRD. WRITE requires a dedicated secondary worktree; READ-ONLY follows the skill’s enforced read-only rules. The worker never merges or pushes.
9
5
 
10
- ## Copilot adapter table (substitute into `dw-cli-run`)
6
+ Run the examples with cwd set to `<WORKTREE>` by the process launcher. Substitute arguments safely, preferably as a subprocess argument array. Placeholder permission arguments mean the existing approved profile, not a bypass flag. Preserve effective permissions on resume; initial and resume commands may support different flags. Validate both help outputs before dispatch.
11
7
 
12
- | Slot | Copilot value |
8
+ ## Copilot adapter table
9
+
10
+ | Slot | Value |
13
11
  |---|---|
14
- | `DISPATCH` | `cd <WORKTREE> && copilot -p "$(cat <PROMPT>)" --allow-all --model <MODEL> --output-format json </dev/null > <AUDIT>/<slug>.log 2>&1` |
15
- | `STREAM` | `--output-format json` (JSONL records) |
16
- | `AUTO` | `--allow-all` (auto-approve all tool/command use; justified because the worktree is isolated). Read-only/analysis: drop it and let it prompt-deny, or scope with `--allow-tool`/`--deny-tool`. |
17
- | `RESUME <id>` | `cd <WORKTREE> && copilot --resume="<SESSION_ID>" -p "$(cat <FOLLOWUP_PROMPT>)" --allow-all --output-format json </dev/null >> <AUDIT>/<slug>.log 2>&1` (also: `--connect=<SESSION_ID>`) |
18
- | `RESUME_LAST` | `copilot --continue -p …` (continue the most recent session in this cwd) |
19
- | `SESSION_ID` | Copilot's `--resume`/`--session-id` **RESUME** an existing session (they don't fix a new one) → **capture** the id from the first run: scan the stream/log for the session id record, or read the newest dir under `~/.copilot/logs` / `~/.copilot/history-session-state`. Write it to `<AUDIT>/<slug>.session`. **Confirm the exact id field in the smoke test.** |
20
- | `DONE_SIGNAL` | the final JSON record of the stream (end-of-turn) |
21
- | `USAGE` | the final record's token usage (confirm the exact field names in the smoke test) |
22
-
23
- **Model:** `--model` selects the engine (e.g. `claude-sonnet-4.5`, `gpt-5`). Copilot has no numeric effort flag;
24
- map "escalation" to model tier. Start one tier below the ceiling; escalate per `dw-cli-run`.
25
-
26
- ## Session resume (the heart)
27
- Copilot does not let you fix the id, so on the first run **capture** the session id (from the stream/log or
28
- `~/.copilot/logs`) and write it to `<AUDIT>/<slug>.session` (durable, outside the worktree → survives
29
- `git worktree remove`). To come back with the **same context**, read the id and re-run `RESUME <id>`
30
- (`copilot --resume="<id>" -p …` or `--connect=<id>`) with the follow-up prompt — Copilot reloads the same session.
31
- Fallback if the sidecar is gone: `copilot --continue -p …` from the same worktree.
32
-
33
- > **Smoke-test confirmations (per the plan):** the exact session-id field in the JSONL, the usage field names, and
34
- > that `--resume=<id>` truly continues the same context — verify these on a throwaway worktree before relying on
35
- > them, and update this table with what you find.
36
-
37
- ## Input Variables
38
- | Variable | Description | Example |
39
- |----------|-------------|---------|
40
- | `<WORKTREE>` | dedicated git worktree (off main) | `~/code/vizzita-billing-s10` |
41
- | `<PROMPT>` | prepared prompt/spec path | `.dw/spec/prd-billing-integrador/codex-prompt.md` |
42
- | `<slug>` | task key for audit/session files | `prd-billing-integrador` |
43
- | `<AUDIT>` | durable audit dir OUTSIDE the worktree | `~/code/vizzita/.dw/cli-run` |
44
-
45
- Return via the `dw-cli-run` **Structured Return** (Status/Score/Scope/Evidence/Artifacts/Decisions/Risks/Telemetry/
46
- Next Step), including the captured `session-id`, its sidecar path, and the exact `RESUME` command to continue.
12
+ | `DISPATCH` | `copilot -p "<PROMPT_TEXT>" --model "<MODEL>" <PERMISSIONS> --output-format json > "<AUDIT>/<slug>.log" 2>&1` |
13
+ | `STREAM` | `--output-format json` (verify installed CLI) |
14
+ | `MODEL` | `--model "<MODEL>"` |
15
+ | `EFFORT` | Use `default` when no effort flag is supported; never invent a flag |
16
+ | `AUTO` | <PERMISSIONS> — approved non-interactive profile; retain existing configuration |
17
+ | `AUTO_READONLY` | Resolve enforced read-only tool controls from installed help; block READ-ONLY if unavailable |
18
+ | `NO_MCP` | Select only capabilities needed, if supported; preserve user configuration otherwise |
19
+ | `RESUME <id>` | `copilot --resume="<SESSION_ID>" -p "<FOLLOWUP_TEXT>" --model "<MODEL>" <RESUME_PERMISSIONS> --output-format json >> "<AUDIT>/<slug>.log" 2>&1` |
20
+ | `SESSION_ID` | Capture exact ID from this task’s stream; verify event schema against installed CLI → `<AUDIT>/<slug>.session` |
21
+ | `DONE_SIGNAL` | Provider terminal record plus process exit and inspected report |
22
+ | `USAGE` | Reported usage fields only; unknown if absent |
23
+
24
+ Create/reuse through `/dw-worktree create <slug>`; after authorized integration, `/dw-worktree merge <slug>` owns merge and safe cleanup. Workers return to the parent and never invoke integration themselves.
25
+
26
+ ## Model selection and resume
27
+
28
+ Resolve concrete model/effort at task breakdown using `.dw/config/routing.json`, current provider metadata and the installed tool. Do not embed a fixed strongest-to-lightest model list in this adapter. Supported effort values depend on model/version; low, medium, high, xhigh and max are candidates only when supported. No mandatory escalation to the ceiling.
29
+
30
+ Store task, provider, worktree, approved assignment, session ID and audit path before handoff. If the session sidecar is absent, recover the exact task session from its log; never blindly continue the latest cwd session. If identity cannot be proven, start a new session from saved state and the actual diff, preserving partial work. Provider sessions are not portable across CLIs.
31
+
32
+ Return the `dw-cli-run` Structured Return with evidence and the exact supported resume command. The parent continues the approved plan; merge/push/publication require applicable authorization.
33
+
34
+ Capability inspection: Copilot adapter requires installed-version capability validation.
47
35
  </system_instructions>
@@ -13,11 +13,11 @@ You are an assistant specialized in creating well-documented Pull Requests. Your
13
13
 
14
14
  | Skill | Trigger |
15
15
  |-------|---------|
16
- | `dw-verify` | **ALWAYS** — invoked before `git push`. Without a VERIFICATION REPORT PASS in the current session AFTER the last code edit, the PR **CANNOT** be created. |
16
+ | `dw-verify` | **ALWAYS** — invoked before `git push`. Without a VERIFICATION REPORT PASS valid for the current inputs, environment and scope, the PR **CANNOT** be created. |
17
17
  | `dw-git-discipline` | **ALWAYS** — validates branch naming (`<type>/<scope>` kebab-case), atomic-commit history (each commit single-intent, conventional message), branch lifetime (flag if >7 days old), and PR scope (suggest split if diff > ~400 lines). PR description follows summary + test plan structure, not a `git log` dump. |
18
18
  | `/dw-secure-audit` | **ALWAYS for TS/Python/C#/Rust projects** — a fresh `.dw/secure-audit/audit-summary.md` with status ≠ REJECTED is required for supported-language projects. |
19
19
 
20
- <critical>Hard gate 1 (verify): if the current session has no VERIFICATION REPORT PASS from `dw-verify` produced AFTER the last edit/commit, STOP and invoke `dw-verify` before proceeding. A PR is a permanent artifact — it demands the highest verification standard.</critical>
20
+ <critical>Hard gate 1 (verify): use `dw-verify` to confirm valid passing evidence for current inputs, environment and scope before push/PR. Reuse equivalent evidence; run missing or invalidated required checks. No new-session or bookkeeping-only-commit reset.</critical>
21
21
 
22
22
  <critical>Hard gate 2 (security): for TS/Python/C#/Rust projects, if `.dw/secure-audit/audit-summary.md` is missing, stale (predates the last edit), OR has REJECTED status, STOP and invoke `/dw-secure-audit` before proceeding. SECRET findings and HIGH/CRITICAL vulnerabilities CANNOT reach the PR. For other languages (Go, Java, etc.), this gate is skipped with a note.</critical>
23
23
 
@@ -4,7 +4,7 @@ You are the dev-workflow durable goal orchestrator. This command gives every sup
4
4
  ## When to Use
5
5
  - Use when a workflow is larger than one normal turn but has a clear finish line.
6
6
  - Use after `/dw-plan` when implementation, review, QA, and post-QA review should run as one durable loop.
7
- - Use from `/dw-autopilot` after the first invocation has completed PRD → TechSpec → Tasks.
7
+ - Use from `/dw-autopilot` after the approved PRD → TechSpec → Tasks plan is ready.
8
8
  - Do NOT use for loose backlogs, unrelated task lists, or exploratory brainstorming.
9
9
 
10
10
  ## Position in Pipeline
@@ -28,7 +28,7 @@ You are the dev-workflow durable goal orchestrator. This command gives every sup
28
28
  Official Codex guidance treats `/goal` as an experimental durable objective for long-running work with a verifiable stopping condition. In Codex CLI it requires `features.goals`; it can be set with `/goal <objective>`, inspected with `/goal`, and controlled with `/goal pause`, `/goal resume`, or `/goal clear`.
29
29
 
30
30
  When running in Codex:
31
- - If a native goal tool is available, create/update it with a short objective pointing to `.dw/goals/<slug>/goal.md`.
31
+ - Use native goal tools only when explicitly requested and permitted by their actual tool contract; never infer native-goal authorization from a portable workflow alone.
32
32
  - If the interactive `/goal` slash command is available and `features.goals` is enabled, use `/goal <objective>` with an objective under 4,000 characters.
33
33
  - If native goals are unavailable, continue with the portable `.dw/goals/` loop. Do not block.
34
34
 
@@ -101,12 +101,12 @@ Checkpoints:
101
101
  | `review-before-qa` | `/dw-review <prd-path>` | `<prd-path>/QA/review-consolidated.md` exists and overall verdict is approved or approved with explicit non-blocking caveats. |
102
102
  | `qa` | `/dw-qa <prd-path>` | Required QA artifacts exist. |
103
103
  | `qa-fix` | `/dw-qa --fix <prd-path>` when `bugs.md` has Open bugs | Bugs are Fixed/Closed or explicitly deferred by user. |
104
- | `review-after-qa` | `/dw-review <prd-path>` | Consolidated review exists after QA fixes and is approved or approved with explicit non-blocking caveats. |
104
+ | `review-after-qa` | `/dw-review <prd-path>` when QA edits/findings invalidate review | Current consolidated review is approved or approved with explicit non-blocking caveats; unchanged QA reuses valid review. |
105
105
 
106
106
  The goal is complete only when:
107
107
  - All checkpoints above are complete or explicitly skipped with a documented reason.
108
108
  - No Open QA bug remains unless the user explicitly accepted deferral.
109
- - The final `/dw-review` ran after the last QA fix.
109
+ - The final full `/dw-review` covers the current implementation. Repeat after QA edits or new findings; reuse when QA invalidated nothing.
110
110
  - `status.json` has `"status": "complete"`.
111
111
 
112
112
  ## Execution Rules
@@ -123,7 +123,7 @@ The goal is complete only when:
123
123
 
124
124
  - `status`: read `status.json` and last 10 entries of `progress.md`; report current checkpoint, completed checkpoints, last verification, and blockers.
125
125
  - `pause`: set `status: "paused"` and append why.
126
- - `resume`: set `status: "active"` and continue from `current_checkpoint`; do not repeat completed checkpoints unless artifacts are missing.
126
+ - `resume`: set `status: "active"` and continue from `current_checkpoint`; do not repeat completed checkpoints unless artifacts are missing or evidence was invalidated.
127
127
  - `clear`: if complete/cancelled/replaced, mark `status: "cancelled"` or archive according to project convention. Do not delete evidence by default.
128
128
 
129
129
  ## Anti-patterns
@@ -133,4 +133,10 @@ The goal is complete only when:
133
133
  - Do not mark a checkpoint complete without checking artifacts.
134
134
  - Do not use native Codex `/goal` as the only state; `.dw/goals/` remains the cross-agent contract.
135
135
 
136
+ ## Approved execution state
137
+
138
+ Read `.dw/references/execution-contract.md`. Consume approved task assignments and preserve `execution-state.json` through checkpoints. A runner return goes back to the parent for review, corrections and next tasks. Do not repeat `/dw-run`'s final full review when it already covers the unchanged implementation: validate its evidence and record the checkpoint as reused. Conditional/inapplicable QA needs a recorded reason, not invented artifacts. Complete the goal by verifying acceptance and evidence first, then set status complete; the status field itself does not prove completion.
139
+
140
+ Resume preserves completed checkpoints unless evidence is invalid or artifacts are missing. Separate delivery from merge/push/publication authorization. Keep partial work on block/pause and never silently change a task's executor.
141
+
136
142
  </system_instructions>
@@ -22,7 +22,9 @@ You are the dev-workflow harness auditor.
22
22
  - Verification gates
23
23
  - Security gates
24
24
  - Context discipline
25
+ - Worktree hygiene
25
26
  3. For structured skill returns, inspect bundled skill `SKILL.md` files and require a `## Structured Return` contract with `Status`, `Evidence`, `Artifacts`, and `Next Step`.
27
+ 3b. For worktree hygiene, run `node .dw/scripts/lib/worktree-gc.mjs list --strict`. Exit 3 (any `REMOVABLE` or `PRUNABLE` worktree) caps the category at 3/10; cite each leftover with its size and verdict and recommend `/dw-worktree clean --apply`. `KEEP:*` entries are informational.
26
28
  4. Cite missing paths, broken references, stale managed files, and skills without a structured return.
27
29
  5. Recommend the top 3 fixes.
28
30
 
@@ -19,11 +19,11 @@ Use `/dw-autopilot "wish"` as the gateway for most feature work. The granular co
19
19
 
20
20
  | Command | When |
21
21
  |---------|------|
22
- | `/dw-autopilot "wish"` | Default entry point in two invocations. First run plans and stops; second run resumes through `/dw-goal`, Security Gate, commit, and PR. |
22
+ | `/dw-autopilot "wish"` | Plan and approve execution assignments, then continue through implementation, review and validation. |
23
23
  | `/dw-bugfix "description"` | A bug or error report. Surgical fix or PRD route. |
24
24
  | `/dw-help [keyword]` | This screen. Pass a keyword for shortcuts. `--advanced` reveals internal commands. |
25
25
 
26
- ## Tier 2 — Pipeline granular (10)
26
+ ## Tier 2 — Pipeline granular (11)
27
27
 
28
28
  | Command | What |
29
29
  |---------|------|
@@ -35,10 +35,11 @@ Use `/dw-autopilot "wish"` as the gateway for most feature work. The granular co
35
35
  | `/dw-qa` | Mode-aware QA (UI / API auto-detect). Flags: `--fix`, `--api`, `--ai`, `--uat`, `--bugfix <slug>`. |
36
36
  | `/dw-pause` | Save session state, decisions, blockers, todos, and open loops into `.dw/STATE.md`. |
37
37
  | `/dw-resume` | Read `.dw/STATE.md`, show a TLDR, and suggest the next `dw-*` command. |
38
+ | `/dw-report [--every <N>m]` | Timestamped done / doing / remaining report every 10 minutes while long work runs; appended to `.dw/reports/`. `now`, `status`, `stop`. Auto-armed by `/dw-run`, `/dw-autopilot`, and the CLI runners. |
38
39
  | `/dw-commit` | Atomic Conventional Commits for pending work. |
39
40
  | `/dw-generate-pr [target]` | Push branch, draft PR body, open browser. |
40
41
 
41
- ## Tier 3 — Specialty (12)
42
+ ## Tier 3 — Specialty (13)
42
43
 
43
44
  | Command | What |
44
45
  |---------|------|
@@ -50,6 +51,7 @@ Use `/dw-autopilot "wish"` as the gateway for most feature work. The granular co
50
51
  | `/dw-context-budget` | Audit context overhead from commands, skills, agents, instructions, and MCPs. |
51
52
  | `/dw-harness-audit` | Score dev-workflow install health: wrappers, agents, MCPs, gates. |
52
53
  | `/dw-skill-health` | Audit skills and agents for bloat, duplication, and missing references. |
54
+ | `/dw-worktree <list\|create\|clean\|merge>` | Worktree lifecycle: create prepared, list with verdicts, clean only proven-merged (dry-run default), ff-only merge + remove in the same turn. Never `--force`. |
53
55
  | `/dw-new-project` | Interview-driven bootstrap (stack + infra + docker-compose + CI). |
54
56
  | `/dw-dockerize` | Detect stack, propose Dockerfile + docker-compose for dev/prod. |
55
57
  | `/dw-install-azure-skills` | Opt-in Azure skills + Microsoft Learn MCP setup. Interactive category selection. |
@@ -103,6 +105,7 @@ Match the keyword and suggest:
103
105
  | `run`, `execute`, `implement` | `/dw-run` |
104
106
  | `goal`, `objective`, `long-running`, `resume autopilot` | `/dw-goal` or `/dw-autopilot` if `autopilot-state.json` exists |
105
107
  | `pause`, `save state`, `end session` | `/dw-pause` |
108
+ | `report`, `progress`, `keep me posted`, `status every` | `/dw-report [--every <N>m]` |
106
109
  | `resume`, `continue`, `where did we stop` | `/dw-resume` |
107
110
  | `review`, `quality`, `audit code` | `/dw-review` |
108
111
  | `qa`, `test plan`, `e2e` | `/dw-qa` |
@@ -121,6 +124,7 @@ Match the keyword and suggest:
121
124
  | `design.md`, `design authority`, `concerns map` | `/dw-analyze-project` (also listed as a post-update action when missing) |
122
125
  | `subagent`, `subtask`, `handoff`, `delegate` | `/dw-subtask-start` or `/dw-subtask-resume` |
123
126
  | `skills`, `skill health`, `bloat` | `/dw-skill-health` |
127
+ | `worktree`, `worktrees`, `disk`, `merge worktree`, `clean worktrees` | `/dw-worktree list` / `create <slug>` / `clean --apply` / `merge <slug>` |
124
128
  | `analyze`, `rules`, `conventions` | `/dw-analyze-project` |
125
129
  | `constitution`, `principles` | `/dw-analyze-project` (Step 8 generates the constitution) |
126
130
  | `security opportunities`, `hardening ideas`, `improve security` | `/dw-opportunities "security"` |
@@ -141,7 +145,7 @@ If no keyword matches, show the default surface and a note: "Keyword `<word>` no
141
145
  ## FAQ
142
146
 
143
147
  **Q: I'm not sure where to start with a new feature.**
144
- - Use `/dw-autopilot "what you want"`. First invocation runs PRD → TechSpec → Tasks and stops; second invocation resumes through `/dw-goal`, Security Gate, commit, and PR.
148
+ - Use `/dw-autopilot "what you want"`; approve the task/executor matrix and continue to validated delivery. Publication follows existing authorization.
145
149
 
146
150
  **Q: Do I have to use `/dw-autopilot`?**
147
151
  - No. The granular pipeline (`/dw-brainstorm` → `/dw-plan` → `/dw-goal` or `/dw-run`/`/dw-qa`/`/dw-review` → `/dw-secure-audit` → `/dw-commit` → `/dw-generate-pr`) gives you control at each step.
@@ -29,6 +29,7 @@ You are a session-handoff agent. Your job is to consolidate the current session'
29
29
  Read the conversation context and identify, **without inventing**:
30
30
 
31
31
  - **Open loops**: tasks/work started but not finished (e.g. "PRD `prd-foo` is at TechSpec stage, awaiting user approval"; "Task 3 of `prd-bar` failing on lint")
32
+ - **Leftover worktrees**: run `node .dw/scripts/lib/worktree-gc.mjs list`. Every `REMOVABLE` entry is an open loop to close **now** with `/dw-worktree clean --apply` — not something to record; `KEEP:*` entries go under Open Loops with their verdict and reason.
32
33
  - **Decisions made**: choices the user and agent agreed on during the session that affect future work
33
34
  - **Blockers encountered**: things that stopped forward motion (waiting on input, broken tooling, knowledge gap)
34
35
  - **Todos** mentioned in passing that don't yet have a PRD or task file