devflow-kit 3.3.0 → 3.5.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 (220) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +8 -4
  3. package/dist/agents/code-edit.md +133 -0
  4. package/dist/agents/code-fix.md +165 -0
  5. package/dist/agents/code.md +187 -0
  6. package/{src/assets → dist}/agents/design.md +1 -2
  7. package/{src/assets → dist}/agents/diagnose.md +1 -2
  8. package/dist/agents/git.md +33 -722
  9. package/{src/assets → dist}/agents/knowledge.md +12 -5
  10. package/{src/assets → dist}/agents/research.md +8 -2
  11. package/{src/assets → dist}/agents/review.md +8 -11
  12. package/{src/assets → dist}/agents/scrutinize.md +4 -1
  13. package/dist/agents/skim.md +152 -0
  14. package/{src/assets → dist}/agents/triage.md +9 -2
  15. package/dist/cli/commands/behavior-prompts.js +77 -0
  16. package/dist/cli/commands/behavior.js +123 -0
  17. package/dist/cli/commands/flags.js +8 -2
  18. package/dist/cli/commands/init-seed.js +7 -3
  19. package/dist/cli/commands/init.js +134 -5
  20. package/dist/cli/commands/learning.js +38 -3
  21. package/dist/cli/commands/rules.js +16 -0
  22. package/dist/cli/commands/tracker.js +112 -15
  23. package/dist/cli/commands/uninstall.js +42 -1
  24. package/dist/cli.js +2 -0
  25. package/dist/commands/bug-analysis.md +35 -13
  26. package/dist/commands/code-review.md +155 -69
  27. package/dist/commands/debug.md +39 -16
  28. package/dist/commands/dynamic-build.md +61 -72
  29. package/dist/commands/dynamic-plan.md +39 -25
  30. package/dist/commands/dynamic-profile.md +28 -14
  31. package/dist/commands/dynamic-tickets.md +38 -22
  32. package/dist/commands/explore.md +18 -16
  33. package/dist/commands/implement.md +121 -150
  34. package/dist/commands/plan.md +51 -31
  35. package/dist/commands/release.md +72 -6
  36. package/dist/commands/research.md +49 -20
  37. package/dist/commands/resolve.md +54 -46
  38. package/dist/commands/self-review.md +38 -25
  39. package/dist/core/agent-frontmatter.js +101 -0
  40. package/dist/core/agent-models.js +43 -0
  41. package/dist/core/assets.js +55 -10
  42. package/dist/core/claude-md-audit.js +190 -0
  43. package/dist/core/compliance-compose.js +6 -4
  44. package/dist/core/feature-switch.js +41 -1
  45. package/dist/core/flags.js +139 -0
  46. package/dist/core/fs-atomic.js +8 -3
  47. package/dist/core/learning-variants.js +213 -0
  48. package/dist/core/manifest.js +73 -3
  49. package/dist/core/mds-variants.js +98 -19
  50. package/dist/core/plugins.js +111 -72
  51. package/dist/core/project-paths.js +0 -4
  52. package/dist/core/proxy-log.js +1 -1
  53. package/dist/core/proxy-state.js +1 -1
  54. package/dist/core/tracker.js +120 -2
  55. package/dist/learning-off/agents/code-edit.md +129 -0
  56. package/dist/learning-off/agents/code-fix.md +161 -0
  57. package/dist/learning-off/agents/code.md +183 -0
  58. package/dist/learning-off/agents/design.md +118 -0
  59. package/dist/learning-off/agents/diagnose.md +210 -0
  60. package/dist/learning-off/agents/knowledge.md +96 -0
  61. package/dist/learning-off/agents/research.md +155 -0
  62. package/dist/learning-off/agents/review.md +224 -0
  63. package/dist/learning-off/agents/scrutinize.md +120 -0
  64. package/{src/assets → dist/learning-off}/agents/skim.md +5 -8
  65. package/dist/learning-off/agents/triage.md +170 -0
  66. package/dist/learning-off/commands/bug-analysis.md +420 -0
  67. package/dist/learning-off/commands/code-review.md +530 -0
  68. package/dist/learning-off/commands/debug.md +314 -0
  69. package/dist/learning-off/commands/dynamic-build.md +1245 -0
  70. package/dist/learning-off/commands/dynamic-plan.md +426 -0
  71. package/dist/learning-off/commands/dynamic-profile.md +214 -0
  72. package/dist/learning-off/commands/dynamic-tickets.md +634 -0
  73. package/dist/learning-off/commands/explore.md +210 -0
  74. package/dist/learning-off/commands/implement.md +774 -0
  75. package/dist/learning-off/commands/plan.md +671 -0
  76. package/dist/learning-off/commands/release.md +311 -0
  77. package/dist/learning-off/commands/research.md +229 -0
  78. package/dist/learning-off/commands/resolve.md +842 -0
  79. package/dist/learning-off/commands/self-review.md +266 -0
  80. package/dist/skills/git/references/learn-conventions.md +27 -3
  81. package/dist/skills/git/references/pr/check-ci-status.md +19 -0
  82. package/dist/skills/git/references/pr/check-merge-readiness.md +19 -0
  83. package/dist/skills/git/references/pr/fetch-review-threads.md +30 -0
  84. package/dist/skills/git/references/pr/post-resolution-summary.md +18 -0
  85. package/dist/skills/git/references/pr/post-review-summary.md +20 -0
  86. package/dist/skills/git/references/pr/resolve-review-threads.md +28 -4
  87. package/dist/skills/git/references/pr/update-pr-evidence.md +13 -0
  88. package/dist/skills/git/references/pr/validate-branch.md +26 -0
  89. package/dist/skills/git/references/tracker/_contract.md +33 -0
  90. package/dist/skills/git/references/tracker/github/associate-release.md +24 -0
  91. package/dist/skills/git/references/tracker/github/backlink-shipped-issues.md +31 -1
  92. package/dist/skills/git/references/tracker/github/create-release.md +30 -1
  93. package/dist/skills/git/references/tracker/github/ensure-pr-ready.md +89 -2
  94. package/dist/skills/git/references/tracker/github/ensure-traceable-issue.md +16 -1
  95. package/dist/skills/git/references/tracker/github/fetch-issue.md +38 -1
  96. package/dist/skills/git/references/tracker/github/fetch-issues-batch.md +49 -1
  97. package/dist/skills/git/references/tracker/github/gather-release-evidence.md +29 -0
  98. package/dist/skills/git/references/tracker/github/manage-debt.md +21 -1
  99. package/dist/skills/git/references/tracker/github/post-wave-report.md +17 -1
  100. package/dist/skills/git/references/tracker/github/setup-task.md +53 -1
  101. package/dist/skills/git/references/tracker/jira/associate-release.md +25 -1
  102. package/dist/skills/git/references/tracker/jira/backlink-shipped-issues.md +31 -1
  103. package/dist/skills/git/references/tracker/jira/create-release.md +30 -1
  104. package/dist/skills/git/references/tracker/jira/ensure-pr-ready.md +89 -2
  105. package/dist/skills/git/references/tracker/jira/ensure-traceable-issue.md +16 -1
  106. package/dist/skills/git/references/tracker/jira/fetch-issue.md +38 -1
  107. package/dist/skills/git/references/tracker/jira/fetch-issues-batch.md +49 -1
  108. package/dist/skills/git/references/tracker/jira/gather-release-evidence.md +29 -0
  109. package/dist/skills/git/references/tracker/jira/manage-debt.md +21 -1
  110. package/dist/skills/git/references/tracker/jira/post-wave-report.md +17 -1
  111. package/dist/skills/git/references/tracker/jira/setup-task.md +55 -3
  112. package/dist/skills/git/references/tracker/linear/associate-release.md +25 -1
  113. package/dist/skills/git/references/tracker/linear/backlink-shipped-issues.md +31 -1
  114. package/dist/skills/git/references/tracker/linear/create-release.md +30 -1
  115. package/dist/skills/git/references/tracker/linear/ensure-pr-ready.md +89 -2
  116. package/dist/skills/git/references/tracker/linear/ensure-traceable-issue.md +16 -1
  117. package/dist/skills/git/references/tracker/linear/fetch-issue.md +38 -1
  118. package/dist/skills/git/references/tracker/linear/fetch-issues-batch.md +49 -1
  119. package/dist/skills/git/references/tracker/linear/gather-release-evidence.md +29 -0
  120. package/dist/skills/git/references/tracker/linear/manage-debt.md +21 -1
  121. package/dist/skills/git/references/tracker/linear/post-wave-report.md +17 -1
  122. package/dist/skills/git/references/tracker/linear/setup-task.md +55 -3
  123. package/dist/targets/claude-code/agent-type-owner.js +164 -0
  124. package/dist/targets/claude-code/behavior-install.js +111 -0
  125. package/dist/targets/claude-code/installer.js +140 -37
  126. package/dist/targets/claude-code/language-stamp.js +185 -0
  127. package/dist/targets/claude-code/learning-install.js +497 -0
  128. package/dist/targets/claude-code/tracker-install.js +33 -16
  129. package/dist/targets/claude-code/tracker-servers.js +107 -0
  130. package/package.json +4 -3
  131. package/src/assets/agents/_partials/_code.mds +109 -0
  132. package/src/assets/agents/code-edit.mds +81 -0
  133. package/src/assets/agents/code-fix.mds +113 -0
  134. package/src/assets/agents/code.mds +135 -0
  135. package/src/assets/agents/design.mds +148 -0
  136. package/src/assets/agents/diagnose.mds +225 -0
  137. package/src/assets/agents/evaluate.md +8 -4
  138. package/src/assets/agents/explore.md +58 -0
  139. package/src/assets/agents/git.mds +33 -722
  140. package/src/assets/agents/knowledge.mds +131 -0
  141. package/src/assets/agents/learning.md +19 -69
  142. package/src/assets/agents/research.mds +182 -0
  143. package/src/assets/agents/review.mds +282 -0
  144. package/src/assets/agents/scrutinize.mds +135 -0
  145. package/src/assets/agents/simplify.md +3 -0
  146. package/src/assets/agents/skim.mds +165 -0
  147. package/src/assets/agents/synthesize.md +26 -352
  148. package/src/assets/agents/test.md +8 -0
  149. package/src/assets/agents/tracker.md +20 -7
  150. package/src/assets/agents/triage.mds +201 -0
  151. package/src/assets/agents/validate.md +13 -6
  152. package/src/assets/commands/_partials/_compliance.mds +41 -4
  153. package/src/assets/commands/_partials/_decisions.mds +33 -2
  154. package/src/assets/commands/_partials/_engine.mds +14 -6
  155. package/src/assets/commands/_partials/_knowledge.mds +25 -12
  156. package/src/assets/commands/_partials/_preamble.mds +34 -10
  157. package/src/assets/commands/_partials/_publication.mds +5 -4
  158. package/src/assets/commands/_partials/_roster.mds +4 -3
  159. package/src/assets/commands/_partials/_settings.mds +13 -5
  160. package/src/assets/commands/_partials/_wave.mds +9 -1
  161. package/src/assets/commands/bug-analysis.mds +27 -5
  162. package/src/assets/commands/code-review.mds +158 -52
  163. package/src/assets/commands/debug.mds +41 -3
  164. package/src/assets/commands/dynamic-build.mds +47 -27
  165. package/src/assets/commands/dynamic-plan.mds +40 -9
  166. package/src/assets/commands/dynamic-profile.mds +9 -1
  167. package/src/assets/commands/dynamic-tickets.mds +21 -6
  168. package/src/assets/commands/explore.mds +28 -2
  169. package/src/assets/commands/implement.mds +126 -129
  170. package/src/assets/commands/plan.mds +58 -14
  171. package/src/assets/commands/{release.md → release.mds} +30 -26
  172. package/src/assets/commands/research.mds +42 -11
  173. package/src/assets/commands/resolve.mds +59 -15
  174. package/src/assets/commands/self-review.mds +30 -5
  175. package/src/assets/mds/.mdsroot +4 -0
  176. package/src/assets/mds/git/_ops.mds +383 -0
  177. package/src/assets/mds/git/_ops_pr.mds +201 -0
  178. package/src/assets/mds/git/_ops_steps.mds +147 -0
  179. package/src/assets/mds/git/_pr.mds +39 -44
  180. package/src/assets/mds/git/_references.mds +6 -3
  181. package/src/assets/mds/tracker/_common.mds +5 -5
  182. package/src/assets/mds/tracker/_contract.mds +73 -0
  183. package/src/assets/mds/tracker/_github.mds +73 -16
  184. package/src/assets/mds/tracker/_jira.mds +77 -19
  185. package/src/assets/mds/tracker/_linear.mds +77 -19
  186. package/src/assets/mds/tracker/_mcp.mds +2 -2
  187. package/src/assets/mds/tracker/_steps.mds +98 -0
  188. package/src/assets/rules/behavior.md +6 -0
  189. package/src/assets/rules/context-economy.md +10 -0
  190. package/src/assets/rules/go.md +1 -0
  191. package/src/assets/rules/java.md +1 -0
  192. package/src/assets/rules/python.md +1 -0
  193. package/src/assets/rules/rust.md +1 -0
  194. package/src/assets/rules/typescript.md +1 -0
  195. package/src/assets/scripts/claude-md-audit.cjs +611 -0
  196. package/src/assets/scripts/hooks/assets/orchestrator-charter.md +3 -3
  197. package/src/assets/scripts/hooks/json-helper.cjs +13 -5
  198. package/src/assets/scripts/hooks/json-parse +34 -10
  199. package/src/assets/scripts/hooks/lib/project-paths.cjs +0 -6
  200. package/src/assets/scripts/hooks/session-start-context +315 -7
  201. package/src/assets/skills/agent-references/SKILL.md +33 -0
  202. package/src/assets/skills/agent-references/references/learning/maintain.md +71 -0
  203. package/src/assets/skills/agent-references/references/synthesize/bug-analysis.md +71 -0
  204. package/src/assets/skills/agent-references/references/synthesize/design.md +36 -0
  205. package/src/assets/skills/agent-references/references/synthesize/exploration.md +38 -0
  206. package/src/assets/skills/agent-references/references/synthesize/planning.md +60 -0
  207. package/src/assets/skills/agent-references/references/synthesize/research.md +61 -0
  208. package/src/assets/skills/agent-references/references/synthesize/review.md +76 -0
  209. package/src/assets/skills/apply-decisions/SKILL.md +1 -1
  210. package/src/assets/skills/apply-feature-knowledge/SKILL.md +5 -5
  211. package/src/assets/skills/compliance/SKILL.md +1 -1
  212. package/src/assets/skills/docs-framework/SKILL.md +80 -83
  213. package/src/assets/skills/docs-framework/references/patterns.md +14 -25
  214. package/src/assets/skills/docs-framework/references/violations.md +7 -7
  215. package/src/assets/skills/feature-knowledge/SKILL.md +43 -12
  216. package/src/assets/skills/gap-analysis/SKILL.md +0 -16
  217. package/src/assets/skills/gap-analysis/references/compliance.md +19 -0
  218. package/src/assets/skills/quality-gates/SKILL.md +1 -1
  219. package/dist/skills/git/references/pr/ensure-pr-ready.md +0 -24
  220. package/src/assets/agents/code.md +0 -330
@@ -5,10 +5,11 @@ output-dir: dist/commands
5
5
  @import { knowledge_load } from "./_partials/_knowledge.mds"
6
6
  @import { decisions_load } from "./_partials/_decisions.mds"
7
7
  @import { docs_root } from "./_partials/_docs_root.mds"
8
- @import { compliance_gate } from "./_partials/_compliance.mds"
8
+ @import { compliance_gate, compliance_focus_inject } from "./_partials/_compliance.mds"
9
9
  @import { evidence_policy } from "./_partials/_evidence_policy.mds"
10
10
  @import { test_plan_line } from "./_partials/_plan_contract.mds"
11
11
  @import { issue_ref_grammar, issue_capture_contract } from "./_partials/_tracker.mds"
12
+ @import "./_partials/_settings.mds" as settings
12
13
  # Plan Command
13
14
 
14
15
  Orchestrate design planning from requirements discovery through gap analysis to implementation design. Produces a machine-readable design artifact consumed by `/implement`.
@@ -107,16 +108,29 @@ If the user says "skip" or "just proceed" — skip remaining questions, present
107
108
 
108
109
  **MANDATORY**: Do not spawn any agents until Gate 0 is confirmed — the Step 0 issue fetch (if applicable) is the sole exception; it precedes and informs Gate 0 and must complete before Gate 0 begins.
109
110
 
111
+ <!-- learning:on -->
110
112
  #### Phase 2: Orient + Load Decisions
111
-
112
- **Produces:** SKIM_CONTEXT, DECISIONS_CONTEXT, FEATURE_KNOWLEDGE
113
+ <!-- learning:off -->
114
+ #### Phase 2: Orient
115
+ <!-- learning:end -->
116
+
117
+ <!-- learning:on -->
118
+ **Produces:** SKIM_CONTEXT, DECISIONS_CONTEXT, FEATURE_KNOWLEDGE, FEATURE_KNOWLEDGE_RULES
119
+ <!-- learning:off -->
120
+ **Produces:** SKIM_CONTEXT, FEATURE_KNOWLEDGE, FEATURE_KNOWLEDGE_RULES
121
+ <!-- learning:end -->
113
122
  **Requires:** CONFIRMED_SCOPE
114
123
 
124
+ {{settings.settings_resolve()}}
125
+
115
126
  Spawn Skim agent for codebase context:
116
127
 
117
128
  ```
118
129
  Agent(subagent_type="Skim"):
119
130
  "Orient in codebase for design planning: {feature/issues}
131
+ <!-- learning:on -->
132
+ LEARNING: {LEARNING from the settings line}
133
+ <!-- learning:end -->
120
134
  Run rskim on source directories (NOT repo root) to identify:
121
135
  - Existing patterns and conventions in the affected area
122
136
  - File structure and module boundaries
@@ -128,19 +142,24 @@ Return codebase context for requirements analysis."
128
142
  {{docs_root()}}
129
143
 
130
144
  {{decisions_load()}}
145
+ <!-- learning:on -->
146
+ This produces a compact index of active ADR/PF entries. Pass the Skim agent context to all subsequent agents. Pass `DECISIONS_CONTEXT` to the Design agents of the gap-analysis phase — prior decisions constrain design, known pitfalls inform gap analysis. Design agents use `devflow:apply-decisions` to Read full entry bodies on demand.
131
147
 
132
- This produces a compact index of active ADR/PF entries. Pass Skim agent context and `DECISIONS_CONTEXT` to all subsequent agents — prior decisions constrain design, known pitfalls inform gap analysis. Agents use `devflow:apply-decisions` to Read full entry bodies on demand.
133
-
148
+ <!-- learning:end -->
134
149
  {{knowledge_load()}}
135
150
 
136
- Pass `FEATURE_KNOWLEDGE` alongside `DECISIONS_CONTEXT` to Explore and Design agents.
151
+ <!-- learning:on -->
152
+ Pass `FEATURE_KNOWLEDGE` to Explore and Design agents. Pass `DECISIONS_CONTEXT` to Design agents only.
153
+ <!-- learning:off -->
154
+ Pass `FEATURE_KNOWLEDGE` to Explore and Design agents.
155
+ <!-- learning:end -->
137
156
 
138
157
  #### Phase 3: Explore Requirements (Parallel)
139
158
 
140
159
  **Produces:** EXPLORE_OUTPUTS
141
- **Requires:** SKIM_CONTEXT, DECISIONS_CONTEXT
160
+ **Requires:** SKIM_CONTEXT
142
161
 
143
- Spawn 4 Explore agents **in a single message**, each with Skim agent context, `DECISIONS_CONTEXT` (from Phase 2), and `FEATURE_KNOWLEDGE` (from Phase 2). Include instructions: "follow `devflow:apply-decisions` for DECISIONS_CONTEXT" and "The FEATURE_KNOWLEDGE is a baseline — VALIDATE, EXTEND, and CORRECT it, don't repeat it. Focus on areas the feature knowledge doesn't cover and changes since it was last updated." Ask each agent for a final report of at most about 1,500 tokens: findings with file:line references, not file dumps.
162
+ Spawn 4 `Agent(subagent_type="Explore")` agents **in a single message**, each with Skim agent context and `FEATURE_KNOWLEDGE: {feature_knowledge}` (from Phase 2). Include the instruction: "The FEATURE_KNOWLEDGE is a baseline — VALIDATE, EXTEND, and CORRECT it. For anything it already covers, cite its KB IDs (`{slug} KB-AP-n`) instead of restating the text. Focus on areas the feature knowledge doesn't cover and changes since it was last updated." Ask each agent for a final report of at most about 1,500 tokens: findings with file:line references, not file dumps.
144
163
 
145
164
  | Focus | Thoroughness | Find |
146
165
  |-------|-------------|------|
@@ -171,7 +190,11 @@ Combine into: user needs, similar features, constraints, failure modes"
171
190
  #### Phase 5: Gap Analysis (Parallel)
172
191
 
173
192
  **Produces:** GAP_OUTPUTS, COMPLIANCE_ACTIVE, COMPLIANCE_FRAMEWORKS
193
+ <!-- learning:on -->
174
194
  **Requires:** EXPLORATION_SYNTHESIS, SKIM_CONTEXT, DECISIONS_CONTEXT
195
+ <!-- learning:off -->
196
+ **Requires:** EXPLORATION_SYNTHESIS, SKIM_CONTEXT
197
+ <!-- learning:end -->
175
198
 
176
199
  {{compliance_gate()}}
177
200
 
@@ -197,22 +220,33 @@ Each Design agent receives:
197
220
  - Focus: (their assigned focus from table)
198
221
  - Exploration synthesis from Phase 4
199
222
  - Skim agent context from Phase 2
223
+ <!-- learning:on -->
200
224
  - `DECISIONS_CONTEXT` (index from Phase 2)
201
- - `COMPLIANCE_FRAMEWORKS` (compliance focus only)
225
+ <!-- learning:end -->
226
+ - `COMPLIANCE_FOCUS_DIRECTIVE` (compliance focus only)
202
227
  - Multi-issue: all issue bodies
203
228
 
229
+ {{compliance_focus_inject()}}
230
+
204
231
  ```
205
232
  Agent(subagent_type="Design"):
206
233
  "Mode: gap-analysis
207
234
  Focus: {completeness|architecture|security|performance|compliance|consistency|dependencies}
235
+ <!-- learning:on -->
208
236
  DECISIONS_CONTEXT: {decisions_context}
237
+ <!-- learning:end -->
209
238
  FEATURE_KNOWLEDGE: {feature_knowledge}
210
- COMPLIANCE_FRAMEWORKS: {COMPLIANCE_FRAMEWORKS} (compliance focus only)
239
+ {COMPLIANCE_FOCUS_DIRECTIVE} (compliance focus only)
240
+ Resolve `${CLAUDE_CONFIG_DIR:-$HOME/.claude}` in Bash, then Read `<that directory>/skills/devflow:gap-analysis/references/compliance.md` with the Read tool and apply it as your focus patterns. (compliance focus only)
211
241
  Artifacts:
212
242
  Feature/Issues: {feature description or issue bodies}
213
243
  Exploration synthesis: {Phase 4 output}
214
244
  Codebase context: {Phase 2 output}
245
+ <!-- learning:on -->
215
246
  Analyze only your assigned focus area. Follow devflow:apply-decisions for DECISIONS_CONTEXT.
247
+ <!-- learning:off -->
248
+ Analyze only your assigned focus area.
249
+ <!-- learning:end -->
216
250
  Cite evidence from provided artifacts."
217
251
  ```
218
252
 
@@ -269,7 +303,7 @@ User can:
269
303
  **Produces:** IMPL_EXPLORE_OUTPUTS
270
304
  **Requires:** SKIM_CONTEXT, ACCEPTED_SCOPE
271
305
 
272
- Spawn 4 Explore agents **in a single message**, each with Skim agent context + accepted scope. Ask each agent for a final report of at most about 1,500 tokens: findings with file:line references, not file dumps.
306
+ Spawn 4 `Agent(subagent_type="Explore")` agents **in a single message**, each with Skim agent context + accepted scope. Ask each agent for a final report of at most about 1,500 tokens: findings with file:line references, not file dumps.
273
307
 
274
308
  | Focus | Thoroughness | Find |
275
309
  |-------|-------------|------|
@@ -296,7 +330,7 @@ Combine into: patterns to follow, integration points, reusable code, edge cases"
296
330
  #### Phase 10: Plan Implementation (Parallel)
297
331
 
298
332
  **Produces:** PLAN_OUTPUTS
299
- **Requires:** IMPL_EXPLORATION_SYNTHESIS, GAP_SYNTHESIS, DECISIONS_CONTEXT
333
+ **Requires:** IMPL_EXPLORATION_SYNTHESIS, GAP_SYNTHESIS
300
334
 
301
335
  Spawn 3 Plan agents **in a single message**, each with implementation exploration synthesis. Ask each agent for a final report of at most about 1,500 tokens: the plan itself, not a restatement of the exploration.
302
336
 
@@ -388,8 +422,10 @@ User can:
388
422
 
389
423
  **Store design artifact:**
390
424
 
391
- **Pre-compute the artifact path** from the slug (it never changes after this):
392
- - If one issue: `{worktree}/.devflow/docs/design/{ISSUE_ID}-{topic-slug}.{YYYY-MM-DD_HHMM}.md` (the `docs-framework` skill's design-document pattern, e.g. `42-jwt-auth.2026-04-07_1430.md`)
425
+ **Load `devflow:docs-framework`** — Load via Skill tool: `devflow:docs-framework`, here and not earlier, so a run that stops before this phase never pays for it. If it fails to load, continue with the paths below.
426
+
427
+ **Pre-compute the artifact path** (it never changes after this) by the skill's rules: `{topic-slug}` is its topic slug of the feature title, the same value as the artifact's `slug:` frontmatter, and `{YYYY-MM-DD_HHMM}` is the local time, computed once:
428
+ - If one issue: `{worktree}/.devflow/docs/design/{ISSUE_ID}-{topic-slug}.{YYYY-MM-DD_HHMM}.md` (e.g. `42-jwt-auth.2026-04-07_1430.md`)
393
429
  - If multi-issue: `{worktree}/.devflow/docs/design/multi-{topic-slug}.{YYYY-MM-DD_HHMM}.md`, frontmatter `issue: pending` — a batch fetch returns no issue ID to name it by
394
430
  - If no issue: `{worktree}/.devflow/docs/design/{topic-slug}.{YYYY-MM-DD_HHMM}.md`
395
431
 
@@ -511,9 +547,17 @@ Display completion summary:
511
547
  ├─ Block 1: Requirements Discovery
512
548
  │ ├─ Phase 1: GATE 0 - Requirements Discovery ⛔ MANDATORY
513
549
  │ │ └─ AskUserQuestion: Validate interpretation
550
+ <!-- learning:on -->
514
551
  │ ├─ Phase 2: Orient + Load Decisions
552
+ <!-- learning:off -->
553
+ │ ├─ Phase 2: Orient
554
+ <!-- learning:end -->
555
+ <!-- learning:on -->
515
556
  │ │ ├─ Skim agent (codebase context)
516
557
  │ │ └─ Read index.md → DECISIONS_CONTEXT
558
+ <!-- learning:off -->
559
+ │ │ └─ Skim agent (codebase context)
560
+ <!-- learning:end -->
517
561
  │ ├─ Phase 3: Explore Requirements (PARALLEL)
518
562
  │ │ ├─ Explore: User perspective
519
563
  │ │ ├─ Explore: Similar features
@@ -1,6 +1,11 @@
1
1
  ---
2
2
  description: Release project using adaptive learned configuration
3
+ output-dir: dist/commands
3
4
  ---
5
+ @import { evidence_policy } from "./_partials/_evidence_policy.mds"
6
+ @import { decisions_gate, decisions_locate } from "./_partials/_decisions.mds"
7
+ @import { knowledge_load } from "./_partials/_knowledge.mds"
8
+ @import "./_partials/_settings.mds" as settings
4
9
 
5
10
  # Release Command
6
11
 
@@ -40,8 +45,6 @@ Parse from `COMMAND_INPUT`:
40
45
 
41
46
  **Produces:** RELEASE_CONFIG, CONFIG_STATE (`learned` | `fresh`)
42
47
 
43
- **Load Companion Skills** — Load via Skill tool: `devflow:git`. If a skill fails to load, continue without it.
44
-
45
48
  **Continuation detection**: Check `.release/.progress.json`. If exists, an interrupted release is in progress. Offer user:
46
49
  - **Resume**: continue from last checkpoint (skip phases already completed)
47
50
  - **Restart**: clean start (delete `.release/.progress.json` and begin from Phase 1)
@@ -52,41 +55,35 @@ Read `.release/RELEASE-FLOW.md`:
52
55
 
53
56
  ### Phase 1b: Load Context
54
57
 
55
- **Produces:** DECISIONS_CONTEXT, FEATURE_KNOWLEDGE
56
-
57
- The decisions ledger belongs to the repository, not to one checkout: in a linked worktree it lives in the main worktree, and a session started in a subdirectory reads the copy at the repository root. Locate it with ONE git call, run from the start directory — `WORKTREE_PATH` if provided, otherwise cwd (`devflow:worktree-support`):
58
+ <!-- learning:on -->
59
+ **Produces:** DECISIONS_CONTEXT, FEATURE_KNOWLEDGE, FEATURE_KNOWLEDGE_RULES
60
+ <!-- learning:off -->
61
+ **Produces:** FEATURE_KNOWLEDGE, FEATURE_KNOWLEDGE_RULES
62
+ <!-- learning:end -->
58
63
 
59
- ```bash
60
- git -C "{start}" rev-parse --path-format=absolute --show-toplevel --git-common-dir
61
- ```
64
+ <!-- learning:on -->
65
+ {{settings.settings_resolve()}}
62
66
 
63
- Line 1 is the checkout's toplevel, line 2 the repository's common git directory. A git older than 2.31 echoes `--path-format=absolute` back as a line of its own first. `{ledger}` is the first of these that applies:
67
+ {{decisions_gate()}}
64
68
 
65
- 1. **The main worktree** — line 2 without its trailing `/.git`, when the output is exactly two lines each beginning with `/`, line 2 ends in `/.git`, and the directory left once it is removed is not your home directory and contains a `.devflow/` directory.
66
- 2. **The toplevel** — line 1, or on an older git the line after the echoed flag.
67
- 3. **The start directory itself** — when the command failed or printed no absolute toplevel (outside a git repository).
68
-
69
- This is the rule the learning hooks apply (D-LEDGER-MAIN-WORKTREE, D-PROMPT-ROOT), so you read the index the Learning agent writes.
69
+ {{decisions_locate()}}
70
70
 
71
71
  Read `{ledger}/.devflow/learning/index.md`. If the file is absent or empty, set `DECISIONS_CONTEXT` to `(none)`; otherwise use the file content as `DECISIONS_CONTEXT`.
72
72
 
73
- Load feature knowledge: Attempt to read `.devflow/features/index.md` (the regenerable cache). If absent or empty, glob `.devflow/features/*/KNOWLEDGE.md` and read each file's YAML frontmatter (`name`, `description`, `directories`) as the relevance surface. Pick release-relevant KBs by matching their documented area against the release context. For each selected KB, read the full `KNOWLEDGE.md` — trust current code over KB content on any mismatch. Concatenate under slug headers and set `FEATURE_KNOWLEDGE` (or `(none)` if no KBs exist or none are relevant). No `index.json`, no subprocess, no `.cjs` script.
73
+ <!-- learning:end -->
74
+ {{knowledge_load()}}
74
75
 
75
- Pass both to all subsequent agents via their input contracts.
76
+ <!-- learning:on -->
77
+ Pass `DECISIONS_CONTEXT` and `FEATURE_KNOWLEDGE` only to agents whose contract declares them; the Validate and Git agents this command spawns do not.
78
+ <!-- learning:off -->
79
+ Pass `FEATURE_KNOWLEDGE` only to agents whose contract declares it; the Validate and Git agents this command spawns do not.
80
+ <!-- learning:end -->
76
81
 
77
82
  ### Phase 1c: Resolve the Evidence Policy
78
83
 
79
84
  **Produces:** EVIDENCE_POLICY, ISSUE_REQUIRED, APPLY_CONVENTIONS, REQUIRE_NON_AUTHOR_APPROVAL
80
85
 
81
- **Resolve the evidence policy once per run**, from the repository root, before any step reads the values:
82
-
83
- ```bash
84
- node "$HOME/.devflow/scripts/resolve-evidence-policy.cjs" 2>/dev/null; echo "exit=$?"
85
- ```
86
-
87
- 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.
88
-
89
- 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.
86
+ {{evidence_policy()}}
90
87
 
91
88
  Reuse this result for all subsequent phases: it decides whether a real release gathers and traces its evidence (Phases 4–5), passes it to the release notes (step 4), and back-links shipped issues and associates them with the release (steps 4b–4c).
92
89
 
@@ -191,6 +188,9 @@ Confirm with user via AskUserQuestion before executing:
191
188
  Sequential execution with progress checkpoints:
192
189
  1. **Version bumps** — write new version to configured files
193
190
  2. **Changelog update** — move Unreleased section to versioned entry (if configured)
191
+
192
+ **Load Companion Skills** (D-RELEASE-GIT-LOAD-LATE) — Load via Skill tool: `devflow:git`, here and not earlier: steps 1–2 only write files and `--dry-run` halts after Phase 4, so neither carries the skill. A resume that skips step 3 loads it before its next main-thread git write. If a skill fails to load, continue without it.
193
+
194
194
  3. **Release commit** — `chore(release): v{VERSION}` (conventional commit)
195
195
  4. **Tag and GitHub Release** — spawn `Agent(subagent_type="Git")` with `create-release` operation (the agent reads `.devflow/conventions.md` for tag format and release title conventions; compliance defaults when absent); only when `EVIDENCE_POLICY` is `required`, also pass `COMMIT_LIST` and `SHIPPED_ISSUES` from RELEASE_EVIDENCE, and `TRACEABILITY_EXCEPTIONS` when composed (Record, or the no-ask exempt rule), as inputs so the agent includes them in the release notes body.
196
196
  4b. **Back-link shipped issues** (only when `EVIDENCE_POLICY` is `required`) — spawn `Agent(subagent_type="Git")` with `backlink-shipped-issues` operation, passing `VERSION` and `SHIPPED_ISSUES`; posts a marker-deduped comment on each issue (bounds and throttle enforced by the operation); degrade gracefully (D4) on any API failure — never block the release
@@ -230,7 +230,11 @@ On completion:
230
230
  │ └─ Read .release/RELEASE-FLOW.md (learned) or proceed to detect (fresh)
231
231
  │
232
232
  ├─ Phase 1b: Load Context
233
- │ └─ Load DECISIONS_CONTEXT and FEATURE_KNOWLEDGE for downstream agents
233
+ <!-- learning:on -->
234
+ │ └─ Load DECISIONS_CONTEXT and FEATURE_KNOWLEDGE for the agents that declare them
235
+ <!-- learning:off -->
236
+ │ └─ Load FEATURE_KNOWLEDGE for the agents that declare it
237
+ <!-- learning:end -->
234
238
  │
235
239
  ├─ Phase 2: Detect Release Process (first run only)
236
240
  │ └─ Tiered scan: package.json, CI workflows, git history
@@ -5,6 +5,7 @@ output-dir: dist/commands
5
5
  @import { knowledge_load } from "./_partials/_knowledge.mds"
6
6
  @import { decisions_load } from "./_partials/_decisions.mds"
7
7
  @import { docs_root } from "./_partials/_docs_root.mds"
8
+ @import "./_partials/_settings.mds" as settings
8
9
  # Research Command
9
10
 
10
11
  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.
@@ -33,16 +34,29 @@ $ARGUMENTS
33
34
 
34
35
  ## Phases
35
36
 
37
+ <!-- learning:on -->
36
38
  ### Phase 1: Load Decisions (Orchestrator-Local)
39
+ <!-- learning:off -->
40
+ ### Phase 1: Load Context (Orchestrator-Local)
41
+ <!-- learning:end -->
37
42
 
38
- **Produces:** DECISIONS_CONTEXT, FEATURE_KNOWLEDGE
43
+ <!-- learning:on -->
44
+ **Produces:** DECISIONS_CONTEXT, FEATURE_KNOWLEDGE, FEATURE_KNOWLEDGE_RULES
45
+ <!-- learning:off -->
46
+ **Produces:** FEATURE_KNOWLEDGE, FEATURE_KNOWLEDGE_RULES
47
+ <!-- learning:end -->
39
48
 
40
49
  {{docs_root()}}
41
50
 
42
- {{decisions_load()}}
51
+ <!-- learning:on -->
52
+ {{settings.settings_resolve()}}
43
53
 
54
+ <!-- learning:end -->
55
+ {{decisions_load()}}
56
+ <!-- learning:on -->
44
57
  Use `DECISIONS_CONTEXT` locally when framing research — prior decisions and pitfalls suggest areas to investigate. Follow `devflow:apply-decisions` to Read full entry bodies on demand. Pass `DECISIONS_CONTEXT` to each Research agent in Phase 4 so their findings can account for relevant decisions.
45
58
 
59
+ <!-- learning:end -->
46
60
  {{knowledge_load()}}
47
61
 
48
62
  Use `FEATURE_KNOWLEDGE` **locally** for research framing. Pass to each Research agent in Phase 4.
@@ -51,6 +65,10 @@ Use `FEATURE_KNOWLEDGE` **locally** for research framing. Pass to each Research
51
65
 
52
66
  **Produces:** RESEARCH_PLAN
53
67
 
68
+ **Load `devflow:docs-framework`** — Load via Skill tool: `devflow:docs-framework`, here and not earlier, so a run that stops before this phase never pays for it. If it fails to load, continue with the rules below.
69
+
70
+ Name the research directory by the skill's rules, once: `{topic-slug}` is its topic slug of the research question and `{YYYY-MM-DD_HHMM}` is the local time. When `{worktree}/.devflow/docs/research/{topic-slug}/{YYYY-MM-DD_HHMM}` already exists (a same-minute collision), the timestamp takes seconds instead, `YYYY-MM-DD_HHMMSS`. Every path of this run uses that one directory.
71
+
54
72
  Analyze the research question to infer research types needed (min 2, max 5). For each type:
55
73
  - `RESEARCH_TYPE`: `codebase | external | market | competitor | technology`
56
74
  - `RESEARCH_QUESTION`: Focused sub-question for this type
@@ -58,15 +76,17 @@ Analyze the research question to infer research types needed (min 2, max 5). For
58
76
 
59
77
  **Tool availability check**: If WebSearch/WebFetch are unavailable, restrict to `codebase` type only.
60
78
 
61
- Generate topic slug from the research question (kebab-case, lowercase, no articles).
62
-
63
79
  ### Phase 3: Orient (Conditional)
64
80
 
65
81
  **Produces:** ORIENT_OUTPUT
66
82
 
67
83
  Only if `codebase` type is in RESEARCH_PLAN.
68
84
 
85
+ <!-- learning:on -->
86
+ Spawn `Agent(subagent_type="Skim")` with `LEARNING` from the settings line, targeting codebase areas relevant to the research question.
87
+ <!-- learning:off -->
69
88
  Spawn `Agent(subagent_type="Skim")` targeting codebase areas relevant to the research question.
89
+ <!-- learning:end -->
70
90
 
71
91
  Skip and set ORIENT_OUTPUT = "(none)" if `codebase` type is not in RESEARCH_PLAN.
72
92
 
@@ -79,8 +99,10 @@ Spawn 2-5 `Agent(subagent_type="Research")` agents **in a single message** (para
79
99
 
80
100
  Each Research agent receives:
81
101
  - `RESEARCH_TYPE`, `RESEARCH_QUESTION`, `OUTPUT_PATH` from RESEARCH_PLAN
102
+ <!-- learning:on -->
82
103
  - `DECISIONS_CONTEXT`: From Phase 1
83
- - `FEATURE_KNOWLEDGE`: From Phase 1
104
+ <!-- learning:end -->
105
+ - `FEATURE_KNOWLEDGE`: `{feature_knowledge}` from Phase 1
84
106
  - `ORIENT_OUTPUT`: Only for `codebase` type
85
107
  - `WORKTREE_PATH`: If in a worktree context
86
108
 
@@ -91,12 +113,17 @@ Each Research agent writes findings to disk at OUTPUT_PATH.
91
113
  **Produces:** RESEARCH_SUMMARY
92
114
  **Requires:** RESEARCH_OUTPUTS
93
115
 
94
- Spawn `Agent(subagent_type="Synthesize")` in `research` mode:
95
- - Reads Research agent outputs from RESEARCH_OUTPUTS paths
96
- - Merges findings with trust-aware aggregation
97
- - Writes `research-summary.md` to the same timestamped directory
116
+ Spawn `Agent(subagent_type="Synthesize")` in `research` mode. It reads the Research agent outputs from the `RESEARCH_OUTPUTS` paths, merges them with trust-aware aggregation, and writes `research-summary.md` into `RESEARCH_BASE_DIR` — the one directory of this run, which only this spawn names:
98
117
 
99
- Output path: `{worktree}/.devflow/docs/research/{topic-slug}/{timestamp}/research-summary.md`
118
+ ```
119
+ Agent(subagent_type="Synthesize", run_in_background=false):
120
+ "Mode: research
121
+ WORKTREE_PATH: {WORKTREE_PATH} (omit if none was provided)
122
+ RESEARCH_OUTPUTS: {the OUTPUT_PATH of every Research agent that wrote its file}
123
+ RESEARCH_BASE_DIR: {worktree}/.devflow/docs/research/{topic-slug}/{YYYY-MM-DD_HHMM}
124
+ Merge findings with trust-aware aggregation.
125
+ Output: {worktree}/.devflow/docs/research/{topic-slug}/{YYYY-MM-DD_HHMM}/research-summary.md"
126
+ ```
100
127
 
101
128
  ### Phase 6: Present
102
129
 
@@ -111,7 +138,7 @@ If external research was skipped due to tool unavailability: inform user.
111
138
 
112
139
  ### Phase 7: Feature Knowledge Creation (Conditional)
113
140
 
114
- **Requires:** RESEARCH_SUMMARY, DECISIONS_CONTEXT
141
+ **Requires:** RESEARCH_SUMMARY
115
142
  **Produces:** FEATURE_KNOWLEDGE_STATUS (created | skipped)
116
143
 
117
144
  1. If `codebase` type was not in RESEARCH_PLAN → skip
@@ -137,7 +164,11 @@ Research findings saved to `{worktree}/.devflow/docs/research/{topic-slug}/{YYYY
137
164
  ```
138
165
  /research (orchestrator)
139
166
  │
167
+ <!-- learning:on -->
140
168
  ├─ Phase 1: Load Decisions (Orchestrator-Local)
169
+ <!-- learning:off -->
170
+ ├─ Phase 1: Load Context (Orchestrator-Local)
171
+ <!-- learning:end -->
141
172
  │
142
173
  ├─ Phase 2: Requirements
143
174
  │ └─ Infer 2-5 research types from question
@@ -7,6 +7,7 @@ output-dir: dist/commands
7
7
  @import { evidence_policy } from "./_partials/_evidence_policy.mds"
8
8
  @import { publication_gate } from "./_partials/_publication.mds"
9
9
  @import "./_partials/_compliance.mds" as compliance
10
+ @import "./_partials/_settings.mds" as settings
10
11
  # Resolve Command
11
12
 
12
13
  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.
@@ -28,9 +29,10 @@ Process issues from code review reports: triage every issue through the blast-ra
28
29
 
29
30
  **Produces:** WORKTREES
30
31
 
31
- 1. **Discover resolvable worktrees** using the `devflow:worktree-support` skill discovery algorithm:
32
- - Run `git worktree list --porcelain` → parse, filter (skip protected/detached/mid-rebase), dedup by branch, sort by recent commit
33
- - 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
32
+ 1. **Discover resolvable worktrees**:
33
+ - Run `git worktree list --porcelain` and count the worktrees it lists
34
+ - **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
35
+ - **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
34
36
  - Additional filter: must have unresolved reviews (latest review directory has no `resolution-summary.md`)
35
37
  2. **If `--path` flag provided:** use only that worktree, skip discovery
36
38
  **`--path` validation**: Before proceeding, verify the path exists as a directory and appears in `git worktree list` output. If not: report error and stop.
@@ -89,14 +91,25 @@ For each worktree:
89
91
 
90
92
  Set `TARGET_DIR` to the selected review or bug-analysis directory path, and `TARGET_DIR_REL` to the same directory relative to the worktree root (`.devflow/docs/reviews/…` or `.devflow/docs/bug-analysis/…`) — the only form of it that may reach a PR comment.
91
93
 
94
+ <!-- learning:on -->
92
95
  #### Step 0d: Load Project Decisions
96
+ <!-- learning:off -->
97
+ #### Step 0d: Load Project Context
98
+ <!-- learning:end -->
93
99
 
94
- **Produces:** DECISIONS_CONTEXT, FEATURE_KNOWLEDGE, EVIDENCE_POLICY, ISSUE_REQUIRED, APPLY_CONVENTIONS, REQUIRE_NON_AUTHOR_APPROVAL, REVIEW_PUBLICATION, RESOLUTION_TS
100
+ <!-- learning:on -->
101
+ **Produces:** DECISIONS_CONTEXT, FEATURE_KNOWLEDGE, FEATURE_KNOWLEDGE_RULES, EVIDENCE_POLICY, ISSUE_REQUIRED, APPLY_CONVENTIONS, REQUIRE_NON_AUTHOR_APPROVAL, REVIEW_PUBLICATION, RESOLUTION_TS
102
+ <!-- learning:off -->
103
+ **Produces:** FEATURE_KNOWLEDGE, FEATURE_KNOWLEDGE_RULES, EVIDENCE_POLICY, ISSUE_REQUIRED, APPLY_CONVENTIONS, REQUIRE_NON_AUTHOR_APPROVAL, REVIEW_PUBLICATION, RESOLUTION_TS
104
+ <!-- learning:end -->
95
105
 
96
- {{decisions_load()}}
106
+ {{settings.settings_resolve()}}
97
107
 
108
+ {{decisions_load()}}
109
+ <!-- learning:on -->
98
110
  This produces a compact index of active ADR/PF entries written at render time — Deprecated/Superseded entries are already stripped. Pass `DECISIONS_CONTEXT` to the Triage agent in Phase 2 and to Code agents in Phase 4.
99
111
 
112
+ <!-- learning:end -->
100
113
  {{knowledge_load()}}
101
114
 
102
115
  Pass `FEATURE_KNOWLEDGE` to the Triage agent in Phase 2.
@@ -107,6 +120,10 @@ Reuse this result for every worktree.
107
120
  {{publication_gate()}}
108
121
  Resolve this per worktree — unlike the evidence policy above, the settings line is per worktree root. From the same line: {{compliance.compliance_frameworks()}}
109
122
 
123
+ {{compliance.compliance_inject()}}
124
+
125
+ Set it per worktree, from that worktree's lens, and pass that worktree's `COMPLIANCE_DIRECTIVE` to each of its Code and Code-fix spawns, on a line of its own.
126
+
110
127
  **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.
111
128
 
112
129
  ### Phase 1: Parse Issues
@@ -159,7 +176,11 @@ Parse `THREAD_MAP` from Git agent output. If Git agent returns `TRACEABILITY: DE
159
176
  ### Phase 2: Global Triage
160
177
 
161
178
  **Produces:** TRIAGE_RESULTS
179
+ <!-- learning:on -->
162
180
  **Requires:** ISSUES, DIFF_FILES, DECISIONS_CONTEXT, FEATURE_KNOWLEDGE, PR_DESCRIPTION
181
+ <!-- learning:off -->
182
+ **Requires:** ISSUES, DIFF_FILES, FEATURE_KNOWLEDGE, PR_DESCRIPTION
183
+ <!-- learning:end -->
163
184
 
164
185
  Spawn a single global Triage agent for ALL issues:
165
186
 
@@ -168,11 +189,15 @@ Agent(subagent_type="Triage"):
168
189
  "ISSUES: {all_issues}
169
190
  DIFF_FILES: {diff_files}
170
191
  WORKTREE_PATH: {worktree_path} (omit if cwd)
192
+ <!-- learning:on -->
171
193
  DECISIONS_CONTEXT: {decisions_context}
194
+ <!-- learning:end -->
172
195
  FEATURE_KNOWLEDGE: {feature_knowledge}
173
196
  PR_DESCRIPTION: <pr-description>{pr_description}</pr-description>
174
197
  Triage every issue: collapse duplicates first, then apply the blast-radius disposition matrix to each group's primary. Assign exactly one verdict per issue.
198
+ <!-- learning:on -->
175
199
  Follow devflow:apply-decisions to Read full ADR/PF bodies on demand.
200
+ <!-- learning:end -->
176
201
  Follow devflow:apply-feature-knowledge for FEATURE_KNOWLEDGE."
177
202
  ```
178
203
 
@@ -185,8 +210,10 @@ Wait for Triage agent to complete before proceeding. Parse verdict ledger from T
185
210
  - **TECH_DEBT**: Architectural overhaul only — LAST RESORT
186
211
  - **DUPLICATE**: Collapsed duplicate issue — carries `duplicate_of: <primary-id>` referencing the non-DUPLICATE primary; inherits the primary's outcome
187
212
 
213
+ <!-- learning:on -->
188
214
  Collect every decision and pitfall the Triage agent's Reasoning columns state, in its words — the resolution summary is posted, so it never carries an ADR/PF ID.
189
215
 
216
+ <!-- learning:end -->
190
217
  **Triage agent completeness assertion:** Verify the parsed ledger against ISSUES before proceeding:
191
218
  1. Every issue `id` from ISSUES must appear in exactly one verdict bucket — none may vanish, none may appear in multiple buckets. DUPLICATE is a valid bucket; a valid DUPLICATE entry must name its `duplicate_of` primary (the `Duplicate Of` column of the ledger's DUPLICATE table) and that primary must be a non-DUPLICATE issue id. A missing `duplicate_of` or one that chains to another DUPLICATE is a **Triage agent failure** (retry-then-abort as below).
192
219
  2. If the Triage agent output is empty, contains a skill re-entrancy guard string (e.g., contains `already running`), or is missing any issue IDs from ISSUES: treat as a **Triage agent failure**:
@@ -210,7 +237,11 @@ Otherwise, batch FIX_NOW issues for Code agent execution. **DUPLICATE issues are
210
237
  ### Phase 4: Fix (Code agent × N)
211
238
 
212
239
  **Produces:** CODE_AGENT_RESULTS
240
+ <!-- learning:on -->
213
241
  **Requires:** BATCHES, DECISIONS_CONTEXT, FEATURE_KNOWLEDGE
242
+ <!-- learning:off -->
243
+ **Requires:** BATCHES, FEATURE_KNOWLEDGE
244
+ <!-- learning:end -->
214
245
 
215
246
  For each batch, spawn Code agent with `OPERATION: issue-fix` and `PUSH: false`:
216
247
 
@@ -221,11 +252,12 @@ TASK_ID: resolve-{batch-id}
221
252
  ISSUES: {fix_now_issues_in_batch}
222
253
  SCOPE: {risk_tier_per_issue}
223
254
  PUSH: false
224
- CREATE_PR: false
225
255
  WORKTREE_PATH: {worktree_path} (omit if cwd)
256
+ <!-- learning:on -->
226
257
  DECISIONS_CONTEXT: {decisions_context}
258
+ <!-- learning:end -->
227
259
  FEATURE_KNOWLEDGE: {feature_knowledge}
228
- COMPLIANCE_FRAMEWORKS: {COMPLIANCE_FRAMEWORKS}
260
+ {COMPLIANCE_DIRECTIVE}
229
261
  Fix only the listed pre-classified FIX_NOW issues. Do not re-litigate dispositions.
230
262
  Same-file issues → one commit. Include ## Verification block in report.
231
263
  Regression fix without failing-then-passing regression test → BLOCKED."
@@ -288,17 +320,19 @@ Run build, typecheck, lint, test. Report pass/fail with failure details."
288
320
  1. Extract failure details from Validate agent output
289
321
  2. Increment `validation_retry_count`
290
322
  3. If `validation_retry_count <= 2`:
291
- - Spawn Code agent with fix context:
323
+ - Spawn Code-fix agent with fix context:
292
324
  ```
293
- Agent(subagent_type="Code"):
325
+ Agent(subagent_type="Code-fix"):
294
326
  "OPERATION: validation-fix
295
327
  TASK_ID: resolve-{batch-id}-valfix-{count}
296
328
  VALIDATION_FAILURES: {parsed failures from Validate agent}
297
329
  SCOPE: Fix only the listed failures, no other changes
298
330
  PUSH: false
299
- CREATE_PR: false
300
331
  WORKTREE_PATH: {worktree_path} (omit if cwd)
301
- COMPLIANCE_FRAMEWORKS: {COMPLIANCE_FRAMEWORKS}"
332
+ <!-- learning:on -->
333
+ DECISIONS_CONTEXT: {decisions_context}
334
+ <!-- learning:end -->
335
+ {COMPLIANCE_DIRECTIVE}"
302
336
  ```
303
337
  - Loop back to re-validate
304
338
  4. If `validation_retry_count > 2`: set VERIFICATION_STATUS = FAILED and exit the validation loop — record a blocking callout in the `## Verification` section (never a silent pass).
@@ -308,7 +342,7 @@ Run build, typecheck, lint, test. Report pass/fail with failure details."
308
342
  Record `## Verification` outcome in resolution-summary.md (runs unconditionally after the validation loop exits):
309
343
  - Rewrite the `## Verification` section with | Command | Result | table + `Final gate: PASS | FAILED after N attempts`
310
344
 
311
- Push all commits to remote once (Code agents and validation-fix Code agents ran with PUSH: false — runs whether the gate PASSED or FAILED, so the branch is always visible before Phase 9 or CI runs):
345
+ Push all commits to remote once (Code and Code-fix agents ran with PUSH: false — runs whether the gate PASSED or FAILED, so the branch is always visible before Phase 9 or CI runs):
312
346
  ```bash
313
347
  git -C {worktree} push
314
348
  ```
@@ -346,7 +380,11 @@ Phase 7 has pushed already, so this is a no-op unless the head moved since. `exi
346
380
  3. **If NO_PR or NO_CI** → skip: "No PR/CI configured, skipping CI validation." Proceed to next phase.
347
381
  4. **If PENDING** and fewer than 3 waits have run → wait again (step 1). After the third wait → report "CI still running — verify manually before merging" and proceed.
348
382
  5. **If INDETERMINATE** and fewer than 3 waits have run → wait again (step 1). After the third wait → report "CI status unknown — verify manually before merging" and proceed.
349
- 6. **If FAILING** and fewer than 2 fixes have run → report the failing checks from the line. Spawn `Agent(subagent_type="Code")` whose prompt opens with `OPERATION: ci-fix`, with `COMPLIANCE_FRAMEWORKS`, `CI_FAILURES` and `PUSH: false`; `CI_FAILURES` holds the failing-check names from the line and nothing else, because the Code agent fetches the full names and reads the logs itself and this command reads none. 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.
383
+ <!-- learning:on -->
384
+ 6. **If FAILING** and fewer than 2 fixes have run → report the failing checks from the line. Spawn `Agent(subagent_type="Code-fix")` whose prompt opens with `OPERATION: ci-fix`, with `COMPLIANCE_DIRECTIVE` (when it is not empty), `CI_FAILURES`, `DECISIONS_CONTEXT` and `PUSH: false`; `CI_FAILURES` holds the failing-check names from the line and nothing else, because the Code-fix agent fetches the full names and reads the logs itself and this command reads none. 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.
385
+ <!-- learning:off -->
386
+ 6. **If FAILING** and fewer than 2 fixes have run → report the failing checks from the line. Spawn `Agent(subagent_type="Code-fix")` whose prompt opens with `OPERATION: ci-fix`, with `COMPLIANCE_DIRECTIVE` (when it is not empty), `CI_FAILURES` and `PUSH: false`; `CI_FAILURES` holds the failing-check names from the line and nothing else, because the Code-fix agent fetches the full names and reads the logs itself and this command reads none. 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.
387
+ <!-- learning:end -->
350
388
  7. **Budget**: at most 3 waits and 2 fixes in all, per worktree. When one is spent, report the current status and proceed.
351
389
  <!-- /PATTERN: ci-status-gate -->
352
390
 
@@ -557,7 +595,11 @@ In multi-worktree mode, report results per worktree with aggregate summary.
557
595
  │ ├─ Step 0a: git worktree list → filter resolvable
558
596
  │ ├─ Step 0b: Git agent (validate-branch) per worktree [parallel] ← + DIFF_FILES
559
597
  │ ├─ Step 0c: Target latest review directory per worktree
598
+ <!-- learning:on -->
560
599
  │ └─ Step 0d: Load project decisions → DECISIONS_CONTEXT + EVIDENCE_POLICY + REVIEW_PUBLICATION
600
+ <!-- learning:off -->
601
+ │ └─ Step 0d: Load project context → EVIDENCE_POLICY + REVIEW_PUBLICATION
602
+ <!-- learning:end -->
561
603
  │
562
604
  ├─ Phase 1: Parse issues from TARGET_DIR + extract confidence %
563
605
  │
@@ -577,10 +619,10 @@ In multi-worktree mode, report results per worktree with aggregate summary.
577
619
  │
578
620
  ├─ Phase 6: Simplify [Simplify agent]
579
621
  │
580
- ├─ Phase 7: Verification Gate [Validate agent, haiku] + push + Code agent validation-fix loop ≤2
622
+ ├─ Phase 7: Verification Gate [Validate agent, haiku] + push + Code-fix agent validation-fix loop ≤2
581
623
  │
582
624
  ├─ Phase 8: CI Status Gate (conditional — skipped if no fixes or verification FAILED)
583
- │ └─ push, then ci-wait.cjs (inline, one wait ≤ 570 s) → Code agent on FAILING (3 waits + 2 fixes per worktree)
625
+ │ └─ push, then ci-wait.cjs (inline, one wait ≤ 570 s) → Code-fix agent on FAILING (3 waits + 2 fixes per worktree)
584
626
  │
585
627
  ├─ Phase 9: Git agent (manage-debt) — FIX_SEPARATE + TECH_DEBT → backfill Tracked={ISSUE_REF} (or TRACEABILITY: DEGRADED on failure)
586
628
  │ SEQUENTIAL across worktrees
@@ -651,12 +693,14 @@ Written in Phase 5 (Collect Results) to `{TARGET_DIR}/resolution-summary.md`:
651
693
  **Review**: {TARGET_DIR_REL}
652
694
  **Command**: /resolve
653
695
 
696
+ <!-- learning:on -->
654
697
  ## Decisions Citations
655
698
 
656
699
  - {decision applied or pitfall avoided, stated in words — never its ID} — {batch-id}, {issue-id}
657
700
 
658
701
  (Omit section if no citations were made)
659
702
 
703
+ <!-- learning:end -->
660
704
  ## Statistics
661
705
  | Metric | Value |
662
706
  |--------|-------|