devflow-kit 3.4.0 → 3.6.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 (221) hide show
  1. package/CHANGELOG.md +127 -0
  2. package/README.md +12 -8
  3. package/dist/agents/code.md +39 -182
  4. package/dist/agents/{diagnose.md → debug.md} +4 -4
  5. package/dist/agents/design.md +0 -1
  6. package/dist/agents/fix.md +165 -0
  7. package/dist/agents/git.md +31 -693
  8. package/dist/agents/{scrutinize.md → harden.md} +9 -6
  9. package/dist/agents/knowledge.md +8 -2
  10. package/dist/agents/refactor.md +133 -0
  11. package/dist/agents/research.md +6 -0
  12. package/dist/agents/review.md +0 -4
  13. package/dist/agents/skim.md +4 -0
  14. package/dist/agents/triage.md +8 -1
  15. package/dist/cli/agents-view/render.js +1 -1
  16. package/dist/cli/commands/behavior-prompts.js +77 -0
  17. package/dist/cli/commands/behavior.js +123 -0
  18. package/dist/cli/commands/flags.js +8 -2
  19. package/dist/cli/commands/init-seed.js +7 -3
  20. package/dist/cli/commands/init.js +75 -8
  21. package/dist/cli/commands/learning.js +12 -12
  22. package/dist/cli/commands/legacy-hooks.js +1 -1
  23. package/dist/cli/commands/rules.js +16 -0
  24. package/dist/cli/commands/tracker.js +112 -15
  25. package/dist/cli/commands/uninstall.js +111 -5
  26. package/dist/cli.js +2 -0
  27. package/dist/commands/bug-analysis.md +22 -18
  28. package/dist/commands/code-review.md +25 -29
  29. package/dist/commands/debug.md +36 -15
  30. package/dist/commands/dynamic-build.md +64 -78
  31. package/dist/commands/dynamic-plan.md +18 -14
  32. package/dist/commands/dynamic-profile.md +8 -6
  33. package/dist/commands/dynamic-tickets.md +19 -15
  34. package/dist/commands/explore.md +14 -14
  35. package/dist/commands/implement.md +122 -225
  36. package/dist/commands/plan.md +32 -47
  37. package/dist/commands/release.md +12 -7
  38. package/dist/commands/research.md +26 -15
  39. package/dist/commands/resolve.md +53 -92
  40. package/dist/commands/self-review.md +42 -42
  41. package/dist/core/agent-frontmatter.js +101 -0
  42. package/dist/core/agent-models.js +47 -11
  43. package/dist/core/compliance-compose.js +6 -4
  44. package/dist/core/{learning-tuning-config.js → curate-tuning-config.js} +14 -14
  45. package/dist/core/feature-switch.js +23 -2
  46. package/dist/core/flags.js +111 -0
  47. package/dist/core/learning-queue-cleanup.js +1 -1
  48. package/dist/core/manifest.js +11 -3
  49. package/dist/core/mds-variants.js +68 -26
  50. package/dist/core/migrations.js +63 -44
  51. package/dist/core/plugins.js +49 -70
  52. package/dist/core/project-paths.js +3 -7
  53. package/dist/core/proxy-log.js +1 -1
  54. package/dist/core/proxy-state.js +1 -1
  55. package/dist/core/tracker.js +120 -2
  56. package/dist/hud/codex-usage.js +247 -0
  57. package/dist/hud/components/codex-quota.js +37 -0
  58. package/dist/hud/components/usage-quota.js +1 -1
  59. package/dist/hud/config.js +1 -0
  60. package/dist/hud/index.js +16 -3
  61. package/dist/hud/render.js +3 -1
  62. package/dist/learning-off/agents/code.md +37 -180
  63. package/dist/learning-off/agents/{diagnose.md → debug.md} +4 -4
  64. package/dist/learning-off/agents/design.md +0 -1
  65. package/dist/learning-off/agents/fix.md +161 -0
  66. package/dist/learning-off/agents/{scrutinize.md → harden.md} +9 -6
  67. package/dist/learning-off/agents/knowledge.md +8 -2
  68. package/dist/learning-off/agents/refactor.md +129 -0
  69. package/dist/learning-off/agents/research.md +6 -0
  70. package/dist/learning-off/agents/review.md +0 -4
  71. package/dist/learning-off/agents/skim.md +4 -0
  72. package/dist/learning-off/agents/triage.md +8 -1
  73. package/dist/learning-off/commands/bug-analysis.md +12 -12
  74. package/dist/learning-off/commands/code-review.md +14 -22
  75. package/dist/learning-off/commands/debug.md +24 -8
  76. package/dist/learning-off/commands/dynamic-build.md +58 -74
  77. package/dist/learning-off/commands/dynamic-plan.md +12 -10
  78. package/dist/learning-off/commands/dynamic-profile.md +2 -2
  79. package/dist/learning-off/commands/dynamic-tickets.md +13 -11
  80. package/dist/learning-off/commands/explore.md +3 -7
  81. package/dist/learning-off/commands/implement.md +110 -217
  82. package/dist/learning-off/commands/plan.md +21 -39
  83. package/dist/learning-off/commands/release.md +7 -4
  84. package/dist/learning-off/commands/research.md +16 -9
  85. package/dist/learning-off/commands/resolve.md +42 -85
  86. package/dist/learning-off/commands/self-review.md +30 -34
  87. package/dist/skills/git/references/learn-conventions.md +27 -3
  88. package/dist/skills/git/references/pr/check-ci-status.md +19 -0
  89. package/dist/skills/git/references/pr/check-merge-readiness.md +21 -0
  90. package/dist/skills/git/references/pr/fetch-review-threads.md +30 -0
  91. package/dist/skills/git/references/pr/post-resolution-summary.md +18 -0
  92. package/dist/skills/git/references/pr/post-review-summary.md +20 -0
  93. package/dist/skills/git/references/pr/resolve-review-threads.md +28 -4
  94. package/dist/skills/git/references/pr/update-pr-evidence.md +17 -6
  95. package/dist/skills/git/references/pr/validate-branch.md +26 -0
  96. package/dist/skills/git/references/tracker/github/associate-release.md +24 -0
  97. package/dist/skills/git/references/tracker/github/backlink-shipped-issues.md +31 -1
  98. package/dist/skills/git/references/tracker/github/create-release.md +30 -1
  99. package/dist/skills/git/references/tracker/github/ensure-pr-ready.md +89 -2
  100. package/dist/skills/git/references/tracker/github/ensure-traceable-issue.md +16 -1
  101. package/dist/skills/git/references/tracker/github/fetch-issue.md +36 -1
  102. package/dist/skills/git/references/tracker/github/fetch-issues-batch.md +47 -1
  103. package/dist/skills/git/references/tracker/github/gather-release-evidence.md +25 -0
  104. package/dist/skills/git/references/tracker/github/manage-debt.md +21 -1
  105. package/dist/skills/git/references/tracker/github/post-wave-report.md +15 -1
  106. package/dist/skills/git/references/tracker/github/setup-task.md +41 -1
  107. package/dist/skills/git/references/tracker/jira/associate-release.md +24 -0
  108. package/dist/skills/git/references/tracker/jira/backlink-shipped-issues.md +31 -1
  109. package/dist/skills/git/references/tracker/jira/create-release.md +30 -1
  110. package/dist/skills/git/references/tracker/jira/ensure-pr-ready.md +89 -2
  111. package/dist/skills/git/references/tracker/jira/ensure-traceable-issue.md +16 -1
  112. package/dist/skills/git/references/tracker/jira/fetch-issue.md +36 -1
  113. package/dist/skills/git/references/tracker/jira/fetch-issues-batch.md +47 -1
  114. package/dist/skills/git/references/tracker/jira/gather-release-evidence.md +25 -0
  115. package/dist/skills/git/references/tracker/jira/manage-debt.md +21 -1
  116. package/dist/skills/git/references/tracker/jira/post-wave-report.md +15 -1
  117. package/dist/skills/git/references/tracker/jira/setup-task.md +41 -1
  118. package/dist/skills/git/references/tracker/linear/associate-release.md +24 -0
  119. package/dist/skills/git/references/tracker/linear/backlink-shipped-issues.md +31 -1
  120. package/dist/skills/git/references/tracker/linear/create-release.md +30 -1
  121. package/dist/skills/git/references/tracker/linear/ensure-pr-ready.md +89 -2
  122. package/dist/skills/git/references/tracker/linear/ensure-traceable-issue.md +16 -1
  123. package/dist/skills/git/references/tracker/linear/fetch-issue.md +36 -1
  124. package/dist/skills/git/references/tracker/linear/fetch-issues-batch.md +47 -1
  125. package/dist/skills/git/references/tracker/linear/gather-release-evidence.md +25 -0
  126. package/dist/skills/git/references/tracker/linear/manage-debt.md +21 -1
  127. package/dist/skills/git/references/tracker/linear/post-wave-report.md +15 -1
  128. package/dist/skills/git/references/tracker/linear/setup-task.md +41 -1
  129. package/dist/targets/claude-code/agent-type-owner.js +164 -0
  130. package/dist/targets/claude-code/behavior-install.js +111 -0
  131. package/dist/targets/claude-code/installer.js +177 -77
  132. package/dist/targets/claude-code/learning-install.js +9 -1
  133. package/dist/targets/claude-code/tracker-install.js +33 -16
  134. package/dist/targets/claude-code/tracker-servers.js +107 -0
  135. package/package.json +4 -3
  136. package/src/assets/agents/_partials/_code.mds +109 -0
  137. package/src/assets/agents/code.mds +18 -222
  138. package/src/assets/agents/{learning.md → curate.md} +22 -72
  139. package/src/assets/agents/{diagnose.mds → debug.mds} +4 -4
  140. package/src/assets/agents/design.mds +0 -1
  141. package/src/assets/agents/evaluate.md +11 -5
  142. package/src/assets/agents/explore.md +58 -0
  143. package/src/assets/agents/fix.mds +113 -0
  144. package/src/assets/agents/git.mds +31 -693
  145. package/src/assets/agents/{scrutinize.mds → harden.mds} +9 -6
  146. package/src/assets/agents/knowledge.mds +8 -2
  147. package/src/assets/agents/{simplify.md → polish.md} +7 -4
  148. package/src/assets/agents/refactor.mds +81 -0
  149. package/src/assets/agents/research.mds +6 -0
  150. package/src/assets/agents/review.mds +0 -4
  151. package/src/assets/agents/skim.mds +4 -0
  152. package/src/assets/agents/synthesize.md +26 -352
  153. package/src/assets/agents/test.md +10 -2
  154. package/src/assets/agents/tracker.md +20 -7
  155. package/src/assets/agents/triage.mds +8 -1
  156. package/src/assets/agents/validate.md +5 -0
  157. package/src/assets/commands/_partials/_compliance.mds +36 -0
  158. package/src/assets/commands/_partials/_decisions.mds +26 -6
  159. package/src/assets/commands/_partials/_engine.mds +17 -17
  160. package/src/assets/commands/_partials/_evidence_policy.mds +0 -17
  161. package/src/assets/commands/_partials/_knowledge.mds +14 -9
  162. package/src/assets/commands/_partials/_preamble.mds +5 -3
  163. package/src/assets/commands/_partials/_roster.mds +6 -5
  164. package/src/assets/commands/_partials/_wave.mds +2 -2
  165. package/src/assets/commands/bug-analysis.mds +10 -10
  166. package/src/assets/commands/code-review.mds +12 -22
  167. package/src/assets/commands/debug.mds +24 -2
  168. package/src/assets/commands/dynamic-build.mds +34 -51
  169. package/src/assets/commands/dynamic-plan.mds +4 -3
  170. package/src/assets/commands/dynamic-tickets.mds +5 -4
  171. package/src/assets/commands/explore.mds +1 -1
  172. package/src/assets/commands/implement.mds +108 -201
  173. package/src/assets/commands/plan.mds +19 -44
  174. package/src/assets/commands/release.mds +8 -3
  175. package/src/assets/commands/research.mds +14 -7
  176. package/src/assets/commands/resolve.mds +37 -82
  177. package/src/assets/commands/self-review.mds +27 -27
  178. package/src/assets/mds/.mdsroot +4 -0
  179. package/src/assets/mds/git/_ops.mds +383 -0
  180. package/src/assets/mds/git/_ops_pr.mds +201 -0
  181. package/src/assets/mds/git/_ops_steps.mds +147 -0
  182. package/src/assets/mds/git/_pr.mds +45 -50
  183. package/src/assets/mds/git/_references.mds +6 -3
  184. package/src/assets/mds/tracker/_common.mds +5 -5
  185. package/src/assets/mds/tracker/_contract.mds +4 -3
  186. package/src/assets/mds/tracker/_github.mds +60 -14
  187. package/src/assets/mds/tracker/_jira.mds +60 -14
  188. package/src/assets/mds/tracker/_linear.mds +60 -14
  189. package/src/assets/mds/tracker/_steps.mds +10 -9
  190. package/src/assets/rules/behavior.md +6 -0
  191. package/src/assets/scripts/hooks/assets/orchestrator-charter.md +5 -3
  192. package/src/assets/scripts/hooks/capture-prompt +1 -1
  193. package/src/assets/scripts/hooks/capture-question +1 -1
  194. package/src/assets/scripts/hooks/capture-turn +1 -1
  195. package/src/assets/scripts/hooks/json-helper.cjs +2 -2
  196. package/src/assets/scripts/hooks/lib/learning-store.cjs +1 -1
  197. package/src/assets/scripts/hooks/lib/project-paths.cjs +4 -10
  198. package/src/assets/scripts/hooks/preamble +1 -1
  199. package/src/assets/scripts/hooks/session-start-context +58 -45
  200. package/src/assets/scripts/verify-evidence.cjs +726 -9
  201. package/src/assets/skills/agent-references/SKILL.md +37 -0
  202. package/src/assets/skills/agent-references/references/commands/implement-evidence-asks.md +35 -0
  203. package/src/assets/skills/agent-references/references/commands/implement-revalidate.md +15 -0
  204. package/src/assets/skills/agent-references/references/curate/maintain.md +71 -0
  205. package/src/assets/skills/agent-references/references/synthesize/bug-analysis.md +71 -0
  206. package/src/assets/skills/agent-references/references/synthesize/design.md +36 -0
  207. package/src/assets/skills/agent-references/references/synthesize/exploration.md +38 -0
  208. package/src/assets/skills/agent-references/references/synthesize/planning.md +60 -0
  209. package/src/assets/skills/agent-references/references/synthesize/research.md +61 -0
  210. package/src/assets/skills/agent-references/references/synthesize/review.md +76 -0
  211. package/src/assets/skills/apply-decisions/SKILL.md +6 -4
  212. package/src/assets/skills/compliance/SKILL.md +1 -1
  213. package/src/assets/skills/docs-framework/SKILL.md +81 -84
  214. package/src/assets/skills/docs-framework/references/patterns.md +14 -25
  215. package/src/assets/skills/docs-framework/references/violations.md +7 -7
  216. package/src/assets/skills/gap-analysis/SKILL.md +0 -16
  217. package/src/assets/skills/gap-analysis/references/compliance.md +19 -0
  218. package/src/assets/skills/qa/SKILL.md +1 -1
  219. package/src/assets/skills/quality-gates/SKILL.md +7 -7
  220. package/src/assets/skills/quality-gates/references/report-template.md +7 -7
  221. package/dist/skills/git/references/pr/ensure-pr-ready.md +0 -24
@@ -5,7 +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 { compliance_gate } from "./_partials/_compliance.mds"
8
+ @import { compliance_gate, compliance_focus_inject } from "./_partials/_compliance.mds"
9
9
  @import { evidence_policy } from "./_partials/_evidence_policy.mds"
10
10
  @import { test_plan_line } from "./_partials/_plan_contract.mds"
11
11
  @import { issue_ref_grammar, issue_capture_contract } from "./_partials/_tracker.mds"
@@ -143,7 +143,7 @@ Return codebase context for requirements analysis."
143
143
 
144
144
  {{decisions_load()}}
145
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.
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 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
147
 
148
148
  <!-- learning:end -->
149
149
  {{knowledge_load()}}
@@ -159,7 +159,7 @@ Pass `FEATURE_KNOWLEDGE` to Explore and Design agents.
159
159
  **Produces:** EXPLORE_OUTPUTS
160
160
  **Requires:** SKIM_CONTEXT
161
161
 
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.
162
+ Spawn 4 `Agent(subagent_type="Explore")` agents **in a single message**, each with Skim agent context and `FEATURE_KNOWLEDGE: {feature_knowledge}` (from Phase 2). Include the instruction: "The FEATURE_KNOWLEDGE is a baseline — VALIDATE, EXTEND, and CORRECT it. For anything it already covers, cite its KB IDs (`{slug} KB-AP-n`) instead of restating the text. Focus on areas the feature knowledge doesn't cover and changes since it was last updated." Ask each agent for a final report of at most about 1,500 tokens: findings with file:line references, not file dumps.
163
163
 
164
164
  | Focus | Thoroughness | Find |
165
165
  |-------|-------------|------|
@@ -223,9 +223,11 @@ Each Design agent receives:
223
223
  <!-- learning:on -->
224
224
  - `DECISIONS_CONTEXT` (index from Phase 2)
225
225
  <!-- learning:end -->
226
- - `COMPLIANCE_FRAMEWORKS` (compliance focus only)
226
+ - `COMPLIANCE_FOCUS_DIRECTIVE` (compliance focus only)
227
227
  - Multi-issue: all issue bodies
228
228
 
229
+ {{compliance_focus_inject()}}
230
+
229
231
  ```
230
232
  Agent(subagent_type="Design"):
231
233
  "Mode: gap-analysis
@@ -234,7 +236,8 @@ Focus: {completeness|architecture|security|performance|compliance|consistency|de
234
236
  DECISIONS_CONTEXT: {decisions_context}
235
237
  <!-- learning:end -->
236
238
  FEATURE_KNOWLEDGE: {feature_knowledge}
237
- COMPLIANCE_FRAMEWORKS: {COMPLIANCE_FRAMEWORKS} (compliance focus only)
239
+ {COMPLIANCE_FOCUS_DIRECTIVE} (compliance focus only)
240
+ Resolve `${CLAUDE_CONFIG_DIR:-$HOME/.claude}` in Bash, then Read `<that directory>/skills/devflow:gap-analysis/references/compliance.md` with the Read tool and apply it as your focus patterns. (compliance focus only)
238
241
  Artifacts:
239
242
  Feature/Issues: {feature description or issue bodies}
240
243
  Exploration synthesis: {Phase 4 output}
@@ -300,7 +303,7 @@ User can:
300
303
  **Produces:** IMPL_EXPLORE_OUTPUTS
301
304
  **Requires:** SKIM_CONTEXT, ACCEPTED_SCOPE
302
305
 
303
- Spawn 4 Explore agents **in a single message**, each with Skim agent context + accepted scope. Ask each agent for a final report of at most about 1,500 tokens: findings with file:line references, not file dumps.
306
+ Spawn 4 `Agent(subagent_type="Explore")` agents **in a single message**, each with Skim agent context + accepted scope. Ask each agent for a final report of at most about 1,500 tokens: findings with file:line references, not file dumps.
304
307
 
305
308
  | Focus | Thoroughness | Find |
306
309
  |-------|-------------|------|
@@ -403,8 +406,9 @@ Use AskUserQuestion to present:
403
406
 
404
407
  User can:
405
408
  - **Accept** — proceed to output phases
406
- - **Revise** — re-run phases 10-12 with new constraints (loop back, no limit on revisions)
409
+ - **Revise** — when fewer than 2 revisions have run, re-run phases 10-12 with new constraints. Budget: at most 2 revisions, counted over the whole run
407
410
  - **Cancel** — stop gracefully, no artifact written
411
+ - **Restart /plan with these constraints** — offered in place of Revise once 2 revisions have run: stop gracefully, write no artifact, and print the constraints given so far for a fresh `/plan` run
408
412
 
409
413
  **MANDATORY**: Do not write design artifact until Gate 2 is confirmed.
410
414
 
@@ -419,8 +423,10 @@ User can:
419
423
 
420
424
  **Store design artifact:**
421
425
 
422
- **Pre-compute the artifact path** from the slug (it never changes after this):
423
- - If one issue: `{worktree}/.devflow/docs/design/{ISSUE_ID}-{topic-slug}.{YYYY-MM-DD_HHMM}.md` (the `docs-framework` skill's design-document pattern, e.g. `42-jwt-auth.2026-04-07_1430.md`)
426
+ **Load `devflow:docs-framework`** — Load via Skill tool: `devflow:docs-framework`, here and not earlier, so a run that stops before this phase never pays for it. If it fails to load, continue with the paths below.
427
+
428
+ **Pre-compute the artifact path** (it never changes after this) by the skill's rules: `{topic-slug}` is its topic slug of the feature title, the same value as the artifact's `slug:` frontmatter, and `{YYYY-MM-DD_HHMM}` is the local time, computed once:
429
+ - If one issue: `{worktree}/.devflow/docs/design/{ISSUE_ID}-{topic-slug}.{YYYY-MM-DD_HHMM}.md` (e.g. `42-jwt-auth.2026-04-07_1430.md`)
424
430
  - If multi-issue: `{worktree}/.devflow/docs/design/multi-{topic-slug}.{YYYY-MM-DD_HHMM}.md`, frontmatter `issue: pending` — a batch fetch returns no issue ID to name it by
425
431
  - If no issue: `{worktree}/.devflow/docs/design/{topic-slug}.{YYYY-MM-DD_HHMM}.md`
426
432
 
@@ -541,68 +547,37 @@ Display completion summary:
541
547
  │
542
548
  ├─ Block 1: Requirements Discovery
543
549
  │ ├─ Phase 1: GATE 0 - Requirements Discovery ⛔ MANDATORY
550
+ │ │ ├─ Git agent (fetch-issue / fetch-issues-batch) - issue mode only
544
551
  │ │ └─ AskUserQuestion: Validate interpretation
545
552
  <!-- learning:on -->
546
553
  │ ├─ Phase 2: Orient + Load Decisions
547
554
  <!-- learning:off -->
548
555
  │ ├─ Phase 2: Orient
549
556
  <!-- learning:end -->
550
- <!-- learning:on -->
551
- │ │ ├─ Skim agent (codebase context)
552
- │ │ └─ Read index.md → DECISIONS_CONTEXT
553
- <!-- learning:off -->
554
- │ │ └─ Skim agent (codebase context)
555
- <!-- learning:end -->
556
557
  │ ├─ Phase 3: Explore Requirements (PARALLEL)
557
- │ │ ├─ Explore: User perspective
558
- │ │ ├─ Explore: Similar features
559
- │ │ ├─ Explore: Constraints
560
- │ │ └─ Explore: Failure modes
561
558
  │ └─ Phase 4: Synthesize Exploration
562
- │ └─ Synthesize agent (mode: exploration)
563
559
  │
564
560
  ├─ Block 2: Gap Analysis
565
561
  │ ├─ Phase 5: Gap Analysis (PARALLEL)
566
- │ │ ├─ Design agent: completeness
567
- │ │ ├─ Design agent: architecture
568
- │ │ ├─ Design agent: security
569
- │ │ ├─ Design agent: performance
570
- │ │ ├─ Design agent: compliance (only when COMPLIANCE_ACTIVE)
571
- │ │ ├─ Design agent: consistency (multi-issue only)
572
- │ │ └─ Design agent: dependencies (multi-issue only)
573
562
  │ └─ Phase 6: Synthesize Gap Analysis
574
- │ └─ Synthesize agent (mode: design)
575
563
  │
576
564
  ├─ Block 3: Scope Approval
577
565
  │ └─ Phase 7: GATE 1 - Validate Scope + Gaps ⛔ MANDATORY
578
- │ └─ AskUserQuestion: Confirm scope and gap resolutions
579
566
  │
580
567
  ├─ Block 4: Implementation Design
581
568
  │ ├─ Phase 8: Explore Implementation (PARALLEL)
582
- │ │ ├─ Explore: Architecture
583
- │ │ ├─ Explore: Integration
584
- │ │ ├─ Explore: Reusable code
585
- │ │ └─ Explore: Edge cases
586
569
  │ ├─ Phase 9: Synthesize Implementation Exploration
587
- │ │ └─ Synthesize agent (mode: exploration)
588
570
  │ ├─ Phase 10: Plan Implementation (PARALLEL)
589
- │ │ ├─ Plan: Implementation steps
590
- │ │ ├─ Plan: Testing strategy
591
- │ │ └─ Plan: Execution strategy
592
571
  │ └─ Phase 11: Synthesize Planning
593
- │ └─ Synthesize agent (mode: planning)
594
572
  │
595
573
  ├─ Block 5: Design Review + Approval
596
574
  │ ├─ Phase 12: Design Review
597
- │ │ └─ Design agent (mode: design-review)
598
575
  │ └─ Phase 13: GATE 2 - Confirm Plan + Design Review ⛔ MANDATORY
599
- │ └─ AskUserQuestion: Final plan approval
576
+ │ └─ Revise ≤ 2 → back to Phase 10; after 2: Accept / Cancel / Restart /plan
600
577
  │
601
578
  ├─ Block 6: Output
602
579
  │ └─ Phase 14: Output
603
- │ ├─ Store design artifact ({worktree}/.devflow/docs/design/)
604
- │ ├─ Create tracker issue (optional)
605
- │ └─ Report summary + next step
580
+ │ └─ Git agent (ensure-traceable-issue) - create or enrich tracker issue (optional)
606
581
  │
607
582
  ```
608
583
 
@@ -619,6 +594,6 @@ Display completion summary:
619
594
  ## Error Handling
620
595
 
621
596
  - If any agent fails, report the phase, agent type, and error
622
- - If user selects "Revise" at Gate 2, loop back to Phase 10 with user's constraints
597
+ - If user selects "Revise" at Gate 2 and fewer than 2 revisions have run, loop back to Phase 10 with user's constraints; after the second revision Gate 2 offers Accept, Cancel or "Restart /plan with these constraints" only
623
598
  - If user selects "Cancel" at any gate, stop gracefully without writing artifact
624
599
  - If `{worktree}/.devflow/docs/design/` does not exist, create it in Phase 14
@@ -3,7 +3,7 @@ description: Release project using adaptive learned configuration
3
3
  output-dir: dist/commands
4
4
  ---
5
5
  @import { evidence_policy } from "./_partials/_evidence_policy.mds"
6
- @import { decisions_gate, decisions_locate } from "./_partials/_decisions.mds"
6
+ @import { decisions_gate, decisions_locate, decisions_slice } from "./_partials/_decisions.mds"
7
7
  @import { knowledge_load } from "./_partials/_knowledge.mds"
8
8
  @import "./_partials/_settings.mds" as settings
9
9
 
@@ -45,8 +45,6 @@ Parse from `COMMAND_INPUT`:
45
45
 
46
46
  **Produces:** RELEASE_CONFIG, CONFIG_STATE (`learned` | `fresh`)
47
47
 
48
- **Load Companion Skills** — Load via Skill tool: `devflow:git`. If a skill fails to load, continue without it.
49
-
50
48
  **Continuation detection**: Check `.release/.progress.json`. If exists, an interrupted release is in progress. Offer user:
51
49
  - **Resume**: continue from last checkpoint (skip phases already completed)
52
50
  - **Restart**: clean start (delete `.release/.progress.json` and begin from Phase 1)
@@ -72,6 +70,8 @@ Read `.release/RELEASE-FLOW.md`:
72
70
 
73
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`.
74
72
 
73
+ {{decisions_slice()}}
74
+
75
75
  <!-- learning:end -->
76
76
  {{knowledge_load()}}
77
77
 
@@ -165,10 +165,12 @@ Arm 1 or 2 ⇒ ask once, via AskUserQuestion: "{u} untraced commits{, coverage u
165
165
  ## Traceability exceptions
166
166
  - `untraced` <sha12> (<author>) self-attested by @<login> at <utc>: <reason>
167
167
  - `coverage` <bound-hit|trace-unavailable|gather-indeterminate|untraced-beyond-list> self-attested by @<login> at <utc>: <reason>
168
+
168
169
  Exempt (not attested): release <n> · revert <n> · bot <n> — <sha12>, …
169
170
  ```
170
171
 
171
172
  - One `untraced` line per listed untraced commit (≤100), its `<sha12>` and `<author>` copied from that `### TRACE_MAP` line. One `coverage` line per arm-1 cause — `bound-hit` for `bound:hit`, `gather-indeterminate` for status `INDETERMINATE` or none of the five, `trace-unavailable` for any other — plus `untraced-beyond-list` when an `…and <n> more` line closes the untraced list. The `Exempt` line counts each exempt kind (its listed lines plus its `…and <n> more`) and names every listed exempt SHA.
173
+ - A blank line separates the last bullet from the `Exempt` line, so Markdown renders that line as its own paragraph and not inside the bullet. Compose the block with that blank line every time.
172
174
  - `@<login>` is `@` followed by the output of `gh api user --jq .login` when that output matches `^[A-Za-z0-9][A-Za-z0-9-]{0,38}$`. On any other output, or a failed call, it is `(login unavailable)` instead, with no `@`.
173
175
  - `<utc>` is the output of `date -u +%Y-%m-%dT%H:%M:%SZ`.
174
176
  - `<reason>` is the user's own words, made inert: replace every character outside printable ASCII (newlines and tabs included) with a space, remove every `<`, `>`, `` ` ``, `[`, `]`, `\`, `/`, `#`, `@`, `&` and `$`, collapse runs of spaces, trim, keep the first 200 characters, and trim again. A reason that is empty after this is no reason.
@@ -190,6 +192,9 @@ Confirm with user via AskUserQuestion before executing:
190
192
  Sequential execution with progress checkpoints:
191
193
  1. **Version bumps** — write new version to configured files
192
194
  2. **Changelog update** — move Unreleased section to versioned entry (if configured)
195
+
196
+ **Load Companion Skills** (D-RELEASE-GIT-LOAD-LATE) — Load via Skill tool: `devflow:git`, here and not earlier: steps 1–2 only write files and `--dry-run` halts after Phase 4, so neither carries the skill. A resume that skips step 3 loads it before its next main-thread git write. If a skill fails to load, continue without it.
197
+
193
198
  3. **Release commit** — `chore(release): v{VERSION}` (conventional commit)
194
199
  4. **Tag and GitHub Release** — spawn `Agent(subagent_type="Git")` with `create-release` operation (the agent reads `.devflow/conventions.md` for tag format and release title conventions; compliance defaults when absent); only when `EVIDENCE_POLICY` is `required`, also pass `COMMIT_LIST` and `SHIPPED_ISSUES` from RELEASE_EVIDENCE, and `TRACEABILITY_EXCEPTIONS` when composed (Record, or the no-ask exempt rule), as inputs so the agent includes them in the release notes body.
195
200
  4b. **Back-link shipped issues** (only when `EVIDENCE_POLICY` is `required`) — spawn `Agent(subagent_type="Git")` with `backlink-shipped-issues` operation, passing `VERSION` and `SHIPPED_ISSUES`; posts a marker-deduped comment on each issue (bounds and throttle enforced by the operation); degrade gracefully (D4) on any API failure — never block the release
@@ -65,6 +65,10 @@ Use `FEATURE_KNOWLEDGE` **locally** for research framing. Pass to each Research
65
65
 
66
66
  **Produces:** RESEARCH_PLAN
67
67
 
68
+ **Load `devflow:docs-framework`** — Load via Skill tool: `devflow:docs-framework`, here and not earlier, so a run that stops before this phase never pays for it. If it fails to load, continue with the rules below.
69
+
70
+ Name the research directory by the skill's rules, once: `{topic-slug}` is its topic slug of the research question and `{YYYY-MM-DD_HHMM}` is the local time. When `{worktree}/.devflow/docs/research/{topic-slug}/{YYYY-MM-DD_HHMM}` already exists (a same-minute collision), the timestamp takes seconds instead, `YYYY-MM-DD_HHMMSS`. Every path of this run uses that one directory.
71
+
68
72
  Analyze the research question to infer research types needed (min 2, max 5). For each type:
69
73
  - `RESEARCH_TYPE`: `codebase | external | market | competitor | technology`
70
74
  - `RESEARCH_QUESTION`: Focused sub-question for this type
@@ -72,8 +76,6 @@ Analyze the research question to infer research types needed (min 2, max 5). For
72
76
 
73
77
  **Tool availability check**: If WebSearch/WebFetch are unavailable, restrict to `codebase` type only.
74
78
 
75
- Generate topic slug from the research question (kebab-case, lowercase, no articles).
76
-
77
79
  ### Phase 3: Orient (Conditional)
78
80
 
79
81
  **Produces:** ORIENT_OUTPUT
@@ -111,12 +113,17 @@ Each Research agent writes findings to disk at OUTPUT_PATH.
111
113
  **Produces:** RESEARCH_SUMMARY
112
114
  **Requires:** RESEARCH_OUTPUTS
113
115
 
114
- Spawn `Agent(subagent_type="Synthesize")` in `research` mode:
115
- - Reads Research agent outputs from RESEARCH_OUTPUTS paths
116
- - Merges findings with trust-aware aggregation
117
- - Writes `research-summary.md` to the same timestamped directory
116
+ Spawn `Agent(subagent_type="Synthesize")` in `research` mode. It reads the Research agent outputs from the `RESEARCH_OUTPUTS` paths, merges them with trust-aware aggregation, and writes `research-summary.md` into `RESEARCH_BASE_DIR` — the one directory of this run, which only this spawn names:
118
117
 
119
- Output path: `{worktree}/.devflow/docs/research/{topic-slug}/{timestamp}/research-summary.md`
118
+ ```
119
+ Agent(subagent_type="Synthesize", run_in_background=false):
120
+ "Mode: research
121
+ WORKTREE_PATH: {WORKTREE_PATH} (omit if none was provided)
122
+ RESEARCH_OUTPUTS: {the OUTPUT_PATH of every Research agent that wrote its file}
123
+ RESEARCH_BASE_DIR: {worktree}/.devflow/docs/research/{topic-slug}/{YYYY-MM-DD_HHMM}
124
+ Merge findings with trust-aware aggregation.
125
+ Output: {worktree}/.devflow/docs/research/{topic-slug}/{YYYY-MM-DD_HHMM}/research-summary.md"
126
+ ```
120
127
 
121
128
  ### Phase 6: Present
122
129
 
@@ -29,9 +29,10 @@ Process issues from code review reports: triage every issue through the blast-ra
29
29
 
30
30
  **Produces:** WORKTREES
31
31
 
32
- 1. **Discover resolvable worktrees** using the `devflow:worktree-support` skill discovery algorithm:
33
- - Run `git worktree list --porcelain` → parse, filter (skip protected/detached/mid-rebase), dedup by branch, sort by recent commit
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
32
+ 1. **Discover resolvable worktrees**:
33
+ - Run `git worktree list --porcelain` and count the worktrees it lists
34
+ - **More than one listed:** Invoke the `devflow:worktree-support` skill, then Read its `references/discovery.md` from the skill's base directory for the full 7-step algorithm; the canonical protected branch list stays in the skill. Parse the list, filter (skip protected/detached/mid-rebase), dedup by branch, sort by recent commit
35
+ - **Exactly one listed:** load neither the skill nor the reference — that worktree is the only candidate, and Step 0b's Git agent validates its branch
35
36
  - Additional filter: must have unresolved reviews (latest review directory has no `resolution-summary.md`)
36
37
  2. **If `--path` flag provided:** use only that worktree, skip discovery
37
38
  **`--path` validation**: Before proceeding, verify the path exists as a directory and appears in `git worktree list` output. If not: report error and stop.
@@ -119,6 +120,10 @@ Reuse this result for every worktree.
119
120
  {{publication_gate()}}
120
121
  Resolve this per worktree — unlike the evidence policy above, the settings line is per worktree root. From the same line: {{compliance.compliance_frameworks()}}
121
122
 
123
+ {{compliance.compliance_inject()}}
124
+
125
+ Set it per worktree, from that worktree's lens, and pass that worktree's `COMPLIANCE_DIRECTIVE` to each of its Code and Fix spawns, on a line of its own.
126
+
122
127
  **Mint `RESOLUTION_TS` once per run:** `date -u +%Y-%m-%dT%H:%M:%SZ`. Every worktree reuses it — the resolution comment's dedup marker is searched per PR, so one run key keeps a retry of this run deduplicated while the next /resolve on the same PR posts. Phase 5 writes it as the summary's `**Date**:` and Phase 9b-2 passes it, so the local file and the posted marker agree.
123
128
 
124
129
  ### Phase 1: Parse Issues
@@ -247,13 +252,12 @@ TASK_ID: resolve-{batch-id}
247
252
  ISSUES: {fix_now_issues_in_batch}
248
253
  SCOPE: {risk_tier_per_issue}
249
254
  PUSH: false
250
- CREATE_PR: false
251
255
  WORKTREE_PATH: {worktree_path} (omit if cwd)
252
256
  <!-- learning:on -->
253
257
  DECISIONS_CONTEXT: {decisions_context}
254
258
  <!-- learning:end -->
255
259
  FEATURE_KNOWLEDGE: {feature_knowledge}
256
- COMPLIANCE_FRAMEWORKS: {COMPLIANCE_FRAMEWORKS}
260
+ {COMPLIANCE_DIRECTIVE}
257
261
  Fix only the listed pre-classified FIX_NOW issues. Do not re-litigate dispositions.
258
262
  Same-file issues → one commit. Include ## Verification block in report.
259
263
  Regression fix without failing-then-passing regression test → BLOCKED."
@@ -270,7 +274,7 @@ Collect from each Code agent:
270
274
  **Produces:** RESOLUTION_FILE (early write for compaction safety)
271
275
  **Requires:** TRIAGE_RESULTS, CODE_AGENT_RESULTS, TARGET_DIR, TARGET_DIR_REL, BRANCH_INFO, RESOLUTION_TS
272
276
 
273
- **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 (Simplify, Verification Gate, CI gate, Tech Debt) trigger context compaction.
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.
274
278
 
275
279
  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).
276
280
 
@@ -278,19 +282,19 @@ DUPLICATE issues are listed **only** in `## Duplicates` — never in `## Fixed I
278
282
 
279
283
  Use the template from the Output Artifact section below.
280
284
 
281
- ### Phase 6: Simplify
285
+ ### Phase 6: Polish
282
286
 
283
- **Produces:** SIMPLIFICATION_RESULT
287
+ **Produces:** POLISH_RESULT
284
288
  **Requires:** CODE_AGENT_RESULTS
285
289
 
286
- If any fixes were made, spawn Simplify agent to refine the changed code:
290
+ If any fixes were made, spawn Polish agent to refine the changed code:
287
291
 
288
292
  ```
289
- Agent(subagent_type="Simplify", run_in_background=false):
293
+ Agent(subagent_type="Polish", run_in_background=false):
290
294
  "TASK_DESCRIPTION: Issue resolution fixes
291
295
  WORKTREE_PATH: {worktree_path} (omit if cwd)
292
296
  FILES_CHANGED: {list of files modified by Code agents}
293
- Simplify and refine the fixes for clarity and consistency
297
+ Polish and refine the fixes for clarity and consistency
294
298
  Commit any improvements with a conventional-commit message."
295
299
  ```
296
300
 
@@ -316,20 +320,19 @@ Run build, typecheck, lint, test. Report pass/fail with failure details."
316
320
  1. Extract failure details from Validate agent output
317
321
  2. Increment `validation_retry_count`
318
322
  3. If `validation_retry_count <= 2`:
319
- - Spawn Code agent with fix context:
323
+ - Spawn Fix agent with fix context:
320
324
  ```
321
- Agent(subagent_type="Code"):
325
+ Agent(subagent_type="Fix"):
322
326
  "OPERATION: validation-fix
323
327
  TASK_ID: resolve-{batch-id}-valfix-{count}
324
328
  VALIDATION_FAILURES: {parsed failures from Validate agent}
325
329
  SCOPE: Fix only the listed failures, no other changes
326
330
  PUSH: false
327
- CREATE_PR: false
328
331
  WORKTREE_PATH: {worktree_path} (omit if cwd)
329
332
  <!-- learning:on -->
330
333
  DECISIONS_CONTEXT: {decisions_context}
331
334
  <!-- learning:end -->
332
- COMPLIANCE_FRAMEWORKS: {COMPLIANCE_FRAMEWORKS}"
335
+ {COMPLIANCE_DIRECTIVE}"
333
336
  ```
334
337
  - Loop back to re-validate
335
338
  4. If `validation_retry_count > 2`: set VERIFICATION_STATUS = FAILED and exit the validation loop — record a blocking callout in the `## Verification` section (never a silent pass).
@@ -339,7 +342,7 @@ Run build, typecheck, lint, test. Report pass/fail with failure details."
339
342
  Record `## Verification` outcome in resolution-summary.md (runs unconditionally after the validation loop exits):
340
343
  - Rewrite the `## Verification` section with | Command | Result | table + `Final gate: PASS | FAILED after N attempts`
341
344
 
342
- Push all commits to remote once (Code agents and validation-fix Code agents ran with PUSH: false — runs whether the gate PASSED or FAILED, so the branch is always visible before Phase 9 or CI runs):
345
+ Push all commits to remote once (Code and Fix agents ran with PUSH: false — runs whether the gate PASSED or FAILED, so the branch is always visible before Phase 9 or CI runs):
343
346
  ```bash
344
347
  git -C {worktree} push
345
348
  ```
@@ -378,9 +381,9 @@ Phase 7 has pushed already, so this is a no-op unless the head moved since. `exi
378
381
  4. **If PENDING** and fewer than 3 waits have run → wait again (step 1). After the third wait → report "CI still running — verify manually before merging" and proceed.
379
382
  5. **If INDETERMINATE** and fewer than 3 waits have run → wait again (step 1). After the third wait → report "CI status unknown — verify manually before merging" and proceed.
380
383
  <!-- 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.
384
+ 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.
382
385
  <!-- 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.
386
+ 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.
384
387
  <!-- learning:end -->
385
388
  7. **Budget**: at most 3 waits and 2 fixes in all, per worktree. When one is spent, report the current status and proceed.
386
389
  <!-- /PATTERN: ci-status-gate -->
@@ -491,19 +494,13 @@ Capture the Git agent's `**Publication**:` and `**Status**:` lines as `PR_COMMEN
491
494
 
492
495
  **Step 9b-3: Refresh the test-plan evidence**
493
496
 
494
- Run this step only when Step 9b-0 ran — the head moved — and its `EVIDENCE` line did not read `total:0` with `exceptions:none` (nothing to record); otherwise record `EVIDENCE_REFRESH` as `SKIPPED ({reason})`. Spawn Git agent:
497
+ Run this step only when Step 9b-0 ran — the head moved — and its `EVIDENCE` line did not read `total:0` with `exceptions:none` (nothing to record); otherwise record `EVIDENCE_REFRESH` as `SKIPPED ({reason})`. Run the script inline — it is the whole `update-pr-evidence` operation, with no Git agent spawn — through the Bash tool with `timeout: 180000`:
495
498
 
496
- ```
497
- Agent(subagent_type="Git"):
498
- "OPERATION: update-pr-evidence
499
- PR_NUMBER: {pr_number}
500
- EVIDENCE_FILE: {TARGET_DIR_REL}/evidence.md
501
- REVIEW_PUBLICATION: {9b-2's publication mode}
502
- WORKTREE_PATH: {worktree_path} (omit if cwd)
503
- Refresh the PR's test-plan block and post its evidence comment."
499
+ ```bash
500
+ cd {worktree} && node "$HOME/.devflow/scripts/verify-evidence.cjs" publish --pr {pr_number} --evidence "{TARGET_DIR_REL}/evidence.md" --publication {9b-2's publication mode}; echo "exit=$?"
504
501
  ```
505
502
 
506
- Omit the `EVIDENCE_FILE` line when Step 9b-0 appended no claim. `REVIEW_PUBLICATION` is the mode 9b-2 reported on its `**Publication**:` line — `FULL…` → `full`, `STUB…` → `stub`, `OFF…` → `off` — else `{REVIEW_PUBLICATION}` as resolved in Step 0d. Capture its `EVIDENCE` line and its `**Body**:` / `**Comment**:` line, or its `TRACEABILITY: DEGRADED ({reason})` line, as `EVIDENCE_REFRESH`. It never blocks.
503
+ Drop the `--evidence` pair when Step 9b-0 appended no claim. Run it only when `TARGET_DIR_REL` matches `^[A-Za-z0-9._/-]+$` — it carries the branch name, which a fork author picks — and `{pr_number}` is digits only; treat any other value as a failed run. The publication value is the mode 9b-2 reported on its `**Publication**:` line — `FULL…` → `full`, `STUB…` → `stub`, `OFF…` → `off` — else `{REVIEW_PUBLICATION}` as resolved in Step 0d. Capture its stdout as `EVIDENCE_REFRESH`: the `## PR Evidence` block's `EVIDENCE` line and its `**Body**:` / `**Comment**:` line, with any `TRACEABILITY: DEGRADED ({reason})` lines after them (exit 0), or the one line `TRACEABILITY: DEGRADED (evidence unavailable)` (exit 2). Empty stdout or any other exit is `TRACEABILITY: DEGRADED (evidence unavailable)`. It never blocks.
507
504
 
508
505
  ### Phase 9c: Merge Readiness (Report-only)
509
506
 
@@ -512,19 +509,17 @@ Omit the `EVIDENCE_FILE` line when Step 9b-0 appended no claim. `REVIEW_PUBLICAT
512
509
 
513
510
  Run this phase only when `REQUIRE_NON_AUTHOR_APPROVAL` is `true`; otherwise skip it and report it as SKIPPED.
514
511
 
515
- Spawn Git agent:
512
+ Run the script inline — it is the whole `check-merge-readiness` operation, with no Git agent spawn — through the Bash tool with `timeout: 180000`:
516
513
 
514
+ ```bash
515
+ cd {worktree} && node "$HOME/.devflow/scripts/verify-evidence.cjs" readiness --pr {pr_number} --require-non-author-approval true; echo "exit=$?"
517
516
  ```
518
- Agent(subagent_type="Git"):
519
- "OPERATION: check-merge-readiness
520
- PR_NUMBER: {pr_number}
521
- REQUIRE_NON_AUTHOR_APPROVAL: {REQUIRE_NON_AUTHOR_APPROVAL}
522
- WORKTREE_PATH: {worktree_path} (omit if cwd)"
523
- ```
517
+
518
+ Pass `--require-non-author-approval true`: `REQUIRE_NON_AUTHOR_APPROVAL` is `true` here, or this phase would not run. `{pr_number}` is digits only. Its stdout is the `## Merge Readiness` block (exit 0), or the same block with `**Status**: DEGRADED ({reason})` and a `TRACEABILITY: DEGRADED ({reason})` line after it (exit 2); empty stdout or any other exit is `TRACEABILITY: DEGRADED (readiness unavailable)`.
524
519
 
525
520
  Include merge readiness verdict (READY / NOT_READY / DEGRADED) and its `- Test plan:` detail line in Phase 10 report. Never block on this result — report-only.
526
521
 
527
- If Git agent returns `TRACEABILITY: DEGRADED`: warn, proceed to Phase 10.
522
+ If the script prints a `TRACEABILITY: DEGRADED` line: warn, proceed to Phase 10.
528
523
 
529
524
  ### Phase 10: Report
530
525
 
@@ -589,48 +584,24 @@ In multi-worktree mode, report results per worktree with aggregate summary.
589
584
  /resolve (orchestrator - spawns agents only)
590
585
  │
591
586
  ├─ Phase 0: Worktree Discovery & Pre-flight
592
- │ ├─ Step 0a: git worktree list → filter resolvable
593
- │ ├─ Step 0b: Git agent (validate-branch) per worktree [parallel] ← + DIFF_FILES
594
- │ ├─ Step 0c: Target latest review directory per worktree
595
- <!-- learning:on -->
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 -->
600
- │
601
587
  ├─ Phase 1: Parse issues from TARGET_DIR + extract confidence %
602
- │
603
588
  ├─ Phase 1b: Fetch external threads (evidence policy required)
604
- │ └─ Git agent (fetch-review-threads) → THREAD_MAP
605
- │
606
589
  ├─ Phase 2: Global Triage [Triage agent, opus, single agent]
607
- │ └─ ALL issues → verdict ledger by disposition (incl. DUPLICATE with duplicate_of)
608
- │
609
590
  ├─ Phase 3: Batch FIX_NOW issues (skip if empty; DUPLICATE issues never dispatched)
610
- │ └─ same-file sequential, distinct-file parallel, max 5/batch
611
- │
612
591
  ├─ Phase 4: Fix [Code agent × N, OPERATION: issue-fix, PUSH: false]
613
- │ └─ Returns Verification block per batch
614
- │
615
592
  ├─ Phase 5: Write resolution-summary.md (compaction safety; Tracked = "(pending)" or "(pending — TRACEABILITY: DEGRADED)" if manage-debt degrades)
616
- │
617
- ├─ Phase 6: Simplify [Simplify agent]
618
- │
619
- ├─ Phase 7: Verification Gate [Validate agent, haiku] + push + Code agent validation-fix loop ≤2
620
- │
593
+ ├─ Phase 6: Polish [Polish agent]
594
+ ├─ Phase 7: Verification Gate [Validate agent, haiku] + push + Fix agent validation-fix loop ≤2
621
595
  ├─ Phase 8: CI Status Gate (conditional — skipped if no fixes or verification FAILED)
622
- │ └─ push, then ci-wait.cjs (inline, one wait ≤ 570 s) → Code agent on FAILING (3 waits + 2 fixes per worktree)
623
- │
624
596
  ├─ Phase 9: Git agent (manage-debt) — FIX_SEPARATE + TECH_DEBT → backfill Tracked={ISSUE_REF} (or TRACEABILITY: DEGRADED on failure)
625
- │ SEQUENTIAL across worktrees
626
597
  │
627
598
  ├─ Phase 9b: Thread resolution + resolution comment
628
599
  │ ├─ Step 9b-0: verify-evidence.cjs --stale-out → ≤1 Test agent on the stale TPs (wrapped) — only after this run's push
629
600
  │ ├─ Step 9b-1: Git agent (resolve-review-threads) — evidence policy required
630
601
  │ ├─ Step 9b-2: Git agent (post-resolution-summary, REVIEW_PUBLICATION) — always-on
631
- │ └─ Step 9b-3: Git agent (update-pr-evidence) — only when the head moved
602
+ │ └─ Step 9b-3: verify-evidence.cjs publish (inline, no Git spawn) — only when the head moved
632
603
  │
633
- ├─ Phase 9c: Git agent (check-merge-readiness) — non-author approval required, report-only
604
+ ├─ Phase 9c: verify-evidence.cjs readiness (inline, no Git spawn) — non-author approval required, report-only
634
605
  │
635
606
  └─ Phase 10: Display results (resolution-summary.md written in Phase 5)
636
607
  ```
@@ -644,21 +615,11 @@ In multi-worktree mode, report results per worktree with aggregate summary.
644
615
  | Fix attempt fails | Revert changes, mark BLOCKED, continue others |
645
616
  | Issue dependencies | Sequential chain, skip dependents if predecessor blocked |
646
617
  | No actionable issues | Report "No issues to resolve" |
647
- | Incomplete review directory (no review-summary.md) | Skip — resolve only targets complete reviews |
648
618
  | Latest review already resolved | Check bug-analysis fallback (Step 0c-5b); if also absent, skip worktree and suggest `/code-review` or `/bug-analysis` |
649
- | Legacy flat layout (no subdirectories) | Read flat *.md files directly (backwards compatible) |
650
619
  | `--review {timestamp}` in multi-worktree mode | Not supported — use `--path` + `--review` to target specific worktree + review |
651
- | Worktree pre-flight fails | Report failure, continue with other worktrees |
652
- | Empty FIX_NOW list | Skip Phases 3-4/6-8; still write full summary + run manage-debt if FIX_SEPARATE/TECH_DEBT exist |
653
- | ESCALATED security issues | Surfaced in ## Escalations + display callout; never routed to manage-debt |
654
- | DUPLICATE verdict without duplicate_of, or chained to another DUPLICATE | Treated as Triage failure — same retry-then-abort as a vanished id |
655
- | DUPLICATE issues in THREAD_MAP | Map ext-{N} to primary's verdict/verification status for thread reply |
656
- | Verification Gate FAILED after 2 attempts | Recorded as FAILED in ## Verification + blocking callout; CI gate skipped; proceed to Phase 9 (manage-debt) then Phase 10 (display) |
657
620
  | gh/GitHub absent | manage-debt degrades (`TRACEABILITY: DEGRADED ({reason})`); Tracked stays `(pending — TRACEABILITY: DEGRADED ({reason}))` — recorded, not dropped |
658
621
  | `EVIDENCE_POLICY` is `standard` | Phases 1b and 9b-step-1 are skipped; post-resolution-summary (Phase 9b step 2) still runs if a PR is known |
659
622
  | `REQUIRE_NON_AUTHOR_APPROVAL` is `false` | Phase 9c is skipped and reported as SKIPPED |
660
- | THREAD_MAP empty or DEGRADED | Phase 9b-1 skipped; resolution comment (Phase 9b-2) still posted if PR known |
661
- | No PR exists for post-resolution-summary | Git agent returns TRACEABILITY: DEGRADED; resolution-summary.md already on disk — not a blocker |
662
623
  | Public repo (`auto` mode) | Git agent probes visibility, posts counts-only STUB comment; full resolution report stays local |
663
624
  | `reviewPublication: off` | Git agent skips posting the resolution comment (OFF) — except that, only when `EVIDENCE_POLICY` is `required`, Step 0d passes `stub` and a counts-only STUB comment posts |
664
625
  | Fork PR this run cannot push to (no maintainer edits, no push access of its own) | validate-branch emits `TRACEABILITY: DEGRADED (cannot push to fork)` → `fork_no_push`: Phase 7 skips the push, Phase 8 is skipped, 9b-1 records FIXED threads as DEGRADED instead of citing unpushed commits; 9b-2 still posts the resolution comment; the head did not move, so 9b-0 and 9b-3 are skipped |
@@ -669,14 +630,8 @@ In multi-worktree mode, report results per worktree with aggregate summary.
669
630
 
670
631
  1. **Orchestration only** - Command spawns agents, doesn't do git/resolve work itself
671
632
  2. **No agent grades its own homework** - Triage agent validates, Code agents fix, Validate agent verifies
672
- 3. **Global triage first** - Single Triage agent sees all issues for cross-issue consistency; no issue may vanish
673
- 4. **Git agent for git work** - All git operations go through Git agent
674
- 5. **Parallel execution** - Distinct-file Code agent batches run in parallel; same-file batches sequential
675
- 6. **Honest reporting** - Verification failure is recorded and displayed, never silenced
676
- 7. **Complete tracking** - Every issue gets exactly one verdict in the ledger
677
- 8. **Latest review by default** - Only process the most recent complete review
678
- 9. **Auto-discover worktrees** - One command handles all resolvable branches
679
- 10. **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)
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)
680
635
 
681
636
  ## Output Artifact
682
637