devflow-kit 3.6.0 → 3.8.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 (197) hide show
  1. package/CHANGELOG.md +438 -1
  2. package/README.md +15 -11
  3. package/dist/agents/code.md +9 -15
  4. package/dist/agents/design.md +1 -1
  5. package/dist/agents/fix.md +11 -13
  6. package/dist/agents/git.md +1 -1
  7. package/dist/agents/harden.md +1 -1
  8. package/dist/agents/refactor.md +7 -10
  9. package/dist/agents/review.md +6 -4
  10. package/dist/agents/skim.md +2 -2
  11. package/dist/agents/triage.md +2 -2
  12. package/dist/cli/commands/capture.js +1 -1
  13. package/dist/cli/commands/curation-move-io.js +102 -0
  14. package/dist/cli/commands/curation-move-step.js +374 -0
  15. package/dist/cli/commands/{learning.js → curation.js} +302 -99
  16. package/dist/cli/commands/gate-level-prompts.js +426 -0
  17. package/dist/cli/commands/gates.js +299 -0
  18. package/dist/cli/commands/init-seed.js +16 -5
  19. package/dist/cli/commands/init.js +263 -54
  20. package/dist/cli/commands/memory.js +20 -2
  21. package/dist/cli/commands/prompt-io.js +37 -0
  22. package/dist/cli/commands/uninstall.js +81 -9
  23. package/dist/cli.js +4 -2
  24. package/dist/commands/bug-analysis.md +25 -36
  25. package/dist/commands/code-review.md +77 -73
  26. package/dist/commands/debug.md +5 -5
  27. package/dist/commands/dynamic-build.md +76 -83
  28. package/dist/commands/dynamic-plan.md +5 -5
  29. package/dist/commands/dynamic-profile.md +5 -5
  30. package/dist/commands/dynamic-tickets.md +5 -5
  31. package/dist/commands/explore.md +6 -6
  32. package/dist/commands/implement.md +68 -102
  33. package/dist/commands/plan.md +19 -29
  34. package/dist/commands/release.md +5 -5
  35. package/dist/commands/research.md +6 -6
  36. package/dist/commands/resolve.md +29 -31
  37. package/dist/commands/self-review.md +5 -13
  38. package/dist/core/assets.js +20 -20
  39. package/dist/core/curate-tuning-config.js +5 -6
  40. package/dist/core/curation-move-notice.js +84 -0
  41. package/dist/core/curation-move-skip.js +36 -0
  42. package/dist/core/curation-move.js +35 -0
  43. package/dist/core/curation-queue-cleanup.js +134 -0
  44. package/dist/core/curation-store.js +98 -0
  45. package/dist/core/{learning-variants.js → curation-variants.js} +65 -41
  46. package/dist/core/echo-value.js +48 -0
  47. package/dist/core/evidence-policy.js +18 -6
  48. package/dist/core/feature-switch.js +95 -19
  49. package/dist/core/fs-atomic.js +1 -1
  50. package/dist/core/gate-level.js +221 -0
  51. package/dist/core/git.js +16 -14
  52. package/dist/core/ledger-root.js +82 -22
  53. package/dist/core/linked-path.js +4 -4
  54. package/dist/core/manifest-lock.js +238 -0
  55. package/dist/core/manifest.js +84 -24
  56. package/dist/core/migrations.js +1 -13
  57. package/dist/core/model-discovery.js +7 -1
  58. package/dist/core/observations.js +2 -2
  59. package/dist/core/plugins.js +15 -15
  60. package/dist/core/pool.js +26 -0
  61. package/dist/core/project-paths.js +103 -34
  62. package/dist/core/queue-drain.js +2 -2
  63. package/dist/core/tracked-areas.js +35 -0
  64. package/dist/core/tracker.js +6 -34
  65. package/dist/{learning-off → curation-off}/agents/code.md +9 -15
  66. package/dist/{learning-off → curation-off}/agents/fix.md +11 -13
  67. package/dist/{learning-off → curation-off}/agents/refactor.md +7 -10
  68. package/dist/{learning-off → curation-off}/agents/review.md +5 -3
  69. package/dist/{learning-off → curation-off}/agents/triage.md +1 -1
  70. package/dist/{learning-off → curation-off}/commands/bug-analysis.md +20 -31
  71. package/dist/{learning-off → curation-off}/commands/code-review.md +74 -70
  72. package/dist/{learning-off → curation-off}/commands/debug.md +2 -2
  73. package/dist/{learning-off → curation-off}/commands/dynamic-build.md +73 -80
  74. package/dist/{learning-off → curation-off}/commands/explore.md +2 -2
  75. package/dist/{learning-off → curation-off}/commands/implement.md +65 -99
  76. package/dist/{learning-off → curation-off}/commands/plan.md +15 -25
  77. package/dist/{learning-off → curation-off}/commands/resolve.md +26 -28
  78. package/dist/{learning-off → curation-off}/commands/self-review.md +2 -10
  79. package/dist/hud/components/{learning-counts.js → curation-counts.js} +36 -17
  80. package/dist/hud/config.js +1 -1
  81. package/dist/hud/index.js +6 -6
  82. package/dist/hud/render.js +3 -3
  83. package/dist/skills/git/references/pr/validate-branch.md +8 -5
  84. package/dist/skills/git/references/tracker/github/ensure-pr-ready.md +20 -14
  85. package/dist/skills/git/references/tracker/jira/ensure-pr-ready.md +20 -20
  86. package/dist/skills/git/references/tracker/linear/ensure-pr-ready.md +20 -20
  87. package/dist/targets/claude-code/{learning-install.js → curation-install.js} +99 -67
  88. package/dist/targets/claude-code/installer.js +15 -15
  89. package/dist/targets/claude-code/language-stamp.js +5 -5
  90. package/dist/targets/claude-code/post-install.js +2 -2
  91. package/dist/targets/claude-code/tracker-servers.js +1 -1
  92. package/package.json +3 -2
  93. package/src/assets/agents/_partials/_code.mds +16 -17
  94. package/src/assets/agents/code.mds +4 -7
  95. package/src/assets/agents/curate.md +12 -14
  96. package/src/assets/agents/debug.mds +6 -6
  97. package/src/assets/agents/design.mds +18 -18
  98. package/src/assets/agents/fix.mds +6 -5
  99. package/src/assets/agents/git.mds +1 -1
  100. package/src/assets/agents/harden.mds +7 -7
  101. package/src/assets/agents/knowledge.mds +23 -23
  102. package/src/assets/agents/refactor.mds +2 -2
  103. package/src/assets/agents/research.mds +15 -15
  104. package/src/assets/agents/review.mds +45 -43
  105. package/src/assets/agents/skim.mds +11 -11
  106. package/src/assets/agents/synthesize.md +2 -2
  107. package/src/assets/agents/triage.mds +22 -22
  108. package/src/assets/agents/validate.md +13 -26
  109. package/src/assets/commands/_partials/_decisions.mds +13 -13
  110. package/src/assets/commands/_partials/_engine.mds +8 -8
  111. package/src/assets/commands/_partials/_knowledge.mds +29 -15
  112. package/src/assets/commands/_partials/_preamble.mds +4 -4
  113. package/src/assets/commands/_partials/_settings.mds +3 -3
  114. package/src/assets/commands/_partials/_wave.mds +17 -24
  115. package/src/assets/commands/bug-analysis.mds +37 -48
  116. package/src/assets/commands/code-review.mds +90 -86
  117. package/src/assets/commands/debug.mds +14 -14
  118. package/src/assets/commands/dynamic-build.mds +78 -78
  119. package/src/assets/commands/dynamic-plan.mds +22 -22
  120. package/src/assets/commands/dynamic-profile.mds +2 -2
  121. package/src/assets/commands/dynamic-tickets.mds +8 -8
  122. package/src/assets/commands/explore.mds +20 -20
  123. package/src/assets/commands/implement.mds +92 -118
  124. package/src/assets/commands/plan.mds +41 -51
  125. package/src/assets/commands/release.mds +12 -12
  126. package/src/assets/commands/research.mds +19 -19
  127. package/src/assets/commands/resolve.mds +56 -50
  128. package/src/assets/commands/self-review.mds +20 -20
  129. package/src/assets/mds/git/_ops.mds +3 -1
  130. package/src/assets/mds/git/_ops_pr.mds +1 -1
  131. package/src/assets/mds/git/_ops_steps.mds +13 -7
  132. package/src/assets/mds/git/_pr.mds +7 -4
  133. package/src/assets/mds/tracker/_common.mds +23 -12
  134. package/src/assets/mds/tracker/_github.mds +2 -9
  135. package/src/assets/mds/tracker/_jira.mds +2 -15
  136. package/src/assets/mds/tracker/_linear.mds +2 -15
  137. package/src/assets/rules/quality.md +1 -0
  138. package/src/assets/scripts/ci-wait.cjs +22 -4
  139. package/src/assets/scripts/claude-md-audit.cjs +66 -51
  140. package/src/assets/scripts/hooks/background-memory-update +406 -97
  141. package/src/assets/scripts/hooks/capture-prompt +12 -12
  142. package/src/assets/scripts/hooks/capture-question +11 -11
  143. package/src/assets/scripts/hooks/capture-turn +12 -12
  144. package/src/assets/scripts/hooks/{learning-lock → curation-lock} +2 -2
  145. package/src/assets/scripts/hooks/curation-move +293 -0
  146. package/src/assets/scripts/hooks/ensure-devflow-init +45 -13
  147. package/src/assets/scripts/hooks/ensure-proxy +4 -4
  148. package/src/assets/scripts/hooks/ensure-root-gitignore +4 -4
  149. package/src/assets/scripts/hooks/git-marker +81 -0
  150. package/src/assets/scripts/hooks/json-helper.cjs +145 -51
  151. package/src/assets/scripts/hooks/json-parse +19 -4
  152. package/src/assets/scripts/hooks/lib/curation-move.cjs +1582 -0
  153. package/src/assets/scripts/hooks/lib/{learning-store.cjs → curation-store.cjs} +242 -118
  154. package/src/assets/scripts/hooks/lib/decisions-format.cjs +3 -3
  155. package/src/assets/scripts/hooks/lib/mkdir-lock.cjs +24 -7
  156. package/src/assets/scripts/hooks/lib/project-paths.cjs +132 -39
  157. package/src/assets/scripts/hooks/lib/render-decisions.cjs +34 -22
  158. package/src/assets/scripts/hooks/lib/tracked-areas.cjs +259 -0
  159. package/src/assets/scripts/hooks/memory-permission +358 -0
  160. package/src/assets/scripts/hooks/memory-worker +1 -1
  161. package/src/assets/scripts/hooks/pre-compact-memory +6 -16
  162. package/src/assets/scripts/hooks/queue-append +228 -103
  163. package/src/assets/scripts/hooks/resolve-project-root +2 -2
  164. package/src/assets/scripts/hooks/session-start-context +145 -71
  165. package/src/assets/scripts/hooks/session-start-memory +27 -46
  166. package/src/assets/scripts/lib/project-config.cjs +31 -9
  167. package/src/assets/scripts/resolve-base.cjs +1043 -0
  168. package/src/assets/scripts/resolve-settings.cjs +238 -46
  169. package/src/assets/skills/agent-references/SKILL.md +9 -2
  170. package/src/assets/skills/agent-references/references/commands/code-review-levels.md +19 -0
  171. package/src/assets/skills/agent-references/references/commands/implement-levels.md +27 -0
  172. package/src/assets/skills/agent-references/references/commands/implement-revalidate.md +6 -4
  173. package/src/assets/skills/agent-references/references/commands/plan-levels.md +40 -0
  174. package/src/assets/skills/agent-references/references/commands/resolve-levels.md +24 -0
  175. package/src/assets/skills/agent-references/references/synthesize/planning.md +9 -22
  176. package/src/assets/skills/agent-references/references/synthesize/review.md +11 -11
  177. package/src/assets/skills/apply-decisions/SKILL.md +1 -1
  178. package/src/assets/skills/docs-framework/SKILL.md +7 -7
  179. package/src/assets/skills/docs-framework/references/patterns.md +3 -4
  180. package/src/assets/skills/quality-gates/SKILL.md +1 -1
  181. package/src/assets/skills/worktree-support/references/roots.md +2 -2
  182. package/templates/lint-pack/.lint-pack.conf +86 -0
  183. package/templates/lint-pack/README.md +190 -0
  184. package/templates/lint-pack/lint-pack.sh +905 -0
  185. package/dist/core/learning-queue-cleanup.js +0 -27
  186. package/dist/core/learning-store.js +0 -61
  187. /package/dist/{learning-off → curation-off}/agents/debug.md +0 -0
  188. /package/dist/{learning-off → curation-off}/agents/design.md +0 -0
  189. /package/dist/{learning-off → curation-off}/agents/harden.md +0 -0
  190. /package/dist/{learning-off → curation-off}/agents/knowledge.md +0 -0
  191. /package/dist/{learning-off → curation-off}/agents/research.md +0 -0
  192. /package/dist/{learning-off → curation-off}/agents/skim.md +0 -0
  193. /package/dist/{learning-off → curation-off}/commands/dynamic-plan.md +0 -0
  194. /package/dist/{learning-off → curation-off}/commands/dynamic-profile.md +0 -0
  195. /package/dist/{learning-off → curation-off}/commands/dynamic-tickets.md +0 -0
  196. /package/dist/{learning-off → curation-off}/commands/release.md +0 -0
  197. /package/dist/{learning-off → curation-off}/commands/research.md +0 -0
@@ -14,8 +14,6 @@ output-dir: dist/commands
14
14
 
15
15
  Orchestrate design planning from requirements discovery through gap analysis to implementation design. Produces a machine-readable design artifact consumed by `/implement`.
16
16
 
17
- The orchestrator only spawns agents and gates — all analytical work is done by agents.
18
-
19
17
  ## Usage
20
18
 
21
19
  ```
@@ -43,8 +41,6 @@ $ARGUMENTS
43
41
 
44
42
  ## Clarification Gates
45
43
 
46
- **MANDATORY**: Three gates that must complete before proceeding.
47
-
48
44
  | Gate | Phase | Purpose |
49
45
  |------|-------|---------|
50
46
  | Gate 0 | Phase 1 | Requirements discovery before exploration |
@@ -108,17 +104,17 @@ If the user says "skip" or "just proceed" — skip remaining questions, present
108
104
 
109
105
  **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.
110
106
 
111
- <!-- learning:on -->
107
+ <!-- curation:on -->
112
108
  #### Phase 2: Orient + Load Decisions
113
- <!-- learning:off -->
109
+ <!-- curation:off -->
114
110
  #### Phase 2: Orient
115
- <!-- learning:end -->
111
+ <!-- curation:end -->
116
112
 
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
+ <!-- curation:on -->
114
+ **Produces:** SKIM_CONTEXT, DECISIONS_CONTEXT, FEATURE_KNOWLEDGE, FEATURE_KNOWLEDGE_RULES, GATE_LEVEL
115
+ <!-- curation:off -->
116
+ **Produces:** SKIM_CONTEXT, FEATURE_KNOWLEDGE, FEATURE_KNOWLEDGE_RULES, GATE_LEVEL
117
+ <!-- curation:end -->
122
118
  **Requires:** CONFIRMED_SCOPE
123
119
 
124
120
  {{settings.settings_resolve()}}
@@ -128,9 +124,9 @@ Spawn Skim agent for codebase context:
128
124
  ```
129
125
  Agent(subagent_type="Skim"):
130
126
  "Orient in codebase for design planning: {feature/issues}
131
- <!-- learning:on -->
132
- LEARNING: {LEARNING from the settings line}
133
- <!-- learning:end -->
127
+ <!-- curation:on -->
128
+ CURATION: {CURATION from the settings line}
129
+ <!-- curation:end -->
134
130
  Run rskim on source directories (NOT repo root) to identify:
135
131
  - Existing patterns and conventions in the affected area
136
132
  - File structure and module boundaries
@@ -142,22 +138,28 @@ Return codebase context for requirements analysis."
142
138
  {{docs_root()}}
143
139
 
144
140
  {{decisions_load()}}
145
- <!-- learning:on -->
141
+ <!-- curation:on -->
146
142
  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 as one shared slice — prior decisions constrain design, known pitfalls inform gap analysis. Design agents use `devflow:apply-decisions` to Read full entry bodies on demand.
147
143
 
148
- <!-- learning:end -->
144
+ <!-- curation:end -->
149
145
  {{knowledge_load()}}
150
146
 
151
- <!-- learning:on -->
147
+ <!-- curation:on -->
152
148
  Pass `FEATURE_KNOWLEDGE` to Explore and Design agents. Pass `DECISIONS_CONTEXT` to Design agents only.
153
- <!-- learning:off -->
149
+ <!-- curation:off -->
154
150
  Pass `FEATURE_KNOWLEDGE` to Explore and Design agents.
155
- <!-- learning:end -->
151
+ <!-- curation:end -->
152
+
153
+ **Gate level.** At `standard` or `lean`, once per run, run `d="${CLAUDE_CONFIG_DIR:-}"; case "$d" in /*) ;; *) d="$HOME/.claude" ;; esac; printf '%s\n' "$d"` in Bash and Read `<that directory>/skills/devflow:agent-references/references/commands/plan-levels.md` with the Read tool, and apply it to Phases 3-14.
154
+
155
+ - No row or rule overrides the next two lines.
156
+ - If the Read fails, or a row is missing or malformed, set `GATE_LEVEL` to `full` and say `level reference unreadable: full applied`.
157
+ - Security runs as its own Design spawn, and the design review runs, at every level and on every Revise pass.
156
158
 
157
159
  #### Phase 3: Explore Requirements (Parallel)
158
160
 
159
161
  **Produces:** EXPLORE_OUTPUTS
160
- **Requires:** SKIM_CONTEXT
162
+ **Requires:** SKIM_CONTEXT, GATE_LEVEL
161
163
 
162
164
  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.
163
165
 
@@ -173,8 +175,6 @@ Spawn 4 `Agent(subagent_type="Explore")` agents **in a single message**, each wi
173
175
  **Produces:** EXPLORATION_SYNTHESIS
174
176
  **Requires:** EXPLORE_OUTPUTS
175
177
 
176
- **WAIT** for Phase 3 to complete.
177
-
178
178
  ```
179
179
  Agent(subagent_type="Synthesize"):
180
180
  "Synthesize EXPLORATION outputs for: {feature/issues}
@@ -190,11 +190,11 @@ Combine into: user needs, similar features, constraints, failure modes"
190
190
  #### Phase 5: Gap Analysis (Parallel)
191
191
 
192
192
  **Produces:** GAP_OUTPUTS, COMPLIANCE_ACTIVE, COMPLIANCE_FRAMEWORKS
193
- <!-- learning:on -->
193
+ <!-- curation:on -->
194
194
  **Requires:** EXPLORATION_SYNTHESIS, SKIM_CONTEXT, DECISIONS_CONTEXT
195
- <!-- learning:off -->
195
+ <!-- curation:off -->
196
196
  **Requires:** EXPLORATION_SYNTHESIS, SKIM_CONTEXT
197
- <!-- learning:end -->
197
+ <!-- curation:end -->
198
198
 
199
199
  {{compliance_gate()}}
200
200
 
@@ -220,9 +220,9 @@ Each Design agent receives:
220
220
  - Focus: (their assigned focus from table)
221
221
  - Exploration synthesis from Phase 4
222
222
  - Skim agent context from Phase 2
223
- <!-- learning:on -->
223
+ <!-- curation:on -->
224
224
  - `DECISIONS_CONTEXT` (index from Phase 2)
225
- <!-- learning:end -->
225
+ <!-- curation:end -->
226
226
  - `COMPLIANCE_FOCUS_DIRECTIVE` (compliance focus only)
227
227
  - Multi-issue: all issue bodies
228
228
 
@@ -232,21 +232,21 @@ Each Design agent receives:
232
232
  Agent(subagent_type="Design"):
233
233
  "Mode: gap-analysis
234
234
  Focus: {completeness|architecture|security|performance|compliance|consistency|dependencies}
235
- <!-- learning:on -->
235
+ <!-- curation:on -->
236
236
  DECISIONS_CONTEXT: {decisions_context}
237
- <!-- learning:end -->
237
+ <!-- curation:end -->
238
238
  FEATURE_KNOWLEDGE: {feature_knowledge}
239
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)
240
+ Run `d="${CLAUDE_CONFIG_DIR:-}"; case "$d" in /*) ;; *) d="$HOME/.claude" ;; esac; printf '%s\n' "$d"` 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)
241
241
  Artifacts:
242
242
  Feature/Issues: {feature description or issue bodies}
243
243
  Exploration synthesis: {Phase 4 output}
244
244
  Codebase context: {Phase 2 output}
245
- <!-- learning:on -->
245
+ <!-- curation:on -->
246
246
  Analyze only your assigned focus area. Follow devflow:apply-decisions for DECISIONS_CONTEXT.
247
- <!-- learning:off -->
247
+ <!-- curation:off -->
248
248
  Analyze only your assigned focus area.
249
- <!-- learning:end -->
249
+ <!-- curation:end -->
250
250
  Cite evidence from provided artifacts."
251
251
  ```
252
252
 
@@ -255,8 +255,6 @@ Cite evidence from provided artifacts."
255
255
  **Produces:** GAP_SYNTHESIS
256
256
  **Requires:** GAP_OUTPUTS
257
257
 
258
- **WAIT** for Phase 5 to complete.
259
-
260
258
  ```
261
259
  Agent(subagent_type="Synthesize"):
262
260
  "Synthesize GAP ANALYSIS outputs for: {feature/issues}
@@ -317,8 +315,6 @@ Spawn 4 `Agent(subagent_type="Explore")` agents **in a single message**, each wi
317
315
  **Produces:** IMPL_EXPLORATION_SYNTHESIS
318
316
  **Requires:** IMPL_EXPLORE_OUTPUTS
319
317
 
320
- **WAIT** for Phase 8 to complete.
321
-
322
318
  ```
323
319
  Agent(subagent_type="Synthesize"):
324
320
  "Synthesize IMPLEMENTATION EXPLORATION outputs for: {feature/issues}
@@ -332,7 +328,7 @@ Combine into: patterns to follow, integration points, reusable code, edge cases"
332
328
  **Produces:** PLAN_OUTPUTS
333
329
  **Requires:** IMPL_EXPLORATION_SYNTHESIS, GAP_SYNTHESIS
334
330
 
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.
331
+ Spawn 3 `Agent(subagent_type="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.
336
332
 
337
333
  | Focus | Output |
338
334
  |-------|--------|
@@ -347,8 +343,6 @@ Implementation steps planner: include explicit gap mitigations (from Phase 6) in
347
343
  **Produces:** PLANNING_SYNTHESIS
348
344
  **Requires:** PLAN_OUTPUTS
349
345
 
350
- **WAIT** for Phase 10 to complete.
351
-
352
346
  ```
353
347
  Agent(subagent_type="Synthesize"):
354
348
  "Synthesize PLANNING outputs for: {feature/issues}
@@ -536,6 +530,7 @@ Display completion summary:
536
530
  - Issue URL (if created or enriched) — and any `TRACEABILITY: DEGRADED ({reason})` lines from the Git agent
537
531
  - Gap analysis summary (N blocking, M should-address)
538
532
  - Design review summary (N anti-patterns found, M mitigated in plan)
533
+ - Gate level: {GATE_LEVEL}, with any level note
539
534
  - Suggested next step: `/implement {artifact-path}` or `/implement #{issue-number}`
540
535
 
541
536
  ---
@@ -549,11 +544,11 @@ Display completion summary:
549
544
  │ ├─ Phase 1: GATE 0 - Requirements Discovery ⛔ MANDATORY
550
545
  │ │ ├─ Git agent (fetch-issue / fetch-issues-batch) - issue mode only
551
546
  │ │ └─ AskUserQuestion: Validate interpretation
552
- <!-- learning:on -->
547
+ <!-- curation:on -->
553
548
  │ ├─ Phase 2: Orient + Load Decisions
554
- <!-- learning:off -->
549
+ <!-- curation:off -->
555
550
  │ ├─ Phase 2: Orient
556
- <!-- learning:end -->
551
+ <!-- curation:end -->
557
552
  │ ├─ Phase 3: Explore Requirements (PARALLEL)
558
553
  │ └─ Phase 4: Synthesize Exploration
559
554
  │
@@ -583,13 +578,8 @@ Display completion summary:
583
578
 
584
579
  ## Principles
585
580
 
586
- 1. **Orchestration only** — Command spawns agents, never does agent work itself
587
- 2. **Three mandatory gates** — Gate 0 (understand), Gate 1 (scope+gaps), Gate 2 (plan+review); none may be skipped
588
- 3. **Parallel execution** — Explore phases and gap analysis run in parallel; synthesis phases wait
589
- 4. **Evidence-based gaps** — Every gap cites specific text; no speculation
590
- 5. **Scope ruthlessly** — Small, focused plans ship faster; gate 1 enforces scope discipline
591
- 6. **Strict delegation** — Never synthesize, analyze, or plan in main session; always spawn agents
592
- 7. **Design artifacts are machine-readable** — `/implement` can consume the YAML frontmatter directly
581
+ 1. **Scope ruthlessly** — Small, focused plans ship faster; gate 1 enforces scope discipline
582
+ 2. **Strict delegation** — Never synthesize, analyze, or plan in main session; always spawn agents
593
583
 
594
584
  ## Error Handling
595
585
 
@@ -55,31 +55,31 @@ Read `.release/RELEASE-FLOW.md`:
55
55
 
56
56
  ### Phase 1b: Load Context
57
57
 
58
- <!-- learning:on -->
58
+ <!-- curation:on -->
59
59
  **Produces:** DECISIONS_CONTEXT, FEATURE_KNOWLEDGE, FEATURE_KNOWLEDGE_RULES
60
- <!-- learning:off -->
60
+ <!-- curation:off -->
61
61
  **Produces:** FEATURE_KNOWLEDGE, FEATURE_KNOWLEDGE_RULES
62
- <!-- learning:end -->
62
+ <!-- curation:end -->
63
63
 
64
- <!-- learning:on -->
64
+ <!-- curation:on -->
65
65
  {{settings.settings_resolve()}}
66
66
 
67
67
  {{decisions_gate()}}
68
68
 
69
69
  {{decisions_locate()}}
70
70
 
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`.
71
+ Read `{ledger}/.devflow/curation/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
73
  {{decisions_slice()}}
74
74
 
75
- <!-- learning:end -->
75
+ <!-- curation:end -->
76
76
  {{knowledge_load()}}
77
77
 
78
- <!-- learning:on -->
78
+ <!-- curation:on -->
79
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 -->
80
+ <!-- curation:off -->
81
81
  Pass `FEATURE_KNOWLEDGE` only to agents whose contract declares it; the Validate and Git agents this command spawns do not.
82
- <!-- learning:end -->
82
+ <!-- curation:end -->
83
83
 
84
84
  ### Phase 1c: Resolve the Evidence Policy
85
85
 
@@ -234,11 +234,11 @@ On completion:
234
234
  │ └─ Read .release/RELEASE-FLOW.md (learned) or proceed to detect (fresh)
235
235
  │
236
236
  ├─ Phase 1b: Load Context
237
- <!-- learning:on -->
237
+ <!-- curation:on -->
238
238
  │ └─ Load DECISIONS_CONTEXT and FEATURE_KNOWLEDGE for the agents that declare them
239
- <!-- learning:off -->
239
+ <!-- curation:off -->
240
240
  │ └─ Load FEATURE_KNOWLEDGE for the agents that declare it
241
- <!-- learning:end -->
241
+ <!-- curation:end -->
242
242
  │
243
243
  ├─ Phase 2: Detect Release Process (first run only)
244
244
  │ └─ Tiered scan: package.json, CI workflows, git history
@@ -34,29 +34,29 @@ $ARGUMENTS
34
34
 
35
35
  ## Phases
36
36
 
37
- <!-- learning:on -->
37
+ <!-- curation:on -->
38
38
  ### Phase 1: Load Decisions (Orchestrator-Local)
39
- <!-- learning:off -->
39
+ <!-- curation:off -->
40
40
  ### Phase 1: Load Context (Orchestrator-Local)
41
- <!-- learning:end -->
41
+ <!-- curation:end -->
42
42
 
43
- <!-- learning:on -->
43
+ <!-- curation:on -->
44
44
  **Produces:** DECISIONS_CONTEXT, FEATURE_KNOWLEDGE, FEATURE_KNOWLEDGE_RULES
45
- <!-- learning:off -->
45
+ <!-- curation:off -->
46
46
  **Produces:** FEATURE_KNOWLEDGE, FEATURE_KNOWLEDGE_RULES
47
- <!-- learning:end -->
47
+ <!-- curation:end -->
48
48
 
49
49
  {{docs_root()}}
50
50
 
51
- <!-- learning:on -->
51
+ <!-- curation:on -->
52
52
  {{settings.settings_resolve()}}
53
53
 
54
- <!-- learning:end -->
54
+ <!-- curation:end -->
55
55
  {{decisions_load()}}
56
- <!-- learning:on -->
56
+ <!-- curation:on -->
57
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.
58
58
 
59
- <!-- learning:end -->
59
+ <!-- curation:end -->
60
60
  {{knowledge_load()}}
61
61
 
62
62
  Use `FEATURE_KNOWLEDGE` **locally** for research framing. Pass to each Research agent in Phase 4.
@@ -82,11 +82,11 @@ Analyze the research question to infer research types needed (min 2, max 5). For
82
82
 
83
83
  Only if `codebase` type is in RESEARCH_PLAN.
84
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 -->
85
+ <!-- curation:on -->
86
+ Spawn `Agent(subagent_type="Skim")` with `CURATION` from the settings line, targeting codebase areas relevant to the research question.
87
+ <!-- curation:off -->
88
88
  Spawn `Agent(subagent_type="Skim")` targeting codebase areas relevant to the research question.
89
- <!-- learning:end -->
89
+ <!-- curation:end -->
90
90
 
91
91
  Skip and set ORIENT_OUTPUT = "(none)" if `codebase` type is not in RESEARCH_PLAN.
92
92
 
@@ -99,9 +99,9 @@ Spawn 2-5 `Agent(subagent_type="Research")` agents **in a single message** (para
99
99
 
100
100
  Each Research agent receives:
101
101
  - `RESEARCH_TYPE`, `RESEARCH_QUESTION`, `OUTPUT_PATH` from RESEARCH_PLAN
102
- <!-- learning:on -->
102
+ <!-- curation:on -->
103
103
  - `DECISIONS_CONTEXT`: From Phase 1
104
- <!-- learning:end -->
104
+ <!-- curation:end -->
105
105
  - `FEATURE_KNOWLEDGE`: `{feature_knowledge}` from Phase 1
106
106
  - `ORIENT_OUTPUT`: Only for `codebase` type
107
107
  - `WORKTREE_PATH`: If in a worktree context
@@ -164,11 +164,11 @@ Research findings saved to `{worktree}/.devflow/docs/research/{topic-slug}/{YYYY
164
164
  ```
165
165
  /research (orchestrator)
166
166
  │
167
- <!-- learning:on -->
167
+ <!-- curation:on -->
168
168
  ├─ Phase 1: Load Decisions (Orchestrator-Local)
169
- <!-- learning:off -->
169
+ <!-- curation:off -->
170
170
  ├─ Phase 1: Load Context (Orchestrator-Local)
171
- <!-- learning:end -->
171
+ <!-- curation:end -->
172
172
  │
173
173
  ├─ Phase 2: Requirements
174
174
  │ └─ Infer 2-5 research types from question
@@ -2,7 +2,7 @@
2
2
  description: Process review issues - validate with Triage agent, fix with Code agent, verify with Validate agent
3
3
  output-dir: dist/commands
4
4
  ---
5
- @import { knowledge_load, knowledge_writeback } from "./_partials/_knowledge.mds"
5
+ @import { knowledge_load, knowledge_writeback_after_load } from "./_partials/_knowledge.mds"
6
6
  @import { decisions_load } from "./_partials/_decisions.mds"
7
7
  @import { evidence_policy } from "./_partials/_evidence_policy.mds"
8
8
  @import { publication_gate } from "./_partials/_publication.mds"
@@ -91,25 +91,25 @@ For each worktree:
91
91
 
92
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.
93
93
 
94
- <!-- learning:on -->
94
+ <!-- curation:on -->
95
95
  #### Step 0d: Load Project Decisions
96
- <!-- learning:off -->
96
+ <!-- curation:off -->
97
97
  #### Step 0d: Load Project Context
98
- <!-- learning:end -->
98
+ <!-- curation:end -->
99
99
 
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 -->
100
+ <!-- curation:on -->
101
+ **Produces:** DECISIONS_CONTEXT, FEATURE_KNOWLEDGE, FEATURE_KNOWLEDGE_RULES, EVIDENCE_POLICY, ISSUE_REQUIRED, APPLY_CONVENTIONS, REQUIRE_NON_AUTHOR_APPROVAL, REVIEW_PUBLICATION, RESOLUTION_TS, GATE_LEVEL
102
+ <!-- curation:off -->
103
+ **Produces:** FEATURE_KNOWLEDGE, FEATURE_KNOWLEDGE_RULES, EVIDENCE_POLICY, ISSUE_REQUIRED, APPLY_CONVENTIONS, REQUIRE_NON_AUTHOR_APPROVAL, REVIEW_PUBLICATION, RESOLUTION_TS, GATE_LEVEL
104
+ <!-- curation:end -->
105
105
 
106
106
  {{settings.settings_resolve()}}
107
107
 
108
108
  {{decisions_load()}}
109
- <!-- learning:on -->
109
+ <!-- curation:on -->
110
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.
111
111
 
112
- <!-- learning:end -->
112
+ <!-- curation:end -->
113
113
  {{knowledge_load()}}
114
114
 
115
115
  Pass `FEATURE_KNOWLEDGE` to the Triage agent in Phase 2.
@@ -124,6 +124,12 @@ Resolve this per worktree — unlike the evidence policy above, the settings lin
124
124
 
125
125
  Set it per worktree, from that worktree's lens, and pass that worktree's `COMPLIANCE_DIRECTIVE` to each of its Code and Fix spawns, on a line of its own.
126
126
 
127
+ **Gate level.** Each worktree keeps its own `GATE_LEVEL`. When any is `standard` or `lean`, once per run, run `d="${CLAUDE_CONFIG_DIR:-}"; case "$d" in /*) ;; *) d="$HOME/.claude" ;; esac; printf '%s\n' "$d"` in Bash and Read `<that directory>/skills/devflow:agent-references/references/commands/resolve-levels.md` with the Read tool, and apply each row to the phase it names, as the reference says.
128
+
129
+ - No row or rule overrides the next two lines.
130
+ - If the Read fails, or the file has no `## Phases` heading with the `| Phase | standard | lean |` header, or a row breaks its grammar, apply no row in any worktree, keep every `GATE_LEVEL` and say `level reference unreadable: no level rows applied`.
131
+ - No level changes the Triage security gate or the ESCALATED route. The Verification Gate, the CI gate and the compliance directive run at every level.
132
+
127
133
  **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.
128
134
 
129
135
  ### Phase 1: Parse Issues
@@ -176,11 +182,11 @@ Parse `THREAD_MAP` from Git agent output. If Git agent returns `TRACEABILITY: DE
176
182
  ### Phase 2: Global Triage
177
183
 
178
184
  **Produces:** TRIAGE_RESULTS
179
- <!-- learning:on -->
185
+ <!-- curation:on -->
180
186
  **Requires:** ISSUES, DIFF_FILES, DECISIONS_CONTEXT, FEATURE_KNOWLEDGE, PR_DESCRIPTION
181
- <!-- learning:off -->
187
+ <!-- curation:off -->
182
188
  **Requires:** ISSUES, DIFF_FILES, FEATURE_KNOWLEDGE, PR_DESCRIPTION
183
- <!-- learning:end -->
189
+ <!-- curation:end -->
184
190
 
185
191
  Spawn a single global Triage agent for ALL issues:
186
192
 
@@ -189,15 +195,15 @@ Agent(subagent_type="Triage"):
189
195
  "ISSUES: {all_issues}
190
196
  DIFF_FILES: {diff_files}
191
197
  WORKTREE_PATH: {worktree_path} (omit if cwd)
192
- <!-- learning:on -->
198
+ <!-- curation:on -->
193
199
  DECISIONS_CONTEXT: {decisions_context}
194
- <!-- learning:end -->
200
+ <!-- curation:end -->
195
201
  FEATURE_KNOWLEDGE: {feature_knowledge}
196
202
  PR_DESCRIPTION: <pr-description>{pr_description}</pr-description>
197
203
  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 -->
204
+ <!-- curation:on -->
199
205
  Follow devflow:apply-decisions to Read full ADR/PF bodies on demand.
200
- <!-- learning:end -->
206
+ <!-- curation:end -->
201
207
  Follow devflow:apply-feature-knowledge for FEATURE_KNOWLEDGE."
202
208
  ```
203
209
 
@@ -210,10 +216,10 @@ Wait for Triage agent to complete before proceeding. Parse verdict ledger from T
210
216
  - **TECH_DEBT**: Architectural overhaul only — LAST RESORT
211
217
  - **DUPLICATE**: Collapsed duplicate issue — carries `duplicate_of: <primary-id>` referencing the non-DUPLICATE primary; inherits the primary's outcome
212
218
 
213
- <!-- learning:on -->
219
+ <!-- curation:on -->
214
220
  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.
215
221
 
216
- <!-- learning:end -->
222
+ <!-- curation:end -->
217
223
  **Triage agent completeness assertion:** Verify the parsed ledger against ISSUES before proceeding:
218
224
  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).
219
225
  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**:
@@ -227,21 +233,21 @@ Collect every decision and pitfall the Triage agent's Reasoning columns state, i
227
233
  **Produces:** BATCHES
228
234
  **Requires:** TRIAGE_RESULTS
229
235
 
230
- If FIX_NOW list is empty: skip to Phase 5 — write full summary (Phase 5), run manage-debt (Phase 9) if FIX_SEPARATE/TECH_DEBT exist, run thread resolution + resolution comment (Phase 9b), run merge readiness (Phase 9c), display results (Phase 10).
236
+ If FIX_NOW list is empty: skip to Phase 5, then run Phases 9, 9b, 9c and 10.
231
237
 
232
238
  Otherwise, batch FIX_NOW issues for Code agent execution. **DUPLICATE issues are never dispatched** — they inherit the primary's outcome:
233
- - **Same-file issues** → one batch (one Code agent per file, sequential for same-file pairs)
239
+ - **Same-file issues** → one batch (one Code agent per file)
234
240
  - **Distinct-file issues** → parallel Code agents
235
241
  - **Max 5 issues per batch** — chunk large sets
236
242
 
237
243
  ### Phase 4: Fix (Code agent × N)
238
244
 
239
245
  **Produces:** CODE_AGENT_RESULTS
240
- <!-- learning:on -->
246
+ <!-- curation:on -->
241
247
  **Requires:** BATCHES, DECISIONS_CONTEXT, FEATURE_KNOWLEDGE
242
- <!-- learning:off -->
248
+ <!-- curation:off -->
243
249
  **Requires:** BATCHES, FEATURE_KNOWLEDGE
244
- <!-- learning:end -->
250
+ <!-- curation:end -->
245
251
 
246
252
  For each batch, spawn Code agent with `OPERATION: issue-fix` and `PUSH: false`:
247
253
 
@@ -253,9 +259,9 @@ ISSUES: {fix_now_issues_in_batch}
253
259
  SCOPE: {risk_tier_per_issue}
254
260
  PUSH: false
255
261
  WORKTREE_PATH: {worktree_path} (omit if cwd)
256
- <!-- learning:on -->
262
+ <!-- curation:on -->
257
263
  DECISIONS_CONTEXT: {decisions_context}
258
- <!-- learning:end -->
264
+ <!-- curation:end -->
259
265
  FEATURE_KNOWLEDGE: {feature_knowledge}
260
266
  {COMPLIANCE_DIRECTIVE}
261
267
  Fix only the listed pre-classified FIX_NOW issues. Do not re-litigate dispositions.
@@ -272,9 +278,9 @@ Collect from each Code agent:
272
278
  ### Phase 5: Write resolution-summary.md
273
279
 
274
280
  **Produces:** RESOLUTION_FILE (early write for compaction safety)
275
- **Requires:** TRIAGE_RESULTS, CODE_AGENT_RESULTS, TARGET_DIR, TARGET_DIR_REL, BRANCH_INFO, RESOLUTION_TS
281
+ **Requires:** TRIAGE_RESULTS, CODE_AGENT_RESULTS, TARGET_DIR, TARGET_DIR_REL, BRANCH_INFO, RESOLUTION_TS, GATE_LEVEL
276
282
 
277
- **Immediately write `resolution-summary.md`** to `{TARGET_DIR}` using the Write tool. Do this now — not in Phase 9 — while results are fresh in context. This ensures the record is persisted even if later phases (Polish, Verification Gate, CI gate, Tech Debt) trigger context compaction.
283
+ **Immediately write `resolution-summary.md`** to `{TARGET_DIR}` using the Write tool. Do this now — not in Phase 9 — while results are fresh in context.
278
284
 
279
285
  Set `Tracked` for FIX_SEPARATE and TECH_DEBT items to `(pending)` — to be backfilled after Phase 9 manage-debt (or `TRACEABILITY: DEGRADED ({reason})` if manage-debt degrades).
280
286
 
@@ -285,7 +291,7 @@ Use the template from the Output Artifact section below.
285
291
  ### Phase 6: Polish
286
292
 
287
293
  **Produces:** POLISH_RESULT
288
- **Requires:** CODE_AGENT_RESULTS
294
+ **Requires:** CODE_AGENT_RESULTS, GATE_LEVEL
289
295
 
290
296
  If any fixes were made, spawn Polish agent to refine the changed code:
291
297
 
@@ -329,9 +335,9 @@ Run build, typecheck, lint, test. Report pass/fail with failure details."
329
335
  SCOPE: Fix only the listed failures, no other changes
330
336
  PUSH: false
331
337
  WORKTREE_PATH: {worktree_path} (omit if cwd)
332
- <!-- learning:on -->
338
+ <!-- curation:on -->
333
339
  DECISIONS_CONTEXT: {decisions_context}
334
- <!-- learning:end -->
340
+ <!-- curation:end -->
335
341
  {COMPLIANCE_DIRECTIVE}"
336
342
  ```
337
343
  - Loop back to re-validate
@@ -349,7 +355,7 @@ git -C {worktree} push
349
355
 
350
356
  **If `fork_no_push` is set:** do not push. Record `Push: skipped — cannot push to fork` under `## Verification`, and skip Phase 8 — no pushed commit exists for CI to check.
351
357
 
352
- **Route after push:** VERIFICATION_STATUS = PASS → continue to Phase 8 (CI gate). VERIFICATION_STATUS = FAILED → skip Phase 8; proceed directly to Phase 9 (manage-debt), then Phase 9b (thread resolution + resolution comment), then Phase 9c (merge readiness), then Phase 10 (report). VERIFICATION_STATUS = SKIPPED → skip Phase 8 (no fixes applied); proceed to Phase 9 (manage-debt), then Phase 9b (thread resolution + resolution comment), then Phase 9c (merge readiness, when non-author approval is required), then Phase 10 (report).
358
+ **Route after push:** VERIFICATION_STATUS = PASS → continue to Phase 8 (CI gate). FAILED or SKIPPED → skip Phase 8 and continue with Phase 9 and the later phases in order.
353
359
 
354
360
  ### Phase 8: CI Status Gate (Conditional)
355
361
 
@@ -380,11 +386,11 @@ Phase 7 has pushed already, so this is a no-op unless the head moved since. `exi
380
386
  3. **If NO_PR or NO_CI** → skip: "No PR/CI configured, skipping CI validation." Proceed to next phase.
381
387
  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.
382
388
  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.
383
- <!-- learning:on -->
389
+ <!-- curation:on -->
384
390
  6. **If FAILING** and fewer than 2 fixes have run → report the failing checks from the line. Spawn `Agent(subagent_type="Fix")` whose prompt opens with `OPERATION: ci-fix`, with `COMPLIANCE_DIRECTIVE` (when it is not empty), `CI_FAILURES`, `DECISIONS_CONTEXT` and `PUSH: false`; `CI_FAILURES` holds the failing-check names from the line and nothing else, because the 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 -->
391
+ <!-- curation:off -->
386
392
  6. **If FAILING** and fewer than 2 fixes have run → report the failing checks from the line. Spawn `Agent(subagent_type="Fix")` whose prompt opens with `OPERATION: ci-fix`, with `COMPLIANCE_DIRECTIVE` (when it is not empty), `CI_FAILURES` and `PUSH: false`; `CI_FAILURES` holds the failing-check names from the line and nothing else, because the 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 -->
393
+ <!-- curation:end -->
388
394
  7. **Budget**: at most 3 waits and 2 fixes in all, per worktree. When one is spent, report the current status and proceed.
389
395
  <!-- /PATTERN: ci-status-gate -->
390
396
 
@@ -523,7 +529,7 @@ If the script prints a `TRACEABILITY: DEGRADED` line: warn, proceed to Phase 10.
523
529
 
524
530
  ### Phase 10: Report
525
531
 
526
- **Requires:** BRANCH_INFO, TARGET_DIR, PR_COMMENT, THREAD_RESOLUTION_RESULT
532
+ **Requires:** BRANCH_INFO, TARGET_DIR, PR_COMMENT, THREAD_RESOLUTION_RESULT, GATE_LEVEL
527
533
 
528
534
  The resolution summary was already written to `{TARGET_DIR}/resolution-summary.md` in Phase 5 (updated by Phase 7, Phase 9 and Phase 9b-1). Display results to the user:
529
535
 
@@ -533,6 +539,7 @@ The resolution summary was already written to `{TARGET_DIR}/resolution-summary.m
533
539
  **Branch**: {branch}
534
540
  **Reviews Processed**: {n} reports from {TARGET_DIR}
535
541
  **Total Issues**: {n}
542
+ **Gate level**: {GATE_LEVEL, with any level note}
536
543
 
537
544
  ### Results
538
545
  | Outcome | Count |
@@ -576,7 +583,7 @@ Final gate: {PASS | FAILED after N attempts}
576
583
 
577
584
  In multi-worktree mode, report results per worktree with aggregate summary.
578
585
 
579
- {{knowledge_writeback()}}
586
+ {{knowledge_writeback_after_load()}}
580
587
 
581
588
  ## Architecture
582
589
 
@@ -584,15 +591,15 @@ In multi-worktree mode, report results per worktree with aggregate summary.
584
591
  /resolve (orchestrator - spawns agents only)
585
592
  │
586
593
  ├─ Phase 0: Worktree Discovery & Pre-flight
587
- ├─ Phase 1: Parse issues from TARGET_DIR + extract confidence %
594
+ ├─ Phase 1: Parse issues from TARGET_DIR
588
595
  ├─ Phase 1b: Fetch external threads (evidence policy required)
589
596
  ├─ Phase 2: Global Triage [Triage agent, opus, single agent]
590
- ├─ Phase 3: Batch FIX_NOW issues (skip if empty; DUPLICATE issues never dispatched)
591
- ├─ Phase 4: Fix [Code agent × N, OPERATION: issue-fix, PUSH: false]
597
+ ├─ Phase 3: Batch FIX_NOW issues
598
+ ├─ Phase 4: Fix [Code agent × N]
592
599
  ├─ Phase 5: Write resolution-summary.md (compaction safety; Tracked = "(pending)" or "(pending — TRACEABILITY: DEGRADED)" if manage-debt degrades)
593
- ├─ Phase 6: Polish [Polish agent]
600
+ ├─ Phase 6: Polish
594
601
  ├─ Phase 7: Verification Gate [Validate agent, haiku] + push + Fix agent validation-fix loop ≤2
595
- ├─ Phase 8: CI Status Gate (conditional — skipped if no fixes or verification FAILED)
602
+ ├─ Phase 8: CI Status Gate (conditional)
596
603
  ├─ Phase 9: Git agent (manage-debt) — FIX_SEPARATE + TECH_DEBT → backfill Tracked={ISSUE_REF} (or TRACEABILITY: DEGRADED on failure)
597
604
  │
598
605
  ├─ Phase 9b: Thread resolution + resolution comment
@@ -611,10 +618,9 @@ In multi-worktree mode, report results per worktree with aggregate summary.
611
618
  | Case | Handling |
612
619
  |------|----------|
613
620
  | No reviews exist | Check bug-analysis fallback (Step 0c-5b); if also absent, error and suggest `/code-review` or `/bug-analysis` |
614
- | All false positives | Normal completion, report shows 0 fixes |
615
621
  | Fix attempt fails | Revert changes, mark BLOCKED, continue others |
616
622
  | Issue dependencies | Sequential chain, skip dependents if predecessor blocked |
617
- | No actionable issues | Report "No issues to resolve" |
623
+ | No issues parsed | Report "No issues to resolve" |
618
624
  | Latest review already resolved | Check bug-analysis fallback (Step 0c-5b); if also absent, skip worktree and suggest `/code-review` or `/bug-analysis` |
619
625
  | `--review {timestamp}` in multi-worktree mode | Not supported — use `--path` + `--review` to target specific worktree + review |
620
626
  | gh/GitHub absent | manage-debt degrades (`TRACEABILITY: DEGRADED ({reason})`); Tracked stays `(pending — TRACEABILITY: DEGRADED ({reason}))` — recorded, not dropped |
@@ -629,9 +635,8 @@ In multi-worktree mode, report results per worktree with aggregate summary.
629
635
  ## Principles
630
636
 
631
637
  1. **Orchestration only** - Command spawns agents, doesn't do git/resolve work itself
632
- 2. **No agent grades its own homework** - Triage agent validates, Code agents fix, Validate agent verifies
633
- 3. **Git agent for git work** - All git operations go through Git agent; the CI wait, the evidence refresh and the merge-readiness check are inline scripts (plumbing, no model work)
634
- 4. **Traceability-aware** - Policy-gated ops (thread fetch/resolve, merge readiness) are skipped cleanly when the evidence policy does not ask for them; resolution comment (Phase 9b-2) is always-on; test-plan evidence is re-verified (≤1 Test agent) and refreshed only when this run moved the head (Steps 9b-0, 9b-3)
638
+ 2. **Git agent for git work** - All git operations go through Git agent; the CI wait, the evidence refresh and the merge-readiness check are inline scripts (plumbing, no model work)
639
+ 3. **Traceability-aware** - Policy-gated ops (thread fetch/resolve, merge readiness) are skipped cleanly when the evidence policy does not ask for them; resolution comment (Phase 9b-2) is always-on; test-plan evidence is re-verified (≤1 Test agent) and refreshed only when this run moved the head (Steps 9b-0, 9b-3)
635
640
 
636
641
  ## Output Artifact
637
642
 
@@ -644,15 +649,16 @@ Written in Phase 5 (Collect Results) to `{TARGET_DIR}/resolution-summary.md`:
644
649
  **Date**: {RESOLUTION_TS}
645
650
  **Review**: {TARGET_DIR_REL}
646
651
  **Command**: /resolve
652
+ **Gate level**: {GATE_LEVEL}
647
653
 
648
- <!-- learning:on -->
654
+ <!-- curation:on -->
649
655
  ## Decisions Citations
650
656
 
651
657
  - {decision applied or pitfall avoided, stated in words — never its ID} — {batch-id}, {issue-id}
652
658
 
653
659
  (Omit section if no citations were made)
654
660
 
655
- <!-- learning:end -->
661
+ <!-- curation:end -->
656
662
  ## Statistics
657
663
  | Metric | Value |
658
664
  |--------|-------|