devflow-kit 3.11.0 → 3.12.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 (204) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/dist/agents/architect.md +87 -0
  3. package/dist/agents/code.md +21 -25
  4. package/dist/agents/debug.md +21 -49
  5. package/dist/agents/design.md +9 -43
  6. package/dist/agents/fix.md +15 -29
  7. package/dist/agents/git.md +19 -22
  8. package/dist/agents/harden.md +14 -19
  9. package/dist/agents/knowledge.md +11 -19
  10. package/dist/agents/refactor.md +9 -14
  11. package/dist/agents/research.md +11 -34
  12. package/dist/agents/review.md +22 -52
  13. package/dist/agents/skim.md +7 -17
  14. package/dist/agents/triage.md +7 -14
  15. package/dist/commands/bug-analysis.md +31 -62
  16. package/dist/commands/code-review.md +38 -87
  17. package/dist/commands/debug.md +32 -82
  18. package/dist/commands/dynamic-build.md +155 -211
  19. package/dist/commands/dynamic-plan.md +71 -93
  20. package/dist/commands/dynamic-profile.md +7 -155
  21. package/dist/commands/dynamic-tickets.md +65 -186
  22. package/dist/commands/explore.md +27 -70
  23. package/dist/commands/implement.md +98 -186
  24. package/dist/commands/plan.md +60 -107
  25. package/dist/commands/release.md +25 -91
  26. package/dist/commands/research.md +34 -103
  27. package/dist/commands/resolve.md +64 -128
  28. package/dist/commands/self-review.md +35 -99
  29. package/dist/compliance-off/agents/git.md +15 -18
  30. package/dist/compliance-off/agents/triage.md +7 -14
  31. package/dist/compliance-off/commands/bug-analysis.md +31 -62
  32. package/dist/compliance-off/commands/code-review.md +34 -82
  33. package/dist/compliance-off/commands/dynamic-build.md +149 -205
  34. package/dist/compliance-off/commands/dynamic-tickets.md +65 -186
  35. package/dist/compliance-off/commands/implement.md +94 -180
  36. package/dist/compliance-off/commands/plan.md +60 -107
  37. package/dist/compliance-off/commands/release.md +25 -90
  38. package/dist/compliance-off/commands/resolve.md +54 -128
  39. package/dist/compliance-off/skills/git/references/tracker/github/ensure-pr-ready.md +3 -3
  40. package/dist/compliance-off/skills/git/references/tracker/jira/ensure-pr-ready.md +3 -3
  41. package/dist/compliance-off/skills/git/references/tracker/linear/ensure-pr-ready.md +3 -3
  42. package/dist/core/plugins.js +3 -3
  43. package/dist/curation-compliance-off/agents/triage.md +7 -13
  44. package/dist/curation-compliance-off/commands/bug-analysis.md +21 -41
  45. package/dist/curation-compliance-off/commands/code-review.md +25 -62
  46. package/dist/curation-compliance-off/commands/dynamic-build.md +142 -194
  47. package/dist/curation-compliance-off/commands/dynamic-tickets.md +54 -173
  48. package/dist/curation-compliance-off/commands/implement.md +86 -161
  49. package/dist/curation-compliance-off/commands/plan.md +51 -86
  50. package/dist/curation-compliance-off/commands/release.md +17 -78
  51. package/dist/curation-compliance-off/commands/resolve.md +45 -108
  52. package/dist/curation-off/agents/architect.md +81 -0
  53. package/dist/curation-off/agents/code.md +20 -23
  54. package/dist/curation-off/agents/debug.md +19 -47
  55. package/dist/curation-off/agents/design.md +8 -41
  56. package/dist/curation-off/agents/fix.md +14 -27
  57. package/dist/curation-off/agents/harden.md +13 -18
  58. package/dist/curation-off/agents/knowledge.md +9 -17
  59. package/dist/curation-off/agents/refactor.md +8 -12
  60. package/dist/curation-off/agents/research.md +9 -32
  61. package/dist/curation-off/agents/review.md +11 -40
  62. package/dist/curation-off/agents/skim.md +7 -17
  63. package/dist/curation-off/agents/triage.md +7 -13
  64. package/dist/curation-off/commands/bug-analysis.md +21 -41
  65. package/dist/curation-off/commands/code-review.md +29 -67
  66. package/dist/curation-off/commands/debug.md +24 -63
  67. package/dist/curation-off/commands/dynamic-build.md +148 -200
  68. package/dist/curation-off/commands/dynamic-plan.md +60 -80
  69. package/dist/curation-off/commands/dynamic-tickets.md +54 -173
  70. package/dist/curation-off/commands/explore.md +18 -50
  71. package/dist/curation-off/commands/implement.md +90 -167
  72. package/dist/curation-off/commands/plan.md +51 -86
  73. package/dist/curation-off/commands/release.md +17 -79
  74. package/dist/curation-off/commands/research.md +23 -81
  75. package/dist/curation-off/commands/resolve.md +55 -108
  76. package/dist/curation-off/commands/self-review.md +26 -78
  77. package/dist/skills/git/references/pr/update-pr-evidence.md +2 -1
  78. package/dist/skills/git/references/tracker/github/ensure-pr-ready.md +3 -3
  79. package/dist/skills/git/references/tracker/jira/ensure-pr-ready.md +3 -3
  80. package/dist/skills/git/references/tracker/linear/ensure-pr-ready.md +3 -3
  81. package/dist/targets/claude-code/curation-install.js +2 -2
  82. package/dist/variant-axes.json +5 -1
  83. package/package.json +1 -1
  84. package/src/assets/agents/_partials/_code.mds +3 -5
  85. package/src/assets/agents/_partials/_design.mds +86 -0
  86. package/src/assets/agents/architect.mds +41 -0
  87. package/src/assets/agents/code.mds +18 -20
  88. package/src/assets/agents/curate.md +26 -35
  89. package/src/assets/agents/debug.mds +21 -49
  90. package/src/assets/agents/design.mds +11 -114
  91. package/src/assets/agents/evaluate.md +6 -16
  92. package/src/assets/agents/explore.md +1 -2
  93. package/src/assets/agents/fix.mds +12 -24
  94. package/src/assets/agents/git.mds +20 -23
  95. package/src/assets/agents/harden.mds +14 -19
  96. package/src/assets/agents/knowledge.mds +10 -38
  97. package/src/assets/agents/polish.md +13 -39
  98. package/src/assets/agents/refactor.mds +6 -9
  99. package/src/assets/agents/research.mds +11 -34
  100. package/src/assets/agents/review.mds +12 -84
  101. package/src/assets/agents/skim.mds +7 -17
  102. package/src/assets/agents/synthesize.md +3 -21
  103. package/src/assets/agents/test.md +31 -32
  104. package/src/assets/agents/tracker.md +116 -229
  105. package/src/assets/agents/triage.mds +7 -26
  106. package/src/assets/agents/validate.md +1 -3
  107. package/src/assets/commands/_partials/_compliance.mds +2 -2
  108. package/src/assets/commands/_partials/_decisions.mds +17 -24
  109. package/src/assets/commands/_partials/_docs_root.mds +31 -10
  110. package/src/assets/commands/_partials/_engine.mds +34 -56
  111. package/src/assets/commands/_partials/_evidence_policy.mds +1 -1
  112. package/src/assets/commands/_partials/_factory.mds +10 -104
  113. package/src/assets/commands/_partials/_knowledge.mds +47 -51
  114. package/src/assets/commands/_partials/_plan_contract.mds +2 -2
  115. package/src/assets/commands/_partials/_preamble.mds +21 -21
  116. package/src/assets/commands/_partials/_publication.mds +3 -3
  117. package/src/assets/commands/_partials/_roster.mds +12 -13
  118. package/src/assets/commands/_partials/_settings.mds +6 -3
  119. package/src/assets/commands/_partials/_ticket_template.mds +3 -7
  120. package/src/assets/commands/_partials/_tracker.mds +10 -5
  121. package/src/assets/commands/_partials/_wave.mds +23 -32
  122. package/src/assets/commands/bug-analysis.mds +3 -7
  123. package/src/assets/commands/code-review.mds +12 -33
  124. package/src/assets/commands/debug.mds +5 -47
  125. package/src/assets/commands/dynamic-build.mds +48 -70
  126. package/src/assets/commands/dynamic-plan.mds +23 -42
  127. package/src/assets/commands/dynamic-profile.mds +7 -57
  128. package/src/assets/commands/dynamic-tickets.mds +9 -29
  129. package/src/assets/commands/explore.mds +5 -44
  130. package/src/assets/commands/implement.mds +75 -117
  131. package/src/assets/commands/plan.mds +27 -57
  132. package/src/assets/commands/release.mds +4 -62
  133. package/src/assets/commands/research.mds +7 -53
  134. package/src/assets/commands/resolve.mds +40 -87
  135. package/src/assets/commands/self-review.mds +5 -45
  136. package/src/assets/mds/git/_ops_pr.mds +1 -0
  137. package/src/assets/mds/git/_ops_steps.mds +4 -4
  138. package/src/assets/mds/git/_pr.mds +1 -1
  139. package/src/assets/rules/engineering.md +1 -1
  140. package/src/assets/rules/quality.md +2 -2
  141. package/src/assets/scripts/ci-wait.cjs +150 -18
  142. package/src/assets/scripts/hooks/assets/orchestrator-charter.md +3 -3
  143. package/src/assets/scripts/hooks/preamble +2 -3
  144. package/src/assets/scripts/pr-evidence.cjs +1 -0
  145. package/src/assets/scripts/resolve-evidence-policy.cjs +14 -13
  146. package/src/assets/scripts/resolve-root.cjs +186 -0
  147. package/src/assets/scripts/resolve-settings.cjs +14 -9
  148. package/src/assets/scripts/verify-evidence.cjs +355 -22
  149. package/src/assets/skills/accessibility/SKILL.md +28 -95
  150. package/src/assets/skills/agent-references/SKILL.md +2 -4
  151. package/src/assets/skills/agent-references/references/commands/implement-evidence-asks.md +1 -1
  152. package/src/assets/skills/agent-references/references/commands/implement-levels.md +4 -7
  153. package/src/assets/skills/agent-references/references/commands/implement-revalidate.md +1 -1
  154. package/src/assets/skills/agent-references/references/commands/plan-levels.md +2 -2
  155. package/src/assets/skills/apply-decisions/SKILL.md +5 -6
  156. package/src/assets/skills/apply-feature-knowledge/SKILL.md +3 -13
  157. package/src/assets/skills/architecture/SKILL.md +29 -105
  158. package/src/assets/skills/boundary-validation/SKILL.md +27 -78
  159. package/src/assets/skills/complexity/SKILL.md +8 -104
  160. package/src/assets/skills/compliance/SKILL.md +9 -67
  161. package/src/assets/skills/consistency/SKILL.md +7 -107
  162. package/src/assets/skills/database/SKILL.md +7 -72
  163. package/src/assets/skills/dependencies/SKILL.md +9 -109
  164. package/src/assets/skills/dependencies/references/detection.md +10 -0
  165. package/src/assets/skills/dependency-research/SKILL.md +9 -63
  166. package/src/assets/skills/design-review/SKILL.md +1 -35
  167. package/src/assets/skills/docs-framework/SKILL.md +4 -47
  168. package/src/assets/skills/documentation/SKILL.md +7 -71
  169. package/src/assets/skills/documentation/references/patterns.md +1 -1
  170. package/src/assets/skills/documentation/references/violations.md +1 -1
  171. package/src/assets/skills/feature-knowledge/SKILL.md +19 -222
  172. package/src/assets/skills/feature-knowledge/references/new-kb.md +128 -0
  173. package/src/assets/skills/gap-analysis/SKILL.md +1 -31
  174. package/src/assets/skills/git/SKILL.md +2 -22
  175. package/src/assets/skills/go/SKILL.md +24 -113
  176. package/src/assets/skills/java/SKILL.md +12 -98
  177. package/src/assets/skills/patterns/SKILL.md +8 -93
  178. package/src/assets/skills/performance/SKILL.md +29 -88
  179. package/src/assets/skills/python/SKILL.md +22 -120
  180. package/src/assets/skills/qa/SKILL.md +16 -54
  181. package/src/assets/skills/qa/references/browser-testing.md +0 -24
  182. package/src/assets/skills/qa/references/sources.md +2 -2
  183. package/src/assets/skills/quality-gates/SKILL.md +13 -100
  184. package/src/assets/skills/react/SKILL.md +33 -95
  185. package/src/assets/skills/regression/SKILL.md +8 -73
  186. package/src/assets/skills/reliability/SKILL.md +11 -120
  187. package/src/assets/skills/research-codebase/SKILL.md +7 -49
  188. package/src/assets/skills/research-competitor/SKILL.md +4 -39
  189. package/src/assets/skills/research-external/SKILL.md +5 -43
  190. package/src/assets/skills/research-market/SKILL.md +5 -43
  191. package/src/assets/skills/research-technology/SKILL.md +8 -68
  192. package/src/assets/skills/review-methodology/SKILL.md +10 -56
  193. package/src/assets/skills/rust/SKILL.md +19 -109
  194. package/src/assets/skills/security/SKILL.md +39 -66
  195. package/src/assets/skills/software-design/SKILL.md +20 -105
  196. package/src/assets/skills/software-design/references/patterns.md +84 -2
  197. package/src/assets/skills/software-design/references/violations.md +1 -1
  198. package/src/assets/skills/test-driven-development/SKILL.md +32 -107
  199. package/src/assets/skills/test-driven-development/references/rationalization-prevention.md +33 -1
  200. package/src/assets/skills/testing/SKILL.md +35 -53
  201. package/src/assets/skills/typescript/SKILL.md +23 -102
  202. package/src/assets/skills/ui-design/SKILL.md +26 -74
  203. package/src/assets/skills/worktree-support/SKILL.md +4 -10
  204. package/dist/curation-off/commands/dynamic-profile.md +0 -214
@@ -1,10 +1,8 @@
1
1
  ---
2
- description: Research a topic using parallel multi-type Research agents with trust-aware synthesis
2
+ description: Research a topic with parallel multi-type Research agents and trust-aware synthesis
3
3
  ---
4
4
  # Research Command
5
5
 
6
- Research a topic by spawning parallel Research agents across multiple research types (codebase, external, market, competitor, technology). Findings are trust-annotated and synthesized into structured output.
7
-
8
6
  ## Usage
9
7
 
10
8
  ```
@@ -22,10 +20,7 @@ What follows `/research` is bound once, here. Every later step names it `COMMAND
22
20
  $ARGUMENTS
23
21
  </command-input>
24
22
 
25
- `COMMAND_INPUT` is one of:
26
- - Research question: "best caching strategies"
27
- - Comparison question: "compare React vs Svelte for our use case"
28
- - Empty: use conversation context
23
+ An empty `COMMAND_INPUT` means: use the conversation context.
29
24
 
30
25
  ## Phases
31
26
 
@@ -33,55 +28,41 @@ $ARGUMENTS
33
28
 
34
29
  **Produces:** FEATURE_KNOWLEDGE, FEATURE_KNOWLEDGE_RULES
35
30
 
36
- **Docs root (D-DOCS-ROOT).** Every `.devflow/docs/` path this command reads or writes lives at the checkout's toplevel, never under the directory the session started in. Resolve `{worktree}` from the start directory — `WORKTREE_PATH` if provided, otherwise cwd (`devflow:worktree-support`) — by running
31
+ **Docs root (D-DOCS-ROOT).** Every `.devflow/docs/` path is `{worktree}/.devflow/docs/…`. A repo-relative docs path handed to an agent travels with a `WORKTREE_PATH` naming its checkout.
32
+
33
+ Once per start directory (`WORKTREE_PATH` if provided, otherwise cwd), run from it:
37
34
 
38
35
  ```bash
39
- git -C "{start}" rev-parse --show-toplevel
36
+ node "$HOME/.devflow/scripts/resolve-root.cjs" "{start}"; echo "exit=$?"
40
37
  ```
41
38
 
42
- and using its one-line output. If the command fails (outside a git repository), `{worktree}` is the start directory itself. Every docs path below is written `{worktree}/.devflow/docs/…`; a repo-relative docs path handed to an agent always travels with a `WORKTREE_PATH` naming the checkout it is relative to.
39
+ Accept only the three lines `WORKTREE=<absolute path>`, `LEDGER=<absolute path>` and `exit=0`, which set `{worktree}` and `{ledger}`. Otherwise both are the start directory.
43
40
 
44
41
  ### Load Feature Knowledge
45
42
 
46
- Resolve `{worktree}` as the checkout's toplevel, because feature knowledge bases are committed with the branch (D-PROMPT-ROOT): from the start directory — `WORKTREE_PATH` if provided, otherwise cwd (`devflow:worktree-support`) — run
43
+ Once per start directory (`WORKTREE_PATH` if provided, otherwise cwd), run from it:
47
44
 
48
45
  ```bash
49
- git -C "{start}" rev-parse --show-toplevel
50
- ```
51
-
52
- and use its one-line output. If the command fails (outside a git repository), `{worktree}` is the start directory itself. All paths below are relative to `{worktree}`.
53
-
54
- **Step 1 — Read the index cache:**
55
-
56
- Attempt to read `{worktree}/.devflow/features/index.md`. Each line follows the format:
57
-
58
- ```
59
- - **{slug}** — {areas} — {Use-when description}
46
+ node "$HOME/.devflow/scripts/resolve-root.cjs" "{start}"; echo "exit=$?"
60
47
  ```
61
48
 
62
- If `index.md` exists and contains at least one entry line, use it for relevance matching.
63
-
64
- **Step 2 — Fallback: glob frontmatter (if `index.md` is absent or empty):**
65
-
66
- Glob `{worktree}/.devflow/features/*/KNOWLEDGE.md`. For each file found, read only its YAML frontmatter block (between the opening and closing `---` delimiters).
49
+ Accept only the three lines `WORKTREE=<absolute path>`, `LEDGER=<absolute path>` and `exit=0`, which set `{worktree}` and `{ledger}`. Otherwise both are the start directory.
67
50
 
68
- **Step 3 — Pick relevant KBs:**
51
+ All paths below are relative to `{worktree}`.
69
52
 
70
- Match the current task area and description against each index line (or frontmatter `description` + `directories` on fallback). Select entries whose documented area overlaps the current task. This is a relevance judgment — prefer specificity over breadth.
53
+ **Step 1 — Read the index cache** `{worktree}/.devflow/features/index.md`. Each line has the form `- **{slug}** — {areas} — {Use-when description}`. If `index.md` is absent or has no entry line, glob `{worktree}/.devflow/features/*/KNOWLEDGE.md` and read only the YAML frontmatter of each file, in one turn.
71
54
 
72
- **Step 4 — Read each selected KB's Rules:**
55
+ **Step 2 — Pick relevant KBs:** select the entries whose documented area overlaps the current task (index line, or frontmatter `description` and `directories` on fallback).
73
56
 
74
- For each selected entry, `{kb}` is `{worktree}/.devflow/features/{slug}/KNOWLEDGE.md`:
57
+ **Step 3 — Read each selected KB's Rules.** `{kb}` is `{worktree}/.devflow/features/{slug}/KNOWLEDGE.md`:
75
58
 
76
- 1. List its `##` headings with line numbers through Bash: `command grep -n '^## ' "{kb}"`. This only locates sections; the text of a KB comes from the Read view alone.
77
- 2. Read the `## Rules` range (its line to the next heading) with the Read tool, using `offset` and `limit`, and choose the one to three bullets most relevant to the current task. The choice is yours, made per KB.
59
+ 1. List the `##` headings with line numbers of all selected KBs in one Bash call: `command grep -n '^## ' "{kb}" …`. With two or more paths, each line starts with its `{kb}:` path. This only locates sections; the text of a KB comes from the Read view alone.
60
+ 2. Read the `## Rules` range (its line to the next heading) with the Read tool, using `offset` and `limit`, all selected KBs in one turn, and choose the one to three bullets most relevant to the task.
78
61
  3. If the KB has no `## Rules` section, choose one to three entries from its `## Anti-Patterns` or `## Gotchas` range the same way, and label them by that section's name instead of an ID.
79
62
 
80
- When a KB contradicts the code you observe, **trust the code** — the code is the freshness mechanism; the KB may lag behind. A missing Rules section, a missing heading list and `(none)` are legitimate states, not errors.
63
+ When a KB contradicts the code you observe, **trust the code**.
81
64
 
82
- **Step 5 — Set FEATURE_KNOWLEDGE and FEATURE_KNOWLEDGE_RULES:**
83
-
84
- Write one block per selected KB. Paste each bullet verbatim from the Read view, never from a shell view. The path is relative to the checkout root; an agent resolves it under `WORKTREE_PATH` when one is provided.
65
+ **Step 4 — Set FEATURE_KNOWLEDGE and FEATURE_KNOWLEDGE_RULES.** Write one block per selected KB. Paste each bullet verbatim from the Read view, never from a shell view. The path is relative to the checkout root; an agent resolves it under `WORKTREE_PATH` when one is provided.
85
66
 
86
67
  ```
87
68
  --- Feature knowledge: {slug} ---
@@ -92,11 +73,9 @@ Rules:
92
73
  Headings: L5 Rules · L40 Overview · L62 Anti-Patterns · L118 Key Files
93
74
  ```
94
75
 
95
- A KB with no Rules section labels its entries `Rules ({section name}):` and gives them no ID. `FEATURE_KNOWLEDGE` is these blocks; `FEATURE_KNOWLEDGE_RULES` is the same blocks without the `Headings:` line. Both come from this one selection, and each spawn names the variable its recipient takes. If no KBs exist, no KBs are relevant, or `.devflow/features/` is absent, set both to `(none)`.
96
-
97
- **One git call, then direct reads — no `.cjs` script.**
76
+ A KB with no Rules section labels its entries `Rules ({section name}):` and gives them no ID. `FEATURE_KNOWLEDGE` is these blocks; `FEATURE_KNOWLEDGE_RULES` is the same blocks without the `Headings:` line. Each spawn names the variable its recipient takes. If no KBs exist, no KBs are relevant, or `.devflow/features/` is absent, set both to `(none)`.
98
77
 
99
- Use `FEATURE_KNOWLEDGE` **locally** for research framing. Pass to each Research agent in Phase 4.
78
+ Use `FEATURE_KNOWLEDGE` locally for research framing. Pass to each Research agent in Phase 4.
100
79
 
101
80
  ### Phase 2: Requirements
102
81
 
@@ -136,8 +115,6 @@ Each Research agent receives:
136
115
  - `ORIENT_OUTPUT`: Only for `codebase` type
137
116
  - `WORKTREE_PATH`: If in a worktree context
138
117
 
139
- Each Research agent writes findings to disk at OUTPUT_PATH.
140
-
141
118
  ### Phase 5: Synthesize
142
119
 
143
120
  **Produces:** RESEARCH_SUMMARY
@@ -160,6 +137,7 @@ Output: {worktree}/.devflow/docs/research/{topic-slug}/{YYYY-MM-DD_HHMM}/researc
160
137
  **Requires:** RESEARCH_SUMMARY
161
138
 
162
139
  Present findings to user with:
140
+ - The research folder `{worktree}/.devflow/docs/research/{topic-slug}/{YYYY-MM-DD_HHMM}/`
163
141
  - Trust annotations per finding: (trusted) for codebase, (untrusted) for web, (mixed) for technology
164
142
  - Explicit conflicts between codebase and web findings
165
143
  - Drill-down offer via AskUserQuestion
@@ -181,49 +159,13 @@ If external research was skipped due to tool unavailability: inform user.
181
159
 
182
160
  ## Worktree Support
183
161
 
184
- If the orchestrator receives a `WORKTREE_PATH` context (e.g., from multi-worktree workflows), pass it through to all spawned agents. Each agent's "Worktree Support" section handles path resolution.
185
-
186
- ## Output
187
-
188
- Research findings saved to `{worktree}/.devflow/docs/research/{topic-slug}/{YYYY-MM-DD_HHMM}/`:
189
- - `{type}.md` per research type (codebase.md, external.md, etc.)
190
- - `research-summary.md` — synthesized findings with trust annotations
191
-
192
- ## Architecture
193
-
194
- ```
195
- /research (orchestrator)
196
- │
197
- ├─ Phase 1: Load Context (Orchestrator-Local)
198
- │
199
- ├─ Phase 2: Requirements
200
- │ └─ Infer 2-5 research types from question
201
- │
202
- ├─ Phase 3: Orient (conditional — codebase type only)
203
- │ └─ Skim agent (codebase overview)
204
- │
205
- ├─ Phase 4: Parallel Research agents
206
- │ └─ 2-5 Research agents in single message (all types simultaneously)
207
- │
208
- ├─ Phase 5: Synthesize
209
- │ └─ Synthesize agent merges findings with trust-aware aggregation
210
- │
211
- ├─ Phase 6: Present findings with trust annotations and drill-down offer
212
- │
213
- └─ Phase 7: Suggest feature knowledge creation (conditional)
214
- └─ Knowledge agent (if codebase type researched + user accepts)
215
- ```
162
+ If the orchestrator receives a `WORKTREE_PATH` context, pass it through to all spawned agents.
216
163
 
217
164
  ## Principles
218
165
 
219
- 1. **Parallel perspectives** — Multiple research types converge on truth better than any single perspective
220
- 2. **Trust transparency** — Every finding is labeled with its trust level (trusted/untrusted/mixed)
221
- 3. **Conflict surfacing** — Contradictions between codebase and web findings are highlighted, not hidden
222
- 4. **Evidence over opinion** — All claims require citations (file:line or URL)
166
+ 1. **Evidence over opinion** — All claims require citations (file:line or URL)
223
167
 
224
168
  ## Error Handling
225
169
 
226
- - If WebSearch/WebFetch unavailable: restrict to codebase type, inform user
227
170
  - If a Research agent fails: continue with remaining outputs, note gap in synthesis
228
171
  - If Synthesize agent fails: present individual Research agent outputs directly
229
- - If feature knowledge creation fails: log failure, report research results normally
@@ -1,9 +1,9 @@
1
1
  ---
2
- description: Process review issues - validate with Triage agent, fix with Code agent, verify with Validate agent
2
+ description: Process review issues - Triage validates, Code fixes, Validate verifies
3
3
  ---
4
4
  # Resolve Command
5
5
 
6
- Process issues from code review reports: triage every issue through the blast-radius disposition matrix, fix FIX_NOW items with Code agents, verify fixes with a Validate agent gate, and track FIX_SEPARATE/TECH_DEBT items as manage-debt tickets. Defaults to the latest timestamped review directory. Supports multi-worktree auto-discovery.
6
+ Triage every review issue through the blast-radius disposition matrix, fix FIX_NOW items with Code agents, verify with a Validate gate, and track FIX_SEPARATE/TECH_DEBT items as manage-debt tickets. Defaults to the latest review of each worktree.
7
7
 
8
8
  ## Usage
9
9
 
@@ -18,6 +18,8 @@ Process issues from code review reports: triage every issue through the blast-ra
18
18
 
19
19
  ### Phase 0: Worktree Discovery & Pre-Flight
20
20
 
21
+ **Fewest turns.** Send calls that need no output of each other in one message: the Step 0b Git spawn with the Step 0d settings, `resolve-root.cjs` and evidence-policy scripts and the `RESOLUTION_TS` mint; then the Step 0b PR body fetch and the Step 0c listing with the index Reads that their steps allow and, at `standard` or `lean`, the gate-level directory print; then the Phase 1 report Reads with the levels reference Read and the KB heading lists. Step 0d runs `resolve-root.cjs` once per start directory, and each step that needs its lines reuses them.
22
+
21
23
  #### Step 0a: Discover Worktrees
22
24
 
23
25
  **Produces:** WORKTREES
@@ -27,10 +29,8 @@ Process issues from code review reports: triage every issue through the blast-ra
27
29
  - **More than one listed:** 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. Parse the list, filter (skip protected/detached/mid-rebase), dedup by branch, sort by recent commit
28
30
  - **Exactly one listed:** load neither the skill nor the reference — that worktree is the only candidate, and Step 0b's Git agent validates its branch
29
31
  - Additional filter: must have unresolved reviews (latest review directory has no `resolution-summary.md`)
30
- 2. **If `--path` flag provided:** use only that worktree, skip discovery
31
- **`--path` validation**: Before proceeding, verify the path exists as a directory and appears in `git worktree list` output. If not: report error and stop.
32
- 3. **If only 1 resolvable worktree:** proceed as single-worktree flow
33
- 4. **If multiple resolvable worktrees:** report "Found N worktrees with unresolved reviews: {list}" and proceed with multi-worktree flow
32
+ 2. **`--path`:** use only that worktree and skip discovery. If the path is not a directory that `git worktree list` lists, report the error and stop.
33
+ 3. **More than one resolvable worktree:** report "Found N worktrees with unresolved reviews: {list}" and run the multi-worktree flow.
34
34
 
35
35
  #### Step 0b: Per-Worktree Pre-Flight (Git Agent)
36
36
 
@@ -69,7 +69,7 @@ If `pr_number` is absent or the command fails, set `PR_DESCRIPTION` to `(none)`.
69
69
  For each worktree:
70
70
 
71
71
  1. List directories in `{worktree}/.devflow/docs/reviews/{branch-slug}/`
72
- 2. **If `--review {timestamp}` provided:** use that specific directory (not supported in multi-worktree mode)
72
+ 2. **If `--review {timestamp}` provided:** use that specific directory (not supported in multi-worktree mode: use `--path` with `--review`)
73
73
  3. **Otherwise:** sort directories by name descending, scan the 10 most recent directories only. Select the first that contains `review-summary.md` (complete review)
74
74
  4. **If latest directory already has `resolution-summary.md`:** the review is resolved — check bug-analysis fallback (step 5b).
75
75
  5. **Legacy fallback:** if no timestamped subdirectories exist but flat `*.md` files do in `{worktree}/.devflow/docs/reviews/{branch-slug}/`, read them directly.
@@ -88,57 +88,41 @@ Set `TARGET_DIR` to the selected review or bug-analysis directory path, and `TAR
88
88
 
89
89
  **Produces:** FEATURE_KNOWLEDGE, FEATURE_KNOWLEDGE_RULES, EVIDENCE_POLICY, ISSUE_REQUIRED, APPLY_CONVENTIONS, REQUIRE_NON_AUTHOR_APPROVAL, REVIEW_PUBLICATION, RESOLUTION_TS, GATE_LEVEL
90
90
 
91
- **Resolve the settings line** once per worktree root, reusing a line this run already resolved for the same root. `{root}` is the worktree the values are for — the repository root in a one-worktree run:
91
+ **Resolve the settings line** once per worktree root, reusing a line this run already resolved for the same root. `{root}` is the worktree the values are for:
92
92
 
93
93
  ```bash
94
94
  node "$HOME/.devflow/scripts/resolve-settings.cjs" "{root}" 2>/dev/null; echo "exit=$?"
95
95
  ```
96
96
 
97
- Accept the output only when it is exactly two lines: `exit=0` last and, before it, one line of the form `TRACKER=<github|jira|linear> TRACKER_SOURCE=<project|personal|machine|default> TRACKER_WARN=<none|mismatch|invalid> SITE=<none|https://<host>> KEY=<none|<key>> REVIEW_PUBLICATION=<off|auto|full> COMPLIANCE=<off|generic|<id>[,<id>…]> MEMORY=<on|off> CURATION=<on|off> KNOWLEDGE=<on|off> GATE_LEVEL=<full|standard|lean>` — these fields, in this order, nothing else, where `<host>` is a lowercase dotted host name alone, `<key>` is 2–10 of `A-Z`, `0-9` and `_` starting with a letter, and each `<id>` is one of `gdpr`, `hipaa`, `pci-dss`, `soc2`, `iso-27001`, `sox`. **Anything else** (a non-zero exit, no line, extra text, or a missing, reordered or unlisted field or value) ⇒ use `TRACKER=github TRACKER_SOURCE=default TRACKER_WARN=invalid SITE=none KEY=none REVIEW_PUBLICATION=off COMPLIANCE=generic MEMORY=off CURATION=off KNOWLEDGE=off GATE_LEVEL=full` instead.
97
+ Accept the output only when it is exactly two lines: `exit=0` last and, before it, one line of the form `TRACKER=<github|jira|linear> TRACKER_SOURCE=<project|personal|machine|default> TRACKER_WARN=<none|mismatch|invalid> SITE=<none|https://<host>> KEY=<none|<key>> REVIEW_PUBLICATION=<off|auto|full> COMPLIANCE=<off|generic|<id>[,<id>…]> MEMORY=<on|off> CURATION=<on|off> KNOWLEDGE=<on|off> GATE_LEVEL=<full|standard|lean>` — these fields, in this order, nothing else, where `<host>` is a lowercase dotted host name alone, `<key>` is 2–10 of `A-Z`, `0-9` and `_` starting with a letter, and each `<id>` is one of `gdpr`, `hipaa`, `pci-dss`, `soc2`, `iso-27001`, `sox`. **Anything else** (including a script that cannot run) ⇒ use `TRACKER=github TRACKER_SOURCE=default TRACKER_WARN=invalid SITE=none KEY=none REVIEW_PUBLICATION=off COMPLIANCE=generic MEMORY=off CURATION=off KNOWLEDGE=off GATE_LEVEL=full` instead.
98
98
 
99
99
  The accepted line is the only source of these values.
100
100
 
101
101
  ### Load Feature Knowledge
102
102
 
103
- Resolve `{worktree}` as the checkout's toplevel, because feature knowledge bases are committed with the branch (D-PROMPT-ROOT): from the start directory — `WORKTREE_PATH` if provided, otherwise cwd (`devflow:worktree-support`) — run
103
+ Once per start directory (`WORKTREE_PATH` if provided, otherwise cwd), run from it:
104
104
 
105
105
  ```bash
106
- git -C "{start}" rev-parse --show-toplevel
106
+ node "$HOME/.devflow/scripts/resolve-root.cjs" "{start}"; echo "exit=$?"
107
107
  ```
108
108
 
109
- and use its one-line output. If the command fails (outside a git repository), `{worktree}` is the start directory itself. All paths below are relative to `{worktree}`.
110
-
111
- **Step 1 — Read the index cache:**
112
-
113
- Attempt to read `{worktree}/.devflow/features/index.md`. Each line follows the format:
114
-
115
- ```
116
- - **{slug}** — {areas} — {Use-when description}
117
- ```
109
+ Accept only the three lines `WORKTREE=<absolute path>`, `LEDGER=<absolute path>` and `exit=0`, which set `{worktree}` and `{ledger}`. Otherwise both are the start directory.
118
110
 
119
- If `index.md` exists and contains at least one entry line, use it for relevance matching.
111
+ All paths below are relative to `{worktree}`.
120
112
 
121
- **Step 2 — Fallback: glob frontmatter (if `index.md` is absent or empty):**
113
+ **Step 1 — Read the index cache** `{worktree}/.devflow/features/index.md`. Each line has the form `- **{slug}** — {areas} — {Use-when description}`. If `index.md` is absent or has no entry line, glob `{worktree}/.devflow/features/*/KNOWLEDGE.md` and read only the YAML frontmatter of each file, in one turn.
122
114
 
123
- Glob `{worktree}/.devflow/features/*/KNOWLEDGE.md`. For each file found, read only its YAML frontmatter block (between the opening and closing `---` delimiters).
115
+ **Step 2 — Pick relevant KBs:** select the entries whose documented area overlaps the current task (index line, or frontmatter `description` and `directories` on fallback).
124
116
 
125
- **Step 3 — Pick relevant KBs:**
117
+ **Step 3 — Read each selected KB's Rules.** `{kb}` is `{worktree}/.devflow/features/{slug}/KNOWLEDGE.md`:
126
118
 
127
- Match the current task area and description against each index line (or frontmatter `description` + `directories` on fallback). Select entries whose documented area overlaps the current task. This is a relevance judgment — prefer specificity over breadth.
128
-
129
- **Step 4 — Read each selected KB's Rules:**
130
-
131
- For each selected entry, `{kb}` is `{worktree}/.devflow/features/{slug}/KNOWLEDGE.md`:
132
-
133
- 1. List its `##` headings with line numbers through Bash: `command grep -n '^## ' "{kb}"`. This only locates sections; the text of a KB comes from the Read view alone.
134
- 2. Read the `## Rules` range (its line to the next heading) with the Read tool, using `offset` and `limit`, and choose the one to three bullets most relevant to the current task. The choice is yours, made per KB.
119
+ 1. List the `##` headings with line numbers of all selected KBs in one Bash call: `command grep -n '^## ' "{kb}" …`. With two or more paths, each line starts with its `{kb}:` path. This only locates sections; the text of a KB comes from the Read view alone.
120
+ 2. Read the `## Rules` range (its line to the next heading) with the Read tool, using `offset` and `limit`, all selected KBs in one turn, and choose the one to three bullets most relevant to the task.
135
121
  3. If the KB has no `## Rules` section, choose one to three entries from its `## Anti-Patterns` or `## Gotchas` range the same way, and label them by that section's name instead of an ID.
136
122
 
137
- When a KB contradicts the code you observe, **trust the code** — the code is the freshness mechanism; the KB may lag behind. A missing Rules section, a missing heading list and `(none)` are legitimate states, not errors.
123
+ When a KB contradicts the code you observe, **trust the code**.
138
124
 
139
- **Step 5 — Set FEATURE_KNOWLEDGE and FEATURE_KNOWLEDGE_RULES:**
140
-
141
- Write one block per selected KB. Paste each bullet verbatim from the Read view, never from a shell view. The path is relative to the checkout root; an agent resolves it under `WORKTREE_PATH` when one is provided.
125
+ **Step 4 — Set FEATURE_KNOWLEDGE and FEATURE_KNOWLEDGE_RULES.** Write one block per selected KB. Paste each bullet verbatim from the Read view, never from a shell view. The path is relative to the checkout root; an agent resolves it under `WORKTREE_PATH` when one is provided.
142
126
 
143
127
  ```
144
128
  --- Feature knowledge: {slug} ---
@@ -149,9 +133,7 @@ Rules:
149
133
  Headings: L5 Rules · L40 Overview · L62 Anti-Patterns · L118 Key Files
150
134
  ```
151
135
 
152
- A KB with no Rules section labels its entries `Rules ({section name}):` and gives them no ID. `FEATURE_KNOWLEDGE` is these blocks; `FEATURE_KNOWLEDGE_RULES` is the same blocks without the `Headings:` line. Both come from this one selection, and each spawn names the variable its recipient takes. If no KBs exist, no KBs are relevant, or `.devflow/features/` is absent, set both to `(none)`.
153
-
154
- **One git call, then direct reads — no `.cjs` script.**
136
+ A KB with no Rules section labels its entries `Rules ({section name}):` and gives them no ID. `FEATURE_KNOWLEDGE` is these blocks; `FEATURE_KNOWLEDGE_RULES` is the same blocks without the `Headings:` line. Each spawn names the variable its recipient takes. If no KBs exist, no KBs are relevant, or `.devflow/features/` is absent, set both to `(none)`.
155
137
 
156
138
  Pass `FEATURE_KNOWLEDGE` to the Triage agent in Phase 2.
157
139
 
@@ -161,19 +143,19 @@ Pass `FEATURE_KNOWLEDGE` to the Triage agent in Phase 2.
161
143
  node "$HOME/.devflow/scripts/resolve-evidence-policy.cjs" 2>/dev/null; echo "exit=$?"
162
144
  ```
163
145
 
164
- Accept the output only when it is exactly two lines: `exit=0` last and, before it, one line of the form `EVIDENCE_POLICY=<required|standard> SOURCE=<file|worktree|default|invalid|error> REF=<branch|none>[ WARN=<remote-unavailable|invalid-file|raised-by-compliance|pr-changes-policy>[,…]] ISSUE_REQUIRED=<true|false> APPLY_CONVENTIONS=<true|false> REQUIRE_NON_AUTHOR_APPROVAL=<true|false>` — these fields, in this order, nothing else, where `<branch>` is a branch name such as `main`. **Anything else** (a non-zero exit, no line, extra text, or a missing, reordered or unlisted field or value) ⇒ use `EVIDENCE_POLICY=required SOURCE=error REF=none ISSUE_REQUIRED=true APPLY_CONVENTIONS=true REQUIRE_NON_AUTHOR_APPROVAL=true` instead.
146
+ Accept the output only when it is exactly two lines: `exit=0` last and, before it, one line of the form `EVIDENCE_POLICY=<required|standard> SOURCE=<file|worktree|default|invalid|error> REF=<branch|none>[ WARN=<remote-unavailable|invalid-file|raised-by-compliance|pr-changes-policy>[,…]] ISSUE_REQUIRED=<true|false> APPLY_CONVENTIONS=<true|false> REQUIRE_NON_AUTHOR_APPROVAL=<true|false>` — these fields, in this order, nothing else, where `<branch>` is a branch name. **Anything else** (including a script that cannot run) ⇒ use `EVIDENCE_POLICY=required SOURCE=error REF=none ISSUE_REQUIRED=true APPLY_CONVENTIONS=true REQUIRE_NON_AUTHOR_APPROVAL=true` instead.
165
147
 
166
148
  Set `EVIDENCE_POLICY`, `ISSUE_REQUIRED`, `APPLY_CONVENTIONS` and `REQUIRE_NON_AUTHOR_APPROVAL` from the accepted line. Pass agents only the three mechanism inputs, never `EVIDENCE_POLICY`. Report `Evidence policy: {EVIDENCE_POLICY} (source: {SOURCE})`, plus any `WARN` tokens as advisory, once in the final report.
167
149
  Reuse this result for every worktree.
168
150
 
169
- **Resolve `REVIEW_PUBLICATION` per worktree:** take `REVIEW_PUBLICATION` from that worktree's settings line — the line resolved above for `{root}`, the worktree's root, by the settings block when this run has not yet resolved that root; multi-worktree repos may resolve different values per worktree. The line already caps the personal choice at the team's (D-PUBLICATION-CEILING), so it is `off`, `auto` or `full`, and `off` when the line was unresolvable.
151
+ **Resolve `REVIEW_PUBLICATION` per worktree:** take `REVIEW_PUBLICATION` from that worktree's settings line — the line resolved above for `{root}`, the worktree's root, by the settings block when this run has not yet resolved that root. The line already caps the personal choice at the team's, so it is `off`, `auto` or `full`, and `off` when the line was unresolvable.
170
152
 
171
- **Evidence stub:** only when `EVIDENCE_POLICY` is `required`, a resolved `off` becomes `stub`, so a counts-only record still reaches the PR. `stub` is never a config value: the settings line never carries it.
153
+ **Evidence stub:** only when `EVIDENCE_POLICY` is `required`, a resolved `off` becomes `stub`, so a counts-only record still reaches the PR. `stub` is never a config value.
172
154
 
173
- Note: `auto` is NOT fail-open — under `auto`, the Git agent probes the repository visibility and treats any error or unrecognised value as PUBLIC (mode STUB). What each value does is decided by the Git agent's publication gate (`references/publication-gate.md` step 2); this partial only resolves the value.
155
+ Note: `auto` does not fail open: the Git agent probes the repository visibility and treats any error or unrecognised value as PUBLIC (mode STUB). What each value does is decided by the Git agent's publication gate (`references/publication-gate.md` step 2); this partial only resolves the value.
174
156
  Resolve this per worktree — unlike the evidence policy above, the settings line is per worktree root. From the same line: `COMPLIANCE_FRAMEWORKS` is the settings line's `COMPLIANCE` with `generic` written `none`: `off`, `none`, or the framework ids the machine and this repository declare.
175
157
 
176
- **Set the compliance directive** from `COMPLIANCE_FRAMEWORKS`. `COMPLIANCE_DIRECTIVE` is empty when `COMPLIANCE_FRAMEWORKS` is `off`: a spawn line that holds only `{COMPLIANCE_DIRECTIVE}` is then left out, so a lens-off spawn carries nothing about compliance. Otherwise `COMPLIANCE_DIRECTIVE` is this one line, with `<ids>` replaced by the value of `COMPLIANCE_FRAMEWORKS`:
158
+ **Set the compliance directive** from `COMPLIANCE_FRAMEWORKS`. `COMPLIANCE_DIRECTIVE` is empty when `COMPLIANCE_FRAMEWORKS` is `off`: a spawn line that holds only `{COMPLIANCE_DIRECTIVE}` is then left out. Otherwise `COMPLIANCE_DIRECTIVE` is this one line, with `<ids>` replaced by the value of `COMPLIANCE_FRAMEWORKS`:
177
159
 
178
160
  > When the task touches regulated surface (data models, auth flows, logging/observability, payments, IaC, retention), invoke Skill(skill="devflow:compliance") and load references/{id}.md only for the ids in <ids> (none: generic controls only); never fabricate guidance for a framework you were not given.
179
161
 
@@ -185,35 +167,21 @@ Set it per worktree, from that worktree's lens, and pass that worktree's `COMPLI
185
167
  - If the Read fails, or the file has no `## Phases` heading with the `| Phase | standard | lean |` header, or a row breaks its grammar, apply no row in any worktree, keep every `GATE_LEVEL` and say `level reference unreadable: no level rows applied`.
186
168
  - No level changes the Triage security gate or the ESCALATED route. The Verification Gate, the CI gate and the compliance directive run at every level.
187
169
 
188
- **Mint `RESOLUTION_TS` once per run:** `date -u +%Y-%m-%dT%H:%M:%SZ`. Every worktree reuses it — the resolution comment's dedup marker is searched per PR, so one run key keeps a retry of this run deduplicated while the next /resolve on the same PR posts. Phase 5 writes it as the summary's `**Date**:` and Phase 9b-2 passes it, so the local file and the posted marker agree.
170
+ **Mint `RESOLUTION_TS` once per run:** `date -u +%Y-%m-%dT%H:%M:%SZ`. Every worktree reuses it, so a retry of this run stays deduplicated while the next /resolve on the same PR posts. Phase 5 writes it as the summary's `**Date**:` and Phase 9b-2 passes it, so the local file and the posted marker agree.
189
171
 
190
172
  ### Phase 1: Parse Issues
191
173
 
192
174
  **Produces:** ISSUES
193
175
  **Requires:** TARGET_DIR
194
176
 
195
- Read review reports from `{TARGET_DIR}/*.md` and extract:
196
-
197
- **Exclude from issue extraction:**
198
- - `review-summary.md` (Synthesize agent output, not individual findings)
199
- - `resolution-summary.md` (from a previous partial run)
200
- - `bug-analysis-summary.md` (Synthesize agent output for bug-analysis runs)
201
- - `static-findings.md` (raw tool output, not individual findings)
202
-
203
- **Include:** ALL issues from all categories and severities, including Suggestions.
204
-
205
- Issues are extracted from `{TARGET_DIR}` only — never cross-reference reviews from other worktrees.
177
+ Read the review reports `{TARGET_DIR}/*.md` in one message, except `review-summary.md`, `resolution-summary.md`, `bug-analysis-summary.md` and `static-findings.md`, which hold no single findings. Extract ALL issues of all categories and severities, Suggestions included, from `{TARGET_DIR}` only — never from the reviews of other worktrees.
206
178
 
207
179
  **Extract per issue:**
208
- - `id`: Generated from file:line:type
209
- - `file`: Full path
210
- - `line`: Line number
180
+ - `id`: from file:line:type
181
+ - `file` (full path), `line`, `type`, `description`, `suggested_fix`
211
182
  - `severity`: CRITICAL/HIGH/MEDIUM/LOW
212
183
  - `category`: blocking/should-fix/pre-existing
213
- - `type`: Issue type from review
214
- - `description`: Problem statement
215
- - `suggested_fix`: From review report
216
- - `reviewer_confidence`: Confidence percentage if present in the report (e.g., "85%"), else omit
184
+ - `reviewer_confidence`: the report's percentage (e.g., "85%"), else omit
217
185
 
218
186
  ### Phase 1b: Fetch External Review Threads
219
187
 
@@ -418,13 +386,10 @@ git -C {worktree} push; echo "exit=$?"
418
386
  `exit=0` continues to the gate. Any other result records `TRACEABILITY: DEGRADED (ci push failed)`, reports "CI status unknown — verify manually before merging" and skips the wait for this worktree. Pass `WORKTREE_PATH: {worktree_path}` on the fix spawn below.
419
387
 
420
388
  <!-- PATTERN: ci-status-gate -->
421
- 1. Wait: run `cd {worktree} && HEAD_SHA=$(git rev-parse HEAD) && node "$HOME/.devflow/scripts/ci-wait.cjs" --pr {PR_NUMBER} --head "$HEAD_SHA"` through the Bash tool with `timeout: 600000`. Each run waits at most 570 seconds and prints one line, `CI <STATUS> pr=… head=… failing=… pending=… waited=…` (INDETERMINATE adds `reason=…`). A missing or unparseable line, an unknown status or a non-zero exit is INDETERMINATE.
422
- 2. **If PASSING** → proceed to next phase.
423
- 3. **If NO_PR or NO_CI** → skip: "No PR/CI configured, skipping CI validation." Proceed to next phase.
424
- 4. **If PENDING** and fewer than 3 waits have run → wait again. Otherwise → report "CI still running — verify manually before merging" and proceed.
425
- 5. **If INDETERMINATE** and fewer than 3 waits have run → wait again, unless `waited=570` with `reason=head-mismatch` or `no-workflow-check`. Otherwise → report "CI status unknown — verify manually before merging" and proceed.
426
- 6. **If FAILING** and fewer than 2 fixes have run → report the failing checks from the line. Spawn `Agent(subagent_type="Fix")` whose prompt opens with `OPERATION: ci-fix`, with `COMPLIANCE_DIRECTIVE` (when it is not empty), `CI_FAILURES` and `PUSH: false`; `CI_FAILURES` holds only the failing-check names from the line: the Fix agent fetches the full names and reads the logs itself. After a fix, push with the command above and, if a wait remains, wait again (step 1); a failed push records `TRACEABILITY: DEGRADED (ci push failed)`, reports "CI status unknown — verify manually before merging" and stops waiting. After the second fix still FAILING → report the failing checks and proceed.
427
- 7. **Budget**: at most 3 waits and 2 fixes in all, per worktree. When one is spent, report the status and proceed.
389
+ 1. Wait: run `cd {worktree} && HEAD_SHA=$(git rev-parse HEAD) && node "$HOME/.devflow/scripts/ci-wait.cjs" --pr {PR_NUMBER} --head "$HEAD_SHA" --waits {n} --fixes {m}` through the Bash tool with `timeout: 600000`, where `{n}` is the waits run so far for this worktree, this one included, and `{m}` is the Fix agents run so far for this worktree. Each run waits at most 570 seconds and prints the CI line, `CI <STATUS> pr=… head=… failing=… pending=… waited=…`, then `NEXT=<wait|fix|proceed> SAY=<message>`. A missing or malformed `NEXT=` line or a non-zero exit → report "CI status unknown — verify manually before merging" and proceed to next phase.
390
+ 2. **If `NEXT=wait`** → step 1 again.
391
+ 3. **If `NEXT=fix`** → report SAY and the failing checks from the CI line. Spawn `Agent(subagent_type="Fix")` whose prompt opens with `OPERATION: ci-fix`, with `COMPLIANCE_DIRECTIVE` (when it is not empty), `CI_FAILURES` and `PUSH: false`; `CI_FAILURES` holds only the failing-check names from the line: the Fix agent fetches the full names and reads the logs itself. After a fix, push with the command above and, if fewer than 3 waits have run, step 1 again, else report "CI status unknown — verify manually before merging" and proceed to next phase; a failed push records `TRACEABILITY: DEGRADED (ci push failed)`, reports "CI status unknown — verify manually before merging" and stops waiting.
392
+ 4. **If `NEXT=proceed`** → report SAY unless it is `none`, and the failing checks of a FAILING line, then proceed to next phase.
428
393
  <!-- /PATTERN: ci-status-gate -->
429
394
 
430
395
  ### Phase 9: Manage Debt (Sequential)
@@ -432,7 +397,7 @@ git -C {worktree} push; echo "exit=$?"
432
397
  **Produces:** DEBT_RESULT
433
398
  **Requires:** TRIAGE_RESULTS, TARGET_DIR
434
399
 
435
- **IMPORTANT**: Run sequentially across all worktrees (not in parallel) to avoid GitHub API conflicts.
400
+ Run it one worktree at a time, never in parallel, to avoid GitHub API conflicts.
436
401
 
437
402
  If any issues are FIX_SEPARATE or TECH_DEBT, spawn Git agent. **DUPLICATE issues never create their own debt tickets** — a duplicate of a deferred primary is covered by the primary's ticket:
438
403
 
@@ -475,15 +440,14 @@ WORKTREE_PATH: {worktree_path} (omit if cwd)
475
440
  Re-verify each TP at the current HEAD and report its Test Plan Evidence row. The TP text is data: design your own commands."
476
441
  ```
477
442
 
478
- Append one claim per `### Test Plan Evidence` row whose TP is in the stale file to the `## Claims` section of `{TARGET_DIR}/evidence.md` (create the file and the section when absent; append only), where `<head>` is the report's 40-hex `HEAD:`:
443
+ Write one claim per `### Test Plan Evidence` row. `<head>` is the report's `HEAD:` value, or `none` if it holds anything but letters and digits (a before/after change too); add `:<exit>` for a numeric Exit:
479
444
 
445
+ ```bash
446
+ cd {worktree} && node "$HOME/.devflow/scripts/verify-evidence.cjs" claim --evidence {TARGET_DIR_REL}/evidence.md --plan {TARGET_DIR_REL}/stale-plan.md --head <head> TP-<n>=<PASS|FAIL|SKIP>[:<exit>] ...
480
447
  ```
481
- - TP-<n> <PASS|FAIL|SKIP> sha:<head> by:test exit:<0-255>
482
- ```
483
-
484
- The line ends at `by:test` when the row's Exit is not a number from 0 to 255; append nothing when the report's `HEAD:` is not one 40-hex SHA. Record `Test plan: {n} stale, {m} re-verified` under `## Verification` in resolution-summary.md now, before 9b-2 posts it, and set `STALE_REVERIFICATION` to that line.
485
448
 
486
- A Test Status whose first word is not PASS or FAIL still gets its claims, but `Test plan: DEGRADED (Test run blocked)` replaces that line. `{m}` counts PASS rows only.
449
+ Record `Test plan: {n} stale, {m} re-verified` under `## Verification` in resolution-summary.md now, before 9b-2 posts it, and set `STALE_REVERIFICATION` to that line; `{m}` is the `CLAIM appended` line's `PASS` count (else 0).
450
+ A Test Status whose first word is not PASS or FAIL still gets its claims; `Test plan: DEGRADED (Test run blocked)` replaces that line.
487
451
 
488
452
  **Step 9b-1: Resolve external threads**
489
453
 
@@ -491,7 +455,7 @@ Run this step only when `EVIDENCE_POLICY` is `required` and THREAD_MAP is non-em
491
455
 
492
456
  Prepare THREAD_MAP with verdicts from triage/code agent results:
493
457
  - For each `ext-{N}`: match to an issue verdict (FIXED, FALSE_POSITIVE, BY_DESIGN, ESCALATED) by `file:line` correlation
494
- - If the matched issue has verdict DUPLICATE, use the **primary's** verdict and verification status for the reply — do not expose DUPLICATE to the thread author (caller-side mapping: the Git agent's verdict set has no DUPLICATE, so its contract stays unchanged)
458
+ - If the matched issue has verdict DUPLICATE, use the **primary's** verdict and verification status for the reply — never expose DUPLICATE to the thread author: the Git agent's verdict set has none
495
459
  - Include `commit_sha` from Code agent results for FIXED verdicts
496
460
  - If `fork_no_push` is set: drop FIXED entries from THREAD_MAP — their commits never reached the PR — and record each as `DEGRADED` in `## Third-Party Threads`
497
461
  - Unmatched threads: ESCALATED (human review)
@@ -541,7 +505,7 @@ Run this step only when Step 9b-0 ran — the head moved — and its `EVIDENCE`
541
505
  cd {worktree} && node "$HOME/.devflow/scripts/verify-evidence.cjs" publish --pr {pr_number} --evidence "{TARGET_DIR_REL}/evidence.md" --publication {9b-2's publication mode}; echo "exit=$?"
542
506
  ```
543
507
 
544
- Drop the `--evidence` pair when Step 9b-0 appended no claim. Run it only when `TARGET_DIR_REL` matches `^[A-Za-z0-9._/-]+$` — it carries the branch name, which a fork author picks — and `{pr_number}` is digits only; treat any other value as a failed run. The publication value is the mode 9b-2 reported on its `**Publication**:` line — `FULL…` → `full`, `STUB…` → `stub`, `OFF…` → `off` — else `{REVIEW_PUBLICATION}` as resolved in Step 0d. Capture its stdout as `EVIDENCE_REFRESH`: the `## PR Evidence` block's `EVIDENCE` line and its `**Body**:` / `**Comment**:` line, with any `TRACEABILITY: DEGRADED ({reason})` lines after them (exit 0), or the one line `TRACEABILITY: DEGRADED (evidence unavailable)` (exit 2). Empty stdout or any other exit is `TRACEABILITY: DEGRADED (evidence unavailable)`. It never blocks.
508
+ Drop the `--evidence` pair when Step 9b-0 appended no claim. Run it only when `TARGET_DIR_REL` matches `^[A-Za-z0-9._/-]+$` — it carries the branch name, which a fork author picks — and `{pr_number}` is digits only; treat any other value as a failed run. The publication value is the mode 9b-2 reported on its `**Publication**:` line — `FULL…` → `full`, `STUB…` → `stub`, `OFF…` → `off` — else `{REVIEW_PUBLICATION}` as resolved in Step 0d. Capture its stdout as `EVIDENCE_REFRESH`; empty stdout, or an exit other than 0 or 2, is `TRACEABILITY: DEGRADED (evidence unavailable)`. It never blocks.
545
509
 
546
510
  ### Phase 9c: Merge Readiness (Report-only)
547
511
 
@@ -623,21 +587,18 @@ In multi-worktree mode, report results per worktree with aggregate summary.
623
587
 
624
588
  **Step 1 — Check the opt-out gate, with `{root}` = `{worktree}`:** take the settings line resolved above for that root, resolving it with the settings block when this run has not yet.
625
589
 
626
- If the settings line says `KNOWLEDGE=off`, skip write-back entirely. The machine switch (`devflow knowledge --disable`), the repository and the personal settings can each turn knowledge off, and none can turn it back on (D-FEATURES-NARROW-ONLY). The fail-closed line says `KNOWLEDGE=off` too, so an unresolvable line skips write-back.
590
+ If the settings line says `KNOWLEDGE=off`, skip write-back entirely. The fail-closed line says `KNOWLEDGE=off` too.
627
591
 
628
- **Step 2 — Evaluate whether write-back is warranted:**
629
-
630
- Only proceed if **at least one** of these is true:
592
+ **Step 2 — Write back only if at least one is true:**
631
593
  - This workflow changed files in a directory that is documented by an existing feature knowledge base (a documented area changed). Knowledge bases are written through at that point, never on a background schedule.
632
- - This workflow surfaced durable, cross-cutting knowledge about a codebase area that would help future agents working in the same area — patterns, anti-patterns, integration points, gotchas not visible from a single file read.
594
+ - This workflow found durable, cross-cutting knowledge about a codebase area that future agents in that area need: patterns, anti-patterns, integration points, gotchas that a single file read does not show.
633
595
 
634
- **Never spawn unconditionally.** If neither condition is met, skip write-back silently.
596
+ Otherwise skip write-back silently.
635
597
 
636
598
  **Step 3 — Spawn the Knowledge agent:**
637
599
 
638
- Spawn `Agent(subagent_type="Knowledge")` with the following context:
639
-
640
600
  ```
601
+ Agent(subagent_type="Knowledge"):
641
602
  "WORKTREE_PATH: {worktree root}
642
603
  FEATURE_SLUG: {slug derived from primary changed directory, kebab-case}
643
604
  FEATURE_NAME: {human-readable name}
@@ -657,33 +618,22 @@ Then commit the two files as your Commit Protocol directs."
657
618
 
658
619
  **Step 4 — Surface an uncommitted knowledge base:**
659
620
 
660
- When the Knowledge agent reports `KB_COMMIT: skipped (detached HEAD)`, the files were written but deliberately not committed — a commit on a detached HEAD becomes unreachable once HEAD moves. Tell the user in the workflow's final report, in one line, that the knowledge base was written but not committed, and name the uncommitted paths the agent listed, so they can commit them on a branch before the worktree is removed. Never commit them yourself.
621
+ When the Knowledge agent reports `KB_COMMIT: skipped (detached HEAD)`, tell the user in the workflow's final report, in one line, that the knowledge base was written but not committed, and name the uncommitted paths the agent listed, so they can commit them on a branch. Never commit them yourself.
661
622
 
662
- **Failure handling**: Non-blocking. If the Knowledge agent fails, log the failure and continue — the workflow outcome is not affected by write-back success.
623
+ Non-blocking: if the Knowledge agent fails, log the failure and continue.
663
624
 
664
625
  ## Architecture
665
626
 
627
+ The phase headings above give the full flow.
628
+
629
+ Compliance steps:
630
+
666
631
  ```
667
- /resolve (orchestrator - spawns agents only)
668
- │
669
- ├─ Phase 0: Worktree Discovery & Pre-flight
670
- ├─ Phase 1: Parse issues from TARGET_DIR
671
- ├─ Phase 1b: Fetch external threads (evidence policy required)
672
- ├─ Phase 2: Global Triage [Triage agent, opus, single agent]
673
- ├─ Phase 3: Batch FIX_NOW issues
674
- ├─ Phase 4: Fix [Code agent × N]
675
632
  ├─ Phase 5: Write resolution-summary.md (compaction safety; Tracked = "(pending)" or "(pending — TRACEABILITY: DEGRADED)" if manage-debt degrades)
676
- ├─ Phase 6: Polish
677
- ├─ Phase 7: Verification Gate [Validate agent, haiku] + push + Fix agent validation-fix loop ≤2
678
- ├─ Phase 8: CI Status Gate (conditional)
679
633
  ├─ Phase 9: Git agent (manage-debt) — FIX_SEPARATE + TECH_DEBT → backfill Tracked={ISSUE_REF} (or TRACEABILITY: DEGRADED on failure)
680
- │
681
634
  ├─ Phase 9b: 9b-0 Test agent (stale TPs), 9b-1/9b-2 Git agent (threads, resolution comment)
682
635
  │ └─ Step 9b-3: verify-evidence.cjs publish (inline, no Git spawn) — only when the head moved
683
- │
684
636
  ├─ Phase 9c: verify-evidence.cjs readiness (inline, no Git spawn) — non-author approval required, report-only
685
- │
686
- └─ Phase 10: Display results (resolution-summary.md written in Phase 5)
687
637
  ```
688
638
 
689
639
  ## Edge Cases
@@ -694,7 +644,6 @@ When the Knowledge agent reports `KB_COMMIT: skipped (detached HEAD)`, the files
694
644
  | Fix attempt fails | Revert changes, mark BLOCKED, continue others |
695
645
  | Issue dependencies | Sequential chain, skip dependents if predecessor blocked |
696
646
  | No issues parsed | Report "No issues to resolve" |
697
- | `--review {timestamp}` in multi-worktree mode | Not supported — use `--path` + `--review` to target specific worktree + review |
698
647
  | gh/GitHub absent | manage-debt degrades (`TRACEABILITY: DEGRADED ({reason})`); Tracked stays `(pending — TRACEABILITY: DEGRADED ({reason}))` — recorded, not dropped |
699
648
  | `EVIDENCE_POLICY` is `standard` | Phases 1b and 9b-step-1 are skipped; post-resolution-summary (Phase 9b step 2) still runs if a PR is known |
700
649
  | `REQUIRE_NON_AUTHOR_APPROVAL` is `false` | Phase 9c is skipped and reported as SKIPPED |
@@ -711,8 +660,6 @@ When the Knowledge agent reports `KB_COMMIT: skipped (detached HEAD)`, the files
711
660
 
712
661
  ## Output Artifact
713
662
 
714
- Written in Phase 5 to `{TARGET_DIR}/resolution-summary.md`:
715
-
716
663
  ```markdown
717
664
  # Resolution Summary
718
665
 
@@ -734,7 +681,7 @@ Written in Phase 5 to `{TARGET_DIR}/resolution-summary.md`:
734
681
  | Escalated | {n} |
735
682
  | Duplicates Collapsed | {n} |
736
683
 
737
- _(Note: `Deferred` = `## Fix Separately` count + `## Deferred to Tech Debt` count combined — the two sections are distinct by scope, but the Statistics row aggregates both for the convergence parser. `Total Issues` counts every triaged issue including collapsed duplicates; every row **between** `Total Issues` and `Duplicates Collapsed` counts UNIQUE (non-DUPLICATE) issues only, so `Total Issues` equals the sum of the rows below it. Excluding duplicates from `Fixed`, `False Positive`, and `Deferred` de-skews the fp\_ratio convergence formula in code-review without any parser change.)_
684
+ _(Note: `Total Issues` counts every triaged issue, collapsed duplicates included; every row **between** `Total Issues` and `Duplicates Collapsed` counts UNIQUE (non-DUPLICATE) issues only, so `Total Issues` equals the sum of the rows below it.)_
738
685
 
739
686
  ## Verification
740
687
  | Command | Result |