devflow-kit 3.2.0 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +1 -1
  3. package/dist/agents/code.md +330 -0
  4. package/{src/assets → dist}/agents/design.md +11 -1
  5. package/{src/assets → dist}/agents/diagnose.md +17 -13
  6. package/dist/agents/git.md +29 -56
  7. package/{src/assets → dist}/agents/knowledge.md +8 -5
  8. package/{src/assets → dist}/agents/research.md +21 -2
  9. package/{src/assets → dist}/agents/review.md +18 -7
  10. package/{src/assets → dist}/agents/scrutinize.md +35 -11
  11. package/dist/agents/skim.md +148 -0
  12. package/{src/assets → dist}/agents/triage.md +8 -2
  13. package/dist/cli/commands/init.js +62 -0
  14. package/dist/cli/commands/learning.js +63 -8
  15. package/dist/cli/commands/uninstall.js +42 -1
  16. package/dist/commands/bug-analysis.md +30 -8
  17. package/dist/commands/code-review.md +142 -61
  18. package/dist/commands/debug.md +15 -13
  19. package/dist/commands/dynamic-build.md +176 -130
  20. package/dist/commands/dynamic-plan.md +31 -19
  21. package/dist/commands/dynamic-profile.md +27 -13
  22. package/dist/commands/dynamic-tickets.md +28 -14
  23. package/dist/commands/explore.md +16 -14
  24. package/dist/commands/implement.md +163 -158
  25. package/dist/commands/plan.md +37 -24
  26. package/dist/commands/release.md +69 -4
  27. package/dist/commands/research.md +33 -11
  28. package/dist/commands/resolve.md +61 -47
  29. package/dist/commands/self-review.md +50 -32
  30. package/dist/core/agent-models.js +53 -7
  31. package/dist/core/assets.js +55 -10
  32. package/dist/core/claude-md-audit.js +190 -0
  33. package/dist/core/feature-switch.js +20 -1
  34. package/dist/core/flags.js +28 -0
  35. package/dist/core/fs-atomic.js +8 -3
  36. package/dist/core/learning-tuning-config.js +8 -0
  37. package/dist/core/learning-variants.js +213 -0
  38. package/dist/core/manifest.js +62 -0
  39. package/dist/core/mds-variants.js +38 -1
  40. package/dist/core/plugins.js +78 -11
  41. package/{src/assets → dist/learning-off}/agents/code.md +77 -28
  42. package/dist/learning-off/agents/design.md +119 -0
  43. package/dist/learning-off/agents/diagnose.md +210 -0
  44. package/dist/learning-off/agents/knowledge.md +90 -0
  45. package/dist/learning-off/agents/research.md +149 -0
  46. package/dist/learning-off/agents/review.md +228 -0
  47. package/dist/learning-off/agents/scrutinize.md +117 -0
  48. package/{src/assets → dist/learning-off}/agents/skim.md +5 -10
  49. package/dist/learning-off/agents/triage.md +163 -0
  50. package/dist/learning-off/commands/bug-analysis.md +420 -0
  51. package/dist/learning-off/commands/code-review.md +525 -0
  52. package/dist/learning-off/commands/debug.md +294 -0
  53. package/dist/learning-off/commands/dynamic-build.md +1255 -0
  54. package/dist/learning-off/commands/dynamic-plan.md +424 -0
  55. package/dist/learning-off/commands/dynamic-profile.md +214 -0
  56. package/dist/learning-off/commands/dynamic-tickets.md +632 -0
  57. package/dist/learning-off/commands/explore.md +210 -0
  58. package/dist/learning-off/commands/implement.md +808 -0
  59. package/dist/learning-off/commands/plan.md +664 -0
  60. package/dist/learning-off/commands/release.md +310 -0
  61. package/dist/learning-off/commands/research.md +222 -0
  62. package/dist/learning-off/commands/resolve.md +837 -0
  63. package/dist/learning-off/commands/self-review.md +266 -0
  64. package/dist/skills/git/references/tracker/_contract.md +33 -0
  65. package/dist/skills/git/references/tracker/github/fetch-issue.md +2 -0
  66. package/dist/skills/git/references/tracker/github/fetch-issues-batch.md +2 -0
  67. package/dist/skills/git/references/tracker/github/gather-release-evidence.md +5 -1
  68. package/dist/skills/git/references/tracker/github/post-wave-report.md +2 -0
  69. package/dist/skills/git/references/tracker/github/setup-task.md +12 -0
  70. package/dist/skills/git/references/tracker/jira/associate-release.md +1 -1
  71. package/dist/skills/git/references/tracker/jira/fetch-issue.md +2 -0
  72. package/dist/skills/git/references/tracker/jira/fetch-issues-batch.md +2 -0
  73. package/dist/skills/git/references/tracker/jira/gather-release-evidence.md +5 -1
  74. package/dist/skills/git/references/tracker/jira/post-wave-report.md +2 -0
  75. package/dist/skills/git/references/tracker/jira/setup-task.md +14 -2
  76. package/dist/skills/git/references/tracker/linear/associate-release.md +1 -1
  77. package/dist/skills/git/references/tracker/linear/fetch-issue.md +2 -0
  78. package/dist/skills/git/references/tracker/linear/fetch-issues-batch.md +2 -0
  79. package/dist/skills/git/references/tracker/linear/gather-release-evidence.md +5 -1
  80. package/dist/skills/git/references/tracker/linear/post-wave-report.md +2 -0
  81. package/dist/skills/git/references/tracker/linear/setup-task.md +14 -2
  82. package/dist/targets/claude-code/installer.js +72 -36
  83. package/dist/targets/claude-code/language-stamp.js +185 -0
  84. package/dist/targets/claude-code/learning-install.js +489 -0
  85. package/package.json +1 -1
  86. package/src/assets/agents/code.mds +339 -0
  87. package/src/assets/agents/design.mds +149 -0
  88. package/src/assets/agents/diagnose.mds +225 -0
  89. package/src/assets/agents/evaluate.md +12 -25
  90. package/src/assets/agents/git.mds +29 -56
  91. package/src/assets/agents/knowledge.mds +125 -0
  92. package/src/assets/agents/learning.md +4 -6
  93. package/src/assets/agents/research.mds +176 -0
  94. package/src/assets/agents/review.mds +286 -0
  95. package/src/assets/agents/scrutinize.mds +132 -0
  96. package/src/assets/agents/simplify.md +20 -0
  97. package/src/assets/agents/skim.mds +161 -0
  98. package/src/assets/agents/synthesize.md +12 -0
  99. package/src/assets/agents/test.md +2 -2
  100. package/src/assets/agents/triage.mds +194 -0
  101. package/src/assets/agents/validate.md +15 -8
  102. package/src/assets/commands/_partials/_compliance.mds +5 -4
  103. package/src/assets/commands/_partials/_decisions.mds +31 -0
  104. package/src/assets/commands/_partials/_engine.mds +29 -24
  105. package/src/assets/commands/_partials/_knowledge.mds +26 -13
  106. package/src/assets/commands/_partials/_plan_contract.mds +1 -1
  107. package/src/assets/commands/_partials/_preamble.mds +33 -9
  108. package/src/assets/commands/_partials/_publication.mds +5 -4
  109. package/src/assets/commands/_partials/_settings.mds +13 -5
  110. package/src/assets/commands/_partials/_wave.mds +16 -6
  111. package/src/assets/commands/bug-analysis.mds +24 -2
  112. package/src/assets/commands/code-review.mds +148 -45
  113. package/src/assets/commands/debug.mds +17 -1
  114. package/src/assets/commands/dynamic-build.mds +144 -65
  115. package/src/assets/commands/dynamic-plan.mds +36 -6
  116. package/src/assets/commands/dynamic-profile.mds +9 -1
  117. package/src/assets/commands/dynamic-tickets.mds +16 -2
  118. package/src/assets/commands/explore.mds +27 -1
  119. package/src/assets/commands/implement.mds +171 -138
  120. package/src/assets/commands/plan.mds +47 -8
  121. package/src/assets/commands/{release.md → release.mds} +27 -24
  122. package/src/assets/commands/research.mds +28 -4
  123. package/src/assets/commands/resolve.mds +69 -17
  124. package/src/assets/commands/self-review.mds +43 -13
  125. package/src/assets/mds/tracker/_common.mds +1 -1
  126. package/src/assets/mds/tracker/_contract.mds +72 -0
  127. package/src/assets/mds/tracker/_github.mds +13 -2
  128. package/src/assets/mds/tracker/_jira.mds +17 -5
  129. package/src/assets/mds/tracker/_linear.mds +17 -5
  130. package/src/assets/mds/tracker/_mcp.mds +2 -2
  131. package/src/assets/mds/tracker/_steps.mds +97 -0
  132. package/src/assets/rules/context-economy.md +10 -0
  133. package/src/assets/rules/go.md +1 -0
  134. package/src/assets/rules/java.md +1 -0
  135. package/src/assets/rules/python.md +1 -0
  136. package/src/assets/rules/rust.md +1 -0
  137. package/src/assets/rules/typescript.md +1 -0
  138. package/src/assets/scripts/ci-wait.cjs +636 -0
  139. package/src/assets/scripts/claude-md-audit.cjs +611 -0
  140. package/src/assets/scripts/hooks/assets/orchestrator-charter.md +2 -3
  141. package/src/assets/scripts/hooks/background-memory-update +290 -9
  142. package/src/assets/scripts/hooks/json-helper.cjs +13 -5
  143. package/src/assets/scripts/hooks/json-parse +34 -10
  144. package/src/assets/scripts/hooks/session-start-context +315 -7
  145. package/src/assets/scripts/release-trace.cjs +27 -10
  146. package/src/assets/skills/accessibility/SKILL.md +1 -1
  147. package/src/assets/skills/apply-decisions/SKILL.md +12 -82
  148. package/src/assets/skills/apply-feature-knowledge/SKILL.md +9 -43
  149. package/src/assets/skills/architecture/SKILL.md +1 -1
  150. package/src/assets/skills/boundary-validation/SKILL.md +1 -1
  151. package/src/assets/skills/complexity/SKILL.md +1 -1
  152. package/src/assets/skills/compliance/SKILL.md +1 -1
  153. package/src/assets/skills/consistency/SKILL.md +1 -1
  154. package/src/assets/skills/database/SKILL.md +1 -1
  155. package/src/assets/skills/dependencies/SKILL.md +1 -1
  156. package/src/assets/skills/dependency-research/SKILL.md +3 -6
  157. package/src/assets/skills/design-review/SKILL.md +1 -1
  158. package/src/assets/skills/docs-framework/SKILL.md +1 -1
  159. package/src/assets/skills/documentation/SKILL.md +1 -1
  160. package/src/assets/skills/feature-knowledge/SKILL.md +43 -12
  161. package/src/assets/skills/gap-analysis/SKILL.md +1 -1
  162. package/src/assets/skills/git/SKILL.md +1 -1
  163. package/src/assets/skills/go/SKILL.md +1 -1
  164. package/src/assets/skills/java/SKILL.md +1 -1
  165. package/src/assets/skills/patterns/SKILL.md +1 -1
  166. package/src/assets/skills/performance/SKILL.md +1 -1
  167. package/src/assets/skills/python/SKILL.md +1 -1
  168. package/src/assets/skills/qa/SKILL.md +1 -3
  169. package/src/assets/skills/quality-gates/SKILL.md +10 -13
  170. package/src/assets/skills/quality-gates/references/report-template.md +20 -20
  171. package/src/assets/skills/react/SKILL.md +1 -1
  172. package/src/assets/skills/regression/SKILL.md +1 -1
  173. package/src/assets/skills/reliability/SKILL.md +1 -1
  174. package/src/assets/skills/research-codebase/SKILL.md +1 -1
  175. package/src/assets/skills/research-competitor/SKILL.md +1 -1
  176. package/src/assets/skills/research-external/SKILL.md +1 -1
  177. package/src/assets/skills/research-technology/SKILL.md +1 -1
  178. package/src/assets/skills/review-methodology/SKILL.md +1 -1
  179. package/src/assets/skills/rust/SKILL.md +1 -1
  180. package/src/assets/skills/security/SKILL.md +1 -1
  181. package/src/assets/skills/software-design/SKILL.md +1 -1
  182. package/src/assets/skills/test-driven-development/SKILL.md +9 -29
  183. package/src/assets/skills/testing/SKILL.md +1 -1
  184. package/src/assets/skills/typescript/SKILL.md +1 -1
  185. package/src/assets/skills/ui-design/SKILL.md +1 -1
  186. package/src/assets/skills/worktree-support/SKILL.md +3 -55
  187. package/src/assets/skills/worktree-support/references/discovery.md +48 -0
  188. package/src/assets/skills/worktree-support/references/roots.md +2 -2
@@ -9,6 +9,7 @@ output-dir: dist/commands
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 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,7 +220,9 @@ 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)
225
+ <!-- learning:end -->
201
226
  - `COMPLIANCE_FRAMEWORKS` (compliance focus only)
202
227
  - Multi-issue: all issue bodies
203
228
 
@@ -205,14 +230,20 @@ Each Design agent receives:
205
230
  Agent(subagent_type="Design"):
206
231
  "Mode: gap-analysis
207
232
  Focus: {completeness|architecture|security|performance|compliance|consistency|dependencies}
233
+ <!-- learning:on -->
208
234
  DECISIONS_CONTEXT: {decisions_context}
235
+ <!-- learning:end -->
209
236
  FEATURE_KNOWLEDGE: {feature_knowledge}
210
237
  COMPLIANCE_FRAMEWORKS: {COMPLIANCE_FRAMEWORKS} (compliance focus only)
211
238
  Artifacts:
212
239
  Feature/Issues: {feature description or issue bodies}
213
240
  Exploration synthesis: {Phase 4 output}
214
241
  Codebase context: {Phase 2 output}
242
+ <!-- learning:on -->
215
243
  Analyze only your assigned focus area. Follow devflow:apply-decisions for DECISIONS_CONTEXT.
244
+ <!-- learning:off -->
245
+ Analyze only your assigned focus area.
246
+ <!-- learning:end -->
216
247
  Cite evidence from provided artifacts."
217
248
  ```
218
249
 
@@ -296,7 +327,7 @@ Combine into: patterns to follow, integration points, reusable code, edge cases"
296
327
  #### Phase 10: Plan Implementation (Parallel)
297
328
 
298
329
  **Produces:** PLAN_OUTPUTS
299
- **Requires:** IMPL_EXPLORATION_SYNTHESIS, GAP_SYNTHESIS, DECISIONS_CONTEXT
330
+ **Requires:** IMPL_EXPLORATION_SYNTHESIS, GAP_SYNTHESIS
300
331
 
301
332
  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
333
 
@@ -511,9 +542,17 @@ Display completion summary:
511
542
  ├─ Block 1: Requirements Discovery
512
543
  │ ├─ Phase 1: GATE 0 - Requirements Discovery ⛔ MANDATORY
513
544
  │ │ └─ AskUserQuestion: Validate interpretation
545
+ <!-- learning:on -->
514
546
  │ ├─ Phase 2: Orient + Load Decisions
547
+ <!-- learning:off -->
548
+ │ ├─ Phase 2: Orient
549
+ <!-- learning:end -->
550
+ <!-- learning:on -->
515
551
  │ │ ├─ Skim agent (codebase context)
516
552
  │ │ └─ Read index.md → DECISIONS_CONTEXT
553
+ <!-- learning:off -->
554
+ │ │ └─ Skim agent (codebase context)
555
+ <!-- learning:end -->
517
556
  │ ├─ Phase 3: Explore Requirements (PARALLEL)
518
557
  │ │ ├─ Explore: User perspective
519
558
  │ │ ├─ 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
 
@@ -52,41 +57,35 @@ Read `.release/RELEASE-FLOW.md`:
52
57
 
53
58
  ### Phase 1b: Load Context
54
59
 
55
- **Produces:** DECISIONS_CONTEXT, FEATURE_KNOWLEDGE
60
+ <!-- learning:on -->
61
+ **Produces:** DECISIONS_CONTEXT, FEATURE_KNOWLEDGE, FEATURE_KNOWLEDGE_RULES
62
+ <!-- learning:off -->
63
+ **Produces:** FEATURE_KNOWLEDGE, FEATURE_KNOWLEDGE_RULES
64
+ <!-- learning:end -->
56
65
 
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`):
66
+ <!-- learning:on -->
67
+ {{settings.settings_resolve()}}
58
68
 
59
- ```bash
60
- git -C "{start}" rev-parse --path-format=absolute --show-toplevel --git-common-dir
61
- ```
62
-
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:
69
+ {{decisions_gate()}}
64
70
 
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.
71
+ {{decisions_locate()}}
70
72
 
71
73
  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
74
 
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.
75
+ <!-- learning:end -->
76
+ {{knowledge_load()}}
74
77
 
75
- Pass both to all subsequent agents via their input contracts.
78
+ <!-- learning:on -->
79
+ Pass `DECISIONS_CONTEXT` and `FEATURE_KNOWLEDGE` only to agents whose contract declares them; the Validate and Git agents this command spawns do not.
80
+ <!-- learning:off -->
81
+ Pass `FEATURE_KNOWLEDGE` only to agents whose contract declares it; the Validate and Git agents this command spawns do not.
82
+ <!-- learning:end -->
76
83
 
77
84
  ### Phase 1c: Resolve the Evidence Policy
78
85
 
79
86
  **Produces:** EVIDENCE_POLICY, ISSUE_REQUIRED, APPLY_CONVENTIONS, REQUIRE_NON_AUTHOR_APPROVAL
80
87
 
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.
88
+ {{evidence_policy()}}
90
89
 
91
90
  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
91
 
@@ -230,7 +229,11 @@ On completion:
230
229
  │ └─ Read .release/RELEASE-FLOW.md (learned) or proceed to detect (fresh)
231
230
  │
232
231
  ├─ Phase 1b: Load Context
233
- │ └─ Load DECISIONS_CONTEXT and FEATURE_KNOWLEDGE for downstream agents
232
+ <!-- learning:on -->
233
+ │ └─ Load DECISIONS_CONTEXT and FEATURE_KNOWLEDGE for the agents that declare them
234
+ <!-- learning:off -->
235
+ │ └─ Load FEATURE_KNOWLEDGE for the agents that declare it
236
+ <!-- learning:end -->
234
237
  │
235
238
  ├─ Phase 2: Detect Release Process (first run only)
236
239
  │ └─ 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.
@@ -66,7 +80,11 @@ Generate topic slug from the research question (kebab-case, lowercase, no articl
66
80
 
67
81
  Only if `codebase` type is in RESEARCH_PLAN.
68
82
 
83
+ <!-- learning:on -->
84
+ Spawn `Agent(subagent_type="Skim")` with `LEARNING` from the settings line, targeting codebase areas relevant to the research question.
85
+ <!-- learning:off -->
69
86
  Spawn `Agent(subagent_type="Skim")` targeting codebase areas relevant to the research question.
87
+ <!-- learning:end -->
70
88
 
71
89
  Skip and set ORIENT_OUTPUT = "(none)" if `codebase` type is not in RESEARCH_PLAN.
72
90
 
@@ -79,8 +97,10 @@ Spawn 2-5 `Agent(subagent_type="Research")` agents **in a single message** (para
79
97
 
80
98
  Each Research agent receives:
81
99
  - `RESEARCH_TYPE`, `RESEARCH_QUESTION`, `OUTPUT_PATH` from RESEARCH_PLAN
100
+ <!-- learning:on -->
82
101
  - `DECISIONS_CONTEXT`: From Phase 1
83
- - `FEATURE_KNOWLEDGE`: From Phase 1
102
+ <!-- learning:end -->
103
+ - `FEATURE_KNOWLEDGE`: `{feature_knowledge}` from Phase 1
84
104
  - `ORIENT_OUTPUT`: Only for `codebase` type
85
105
  - `WORKTREE_PATH`: If in a worktree context
86
106
 
@@ -111,7 +131,7 @@ If external research was skipped due to tool unavailability: inform user.
111
131
 
112
132
  ### Phase 7: Feature Knowledge Creation (Conditional)
113
133
 
114
- **Requires:** RESEARCH_SUMMARY, DECISIONS_CONTEXT
134
+ **Requires:** RESEARCH_SUMMARY
115
135
  **Produces:** FEATURE_KNOWLEDGE_STATUS (created | skipped)
116
136
 
117
137
  1. If `codebase` type was not in RESEARCH_PLAN → skip
@@ -137,7 +157,11 @@ Research findings saved to `{worktree}/.devflow/docs/research/{topic-slug}/{YYYY
137
157
  ```
138
158
  /research (orchestrator)
139
159
  │
160
+ <!-- learning:on -->
140
161
  ├─ Phase 1: Load Decisions (Orchestrator-Local)
162
+ <!-- learning:off -->
163
+ ├─ Phase 1: Load Context (Orchestrator-Local)
164
+ <!-- learning:end -->
141
165
  │
142
166
  ├─ Phase 2: Requirements
143
167
  │ └─ 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.
@@ -30,7 +31,7 @@ Process issues from code review reports: triage every issue through the blast-ra
30
31
 
31
32
  1. **Discover resolvable worktrees** using the `devflow:worktree-support` skill discovery algorithm:
32
33
  - Run `git worktree list --porcelain` → parse, filter (skip protected/detached/mid-rebase), dedup by branch, sort by recent commit
33
- - See the `devflow:worktree-support` skill for the full 7-step algorithm and canonical protected branch list
34
+ - Invoke the `devflow:worktree-support` skill, then Read its `references/discovery.md` from the skill's base directory for the full 7-step algorithm; the canonical protected branch list stays in the skill
34
35
  - Additional filter: must have unresolved reviews (latest review directory has no `resolution-summary.md`)
35
36
  2. **If `--path` flag provided:** use only that worktree, skip discovery
36
37
  **`--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 +90,25 @@ For each worktree:
89
90
 
90
91
  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
92
 
93
+ <!-- learning:on -->
92
94
  #### Step 0d: Load Project Decisions
95
+ <!-- learning:off -->
96
+ #### Step 0d: Load Project Context
97
+ <!-- learning:end -->
93
98
 
94
- **Produces:** DECISIONS_CONTEXT, FEATURE_KNOWLEDGE, EVIDENCE_POLICY, ISSUE_REQUIRED, APPLY_CONVENTIONS, REQUIRE_NON_AUTHOR_APPROVAL, REVIEW_PUBLICATION, RESOLUTION_TS
99
+ <!-- learning:on -->
100
+ **Produces:** DECISIONS_CONTEXT, FEATURE_KNOWLEDGE, FEATURE_KNOWLEDGE_RULES, EVIDENCE_POLICY, ISSUE_REQUIRED, APPLY_CONVENTIONS, REQUIRE_NON_AUTHOR_APPROVAL, REVIEW_PUBLICATION, RESOLUTION_TS
101
+ <!-- learning:off -->
102
+ **Produces:** FEATURE_KNOWLEDGE, FEATURE_KNOWLEDGE_RULES, EVIDENCE_POLICY, ISSUE_REQUIRED, APPLY_CONVENTIONS, REQUIRE_NON_AUTHOR_APPROVAL, REVIEW_PUBLICATION, RESOLUTION_TS
103
+ <!-- learning:end -->
95
104
 
96
- {{decisions_load()}}
105
+ {{settings.settings_resolve()}}
97
106
 
107
+ {{decisions_load()}}
108
+ <!-- learning:on -->
98
109
  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
110
 
111
+ <!-- learning:end -->
100
112
  {{knowledge_load()}}
101
113
 
102
114
  Pass `FEATURE_KNOWLEDGE` to the Triage agent in Phase 2.
@@ -159,7 +171,11 @@ Parse `THREAD_MAP` from Git agent output. If Git agent returns `TRACEABILITY: DE
159
171
  ### Phase 2: Global Triage
160
172
 
161
173
  **Produces:** TRIAGE_RESULTS
174
+ <!-- learning:on -->
162
175
  **Requires:** ISSUES, DIFF_FILES, DECISIONS_CONTEXT, FEATURE_KNOWLEDGE, PR_DESCRIPTION
176
+ <!-- learning:off -->
177
+ **Requires:** ISSUES, DIFF_FILES, FEATURE_KNOWLEDGE, PR_DESCRIPTION
178
+ <!-- learning:end -->
163
179
 
164
180
  Spawn a single global Triage agent for ALL issues:
165
181
 
@@ -168,11 +184,15 @@ Agent(subagent_type="Triage"):
168
184
  "ISSUES: {all_issues}
169
185
  DIFF_FILES: {diff_files}
170
186
  WORKTREE_PATH: {worktree_path} (omit if cwd)
187
+ <!-- learning:on -->
171
188
  DECISIONS_CONTEXT: {decisions_context}
189
+ <!-- learning:end -->
172
190
  FEATURE_KNOWLEDGE: {feature_knowledge}
173
191
  PR_DESCRIPTION: <pr-description>{pr_description}</pr-description>
174
192
  Triage every issue: collapse duplicates first, then apply the blast-radius disposition matrix to each group's primary. Assign exactly one verdict per issue.
193
+ <!-- learning:on -->
175
194
  Follow devflow:apply-decisions to Read full ADR/PF bodies on demand.
195
+ <!-- learning:end -->
176
196
  Follow devflow:apply-feature-knowledge for FEATURE_KNOWLEDGE."
177
197
  ```
178
198
 
@@ -185,8 +205,10 @@ Wait for Triage agent to complete before proceeding. Parse verdict ledger from T
185
205
  - **TECH_DEBT**: Architectural overhaul only — LAST RESORT
186
206
  - **DUPLICATE**: Collapsed duplicate issue — carries `duplicate_of: <primary-id>` referencing the non-DUPLICATE primary; inherits the primary's outcome
187
207
 
208
+ <!-- learning:on -->
188
209
  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
210
 
211
+ <!-- learning:end -->
190
212
  **Triage agent completeness assertion:** Verify the parsed ledger against ISSUES before proceeding:
191
213
  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
214
  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,20 +232,26 @@ Otherwise, batch FIX_NOW issues for Code agent execution. **DUPLICATE issues are
210
232
  ### Phase 4: Fix (Code agent × N)
211
233
 
212
234
  **Produces:** CODE_AGENT_RESULTS
235
+ <!-- learning:on -->
213
236
  **Requires:** BATCHES, DECISIONS_CONTEXT, FEATURE_KNOWLEDGE
237
+ <!-- learning:off -->
238
+ **Requires:** BATCHES, FEATURE_KNOWLEDGE
239
+ <!-- learning:end -->
214
240
 
215
241
  For each batch, spawn Code agent with `OPERATION: issue-fix` and `PUSH: false`:
216
242
 
217
243
  ```
218
244
  Agent(subagent_type="Code"):
219
- "TASK_ID: resolve-{batch-id}
220
- OPERATION: issue-fix
245
+ "OPERATION: issue-fix
246
+ TASK_ID: resolve-{batch-id}
221
247
  ISSUES: {fix_now_issues_in_batch}
222
248
  SCOPE: {risk_tier_per_issue}
223
249
  PUSH: false
224
250
  CREATE_PR: false
225
251
  WORKTREE_PATH: {worktree_path} (omit if cwd)
252
+ <!-- learning:on -->
226
253
  DECISIONS_CONTEXT: {decisions_context}
254
+ <!-- learning:end -->
227
255
  FEATURE_KNOWLEDGE: {feature_knowledge}
228
256
  COMPLIANCE_FRAMEWORKS: {COMPLIANCE_FRAMEWORKS}
229
257
  Fix only the listed pre-classified FIX_NOW issues. Do not re-litigate dispositions.
@@ -262,7 +290,8 @@ Agent(subagent_type="Simplify", run_in_background=false):
262
290
  "TASK_DESCRIPTION: Issue resolution fixes
263
291
  WORKTREE_PATH: {worktree_path} (omit if cwd)
264
292
  FILES_CHANGED: {list of files modified by Code agents}
265
- Simplify and refine the fixes for clarity and consistency"
293
+ Simplify and refine the fixes for clarity and consistency
294
+ Commit any improvements with a conventional-commit message."
266
295
  ```
267
296
 
268
297
  ### Phase 7: Verification Gate
@@ -290,13 +319,16 @@ Run build, typecheck, lint, test. Report pass/fail with failure details."
290
319
  - Spawn Code agent with fix context:
291
320
  ```
292
321
  Agent(subagent_type="Code"):
293
- "TASK_ID: resolve-{batch-id}-valfix-{count}
294
- OPERATION: validation-fix
322
+ "OPERATION: validation-fix
323
+ TASK_ID: resolve-{batch-id}-valfix-{count}
295
324
  VALIDATION_FAILURES: {parsed failures from Validate agent}
296
325
  SCOPE: Fix only the listed failures, no other changes
297
326
  PUSH: false
298
327
  CREATE_PR: false
299
328
  WORKTREE_PATH: {worktree_path} (omit if cwd)
329
+ <!-- learning:on -->
330
+ DECISIONS_CONTEXT: {decisions_context}
331
+ <!-- learning:end -->
300
332
  COMPLIANCE_FRAMEWORKS: {COMPLIANCE_FRAMEWORKS}"
301
333
  ```
302
334
  - Loop back to re-validate
@@ -329,14 +361,28 @@ If `fork_no_push` is set → skip: "Cannot push to fork — skipping CI validati
329
361
 
330
362
  Otherwise, for each worktree with fixes:
331
363
 
332
- <!-- PATTERN: ci-status-gate — shared polling/classification/budget logic; context-specific preamble lives outside this block -->
333
- 1. Spawn `Agent(subagent_type="Git")` with `OPERATION: check-ci-status` and `WORKTREE_PATH`.
364
+ `PR_NUMBER` is the worktree's `pr_number` from Phase 0; when it is absent, skip: "No PR/CI configured, skipping CI validation."
365
+
366
+ **Push first, outside the gate block.** The gate waits on the pushed head, so push once more with the gate's own command — never forced, and no retry:
367
+
368
+ ```bash
369
+ git -C {worktree} push; echo "exit=$?"
370
+ ```
371
+
372
+ Phase 7 has pushed already, so this is a no-op unless the head moved since. `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.
373
+
374
+ <!-- PATTERN: ci-status-gate -->
375
+ 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 is one wait of at most 570 seconds and prints one line, `CI <STATUS> pr=… head=… failing=… pending=… waited=…` (INDETERMINATE adds `reason=…`). A missing or unparseable line, a status outside the six below, or a non-zero exit is INDETERMINATE.
334
376
  2. **If PASSING** → proceed to next phase.
335
377
  3. **If NO_PR or NO_CI** → skip: "No PR/CI configured, skipping CI validation." Proceed to next phase.
336
- 4. **If PENDING** → poll every 60 seconds (global budget, see step 7). Re-spawn Git agent each poll. If PASSING → proceed. If still PENDING after budget exhausted → report "CI still running — verify manually before merging" and proceed.
337
- 5. **If INDETERMINATE** → poll as PENDING within the same budget. If still INDETERMINATE after budget exhausted → report "CI status unknown — verify manually before merging" and proceed.
338
- 6. **If FAILING** → report failing checks. Spawn `Agent(subagent_type="Code")` with `COMPLIANCE_FRAMEWORKS` to fix CI failures based on check names and failure context. After fix, push and re-check. Max 2 fix attempts. If still failing → report failures and proceed.
339
- 7. **Total budget**: max 10 polls and max 2 fix attempts across all check/fix cycles combined. If the budget is exhausted, report current status and proceed.
378
+ 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.
379
+ 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.
380
+ <!-- learning:on -->
381
+ 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`, `DECISIONS_CONTEXT` 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.
382
+ <!-- learning:off -->
383
+ 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.
384
+ <!-- learning:end -->
385
+ 7. **Budget**: at most 3 waits and 2 fixes in all, per worktree. When one is spent, report the current status and proceed.
340
386
  <!-- /PATTERN: ci-status-gate -->
341
387
 
342
388
  ### Phase 9: Manage Debt (Sequential)
@@ -369,7 +415,7 @@ After manage-debt completes:
369
415
 
370
416
  **Step 9b-0: Re-verify stale test-plan items**
371
417
 
372
- Run this step only when this run's Phase 7 push succeeded — the one way /resolve moves the PR head — and a PR is known; otherwise skip it and Step 9b-3, and record `STALE_REVERIFICATION` as `SKIPPED (head unchanged)`. Detection needs no Git agent: from the worktree root, run the evidence script, which re-derives every test-plan state at the new head and writes the stale TP lines whose text the PR's trusted evidence record vouches for:
418
+ Run this step only when a push of this run succeeded — Phase 7's, or the push of Phase 8's gate — and a PR is known; otherwise skip it and Step 9b-3, and record `STALE_REVERIFICATION` as `SKIPPED (head unchanged)`. Detection needs no Git agent: from the worktree root, run the evidence script, which re-derives every test-plan state at the new head and writes the stale TP lines whose text the PR's trusted evidence record vouches for:
373
419
 
374
420
  ```bash
375
421
  cd {worktree} && node "$HOME/.devflow/scripts/verify-evidence.cjs" verify --pr {pr_number} --stale-out "{TARGET_DIR_REL}/stale-plan.md"; echo "exit=$?"
@@ -521,7 +567,7 @@ Final gate: {PASS | FAILED after N attempts}
521
567
  - Resolution comment: {POSTED | POSTED+TRUNCATED | SKIPPED (already posted) | SKIPPED (publication off) | SKIPPED (no PR) | DEGRADED (reason)}
522
568
  - Publication: {FULL (private repo) | FULL (config override) | STUB (public repository) | OFF (publication disabled by config) | STUB (visibility undeterminable) | STUB (evidence policy)}
523
569
  - Thread replies: {COMPLETE | PARTIAL | TRUNCATED | SKIPPED (reason) | DEGRADED (reason)}
524
- - Push: {pushed | skipped (no fixes) | skipped (cannot push to fork)}
570
+ - Push: {pushed (Phase 7, a CI-fix push, or both) | skipped (no fixes) | skipped (cannot push to fork) | DEGRADED (ci push failed)}
525
571
  - Test-plan re-verification: {Test plan: n stale, m re-verified | SKIPPED (head unchanged) | DEGRADED (reason)}
526
572
  - Test-plan evidence: {the EVIDENCE line's VERIFIED-CI + ATTESTED-LOCAL / total, then the Body / Comment line | SKIPPED (reason) | DEGRADED (reason)}
527
573
 
@@ -546,7 +592,11 @@ In multi-worktree mode, report results per worktree with aggregate summary.
546
592
  │ ├─ Step 0a: git worktree list → filter resolvable
547
593
  │ ├─ Step 0b: Git agent (validate-branch) per worktree [parallel] ← + DIFF_FILES
548
594
  │ ├─ Step 0c: Target latest review directory per worktree
595
+ <!-- learning:on -->
549
596
  │ └─ Step 0d: Load project decisions → DECISIONS_CONTEXT + EVIDENCE_POLICY + REVIEW_PUBLICATION
597
+ <!-- learning:off -->
598
+ │ └─ Step 0d: Load project context → EVIDENCE_POLICY + REVIEW_PUBLICATION
599
+ <!-- learning:end -->
550
600
  │
551
601
  ├─ Phase 1: Parse issues from TARGET_DIR + extract confidence %
552
602
  │
@@ -569,7 +619,7 @@ In multi-worktree mode, report results per worktree with aggregate summary.
569
619
  ├─ Phase 7: Verification Gate [Validate agent, haiku] + push + Code agent validation-fix loop ≤2
570
620
  │
571
621
  ├─ Phase 8: CI Status Gate (conditional — skipped if no fixes or verification FAILED)
572
- │ └─ Git agent (check-ci-status) → poll/fix loop
622
+ │ └─ push, then ci-wait.cjs (inline, one wait ≤ 570 s) → Code agent on FAILING (3 waits + 2 fixes per worktree)
573
623
  │
574
624
  ├─ Phase 9: Git agent (manage-debt) — FIX_SEPARATE + TECH_DEBT → backfill Tracked={ISSUE_REF} (or TRACEABILITY: DEGRADED on failure)
575
625
  │ SEQUENTIAL across worktrees
@@ -640,12 +690,14 @@ Written in Phase 5 (Collect Results) to `{TARGET_DIR}/resolution-summary.md`:
640
690
  **Review**: {TARGET_DIR_REL}
641
691
  **Command**: /resolve
642
692
 
693
+ <!-- learning:on -->
643
694
  ## Decisions Citations
644
695
 
645
696
  - {decision applied or pitfall avoided, stated in words — never its ID} — {batch-id}, {issue-id}
646
697
 
647
698
  (Omit section if no citations were made)
648
699
 
700
+ <!-- learning:end -->
649
701
  ## Statistics
650
702
  | Metric | Value |
651
703
  |--------|-------|