devflow-kit 3.2.0 → 3.4.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 (188) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +1 -1
  3. package/dist/agents/code.md +330 -0
  4. package/{src/assets → dist}/agents/design.md +11 -1
  5. package/{src/assets → dist}/agents/diagnose.md +17 -13
  6. package/dist/agents/git.md +29 -56
  7. package/{src/assets → dist}/agents/knowledge.md +8 -5
  8. package/{src/assets → dist}/agents/research.md +21 -2
  9. package/{src/assets → dist}/agents/review.md +18 -7
  10. package/{src/assets → dist}/agents/scrutinize.md +35 -11
  11. package/dist/agents/skim.md +148 -0
  12. package/{src/assets → dist}/agents/triage.md +8 -2
  13. package/dist/cli/commands/init.js +62 -0
  14. package/dist/cli/commands/learning.js +63 -8
  15. package/dist/cli/commands/uninstall.js +42 -1
  16. package/dist/commands/bug-analysis.md +30 -8
  17. package/dist/commands/code-review.md +142 -61
  18. package/dist/commands/debug.md +15 -13
  19. package/dist/commands/dynamic-build.md +176 -130
  20. package/dist/commands/dynamic-plan.md +31 -19
  21. package/dist/commands/dynamic-profile.md +27 -13
  22. package/dist/commands/dynamic-tickets.md +28 -14
  23. package/dist/commands/explore.md +16 -14
  24. package/dist/commands/implement.md +163 -158
  25. package/dist/commands/plan.md +37 -24
  26. package/dist/commands/release.md +69 -4
  27. package/dist/commands/research.md +33 -11
  28. package/dist/commands/resolve.md +61 -47
  29. package/dist/commands/self-review.md +50 -32
  30. package/dist/core/agent-models.js +53 -7
  31. package/dist/core/assets.js +55 -10
  32. package/dist/core/claude-md-audit.js +190 -0
  33. package/dist/core/feature-switch.js +20 -1
  34. package/dist/core/flags.js +28 -0
  35. package/dist/core/fs-atomic.js +8 -3
  36. package/dist/core/learning-tuning-config.js +8 -0
  37. package/dist/core/learning-variants.js +213 -0
  38. package/dist/core/manifest.js +62 -0
  39. package/dist/core/mds-variants.js +38 -1
  40. package/dist/core/plugins.js +78 -11
  41. package/{src/assets → dist/learning-off}/agents/code.md +77 -28
  42. package/dist/learning-off/agents/design.md +119 -0
  43. package/dist/learning-off/agents/diagnose.md +210 -0
  44. package/dist/learning-off/agents/knowledge.md +90 -0
  45. package/dist/learning-off/agents/research.md +149 -0
  46. package/dist/learning-off/agents/review.md +228 -0
  47. package/dist/learning-off/agents/scrutinize.md +117 -0
  48. package/{src/assets → dist/learning-off}/agents/skim.md +5 -10
  49. package/dist/learning-off/agents/triage.md +163 -0
  50. package/dist/learning-off/commands/bug-analysis.md +420 -0
  51. package/dist/learning-off/commands/code-review.md +525 -0
  52. package/dist/learning-off/commands/debug.md +294 -0
  53. package/dist/learning-off/commands/dynamic-build.md +1255 -0
  54. package/dist/learning-off/commands/dynamic-plan.md +424 -0
  55. package/dist/learning-off/commands/dynamic-profile.md +214 -0
  56. package/dist/learning-off/commands/dynamic-tickets.md +632 -0
  57. package/dist/learning-off/commands/explore.md +210 -0
  58. package/dist/learning-off/commands/implement.md +808 -0
  59. package/dist/learning-off/commands/plan.md +664 -0
  60. package/dist/learning-off/commands/release.md +310 -0
  61. package/dist/learning-off/commands/research.md +222 -0
  62. package/dist/learning-off/commands/resolve.md +837 -0
  63. package/dist/learning-off/commands/self-review.md +266 -0
  64. package/dist/skills/git/references/tracker/_contract.md +33 -0
  65. package/dist/skills/git/references/tracker/github/fetch-issue.md +2 -0
  66. package/dist/skills/git/references/tracker/github/fetch-issues-batch.md +2 -0
  67. package/dist/skills/git/references/tracker/github/gather-release-evidence.md +5 -1
  68. package/dist/skills/git/references/tracker/github/post-wave-report.md +2 -0
  69. package/dist/skills/git/references/tracker/github/setup-task.md +12 -0
  70. package/dist/skills/git/references/tracker/jira/associate-release.md +1 -1
  71. package/dist/skills/git/references/tracker/jira/fetch-issue.md +2 -0
  72. package/dist/skills/git/references/tracker/jira/fetch-issues-batch.md +2 -0
  73. package/dist/skills/git/references/tracker/jira/gather-release-evidence.md +5 -1
  74. package/dist/skills/git/references/tracker/jira/post-wave-report.md +2 -0
  75. package/dist/skills/git/references/tracker/jira/setup-task.md +14 -2
  76. package/dist/skills/git/references/tracker/linear/associate-release.md +1 -1
  77. package/dist/skills/git/references/tracker/linear/fetch-issue.md +2 -0
  78. package/dist/skills/git/references/tracker/linear/fetch-issues-batch.md +2 -0
  79. package/dist/skills/git/references/tracker/linear/gather-release-evidence.md +5 -1
  80. package/dist/skills/git/references/tracker/linear/post-wave-report.md +2 -0
  81. package/dist/skills/git/references/tracker/linear/setup-task.md +14 -2
  82. package/dist/targets/claude-code/installer.js +72 -36
  83. package/dist/targets/claude-code/language-stamp.js +185 -0
  84. package/dist/targets/claude-code/learning-install.js +489 -0
  85. package/package.json +1 -1
  86. package/src/assets/agents/code.mds +339 -0
  87. package/src/assets/agents/design.mds +149 -0
  88. package/src/assets/agents/diagnose.mds +225 -0
  89. package/src/assets/agents/evaluate.md +12 -25
  90. package/src/assets/agents/git.mds +29 -56
  91. package/src/assets/agents/knowledge.mds +125 -0
  92. package/src/assets/agents/learning.md +4 -6
  93. package/src/assets/agents/research.mds +176 -0
  94. package/src/assets/agents/review.mds +286 -0
  95. package/src/assets/agents/scrutinize.mds +132 -0
  96. package/src/assets/agents/simplify.md +20 -0
  97. package/src/assets/agents/skim.mds +161 -0
  98. package/src/assets/agents/synthesize.md +12 -0
  99. package/src/assets/agents/test.md +2 -2
  100. package/src/assets/agents/triage.mds +194 -0
  101. package/src/assets/agents/validate.md +15 -8
  102. package/src/assets/commands/_partials/_compliance.mds +5 -4
  103. package/src/assets/commands/_partials/_decisions.mds +31 -0
  104. package/src/assets/commands/_partials/_engine.mds +29 -24
  105. package/src/assets/commands/_partials/_knowledge.mds +26 -13
  106. package/src/assets/commands/_partials/_plan_contract.mds +1 -1
  107. package/src/assets/commands/_partials/_preamble.mds +33 -9
  108. package/src/assets/commands/_partials/_publication.mds +5 -4
  109. package/src/assets/commands/_partials/_settings.mds +13 -5
  110. package/src/assets/commands/_partials/_wave.mds +16 -6
  111. package/src/assets/commands/bug-analysis.mds +24 -2
  112. package/src/assets/commands/code-review.mds +148 -45
  113. package/src/assets/commands/debug.mds +17 -1
  114. package/src/assets/commands/dynamic-build.mds +144 -65
  115. package/src/assets/commands/dynamic-plan.mds +36 -6
  116. package/src/assets/commands/dynamic-profile.mds +9 -1
  117. package/src/assets/commands/dynamic-tickets.mds +16 -2
  118. package/src/assets/commands/explore.mds +27 -1
  119. package/src/assets/commands/implement.mds +171 -138
  120. package/src/assets/commands/plan.mds +47 -8
  121. package/src/assets/commands/{release.md → release.mds} +27 -24
  122. package/src/assets/commands/research.mds +28 -4
  123. package/src/assets/commands/resolve.mds +69 -17
  124. package/src/assets/commands/self-review.mds +43 -13
  125. package/src/assets/mds/tracker/_common.mds +1 -1
  126. package/src/assets/mds/tracker/_contract.mds +72 -0
  127. package/src/assets/mds/tracker/_github.mds +13 -2
  128. package/src/assets/mds/tracker/_jira.mds +17 -5
  129. package/src/assets/mds/tracker/_linear.mds +17 -5
  130. package/src/assets/mds/tracker/_mcp.mds +2 -2
  131. package/src/assets/mds/tracker/_steps.mds +97 -0
  132. package/src/assets/rules/context-economy.md +10 -0
  133. package/src/assets/rules/go.md +1 -0
  134. package/src/assets/rules/java.md +1 -0
  135. package/src/assets/rules/python.md +1 -0
  136. package/src/assets/rules/rust.md +1 -0
  137. package/src/assets/rules/typescript.md +1 -0
  138. package/src/assets/scripts/ci-wait.cjs +636 -0
  139. package/src/assets/scripts/claude-md-audit.cjs +611 -0
  140. package/src/assets/scripts/hooks/assets/orchestrator-charter.md +2 -3
  141. package/src/assets/scripts/hooks/background-memory-update +290 -9
  142. package/src/assets/scripts/hooks/json-helper.cjs +13 -5
  143. package/src/assets/scripts/hooks/json-parse +34 -10
  144. package/src/assets/scripts/hooks/session-start-context +315 -7
  145. package/src/assets/scripts/release-trace.cjs +27 -10
  146. package/src/assets/skills/accessibility/SKILL.md +1 -1
  147. package/src/assets/skills/apply-decisions/SKILL.md +12 -82
  148. package/src/assets/skills/apply-feature-knowledge/SKILL.md +9 -43
  149. package/src/assets/skills/architecture/SKILL.md +1 -1
  150. package/src/assets/skills/boundary-validation/SKILL.md +1 -1
  151. package/src/assets/skills/complexity/SKILL.md +1 -1
  152. package/src/assets/skills/compliance/SKILL.md +1 -1
  153. package/src/assets/skills/consistency/SKILL.md +1 -1
  154. package/src/assets/skills/database/SKILL.md +1 -1
  155. package/src/assets/skills/dependencies/SKILL.md +1 -1
  156. package/src/assets/skills/dependency-research/SKILL.md +3 -6
  157. package/src/assets/skills/design-review/SKILL.md +1 -1
  158. package/src/assets/skills/docs-framework/SKILL.md +1 -1
  159. package/src/assets/skills/documentation/SKILL.md +1 -1
  160. package/src/assets/skills/feature-knowledge/SKILL.md +43 -12
  161. package/src/assets/skills/gap-analysis/SKILL.md +1 -1
  162. package/src/assets/skills/git/SKILL.md +1 -1
  163. package/src/assets/skills/go/SKILL.md +1 -1
  164. package/src/assets/skills/java/SKILL.md +1 -1
  165. package/src/assets/skills/patterns/SKILL.md +1 -1
  166. package/src/assets/skills/performance/SKILL.md +1 -1
  167. package/src/assets/skills/python/SKILL.md +1 -1
  168. package/src/assets/skills/qa/SKILL.md +1 -3
  169. package/src/assets/skills/quality-gates/SKILL.md +10 -13
  170. package/src/assets/skills/quality-gates/references/report-template.md +20 -20
  171. package/src/assets/skills/react/SKILL.md +1 -1
  172. package/src/assets/skills/regression/SKILL.md +1 -1
  173. package/src/assets/skills/reliability/SKILL.md +1 -1
  174. package/src/assets/skills/research-codebase/SKILL.md +1 -1
  175. package/src/assets/skills/research-competitor/SKILL.md +1 -1
  176. package/src/assets/skills/research-external/SKILL.md +1 -1
  177. package/src/assets/skills/research-technology/SKILL.md +1 -1
  178. package/src/assets/skills/review-methodology/SKILL.md +1 -1
  179. package/src/assets/skills/rust/SKILL.md +1 -1
  180. package/src/assets/skills/security/SKILL.md +1 -1
  181. package/src/assets/skills/software-design/SKILL.md +1 -1
  182. package/src/assets/skills/test-driven-development/SKILL.md +9 -29
  183. package/src/assets/skills/testing/SKILL.md +1 -1
  184. package/src/assets/skills/typescript/SKILL.md +1 -1
  185. package/src/assets/skills/ui-design/SKILL.md +1 -1
  186. package/src/assets/skills/worktree-support/SKILL.md +3 -55
  187. package/src/assets/skills/worktree-support/references/discovery.md +48 -0
  188. package/src/assets/skills/worktree-support/references/roots.md +2 -2
@@ -7,6 +7,7 @@ output-dir: dist/commands
7
7
  @import { compliance_gate } from "./_partials/_compliance.mds"
8
8
  @import { evidence_policy } from "./_partials/_evidence_policy.mds"
9
9
  @import { publication_gate } from "./_partials/_publication.mds"
10
+ @import "./_partials/_settings.mds" as settings
10
11
  # Code Review Command
11
12
 
12
13
  Run a comprehensive code review of the current branch by spawning parallel review agents, then synthesizing results into PR comments. Supports incremental reviews, timestamped report directories, and multi-worktree auto-discovery.
@@ -30,7 +31,7 @@ Run a comprehensive code review of the current branch by spawning parallel revie
30
31
 
31
32
  1. **Discover reviewable worktrees** using the `devflow:worktree-support` skill discovery algorithm:
32
33
  - Run `git worktree list --porcelain` → parse, filter (skip protected/detached/mid-rebase), dedup by branch, sort by recent commit
33
- - See the `devflow:worktree-support` skill for the full 7-step algorithm and canonical protected branch list
34
+ - Invoke the `devflow:worktree-support` skill, then Read its `references/discovery.md` from the skill's base directory for the full 7-step algorithm; the canonical protected branch list stays in the skill
34
35
  2. **If `--path` flag provided:** use only that worktree, skip discovery
35
36
  **`--path` validation**: Before proceeding, verify the path exists as a directory and appears in `git worktree list` output. If not: report error and stop.
36
37
  3. **If only 1 reviewable worktree** (the common case): proceed as single-worktree flow — zero behavior change
@@ -40,6 +41,8 @@ Run a comprehensive code review of the current branch by spawning parallel revie
40
41
 
41
42
  **Produces:** COMPLIANCE_ACTIVE, COMPLIANCE_FRAMEWORKS
42
43
 
44
+ {{settings.settings_resolve()}}
45
+
43
46
  {{compliance_gate()}}
44
47
  Keep each worktree's values for every downstream phase of that worktree.
45
48
 
@@ -164,10 +167,48 @@ For each reviewable worktree, call:
164
167
 
165
168
  ### Phase 1: Analyze Changed Files
166
169
 
167
- **Produces:** REVIEW_FOCUS_LIST
168
- **Requires:** DIFF_RANGE, COMPLIANCE_ACTIVE (from Step 0b)
170
+ **Produces:** REVIEW_FOCUS_LIST, DIFF_CLASS, DIFF_FILES
171
+ **Requires:** DIFF_RANGE, REVIEW_DIR, COMPLIANCE_ACTIVE (from Step 0b)
172
+
173
+ Per worktree, in order. Each `git` command here writes to a file and prints nothing.
174
+
175
+ #### Step 1.1: Classify the diff
176
+
177
+ **Produces:** DIFF_CLASS, CHANGED_PATHS, REVIEW_FOCUS_LIST (reduced classes)
178
+ **Requires:** DIFF_RANGE, REVIEW_DIR
179
+
180
+ List the changed paths into `{REVIEW_DIR}/paths.txt` and print only the line count (drop `-C "{WORKTREE_PATH}"` when there is no `WORKTREE_PATH`):
181
+
182
+ ```bash
183
+ git -C "{WORKTREE_PATH}" diff --name-only --no-renames {DIFF_RANGE} > "{REVIEW_DIR}/paths.txt"
184
+ wc -l < "{REVIEW_DIR}/paths.txt"
185
+ ```
186
+
187
+ Read `paths.txt` once when the count is about 40 or fewer, and in ranges of about 40 lines (Read with offset and limit) when it is more. `--no-renames` lists a moved file under its old path and its new one, so a move cannot take a file out of its own class.
188
+
189
+ Set `DIFF_CLASS` by these rules, in order; the first that decides wins:
190
+
191
+ 1. **Instruction and config paths are `code`.** Any changed path that is `CLAUDE.md`, `AGENTS.md`, under `.claude/` or `src/assets/`, a `*.mds` file, under a plugin's `agents/`, `skills/` or `commands/` directory, `.devflow/project.json`, `.devflow/conventions.md`, or a manifest or build file (`package.json`, `go.mod`, `Cargo.toml`, `pyproject.toml`, `requirements*.txt`, `CMakeLists.txt`). This rule runs first, so a diff made only of such files is `code` and never `docs-only`.
192
+ 2. **`docs-only`.** Every changed path matches `*.md`, `*.mdx`, `*.rst`, `*.txt`, `docs/**` or `CHANGELOG*`.
193
+ 3. **`tests-only`.** Every changed path matches `tests/**`, `**/__tests__/**`, `*.test.*`, `*.spec.*`, `*_test.go`, `test_*.py` or `*_test.py`.
194
+ 4. **`lockfile-only`.** Every changed path is `package-lock.json`, `pnpm-lock.yaml`, `yarn.lock`, `bun.lockb`, `Cargo.lock`, `go.sum`, `poetry.lock`, `uv.lock`, `Gemfile.lock` or `composer.lock`.
195
+ 5. **Mixed non-code.** Every changed path matches the docs, tests or lockfile patterns, but no single rule above holds (docs with tests, tests with a lockfile): `DIFF_CLASS` names each class involved.
196
+ 6. **Fail-safe is `code`.** A changed path that matches no class pattern makes the diff `code`, and so does an empty path list. A manifest change is `code` and never `lockfile-only`.
197
+
198
+ Each reduced class runs only its focus set, every member reading `diff.patch`:
199
+
200
+ - `docs-only`: documentation, consistency, security
201
+ - `tests-only`: testing, reliability, consistency, security
202
+ - `lockfile-only`: dependencies, security
203
+
204
+ A mixed non-code diff runs the union of the sets of the classes it holds. Language and conditional triggers inside a reduced class are suppressed: they add no focus, and Step 1.2 applies to the `code` class only.
169
205
 
170
- Per worktree, detect file types in diff using `DIFF_RANGE` to determine conditional reviews.
206
+ #### Step 1.2: Choose the focuses
207
+
208
+ **Produces:** REVIEW_FOCUS_LIST (code class)
209
+ **Requires:** DIFF_CLASS, CHANGED_PATHS, COMPLIANCE_ACTIVE
210
+
211
+ When `DIFF_CLASS` is `code`, read the file types from the paths in `paths.txt` to determine conditional reviews:
171
212
 
172
213
  | Condition | Adds Review |
173
214
  |-----------|-------------|
@@ -186,57 +227,104 @@ Per worktree, detect file types in diff using `DIFF_RANGE` to determine conditio
186
227
 
187
228
  If `COMPLIANCE_ACTIVE` AND the diff touches regulated surface (data models, auth flows, logging/observability, payments, IaC, retention): add `compliance` to REVIEW_FOCUS_LIST for this worktree.
188
229
 
189
- **Language focus presence gate.** The eight language focuses — `typescript`, `react`, `accessibility`, `ui-design`, `go`, `java`, `python`, `rust` — ship with optional plugins, so their pattern skills are installed only when the user selected that plugin. Gate them by presence: for each language focus the table above would add, check whether `{claude_dir}/skills/devflow:{focus}/SKILL.md` exists, `{claude_dir}` being Claude Code's directory as the installer resolves it — `CLAUDE_CONFIG_DIR` when that is set to an absolute path, else `$HOME/.claude` (D-CLAUDE-DIR-PROMPTS). Run one read-only, silent check per candidate focus:
230
+ **Language focus stamp.** The eight language focuses — `typescript`, `react`, `accessibility`, `ui-design`, `go`, `java`, `python`, `rust` — ship with optional plugins, and the installer stamps the ones installed on this machine onto this line, rewriting it on every install and on `uninstall --plugin`:
231
+
232
+ Installed language focuses: (none)
233
+
234
+ A language focus is spawned only when its file-type condition above fires AND its name appears in that stamped line. A focus missing from the line is never spawned, even when its trigger fires. The eight core focuses are unconditional and are never stamp-gated.
235
+
236
+ #### Step 1.3: Write the diff files
237
+
238
+ **Produces:** DIFF_FILES
239
+ **Requires:** DIFF_RANGE, REVIEW_DIR, REVIEW_FOCUS_LIST
240
+
241
+ Write `diff.patch` once per worktree, by redirect:
190
242
 
191
243
  ```bash
192
- d="${CLAUDE_CONFIG_DIR:-}"; case "$d" in /*) ;; *) d="$HOME/.claude" ;; esac; test -f "$d/skills/devflow:{focus}/SKILL.md"; echo "exit=$?"
244
+ git -C "{WORKTREE_PATH}" diff --no-color --no-ext-diff --no-textconv {DIFF_RANGE} > "{REVIEW_DIR}/diff.patch"
193
245
  ```
194
246
 
195
- Only `exit=0` means the skill is installed. On any other result, do NOT add that focus to `REVIEW_FOCUS_LIST` and do NOT spawn a Review agent for it — the file-type condition alone never spawns a language focus. The eight core focuses are unconditional and are never presence-gated.
247
+ It holds the whole diff of `DIFF_RANGE`. On a `code` diff, add one patch for each language focus in REVIEW_FOCUS_LIST, by the same command with quoted pathspecs from this table:
196
248
 
249
+ ```bash
250
+ git -C "{WORKTREE_PATH}" diff --no-color --no-ext-diff --no-textconv {DIFF_RANGE} -- '<pathspec>' ... > "{REVIEW_DIR}/diff-{focus}.patch"
251
+ ```
252
+
253
+ | Focus | Pathspecs |
254
+ |-------|-----------|
255
+ | typescript | `'*.ts' '*.tsx'` |
256
+ | react, accessibility | `'*.tsx' '*.jsx'` |
257
+ | ui-design | `'*.tsx' '*.jsx' '*.css' '*.scss'` |
258
+ | go | `'*.go'` |
259
+ | java | `'*.java'` |
260
+ | python | `'*.py'` |
261
+ | rust | `'*.rs'` |
262
+
263
+ The core, database, dependencies, documentation and compliance focuses, and every reduced-class focus, read `diff.patch`. A language focus sees only its own extensions and reaches anything else through `DIFF_RANGE`. Set `DIFF_FILES` to the files written. They live in `REVIEW_DIR`, under the gitignored `.devflow/` tree, with `paths.txt`: never committed, posted or passed to the Git agent.
264
+
265
+ <!-- learning:on -->
197
266
  ### Phase 1b: Load Decisions Index
267
+ <!-- learning:off -->
268
+ ### Phase 1b: Load Context
269
+ <!-- learning:end -->
198
270
 
199
- **Produces:** DECISIONS_CONTEXT, FEATURE_KNOWLEDGE, COMPLIANCE_FRAMEWORKS (carried from Step 0b)
271
+ <!-- learning:on -->
272
+ **Produces:** DECISIONS_CONTEXT, FEATURE_KNOWLEDGE, FEATURE_KNOWLEDGE_RULES, COMPLIANCE_FRAMEWORKS (carried from Step 0b)
273
+ <!-- learning:off -->
274
+ **Produces:** FEATURE_KNOWLEDGE, FEATURE_KNOWLEDGE_RULES, COMPLIANCE_FRAMEWORKS (carried from Step 0b)
275
+ <!-- learning:end -->
200
276
 
201
277
  {{decisions_load()}}
202
-
278
+ <!-- learning:on -->
203
279
  This produces a compact index of active ADR/PF entries. Pass `DECISIONS_CONTEXT` to all Review agents. Review agents use `devflow:apply-decisions` to Read full entry bodies on demand.
204
280
 
281
+ <!-- learning:end -->
205
282
  {{knowledge_load()}}
206
283
 
284
+ <!-- learning:on -->
207
285
  Pass `FEATURE_KNOWLEDGE` to all Review agents alongside `DECISIONS_CONTEXT`.
286
+ <!-- learning:off -->
287
+ Pass `FEATURE_KNOWLEDGE` to all Review agents.
288
+ <!-- learning:end -->
208
289
 
209
290
  ### Phase 2: Run Reviews (Parallel)
210
291
 
211
292
  **Produces:** REVIEW_FOCUS_OUTPUTS
212
- **Requires:** DIFF_RANGE, REVIEW_DIR, TIMESTAMP, DECISIONS_CONTEXT, FEATURE_KNOWLEDGE, PR_DESCRIPTION, PRIOR_RESOLUTIONS, REVIEW_FOCUS_LIST
213
-
214
- Spawn Review agents **in a single message**. Always run 8 core reviews; conditionally add more based on changed file types (max 20 per worktree):
215
-
216
- | Focus | Always | Pattern Skill |
217
- |-------|--------|---------------|
218
- | security | ✓ | devflow:security |
219
- | architecture | ✓ | devflow:architecture |
220
- | performance | ✓ | devflow:performance |
221
- | complexity | ✓ | devflow:complexity |
222
- | consistency | ✓ | devflow:consistency |
223
- | regression | ✓ | devflow:regression |
224
- | testing | ✓ | devflow:testing |
225
- | reliability | ✓ | devflow:reliability |
226
- | typescript | presence-gated | devflow:typescript |
227
- | react | presence-gated | devflow:react |
228
- | accessibility | presence-gated | devflow:accessibility |
229
- | ui-design | presence-gated | devflow:ui-design |
230
- | go | presence-gated | devflow:go |
231
- | java | presence-gated | devflow:java |
232
- | python | presence-gated | devflow:python |
233
- | rust | presence-gated | devflow:rust |
234
- | database | conditional | devflow:database |
235
- | dependencies | conditional | devflow:dependencies |
236
- | documentation | conditional | devflow:documentation |
237
- | compliance | diff-driven | devflow:compliance |
238
-
239
- Review agent count: 8 always-active, +1-12 diff-driven conditional (max 20 total per worktree).
293
+ <!-- learning:on -->
294
+ **Requires:** DIFF_RANGE, REVIEW_DIR, TIMESTAMP, DECISIONS_CONTEXT, FEATURE_KNOWLEDGE, PR_DESCRIPTION, PRIOR_RESOLUTIONS, REVIEW_FOCUS_LIST, DIFF_CLASS, DIFF_FILES
295
+ <!-- learning:off -->
296
+ **Requires:** DIFF_RANGE, REVIEW_DIR, TIMESTAMP, FEATURE_KNOWLEDGE, PR_DESCRIPTION, PRIOR_RESOLUTIONS, REVIEW_FOCUS_LIST, DIFF_CLASS, DIFF_FILES
297
+ <!-- learning:end -->
298
+
299
+ Spawn Review agents **in a single message**, for the focus set `DIFF_CLASS` selects (max 20 per worktree):
300
+
301
+ - `code`: the 8 core reviews on the full `diff.patch`, plus the language and conditional focuses Phase 1 added.
302
+ - `docs-only`, `tests-only`, `lockfile-only`: only the reduced set Phase 1 names, each reading `diff.patch`; a mixed non-code diff runs the union. No language or conditional focus is spawned, whatever its trigger.
303
+
304
+ | Focus | Runs | Pattern Skill | DIFF_FILE |
305
+ |-------|------|---------------|-----------|
306
+ | security | ✓ | devflow:security | diff.patch |
307
+ | architecture | ✓ | devflow:architecture | diff.patch |
308
+ | performance | ✓ | devflow:performance | diff.patch |
309
+ | complexity | ✓ | devflow:complexity | diff.patch |
310
+ | consistency | ✓ | devflow:consistency | diff.patch |
311
+ | regression | ✓ | devflow:regression | diff.patch |
312
+ | testing | ✓ | devflow:testing | diff.patch |
313
+ | reliability | ✓ | devflow:reliability | diff.patch |
314
+ | typescript | stamp-gated | devflow:typescript | diff-typescript.patch |
315
+ | react | stamp-gated | devflow:react | diff-react.patch |
316
+ | accessibility | stamp-gated | devflow:accessibility | diff-accessibility.patch |
317
+ | ui-design | stamp-gated | devflow:ui-design | diff-ui-design.patch |
318
+ | go | stamp-gated | devflow:go | diff-go.patch |
319
+ | java | stamp-gated | devflow:java | diff-java.patch |
320
+ | python | stamp-gated | devflow:python | diff-python.patch |
321
+ | rust | stamp-gated | devflow:rust | diff-rust.patch |
322
+ | database | conditional | devflow:database | diff.patch |
323
+ | dependencies | conditional | devflow:dependencies | diff.patch |
324
+ | documentation | conditional | devflow:documentation | diff.patch |
325
+ | compliance | diff-driven | devflow:compliance | diff.patch |
326
+
327
+ Review agent count: `code` runs 8 core, +1-12 added by Phase 1 (max 20 total per worktree); a reduced class or a mix runs 2-6.
240
328
 
241
329
  Each Review agent invocation (all in one message, **NOT background**):
242
330
  ```
@@ -245,14 +333,19 @@ Agent(subagent_type="Review", run_in_background=false):
245
333
  Follow 6-step process from devflow:review-methodology.
246
334
  PR: #{pr_number}, Base: {base_branch}
247
335
  WORKTREE_PATH: {worktree_path} (omit if cwd)
248
- DIFF_COMMAND: git -C {WORKTREE_PATH} diff {DIFF_RANGE} (omit -C flag if no WORKTREE_PATH)
336
+ DIFF_FILE: {diff_file} (absolute: {REVIEW_DIR}/diff.patch, or {REVIEW_DIR}/diff-{focus}.patch for a language focus, per the table)
337
+ DIFF_RANGE: {DIFF_RANGE} (information only)
338
+ <!-- learning:on -->
249
339
  DECISIONS_CONTEXT: {decisions_context}
340
+ <!-- learning:end -->
250
341
  FEATURE_KNOWLEDGE: {feature_knowledge}
251
342
  PR_DESCRIPTION: <pr-description>{pr_description}</pr-description>
252
343
  PRIOR_RESOLUTIONS: <prior-resolution-summary>{prior_resolutions}</prior-resolution-summary>
253
344
  COMPLIANCE_FRAMEWORKS: {COMPLIANCE_FRAMEWORKS} (compliance focus only)
254
345
  If PRIOR_RESOLUTIONS is not (none), follow Cross-Cycle Awareness in review.md.
346
+ <!-- learning:on -->
255
347
  Follow devflow:apply-decisions to scan the index and Read full ADR/PF bodies on demand.
348
+ <!-- learning:end -->
256
349
  Follow devflow:apply-feature-knowledge for FEATURE_KNOWLEDGE — feature-specific patterns and anti-patterns inform findings.
257
350
  IMPORTANT: Write report to {worktree_path}/.devflow/docs/reviews/{branch-slug}/{timestamp}/{focus}.md using Write tool"
258
351
  ```
@@ -325,13 +418,15 @@ In multi-worktree mode, report results per worktree.
325
418
  ├─ Per worktree (SEQUENTIAL — one worktree at a time):
326
419
  │ │
327
420
  │ ├─ Phase 1: Analyze changed files
328
- │ │ └─ Detect file types for conditional reviews
421
+ │ │ ├─ Classify the diff (paths.txt → DIFF_CLASS)
422
+ │ │ ├─ Choose the focuses (code class: file types + the language stamp)
423
+ │ │ └─ Write diff.patch and diff-{focus}.patch, by redirect
329
424
  │ │
330
425
  │ ├─ Phase 2: Reviews (PARALLEL within worktree)
331
- │ │ ├─ Review agent: security
332
- │ │ ├─ Review agent: architecture, performance, complexity
333
- │ │ ├─ Review agent: consistency, regression, testing
334
- │ │ └─ Review agent: [conditional]
426
+ │ │ ├─ code: Review agents security, architecture, performance, complexity,
427
+ │ │ │ consistency, regression, testing, reliability (diff.patch)
428
+ │ │ ├─ code: + language (diff-{focus}.patch) and conditional Review agents
429
+ │ │ └─ docs-only / tests-only / lockfile-only: the reduced set (diff.patch)
335
430
  │ │
336
431
  │ ├─ Phase 3: Synthesis → Review Comment (SEQUENTIAL within worktree)
337
432
  │ │ ├─ Step 3a: Synthesize agent (mode: review, writes review-summary.md)
@@ -360,6 +455,14 @@ In multi-worktree mode, report results per worktree.
360
455
  | `--full` flag | Bypass incremental detection (Step 0d), still load PRIOR_RESOLUTIONS for cross-cycle awareness |
361
456
  | Parsing failure on resolution-summary.md | fp_ratio = 0, convergence tracking degraded (see Step 0e-ii) |
362
457
  | Concurrent sessions | Advisory only, each session computes independently |
458
+ | Docs-only diff | `docs-only`: documentation, consistency, security on `diff.patch`; no language or conditional focus |
459
+ | Tests-only diff | `tests-only`: testing, reliability, consistency, security on `diff.patch`; no language or conditional focus |
460
+ | Lockfile-only diff | `lockfile-only`: dependencies, security on `diff.patch` |
461
+ | Mixed non-code diff (docs with tests, tests with a lockfile) | The union of the matching sets, on `diff.patch` |
462
+ | A path matching no class pattern, or an empty path list | `code` (fail-safe): the 8 core focuses on the full diff |
463
+ | A file moved across classes | `--no-renames` lists the old and the new path, so a code path makes the diff `code` |
464
+ | Path listing above about 40 lines | The count is printed; `paths.txt` is read in ranges of about 40 lines |
465
+ | Language files changed, plugin not installed | The focus is absent from the stamped line: not spawned |
363
466
  | Public repo (`auto` mode) | Git agent probes visibility, posts counts-only STUB comment; full report stays local |
364
467
  | `reviewPublication: off` | Git agent skips posting the review comment (OFF) — except that, only when `EVIDENCE_POLICY` is `required`, Step 0f passes `stub` and a counts-only STUB comment posts |
365
468
 
@@ -370,9 +473,9 @@ In multi-worktree mode, report results per worktree.
370
473
 
371
474
  ## Principles
372
475
 
373
- 1. **Orchestration only** - Command spawns agents, doesn't do git/review work itself
476
+ 1. **Orchestration only** - Command spawns agents, doesn't do git/review work itself. The exceptions are the read-only Phase 0 probes (`git worktree list`, `git -C ... branch --show-current`, `git -C ... cat-file -t`), the bounded Phase 1 path listing (a redirect into `paths.txt`, a `wc -l` count and ranged reads) and the redirect-only patch writes (`diff.patch`, `diff-{focus}.patch`). Redirect-only writes print nothing, so no diff content reaches this thread
374
477
  2. **Parallel, not background** - Multiple agents in one message, but `run_in_background=false` so phases complete before proceeding
375
- 3. **Git agent for git work** - All git operations go through Git agent
478
+ 3. **Git agent for git work** - All git operations go through Git agent, except the exceptions named in Principle 1; redirect-only writes print nothing
376
479
  4. **Clear ownership** - Each agent owns its output completely
377
480
  5. **Honest reporting** - Display agent outputs directly
378
481
  6. **Incremental by default** - Only review new changes unless `--full` specified
@@ -5,6 +5,7 @@ output-dir: dist/commands
5
5
  @import { knowledge_writeback } from "./_partials/_knowledge.mds"
6
6
  @import { decisions_load } from "./_partials/_decisions.mds"
7
7
  @import { issue_ref_grammar, issue_capture_contract } from "./_partials/_tracker.mds"
8
+ @import "./_partials/_settings.mds" as settings
8
9
  # Debug Command
9
10
 
10
11
  Investigate bugs by spawning parallel agents, each pursuing a different hypothesis. Evidence is aggregated and synthesized to identify the root cause.
@@ -32,20 +33,31 @@ $ARGUMENTS
32
33
 
33
34
  ## Phases
34
35
 
36
+ <!-- learning:on -->
35
37
  ### Phase 1: Load Decisions Index (Orchestrator-Local)
38
+ <!-- learning:off -->
39
+ ### Phase 1: Resolve Settings
40
+ <!-- learning:end -->
36
41
 
42
+ <!-- learning:on -->
37
43
  **Produces:** DECISIONS_CONTEXT
38
44
 
39
- {{decisions_load()}}
45
+ <!-- learning:end -->
46
+ {{settings.settings_resolve()}}
40
47
 
48
+ {{decisions_load()}}
49
+ <!-- learning:on -->
41
50
  The orchestrator uses `DECISIONS_CONTEXT` locally when generating hypotheses (Phase 2) — prior pitfalls and decisions can suggest specific root causes to investigate. Follow `devflow:apply-decisions` to Read full entry bodies on demand. **Do NOT pass `DECISIONS_CONTEXT` to Explore investigators** — decisions context stays in the orchestrator; investigators examine code directly.
42
51
 
52
+ <!-- learning:end -->
43
53
  **No up-front feature knowledge load** — debug investigation workers read code directly to avoid confirmation bias. Feature knowledge is only written back at the end if the investigation surfaced durable, cross-cutting knowledge.
44
54
 
45
55
  ### Phase 2: Context Gathering
46
56
 
47
57
  **Produces:** HYPOTHESES, BUG_CONTEXT
58
+ <!-- learning:on -->
48
59
  **Requires:** DECISIONS_CONTEXT
60
+ <!-- learning:end -->
49
61
 
50
62
  If `COMMAND_INPUT` opens with a candidate issue reference, fetch the issue:
51
63
 
@@ -193,7 +205,11 @@ Ask user via AskUserQuestion: "Want me to implement this fix?"
193
205
  ```
194
206
  /debug (orchestrator)
195
207
  │
208
+ <!-- learning:on -->
196
209
  ├─ Phase 1: Load Decisions Index (Orchestrator-Local)
210
+ <!-- learning:off -->
211
+ ├─ Phase 1: Resolve Settings
212
+ <!-- learning:end -->
197
213
  │ └─ No up-front feature knowledge load (avoids confirmation bias in investigators)
198
214
  │
199
215
  ├─ Phase 2: Context gathering