@brunosps00/dev-workflow 2.6.0 → 2.7.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 (56) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +72 -0
  3. package/README.md +7 -4
  4. package/lib/doctor.js +17 -2
  5. package/lib/init.js +16 -6
  6. package/lib/migrate-skills.js +189 -39
  7. package/lib/removed-bundled-skills.js +4 -2
  8. package/lib/skill-registry.js +12 -2
  9. package/lib/uninstall.js +61 -5
  10. package/package.json +1 -1
  11. package/scaffold/en/agent-instructions.md +1 -1
  12. package/scaffold/en/commands/dw-brainstorm.md +2 -2
  13. package/scaffold/en/commands/dw-bugfix.md +1 -1
  14. package/scaffold/en/commands/dw-commit.md +1 -1
  15. package/scaffold/en/commands/dw-dockerize.md +2 -2
  16. package/scaffold/en/commands/dw-functional-doc.md +1 -1
  17. package/scaffold/en/commands/dw-harness-audit.md +1 -1
  18. package/scaffold/en/commands/dw-intel.md +1 -1
  19. package/scaffold/en/commands/dw-learn.md +1 -1
  20. package/scaffold/en/commands/dw-new-project.md +3 -3
  21. package/scaffold/en/commands/dw-plan.md +2 -2
  22. package/scaffold/en/commands/dw-qa.md +6 -5
  23. package/scaffold/en/commands/dw-redesign-ui.md +3 -3
  24. package/scaffold/en/commands/dw-review.md +2 -2
  25. package/scaffold/en/commands/dw-skill-health.md +24 -1
  26. package/scaffold/en/commands/dw-update.md +28 -11
  27. package/scaffold/en/references/invariants.md +4 -0
  28. package/scaffold/en/templates/project-onepager.md +1 -1
  29. package/scaffold/pt-br/agent-instructions.md +1 -1
  30. package/scaffold/pt-br/commands/dw-brainstorm.md +2 -2
  31. package/scaffold/pt-br/commands/dw-bugfix.md +1 -1
  32. package/scaffold/pt-br/commands/dw-commit.md +1 -1
  33. package/scaffold/pt-br/commands/dw-dockerize.md +2 -2
  34. package/scaffold/pt-br/commands/dw-functional-doc.md +1 -1
  35. package/scaffold/pt-br/commands/dw-harness-audit.md +1 -1
  36. package/scaffold/pt-br/commands/dw-intel.md +1 -1
  37. package/scaffold/pt-br/commands/dw-learn.md +1 -1
  38. package/scaffold/pt-br/commands/dw-new-project.md +3 -3
  39. package/scaffold/pt-br/commands/dw-plan.md +2 -2
  40. package/scaffold/pt-br/commands/dw-qa.md +6 -5
  41. package/scaffold/pt-br/commands/dw-redesign-ui.md +3 -3
  42. package/scaffold/pt-br/commands/dw-review.md +2 -2
  43. package/scaffold/pt-br/commands/dw-skill-health.md +24 -1
  44. package/scaffold/pt-br/commands/dw-update.md +28 -11
  45. package/scaffold/pt-br/references/invariants.md +5 -0
  46. package/scaffold/pt-br/templates/project-onepager.md +1 -1
  47. package/scaffold/scripts/hooks/session-cost.mjs +62 -21
  48. package/scaffold/skills/docker-compose-recipes/references/compose-composition.md +1 -1
  49. package/scaffold/skills/dw-llm-eval/SKILL.md +3 -1
  50. package/scaffold/skills/dw-llm-eval/references/integration-with-dev-workflow-commands-detail.md +2 -2
  51. package/scaffold/skills/dw-llm-eval/references/reference-dataset.md +57 -3
  52. package/scaffold/skills/dw-ui-discipline/SKILL.md +8 -5
  53. package/scaffold/skills/dw-ui-discipline/references/accessibility-floor.md +20 -8
  54. package/scaffold/skills/dw-ui-discipline/references/content-stress.md +246 -0
  55. package/scaffold/skills/dw-ui-discipline/references/motion.md +205 -35
  56. package/scaffold/skills/dw-ui-discipline/references/responsive.md +44 -2
package/lib/uninstall.js CHANGED
@@ -3,6 +3,9 @@ const path = require('path');
3
3
  const { COMMANDS, PLATFORMS, MCP_SERVERS } = require('./constants');
4
4
  const { AGENT_TARGETS, LEGACY_AGENT_TARGETS, readAgentRegistry } = require('./agents');
5
5
  const { removeHooks } = require('./hooks');
6
+ const { BUNDLED_SKILLS_REL, LEGACY_BUNDLED_SKILLS_REL } = require('./skill-registry');
7
+ const { classifyLegacySkill, isDevWorkflowSkillCopy, managedSet, moveToBackup, timestamp, MIGRATED_REL } = require('./migrate-skills');
8
+ const { readInstallState } = require('./install-state');
6
9
 
7
10
  function run() {
8
11
  const projectRoot = process.cwd();
@@ -36,7 +39,19 @@ function run() {
36
39
  // 1. Remove .dw/commands/, .dw/templates/, .dw/references/, .dw/scripts/
37
40
  console.log(' Managed files:');
38
41
  removeDir(path.join(projectRoot, '.dw', 'commands'), '.dw/commands/');
39
- removeDir(path.join(projectRoot, '.dw', 'templates'), '.dw/templates/');
42
+ // .dw/templates/overrides/ is the owner's (it wins over the managed templates): keep it.
43
+ const templatesDir = path.join(projectRoot, '.dw', 'templates');
44
+ if (fs.existsSync(templatesDir)) {
45
+ for (const entry of fs.readdirSync(templatesDir)) {
46
+ if (entry === 'overrides') continue;
47
+ fs.rmSync(path.join(templatesDir, entry), { recursive: true, force: true });
48
+ }
49
+ if (fs.readdirSync(templatesDir).length === 0) fs.rmdirSync(templatesDir);
50
+ console.log(` \x1b[31m-\x1b[0m .dw/templates [removed${fs.existsSync(templatesDir) ? ', overrides/ kept' : ''}]`);
51
+ removed++;
52
+ } else {
53
+ skipped++;
54
+ }
40
55
  removeDir(path.join(projectRoot, '.dw', 'references'), '.dw/references/');
41
56
  removeDir(path.join(projectRoot, '.dw', 'scripts'), '.dw/scripts/');
42
57
  removeFile(path.join(projectRoot, '.dw', 'agent-registry.json'));
@@ -57,14 +72,39 @@ function run() {
57
72
  }
58
73
  console.log();
59
74
 
60
- // 3. Remove bundled skills from .agents/skills/
75
+ // 3. Remove bundled skills from .dw/skills/ (managed by this package). A legacy
76
+ // copy left under .agents/skills/ by a release up to 2.6.0 is moved to
77
+ // .dw/.migrated/<ts>/ — only when it is ours (classifyLegacySkill); a
78
+ // same-named skill installed from elsewhere is kept and reported.
61
79
  console.log(' Bundled skills:');
62
80
  const skillsDir = path.join(__dirname, '..', 'scaffold', 'skills');
63
81
  const bundledSkills = fs.existsSync(skillsDir)
64
82
  ? fs.readdirSync(skillsDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name)
65
83
  : [];
84
+ const managed = managedSet(readInstallState(projectRoot));
85
+ const stamp = timestamp();
86
+ let movedLegacy = 0;
66
87
  for (const skill of bundledSkills) {
67
- removeDir(path.join(projectRoot, '.agents', 'skills', skill));
88
+ removeDir(path.join(projectRoot, BUNDLED_SKILLS_REL, skill));
89
+ const legacy = path.join(projectRoot, LEGACY_BUNDLED_SKILLS_REL, skill);
90
+ if (!fs.existsSync(legacy)) continue;
91
+ const verdict = classifyLegacySkill(projectRoot, skill, managed);
92
+ const rel = path.relative(projectRoot, legacy);
93
+ if (verdict.ours) {
94
+ moveToBackup(projectRoot, legacy, stamp);
95
+ console.log(` \x1b[31m-\x1b[0m ${rel} [moved to ${path.join(MIGRATED_REL, stamp)}/]`);
96
+ removed++;
97
+ movedLegacy++;
98
+ } else {
99
+ console.log(` \x1b[36m!\x1b[0m ${rel} [kept: not a dev-workflow copy (${verdict.reason})]`);
100
+ }
101
+ }
102
+ if (movedLegacy > 0) {
103
+ console.log(` Legacy copies are in ${path.join(MIGRATED_REL, stamp)}/; delete that folder when you no longer need them.`);
104
+ }
105
+ const bundledRoot = path.join(projectRoot, BUNDLED_SKILLS_REL);
106
+ if (fs.existsSync(bundledRoot) && fs.readdirSync(bundledRoot).length === 0) {
107
+ fs.rmdirSync(bundledRoot);
68
108
  }
69
109
  console.log();
70
110
 
@@ -125,8 +165,22 @@ function run() {
125
165
  removeFile(path.join(projectRoot, '.opencode', 'package.json'));
126
166
  removeFile(path.join(projectRoot, '.dw', 'install-state.json'));
127
167
 
128
- // 6. Remove legacy .codex/skills/
129
- removeDir(path.join(projectRoot, '.codex', 'skills'));
168
+ // 6. Retire dev-workflow entries from legacy .codex/skills/ (dw-* wrappers and
169
+ // bundled-skill copies that pass the contract check) by moving them to
170
+ // .dw/.migrated/<ts>/; anything else there belongs to the user or another tool.
171
+ const codexSkills = path.join(projectRoot, '.codex', 'skills');
172
+ if (fs.existsSync(codexSkills)) {
173
+ for (const entry of fs.readdirSync(codexSkills, { withFileTypes: true })) {
174
+ const target = path.join(codexSkills, entry.name);
175
+ const isBundledCopy = bundledSkills.includes(entry.name) && isDevWorkflowSkillCopy(target);
176
+ if (entry.name.startsWith('dw-') || isBundledCopy) {
177
+ moveToBackup(projectRoot, target, stamp);
178
+ console.log(` \x1b[31m-\x1b[0m ${path.relative(projectRoot, target)} [moved to ${path.join(MIGRATED_REL, stamp)}/]`);
179
+ removed++;
180
+ }
181
+ }
182
+ if (fs.readdirSync(codexSkills).length === 0) fs.rmdirSync(codexSkills);
183
+ }
130
184
 
131
185
  // Note: .dw/rules/, .dw/spec/, .dw/intel/ are USER DATA — never removed
132
186
  console.log(`\n ${'='.repeat(40)}`);
@@ -137,6 +191,8 @@ function run() {
137
191
  console.log(' .dw/spec/ (PRDs and specs)');
138
192
  console.log(' .dw/intel/ (codebase index from /dw-intel --build)');
139
193
  console.log(' .dw/minimalism.json (dw-minimalism intensity preference)');
194
+ console.log(' .dw/templates/overrides/ (your template overrides)');
195
+ console.log(' .dw/.migrated/ (anything uninstall or update retired; delete when no longer needed)');
140
196
  console.log();
141
197
  }
142
198
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brunosps00/dev-workflow",
3
- "version": "2.6.0",
3
+ "version": "2.7.0",
4
4
  "description": "AI-driven development workflow commands for any project. Scaffolds a complete PRD-to-PR pipeline with multi-platform AI assistant support.",
5
5
  "bin": {
6
6
  "dev-workflow": "./bin/dev-workflow.js"
@@ -27,7 +27,7 @@ During task breakdown, propose local or cross-tool development and a model, effo
27
27
 
28
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.
29
29
 
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.
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. dev-workflow skills live in `.dw/skills/<name>/`; when a command names one, read it from there. `.agents/skills/` and `.claude/skills/` also hold the user's and other tools' skills: outside `update`, delete nothing there without listing it and asking first. Subagents receive a compact packet and return evidence and decisions, not full logs.
31
31
 
32
32
  ## Completion and boundaries
33
33
 
@@ -61,7 +61,7 @@ digraph brainstorm_decision {
61
61
 
62
62
  ## Complementary Skills
63
63
 
64
- When available in the project under `./.agents/skills/`, use these skills to enrich ideation:
64
+ When available in the project under `./.dw/skills/`, use these skills to enrich ideation:
65
65
 
66
66
  - `dw-council`: invoked by the dispatcher's **council** mode — multi-advisor stress-test of the most promising options with mandatory steel-manning and concession tracking. The dispatcher fires it when 2+ paths tie OR consensus forms too quickly (false-consensus signal). Not invoked on every brainstorm — only when signals justify it.
67
67
  - `dw-simplification`: invoked by the dispatcher's **refactor-audit** mode — applies Chesterton's Fence + complexity metrics + the new **deep-modules** reference (deletion test, locality, leverage, interface depth) to every flagged smell.
@@ -345,7 +345,7 @@ turns and it writes files. Because it is stateful and mutating, it starts **only
345
345
 
346
346
  <critical>Ask exactly ONE unresolved decision per interaction, then wait. Never dump a list of questions.</critical>
347
347
 
348
- Grill is powered by two internal skills (loaded by path from `./.agents/skills/`, never exported):
348
+ Grill is powered by two internal skills (loaded by path from `./.dw/skills/`, never exported):
349
349
  - **`dw-grilling`** — the decision-tree interview engine (dependency ordering, one decision per turn, a
350
350
  recommended answer for every question, facts discovered rather than asked, the shared-understanding gate).
351
351
  - **`dw-domain-modeling`** — the vocabulary engine (canonical terms, fuzzy/overloaded-term challenge, code
@@ -36,7 +36,7 @@
36
36
 
37
37
  ## Complementary Skills
38
38
 
39
- When available in the project at `./.agents/skills/`, use these skills as contextual support without replacing this command:
39
+ When available in the project at `./.dw/skills/`, use these skills as contextual support without replacing this command:
40
40
 
41
41
  - `dw-debug-protocol`: **ALWAYS** — runs the bug through the six-step triage (Reproduce → Localize → Reduce → Fix Root Cause → Guard → Verify End-to-End). Stop-the-line discipline; root-cause over symptom; regression test committed in the same atomic commit. For non-trivial bugs, or after a first fix fails, Step 1 must establish a red-capable feedback loop before theorizing. Non-reproducible bugs follow the instrument-first sub-protocol — no guess fixes without explicit acknowledgement.
42
42
  - `dw-verify`: **ALWAYS** — in Direct mode, invoked before committing the fix. The VERIFICATION REPORT must show the original bug symptom no longer reproduces (not just that tests pass).
@@ -11,7 +11,7 @@
11
11
 
12
12
  ## Complementary Skills
13
13
 
14
- When available in the project under `./.agents/skills/`, use these skills as operational support without replacing this command:
14
+ When available in the project under `./.dw/skills/`, use these skills as operational support without replacing this command:
15
15
 
16
16
  - `dw-git-discipline`: **ALWAYS** — enforces atomic commits (one logical intent per commit; refactor separate from feature), Conventional Commits format, lint+tests+build green BEFORE the commit, and bans bypassing pre-commit hooks (`--no-verify`) or amending pushed commits. When mixed changes are detected, splits via `git add -p`.
17
17
 
@@ -44,7 +44,7 @@ This command is **complementary** to `/dw-new-project`:
44
44
  - Audit/dockerize report: `.dw/audit/dockerize-<YYYY-MM-DD>.md` (PRD scope: `.dw/spec/prd-<slug>/dockerize.md`)
45
45
  - Generated dev artifacts: `<SCOPE>/docker-compose.dev.yml`, `<SCOPE>/Dockerfile.dev`, `<SCOPE>/.dockerignore`
46
46
  - Generated prod artifacts: `<SCOPE>/Dockerfile`, `<SCOPE>/docker-compose.prod.yml` (optional), `<SCOPE>/.dockerignore`
47
- - Recipe source: `.agents/skills/docker-compose-recipes/services/*.yml`
47
+ - Recipe source: `.dw/skills/docker-compose-recipes/services/*.yml`
48
48
 
49
49
  ## Required Behavior — Pipeline
50
50
 
@@ -163,7 +163,7 @@ Without approval: write report (Phase 3 with `status: PLANNED`) and stop.
163
163
  #### 2.1 `--dev` artifacts
164
164
 
165
165
  **`docker-compose.dev.yml`**:
166
- - Compose service blocks from `.agents/skills/docker-compose-recipes/services/*.yml` per `references/compose-composition.md`.
166
+ - Compose service blocks from `.dw/skills/docker-compose-recipes/services/*.yml` per `references/compose-composition.md`.
167
167
  - Add app service(s) at the end: `build: { context: ., dockerfile: Dockerfile.dev }`, `volumes` for hot reload (bind mount source, anonymous volume for `node_modules`/`__pycache__`), `env_file: .env`, `depends_on` with `condition: service_healthy` per `references/healthcheck-patterns.md`.
168
168
  - Preserve each recipe's image tag (do NOT convert any of them to a digest — a digest freezes the base and never picks up a security rebuild), the required credential vars, and the `127.0.0.1` binds. The loopback ports intentionally keep the `apps on host` topology working.
169
169
  - Header comment: `# Generated by /dw-dockerize on YYYY-MM-DD`.
@@ -53,7 +53,7 @@ Works best with project analyzed by `/dw-analyze-project`
53
53
 
54
54
  ## Complementary Skills
55
55
 
56
- When available in the project under `./.agents/skills/`, use these skills as operational support without replacing this command as source of truth:
56
+ When available in the project under `./.dw/skills/`, use these skills as operational support without replacing this command as source of truth:
57
57
 
58
58
  - `dw-testing-discipline`: support for structuring E2E flows (`references/playwright-recipes.md`), evidence collection patterns, and applying core rules + selector hierarchy to any test the doc references
59
59
  - `remotion-best-practices`: mandatory support when there is a final human video, captions, composition, transitions, FFmpeg, or Remotion
@@ -29,7 +29,7 @@ You are the dev-workflow harness auditor.
29
29
  5. Recommend the top 3 fixes.
30
30
 
31
31
  ## Runtime degradation triage (on-demand)
32
- The scorecard above is deterministic **install** health. If instead the *agent* is misbehaving at runtime (loops, objective drift, hallucinated edits, degraded reasoning), that is a different diagnosis: point the user to `.agents/skills/dw-debug-protocol/references/agent-degradation.md` (symptom→cause table + ordered recovery). Advisory only — it does not affect the scorecard.
32
+ The scorecard above is deterministic **install** health. If instead the *agent* is misbehaving at runtime (loops, objective drift, hallucinated edits, degraded reasoning), that is a different diagnosis: point the user to `.dw/skills/dw-debug-protocol/references/agent-degradation.md` (symptom→cause table + ordered recovery). Advisory only — it does not affect the scorecard.
33
33
 
34
34
  ## Output
35
35
  Return a scorecard and do not mutate files. Tell the user to run `dev-workflow repair` for managed-file drift.
@@ -64,7 +64,7 @@ Don't refuse to answer — return the best info available.
64
64
 
65
65
  ### 2. Query shape detection
66
66
 
67
- Classify the user's `{{QUERY}}` into one of the shapes documented in `.agents/skills/dw-codebase-intel/references/query-patterns.md`:
67
+ Classify the user's `{{QUERY}}` into one of the shapes documented in `.dw/skills/dw-codebase-intel/references/query-patterns.md`:
68
68
 
69
69
  - **where-is** — primary: `files.json`, secondary: `apis.json`
70
70
  - **what-uses** — primary: `deps.json` (libs) or `files.json` (symbols)
@@ -23,7 +23,7 @@ Gather signals only from what is already persisted:
23
23
  4. **Present** candidates in chat as a markdown list — id, trigger, action, confidence, evidence. Do NOT write yet.
24
24
  5. **Ask**: "Approve which to store? (ids, or 'all', or 'none'). Any to promote to a constitution principle?"
25
25
  6. On approval:
26
- - Write each approved instinct to `.dw/memory/instincts/<slug>.md` in the format from `.agents/skills/dw-memory/references/instincts.md` (create or update; never duplicate an existing id).
26
+ - Write each approved instinct to `.dw/memory/instincts/<slug>.md` in the format from `.dw/skills/dw-memory/references/instincts.md` (create or update; never duplicate an existing id).
27
27
  - For any the user chooses to promote, hand off to the constitution flow — propose a `P-NNN` principle at `severity: info` for `/dw-analyze-project` Step 8. Do NOT edit `.dw/constitution.md` directly without the user re-confirming.
28
28
  7. Update confidence on existing instincts that new evidence reconfirms or contradicts.
29
29
 
@@ -39,7 +39,7 @@ You are a workspace bootstrap lead for the dev-workflow ecosystem. Your job is t
39
39
  - Project one-pager: `.dw/spec/projects/{{PROJECT_NAME}}.md` (uses `.dw/templates/project-onepager.md`)
40
40
  - Final report: `.dw/spec/projects/{{PROJECT_NAME}}-bootstrap.md`
41
41
  - Seeded rules: `.dw/rules/index.md` (minimal, replaceable later by `/dw-analyze-project`)
42
- - Compose recipes: `.agents/skills/docker-compose-recipes/services/*.yml`
42
+ - Compose recipes: `.dw/skills/docker-compose-recipes/services/*.yml`
43
43
 
44
44
  ## Required Behavior — Pipeline
45
45
 
@@ -157,7 +157,7 @@ If fullstack:
157
157
 
158
158
  #### 3.3 Generate `docker-compose.dev.yml`
159
159
 
160
- 1. Read `.agents/skills/docker-compose-recipes/SKILL.md` and the relevant `services/<name>.yml` files.
160
+ 1. Read `.dw/skills/docker-compose-recipes/SKILL.md` and the relevant `services/<name>.yml` files.
161
161
  2. Apply the merge algorithm in `references/compose-composition.md`:
162
162
  - Concatenate selected service blocks under `services:`.
163
163
  - Aggregate named volumes under `volumes:`.
@@ -300,7 +300,7 @@ monorepo: <pnpm-workspaces|turborepo|nx|none>
300
300
  | ... | ... | ... |
301
301
 
302
302
  ## Services Composed
303
- <table of services with port + UI URL + credential requirements, sourced from .agents/skills/docker-compose-recipes/>
303
+ <table of services with port + UI URL + credential requirements, sourced from .dw/skills/docker-compose-recipes/>
304
304
 
305
305
  ## Next Steps
306
306
  1. `cp .env.example .env`, generate unique local secrets, and set every required value such as `POSTGRES_PASSWORD`.
@@ -30,7 +30,7 @@ You are a planning orchestrator that takes an idea through the full PRD → Tech
30
30
 
31
31
  ## Complementary Skills
32
32
 
33
- When available under `./.agents/skills/`, use these as planning support:
33
+ When available under `./.dw/skills/`, use these as planning support:
34
34
 
35
35
  - `dw-source-grounding`: **ALWAYS** in TechSpec stage — every framework/library decision must cite official docs with version + retrieval date.
36
36
  - `dw-ui-discipline`: **REQUIRED** when the PRD has UI surfaces — runs the 4 grounding questions before any visual design lands in the TechSpec.
@@ -169,7 +169,7 @@ Runs when default mode (after TechSpec approval) OR `plan tasks`.
169
169
  3. **End-to-end coverage:** every user-facing flow has backend + frontend + functional UI subtasks if applicable.
170
170
  4. **Test placement (`dw-testing-discipline`):** every test-adding subtask names its invariant per the placement doctrine. Owning layer specified.
171
171
  5. **Constitution alignment:** every task lists `Constitution: respects P-NNN` or `Constitution: deviates P-NNN — ADR planned: <slug>` or `Constitution: n/a — reason: <one-liner>`.
172
- 6. **LLM-eval subtask (when applicable):** if the PRD has an AI feature, one task must include an Eval Plan subtask (reference dataset path, oracle rungs, judge calibration, target metrics).
172
+ 6. **LLM-eval subtask (when applicable):** if the PRD has an AI feature, one task must include an Eval Plan subtask (reference dataset path, oracle rungs, judge calibration, target metrics), ordered before the implementation subtasks: behavior spec (when / does / must not / keeps working), cases, and a baseline run on the current code where the new-behavior cases fail.
173
173
  7. **Dependency declaration:** each task explicitly lists which previous tasks it depends on. Write the field as `Depends on: none` or `Depends on: 1.0, 2.0` in `tasks.md` and each `<N>_task.md`. Validation rejects cycles.
174
174
  8. **Output locations:**
175
175
  - Summary: `.dw/spec/prd-<feature-slug>/tasks.md`
@@ -48,14 +48,14 @@ Compute `<target>` ONCE at the start; substitute it wherever you see `<target>`
48
48
 
49
49
  ## Complementary Skills
50
50
 
51
- When available under `./.agents/skills/`, these are invoked operationally:
51
+ When available under `./.dw/skills/`, these are invoked operationally:
52
52
 
53
53
  - `dw-testing-discipline`: **(UI mode — ALWAYS)** — core rules and 25 anti-patterns apply to every QA test authored. `references/playwright-recipes.md` for tactical patterns. `references/three-workflow-patterns.md` to pick the right verification mode (UI / network / perf). `references/security-boundary.md` for any flow that crosses an auth boundary.
54
54
  - `api-testing-recipes`: **(API mode — ALWAYS)** — validated snippets for `.http`, pytest+httpx, supertest, WebApplicationFactory, reqwest. Composes per-FR test files in `QA/scripts/api/` and JSONL logs in `QA/logs/api/`.
55
- - `dw-llm-eval`: **(AI mode — when invoked with `--ai`)** — runs reference dataset against current implementation. Computes precision@k / faithfulness / outcome accuracy. Logs JSONL to `QA/logs/ai/<feature>-<date>.jsonl`. Alerts on >10% metric regression vs prior run.
55
+ - `dw-llm-eval`: **(AI mode — when invoked with `--ai`)** — runs reference dataset against current implementation. Computes precision@k / faithfulness / outcome accuracy. Logs JSONL to `QA/logs/ai/<feature>-<date>.jsonl`. Lists per-case pass → fail flips vs prior run (each is a bug) and alerts on >10% metric regression.
56
56
  - `dw-debug-protocol`: **(in `--fix` mode — ALWAYS)** — six-step triage (Reproduce → Localize → Reduce → Fix Root Cause → Guard → Verify End-to-End) for each detected bug. Stop-the-line discipline; root-cause over symptom; regression test in same atomic commit.
57
57
  - `vercel-react-best-practices`: (UI mode) when React/Next.js regression risk is suspected.
58
- - `dw-ui-discipline`: (UI mode) when validating design consistency — anti-slop catalog + WCAG accessibility floor check.
58
+ - `dw-ui-discipline`: (UI mode) when validating design consistency — anti-slop catalog + WCAG accessibility floor check, plus the content-stress pass in `references/content-stress.md`.
59
59
  - `dw-chaos-engineering`: **(by name only)** — adversarial pass over a change whose normal tests already pass. Ask for it after QA is green when resilience matters more than coverage; it writes tests only, runs locally, and caps at 3 rounds. Never auto-invoked.
60
60
  - `dw-verify`: **(in `--fix` mode — ALWAYS)** — before marking any bug `Fixed` or `Closed`, requires VERIFICATION REPORT PASS (test + lint + build) AND retest evidence (screenshot in UI mode, JSONL log in API mode, eval-run delta in AI mode).
61
61
 
@@ -92,7 +92,8 @@ Read the affected module's quality baseline/TechSpec. Reuse valid required-check
92
92
  - Negative flows (unauthorized actions, malformed input).
93
93
  - Regressions (smoke check on adjacent surfaces).
94
94
  - WCAG 2.2 accessibility check per `dw-ui-discipline/references/accessibility-floor.md`.
95
- 4. **Capture evidence**: screenshots at 375px mobile + 1440px desktop, console logs, network HARs.
95
+ - Content stress per `dw-ui-discipline/references/content-stress.md` for every surface that renders user or API data: map the rendered fields and their limits, build a realistic worst-case fixture (plus empty, one and 1,000+ rows), inject it at the data boundary — the project's own fixtures/mocks, or `page.route()` in the test; never by editing the component — and check it at the real container width, 320px, 200% zoom, and dark mode/RTL when the product supports them. Each break goes to `bugs.md` with the reference's severity mapping (Broken → high, Ugly → medium, Fragile → low). Mobile-platform behaviour (sticky hover, input zoom, safe areas) does not reproduce in emulation: list it in `qa-report.md` as needing a real device instead of marking it passed.
96
+ 4. **Capture evidence**: screenshots at 375px mobile + 1440px desktop, console logs, network HARs; for the content-stress pass, screenshots of the worst-case fixture at 320px and at 200% zoom.
96
97
  5. **Detect stub/placeholder pages**: any page that looks "TODO" or has obvious dummy content → flag as a bug.
97
98
  6. **Write `qa-report.md`**: test plan, execution log, evidence references, bug count by severity.
98
99
  7. **Write `bugs.md`**: one entry per bug found, with severity, repro steps, evidence link, status (`Open`).
@@ -117,7 +118,7 @@ Read the affected module's quality baseline/TechSpec. Reuse valid required-check
117
118
  - Agent: outcome assertion + trajectory match (per `--ai-mode` parameter or feature config).
118
119
  - Classification: exact match accuracy.
119
120
  3. Log JSONL to `QA/logs/ai/<feature>-<date>.jsonl`.
120
- 4. Compare to prior run's JSONL — alert on >10% regression in any metric.
121
+ 4. Compare to the prior run's JSONL case by case: list every case that flipped pass → fail and file each one as a bug, whatever the averages say. Then alert on >10% regression in any metric. Run the `holdout` split too and report it apart from `dev`.
121
122
  5. Append AI-mode section to `qa-report.md`.
122
123
 
123
124
  ## Mode 1.5: Interactive UAT (`/dw-qa --uat`)
@@ -38,7 +38,7 @@ digraph redesign_decision {
38
38
 
39
39
  ## Complementary Skills
40
40
 
41
- When available in the project under `./.agents/skills/`, use these to guide the redesign:
41
+ When available in the project under `./.dw/skills/`, use these to guide the redesign:
42
42
 
43
43
  - `dw-ui-discipline`: **REQUIRED** — runs the 4-checkpoint hard-gate (brand authorities OR curated defaults; surface job sentence; complete state matrix; scene sentence) BEFORE any design proposal. The 14 anti-slop patterns are checked against each proposed direction. The WCAG 2.2 AA floor is non-negotiable at the validate step.
44
44
  - `vercel-react-best-practices`: use when the project is React/Next.js for performance and implementation patterns
@@ -58,10 +58,10 @@ Use diagnostic tools based on the project's framework:
58
58
  1. Identify the target: page, component, or route to be redesigned.
59
59
  2. **AUDIT**: read the current implementation, identify the CSS stack (Tailwind, CSS Modules, styled-components, etc.), capture the before-state screenshot (Playwright MCP, or `node .dw/scripts/lib/capture-screenshots.mjs` as the WSL-resilient fallback), run react-doctor if React project.
60
60
  3. Ask 3 to 5 questions about redesign goals: style direction, brand constraints, inspirations, target audience, priority devices.
61
- 4. **PROPOSE**: present 2 to 3 design directions after passing the `dw-ui-discipline` hard-gate (brand authorities or curated defaults selected; surface job sentence written; state matrix enumerated; scene sentence written). Each direction lists color palette, typography pairing, layout style, and rationale. Self-check each direction against the 14 anti-slop patterns. For EACH direction, explicitly describe the mobile layout (<=768px) and desktop layout (>=1024px), including how elements reorganize, stack, or hide between breakpoints.
61
+ 4. **PROPOSE**: present 2 to 3 design directions after passing the `dw-ui-discipline` hard-gate (brand authorities or curated defaults selected; surface job sentence written; state matrix enumerated; scene sentence written). Directions must diverge on a named axis — layout, density, personality, motion, or interaction model — and are named for that direction ("Quiet", "Editorial", "Dense"), never "Option A/B/C"; three tints of the same idea count as one direction. Each direction lists its axis, color palette, typography pairing, layout style, and rationale. Self-check each direction against the 14 anti-slop patterns. For EACH direction, explicitly describe the mobile layout (<=768px) and desktop layout (>=1024px), including how elements reorganize, stack, or hide between breakpoints.
62
62
  5. Wait for explicit user approval before implementing.
63
63
  6. **IMPLEMENT**: apply the chosen design with a mobile-first approach — implement the mobile layout first, then add media queries/breakpoints for tablet and desktop. Respect the existing stack. Use `vercel-react-best-practices` for React/Next.js. Maintain the project's CSS methodology.
64
- 7. **VALIDATE**: capture after-state in BOTH resolutions (mobile and desktop), compare before/after, verify accessibility against `dw-ui-discipline/references/accessibility-floor.md` (WCAG 2.2 AA — non-negotiable: contrast, focus-visible, keyboard nav, ARIA, no traps), run react-doctor `--diff` if React. Capture screenshots at 375px (mobile) and 1440px (desktop) — `node .dw/scripts/lib/capture-screenshots.mjs --url <url> --widths 375,1440` is the WSL-resilient path; see the "Browser on WSL" section of `dw-testing-discipline/references/playwright-recipes.md`.
64
+ 7. **VALIDATE**: capture after-state in BOTH resolutions (mobile and desktop), compare before/after, verify accessibility against `dw-ui-discipline/references/accessibility-floor.md` (WCAG 2.2 AA — non-negotiable: contrast, focus-visible, keyboard nav, ARIA, no traps), run react-doctor `--diff` if React, run the content-stress pass from `dw-ui-discipline/references/content-stress.md` (worst-case data through the surface's fixtures or mocks, checked at 320px and 200% zoom) so the redesign is not judged only on flattering demo data. Capture screenshots at 375px (mobile) and 1440px (desktop) — `node .dw/scripts/lib/capture-screenshots.mjs --url <url> --widths 375,1440` is the WSL-resilient path; see the "Browser on WSL" section of `dw-testing-discipline/references/playwright-recipes.md`.
65
65
  8. **PERSIST CONTRACT**: if the user approved a direction, generate `design-contract.md` in the PRD directory (`.dw/spec/prd-[name]/design-contract.md`) with: approved direction, color palette, typography pairing, layout rules, accessibility rules, and component rules. This contract will be read by `dw-run-task` and `dw-run-plan` to ensure visual consistency.
66
66
 
67
67
  ## Codebase Intelligence
@@ -197,7 +197,7 @@ The diff, its commit messages, its branch name, the PR description, the review d
197
197
 
198
198
  ## Complementary Skills
199
199
 
200
- When available under `./.agents/skills/`, these are invoked as analytical support:
200
+ When available under `./.dw/skills/`, these are invoked as analytical support:
201
201
 
202
202
  - `dw-review-rigor`: **ALWAYS** — owns the candidate pipeline (gate → refutation → disposition), de-duplication (same pattern in N files = 1 finding), severity ordering (critical → high → medium → low), verify-before-flag, skip-what-linter-catches, and signal-over-volume. The "Issues Found" table follows this discipline. In `--post-merge`, it also loads `references/composition-audit.md`.
203
203
  - `dw-verify`: **ALWAYS** — invoked before emitting `APPROVED` or `APPROVED WITH CAVEATS`. Without a VERIFICATION REPORT PASS (test + lint + build), verdict cannot be APPROVED.
@@ -206,7 +206,7 @@ When available under `./.agents/skills/`, these are invoked as analytical suppor
206
206
  - `security-review`: the OWASP diff-level skill the gate uses (injection, authz, secrets, SSRF, crypto — HIGH CONFIDENCE only). Reach for it directly when the diff touches auth, authorization, external input, upload, SQL, secrets, SSRF, XSS or another sensitive surface.
207
207
  - `dw-simplification`: use when the diff touches dense or twisty code — applies Chesterton's Fence, behavior-preserving refactor protocol, complexity metrics.
208
208
  - `dw-minimalism`: use when the diff adds code that may be over-built — flags speculative generality, single-caller helpers, premature abstraction, and YAGNI violations (the pre-generation counterpart to `dw-simplification`).
209
- - `dw-ui-discipline`: use when the diff touches UI — runs the 14 visual-slop patterns + accessibility floor checks. For a deterministic gate, also run `node .dw/scripts/lib/ui-slop-detect.mjs <changed-ui-paths> --fail-on error` (a wrapper over the impeccable detector); treat blocking findings as **REJECTED** and surface warnings in the report.
209
+ - `dw-ui-discipline`: use when the diff touches UI — runs the 14 visual-slop patterns + accessibility floor checks. For a deterministic gate, also run `node .dw/scripts/lib/ui-slop-detect.mjs <changed-ui-paths> --fail-on error` (a wrapper over the impeccable detector); treat blocking findings as **REJECTED** and surface warnings in the report. When the diff adds or changes motion (`transition`, `animation`, `@keyframes`, motion-library props), check it against the escalation triggers in `references/motion.md` §9; when it renders user or API data, check the static signals in `references/content-stress.md`. Both produce candidates for `dw-review-rigor`, at the severities those references set.
210
210
  - `dw-testing-discipline`: use when the diff touches tests — applies the 25 anti-patterns catalog + 6 agent guardrails (when tests were agent-authored).
211
211
  - `dw-llm-eval`: **REQUIRED when the diff touches AI/LLM feature code paths**. Reference dataset + ≥2 oracle rungs + judge calibration (if rung 4 used) + eval run results MUST be in the PR. Missing → REJECTED.
212
212
  - `vercel-react-best-practices`: use when the diff touches React/Next.js.
@@ -7,7 +7,7 @@ You are the dev-workflow skill and agent health auditor.
7
7
  - Use before promoting a learned pattern into a reusable skill.
8
8
 
9
9
  ## Process
10
- 1. Read `scaffold/skill-registry.json` when auditing the dev-workflow repo, or `.dw/skill-registry.json` + installed `.agents/skills/` in consumer projects.
10
+ 1. Read `scaffold/skill-registry.json` when auditing the dev-workflow repo, or `.dw/skill-registry.json` + the bundled skills installed in `.dw/skills/` in consumer projects. Skills under `.claude/skills/`, `.agents/skills/` and the other agent indexes are command wrappers or the user's own; a dev-workflow skill found there is a legacy copy that `update` removes.
11
11
  2. Group skills by `kind`: `protocol`, `domain-pack`, `recipe-pack`, `asset-pack`.
12
12
  3. Validate every skill has a trigger, expected output, owner, load policy, and context limit.
13
13
  4. Validate every bundled `SKILL.md` has a `## Structured Return` contract with `Status`, `Scope`, `Evidence`, `Artifacts`, `Decisions`, `Risks`, and `Next Step`.
@@ -59,6 +59,28 @@ Declare the window before any judgement: count the instrumented rows — those c
59
59
 
60
60
  Recommend demotion only when ALL hold: model-invocable cohort; at least 20 instrumented sessions or 30 days of window; zero references; no artifact signal; owner command reachable. Below that, print the counts and say the window is too short to conclude. Removing a bundled skill from the package is an append-only entry in `lib/removed-bundled-skills.js` — this command proposes, it never removes and never deletes files.
61
61
 
62
+ ### Commands — which entries earn their place in the index
63
+
64
+ Every installed `dw-*` command is one entry in each agent's skill index, and a crowded index degrades the choice the model makes there. Rows carrying a `commands` object record which commands the session loaded: a read of `.dw/commands/<name>.md` (every wrapper performs one) or a Skill-tool call naming the command. The skill rules apply unchanged: an absent `commands` key is no telemetry, the window is counted only from rows carrying `commands`, and the count measures loading, not success. The hook parses Claude Code transcripts only; when the project also runs Codex, Copilot or OpenCode, say that their sessions are not in the count.
65
+
66
+ Print one table: command, sessions that loaded it, references. Then, for each family of commands that share a purpose, print the members' counts side by side:
67
+
68
+ | Family | Members |
69
+ |---|---|
70
+ | Subagent handoff | `dw-subtask-start`, `dw-subtask-complete`, `dw-subtask-resume` |
71
+ | External runners | `dw-codex-run`, `dw-claude-run`, `dw-copilot-run` |
72
+ | Cloud skill installers | `dw-install-aws-skills`, `dw-install-azure-skills` |
73
+ | Install and context audits | `dw-skill-health`, `dw-harness-audit`, `dw-context-budget` |
74
+ | Session checkpoint | `dw-pause`, `dw-resume` |
75
+
76
+ Classify each family:
77
+
78
+ - `MERGE CANDIDATE` — the window holds at least 20 instrumented sessions or 30 days, and the whole family was loaded in fewer than 5% of them, or some member was never loaded while another was. One command with modes would cost the index fewer entries.
79
+ - `KEEP SEPARATE` — two or more members were each loaded in at least 5 sessions: the distinct names are in use, and merging them trades a measured habit for a smaller index.
80
+ - `TOO EARLY` — below the window threshold. Print the counts and say so.
81
+
82
+ Commands outside any family follow the skill wording: a model-invocable command with zero loads over a long enough window is an `IDLE CANDIDATE`, never "unused". A merge or removal in the package is a product decision recorded append-only in `lib/removed-commands.js` (the update then removes the old wrappers); this command proposes, it never renames, removes or edits commands. When auditing the dev-workflow repository itself there is no local telemetry: report `NO TELEMETRY` unless the maintainer supplies `costs.jsonl` files from consumer projects, and aggregate those per project before adding them up.
83
+
62
84
  ## Output
63
85
 
64
86
  When `.dw/config/routing-defaults.json` exists, compare its current candidates with the owner's `.dw/config/routing.json`. Report relevant differences and validate proposed models/capabilities before adoption. Different values can be intentional; do not treat them as failed migration or overwrite them automatically. Approved task assignments take precedence over either candidate file.
@@ -70,6 +92,7 @@ Include:
70
92
  - Registry/schema issues.
71
93
  - Structured-return coverage, including any skill missing the contract or status vocabulary.
72
94
  - Usage evidence: the declared window, the per-cohort tables, and every idle candidate with its window sentence. When telemetry is missing, say so instead of scoring.
95
+ - Command usage: the per-command table and each family's classification (`MERGE CANDIDATE`, `KEEP SEPARATE`, `TOO EARLY`).
73
96
  - Top 3 fixes.
74
97
 
75
98
  Final marker: `## SKILL-HEALTH COMPLETE`
@@ -24,14 +24,15 @@ Before overwriting managed files, create a snapshot:
24
24
  ```bash
25
25
  SNAPSHOT_DIR=".dw/.backup/$(date -u +%Y%m%dT%H%M%SZ)"
26
26
  mkdir -p "$SNAPSHOT_DIR"
27
- cp -r .dw/commands .dw/templates .dw/references .dw/scripts "$SNAPSHOT_DIR/" 2>/dev/null
27
+ cp -r .dw/commands .dw/templates .dw/references .dw/scripts .dw/skills "$SNAPSHOT_DIR/" 2>/dev/null
28
28
  [ -d .agents/skills ] && cp -r .agents/skills "$SNAPSHOT_DIR/agents-skills" 2>/dev/null
29
29
  # .claude/settings.json is now mutated by update (MCPs + hooks + statusLine)
30
30
  [ -f .claude/settings.json ] && mkdir -p "$SNAPSHOT_DIR/claude" && cp .claude/settings.json "$SNAPSHOT_DIR/claude/settings.json" 2>/dev/null
31
+ [ -f .dw/install-state.json ] && cp .dw/install-state.json "$SNAPSHOT_DIR/install-state.json" 2>/dev/null
31
32
  echo "Snapshot saved to $SNAPSHOT_DIR"
32
33
  ```
33
34
 
34
- Keep only the 3 most recent snapshots (remove older ones) to avoid buildup.
35
+ Keep only the 3 most recent snapshots in `.dw/.backup/` (remove older ones) to avoid buildup. `.dw/.migrated/` is not a snapshot: never prune it.
35
36
 
36
37
  ### 1. Record Current Version (Required)
37
38
 
@@ -85,7 +86,13 @@ The `update` command overwrites managed files and PRESERVES:
85
86
 
86
87
  The `update` command also runs the GSD migration step automatically — if a project has legacy `.planning/` (from prior GSD usage), the contents are migrated to `.dw/intel/`, `.dw/spec/active-session.md`, `.dw/spec/quick/`, etc., and `.planning/` is renamed to `.planning.gsd-archive-<DATE>/` for inspection. The `.claude/commands/gsd/`, `.claude/agents/gsd-*.md`, `.claude/hooks/gsd-*.js`, and `.claude/gsd-file-manifest.json` files are removed during the migration.
87
88
 
88
- If the update fails (network error, permission, package unavailable): report the error to the user and STOP. Do NOT attempt manual workarounds like copying files by hand.
89
+ The CLI never deletes what it retires: it moves it to `.dw/.migrated/<timestamp>/`, keeping the relative path, and prints the destination. It does this only after the new skills are in `.dw/skills/`, so an interrupted update leaves the old copies in place. What it retires, and how it decides:
90
+
91
+ - **Legacy bundled-skill copies** under `.agents/skills/` (`[moved]`): only when the copy is dev-workflow's. A same-named skill that is not is printed as `[kept]` and left alone.
92
+ - **Skills removed in past releases** (`[v<N>]`) and **removed command sources** (`[legacy]`): matched by name, so a same-named skill from elsewhere is moved too — the move is what makes that recoverable.
93
+ - **Orphan `dw-*` wrappers** (`[orphan]`): `dw-` is this package's namespace; a user skill named `dw-*` is moved, not lost.
94
+
95
+ If the update fails (network error, permission, package unavailable): report the error to the user and STOP. Do NOT attempt manual workarounds like copying files by hand. Give the user the snapshot path from step 0 and the two ways out: re-run the update once the cause is fixed (it is idempotent), or `/dw-update --rollback`.
89
96
 
90
97
  ### 4. Capture New Version
91
98
 
@@ -95,7 +102,7 @@ node -e 'const s = JSON.parse(require("node:fs").readFileSync(".dw/install-state
95
102
 
96
103
  ### Upgrade compatibility checks
97
104
 
98
- Read the refreshed `.dw/commands/dw-update.md` after the CLI completes. Use `.dw/install-state.json` and the CLI's `Installed version` output for the version delta: an `npx` package need not be resolvable from the consumer's `node_modules`. A missing or invalid new install state is a failed verification; do not claim the update succeeded.
105
+ Read the refreshed `.dw/commands/dw-update.md` after the CLI completes. Use `.dw/install-state.json` and the CLI's `Installed version` output for the version delta: an `npx` package need not be resolvable from the consumer's `node_modules`. A missing or invalid new install state is a failed verification; do not claim the update succeeded. The version read in step 4 must equal the right-hand side of the CLI's `Installed version: <old> -> <new>` line; if that line is missing, or the versions differ, the CLI did not finish and the update failed.
99
106
 
100
107
  For an upgrade from before 2.3.0 (or an unknown legacy version):
101
108
 
@@ -115,6 +122,7 @@ Present to the user:
115
122
  - Summary of what the `update` output showed (files copied, wrappers generated, MCPs configured)
116
123
  - The `Post-update agent actions` printed by the CLI
117
124
  - Any warnings or errors
125
+ - Every `[moved]`, `[v<N>]`, `[orphan]`, `[legacy]` or `[kept]` line from `Skill migration`, the `.dw/.migrated/<timestamp>/` path, and any file flagged `was not installed by dev-workflow` (the team's own addition: offer to bring it back into a skill of their own, never into `.dw/skills/`, which update overwrites)
118
126
 
119
127
  ### 6. Run Post-Update Agent Actions (Required)
120
128
 
@@ -143,19 +151,28 @@ If invoked with `--rollback`:
143
151
  1. List snapshots in `.dw/.backup/`
144
152
  2. If none exist: STOP and report "No snapshot available"
145
153
  3. If more than one exists: ask the user which to restore (default: most recent)
146
- 4. Confirm with the user: "Restore snapshot `<path>`? This OVERWRITES `.dw/commands/`, `.dw/templates/`, `.dw/references/`, `.dw/scripts/`, `.agents/skills/`, and `.claude/settings.json`. Proceed? [y/N]"
154
+ 4. Confirm with the user: "Restore snapshot `<path>`? This REPLACES `.dw/commands/`, `.dw/templates/`, `.dw/references/`, `.dw/scripts/` and `.dw/skills/` with the snapshot's copies (when the snapshot has them), copies the snapshot's `.agents/skills/` back over the current one without removing other entries, and restores `.claude/settings.json` and `.dw/install-state.json`. `.dw/templates/overrides/` is never touched. Proceed? [y/N]"
147
155
  5. Only after `y`: copy back
148
156
 
149
157
  ```bash
150
- cp -r "$SNAPSHOT_DIR/commands" .dw/
151
- cp -r "$SNAPSHOT_DIR/templates" .dw/
152
- cp -r "$SNAPSHOT_DIR/references" .dw/ 2>/dev/null
153
- cp -r "$SNAPSHOT_DIR/scripts" .dw/ 2>/dev/null
154
- [ -d "$SNAPSHOT_DIR/agents-skills" ] && cp -r "$SNAPSHOT_DIR/agents-skills" .agents/skills 2>/dev/null
158
+ SNAPSHOT_DIR=".dw/.backup/<chosen-timestamp>" # the snapshot confirmed in step 4
159
+ [ -d "$SNAPSHOT_DIR" ] || { echo "Snapshot not found: $SNAPSHOT_DIR"; exit 1; }
160
+ # Managed .dw folders are replaced, so files added by the newer release do not linger.
161
+ for d in commands references scripts skills; do
162
+ [ -d "$SNAPSHOT_DIR/$d" ] && rm -rf ".dw/$d" && cp -r "$SNAPSHOT_DIR/$d" .dw/
163
+ done
164
+ # .dw/templates/overrides/ is the owner's: restore the managed templates around it, never remove it.
165
+ if [ -d "$SNAPSHOT_DIR/templates" ]; then
166
+ find .dw/templates -mindepth 1 -maxdepth 1 ! -name overrides -exec rm -rf {} +
167
+ for f in "$SNAPSHOT_DIR/templates"/*; do [ "$(basename "$f")" = overrides ] || cp -r "$f" .dw/templates/; done
168
+ fi
169
+ # .agents/skills is shared with the user's own skills: merge, never replace.
170
+ [ -d "$SNAPSHOT_DIR/agents-skills" ] && mkdir -p .agents/skills && cp -r "$SNAPSHOT_DIR/agents-skills/." .agents/skills/ 2>/dev/null
155
171
  [ -f "$SNAPSHOT_DIR/claude/settings.json" ] && cp "$SNAPSHOT_DIR/claude/settings.json" .claude/settings.json 2>/dev/null
172
+ [ -f "$SNAPSHOT_DIR/install-state.json" ] && cp "$SNAPSHOT_DIR/install-state.json" .dw/install-state.json 2>/dev/null
156
173
  ```
157
174
 
158
- 6. Report: snapshot restored, version likely recovered (read from `.dw/commands/dw-help.md` or metadata if present)
175
+ 6. Report: snapshot restored, and the version from the restored `.dw/install-state.json` (or "unknown" when the snapshot predates it). A snapshot taken before 2.7.0 has no `skills/`: `.dw/skills/` then stays as it was, which is harmless (older commands read `.agents/skills/`), and the next update retires the restored `.agents/skills/` copies again.
159
176
 
160
177
  ## Advanced Options
161
178
 
@@ -81,6 +81,10 @@ This floor is narrow by design. Something genuinely destructive that is not list
81
81
  apply the same standard: if the action destroys work with no second copy, rewrites shared history, or moves
82
82
  a credential, stop and ask. An extra confirmation costs a message.
83
83
 
84
+ The same holds for the skill folders agents share — `.agents/skills/`, `.claude/skills/`, `.codex/skills/`:
85
+ they hold the user's and other tools' skills too. Outside the CLI's own `update`/`uninstall`, list what
86
+ you would remove and ask per entry; move what is approved to `.dw/.migrated/<timestamp>/`, never `rm` it.
87
+
84
88
  ## Attribution
85
89
 
86
90
  The two-layer model — a floor that project rules may only tighten, never loosen — is adapted from the
@@ -80,7 +80,7 @@ services: []
80
80
  │ └── api/ (created by `pnpm dlx @nestjs/cli` or selected scaffold)
81
81
  ├── packages/
82
82
  │ └── shared/ (created by /dw-new-project)
83
- ├── docker-compose.dev.yml (composed from .agents/skills/docker-compose-recipes/)
83
+ ├── docker-compose.dev.yml (composed from .dw/skills/docker-compose-recipes/)
84
84
  ├── .env.example (consolidated from selected services)
85
85
  ├── .gitignore (per stack)
86
86
  ├── .dockerignore (per stack)
@@ -27,7 +27,7 @@ Na quebra de tasks, proponha desenvolvimento local ou cruzado e modelo, esforço
27
27
 
28
28
  Claude pode delegar implementação por `/dw-codex-run`; Codex pode usar `/dw-claude-run`. O parent conduz review, correções e continuidade. Agentes locais herdam o modelo da sessão salvo override aprovado na task. Delegue trabalho independente e delimitado quando melhorar qualidade ou tempo; mantenha trabalho pequeno ou acoplado local. Máximo de 3 workers por fluxo e nunca escritores simultâneos no mesmo worktree.
29
29
 
30
- Leia primeiro arquivos relevantes. Use `.dw/intel/` ou code-explorer quando ajudar em fluxos amplos ou desconhecidos, conferindo o índice contra o código atual. Carregue entrypoints de skills somente para tasks correspondentes e referências somente para o modo escolhido. Subagentes recebem um pacote compacto e retornam evidências e decisões, não logs completos.
30
+ Leia primeiro arquivos relevantes. Use `.dw/intel/` ou code-explorer quando ajudar em fluxos amplos ou desconhecidos, conferindo o índice contra o código atual. Carregue entrypoints de skills somente para tasks correspondentes e referências somente para o modo escolhido. As skills do dev-workflow ficam em `.dw/skills/<nome>/`; quando um comando nomear uma, leia de lá. `.agents/skills/` e `.claude/skills/` também guardam skills do usuário e de outras ferramentas: fora do `update`, não apague nada ali sem listar e perguntar antes. Subagentes recebem um pacote compacto e retornam evidências e decisões, não logs completos.
31
31
 
32
32
  ## Conclusão e limites
33
33
 
@@ -61,7 +61,7 @@ digraph brainstorm_decision {
61
61
 
62
62
  ## Skills Complementares
63
63
 
64
- Quando disponíveis no projeto em `./.agents/skills/`, use para enriquecer a ideação:
64
+ Quando disponíveis no projeto em `./.dw/skills/`, use para enriquecer a ideação:
65
65
 
66
66
  - `dw-council`: invocada pelo modo **council** do dispatcher — stress-test multi-advisor das opções mais promissoras com steel-manning obrigatório e concession tracking. O dispatcher dispara quando 2+ caminhos empatam OU consenso se forma rápido demais (sinal de false-consensus). Não roda em todo brainstorm — só quando os sinais justificam.
67
67
  - `dw-simplification`: invocada pelo modo **refactor-audit** — aplica Chesterton's Fence + métricas de complexidade + a nova referência **deep-modules** (deletion test, locality, leverage, interface depth) em todo smell flagueado.
@@ -345,7 +345,7 @@ entre turns e escreve arquivos. Por ser stateful e mutante, começa **só com in
345
345
 
346
346
  <critical>Pergunte exatamente UMA decisão não-resolvida por interação, e espere. Nunca despeje uma lista de perguntas.</critical>
347
347
 
348
- Grill é movido por duas skills internas (lidas por path em `./.agents/skills/`, nunca exportadas):
348
+ Grill é movido por duas skills internas (lidas por path em `./.dw/skills/`, nunca exportadas):
349
349
  - **`dw-grilling`** — o motor de entrevista em árvore de decisão (ordenação por dependência, uma decisão por
350
350
  turn, uma resposta recomendada para cada pergunta, fatos descobertos em vez de perguntados, o gate de
351
351
  shared-understanding).
@@ -36,7 +36,7 @@
36
36
 
37
37
  ## Skills Complementares
38
38
 
39
- Quando disponíveis no projeto em `./.agents/skills/`, use estas skills como suporte contextual sem substituir este comando:
39
+ Quando disponíveis no projeto em `./.dw/skills/`, use estas skills como suporte contextual sem substituir este comando:
40
40
 
41
41
  - `dw-debug-protocol`: **SEMPRE** — conduz o bug pelo six-step triage (Reproduzir → Localizar → Reduzir → Fix Root Cause → Guardar → Verificar End-to-End). Stop-the-line discipline; root-cause sobre symptom; regression test commitado no mesmo commit atômico. Para bugs não triviais, ou depois que a primeira tentativa de fix falhar, o Passo 1 precisa estabelecer um loop de feedback red-capable antes de teorizar. Bugs não-reprodutíveis seguem o sub-protocolo instrument-first — sem fix por palpite a não ser com acknowledgement explícito.
42
42
  - `dw-verify`: **SEMPRE** — em modo Direto, invocada antes do commit da correção. O VERIFICATION REPORT deve mostrar que o sintoma original do bug não se reproduz mais (não apenas que os testes passam).
@@ -11,7 +11,7 @@
11
11
 
12
12
  ## Skills Complementares
13
13
 
14
- Quando disponíveis no projeto em `./.agents/skills/`, use estas skills como suporte operacional sem substituir este comando:
14
+ Quando disponíveis no projeto em `./.dw/skills/`, use estas skills como suporte operacional sem substituir este comando:
15
15
 
16
16
  - `dw-git-discipline`: **SEMPRE** — aplica atomic commits (uma intenção lógica por commit; refactor separado de feature), formato Conventional Commits, lint+tests+build verdes ANTES do commit e proíbe pular hooks (`--no-verify`) ou amend de commits já empurrados. Em mudanças mistas, separa via `git add -p`.
17
17
 
@@ -44,7 +44,7 @@ Este comando e **complementar** ao `/dw-new-project`:
44
44
  - Relatório: `.dw/audit/dockerize-<YYYY-MM-DD>.md` (escopo PRD: `.dw/spec/prd-<slug>/dockerize.md`)
45
45
  - Artefatos dev gerados: `<SCOPE>/docker-compose.dev.yml`, `<SCOPE>/Dockerfile.dev`, `<SCOPE>/.dockerignore`
46
46
  - Artefatos prod gerados: `<SCOPE>/Dockerfile`, `<SCOPE>/docker-compose.prod.yml` (opcional), `<SCOPE>/.dockerignore`
47
- - Fonte das receitas: `.agents/skills/docker-compose-recipes/services/*.yml`
47
+ - Fonte das receitas: `.dw/skills/docker-compose-recipes/services/*.yml`
48
48
 
49
49
  ## Comportamento Obrigatório — Pipeline
50
50
 
@@ -163,7 +163,7 @@ Sem aprovação: escreve relatório (Fase 3 com `status: PLANNED`) e para.
163
163
  #### 2.1 Artefatos `--dev`
164
164
 
165
165
  **`docker-compose.dev.yml`**:
166
- - Componha blocos de `.agents/skills/docker-compose-recipes/services/*.yml` segundo `references/compose-composition.md`.
166
+ - Componha blocos de `.dw/skills/docker-compose-recipes/services/*.yml` segundo `references/compose-composition.md`.
167
167
  - Adicione service(s) do app no fim: `build: { context: ., dockerfile: Dockerfile.dev }`, `volumes` para hot reload (bind mount do source, anonymous volume para `node_modules`/`__pycache__`), `env_file: .env`, `depends_on` com `condition: service_healthy` segundo `references/healthcheck-patterns.md`.
168
168
  - Preserve a tag da imagem de cada recipe (NÃO converta nenhuma para digest — digest congela a base e nunca alcanca um rebuild de segurança), as vars de credencial obrigatórias e os binds em `127.0.0.1`. As portas loopback mantem intencionalmente a topologia `apps no host` funcionando.
169
169
  - Header: `# Generated by /dw-dockerize on YYYY-MM-DD`.