@brunosps00/dev-workflow 2.2.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +46 -0
  3. package/README.md +12 -4
  4. package/lib/constants.js +24 -24
  5. package/lib/init.js +8 -0
  6. package/lib/instruction-health.js +38 -0
  7. package/lib/post-update.js +2 -1
  8. package/lib/validate.js +3 -1
  9. package/package.json +1 -1
  10. package/scaffold/config/routing.json +61 -23
  11. package/scaffold/en/agent-instructions.md +31 -137
  12. package/scaffold/en/commands/dw-analyze-project.md +2 -0
  13. package/scaffold/en/commands/dw-autopilot.md +22 -245
  14. package/scaffold/en/commands/dw-bugfix.md +9 -35
  15. package/scaffold/en/commands/dw-claude-run.md +29 -45
  16. package/scaffold/en/commands/dw-codex-run.md +30 -45
  17. package/scaffold/en/commands/dw-context-budget.md +6 -14
  18. package/scaffold/en/commands/dw-copilot-run.md +29 -41
  19. package/scaffold/en/commands/dw-generate-pr.md +2 -2
  20. package/scaffold/en/commands/dw-goal.md +11 -5
  21. package/scaffold/en/commands/dw-help.md +2 -2
  22. package/scaffold/en/commands/dw-plan.md +14 -7
  23. package/scaffold/en/commands/dw-qa.md +2 -0
  24. package/scaffold/en/commands/dw-resume.md +5 -11
  25. package/scaffold/en/commands/dw-review.md +4 -3
  26. package/scaffold/en/commands/dw-run.md +19 -166
  27. package/scaffold/en/commands/dw-skill-health.md +7 -0
  28. package/scaffold/en/commands/dw-update.md +18 -4
  29. package/scaffold/en/references/command-routing.md +53 -0
  30. package/scaffold/en/references/execution-contract.md +55 -0
  31. package/scaffold/en/templates/frontend-quality-template.md +43 -0
  32. package/scaffold/en/templates/task-template.md +20 -40
  33. package/scaffold/en/templates/tasks-template.md +9 -6
  34. package/scaffold/en/templates/techspec-template.md +4 -0
  35. package/scaffold/pt-br/agent-instructions.md +31 -137
  36. package/scaffold/pt-br/commands/dw-analyze-project.md +2 -0
  37. package/scaffold/pt-br/commands/dw-autopilot.md +22 -245
  38. package/scaffold/pt-br/commands/dw-bugfix.md +9 -35
  39. package/scaffold/pt-br/commands/dw-claude-run.md +29 -46
  40. package/scaffold/pt-br/commands/dw-codex-run.md +30 -45
  41. package/scaffold/pt-br/commands/dw-context-budget.md +6 -14
  42. package/scaffold/pt-br/commands/dw-copilot-run.md +29 -43
  43. package/scaffold/pt-br/commands/dw-generate-pr.md +2 -2
  44. package/scaffold/pt-br/commands/dw-goal.md +11 -5
  45. package/scaffold/pt-br/commands/dw-help.md +2 -2
  46. package/scaffold/pt-br/commands/dw-plan.md +14 -7
  47. package/scaffold/pt-br/commands/dw-qa.md +2 -0
  48. package/scaffold/pt-br/commands/dw-resume.md +7 -11
  49. package/scaffold/pt-br/commands/dw-review.md +4 -3
  50. package/scaffold/pt-br/commands/dw-run.md +19 -166
  51. package/scaffold/pt-br/commands/dw-skill-health.md +7 -0
  52. package/scaffold/pt-br/commands/dw-update.md +18 -4
  53. package/scaffold/pt-br/references/command-routing.md +53 -0
  54. package/scaffold/pt-br/references/execution-contract.md +55 -0
  55. package/scaffold/pt-br/templates/frontend-quality-template.md +43 -0
  56. package/scaffold/pt-br/templates/task-template.md +20 -40
  57. package/scaffold/pt-br/templates/tasks-template.md +9 -6
  58. package/scaffold/pt-br/templates/techspec-template.md +4 -0
  59. package/scaffold/scripts/lib/workflow-contract.mjs +101 -0
  60. package/scaffold/skill-registry.json +23 -23
  61. package/scaffold/skills/dw-cli-run/SKILL.md +33 -217
  62. package/scaffold/skills/dw-cli-run/references/dispatch-tuning.md +14 -72
  63. package/scaffold/skills/dw-codebase-intel/SKILL.md +5 -39
  64. package/scaffold/skills/dw-codebase-intel/agents/intel-updater.md +1 -1
  65. package/scaffold/skills/dw-codebase-intel/references/agents-detail.md +7 -0
  66. package/scaffold/skills/dw-codebase-intel/references/files-in-dw-intel-detail.md +16 -0
  67. package/scaffold/skills/dw-codebase-intel/references/how-dw-intel-reads-this-detail.md +12 -0
  68. package/scaffold/skills/dw-codebase-intel/references/how-to-compose-the-typical-flow-detail.md +11 -0
  69. package/scaffold/skills/dw-council/SKILL.md +2 -17
  70. package/scaffold/skills/dw-council/references/integration-with-other-dw-commands-detail.md +7 -0
  71. package/scaffold/skills/dw-council/references/phase-2-tensions-and-rebuttals-detail.md +15 -0
  72. package/scaffold/skills/dw-domain-modeling/SKILL.md +1 -1
  73. package/scaffold/skills/dw-execute-phase/SKILL.md +12 -32
  74. package/scaffold/skills/dw-execute-phase/agents/executor.md +15 -252
  75. package/scaffold/skills/dw-execute-phase/agents/plan-checker.md +4 -207
  76. package/scaffold/skills/dw-execute-phase/references/atomic-commits.md +8 -18
  77. package/scaffold/skills/dw-execute-phase/references/de-sloppify-pass-optional-cleanup-task-detail.md +12 -0
  78. package/scaffold/skills/dw-execute-phase/references/deviation-rules-during-execution-detail.md +8 -0
  79. package/scaffold/skills/dw-execute-phase/references/how-the-two-agents-compose-detail.md +7 -0
  80. package/scaffold/skills/dw-execute-phase/references/plan-verification.md +9 -155
  81. package/scaffold/skills/dw-execute-phase/references/wave-coordination.md +6 -97
  82. package/scaffold/skills/dw-git-discipline/SKILL.md +2 -2
  83. package/scaffold/skills/dw-grilling/SKILL.md +1 -1
  84. package/scaffold/skills/dw-incident-response/SKILL.md +1 -64
  85. package/scaffold/skills/dw-incident-response/references/the-five-phases-detail.md +66 -0
  86. package/scaffold/skills/dw-llm-eval/SKILL.md +5 -53
  87. package/scaffold/skills/dw-llm-eval/references/agent-tool-use-evaluation-detail.md +23 -0
  88. package/scaffold/skills/dw-llm-eval/references/anti-patterns-will-block-in-dw-review-code-only-detail.md +9 -0
  89. package/scaffold/skills/dw-llm-eval/references/consistency-run-to-run-stability-detail.md +10 -0
  90. package/scaffold/skills/dw-llm-eval/references/integration-with-dev-workflow-commands-detail.md +6 -0
  91. package/scaffold/skills/dw-llm-eval/references/the-oracle-ladder-detail.md +15 -0
  92. package/scaffold/skills/dw-memory/SKILL.md +4 -50
  93. package/scaffold/skills/dw-memory/references/context-budget.md +8 -56
  94. package/scaffold/skills/dw-memory/references/promotion-decision-test-detail.md +30 -0
  95. package/scaffold/skills/dw-minimalism/SKILL.md +4 -5
  96. package/scaffold/skills/dw-review-rigor/SKILL.md +1 -54
  97. package/scaffold/skills/dw-review-rigor/references/the-five-rules-detail.md +56 -0
  98. package/scaffold/skills/dw-simplification/SKILL.md +2 -55
  99. package/scaffold/skills/dw-simplification/references/pattern-recognition-detail.md +11 -0
  100. package/scaffold/skills/dw-simplification/references/the-five-rules-detail.md +48 -0
  101. package/scaffold/skills/dw-source-grounding/SKILL.md +1 -56
  102. package/scaffold/skills/dw-source-grounding/references/the-protocol-detect-fetch-implement-cite-detail.md +58 -0
  103. package/scaffold/skills/dw-testing-discipline/SKILL.md +25 -177
  104. package/scaffold/skills/dw-testing-discipline/references/agent-guardrails.md +9 -167
  105. package/scaffold/skills/dw-testing-discipline/references/core-rules.md +3 -3
  106. package/scaffold/skills/dw-testing-discipline/references/mutation-testing.md +19 -0
  107. package/scaffold/skills/dw-testing-discipline/references/patterns.md +3 -12
  108. package/scaffold/skills/dw-ui-discipline/SKILL.md +2 -59
  109. package/scaffold/skills/dw-ui-discipline/references/frontend-engineering.md +46 -0
  110. package/scaffold/skills/dw-ui-discipline/references/the-four-grounding-questions-detail.md +61 -0
  111. package/scaffold/skills/dw-verify/SKILL.md +26 -148
  112. package/scaffold/skills/dw-verify/references/verification-discovery-and-attribution.md +2 -2
  113. package/scaffold/skills/humanizer/SKILL.md +2 -1
  114. package/scaffold/skills/security-review/SKILL.md +3 -183
  115. package/scaffold/skills/security-review/references/do-not-flag-detail.md +49 -0
  116. package/scaffold/skills/security-review/references/quick-patterns-reference-detail.md +56 -0
  117. package/scaffold/skills/security-review/references/review-process-detail.md +84 -0
  118. package/scaffold/skills/vercel-react-best-practices/SKILL.md +1 -90
  119. package/scaffold/skills/vercel-react-best-practices/references/quick-reference-detail.md +92 -0
@@ -1,85 +1,27 @@
1
- # Dispatch tuning — trim the cold start, bind the routing table
1
+ # Dispatch diagnostics and tuning
2
2
 
3
- Read this when a dispatch feels disproportionately expensive for the size of the task, or when wiring
4
- `.dw/config/routing.json` for the first time. The protocol in `SKILL.md` works without it.
3
+ Read when configuring a provider, diagnosing a failed dispatch, or proposing an approved escalation.
5
4
 
6
- ## Cold-start cost
5
+ ## Configuration
7
6
 
8
- A spawned CLI does not share the parent session's prompt cache and boots every configured MCP server before doing
9
- any work. On a small task that startup can cost more than the task itself. This is the one real advantage an
10
- in-session subagent keeps over a spawned CLI — so trim the spawn until the gap stops mattering.
7
+ Inspect CLI version/help for supported flags. Model identifiers and effort support depend on the selected model, provider, account and CLI; help alone is not an availability check. Use project routing candidates and current official provider documentation to propose concrete assignments at task breakdown. Do not silently overwrite `.dw/config/routing.json` during updates.
11
8
 
12
- | | Claude | Codex |
13
- |---|---|---|
14
- | No MCP servers | `--strict-mcp-config` (with no `--mcp-config`) | `-c mcp_servers='{}'` |
15
- | Drop all user config | — | `--ignore-user-config` (blunt: also drops model defaults, so `MODEL` + `EFFORT` become mandatory) |
16
- | Restrict tools | `--tools ""` disables all; `--allowedTools <list>` for a subset | `--sandbox read-only` |
9
+ For legacy plans, `by_commit_type` may suggest a tier; sensitive surfaces and actual complexity take precedence. An approved task assignment wins over routing defaults. Agent profiles keep `model: inherit`; dispatch overrides belong in the task plan.
17
10
 
18
- **Default:** pass the MCP kill switch on every dispatch whose prompt does not name an MCP capability. If the
19
- prompt needs docs lookup (`context7`) or browser automation (`playwright`), keep them and say so in the dispatch
20
- rationale.
11
+ ## Permissions and MCP
21
12
 
22
- Verified against `claude` 2.1.220 and `codex-cli` 0.144.4. Re-check with `claude --help` / `codex exec --help`
23
- after a CLI upgrade — these flags are not covered by either project's stability guarantees.
13
+ Use the approved permission profile for WRITE and enforced read-only controls for READ-ONLY. Preserve the same boundary on resume. Do not use bypass flags as a response to a generic network/test failure. Identify the failing operation and request only missing access if existing authorization does not cover it.
24
14
 
25
- ## Binding `.dw/config/routing.json`
15
+ Load MCP capabilities needed by the task, retaining user configuration. Claude supports `--strict-mcp-config` with an explicit config for selected servers. On Codex, a TOML override such as `mcp_servers='{}'` must not be assumed to remove inherited entries: confirm effective configuration before claiming zero servers. If no selective mechanism is available, retain configuration and report the overhead. Do not drop user rules/auth/config wholesale for a faster start.
26
16
 
27
- Resolution order for a dispatch:
17
+ ## Review and escalation
28
18
 
29
- 1. Read the task's Conventional-Commit type (already in `tasks.md` and in the atomic commit subject).
30
- 2. `by_commit_type[<type>]` → tier name.
31
- 3. If the fence or the task title matches any `escalate_on_surface.patterns`, override the tier upward.
32
- 4. `tiers[<tier>][<brand>]` → concrete `MODEL` + `EFFORT`.
33
- 5. Substitute into the adapter's `MODEL`/`EFFORT` slots.
19
+ Parent re-gate (independent) checks the actual implementation and acceptance criteria. It can reuse matching verification evidence after checking command, inputs, environment, scope and output. It need not buy another provider invocation solely to repeat passing commands. Where a specialized independent reviewer adds value, use the approved agent assignment.
34
20
 
35
- If the file is absent, or the task has no declared type, fall back to the sizing heuristic in `SKILL.md` step 2.
21
+ Fix ordinary defects with the current executor. Escalate model/effort only when the diagnosis identifies a capability limit and the alternative is in the approved plan. Preserve the same session when supported; otherwise reconstruct from durable state in the same worktree. Never discard partial edits. Provider errors, missing credentials, resource limits and permission failures do not automatically justify a stronger model.
36
22
 
37
- `routing.json` is seeded once on init and never reconciled on update, because model availability differs per
38
- account. Treat the shipped model ids as defaults to verify, not as a guarantee of access — a dispatch that fails
39
- with an unknown-model error is a routing-table edit, not a protocol bug.
23
+ Stop when the task is accepted or a concrete blocker prevents further progress; a 0–10 self-score neither proves quality nor authorizes endless retries. Report exhausted approved alternatives and preserve the branch for the owner.
40
24
 
41
- ## Dual evaluation in full
25
+ ## Process handling
42
26
 
43
- The CLI auto-gates cheaply (close to the work); the parent/orchestrator audits independently and compares the
44
- scores, which is what catches an inflated self-score. The parent is the dispatching session — possibly Claude
45
- itself; the re-gate is provider-neutral.
46
-
47
- 1. **Worker auto-gate (loop, MAX effort).** The prompt MUST instruct: after implementing, **run the SAME gate**
48
- and give a **self-score 0–10**; **fix and re-run while the self-score <9 or the gate isn't green**, at max
49
- effort. Stop at self-score ≥9 + green gate (or report `blockers`). The final report carries the self-score plus
50
- a per-criterion breakdown.
51
- 2. **Parent re-gate (independent).** When the worker declares pass, the parent **re-runs the SAME gate** (fan-out,
52
- prefer Workflow → `/workflows`) and gives its **own 0–10**, without trusting the self-score. Prefer a different
53
- brand for this step when both are installed — a second vendor fails differently, which is the whole point of
54
- the second layer. With one brand installed, re-gate in a separate dispatch at a different tier.
55
- 3. **Compare + decide.** Parent ≥9 and small gap → **PASS** (ready for the owner's merge decision). Parent <9 OR a
56
- large gap (worker overestimated) → re-execute: hand the gaps back via **session resume** at max effort and
57
- repeat 1→2→3 until it converges. **The score that counts for acceptance is the parent's**; the self-score is
58
- signal plus an inflation detector. Always record both scores and the gap in the Structured Return.
59
-
60
- ## The escalation ladder in full
61
-
62
- If the score is low, the gate failed, or the CLI didn't finish, re-run the SAME task one notch up — gradual, no
63
- giving up on the first stumble, no jumping to the top.
64
-
65
- - **Ladder (one at a time):** first **effort** `low`→`medium`→`high`→`xhigh`(→`max` on Claude; the adapter names
66
- the levels it supports); once exhausted, bump the **model** one tier and reset effort to `high`. Re-run and
67
- **re-score**.
68
- - **Continue vs restart:** coherent partial edits → **resume the session** (keeps its context and the files it
69
- already touched). Broken or dirty worktree → **reset first**
70
- (`git -C <worktree> reset --hard && git clean -fd`) and run fresh at the higher notch. Don't stack error on
71
- error.
72
- - **Stop:** at **score ≥9** (ready for the owner's gate), OR when **exhausted** (strongest model at max effort
73
- still below the bar) → `BLOCKED` with evidence. Announce each notch; with autonomy, escalate to the ceiling
74
- yourself rather than asking at every step.
75
-
76
- ## Reading escalation as a routing signal
77
-
78
- A task that routinely needs two or more notches above what the table assigned is telling you the table is wrong
79
- for that commit type. Report which
80
- entry mis-sized it in the Structured Return, so the next edit to `routing.json` is grounded in a real run rather
81
- than a guess.
82
-
83
- The reverse also matters and is easier to miss: a tier that never escalates may be over-provisioned. If `feat`
84
- work consistently lands at score ≥9 on the first try, try the tier below it before assuming the current one is
85
- load-bearing.
27
+ Capture the actual process handle/PID on launch. Use its completion/exit status plus the provider's terminal event and final report. Cancel only that task's process through the host handle; do not infer task identity from a broad process-name match. Keep audit logs outside worktrees so authorized cleanup cannot erase evidence.
@@ -31,58 +31,24 @@ Read this skill when:
31
31
  Do NOT use when:
32
32
 
33
33
  - The user is asking a runtime question (use logs / running app).
34
- - The intel is fresh (`.dw/intel/.last-refresh.json` is current and the user did not ask for a refresh).
34
+ - Do not rebuild fresh intel unless requested; querying a fresh index remains appropriate.
35
35
  - The project is greenfield with no source files yet — in that case, fall back to `.dw/rules/` seeded by `/dw-new-project`.
36
36
 
37
37
  ## Files in `.dw/intel/`
38
38
 
39
- The intel directory is the contract. Every file is machine-parseable and references real file paths.
40
-
41
- | File | Purpose | Format |
42
- |------|---------|--------|
43
- | `stack.json` | Languages, frameworks, build/test tooling, package manager | JSON |
44
- | `files.json` | File graph: per-file imports/exports/type | JSON |
45
- | `apis.json` | API surface: routes, methods, params, source file | JSON |
46
- | `deps.json` | Dependencies: version, type, used_by, invocation | JSON |
47
- | `bugfixes.json` | Historical bugfix index aggregated from `.dw/bugfixes/*/SUMMARY.md` (slug, date, modules touched, related concerns, by_module map). Optional — present only if `.dw/bugfixes/` is non-empty. | JSON |
48
- | `arch.md` | Human-readable architecture overview + key components + data flow | Markdown |
49
- | `codemaps/*.md` | Token-lean architecture maps for architecture/backend/frontend/data/dependencies. Optional but recommended for large repos. | Markdown |
50
- | `.last-refresh.json` | Timestamps + content hashes for incremental detection (now includes `bugfixes_indexed` count) | JSON |
51
-
52
- Schemas are documented in `references/intel-format.md`.
39
+ For files in `.dw/intel/`, read `references/files-in-dw-intel-detail.md`. Load only when this part of the task applies.
53
40
 
54
41
  ## Agents
55
42
 
56
- | Agent | Responsibility | Spawn from |
57
- |-------|----------------|------------|
58
- | `agents/intel-updater.md` | Reads source files, writes structured intel to `.dw/intel/`. Supports `full` or `partial --files <paths>` updates. | `/dw-intel --build` |
59
-
60
- This skill ships ONE agent — `intel-updater` — which produces machine-readable JSON for `/dw-intel` queries. Human-readable architecture analysis (per-module conventions, anti-patterns, code smells) lives in `.dw/rules/` and is generated by `/dw-analyze-project`. The two are complementary: `.dw/intel/` answers "what's in this codebase right now?" and `.dw/rules/` answers "how should we write code here?".
43
+ For agents, read `references/agents-detail.md`. Load only when this part of the task applies.
61
44
 
62
45
  ## How to Compose (the typical flow)
63
46
 
64
- 1. **`/dw-intel --build`** is invoked.
65
- 2. The command spawns `intel-updater` with `focus: full` (first run) or `focus: partial --files <paths>` (incremental).
66
- 3. The agent reads source files using iterative retrieval: broad search, relevance evaluation, refined search, then final read set. Use Glob/Read/Grep; no Bash file listing for cross-platform safety.
67
- 4. The agent writes the intel files (`stack.json`, `files.json`, `apis.json`, `deps.json`, `arch.md`) plus token-lean codemaps in `.dw/intel/codemaps/` when enough structure exists.
68
- 5. If `.dw/bugfixes/` exists and contains at least one `SUMMARY.md`, the agent additionally scans every SUMMARY frontmatter + Files Touched section and writes `bugfixes.json`. SUMMARY files with invalid frontmatter are logged and skipped.
69
- 6. The agent writes `.last-refresh.json` with timestamps + hashes for incremental change detection on the next run, including a `bugfixes_indexed` count.
70
- 7. `/dw-intel --build` reports completion and invites the user to query via `/dw-intel "<question>"`.
71
-
72
- For human-readable analysis (architecture overview, module conventions, anti-patterns), run `/dw-analyze-project` after `/dw-intel --build` — it reads `.dw/intel/` as input and produces `.dw/rules/`.
47
+ For how to compose (the typical flow), read `references/how-to-compose-the-typical-flow-detail.md`. Load only when this part of the task applies.
73
48
 
74
49
  ## How `/dw-intel` Reads This
75
50
 
76
- `/dw-intel "auth flow"` does:
77
-
78
- 1. Check `.dw/intel/.last-refresh.json` — is the index fresh (within last 7 days)? If stale, suggest re-running `/dw-intel --build`.
79
- 2. Search `apis.json` for matching paths/descriptions.
80
- 3. Search `files.json` for matching exports.
81
- 4. Search `arch.md` (full-text) for the keyword.
82
- 5. Cross-reference with `deps.json` if the query is about a library.
83
- 6. Return a structured answer with file paths cited, each tagged with a `relevance` (0–1, or high/medium/low) and a one-line reason — so the calling command reads the high-relevance files first and skips the rest, instead of loading the whole result set. Ordering by relevance is what keeps intel queries token-lean.
84
-
85
- If no `.dw/intel/` exists at all, `/dw-intel` falls back to `.dw/rules/` (seeded by `/dw-new-project` or `/dw-analyze-project`) and direct grep over the codebase.
51
+ For how `/dw-intel` reads this, read `references/how-dw-intel-reads-this-detail.md`. Load only when this part of the task applies.
86
52
 
87
53
  ## Rules
88
54
 
@@ -15,7 +15,7 @@ Skipping this causes hallucinated context and broken output.
15
15
 
16
16
  **Project skills:** Check `.claude/skills/` or `.agents/skills/` directory if either exists:
17
17
  1. List available skills (subdirectories)
18
- 2. Read `SKILL.md` for each skill (lightweight index ~130 lines)
18
+ 2. Read only the matching skill entrypoint; discovery metadata is enough to select it
19
19
  3. Load specific reference files as needed during analysis
20
20
  4. Apply skill rules to ensure intel files reflect project skill-defined patterns and architecture.
21
21
 
@@ -0,0 +1,7 @@
1
+ ## Agents
2
+
3
+ | Agent | Responsibility | Spawn from |
4
+ |-------|----------------|------------|
5
+ | `../agents/intel-updater.md` | Reads source files, writes structured intel to `.dw/intel/`. Supports `full` or `partial --files <paths>` updates. | `/dw-intel --build` |
6
+
7
+ This skill ships ONE agent — `intel-updater` — which produces machine-readable JSON for `/dw-intel` queries. Human-readable architecture analysis (per-module conventions, anti-patterns, code smells) lives in `.dw/rules/` and is generated by `/dw-analyze-project`. The two are complementary: `.dw/intel/` answers "what's in this codebase right now?" and `.dw/rules/` answers "how should we write code here?".
@@ -0,0 +1,16 @@
1
+ ## Files in `.dw/intel/`
2
+
3
+ The intel directory is the contract. Every file is machine-parseable and references real file paths.
4
+
5
+ | File | Purpose | Format |
6
+ |------|---------|--------|
7
+ | `stack.json` | Languages, frameworks, build/test tooling, package manager | JSON |
8
+ | `files.json` | File graph: per-file imports/exports/type | JSON |
9
+ | `apis.json` | API surface: routes, methods, params, source file | JSON |
10
+ | `deps.json` | Dependencies: version, type, used_by, invocation | JSON |
11
+ | `bugfixes.json` | Historical bugfix index aggregated from `.dw/bugfixes/*/SUMMARY.md` (slug, date, modules touched, related concerns, by_module map). Optional — present only if `.dw/bugfixes/` is non-empty. | JSON |
12
+ | `arch.md` | Human-readable architecture overview + key components + data flow | Markdown |
13
+ | `codemaps/*.md` | Token-lean architecture maps for architecture/backend/frontend/data/dependencies. Optional but recommended for large repos. | Markdown |
14
+ | `.last-refresh.json` | Timestamps + content hashes for incremental detection (now includes `bugfixes_indexed` count) | JSON |
15
+
16
+ Schemas are documented in `intel-format.md`.
@@ -0,0 +1,12 @@
1
+ ## How `/dw-intel` Reads This
2
+
3
+ `/dw-intel "auth flow"` does:
4
+
5
+ 1. Check `.dw/intel/.last-refresh.json` — is the index fresh (within last 7 days)? If stale, suggest re-running `/dw-intel --build`.
6
+ 2. Search `apis.json` for matching paths/descriptions.
7
+ 3. Search `files.json` for matching exports.
8
+ 4. Search `arch.md` (full-text) for the keyword.
9
+ 5. Cross-reference with `deps.json` if the query is about a library.
10
+ 6. Return a structured answer with file paths cited, each tagged with a `relevance` (0–1, or high/medium/low) and a one-line reason — so the calling command reads the high-relevance files first and skips the rest, instead of loading the whole result set. Ordering by relevance is what keeps intel queries token-lean.
11
+
12
+ If no `.dw/intel/` exists at all, `/dw-intel` falls back to `.dw/rules/` (seeded by `/dw-new-project` or `/dw-analyze-project`) and direct grep over the codebase.
@@ -0,0 +1,11 @@
1
+ ## How to Compose (the typical flow)
2
+
3
+ 1. **`/dw-intel --build`** is invoked.
4
+ 2. The command spawns `intel-updater` with `focus: full` (first run) or `focus: partial --files <paths>` (incremental).
5
+ 3. The agent reads source files using iterative retrieval: broad search, relevance evaluation, refined search, then final read set. Use Glob/Read/Grep; no Bash file listing for cross-platform safety.
6
+ 4. The agent writes the intel files (`stack.json`, `files.json`, `apis.json`, `deps.json`, `arch.md`) plus token-lean codemaps in `.dw/intel/codemaps/` when enough structure exists.
7
+ 5. If `.dw/bugfixes/` exists and contains at least one `SUMMARY.md`, the agent additionally scans every SUMMARY frontmatter + Files Touched section and writes `bugfixes.json`. SUMMARY files with invalid frontmatter are logged and skipped.
8
+ 6. The agent writes `.last-refresh.json` with timestamps + hashes for incremental change detection on the next run, including a `bugfixes_indexed` count.
9
+ 7. `/dw-intel --build` reports completion and invites the user to query via `/dw-intel "<question>"`.
10
+
11
+ For human-readable analysis (architecture overview, module conventions, anti-patterns), run `/dw-analyze-project` after `/dw-intel --build` — it reads `.dw/intel/` as input and produces `.dw/rules/`.
@@ -74,19 +74,8 @@ Render as:
74
74
 
75
75
  ## Phase 2: Tensions and Rebuttals
76
76
 
77
- Read the openings and identify 2-4 **genuine tensions** (Side A, Side B, meaningful stakes — not cosmetic disagreements).
77
+ For phase 2: tensions and rebuttals, read `references/phase-2-tensions-and-rebuttals-detail.md`. Load only when this part of the task applies.
78
78
 
79
- For each tension, re-dispatch the two opposing advisors (can be parallel within a tension, sequential across tensions) with this prompt:
80
-
81
- ```
82
- Steel-man [opponent]'s position in 1-2 sentences, then deliver your rebuttal
83
- in 1 paragraph. State whether you concede, partially concede, or hold firm,
84
- and why. Reference your priorities from agents/<your-id>.md.
85
- ```
86
-
87
- Record as:
88
-
89
- ```markdown
90
79
  ## Core Tensions
91
80
 
92
81
  | Tension | Side A (Advisor) | Side B (Advisor) | Facilitator Note |
@@ -159,11 +148,7 @@ Record as:
159
148
 
160
149
  ## Integration With Other dw-* Commands
161
150
 
162
- - **`/dw-brainstorm --council`** (opt-in): invokes the council after the normal brainstorm to stress-test the top 2-3 options before recommending
163
- - **`/dw-plan techspec --council`** (opt-in): invokes the council on the primary architectural decision of the techspec before finalizing
164
- - **Standalone** `/dw-council "<dilemma>"` (if registered as a command — currently this is a bundled skill invoked by the two above; it can be promoted to a command in a future release if direct usage becomes common)
165
-
166
- The `--council` flag is **additive**: omitting it produces the normal brainstorm/techspec flow. Including it adds a debate section to the output.
151
+ For integration with other dw-* commands, read `references/integration-with-other-dw-commands-detail.md`. Load only when this part of the task applies.
167
152
 
168
153
  ## Inspired by
169
154
 
@@ -0,0 +1,7 @@
1
+ ## Integration With Other dw-* Commands
2
+
3
+ - **`/dw-brainstorm --council`** (opt-in): invokes the council after the normal brainstorm to stress-test the top 2-3 options before recommending
4
+ - **`/dw-plan techspec --council`** (opt-in): invokes the council on the primary architectural decision of the techspec before finalizing
5
+ - **Standalone** `/dw-council "<dilemma>"` (if registered as a command — currently this is a bundled skill invoked by the two above; it can be promoted to a command in a future release if direct usage becomes common)
6
+
7
+ The `--council` flag is **additive**: omitting it produces the normal brainstorm/techspec flow. Including it adds a debate section to the output.
@@ -0,0 +1,15 @@
1
+ ## Phase 2: Tensions and Rebuttals
2
+
3
+ Read the openings and identify 2-4 **genuine tensions** (Side A, Side B, meaningful stakes — not cosmetic disagreements).
4
+
5
+ For each tension, re-dispatch the two opposing advisors (can be parallel within a tension, sequential across tensions) with this prompt:
6
+
7
+ ```
8
+ Steel-man [opponent]'s position in 1-2 sentences, then deliver your rebuttal
9
+ in 1 paragraph. State whether you concede, partially concede, or hold firm,
10
+ and why. Reference your priorities from agents/<your-id>.md.
11
+ ```
12
+
13
+ Record as:
14
+
15
+ ```markdown
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: dw-domain-modeling
3
- description: "Internal domain-vocabulary protocol for the native Grill flow. Loaded by /dw-brainstorm (grill mode) and referenced by /dw-analyze-project to keep canonical vocabulary: challenge fuzzy or overloaded terms, propose precise canonical names, stress-test with concrete edge-case scenarios, cross-check terms against the code, and persist resolved terms safely and lazily into .dw/domain (glossary for a single context, context-map plus per-context files for many). Rare ADR policy. Pipeline-internal, never exported, never implements code."
3
+ description: Internal domain-vocabulary protocol for the native Grill flow.
4
4
  allowed-tools:
5
5
  - Read
6
6
  - Grep
@@ -26,7 +26,7 @@ Read this skill when:
26
26
 
27
27
  - `/dw-execute-phase` is invoked to run a batch of tasks in parallel waves.
28
28
  - `/dw-plan-checker` is invoked to verify a `tasks.md` file will achieve its PRD goal before execution.
29
- - `/dw-run` is invoked (it spawns the executor agent for each wave).
29
+ - `/dw-run` needs dependency or plan verification for approved tasks.
30
30
  - `/dw-autopilot` enters the execution stage (it gates on plan-checker before invoking the executor).
31
31
 
32
32
  Do NOT use when:
@@ -35,6 +35,8 @@ Do NOT use when:
35
35
  - The user is exploring/brainstorming, not executing (use `/dw-brainstorm`).
36
36
  - The plan hasn't been created yet (use `/dw-plan tasks` first).
37
37
 
38
+ Read `.dw/references/execution-contract.md` for approved tool/model/agent assignments and durable state. Agent profiles below are available protocols, not mandatory additional dispatches.
39
+
38
40
  ## Agents
39
41
 
40
42
  | Agent | Responsibility | Spawn from |
@@ -44,40 +46,27 @@ Do NOT use when:
44
46
 
45
47
  ## How the Two Agents Compose
46
48
 
47
- The expected flow:
48
-
49
- 1. `/dw-plan tasks` produces `.dw/spec/prd-<slug>/tasks.md` from PRD + TechSpec.
50
- 2. **Plan-checker GATE** — `/dw-plan-checker .dw/spec/prd-<slug>/` spawns the plan-checker agent. The agent reads PRD/TechSpec/tasks.md and verifies tasks WILL achieve the goal. Returns one of: `PASS` (proceed), `REVISE` (issues found, planner re-runs), `BLOCK` (fundamental gap, abort).
51
- 3. `/dw-execute-phase` spawns the executor agent ONLY if plan-checker returned `PASS`. The executor runs tasks in waves, commits atomically, handles deviations.
52
- 4. `/dw-qa` runs after all waves complete to validate the implementation against PRD.
53
-
54
- `/dw-autopilot` orchestrates this entire flow with hard gates between stages.
49
+ For how the two agents compose, read `references/how-the-two-agents-compose-detail.md`. Load only when this part of the task applies.
55
50
 
56
51
  ## Wave Concept
57
52
 
58
53
  Tasks in `tasks.md` are grouped into **waves** by their `Depends on:` frontmatter:
59
54
 
60
- - Wave 1: tasks with no dependencies → run in parallel
55
+ - Wave 1: tasks with no dependencies → ready to run
61
56
  - Wave 2: tasks that depend on Wave 1 → run after Wave 1 commits land
62
57
  - Wave N: ...
63
58
 
64
- Within a wave, tasks run in parallel via subagent dispatch. Across waves, sequential.
59
+ Within a wave, concurrency is optional and follows approved assignments. One writer per worktree, at most 3 workers; dependent tasks share the execution branch sequentially.
65
60
 
66
61
  The executor calculates waves automatically by topologically sorting task dependencies. See `references/wave-coordination.md`.
67
62
 
68
63
  ## Deviation Rules (during execution)
69
64
 
70
- Mid-task, the executor may discover the plan is incomplete or contradicted by reality. Three rules:
71
-
72
- 1. **Auto-add missing critical functionality** — if a task says "create endpoint" but no validation is specified and the project's CLAUDE.md/rules require it, add the validation as part of the same task. Note in the task's commit message.
73
- 2. **Surface ambiguity, don't guess** — if the plan says "use the existing service" and 3 services match, STOP, write a deviation entry to `.dw/spec/prd-<slug>/deviations.md`, and ask the user.
74
- 3. **Block on architectural conflicts** — if the task as planned would violate a locked decision in CONTEXT.md / project rules, abort the task and surface the conflict for re-planning.
75
-
76
- Detail in `references/atomic-commits.md` (deviation entry format) and `references/plan-verification.md` (what plan-checker should catch BEFORE execution to prevent deviations).
65
+ For deviation rules (during execution), read `references/deviation-rules-during-execution-detail.md`. Load only when this part of the task applies.
77
66
 
78
67
  ## Atomic Commit Protocol
79
68
 
80
- Every task ends with exactly one git commit:
69
+ Formal tasks use scoped atomic commits, with approved subtask milestones when specified:
81
70
 
82
71
  ```
83
72
  feat(<scope>): <task title> (#<task-id>)
@@ -98,16 +87,7 @@ The commit message format is consistent across waves so `/dw-generate-pr` can bu
98
87
 
99
88
  ## De-Sloppify Pass (optional cleanup task)
100
89
 
101
- LLM implementers are thorough but leave slop — tests of framework/language behavior, defensive checks the type system already enforces, leftover `console.log`, over-handled impossible states. Constraining the implementer with "don't over-engineer" degrades its output unpredictably; a **separate cleanup pass in a fresh context** works better. Two focused agents beat one constrained agent.
102
-
103
- To request one, a task in `tasks.md` may carry `Cleanup After: <N>` in its frontmatter. The executor runs it as its own task (own commit) right after task N's wave lands, scoped to task N's diff:
104
-
105
- - Remove tests that assert language/framework behavior rather than business logic.
106
- - Remove type checks and guards the type system or a prior validation already guarantees.
107
- - Remove `console.log`/debug prints and commented-out code.
108
- - Keep every business-logic test and every real error path — when unsure, keep it.
109
-
110
- The cleanup task commits as `refactor(<scope>): de-slop <task N title>` and must leave the gate green (lint + tests + build) — it never changes behavior. Opt-in: no `Cleanup After:` means no cleanup task runs.
90
+ For de-sloppify pass (optional cleanup task), read `references/de-sloppify-pass-optional-cleanup-task-detail.md`. Load only when this part of the task applies.
111
91
 
112
92
  ## Checkpoint Protocol
113
93
 
@@ -137,11 +117,11 @@ If the executor exhausts its context budget mid-phase OR the user signals stop:
137
117
 
138
118
  ## Rules
139
119
 
140
- - **No execution without plan-checker PASS.** `/dw-execute-phase` and `/dw-run` must call plan-checker first; if it returns REVISE or BLOCK, abort.
141
- - **One commit per task, no exceptions.** Even trivial tasks commit. This drives traceability and revert safety.
120
+ - **No execution without plan-checker PASS.** `/dw-execute-phase` and `/dw-run` must call plan-checker first; repair internal REVISE findings; BLOCK only when a material decision or invalid dependency remains.
121
+ - **Scoped atomic commits for formal tasks.** Follow approved subtask milestones when specified; direct small edits do not invoke this protocol. This drives traceability and revert safety.
142
122
  - **Deviations are recorded, not silenced.** Every adjustment beyond the plan goes in `deviations.md` with reason.
143
123
  - **Checkpoint > timeout.** When context budget is low, checkpoint cleanly rather than running tasks half-way.
144
- - **Wave order is topological, not user-defined.** The executor computes wave boundaries from `Depends on:` fields; users can't override.
124
+ - **Wave order is topological, not user-defined.** The executor computes wave boundaries from `Depends on:` fields; concurrency limits queue ready tasks without inventing dependencies.
145
125
 
146
126
  ## Inspired by
147
127