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
@@ -165,7 +165,7 @@ If `index.md` exists and contains at least one entry line, use it for relevance
165
165
 
166
166
  **Step 2 — Fallback: glob frontmatter (if `index.md` is absent or empty):**
167
167
 
168
- Glob `{worktree}/.devflow/features/*/KNOWLEDGE.md`. For each file found, read only its YAML frontmatter block (between the opening and closing `---` delimiters). The frontmatter fields `name`, `description`, and `directories` are the authoritative relevance surface — `index.md` is only a cache.
168
+ Glob `{worktree}/.devflow/features/*/KNOWLEDGE.md`. For each file found, read only its YAML frontmatter block (between the opening and closing `---` delimiters).
169
169
 
170
170
  **Step 3 — Pick relevant KBs:**
171
171
 
@@ -196,7 +196,7 @@ Headings: L5 Rules · L40 Overview · L62 Anti-Patterns · L118 Key Files
196
196
 
197
197
  A KB with no Rules section labels its entries `Rules ({section name}):` and gives them no ID. `FEATURE_KNOWLEDGE` is these blocks; `FEATURE_KNOWLEDGE_RULES` is the same blocks without the `Headings:` line. Both come from this one selection, and each spawn names the variable its recipient takes. If no KBs exist, no KBs are relevant, or `.devflow/features/` is absent, set both to `(none)`.
198
198
 
199
- **One git call, then direct reads — no `.cjs` script.** After resolving `{worktree}`, this step is 1 index read (or N frontmatter reads on fallback), plus one heading listing and one Rules read per selected KB, bounded by KB count.
199
+ **One git call, then direct reads — no `.cjs` script.**
200
200
 
201
201
  Pass `FEATURE_KNOWLEDGE` to Explore and Design agents.
202
202
 
@@ -205,7 +205,7 @@ Pass `FEATURE_KNOWLEDGE` to Explore and Design agents.
205
205
  **Produces:** EXPLORE_OUTPUTS
206
206
  **Requires:** SKIM_CONTEXT
207
207
 
208
- 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.
208
+ 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.
209
209
 
210
210
  | Focus | Thoroughness | Find |
211
211
  |-------|-------------|------|
@@ -266,15 +266,20 @@ Each Design agent receives:
266
266
  - Focus: (their assigned focus from table)
267
267
  - Exploration synthesis from Phase 4
268
268
  - Skim agent context from Phase 2
269
- - `COMPLIANCE_FRAMEWORKS` (compliance focus only)
269
+ - `COMPLIANCE_FOCUS_DIRECTIVE` (compliance focus only)
270
270
  - Multi-issue: all issue bodies
271
271
 
272
+ **Set the compliance focus directive** from `COMPLIANCE_FRAMEWORKS`. `COMPLIANCE_FOCUS_DIRECTIVE` is this one line, with `<ids>` replaced by the value of `COMPLIANCE_FRAMEWORKS`; only the compliance focus's spawn carries it:
273
+
274
+ > For this compliance focus, invoke Skill(skill="devflow:compliance") and load references/{id}.md only for the ids in <ids> (none: generic controls only); never fabricate guidance for a framework you were not given.
275
+
272
276
  ```
273
277
  Agent(subagent_type="Design"):
274
278
  "Mode: gap-analysis
275
279
  Focus: {completeness|architecture|security|performance|compliance|consistency|dependencies}
276
280
  FEATURE_KNOWLEDGE: {feature_knowledge}
277
- COMPLIANCE_FRAMEWORKS: {COMPLIANCE_FRAMEWORKS} (compliance focus only)
281
+ {COMPLIANCE_FOCUS_DIRECTIVE} (compliance focus only)
282
+ 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)
278
283
  Artifacts:
279
284
  Feature/Issues: {feature description or issue bodies}
280
285
  Exploration synthesis: {Phase 4 output}
@@ -336,7 +341,7 @@ User can:
336
341
  **Produces:** IMPL_EXPLORE_OUTPUTS
337
342
  **Requires:** SKIM_CONTEXT, ACCEPTED_SCOPE
338
343
 
339
- 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.
344
+ 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.
340
345
 
341
346
  | Focus | Thoroughness | Find |
342
347
  |-------|-------------|------|
@@ -444,8 +449,9 @@ Use AskUserQuestion to present:
444
449
 
445
450
  User can:
446
451
  - **Accept** — proceed to output phases
447
- - **Revise** — re-run phases 10-12 with new constraints (loop back, no limit on revisions)
452
+ - **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
448
453
  - **Cancel** — stop gracefully, no artifact written
454
+ - **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
449
455
 
450
456
  **MANDATORY**: Do not write design artifact until Gate 2 is confirmed.
451
457
 
@@ -460,8 +466,10 @@ User can:
460
466
 
461
467
  **Store design artifact:**
462
468
 
463
- **Pre-compute the artifact path** from the slug (it never changes after this):
464
- - 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`)
469
+ **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.
470
+
471
+ **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:
472
+ - 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`)
465
473
  - 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
466
474
  - If no issue: `{worktree}/.devflow/docs/design/{topic-slug}.{YYYY-MM-DD_HHMM}.md`
467
475
 
@@ -590,59 +598,33 @@ Display completion summary:
590
598
  │
591
599
  ├─ Block 1: Requirements Discovery
592
600
  │ ├─ Phase 1: GATE 0 - Requirements Discovery ⛔ MANDATORY
601
+ │ │ ├─ Git agent (fetch-issue / fetch-issues-batch) - issue mode only
593
602
  │ │ └─ AskUserQuestion: Validate interpretation
594
603
  │ ├─ Phase 2: Orient
595
- │ │ └─ Skim agent (codebase context)
596
604
  │ ├─ Phase 3: Explore Requirements (PARALLEL)
597
- │ │ ├─ Explore: User perspective
598
- │ │ ├─ Explore: Similar features
599
- │ │ ├─ Explore: Constraints
600
- │ │ └─ Explore: Failure modes
601
605
  │ └─ Phase 4: Synthesize Exploration
602
- │ └─ Synthesize agent (mode: exploration)
603
606
  │
604
607
  ├─ Block 2: Gap Analysis
605
608
  │ ├─ Phase 5: Gap Analysis (PARALLEL)
606
- │ │ ├─ Design agent: completeness
607
- │ │ ├─ Design agent: architecture
608
- │ │ ├─ Design agent: security
609
- │ │ ├─ Design agent: performance
610
- │ │ ├─ Design agent: compliance (only when COMPLIANCE_ACTIVE)
611
- │ │ ├─ Design agent: consistency (multi-issue only)
612
- │ │ └─ Design agent: dependencies (multi-issue only)
613
609
  │ └─ Phase 6: Synthesize Gap Analysis
614
- │ └─ Synthesize agent (mode: design)
615
610
  │
616
611
  ├─ Block 3: Scope Approval
617
612
  │ └─ Phase 7: GATE 1 - Validate Scope + Gaps ⛔ MANDATORY
618
- │ └─ AskUserQuestion: Confirm scope and gap resolutions
619
613
  │
620
614
  ├─ Block 4: Implementation Design
621
615
  │ ├─ Phase 8: Explore Implementation (PARALLEL)
622
- │ │ ├─ Explore: Architecture
623
- │ │ ├─ Explore: Integration
624
- │ │ ├─ Explore: Reusable code
625
- │ │ └─ Explore: Edge cases
626
616
  │ ├─ Phase 9: Synthesize Implementation Exploration
627
- │ │ └─ Synthesize agent (mode: exploration)
628
617
  │ ├─ Phase 10: Plan Implementation (PARALLEL)
629
- │ │ ├─ Plan: Implementation steps
630
- │ │ ├─ Plan: Testing strategy
631
- │ │ └─ Plan: Execution strategy
632
618
  │ └─ Phase 11: Synthesize Planning
633
- │ └─ Synthesize agent (mode: planning)
634
619
  │
635
620
  ├─ Block 5: Design Review + Approval
636
621
  │ ├─ Phase 12: Design Review
637
- │ │ └─ Design agent (mode: design-review)
638
622
  │ └─ Phase 13: GATE 2 - Confirm Plan + Design Review ⛔ MANDATORY
639
- │ └─ AskUserQuestion: Final plan approval
623
+ │ └─ Revise ≤ 2 → back to Phase 10; after 2: Accept / Cancel / Restart /plan
640
624
  │
641
625
  ├─ Block 6: Output
642
626
  │ └─ Phase 14: Output
643
- │ ├─ Store design artifact ({worktree}/.devflow/docs/design/)
644
- │ ├─ Create tracker issue (optional)
645
- │ └─ Report summary + next step
627
+ │ └─ Git agent (ensure-traceable-issue) - create or enrich tracker issue (optional)
646
628
  │
647
629
  ```
648
630
 
@@ -659,6 +641,6 @@ Display completion summary:
659
641
  ## Error Handling
660
642
 
661
643
  - If any agent fails, report the phase, agent type, and error
662
- - If user selects "Revise" at Gate 2, loop back to Phase 10 with user's constraints
644
+ - 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
663
645
  - If user selects "Cancel" at any gate, stop gracefully without writing artifact
664
646
  - If `{worktree}/.devflow/docs/design/` does not exist, create it in Phase 14
@@ -40,8 +40,6 @@ Parse from `COMMAND_INPUT`:
40
40
 
41
41
  **Produces:** RELEASE_CONFIG, CONFIG_STATE (`learned` | `fresh`)
42
42
 
43
- **Load Companion Skills** — Load via Skill tool: `devflow:git`. If a skill fails to load, continue without it.
44
-
45
43
  **Continuation detection**: Check `.release/.progress.json`. If exists, an interrupted release is in progress. Offer user:
46
44
  - **Resume**: continue from last checkpoint (skip phases already completed)
47
45
  - **Restart**: clean start (delete `.release/.progress.json` and begin from Phase 1)
@@ -76,7 +74,7 @@ If `index.md` exists and contains at least one entry line, use it for relevance
76
74
 
77
75
  **Step 2 — Fallback: glob frontmatter (if `index.md` is absent or empty):**
78
76
 
79
- Glob `{worktree}/.devflow/features/*/KNOWLEDGE.md`. For each file found, read only its YAML frontmatter block (between the opening and closing `---` delimiters). The frontmatter fields `name`, `description`, and `directories` are the authoritative relevance surface — `index.md` is only a cache.
77
+ Glob `{worktree}/.devflow/features/*/KNOWLEDGE.md`. For each file found, read only its YAML frontmatter block (between the opening and closing `---` delimiters).
80
78
 
81
79
  **Step 3 — Pick relevant KBs:**
82
80
 
@@ -107,7 +105,7 @@ Headings: L5 Rules · L40 Overview · L62 Anti-Patterns · L118 Key Files
107
105
 
108
106
  A KB with no Rules section labels its entries `Rules ({section name}):` and gives them no ID. `FEATURE_KNOWLEDGE` is these blocks; `FEATURE_KNOWLEDGE_RULES` is the same blocks without the `Headings:` line. Both come from this one selection, and each spawn names the variable its recipient takes. If no KBs exist, no KBs are relevant, or `.devflow/features/` is absent, set both to `(none)`.
109
107
 
110
- **One git call, then direct reads — no `.cjs` script.** After resolving `{worktree}`, this step is 1 index read (or N frontmatter reads on fallback), plus one heading listing and one Rules read per selected KB, bounded by KB count.
108
+ **One git call, then direct reads — no `.cjs` script.**
111
109
 
112
110
  Pass `FEATURE_KNOWLEDGE` only to agents whose contract declares it; the Validate and Git agents this command spawns do not.
113
111
 
@@ -203,10 +201,12 @@ Arm 1 or 2 ⇒ ask once, via AskUserQuestion: "{u} untraced commits{, coverage u
203
201
  ## Traceability exceptions
204
202
  - `untraced` <sha12> (<author>) self-attested by @<login> at <utc>: <reason>
205
203
  - `coverage` <bound-hit|trace-unavailable|gather-indeterminate|untraced-beyond-list> self-attested by @<login> at <utc>: <reason>
204
+
206
205
  Exempt (not attested): release <n> · revert <n> · bot <n> — <sha12>, …
207
206
  ```
208
207
 
209
208
  - 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.
209
+ - 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.
210
210
  - `@<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 `@`.
211
211
  - `<utc>` is the output of `date -u +%Y-%m-%dT%H:%M:%SZ`.
212
212
  - `<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.
@@ -228,6 +228,9 @@ Confirm with user via AskUserQuestion before executing:
228
228
  Sequential execution with progress checkpoints:
229
229
  1. **Version bumps** — write new version to configured files
230
230
  2. **Changelog update** — move Unreleased section to versioned entry (if configured)
231
+
232
+ **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.
233
+
231
234
  3. **Release commit** — `chore(release): v{VERSION}` (conventional commit)
232
235
  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.
233
236
  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
@@ -63,7 +63,7 @@ If `index.md` exists and contains at least one entry line, use it for relevance
63
63
 
64
64
  **Step 2 — Fallback: glob frontmatter (if `index.md` is absent or empty):**
65
65
 
66
- Glob `{worktree}/.devflow/features/*/KNOWLEDGE.md`. For each file found, read only its YAML frontmatter block (between the opening and closing `---` delimiters). The frontmatter fields `name`, `description`, and `directories` are the authoritative relevance surface — `index.md` is only a cache.
66
+ Glob `{worktree}/.devflow/features/*/KNOWLEDGE.md`. For each file found, read only its YAML frontmatter block (between the opening and closing `---` delimiters).
67
67
 
68
68
  **Step 3 — Pick relevant KBs:**
69
69
 
@@ -94,7 +94,7 @@ Headings: L5 Rules · L40 Overview · L62 Anti-Patterns · L118 Key Files
94
94
 
95
95
  A KB with no Rules section labels its entries `Rules ({section name}):` and gives them no ID. `FEATURE_KNOWLEDGE` is these blocks; `FEATURE_KNOWLEDGE_RULES` is the same blocks without the `Headings:` line. Both come from this one selection, and each spawn names the variable its recipient takes. If no KBs exist, no KBs are relevant, or `.devflow/features/` is absent, set both to `(none)`.
96
96
 
97
- **One git call, then direct reads — no `.cjs` script.** After resolving `{worktree}`, this step is 1 index read (or N frontmatter reads on fallback), plus one heading listing and one Rules read per selected KB, bounded by KB count.
97
+ **One git call, then direct reads — no `.cjs` script.**
98
98
 
99
99
  Use `FEATURE_KNOWLEDGE` **locally** for research framing. Pass to each Research agent in Phase 4.
100
100
 
@@ -102,6 +102,10 @@ Use `FEATURE_KNOWLEDGE` **locally** for research framing. Pass to each Research
102
102
 
103
103
  **Produces:** RESEARCH_PLAN
104
104
 
105
+ **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.
106
+
107
+ 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.
108
+
105
109
  Analyze the research question to infer research types needed (min 2, max 5). For each type:
106
110
  - `RESEARCH_TYPE`: `codebase | external | market | competitor | technology`
107
111
  - `RESEARCH_QUESTION`: Focused sub-question for this type
@@ -109,8 +113,6 @@ Analyze the research question to infer research types needed (min 2, max 5). For
109
113
 
110
114
  **Tool availability check**: If WebSearch/WebFetch are unavailable, restrict to `codebase` type only.
111
115
 
112
- Generate topic slug from the research question (kebab-case, lowercase, no articles).
113
-
114
116
  ### Phase 3: Orient (Conditional)
115
117
 
116
118
  **Produces:** ORIENT_OUTPUT
@@ -141,12 +143,17 @@ Each Research agent writes findings to disk at OUTPUT_PATH.
141
143
  **Produces:** RESEARCH_SUMMARY
142
144
  **Requires:** RESEARCH_OUTPUTS
143
145
 
144
- Spawn `Agent(subagent_type="Synthesize")` in `research` mode:
145
- - Reads Research agent outputs from RESEARCH_OUTPUTS paths
146
- - Merges findings with trust-aware aggregation
147
- - Writes `research-summary.md` to the same timestamped directory
146
+ 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:
148
147
 
149
- Output path: `{worktree}/.devflow/docs/research/{topic-slug}/{timestamp}/research-summary.md`
148
+ ```
149
+ Agent(subagent_type="Synthesize", run_in_background=false):
150
+ "Mode: research
151
+ WORKTREE_PATH: {WORKTREE_PATH} (omit if none was provided)
152
+ RESEARCH_OUTPUTS: {the OUTPUT_PATH of every Research agent that wrote its file}
153
+ RESEARCH_BASE_DIR: {worktree}/.devflow/docs/research/{topic-slug}/{YYYY-MM-DD_HHMM}
154
+ Merge findings with trust-aware aggregation.
155
+ Output: {worktree}/.devflow/docs/research/{topic-slug}/{YYYY-MM-DD_HHMM}/research-summary.md"
156
+ ```
150
157
 
151
158
  ### Phase 6: Present
152
159
 
@@ -22,9 +22,10 @@ Process issues from code review reports: triage every issue through the blast-ra
22
22
 
23
23
  **Produces:** WORKTREES
24
24
 
25
- 1. **Discover resolvable worktrees** using the `devflow:worktree-support` skill discovery algorithm:
26
- - Run `git worktree list --porcelain` → parse, filter (skip protected/detached/mid-rebase), dedup by branch, sort by recent commit
27
- - 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
25
+ 1. **Discover resolvable worktrees**:
26
+ - Run `git worktree list --porcelain` and count the worktrees it lists
27
+ - **More than one listed:** Invoke the `devflow:worktree-support` skill, then Read its `references/discovery.md` from the skill's base directory for the full 7-step algorithm; the canonical protected branch list stays in the skill. Parse the list, filter (skip protected/detached/mid-rebase), dedup by branch, sort by recent commit
28
+ - **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
28
29
  - Additional filter: must have unresolved reviews (latest review directory has no `resolution-summary.md`)
29
30
  2. **If `--path` flag provided:** use only that worktree, skip discovery
30
31
  **`--path` validation**: Before proceeding, verify the path exists as a directory and appears in `git worktree list` output. If not: report error and stop.
@@ -119,7 +120,7 @@ If `index.md` exists and contains at least one entry line, use it for relevance
119
120
 
120
121
  **Step 2 — Fallback: glob frontmatter (if `index.md` is absent or empty):**
121
122
 
122
- Glob `{worktree}/.devflow/features/*/KNOWLEDGE.md`. For each file found, read only its YAML frontmatter block (between the opening and closing `---` delimiters). The frontmatter fields `name`, `description`, and `directories` are the authoritative relevance surface — `index.md` is only a cache.
123
+ Glob `{worktree}/.devflow/features/*/KNOWLEDGE.md`. For each file found, read only its YAML frontmatter block (between the opening and closing `---` delimiters).
123
124
 
124
125
  **Step 3 — Pick relevant KBs:**
125
126
 
@@ -150,7 +151,7 @@ Headings: L5 Rules · L40 Overview · L62 Anti-Patterns · L118 Key Files
150
151
 
151
152
  A KB with no Rules section labels its entries `Rules ({section name}):` and gives them no ID. `FEATURE_KNOWLEDGE` is these blocks; `FEATURE_KNOWLEDGE_RULES` is the same blocks without the `Headings:` line. Both come from this one selection, and each spawn names the variable its recipient takes. If no KBs exist, no KBs are relevant, or `.devflow/features/` is absent, set both to `(none)`.
152
153
 
153
- **One git call, then direct reads — no `.cjs` script.** After resolving `{worktree}`, this step is 1 index read (or N frontmatter reads on fallback), plus one heading listing and one Rules read per selected KB, bounded by KB count.
154
+ **One git call, then direct reads — no `.cjs` script.**
154
155
 
155
156
  Pass `FEATURE_KNOWLEDGE` to the Triage agent in Phase 2.
156
157
 
@@ -172,6 +173,12 @@ Reuse this result for every worktree.
172
173
  Note: `auto` is NOT fail-open — under `auto`, the Git agent probes the repository visibility and treats any error or unrecognised value as PUBLIC (mode STUB). What each value does is decided by the Git agent's publication gate (`references/publication-gate.md` step 2); this partial only resolves the value.
173
174
  Resolve this per worktree — unlike the evidence policy above, the settings line is per worktree root. From the same line: `COMPLIANCE_FRAMEWORKS` is the settings line's `COMPLIANCE` with `generic` written `none`: `off`, `none`, or the framework ids the machine and this repository declare.
174
175
 
176
+ **Set the compliance directive** from `COMPLIANCE_FRAMEWORKS`. `COMPLIANCE_DIRECTIVE` is empty when `COMPLIANCE_FRAMEWORKS` is `off`: a spawn line that holds only `{COMPLIANCE_DIRECTIVE}` is then left out, so a lens-off spawn carries nothing about compliance. Otherwise `COMPLIANCE_DIRECTIVE` is this one line, with `<ids>` replaced by the value of `COMPLIANCE_FRAMEWORKS`:
177
+
178
+ > When the task touches regulated surface (data models, auth flows, logging/observability, payments, IaC, retention), invoke Skill(skill="devflow:compliance") and load references/{id}.md only for the ids in <ids> (none: generic controls only); never fabricate guidance for a framework you were not given.
179
+
180
+ 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.
181
+
175
182
  **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.
176
183
 
177
184
  ### Phase 1: Parse Issues
@@ -282,10 +289,9 @@ TASK_ID: resolve-{batch-id}
282
289
  ISSUES: {fix_now_issues_in_batch}
283
290
  SCOPE: {risk_tier_per_issue}
284
291
  PUSH: false
285
- CREATE_PR: false
286
292
  WORKTREE_PATH: {worktree_path} (omit if cwd)
287
293
  FEATURE_KNOWLEDGE: {feature_knowledge}
288
- COMPLIANCE_FRAMEWORKS: {COMPLIANCE_FRAMEWORKS}
294
+ {COMPLIANCE_DIRECTIVE}
289
295
  Fix only the listed pre-classified FIX_NOW issues. Do not re-litigate dispositions.
290
296
  Same-file issues → one commit. Include ## Verification block in report.
291
297
  Regression fix without failing-then-passing regression test → BLOCKED."
@@ -302,7 +308,7 @@ Collect from each Code agent:
302
308
  **Produces:** RESOLUTION_FILE (early write for compaction safety)
303
309
  **Requires:** TRIAGE_RESULTS, CODE_AGENT_RESULTS, TARGET_DIR, TARGET_DIR_REL, BRANCH_INFO, RESOLUTION_TS
304
310
 
305
- **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.
311
+ **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.
306
312
 
307
313
  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).
308
314
 
@@ -310,19 +316,19 @@ DUPLICATE issues are listed **only** in `## Duplicates` — never in `## Fixed I
310
316
 
311
317
  Use the template from the Output Artifact section below.
312
318
 
313
- ### Phase 6: Simplify
319
+ ### Phase 6: Polish
314
320
 
315
- **Produces:** SIMPLIFICATION_RESULT
321
+ **Produces:** POLISH_RESULT
316
322
  **Requires:** CODE_AGENT_RESULTS
317
323
 
318
- If any fixes were made, spawn Simplify agent to refine the changed code:
324
+ If any fixes were made, spawn Polish agent to refine the changed code:
319
325
 
320
326
  ```
321
- Agent(subagent_type="Simplify", run_in_background=false):
327
+ Agent(subagent_type="Polish", run_in_background=false):
322
328
  "TASK_DESCRIPTION: Issue resolution fixes
323
329
  WORKTREE_PATH: {worktree_path} (omit if cwd)
324
330
  FILES_CHANGED: {list of files modified by Code agents}
325
- Simplify and refine the fixes for clarity and consistency
331
+ Polish and refine the fixes for clarity and consistency
326
332
  Commit any improvements with a conventional-commit message."
327
333
  ```
328
334
 
@@ -348,17 +354,16 @@ Run build, typecheck, lint, test. Report pass/fail with failure details."
348
354
  1. Extract failure details from Validate agent output
349
355
  2. Increment `validation_retry_count`
350
356
  3. If `validation_retry_count <= 2`:
351
- - Spawn Code agent with fix context:
357
+ - Spawn Fix agent with fix context:
352
358
  ```
353
- Agent(subagent_type="Code"):
359
+ Agent(subagent_type="Fix"):
354
360
  "OPERATION: validation-fix
355
361
  TASK_ID: resolve-{batch-id}-valfix-{count}
356
362
  VALIDATION_FAILURES: {parsed failures from Validate agent}
357
363
  SCOPE: Fix only the listed failures, no other changes
358
364
  PUSH: false
359
- CREATE_PR: false
360
365
  WORKTREE_PATH: {worktree_path} (omit if cwd)
361
- COMPLIANCE_FRAMEWORKS: {COMPLIANCE_FRAMEWORKS}"
366
+ {COMPLIANCE_DIRECTIVE}"
362
367
  ```
363
368
  - Loop back to re-validate
364
369
  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).
@@ -368,7 +373,7 @@ Run build, typecheck, lint, test. Report pass/fail with failure details."
368
373
  Record `## Verification` outcome in resolution-summary.md (runs unconditionally after the validation loop exits):
369
374
  - Rewrite the `## Verification` section with | Command | Result | table + `Final gate: PASS | FAILED after N attempts`
370
375
 
371
- 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):
376
+ 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):
372
377
  ```bash
373
378
  git -C {worktree} push
374
379
  ```
@@ -406,7 +411,7 @@ Phase 7 has pushed already, so this is a no-op unless the head moved since. `exi
406
411
  3. **If NO_PR or NO_CI** → skip: "No PR/CI configured, skipping CI validation." Proceed to next phase.
407
412
  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.
408
413
  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.
409
- 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.
414
+ 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.
410
415
  7. **Budget**: at most 3 waits and 2 fixes in all, per worktree. When one is spent, report the current status and proceed.
411
416
  <!-- /PATTERN: ci-status-gate -->
412
417
 
@@ -516,19 +521,13 @@ Capture the Git agent's `**Publication**:` and `**Status**:` lines as `PR_COMMEN
516
521
 
517
522
  **Step 9b-3: Refresh the test-plan evidence**
518
523
 
519
- 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:
524
+ 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`:
520
525
 
521
- ```
522
- Agent(subagent_type="Git"):
523
- "OPERATION: update-pr-evidence
524
- PR_NUMBER: {pr_number}
525
- EVIDENCE_FILE: {TARGET_DIR_REL}/evidence.md
526
- REVIEW_PUBLICATION: {9b-2's publication mode}
527
- WORKTREE_PATH: {worktree_path} (omit if cwd)
528
- Refresh the PR's test-plan block and post its evidence comment."
526
+ ```bash
527
+ 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=$?"
529
528
  ```
530
529
 
531
- 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.
530
+ 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.
532
531
 
533
532
  ### Phase 9c: Merge Readiness (Report-only)
534
533
 
@@ -537,19 +536,17 @@ Omit the `EVIDENCE_FILE` line when Step 9b-0 appended no claim. `REVIEW_PUBLICAT
537
536
 
538
537
  Run this phase only when `REQUIRE_NON_AUTHOR_APPROVAL` is `true`; otherwise skip it and report it as SKIPPED.
539
538
 
540
- Spawn Git agent:
539
+ Run the script inline — it is the whole `check-merge-readiness` operation, with no Git agent spawn — through the Bash tool with `timeout: 180000`:
541
540
 
542
- ```
543
- Agent(subagent_type="Git"):
544
- "OPERATION: check-merge-readiness
545
- PR_NUMBER: {pr_number}
546
- REQUIRE_NON_AUTHOR_APPROVAL: {REQUIRE_NON_AUTHOR_APPROVAL}
547
- WORKTREE_PATH: {worktree_path} (omit if cwd)"
541
+ ```bash
542
+ cd {worktree} && node "$HOME/.devflow/scripts/verify-evidence.cjs" readiness --pr {pr_number} --require-non-author-approval true; echo "exit=$?"
548
543
  ```
549
544
 
545
+ 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)`.
546
+
550
547
  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.
551
548
 
552
- If Git agent returns `TRACEABILITY: DEGRADED`: warn, proceed to Phase 10.
549
+ If the script prints a `TRACEABILITY: DEGRADED` line: warn, proceed to Phase 10.
553
550
 
554
551
  ### Phase 10: Report
555
552
 
@@ -642,16 +639,12 @@ FILES_CHANGED: {list of files changed}
642
639
  Write the knowledge base to:
643
640
  {worktree}/.devflow/features/{slug}/KNOWLEDGE.md
644
641
 
645
- Then update the index cache by performing a read-modify-write on:
642
+ Then update the index cache:
646
643
  {worktree}/.devflow/features/index.md
647
644
 
648
645
  Index line format: `- **{slug}** — {areas} — {Use-when description}` — at most 300 characters, the description at most 220; reword a longer one, never cut it.
649
646
 
650
- If the line for this slug already exists in index.md, replace it. If it does not exist, append it. If index.md does not exist, create it with just this line.
651
-
652
- The frontmatter in KNOWLEDGE.md is the source of truth — index.md is only a cache. Write the two files directly — no intermediate result JSON files, no external scripts.
653
-
654
- After writing, commit the two files to the current worktree branch yourself by running git via your Bash tool (do not use a script). Stage ONLY .devflow/features/index.md and .devflow/features/{slug}/KNOWLEDGE.md, then commit just those paths with a docs(knowledge): message. Do NOT push, do NOT force, do NOT stage anything else. Follow your Commit Protocol — it is non-blocking, so if any git step fails, report KB_COMMIT and finish normally."
647
+ Then commit the two files as your Commit Protocol directs."
655
648
  ```
656
649
 
657
650
  **Step 4 — Surface an uncommitted knowledge base:**
@@ -666,44 +659,24 @@ When the Knowledge agent reports `KB_COMMIT: skipped (detached HEAD)`, the files
666
659
  /resolve (orchestrator - spawns agents only)
667
660
  │
668
661
  ├─ Phase 0: Worktree Discovery & Pre-flight
669
- │ ├─ Step 0a: git worktree list → filter resolvable
670
- │ ├─ Step 0b: Git agent (validate-branch) per worktree [parallel] ← + DIFF_FILES
671
- │ ├─ Step 0c: Target latest review directory per worktree
672
- │ └─ Step 0d: Load project context → EVIDENCE_POLICY + REVIEW_PUBLICATION
673
- │
674
662
  ├─ Phase 1: Parse issues from TARGET_DIR + extract confidence %
675
- │
676
663
  ├─ Phase 1b: Fetch external threads (evidence policy required)
677
- │ └─ Git agent (fetch-review-threads) → THREAD_MAP
678
- │
679
664
  ├─ Phase 2: Global Triage [Triage agent, opus, single agent]
680
- │ └─ ALL issues → verdict ledger by disposition (incl. DUPLICATE with duplicate_of)
681
- │
682
665
  ├─ Phase 3: Batch FIX_NOW issues (skip if empty; DUPLICATE issues never dispatched)
683
- │ └─ same-file sequential, distinct-file parallel, max 5/batch
684
- │
685
666
  ├─ Phase 4: Fix [Code agent × N, OPERATION: issue-fix, PUSH: false]
686
- │ └─ Returns Verification block per batch
687
- │
688
667
  ├─ Phase 5: Write resolution-summary.md (compaction safety; Tracked = "(pending)" or "(pending — TRACEABILITY: DEGRADED)" if manage-debt degrades)
689
- │
690
- ├─ Phase 6: Simplify [Simplify agent]
691
- │
692
- ├─ Phase 7: Verification Gate [Validate agent, haiku] + push + Code agent validation-fix loop ≤2
693
- │
668
+ ├─ Phase 6: Polish [Polish agent]
669
+ ├─ Phase 7: Verification Gate [Validate agent, haiku] + push + Fix agent validation-fix loop ≤2
694
670
  ├─ Phase 8: CI Status Gate (conditional — skipped if no fixes or verification FAILED)
695
- │ └─ push, then ci-wait.cjs (inline, one wait ≤ 570 s) → Code agent on FAILING (3 waits + 2 fixes per worktree)
696
- │
697
671
  ├─ Phase 9: Git agent (manage-debt) — FIX_SEPARATE + TECH_DEBT → backfill Tracked={ISSUE_REF} (or TRACEABILITY: DEGRADED on failure)
698
- │ SEQUENTIAL across worktrees
699
672
  │
700
673
  ├─ Phase 9b: Thread resolution + resolution comment
701
674
  │ ├─ Step 9b-0: verify-evidence.cjs --stale-out → ≤1 Test agent on the stale TPs (wrapped) — only after this run's push
702
675
  │ ├─ Step 9b-1: Git agent (resolve-review-threads) — evidence policy required
703
676
  │ ├─ Step 9b-2: Git agent (post-resolution-summary, REVIEW_PUBLICATION) — always-on
704
- │ └─ Step 9b-3: Git agent (update-pr-evidence) — only when the head moved
677
+ │ └─ Step 9b-3: verify-evidence.cjs publish (inline, no Git spawn) — only when the head moved
705
678
  │
706
- ├─ Phase 9c: Git agent (check-merge-readiness) — non-author approval required, report-only
679
+ ├─ Phase 9c: verify-evidence.cjs readiness (inline, no Git spawn) — non-author approval required, report-only
707
680
  │
708
681
  └─ Phase 10: Display results (resolution-summary.md written in Phase 5)
709
682
  ```
@@ -717,21 +690,11 @@ When the Knowledge agent reports `KB_COMMIT: skipped (detached HEAD)`, the files
717
690
  | Fix attempt fails | Revert changes, mark BLOCKED, continue others |
718
691
  | Issue dependencies | Sequential chain, skip dependents if predecessor blocked |
719
692
  | No actionable issues | Report "No issues to resolve" |
720
- | Incomplete review directory (no review-summary.md) | Skip — resolve only targets complete reviews |
721
693
  | Latest review already resolved | Check bug-analysis fallback (Step 0c-5b); if also absent, skip worktree and suggest `/code-review` or `/bug-analysis` |
722
- | Legacy flat layout (no subdirectories) | Read flat *.md files directly (backwards compatible) |
723
694
  | `--review {timestamp}` in multi-worktree mode | Not supported — use `--path` + `--review` to target specific worktree + review |
724
- | Worktree pre-flight fails | Report failure, continue with other worktrees |
725
- | Empty FIX_NOW list | Skip Phases 3-4/6-8; still write full summary + run manage-debt if FIX_SEPARATE/TECH_DEBT exist |
726
- | ESCALATED security issues | Surfaced in ## Escalations + display callout; never routed to manage-debt |
727
- | DUPLICATE verdict without duplicate_of, or chained to another DUPLICATE | Treated as Triage failure — same retry-then-abort as a vanished id |
728
- | DUPLICATE issues in THREAD_MAP | Map ext-{N} to primary's verdict/verification status for thread reply |
729
- | 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) |
730
695
  | gh/GitHub absent | manage-debt degrades (`TRACEABILITY: DEGRADED ({reason})`); Tracked stays `(pending — TRACEABILITY: DEGRADED ({reason}))` — recorded, not dropped |
731
696
  | `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 |
732
697
  | `REQUIRE_NON_AUTHOR_APPROVAL` is `false` | Phase 9c is skipped and reported as SKIPPED |
733
- | THREAD_MAP empty or DEGRADED | Phase 9b-1 skipped; resolution comment (Phase 9b-2) still posted if PR known |
734
- | No PR exists for post-resolution-summary | Git agent returns TRACEABILITY: DEGRADED; resolution-summary.md already on disk — not a blocker |
735
698
  | Public repo (`auto` mode) | Git agent probes visibility, posts counts-only STUB comment; full resolution report stays local |
736
699
  | `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 |
737
700
  | 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 |
@@ -742,14 +705,8 @@ When the Knowledge agent reports `KB_COMMIT: skipped (detached HEAD)`, the files
742
705
 
743
706
  1. **Orchestration only** - Command spawns agents, doesn't do git/resolve work itself
744
707
  2. **No agent grades its own homework** - Triage agent validates, Code agents fix, Validate agent verifies
745
- 3. **Global triage first** - Single Triage agent sees all issues for cross-issue consistency; no issue may vanish
746
- 4. **Git agent for git work** - All git operations go through Git agent
747
- 5. **Parallel execution** - Distinct-file Code agent batches run in parallel; same-file batches sequential
748
- 6. **Honest reporting** - Verification failure is recorded and displayed, never silenced
749
- 7. **Complete tracking** - Every issue gets exactly one verdict in the ledger
750
- 8. **Latest review by default** - Only process the most recent complete review
751
- 9. **Auto-discover worktrees** - One command handles all resolvable branches
752
- 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)
708
+ 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)
709
+ 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)
753
710
 
754
711
  ## Output Artifact
755
712