devflow-kit 3.4.0 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +8 -4
  3. package/dist/agents/code-edit.md +133 -0
  4. package/dist/agents/code-fix.md +165 -0
  5. package/dist/agents/code.md +39 -182
  6. package/dist/agents/design.md +0 -1
  7. package/dist/agents/git.md +31 -693
  8. package/dist/agents/knowledge.md +8 -2
  9. package/dist/agents/research.md +6 -0
  10. package/dist/agents/review.md +0 -4
  11. package/dist/agents/scrutinize.md +3 -0
  12. package/dist/agents/skim.md +4 -0
  13. package/dist/agents/triage.md +8 -1
  14. package/dist/cli/commands/behavior-prompts.js +77 -0
  15. package/dist/cli/commands/behavior.js +123 -0
  16. package/dist/cli/commands/flags.js +8 -2
  17. package/dist/cli/commands/init-seed.js +7 -3
  18. package/dist/cli/commands/init.js +72 -5
  19. package/dist/cli/commands/rules.js +16 -0
  20. package/dist/cli/commands/tracker.js +112 -15
  21. package/dist/cli.js +2 -0
  22. package/dist/commands/bug-analysis.md +5 -5
  23. package/dist/commands/code-review.md +14 -9
  24. package/dist/commands/debug.md +25 -4
  25. package/dist/commands/dynamic-build.md +28 -38
  26. package/dist/commands/dynamic-plan.md +11 -9
  27. package/dist/commands/dynamic-profile.md +3 -3
  28. package/dist/commands/dynamic-tickets.md +12 -10
  29. package/dist/commands/explore.md +3 -3
  30. package/dist/commands/implement.md +91 -125
  31. package/dist/commands/plan.md +15 -8
  32. package/dist/commands/release.md +3 -2
  33. package/dist/commands/research.md +16 -9
  34. package/dist/commands/resolve.md +20 -15
  35. package/dist/commands/self-review.md +2 -2
  36. package/dist/core/agent-frontmatter.js +101 -0
  37. package/dist/core/compliance-compose.js +6 -4
  38. package/dist/core/feature-switch.js +23 -2
  39. package/dist/core/flags.js +111 -0
  40. package/dist/core/manifest.js +11 -3
  41. package/dist/core/mds-variants.js +68 -26
  42. package/dist/core/plugins.js +42 -65
  43. package/dist/core/project-paths.js +0 -4
  44. package/dist/core/proxy-log.js +1 -1
  45. package/dist/core/proxy-state.js +1 -1
  46. package/dist/core/tracker.js +120 -2
  47. package/dist/learning-off/agents/code-edit.md +129 -0
  48. package/dist/learning-off/agents/code-fix.md +161 -0
  49. package/dist/learning-off/agents/code.md +37 -180
  50. package/dist/learning-off/agents/design.md +0 -1
  51. package/dist/learning-off/agents/knowledge.md +8 -2
  52. package/dist/learning-off/agents/research.md +6 -0
  53. package/dist/learning-off/agents/review.md +0 -4
  54. package/dist/learning-off/agents/scrutinize.md +3 -0
  55. package/dist/learning-off/agents/skim.md +4 -0
  56. package/dist/learning-off/agents/triage.md +8 -1
  57. package/dist/learning-off/commands/bug-analysis.md +3 -3
  58. package/dist/learning-off/commands/code-review.md +12 -7
  59. package/dist/learning-off/commands/debug.md +22 -2
  60. package/dist/learning-off/commands/dynamic-build.md +27 -37
  61. package/dist/learning-off/commands/dynamic-plan.md +10 -8
  62. package/dist/learning-off/commands/dynamic-profile.md +2 -2
  63. package/dist/learning-off/commands/dynamic-tickets.md +11 -9
  64. package/dist/learning-off/commands/explore.md +1 -1
  65. package/dist/learning-off/commands/implement.md +89 -123
  66. package/dist/learning-off/commands/plan.md +13 -6
  67. package/dist/learning-off/commands/release.md +3 -2
  68. package/dist/learning-off/commands/research.md +14 -7
  69. package/dist/learning-off/commands/resolve.md +18 -13
  70. package/dist/skills/git/references/learn-conventions.md +27 -3
  71. package/dist/skills/git/references/pr/check-ci-status.md +19 -0
  72. package/dist/skills/git/references/pr/check-merge-readiness.md +19 -0
  73. package/dist/skills/git/references/pr/fetch-review-threads.md +30 -0
  74. package/dist/skills/git/references/pr/post-resolution-summary.md +18 -0
  75. package/dist/skills/git/references/pr/post-review-summary.md +20 -0
  76. package/dist/skills/git/references/pr/resolve-review-threads.md +28 -4
  77. package/dist/skills/git/references/pr/update-pr-evidence.md +13 -0
  78. package/dist/skills/git/references/pr/validate-branch.md +26 -0
  79. package/dist/skills/git/references/tracker/github/associate-release.md +24 -0
  80. package/dist/skills/git/references/tracker/github/backlink-shipped-issues.md +31 -1
  81. package/dist/skills/git/references/tracker/github/create-release.md +30 -1
  82. package/dist/skills/git/references/tracker/github/ensure-pr-ready.md +89 -2
  83. package/dist/skills/git/references/tracker/github/ensure-traceable-issue.md +16 -1
  84. package/dist/skills/git/references/tracker/github/fetch-issue.md +36 -1
  85. package/dist/skills/git/references/tracker/github/fetch-issues-batch.md +47 -1
  86. package/dist/skills/git/references/tracker/github/gather-release-evidence.md +25 -0
  87. package/dist/skills/git/references/tracker/github/manage-debt.md +21 -1
  88. package/dist/skills/git/references/tracker/github/post-wave-report.md +15 -1
  89. package/dist/skills/git/references/tracker/github/setup-task.md +41 -1
  90. package/dist/skills/git/references/tracker/jira/associate-release.md +24 -0
  91. package/dist/skills/git/references/tracker/jira/backlink-shipped-issues.md +31 -1
  92. package/dist/skills/git/references/tracker/jira/create-release.md +30 -1
  93. package/dist/skills/git/references/tracker/jira/ensure-pr-ready.md +89 -2
  94. package/dist/skills/git/references/tracker/jira/ensure-traceable-issue.md +16 -1
  95. package/dist/skills/git/references/tracker/jira/fetch-issue.md +36 -1
  96. package/dist/skills/git/references/tracker/jira/fetch-issues-batch.md +47 -1
  97. package/dist/skills/git/references/tracker/jira/gather-release-evidence.md +25 -0
  98. package/dist/skills/git/references/tracker/jira/manage-debt.md +21 -1
  99. package/dist/skills/git/references/tracker/jira/post-wave-report.md +15 -1
  100. package/dist/skills/git/references/tracker/jira/setup-task.md +41 -1
  101. package/dist/skills/git/references/tracker/linear/associate-release.md +24 -0
  102. package/dist/skills/git/references/tracker/linear/backlink-shipped-issues.md +31 -1
  103. package/dist/skills/git/references/tracker/linear/create-release.md +30 -1
  104. package/dist/skills/git/references/tracker/linear/ensure-pr-ready.md +89 -2
  105. package/dist/skills/git/references/tracker/linear/ensure-traceable-issue.md +16 -1
  106. package/dist/skills/git/references/tracker/linear/fetch-issue.md +36 -1
  107. package/dist/skills/git/references/tracker/linear/fetch-issues-batch.md +47 -1
  108. package/dist/skills/git/references/tracker/linear/gather-release-evidence.md +25 -0
  109. package/dist/skills/git/references/tracker/linear/manage-debt.md +21 -1
  110. package/dist/skills/git/references/tracker/linear/post-wave-report.md +15 -1
  111. package/dist/skills/git/references/tracker/linear/setup-task.md +41 -1
  112. package/dist/targets/claude-code/agent-type-owner.js +164 -0
  113. package/dist/targets/claude-code/behavior-install.js +111 -0
  114. package/dist/targets/claude-code/installer.js +69 -2
  115. package/dist/targets/claude-code/learning-install.js +9 -1
  116. package/dist/targets/claude-code/tracker-install.js +33 -16
  117. package/dist/targets/claude-code/tracker-servers.js +107 -0
  118. package/package.json +4 -3
  119. package/src/assets/agents/_partials/_code.mds +109 -0
  120. package/src/assets/agents/code-edit.mds +81 -0
  121. package/src/assets/agents/code-fix.mds +113 -0
  122. package/src/assets/agents/code.mds +18 -222
  123. package/src/assets/agents/design.mds +0 -1
  124. package/src/assets/agents/evaluate.md +7 -1
  125. package/src/assets/agents/explore.md +58 -0
  126. package/src/assets/agents/git.mds +31 -693
  127. package/src/assets/agents/knowledge.mds +8 -2
  128. package/src/assets/agents/learning.md +19 -69
  129. package/src/assets/agents/research.mds +6 -0
  130. package/src/assets/agents/review.mds +0 -4
  131. package/src/assets/agents/scrutinize.mds +3 -0
  132. package/src/assets/agents/simplify.md +3 -0
  133. package/src/assets/agents/skim.mds +4 -0
  134. package/src/assets/agents/synthesize.md +26 -352
  135. package/src/assets/agents/test.md +8 -0
  136. package/src/assets/agents/tracker.md +20 -7
  137. package/src/assets/agents/triage.mds +8 -1
  138. package/src/assets/agents/validate.md +5 -0
  139. package/src/assets/commands/_partials/_compliance.mds +36 -0
  140. package/src/assets/commands/_partials/_decisions.mds +2 -2
  141. package/src/assets/commands/_partials/_engine.mds +8 -8
  142. package/src/assets/commands/_partials/_preamble.mds +3 -3
  143. package/src/assets/commands/_partials/_roster.mds +4 -3
  144. package/src/assets/commands/_partials/_wave.mds +2 -2
  145. package/src/assets/commands/bug-analysis.mds +3 -3
  146. package/src/assets/commands/code-review.mds +11 -8
  147. package/src/assets/commands/debug.mds +24 -2
  148. package/src/assets/commands/dynamic-build.mds +14 -25
  149. package/src/assets/commands/dynamic-plan.mds +4 -3
  150. package/src/assets/commands/dynamic-tickets.mds +5 -4
  151. package/src/assets/commands/explore.mds +1 -1
  152. package/src/assets/commands/implement.mds +89 -125
  153. package/src/assets/commands/plan.mds +12 -7
  154. package/src/assets/commands/release.mds +3 -2
  155. package/src/assets/commands/research.mds +14 -7
  156. package/src/assets/commands/resolve.mds +17 -14
  157. package/src/assets/mds/.mdsroot +4 -0
  158. package/src/assets/mds/git/_ops.mds +383 -0
  159. package/src/assets/mds/git/_ops_pr.mds +201 -0
  160. package/src/assets/mds/git/_ops_steps.mds +147 -0
  161. package/src/assets/mds/git/_pr.mds +39 -44
  162. package/src/assets/mds/git/_references.mds +6 -3
  163. package/src/assets/mds/tracker/_common.mds +5 -5
  164. package/src/assets/mds/tracker/_contract.mds +4 -3
  165. package/src/assets/mds/tracker/_github.mds +60 -14
  166. package/src/assets/mds/tracker/_jira.mds +60 -14
  167. package/src/assets/mds/tracker/_linear.mds +60 -14
  168. package/src/assets/mds/tracker/_steps.mds +10 -9
  169. package/src/assets/rules/behavior.md +6 -0
  170. package/src/assets/scripts/hooks/assets/orchestrator-charter.md +2 -1
  171. package/src/assets/scripts/hooks/lib/project-paths.cjs +0 -6
  172. package/src/assets/skills/agent-references/SKILL.md +33 -0
  173. package/src/assets/skills/agent-references/references/learning/maintain.md +71 -0
  174. package/src/assets/skills/agent-references/references/synthesize/bug-analysis.md +71 -0
  175. package/src/assets/skills/agent-references/references/synthesize/design.md +36 -0
  176. package/src/assets/skills/agent-references/references/synthesize/exploration.md +38 -0
  177. package/src/assets/skills/agent-references/references/synthesize/planning.md +60 -0
  178. package/src/assets/skills/agent-references/references/synthesize/research.md +61 -0
  179. package/src/assets/skills/agent-references/references/synthesize/review.md +76 -0
  180. package/src/assets/skills/compliance/SKILL.md +1 -1
  181. package/src/assets/skills/docs-framework/SKILL.md +80 -83
  182. package/src/assets/skills/docs-framework/references/patterns.md +14 -25
  183. package/src/assets/skills/docs-framework/references/violations.md +7 -7
  184. package/src/assets/skills/gap-analysis/SKILL.md +0 -16
  185. package/src/assets/skills/gap-analysis/references/compliance.md +19 -0
  186. package/dist/skills/git/references/pr/ensure-pr-ready.md +0 -24
@@ -46,13 +46,13 @@ When the user explicitly asks to re-validate, re-check, or re-run quality gates
46
46
  2. **Skip Phase 2** — no Code agent needed, user already made changes.
47
47
  3. **Detect FILES_CHANGED**: `git diff --name-only {base_branch}...HEAD`
48
48
  4. **Run Phases 3-8** — Simplify, Self-Review, Alignment, the one full Validate, QA Testing and the conditional Re-Validate, on the detected changes.
49
- 5. **Proceed to Phase 10** (Create PR), **Phase 10b** (Evidence) and **Phase 11** (Report).
49
+ 5. **Proceed to Phase 9** (Open PR), **Phase 11** (Evidence) and **Phase 12** (Report).
50
50
 
51
51
  If the user prompt does NOT match re-validation, proceed with the full pipeline below.
52
52
 
53
53
  ### Phase 1: Setup
54
54
 
55
- **Produces:** TASK_ID, BASE_BRANCH, EXECUTION_PLAN, FEATURE_KNOWLEDGE, FEATURE_KNOWLEDGE_RULES, PR_DESCRIPTION_GUIDANCE, ISSUE_NUMBER, EVIDENCE_POLICY, ISSUE_REQUIRED, APPLY_CONVENTIONS, REQUIRE_NON_AUTHOR_APPROVAL, PR_EXCEPTIONS, TEST_PLAN, EVIDENCE_FILE, PR_TEST_PLAN_BLOCK, REVIEW_PUBLICATION
55
+ **Produces:** TASK_ID, BASE_BRANCH, EXECUTION_PLAN, FEATURE_KNOWLEDGE, FEATURE_KNOWLEDGE_RULES, PR_DESCRIPTION_GUIDANCE, ISSUE_NUMBER, ISSUE_PR_LINK, EVIDENCE_POLICY, ISSUE_REQUIRED, APPLY_CONVENTIONS, REQUIRE_NON_AUTHOR_APPROVAL, PR_EXCEPTIONS, TEST_PLAN, EVIDENCE_FILE, PR_TEST_PLAN_BLOCK, REVIEW_PUBLICATION
56
56
 
57
57
  Record the current branch name as `BASE_BRANCH` - this will be the PR target.
58
58
 
@@ -135,6 +135,7 @@ visible, a silently discarded request is not.
135
135
  - `TASK_ID`: The branch name created by Git agent (use as TASK_ID for rest of flow)
136
136
  - `BASE_BRANCH`: Branch this feature was created from (for PR target)
137
137
  - `ISSUE_NUMBER`: the provider-canonical issue identifier for this task — the same value the Git agent emits as `ISSUE_ID` (if provided, or created by the Git agent's issue-first step in setup-task)
138
+ - `branch_slug`: `TASK_ID` with every `/` replaced by `-`. It names `handoff-{branch_slug}.md` and `evidence-{branch_slug}.md` only when it matches `^[A-Za-z0-9._-]{1,200}$`; any other branch name stops the run here, telling the user it cannot name those files.
138
139
 
139
140
  **Capture from the Git agent's Output block, as written:** `ISSUE_REF` (the rendered reference in the `## Issue {ISSUE_REF}:` heading), `ISSUE_ID` (the `- **Issue ID**:` line under `### Handoff Values`), `ISSUE_CONTENT` (the body between the `<untrusted-issue-body>` markers), `ACCEPTANCE_CRITERIA`, `ISSUE_PR_LINK` (the `- **PR link line**:` line) and `ISSUE_BRANCH_TOKEN` (the `- **Branch token**:` line). Read every value from the block that emits it; never re-derive one value from another, and never infer any of them from a `TRACEABILITY: DEGRADED ({reason})` status line — a DEGRADED line is a status, not issue content.
140
141
 
@@ -160,7 +161,7 @@ Note: `ISSUE_CONTENT` stays inside its `<untrusted-issue-body>` markers wherever
160
161
 
161
162
  Note: the section reaches a public PR body. The Code agent re-checks every line against this shape before it pastes, and the body's D11 scrub is the reason's secret scrub — rendering filters no secrets. A rendered reason carries no HTML or comment markers, link or image syntax, @-mentions, `#N` or full-URL references (no `/` survives), entities or shell-expansion characters; plain emphasis and `www.` or `GH-N` autolinks can remain — the requester authors the reason.
162
163
 
163
- **Record the exception at once**, before any Code spawn: write the rendered section as the `## Evidence Exceptions` section of `{worktree}/.devflow/docs/handoff-{branch_slug}.md`, creating the file if absent, and set `PR_EXCEPTIONS` to that section. The file is its one home until the PR exists: every later write to the file keeps the section byte-identical, every PR-creating Code spawn passes it verbatim as `PR_EXCEPTIONS`, and the file is deleted only once the PR exists — after the PR-creating Phase 2 Code agent under SINGLE_CODE_AGENT and SEQUENTIAL_CODE_AGENTS, after Phase 10 under PARALLEL_CODE_AGENTS. With no exception recorded, `PR_EXCEPTIONS` is `(none)`.
164
+ **Record the exception at once**, before any Code spawn: write the rendered section as the `## Evidence Exceptions` section of `{worktree}/.devflow/docs/handoff-{branch_slug}.md`, creating the file if absent, and set `PR_EXCEPTIONS` to that section. The file is its one home until the PR exists: every later write to the file keeps the section byte-identical, the Phase 9 Git spawn passes it verbatim as `PR_EXCEPTIONS`, and the file is deleted only once the PR exists — after Phase 9, under every strategy. With no exception recorded, `PR_EXCEPTIONS` is `(none)`.
164
165
 
165
166
  **Test plan.** Before any Code spawn, give the task a test plan in the evidence file `{worktree}/.devflow/docs/evidence-{branch_slug}.md` (`EVIDENCE_FILE`) — unlike the handoff file, it stays after the PR exists. It holds up to three sections, in this order and nothing else: `## Test Plan`; `## Evidence Exceptions`, a byte copy of `PR_EXCEPTIONS` present only while that is not `(none)`; and `## Claims`, always last, so every claim is appended at the end of the file. Create the file if absent; if it exists, replace its `## Test Plan` and `## Evidence Exceptions` sections and keep `## Claims` byte-identical.
166
167
 
@@ -185,7 +186,7 @@ node "$HOME/.devflow/scripts/verify-evidence.cjs" check tp "{worktree}/.devflow/
185
186
  - **Record an exception** — the user gives the reason as free text. Render it with the exception grammar above, as kind `test-plan`; when the rendered reason is empty, ask for it once more, and stop as below if it is empty again. Add the rendered line to the `## Evidence Exceptions` section of `{worktree}/.devflow/docs/handoff-{branch_slug}.md` — after any `ticket-link` line, creating the section and the file when absent — and set `PR_EXCEPTIONS` to that section, under the same rules as the record above.
186
187
  - **Stop** — report `BLOCKED (no test plan)`, name `TASK_ID` and `BASE_BRANCH` so the branch can be reused or removed, and give the remedy: state the acceptance criteria in the task, the issue or a `/plan` document (its `## Test Plan` section is copied) and re-run `/implement`, or — for a team that does not want test plans enforced — commit `.devflow/project.json` as `{"version":1,"evidence":"standard"}` on the default branch; a machine with compliance enabled still resolves `required` whatever that file says. Spawn nothing further.
187
188
 
188
- When `EVIDENCE_POLICY` is `standard`, a missing test plan is never asked about: carry `Test plan: missing` to the Phase 11 report.
189
+ When `EVIDENCE_POLICY` is `standard`, a missing test plan is never asked about: carry `Test plan: missing` to the Phase 12 report.
189
190
 
190
191
  **Test-plan outputs**, set once before any Code spawn:
191
192
  - `TEST_PLAN` — the TP lines of the evidence file's `## Test Plan` section, or `(none)` when the test plan is missing.
@@ -212,7 +213,13 @@ The accepted line is the only source of these values: the script alone folds the
212
213
  **Evidence stub:** only when `EVIDENCE_POLICY` is `required`, a resolved `off` becomes `stub`, so a counts-only record still reaches the PR. `stub` is never a config value: the settings line never carries it.
213
214
 
214
215
  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.
215
- Phase 10b passes the resolved value to `update-pr-evidence`, which decides what each value means for the evidence comment. 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. Pass it to every Code spawn.
216
+ Phase 11 passes the resolved value to `update-pr-evidence`, which decides what each value means for the evidence comment. 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.
217
+
218
+ **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`:
219
+
220
+ > 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.
221
+
222
+ Pass `COMPLIANCE_DIRECTIVE` to every Code and Code-fix spawn, on a line of its own.
216
223
 
217
224
  ### Load Feature Knowledge
218
225
 
@@ -271,8 +278,8 @@ A KB with no Rules section labels its entries `Rules ({section name}):` and give
271
278
 
272
279
  ### Phase 2: Implement
273
280
 
274
- **Produces:** CODE_AGENT_OUTPUT, FILES_CHANGED, PR_URL
275
- **Requires:** TASK_ID, BASE_BRANCH, EXECUTION_PLAN, PR_DESCRIPTION_GUIDANCE, PR_EXCEPTIONS, PR_TEST_PLAN_BLOCK
281
+ **Produces:** CODE_AGENT_OUTPUT, FILES_CHANGED
282
+ **Requires:** TASK_ID, BASE_BRANCH, EXECUTION_PLAN
276
283
 
277
284
  Based on Setup context (plan document, issue body, or conversation context), use the three-strategy framework:
278
285
 
@@ -298,15 +305,8 @@ TASK_DESCRIPTION: {description}
298
305
  BASE_BRANCH: {base branch}
299
306
  EXECUTION_PLAN: {full plan from setup context}
300
307
  PATTERNS: {patterns from plan document or empty}
301
- CREATE_PR: true
302
- DOMAIN: {detected domain or 'fullstack'}
303
308
  FEATURE_KNOWLEDGE: {feature_knowledge}
304
- COMPLIANCE_FRAMEWORKS: {COMPLIANCE_FRAMEWORKS}
305
- PR_DESCRIPTION_GUIDANCE: {pr_description_guidance}
306
- ISSUE_NUMBER: {ISSUE_ID captured in Phase 1, or (none)}
307
- ISSUE_PR_LINK: {ISSUE_PR_LINK captured in Phase 1, or (none)}
308
- PR_EXCEPTIONS: {the ## Evidence Exceptions section of {worktree}/.devflow/docs/handoff-{branch_slug}.md verbatim, or (none)}
309
- PR_TEST_PLAN_BLOCK: {PR_TEST_PLAN_BLOCK from Phase 1 verbatim, or (none)}"
309
+ {COMPLIANCE_DIRECTIVE}"
310
310
  ```
311
311
 
312
312
  ---
@@ -324,13 +324,8 @@ TASK_DESCRIPTION: {phase 1 description}
324
324
  BASE_BRANCH: {base branch}
325
325
  EXECUTION_PLAN: {phase 1 steps}
326
326
  PATTERNS: {patterns from plan document or empty}
327
- CREATE_PR: false
328
- DOMAIN: {phase 1 domain, e.g., 'backend'}
329
327
  FEATURE_KNOWLEDGE: {feature_knowledge}
330
- COMPLIANCE_FRAMEWORKS: {COMPLIANCE_FRAMEWORKS}
331
- PR_DESCRIPTION_GUIDANCE: {pr_description_guidance}
332
- ISSUE_NUMBER: {ISSUE_ID captured in Phase 1, or (none)}
333
- ISSUE_PR_LINK: {ISSUE_PR_LINK captured in Phase 1, or (none)}
328
+ {COMPLIANCE_DIRECTIVE}
334
329
  HANDOFF_REQUIRED: true
335
330
  HANDOFF_FILE: {worktree}/.devflow/docs/handoff-{branch_slug}.md"
336
331
  ```
@@ -344,22 +339,15 @@ TASK_DESCRIPTION: {phase N description}
344
339
  BASE_BRANCH: {base branch}
345
340
  EXECUTION_PLAN: {phase N steps}
346
341
  PATTERNS: {patterns from plan document or empty}
347
- CREATE_PR: {true if last phase, false otherwise}
348
- DOMAIN: {phase N domain, e.g., 'frontend'}
349
342
  PRIOR_PHASE_SUMMARY: {summary from previous Code agent}
350
343
  FILES_FROM_PRIOR_PHASE: {list of files created}
351
344
  FEATURE_KNOWLEDGE: {feature_knowledge}
352
- COMPLIANCE_FRAMEWORKS: {COMPLIANCE_FRAMEWORKS}
353
- PR_DESCRIPTION_GUIDANCE: {pr_description_guidance}
354
- ISSUE_NUMBER: {ISSUE_ID captured in Phase 1, or (none)}
355
- ISSUE_PR_LINK: {ISSUE_PR_LINK captured in Phase 1, or (none)}
356
- PR_EXCEPTIONS: {the ## Evidence Exceptions section of {worktree}/.devflow/docs/handoff-{branch_slug}.md verbatim, or (none)}
357
- PR_TEST_PLAN_BLOCK: {PR_TEST_PLAN_BLOCK from Phase 1 verbatim, or (none)}
345
+ {COMPLIANCE_DIRECTIVE}
358
346
  HANDOFF_REQUIRED: {true if not last phase}
359
347
  HANDOFF_FILE: {worktree}/.devflow/docs/handoff-{branch_slug}.md"
360
348
  ```
361
349
 
362
- **Handoff Protocol**: Each sequential Code agent receives the prior Code agent's implementation summary via PRIOR_PHASE_SUMMARY and FILES_FROM_PRIOR_PHASE. The Code agent's built-in branch orientation step handles git log scanning, file reading, and pattern discovery automatically. Each Code agent with HANDOFF_REQUIRED=true appends its own `## Phase {N} Implementation Summary` section, at most 8,192 bytes, to `{worktree}/.devflow/docs/handoff-{branch_slug}.md` (survives context compaction), never rewriting an earlier section and keeping any `## Evidence Exceptions` section byte-identical; the next Code agent reads only the section of the phase immediately before its own through HANDOFF_FILE. The orchestrator writes no phase section. Delete `{worktree}/.devflow/docs/handoff-{branch_slug}.md` once the PR exists — after the final Code agent, which creates it, completes (cleanup).
350
+ **Handoff Protocol**: Each sequential Code agent receives the prior Code agent's implementation summary via PRIOR_PHASE_SUMMARY and FILES_FROM_PRIOR_PHASE. The Code agent's built-in branch orientation step handles git log scanning, file reading, and pattern discovery automatically. Each Code agent with HANDOFF_REQUIRED=true appends its own `## Phase {N} Implementation Summary` section, at most 8,192 bytes, to `{worktree}/.devflow/docs/handoff-{branch_slug}.md` (survives context compaction), never rewriting an earlier section and keeping any `## Evidence Exceptions` section byte-identical; the next Code agent reads only the section of the phase immediately before its own through HANDOFF_FILE. The orchestrator writes no phase section. Delete `{worktree}/.devflow/docs/handoff-{branch_slug}.md` once the PR exists — after Phase 9 (cleanup).
363
351
 
364
352
  ---
365
353
 
@@ -375,13 +363,8 @@ TASK_DESCRIPTION: {independent subtask 1}
375
363
  BASE_BRANCH: {base branch}
376
364
  EXECUTION_PLAN: {subtask 1 steps}
377
365
  PATTERNS: {patterns}
378
- CREATE_PR: false
379
- DOMAIN: {subtask 1 domain}
380
366
  FEATURE_KNOWLEDGE: {feature_knowledge}
381
- COMPLIANCE_FRAMEWORKS: {COMPLIANCE_FRAMEWORKS}
382
- PR_DESCRIPTION_GUIDANCE: {pr_description_guidance}
383
- ISSUE_NUMBER: {ISSUE_ID captured in Phase 1, or (none)}
384
- ISSUE_PR_LINK: {ISSUE_PR_LINK captured in Phase 1, or (none)}"
367
+ {COMPLIANCE_DIRECTIVE}"
385
368
 
386
369
  Agent(subagent_type="Code"): # Code agent 2 (same message)
387
370
  "OPERATION: implement
@@ -390,13 +373,8 @@ TASK_DESCRIPTION: {independent subtask 2}
390
373
  BASE_BRANCH: {base branch}
391
374
  EXECUTION_PLAN: {subtask 2 steps}
392
375
  PATTERNS: {patterns}
393
- CREATE_PR: false
394
- DOMAIN: {subtask 2 domain}
395
376
  FEATURE_KNOWLEDGE: {feature_knowledge}
396
- COMPLIANCE_FRAMEWORKS: {COMPLIANCE_FRAMEWORKS}
397
- PR_DESCRIPTION_GUIDANCE: {pr_description_guidance}
398
- ISSUE_NUMBER: {ISSUE_ID captured in Phase 1, or (none)}
399
- ISSUE_PR_LINK: {ISSUE_PR_LINK captured in Phase 1, or (none)}"
377
+ {COMPLIANCE_DIRECTIVE}"
400
378
  ```
401
379
 
402
380
  **Independence criteria** (all must be true for PARALLEL_CODE_AGENTS):
@@ -461,18 +439,15 @@ Validate alignment with request and plan. Report ALIGNED or MISALIGNED with deta
461
439
  1. Extract misalignment details from Evaluate agent output
462
440
  2. Increment `alignment_fix_count`
463
441
  3. If `alignment_fix_count <= 2`:
464
- - Spawn Code agent to fix misalignments:
442
+ - Spawn Code-fix agent to fix misalignments:
465
443
  ```
466
- Agent(subagent_type="Code"):
444
+ Agent(subagent_type="Code-fix"):
467
445
  "OPERATION: alignment-fix
468
446
  TASK_ID: {task-id}
469
447
  TASK_DESCRIPTION: Fix alignment issues
470
448
  MISALIGNMENTS: {structured misalignments from Evaluate agent}
471
449
  SCOPE: Fix only the listed misalignments, no other changes
472
- CREATE_PR: false
473
- ISSUE_NUMBER: {ISSUE_ID captured in Phase 1, or (none)}
474
- ISSUE_PR_LINK: {ISSUE_PR_LINK captured in Phase 1, or (none)}
475
- COMPLIANCE_FRAMEWORKS: {COMPLIANCE_FRAMEWORKS}"
450
+ {COMPLIANCE_DIRECTIVE}"
476
451
  ```
477
452
  - Loop back to Phase 5 (re-check alignment). The fix is not validated here: the Phase 6 run covers it.
478
453
  4. If `alignment_fix_count > 2`: Report misalignments to user for decision
@@ -495,18 +470,15 @@ Run build, typecheck, lint, test. Report pass/fail with failure details."
495
470
  1. Extract failure details from Validate agent output
496
471
  2. Increment `validation_retry_count`
497
472
  3. If `validation_retry_count <= 2`:
498
- - Spawn Code agent with fix context:
473
+ - Spawn Code-fix agent with fix context:
499
474
  ```
500
- Agent(subagent_type="Code"):
475
+ Agent(subagent_type="Code-fix"):
501
476
  "OPERATION: validation-fix
502
477
  TASK_ID: {task-id}
503
478
  TASK_DESCRIPTION: Fix validation failures
504
479
  VALIDATION_FAILURES: {parsed failures from Validate agent}
505
480
  SCOPE: Fix only the listed failures, no other changes
506
- CREATE_PR: false
507
- ISSUE_NUMBER: {ISSUE_ID captured in Phase 1, or (none)}
508
- ISSUE_PR_LINK: {ISSUE_PR_LINK captured in Phase 1, or (none)}
509
- COMPLIANCE_FRAMEWORKS: {COMPLIANCE_FRAMEWORKS}"
481
+ {COMPLIANCE_DIRECTIVE}"
510
482
  ```
511
483
  - Loop back to Phase 6 (re-validate at the new HEAD, full scope)
512
484
  4. If `validation_retry_count > 2`: Report failures to user and halt
@@ -522,7 +494,7 @@ Run build, typecheck, lint, test. Report pass/fail with failure details."
522
494
 
523
495
  - `gate:validate` — after a Phase 6 or Phase 8 PASS.
524
496
  - `TP-<n>` — after every Phase 7 run, one line per `### Test Plan Evidence` row whose TP is in `TEST_PLAN`, with the row's outcome; the line ends at `by:test` when the row's Exit is not a number from 0 to 255.
525
- - Append nothing from a report whose `HEAD:` is not a single 40-hex SHA — a reported before/after change included — and say so in the Phase 11 report.
497
+ - Append nothing from a report whose `HEAD:` is not a single 40-hex SHA — a reported before/after change included — and say so in the Phase 12 report.
526
498
 
527
499
  ### Phase 7: QA Testing
528
500
 
@@ -549,21 +521,18 @@ After every Test agent run — PASS or FAIL, first run or retry — append its T
549
521
  1. Extract failure details from Test agent output
550
522
  2. Increment `qa_retry_count`
551
523
  3. If `qa_retry_count <= 2`:
552
- - Spawn Code agent to fix QA failures:
524
+ - Spawn Code-fix agent to fix QA failures:
553
525
  ```
554
- Agent(subagent_type="Code"):
526
+ Agent(subagent_type="Code-fix"):
555
527
  "OPERATION: qa-fix
556
528
  TASK_ID: {task-id}
557
529
  TASK_DESCRIPTION: Fix QA test failures
558
530
  QA_FAILURES: {structured failures from Test agent}
559
531
  SCOPE: Fix only the listed failures, no other changes
560
- CREATE_PR: false
561
- ISSUE_NUMBER: {ISSUE_ID captured in Phase 1, or (none)}
562
- ISSUE_PR_LINK: {ISSUE_PR_LINK captured in Phase 1, or (none)}
563
- COMPLIANCE_FRAMEWORKS: {COMPLIANCE_FRAMEWORKS}"
532
+ {COMPLIANCE_DIRECTIVE}"
564
533
  ```
565
534
  - Loop back to Phase 7 (re-run Test agent). The fix is not validated here: Phase 8 covers it.
566
- 4. If `qa_retry_count > 2`: Report QA failures to user for decision. The run stops at the report (Phase 11), so Phases 8 and 9 do not run.
535
+ 4. If `qa_retry_count > 2`: Report QA failures to user for decision. The run stops at the report (Phase 12), so Phases 8 to 11 do not run.
567
536
 
568
537
  ### Phase 8: Re-Validate (only if a qa-fix committed)
569
538
 
@@ -583,12 +552,37 @@ Verify the qa-fix commits did not break anything."
583
552
 
584
553
  **If PASS:** append a `gate:validate` claim (Phase 6's **Evidence claims**), then continue to Phase 9.
585
554
 
586
- ### Phase 9: CI Status Gate
555
+ ### Phase 9: Open PR
556
+
557
+ **Produces:** PR_NUMBER
558
+ **Requires:** BASE_BRANCH, TASK_ID, ISSUE_NUMBER, ISSUE_PR_LINK, PR_EXCEPTIONS, PR_TEST_PLAN_BLOCK, PR_DESCRIPTION_GUIDANCE, APPLY_CONVENTIONS, CODE_AGENT_OUTPUT
559
+
560
+ Run once, after the gates, under every strategy. This phase sits outside the strategy branches, so no run reaches the end with commits and no PR. No Code agent opens a PR: the Git agent does, and it pastes `ISSUE_PR_LINK`, `PR_EXCEPTIONS` and `PR_TEST_PLAN_BLOCK` through their paste gates and scrubs the body (D11) before `gh pr create`. This command renders no link line and creates no PR itself: the Git agent's Phase-1 rendering is the only one, forwarded verbatim.
561
+
562
+ ```
563
+ Agent(subagent_type="Git"):
564
+ "OPERATION: ensure-pr-ready
565
+ WORKTREE_PATH: {worktree}
566
+ BASE_BRANCH: {base branch}
567
+ TASK_ID: {task-id}
568
+ ISSUE_NUMBER: {ISSUE_ID captured in Phase 1, or (none)}
569
+ ISSUE_PR_LINK: {ISSUE_PR_LINK captured in Phase 1, or (none)}
570
+ PR_EXCEPTIONS: {the ## Evidence Exceptions section of {worktree}/.devflow/docs/handoff-{branch_slug}.md verbatim, or (none)}
571
+ PR_TEST_PLAN_BLOCK: {PR_TEST_PLAN_BLOCK verbatim, or (none)}
572
+ PR_DESCRIPTION_GUIDANCE: {pr_description_guidance from Phase 1 unless it is (none), then the Code agents' reports from CODE_AGENT_OUTPUT in spawn order — Implementation, Commits and Key Decisions, and a sequential agent's ## Phase {N} Implementation Summary}
573
+ APPLY_CONVENTIONS: {APPLY_CONVENTIONS}
574
+ COMMIT_UNCOMMITTED: false
575
+ Open the pull request for this branch and return the pre-flight summary."
576
+ ```
577
+
578
+ `COMMIT_UNCOMMITTED: false` keeps the Git agent from committing a stray file: the Code, Simplify, Scrutinize and fix agents commit their own work. Capture the `- **PR**: #{number}` line of its `### Branch` as `PR_NUMBER`, its `### Uncommitted files` list and its `TRACEABILITY: DEGRADED ({reason})` lines for the Phase 12 report. If it returns `### Status: BLOCKED` or no PR number, report its reason to the user and stop at the report (Phase 12); Phases 10 and 11 do not run.
579
+
580
+ ### Phase 10: CI Status Gate
587
581
 
588
582
  **Produces:** CI_STATUS
589
- **Requires:** PR_URL, FILES_CHANGED
583
+ **Requires:** PR_NUMBER, FILES_CHANGED
590
584
 
591
- Strategy-conditional: run when the PR already exists — **SINGLE_CODE_AGENT** and **SEQUENTIAL_CODE_AGENTS** (the Phase 2 Code agent with `CREATE_PR: true` creates it); skip for **PARALLEL_CODE_AGENTS** (its unified PR is created in Phase 10).
585
+ Run under every strategy: Phase 9 opened the PR.
592
586
 
593
587
  **Push first, outside the gate block.** The gate reads CI for the pushed head, and the Simplify, Scrutinize and fix commits reach the PR only by a push. Push once — never force, and no retry:
594
588
 
@@ -596,52 +590,24 @@ Strategy-conditional: run when the PR already exists — **SINGLE_CODE_AGENT** a
596
590
  git push origin HEAD; echo "exit=$?"
597
591
  ```
598
592
 
599
- `exit=0` continues to the gate. Any other result, a rejected non-fast-forward push included, records `TRACEABILITY: DEGRADED (ci push failed)` for the Phase 11 report, reports "CI status unknown — verify manually before merging" and proceeds to Phase 10 without waiting. `PR_NUMBER` is the number in `PR_URL`.
593
+ `exit=0` continues to the gate. Any other result, a rejected non-fast-forward push included, records `TRACEABILITY: DEGRADED (ci push failed)` for the Phase 12 report, reports "CI status unknown — verify manually before merging" and proceeds to Phase 11 without waiting.
600
594
 
601
595
  <!-- PATTERN: ci-status-gate -->
602
596
  1. Wait: run `cd {worktree} && HEAD_SHA=$(git rev-parse HEAD) && node "$HOME/.devflow/scripts/ci-wait.cjs" --pr {PR_NUMBER} --head "$HEAD_SHA"` through the Bash tool with `timeout: 600000`. Each run is one wait of at most 570 seconds and prints one line, `CI <STATUS> pr=… head=… failing=… pending=… waited=…` (INDETERMINATE adds `reason=…`). A missing or unparseable line, a status outside the six below, or a non-zero exit is INDETERMINATE.
603
- 2. **If PASSING** → proceed to Phase 10.
604
- 3. **If NO_PR or NO_CI** → skip: "No PR/CI configured, skipping CI validation." Proceed to Phase 10.
597
+ 2. **If PASSING** → proceed to Phase 11.
598
+ 3. **If NO_PR or NO_CI** → skip: "No PR/CI configured, skipping CI validation." Proceed to Phase 11.
605
599
  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.
606
600
  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.
607
- 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.
601
+ 6. **If FAILING** and fewer than 2 fixes have run → report the failing checks from the line. Spawn `Agent(subagent_type="Code-fix")` whose prompt opens with `OPERATION: ci-fix`, with `COMPLIANCE_DIRECTIVE` (when it is not empty), `CI_FAILURES` and `PUSH: false`; `CI_FAILURES` holds the failing-check names from the line and nothing else, because the Code-fix agent fetches the full names and reads the logs itself and this command reads none. After a fix, push with the command above and, if a wait remains, wait again (step 1); a failed push records `TRACEABILITY: DEGRADED (ci push failed)`, reports "CI status unknown — verify manually before merging" and stops waiting. After the second fix still FAILING → report the failing checks and proceed.
608
602
  7. **Budget**: at most 3 waits and 2 fixes in all. When one is spent, report the current status and proceed.
609
603
  <!-- /PATTERN: ci-status-gate -->
610
604
 
611
- ### Phase 10: Create PR
612
-
613
- **Produces:** PR_URL
614
- **Requires:** BASE_BRANCH, TASK_ID, PR_EXCEPTIONS, PR_TEST_PLAN_BLOCK
615
-
616
- **For SEQUENTIAL_CODE_AGENTS**: the PR already exists — the last Phase 2 Code agent (`CREATE_PR: true`) created it, and Phase 9 has gated its CI.
617
-
618
- **For PARALLEL_CODE_AGENTS**: spawn one Code agent to create the unified PR:
619
-
620
- ```
621
- Agent(subagent_type="Code"):
622
- "OPERATION: pr-create
623
- TASK_ID: {task-id}
624
- TASK_DESCRIPTION: Create the unified PR for the parallel implementation
625
- BASE_BRANCH: {base branch}
626
- CREATE_PR: true
627
- PR_DESCRIPTION_GUIDANCE: {pr_description_guidance}
628
- ISSUE_NUMBER: {ISSUE_ID captured in Phase 1, or (none)}
629
- ISSUE_PR_LINK: {ISSUE_PR_LINK captured in Phase 1, or (none)}
630
- PR_EXCEPTIONS: {the ## Evidence Exceptions section of {worktree}/.devflow/docs/handoff-{branch_slug}.md verbatim, or (none)}
631
- PR_TEST_PLAN_BLOCK: {PR_TEST_PLAN_BLOCK from Phase 1 verbatim, or (none)}
632
- COMPLIANCE_FRAMEWORKS: {COMPLIANCE_FRAMEWORKS}"
633
- ```
634
-
635
- Its Responsibility 7 composes the body, pastes `ISSUE_PR_LINK`, `PR_EXCEPTIONS` and `PR_TEST_PLAN_BLOCK` through their paste gates and scrubs the body (D11) before `gh pr create`. This command renders no link line and creates no PR itself: the Git agent's Phase-1 rendering is the only one, forwarded verbatim.
636
-
637
- **For SINGLE_CODE_AGENT**: PR is created by the Code agent (CREATE_PR: true) — the Code agent's Responsibility 7 handles Related Issues inclusion when ISSUE_NUMBER is provided.
638
-
639
- ### Phase 10b: Evidence
605
+ ### Phase 11: Evidence
640
606
 
641
607
  **Produces:** EVIDENCE_RESULT
642
- **Requires:** PR_URL, EVIDENCE_FILE, REVIEW_PUBLICATION
608
+ **Requires:** PR_NUMBER, EVIDENCE_FILE, REVIEW_PUBLICATION
643
609
 
644
- Run once, after Phase 10, under every strategy: the PR exists by now under all three — from Phase 2 for SINGLE_CODE_AGENT and SEQUENTIAL_CODE_AGENTS, from Phase 10 for PARALLEL_CODE_AGENTS. Skip it only when no PR was created. PARALLEL_CODE_AGENTS ran no CI gate, so its `ci` TPs usually read `INDETERMINATE` until a later refresh.
610
+ Run once, after Phase 10, under every strategy: the PR exists by now, opened in Phase 9. The re-validation path has no CI gate and runs this phase straight after Phase 9. Skip it only when Phase 9 stopped the run. A `ci` TP reads `INDETERMINATE` only when the CI gate could not tell or did not run.
645
611
 
646
612
  **Push first.** Every claim is keyed to the HEAD an agent reported, and a Scrutinize or fix agent may have committed without pushing; a claim whose SHA is not in the PR reads `UNVERIFIED`. So push the branch once before the spawn — never force, and no retry:
647
613
 
@@ -649,29 +615,31 @@ Run once, after Phase 10, under every strategy: the PR exists by now under all t
649
615
  git push origin HEAD; echo "exit=$?"
650
616
  ```
651
617
 
652
- `exit=0` continues to the spawn. Any other result, a rejected non-fast-forward push included, does not block: record `TRACEABILITY: DEGRADED (evidence push failed)` for the Phase 11 report and spawn anyway.
618
+ `exit=0` continues to the spawn. Any other result, a rejected non-fast-forward push included, does not block: record `TRACEABILITY: DEGRADED (evidence push failed)` for the Phase 12 report and spawn anyway.
653
619
 
654
620
  ```
655
621
  Agent(subagent_type="Git"):
656
622
  "OPERATION: update-pr-evidence
657
- PR_NUMBER: {number from PR_URL}
623
+ PR_NUMBER: {PR_NUMBER}
658
624
  EVIDENCE_FILE: .devflow/docs/evidence-{branch_slug}.md
659
625
  REVIEW_PUBLICATION: {REVIEW_PUBLICATION resolved in Phase 1, or auto}
660
626
  WORKTREE_PATH: {worktree}
661
627
  Update the PR's test-plan block and post its evidence comment."
662
628
  ```
663
629
 
664
- Omit the `EVIDENCE_FILE` line when that file does not exist. Capture the op's `## PR Evidence` block — its `EVIDENCE` line and its `**Body**:` / `**Comment**:` line — as `EVIDENCE_RESULT`, or its `TRACEABILITY: DEGRADED ({reason})` line. It never blocks: whatever it returns, continue to Phase 11.
630
+ Omit the `EVIDENCE_FILE` line when that file does not exist. Capture the op's `## PR Evidence` block — its `EVIDENCE` line and its `**Body**:` / `**Comment**:` line — as `EVIDENCE_RESULT`, or its `TRACEABILITY: DEGRADED ({reason})` line. It never blocks: whatever it returns, continue to Phase 12.
665
631
 
666
- ### Phase 11: Report
632
+ ### Phase 12: Report
667
633
 
668
- **Requires:** VALIDATION_RESULT, ALIGNMENT_RESULT, QA_RESULT, PR_URL, EVIDENCE_RESULT
634
+ **Requires:** VALIDATION_RESULT, ALIGNMENT_RESULT, QA_RESULT, PR_NUMBER, EVIDENCE_RESULT
669
635
 
670
636
  Display completion summary with phase status, PR info, and next steps.
671
637
 
672
- Show the test plan's evidence from Phase 10b: `Test plan: {VERIFIED-CI + ATTESTED-LOCAL}/{total} verified (VERIFIED-CI {n}, ATTESTED-LOCAL {n})`, read from the `EVIDENCE` line and never inferred, then its `**Body**:` / `**Comment**:` line verbatim. Without an `EVIDENCE` line, show `Test plan: evidence unavailable`; with no test plan, `Test plan: missing`.
638
+ Show the test plan's evidence from Phase 11: `Test plan: {VERIFIED-CI + ATTESTED-LOCAL}/{total} verified (VERIFIED-CI {n}, ATTESTED-LOCAL {n})`, read from the `EVIDENCE` line and never inferred, then its `**Body**:` / `**Comment**:` line verbatim. Without an `EVIDENCE` line, show `Test plan: evidence unavailable`; with no test plan, `Test plan: missing`.
639
+
640
+ If any Git agent output emitted `TRACEABILITY: DEGRADED ({reason})` lines during the run, or Phase 10's push or Phase 11's push recorded one, surface them verbatim in the report under a `### Traceability` subsection so the user can act on them.
673
641
 
674
- If any Git agent output emitted `TRACEABILITY: DEGRADED ({reason})` lines during the run, or Phase 9's push or Phase 10b's push recorded one, surface them verbatim in the report under a `### Traceability` subsection so the user can act on them.
642
+ If Phase 9 listed uncommitted files, show them as a `### Uncommitted files` subsection: the user commits them or discards them.
675
643
 
676
644
  If Phase 1 recorded an evidence exception, show its `## Evidence Exceptions` lines in the report.
677
645
 
@@ -735,7 +703,7 @@ When the Knowledge agent reports `KB_COMMIT: skipped (detached HEAD)`, the files
735
703
  /implement (orchestrator - spawns agents only)
736
704
  │
737
705
  ├─ Re-validation Path (when user says "re-validate"/"re-check"/"re-run gates")
738
- │ └─ Branch safety → skip Phase 2 → detect FILES_CHANGED → Phases 3-8 → Phase 10, 10b, 11
706
+ │ └─ Branch safety → skip Phase 2 → detect FILES_CHANGED → Phases 3-8 → Phase 9, 11, 12
739
707
  │
740
708
  ├─ Phase 1: Setup
741
709
  │ └─ Plan document parsing (if .md path provided) - extracts execution plan, strategy, frontmatter issue
@@ -744,7 +712,7 @@ When the Knowledge agent reports `KB_COMMIT: skipped (detached HEAD)`, the files
744
712
  │ └─ Test plan (evidence file) - copy or author TP lines, check them, render the PR block; missing under a required policy: record a test-plan exception or stop
745
713
  │
746
714
  ├─ Phase 2: Implement (3-strategy framework)
747
- │ ├─ SINGLE_CODE_AGENT (80%): One Code agent, full plan, CREATE_PR: true
715
+ │ ├─ SINGLE_CODE_AGENT (80%): One Code agent, full plan
748
716
  │ ├─ SEQUENTIAL_CODE_AGENTS (15%): N Code agents with handoff summaries
749
717
  │ └─ PARALLEL_CODE_AGENTS (5%): N Code agents in single message (rare)
750
718
  │
@@ -756,33 +724,31 @@ When the Knowledge agent reports `KB_COMMIT: skipped (detached HEAD)`, the files
756
724
  │
757
725
  ├─ Phase 5: Alignment Check
758
726
  │ └─ Evaluate agent (validates alignment - reports only, no fixes)
759
- │ └─ If MISALIGNED: Code agent fix loop (max 2 iterations) → re-check alignment
727
+ │ └─ If MISALIGNED: Code-fix agent loop (max 2 iterations) → re-check alignment
760
728
  │
761
729
  ├─ Phase 6: Validate (the one full-suite slot)
762
730
  │ └─ Validate agent (build, typecheck, lint, test over the branch diff)
763
- │ └─ If FAIL: Code agent fix loop (max 2 retries) → re-validate at the new HEAD
731
+ │ └─ If FAIL: Code-fix agent loop (max 2 retries) → re-validate at the new HEAD
764
732
  │ └─ If PASS: record VALIDATED_HEAD, gate:validate claim → evidence file
765
733
  │
766
734
  ├─ Phase 7: QA Testing
767
735
  │ └─ Test agent (scenario-based acceptance tests, TEST_PLAN) → one claim per TP row → evidence file
768
- │ └─ If FAIL: Code agent fix loop (max 2 retries) → re-test
736
+ │ └─ If FAIL: Code-fix agent loop (max 2 retries) → re-test
769
737
  │
770
738
  ├─ Phase 8: Re-Validate (only if a qa-fix committed)
771
739
  │ └─ Validate agent (changed-only over VALIDATED_HEAD..HEAD) → gate:validate claim
772
740
  │
773
- ├─ Phase 9: CI Status Gate (SINGLE_CODE_AGENT + SEQUENTIAL_CODE_AGENTS; skipped for PARALLEL_CODE_AGENTS)
774
- │ └─ Push the branch, then ci-wait.cjs (inline, one wait ≤ 570 s) → Code agent on FAILING (3 waits + 2 fixes)
741
+ ├─ Phase 9: Open PR (every strategy, outside the strategy branches)
742
+ │ └─ Git agent (operation: ensure-pr-ready) - commits nothing (COMMIT_UNCOMMITTED: false), pushes, opens the PR with the pasted link line, exceptions and test-plan block, D11-scrubbed body
775
743
  │
776
- ├─ Phase 10: Create PR (if needed)
777
- │ └─ SINGLE_CODE_AGENT: already created by the Phase 2 Code agent
778
- │ └─ SEQUENTIAL: already created by the last Phase 2 Code agent
779
- │ └─ PARALLEL: Code agent (pr-create) creates unified PR
744
+ ├─ Phase 10: CI Status Gate (every strategy)
745
+ │ └─ Push the branch, then ci-wait.cjs (inline, one wait ≤ 570 s) → Code-fix agent on FAILING (3 waits + 2 fixes)
780
746
  │
781
- ├─ Phase 10b: Evidence (every strategy, once the PR exists)
747
+ ├─ Phase 11: Evidence (every strategy, once the PR exists)
782
748
  │ └─ Push the branch (never force; a failure is DEGRADED, not a stop)
783
749
  │ └─ Git agent (update-pr-evidence) - test-plan block + evidence comment; never blocks
784
750
  │
785
- ├─ Phase 11: Report
751
+ ├─ Phase 12: Report
786
752
  │
787
753
  └─ Feature Knowledge Write-Back (Conditional)
788
754
  └─ Knowledge agent (if documented area changed AND knowledge enabled)
@@ -790,7 +756,7 @@ When the Knowledge agent reports `KB_COMMIT: skipped (detached HEAD)`, the files
790
756
 
791
757
  ## Principles
792
758
 
793
- 1. **Orchestration only** - Command spawns agents, never does work itself; the inline calls are the bounded plumbing the charter allows: the Phase 9 and Phase 10b pushes, the Phase 9 ci-wait call and the evidence script checks
759
+ 1. **Orchestration only** - Command spawns agents, never does work itself; the inline calls are the bounded plumbing the charter allows: the Phase 10 and Phase 11 pushes, the Phase 10 ci-wait call and the evidence script checks
794
760
  2. **Plan-first** - Plan documents from `/plan` skip exploration/planning overhead entirely
795
761
  3. **Coherence-first** - Single Code agent produces more consistent code (default ~80% of tasks)
796
762
  4. **Agent ownership** - Each agent owns its output completely
@@ -799,9 +765,9 @@ When the Knowledge agent reports `KB_COMMIT: skipped (detached HEAD)`, the files
799
765
  7. **Simplification pass** - Code refined for clarity before PR
800
766
  8. **Strict delegation** - Never perform agent work in main session. "Spawn X" means call Agent tool with X, not do X's work yourself
801
767
  9. **Validate agent owns validation** - Never run `npm test`, `npm run build`, or similar in main session; always delegate to Validate agent
802
- 10. **Code agent owns fixes** - Never implement fixes in main session; spawn Code agent for validation failures and alignment fixes
768
+ 10. **Code-fix agent owns fixes** - Never implement fixes in main session; spawn Code-fix agent for validation failures and alignment fixes
803
769
  11. **Loop limits** - Max 2 validation retries, max 2 alignment fix iterations, max 2 QA retries before escalating to user; the CI gate allows at most 3 waits and 2 fixes
804
- 12. **CI awareness** - CI status is checked before merge for SINGLE_CODE_AGENT and SEQUENTIAL_CODE_AGENTS, whose PR exists from Phase 2; skipped for PARALLEL_CODE_AGENTS, whose PR is created in Phase 10; test-plan evidence (Phase 10b) is recorded under every strategy once the PR exists
770
+ 12. **CI awareness** - CI status is checked before merge under every strategy, once Phase 9 has opened the PR; test-plan evidence (Phase 11) is recorded under every strategy once the PR exists
805
771
 
806
772
  ## Error Handling
807
773
 
@@ -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
  |-------|-------------|------|
@@ -460,8 +465,10 @@ User can:
460
465
 
461
466
  **Store design artifact:**
462
467
 
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`)
468
+ **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.
469
+
470
+ **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:
471
+ - 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
472
  - 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
473
  - If no issue: `{worktree}/.devflow/docs/design/{topic-slug}.{YYYY-MM-DD_HHMM}.md`
467
474
 
@@ -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)
@@ -228,6 +226,9 @@ Confirm with user via AskUserQuestion before executing:
228
226
  Sequential execution with progress checkpoints:
229
227
  1. **Version bumps** — write new version to configured files
230
228
  2. **Changelog update** — move Unreleased section to versioned entry (if configured)
229
+
230
+ **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.
231
+
231
232
  3. **Release commit** — `chore(release): v{VERSION}` (conventional commit)
232
233
  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
234
  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
@@ -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