devflow-kit 3.10.0 → 3.12.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 (229) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/dist/agents/architect.md +87 -0
  3. package/dist/agents/code.md +21 -25
  4. package/dist/agents/debug.md +21 -49
  5. package/dist/agents/design.md +9 -43
  6. package/dist/agents/fix.md +15 -29
  7. package/dist/agents/git.md +19 -22
  8. package/dist/agents/harden.md +14 -19
  9. package/dist/agents/knowledge.md +11 -19
  10. package/dist/agents/refactor.md +9 -14
  11. package/dist/agents/research.md +11 -34
  12. package/dist/agents/review.md +22 -52
  13. package/dist/agents/skim.md +7 -17
  14. package/dist/agents/triage.md +7 -14
  15. package/dist/cli/commands/backup-session.js +131 -0
  16. package/dist/cli/commands/compliance.js +16 -3
  17. package/dist/cli/commands/curation.js +12 -4
  18. package/dist/cli/commands/init.js +36 -55
  19. package/dist/cli/commands/install-report.js +95 -0
  20. package/dist/cli/commands/legacy-sweep.js +140 -45
  21. package/dist/cli/commands/rules.js +50 -13
  22. package/dist/cli/commands/uninstall.js +62 -24
  23. package/dist/commands/bug-analysis.md +31 -62
  24. package/dist/commands/code-review.md +38 -87
  25. package/dist/commands/debug.md +32 -82
  26. package/dist/commands/dynamic-build.md +155 -211
  27. package/dist/commands/dynamic-plan.md +71 -93
  28. package/dist/commands/dynamic-profile.md +7 -155
  29. package/dist/commands/dynamic-tickets.md +65 -186
  30. package/dist/commands/explore.md +27 -70
  31. package/dist/commands/implement.md +98 -186
  32. package/dist/commands/plan.md +60 -107
  33. package/dist/commands/release.md +25 -91
  34. package/dist/commands/research.md +34 -103
  35. package/dist/commands/resolve.md +64 -128
  36. package/dist/commands/self-review.md +35 -99
  37. package/dist/compliance-off/agents/git.md +15 -18
  38. package/dist/compliance-off/agents/triage.md +7 -14
  39. package/dist/compliance-off/commands/bug-analysis.md +31 -62
  40. package/dist/compliance-off/commands/code-review.md +34 -82
  41. package/dist/compliance-off/commands/dynamic-build.md +149 -205
  42. package/dist/compliance-off/commands/dynamic-tickets.md +65 -186
  43. package/dist/compliance-off/commands/implement.md +94 -180
  44. package/dist/compliance-off/commands/plan.md +60 -107
  45. package/dist/compliance-off/commands/release.md +25 -90
  46. package/dist/compliance-off/commands/resolve.md +54 -128
  47. package/dist/compliance-off/skills/git/references/tracker/github/ensure-pr-ready.md +3 -3
  48. package/dist/compliance-off/skills/git/references/tracker/jira/ensure-pr-ready.md +3 -3
  49. package/dist/compliance-off/skills/git/references/tracker/linear/ensure-pr-ready.md +3 -3
  50. package/dist/core/compliance.js +14 -0
  51. package/dist/core/fs-atomic.js +5 -1
  52. package/dist/core/orphan-sweep.js +20 -2
  53. package/dist/core/path-set.js +15 -0
  54. package/dist/core/plugins.js +6 -5
  55. package/dist/core/reference-sweep.js +42 -25
  56. package/dist/core/retired-shipped-names.js +278 -0
  57. package/dist/curation-compliance-off/agents/triage.md +7 -13
  58. package/dist/curation-compliance-off/commands/bug-analysis.md +21 -41
  59. package/dist/curation-compliance-off/commands/code-review.md +25 -62
  60. package/dist/curation-compliance-off/commands/dynamic-build.md +142 -194
  61. package/dist/curation-compliance-off/commands/dynamic-tickets.md +54 -173
  62. package/dist/curation-compliance-off/commands/implement.md +86 -161
  63. package/dist/curation-compliance-off/commands/plan.md +51 -86
  64. package/dist/curation-compliance-off/commands/release.md +17 -78
  65. package/dist/curation-compliance-off/commands/resolve.md +45 -108
  66. package/dist/curation-off/agents/architect.md +81 -0
  67. package/dist/curation-off/agents/code.md +20 -23
  68. package/dist/curation-off/agents/debug.md +19 -47
  69. package/dist/curation-off/agents/design.md +8 -41
  70. package/dist/curation-off/agents/fix.md +14 -27
  71. package/dist/curation-off/agents/harden.md +13 -18
  72. package/dist/curation-off/agents/knowledge.md +9 -17
  73. package/dist/curation-off/agents/refactor.md +8 -12
  74. package/dist/curation-off/agents/research.md +9 -32
  75. package/dist/curation-off/agents/review.md +11 -40
  76. package/dist/curation-off/agents/skim.md +7 -17
  77. package/dist/curation-off/agents/triage.md +7 -13
  78. package/dist/curation-off/commands/bug-analysis.md +21 -41
  79. package/dist/curation-off/commands/code-review.md +29 -67
  80. package/dist/curation-off/commands/debug.md +24 -63
  81. package/dist/curation-off/commands/dynamic-build.md +148 -200
  82. package/dist/curation-off/commands/dynamic-plan.md +60 -80
  83. package/dist/curation-off/commands/dynamic-tickets.md +54 -173
  84. package/dist/curation-off/commands/explore.md +18 -50
  85. package/dist/curation-off/commands/implement.md +90 -167
  86. package/dist/curation-off/commands/plan.md +51 -86
  87. package/dist/curation-off/commands/release.md +17 -79
  88. package/dist/curation-off/commands/research.md +23 -81
  89. package/dist/curation-off/commands/resolve.md +55 -108
  90. package/dist/curation-off/commands/self-review.md +26 -78
  91. package/dist/skills/git/references/pr/update-pr-evidence.md +2 -1
  92. package/dist/skills/git/references/tracker/github/ensure-pr-ready.md +3 -3
  93. package/dist/skills/git/references/tracker/jira/ensure-pr-ready.md +3 -3
  94. package/dist/skills/git/references/tracker/linear/ensure-pr-ready.md +3 -3
  95. package/dist/targets/claude-code/compliance-install.js +38 -13
  96. package/dist/targets/claude-code/compliance-off-files.js +5 -1
  97. package/dist/targets/claude-code/curation-install.js +77 -32
  98. package/dist/targets/claude-code/folder-swap.js +142 -0
  99. package/dist/targets/claude-code/install-backup.js +780 -0
  100. package/dist/targets/claude-code/installer.js +383 -192
  101. package/dist/targets/claude-code/legacy-skill-hashes.js +170 -0
  102. package/dist/targets/claude-code/linked-folder.js +5 -11
  103. package/dist/targets/claude-code/reference-converge.js +15 -2
  104. package/dist/targets/claude-code/rules-folder.js +34 -0
  105. package/dist/targets/claude-code/shipped-set.js +160 -0
  106. package/dist/targets/claude-code/workflow-folder-install.js +32 -12
  107. package/dist/variant-axes.json +5 -1
  108. package/package.json +1 -1
  109. package/src/assets/agents/_partials/_code.mds +3 -5
  110. package/src/assets/agents/_partials/_design.mds +86 -0
  111. package/src/assets/agents/architect.mds +41 -0
  112. package/src/assets/agents/code.mds +18 -20
  113. package/src/assets/agents/curate.md +26 -35
  114. package/src/assets/agents/debug.mds +21 -49
  115. package/src/assets/agents/design.mds +11 -114
  116. package/src/assets/agents/evaluate.md +6 -16
  117. package/src/assets/agents/explore.md +1 -2
  118. package/src/assets/agents/fix.mds +12 -24
  119. package/src/assets/agents/git.mds +20 -23
  120. package/src/assets/agents/harden.mds +14 -19
  121. package/src/assets/agents/knowledge.mds +10 -38
  122. package/src/assets/agents/polish.md +13 -39
  123. package/src/assets/agents/refactor.mds +6 -9
  124. package/src/assets/agents/research.mds +11 -34
  125. package/src/assets/agents/review.mds +12 -84
  126. package/src/assets/agents/skim.mds +7 -17
  127. package/src/assets/agents/synthesize.md +3 -21
  128. package/src/assets/agents/test.md +31 -32
  129. package/src/assets/agents/tracker.md +116 -229
  130. package/src/assets/agents/triage.mds +7 -26
  131. package/src/assets/agents/validate.md +1 -3
  132. package/src/assets/commands/_partials/_compliance.mds +2 -2
  133. package/src/assets/commands/_partials/_decisions.mds +17 -24
  134. package/src/assets/commands/_partials/_docs_root.mds +31 -10
  135. package/src/assets/commands/_partials/_engine.mds +34 -56
  136. package/src/assets/commands/_partials/_evidence_policy.mds +1 -1
  137. package/src/assets/commands/_partials/_factory.mds +10 -104
  138. package/src/assets/commands/_partials/_knowledge.mds +47 -51
  139. package/src/assets/commands/_partials/_plan_contract.mds +2 -2
  140. package/src/assets/commands/_partials/_preamble.mds +21 -21
  141. package/src/assets/commands/_partials/_publication.mds +3 -3
  142. package/src/assets/commands/_partials/_roster.mds +12 -13
  143. package/src/assets/commands/_partials/_settings.mds +6 -3
  144. package/src/assets/commands/_partials/_ticket_template.mds +3 -7
  145. package/src/assets/commands/_partials/_tracker.mds +10 -5
  146. package/src/assets/commands/_partials/_wave.mds +23 -32
  147. package/src/assets/commands/bug-analysis.mds +3 -7
  148. package/src/assets/commands/code-review.mds +12 -33
  149. package/src/assets/commands/debug.mds +5 -47
  150. package/src/assets/commands/dynamic-build.mds +48 -70
  151. package/src/assets/commands/dynamic-plan.mds +23 -42
  152. package/src/assets/commands/dynamic-profile.mds +7 -57
  153. package/src/assets/commands/dynamic-tickets.mds +9 -29
  154. package/src/assets/commands/explore.mds +5 -44
  155. package/src/assets/commands/implement.mds +75 -117
  156. package/src/assets/commands/plan.mds +27 -57
  157. package/src/assets/commands/release.mds +4 -62
  158. package/src/assets/commands/research.mds +7 -53
  159. package/src/assets/commands/resolve.mds +40 -87
  160. package/src/assets/commands/self-review.mds +5 -45
  161. package/src/assets/mds/git/_ops_pr.mds +1 -0
  162. package/src/assets/mds/git/_ops_steps.mds +4 -4
  163. package/src/assets/mds/git/_pr.mds +1 -1
  164. package/src/assets/rules/engineering.md +1 -1
  165. package/src/assets/rules/quality.md +2 -2
  166. package/src/assets/scripts/ci-wait.cjs +150 -18
  167. package/src/assets/scripts/hooks/assets/orchestrator-charter.md +3 -3
  168. package/src/assets/scripts/hooks/preamble +2 -3
  169. package/src/assets/scripts/pr-evidence.cjs +1 -0
  170. package/src/assets/scripts/resolve-evidence-policy.cjs +14 -13
  171. package/src/assets/scripts/resolve-root.cjs +186 -0
  172. package/src/assets/scripts/resolve-settings.cjs +14 -9
  173. package/src/assets/scripts/verify-evidence.cjs +355 -22
  174. package/src/assets/skills/accessibility/SKILL.md +28 -95
  175. package/src/assets/skills/agent-references/SKILL.md +2 -4
  176. package/src/assets/skills/agent-references/references/commands/implement-evidence-asks.md +1 -1
  177. package/src/assets/skills/agent-references/references/commands/implement-levels.md +4 -7
  178. package/src/assets/skills/agent-references/references/commands/implement-revalidate.md +1 -1
  179. package/src/assets/skills/agent-references/references/commands/plan-levels.md +2 -2
  180. package/src/assets/skills/apply-decisions/SKILL.md +5 -6
  181. package/src/assets/skills/apply-feature-knowledge/SKILL.md +3 -13
  182. package/src/assets/skills/architecture/SKILL.md +29 -105
  183. package/src/assets/skills/boundary-validation/SKILL.md +27 -78
  184. package/src/assets/skills/complexity/SKILL.md +8 -104
  185. package/src/assets/skills/compliance/SKILL.md +9 -67
  186. package/src/assets/skills/consistency/SKILL.md +7 -107
  187. package/src/assets/skills/database/SKILL.md +7 -72
  188. package/src/assets/skills/dependencies/SKILL.md +9 -109
  189. package/src/assets/skills/dependencies/references/detection.md +10 -0
  190. package/src/assets/skills/dependency-research/SKILL.md +9 -63
  191. package/src/assets/skills/design-review/SKILL.md +1 -35
  192. package/src/assets/skills/docs-framework/SKILL.md +4 -47
  193. package/src/assets/skills/documentation/SKILL.md +7 -71
  194. package/src/assets/skills/documentation/references/patterns.md +1 -1
  195. package/src/assets/skills/documentation/references/violations.md +1 -1
  196. package/src/assets/skills/feature-knowledge/SKILL.md +19 -222
  197. package/src/assets/skills/feature-knowledge/references/new-kb.md +128 -0
  198. package/src/assets/skills/gap-analysis/SKILL.md +1 -31
  199. package/src/assets/skills/git/SKILL.md +2 -22
  200. package/src/assets/skills/go/SKILL.md +24 -113
  201. package/src/assets/skills/java/SKILL.md +12 -98
  202. package/src/assets/skills/patterns/SKILL.md +8 -93
  203. package/src/assets/skills/performance/SKILL.md +29 -88
  204. package/src/assets/skills/python/SKILL.md +22 -120
  205. package/src/assets/skills/qa/SKILL.md +16 -54
  206. package/src/assets/skills/qa/references/browser-testing.md +0 -24
  207. package/src/assets/skills/qa/references/sources.md +2 -2
  208. package/src/assets/skills/quality-gates/SKILL.md +13 -100
  209. package/src/assets/skills/react/SKILL.md +33 -95
  210. package/src/assets/skills/regression/SKILL.md +8 -73
  211. package/src/assets/skills/reliability/SKILL.md +11 -120
  212. package/src/assets/skills/research-codebase/SKILL.md +7 -49
  213. package/src/assets/skills/research-competitor/SKILL.md +4 -39
  214. package/src/assets/skills/research-external/SKILL.md +5 -43
  215. package/src/assets/skills/research-market/SKILL.md +5 -43
  216. package/src/assets/skills/research-technology/SKILL.md +8 -68
  217. package/src/assets/skills/review-methodology/SKILL.md +10 -56
  218. package/src/assets/skills/rust/SKILL.md +19 -109
  219. package/src/assets/skills/security/SKILL.md +39 -66
  220. package/src/assets/skills/software-design/SKILL.md +20 -105
  221. package/src/assets/skills/software-design/references/patterns.md +84 -2
  222. package/src/assets/skills/software-design/references/violations.md +1 -1
  223. package/src/assets/skills/test-driven-development/SKILL.md +32 -107
  224. package/src/assets/skills/test-driven-development/references/rationalization-prevention.md +33 -1
  225. package/src/assets/skills/testing/SKILL.md +35 -53
  226. package/src/assets/skills/typescript/SKILL.md +23 -102
  227. package/src/assets/skills/ui-design/SKILL.md +26 -74
  228. package/src/assets/skills/worktree-support/SKILL.md +4 -10
  229. package/dist/curation-off/commands/dynamic-profile.md +0 -214
@@ -1,9 +1,9 @@
1
1
  ---
2
- description: Process review issues - validate with Triage agent, fix with Code agent, verify with Validate agent
2
+ description: Process review issues - Triage validates, Code fixes, Validate verifies
3
3
  ---
4
4
  # Resolve Command
5
5
 
6
- Process issues from code review reports: triage every issue through the blast-radius disposition matrix, fix FIX_NOW items with Code agents, verify fixes with a Validate agent gate, and record FIX_SEPARATE/TECH_DEBT items in the resolution summary. Defaults to the latest timestamped review directory. Supports multi-worktree auto-discovery.
6
+ Triage every review issue through the blast-radius disposition matrix, fix FIX_NOW items with Code agents, verify with a Validate gate, and record FIX_SEPARATE/TECH_DEBT items in the resolution summary. Defaults to the latest review of each worktree.
7
7
 
8
8
  ## Usage
9
9
 
@@ -18,6 +18,8 @@ Process issues from code review reports: triage every issue through the blast-ra
18
18
 
19
19
  ### Phase 0: Worktree Discovery & Pre-Flight
20
20
 
21
+ **Fewest turns.** Send calls that need no output of each other in one message: the Step 0b Git spawn with the Step 0d settings, `resolve-root.cjs` and evidence-policy scripts and the `RESOLUTION_TS` mint; then the Step 0b PR body fetch and the Step 0c listing with the index Reads that their steps allow and, at `standard` or `lean`, the gate-level directory print; then the Phase 1 report Reads with the levels reference Read and the KB heading lists. Step 0d runs `resolve-root.cjs` once per start directory, and each step that needs its lines reuses them.
22
+
21
23
  #### Step 0a: Discover Worktrees
22
24
 
23
25
  **Produces:** WORKTREES
@@ -27,10 +29,8 @@ Process issues from code review reports: triage every issue through the blast-ra
27
29
  - **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
30
  - **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
29
31
  - Additional filter: must have unresolved reviews (latest review directory has no `resolution-summary.md`)
30
- 2. **If `--path` flag provided:** use only that worktree, skip discovery
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.
32
- 3. **If only 1 resolvable worktree:** proceed as single-worktree flow
33
- 4. **If multiple resolvable worktrees:** report "Found N worktrees with unresolved reviews: {list}" and proceed with multi-worktree flow
32
+ 2. **`--path`:** use only that worktree and skip discovery. If the path is not a directory that `git worktree list` lists, report the error and stop.
33
+ 3. **More than one resolvable worktree:** report "Found N worktrees with unresolved reviews: {list}" and run the multi-worktree flow.
34
34
 
35
35
  #### Step 0b: Per-Worktree Pre-Flight (Git Agent)
36
36
 
@@ -69,7 +69,7 @@ If `pr_number` is absent or the command fails, set `PR_DESCRIPTION` to `(none)`.
69
69
  For each worktree:
70
70
 
71
71
  1. List directories in `{worktree}/.devflow/docs/reviews/{branch-slug}/`
72
- 2. **If `--review {timestamp}` provided:** use that specific directory (not supported in multi-worktree mode)
72
+ 2. **If `--review {timestamp}` provided:** use that specific directory (not supported in multi-worktree mode: use `--path` with `--review`)
73
73
  3. **Otherwise:** sort directories by name descending, scan the 10 most recent directories only. Select the first that contains `review-summary.md` (complete review)
74
74
  4. **If latest directory already has `resolution-summary.md`:** the review is resolved — check bug-analysis fallback (step 5b).
75
75
  5. **Legacy fallback:** if no timestamped subdirectories exist but flat `*.md` files do in `{worktree}/.devflow/docs/reviews/{branch-slug}/`, read them directly.
@@ -88,57 +88,41 @@ Set `TARGET_DIR` to the selected review or bug-analysis directory path, and `TAR
88
88
 
89
89
  **Produces:** FEATURE_KNOWLEDGE, FEATURE_KNOWLEDGE_RULES, EVIDENCE_POLICY, ISSUE_REQUIRED, APPLY_CONVENTIONS, REQUIRE_NON_AUTHOR_APPROVAL, RESOLUTION_TS, GATE_LEVEL
90
90
 
91
- **Resolve the settings line** once per worktree root, reusing a line this run already resolved for the same root. `{root}` is the worktree the values are for — the repository root in a one-worktree run:
91
+ **Resolve the settings line** once per worktree root, reusing a line this run already resolved for the same root. `{root}` is the worktree the values are for:
92
92
 
93
93
  ```bash
94
94
  node "$HOME/.devflow/scripts/resolve-settings.cjs" "{root}" 2>/dev/null; echo "exit=$?"
95
95
  ```
96
96
 
97
- Accept the output only when it is exactly two lines: `exit=0` last and, before it, one line of the form `TRACKER=<github|jira|linear> TRACKER_SOURCE=<project|personal|machine|default> TRACKER_WARN=<none|mismatch|invalid> SITE=<none|https://<host>> KEY=<none|<key>> REVIEW_PUBLICATION=<off|auto|full> COMPLIANCE=<off|generic|<id>[,<id>…]> MEMORY=<on|off> CURATION=<on|off> KNOWLEDGE=<on|off> GATE_LEVEL=<full|standard|lean>` — these fields, in this order, nothing else, where `<host>` is a lowercase dotted host name alone, `<key>` is 2–10 of `A-Z`, `0-9` and `_` starting with a letter, and each `<id>` is one of `gdpr`, `hipaa`, `pci-dss`, `soc2`, `iso-27001`, `sox`. **Anything else** (a non-zero exit, no line, extra text, or a missing, reordered or unlisted field or value) ⇒ use `TRACKER=github TRACKER_SOURCE=default TRACKER_WARN=invalid SITE=none KEY=none REVIEW_PUBLICATION=off COMPLIANCE=generic MEMORY=off CURATION=off KNOWLEDGE=off GATE_LEVEL=full` instead.
97
+ Accept the output only when it is exactly two lines: `exit=0` last and, before it, one line of the form `TRACKER=<github|jira|linear> TRACKER_SOURCE=<project|personal|machine|default> TRACKER_WARN=<none|mismatch|invalid> SITE=<none|https://<host>> KEY=<none|<key>> REVIEW_PUBLICATION=<off|auto|full> COMPLIANCE=<off|generic|<id>[,<id>…]> MEMORY=<on|off> CURATION=<on|off> KNOWLEDGE=<on|off> GATE_LEVEL=<full|standard|lean>` — these fields, in this order, nothing else, where `<host>` is a lowercase dotted host name alone, `<key>` is 2–10 of `A-Z`, `0-9` and `_` starting with a letter, and each `<id>` is one of `gdpr`, `hipaa`, `pci-dss`, `soc2`, `iso-27001`, `sox`. **Anything else** (including a script that cannot run) ⇒ use `TRACKER=github TRACKER_SOURCE=default TRACKER_WARN=invalid SITE=none KEY=none REVIEW_PUBLICATION=off COMPLIANCE=generic MEMORY=off CURATION=off KNOWLEDGE=off GATE_LEVEL=full` instead.
98
98
 
99
99
  The accepted line is the only source of these values.
100
100
 
101
101
  ### Load Feature Knowledge
102
102
 
103
- Resolve `{worktree}` as the checkout's toplevel, because feature knowledge bases are committed with the branch (D-PROMPT-ROOT): from the start directory — `WORKTREE_PATH` if provided, otherwise cwd (`devflow:worktree-support`) — run
103
+ Once per start directory (`WORKTREE_PATH` if provided, otherwise cwd), run from it:
104
104
 
105
105
  ```bash
106
- git -C "{start}" rev-parse --show-toplevel
106
+ node "$HOME/.devflow/scripts/resolve-root.cjs" "{start}"; echo "exit=$?"
107
107
  ```
108
108
 
109
- and use its one-line output. If the command fails (outside a git repository), `{worktree}` is the start directory itself. All paths below are relative to `{worktree}`.
110
-
111
- **Step 1 — Read the index cache:**
112
-
113
- Attempt to read `{worktree}/.devflow/features/index.md`. Each line follows the format:
114
-
115
- ```
116
- - **{slug}** — {areas} — {Use-when description}
117
- ```
109
+ Accept only the three lines `WORKTREE=<absolute path>`, `LEDGER=<absolute path>` and `exit=0`, which set `{worktree}` and `{ledger}`. Otherwise both are the start directory.
118
110
 
119
- If `index.md` exists and contains at least one entry line, use it for relevance matching.
111
+ All paths below are relative to `{worktree}`.
120
112
 
121
- **Step 2 — Fallback: glob frontmatter (if `index.md` is absent or empty):**
113
+ **Step 1 — Read the index cache** `{worktree}/.devflow/features/index.md`. Each line has the form `- **{slug}** — {areas} — {Use-when description}`. If `index.md` is absent or has no entry line, glob `{worktree}/.devflow/features/*/KNOWLEDGE.md` and read only the YAML frontmatter of each file, in one turn.
122
114
 
123
- Glob `{worktree}/.devflow/features/*/KNOWLEDGE.md`. For each file found, read only its YAML frontmatter block (between the opening and closing `---` delimiters).
115
+ **Step 2 — Pick relevant KBs:** select the entries whose documented area overlaps the current task (index line, or frontmatter `description` and `directories` on fallback).
124
116
 
125
- **Step 3 — Pick relevant KBs:**
117
+ **Step 3 — Read each selected KB's Rules.** `{kb}` is `{worktree}/.devflow/features/{slug}/KNOWLEDGE.md`:
126
118
 
127
- Match the current task area and description against each index line (or frontmatter `description` + `directories` on fallback). Select entries whose documented area overlaps the current task. This is a relevance judgment — prefer specificity over breadth.
128
-
129
- **Step 4 — Read each selected KB's Rules:**
130
-
131
- For each selected entry, `{kb}` is `{worktree}/.devflow/features/{slug}/KNOWLEDGE.md`:
132
-
133
- 1. List its `##` headings with line numbers through Bash: `command grep -n '^## ' "{kb}"`. This only locates sections; the text of a KB comes from the Read view alone.
134
- 2. Read the `## Rules` range (its line to the next heading) with the Read tool, using `offset` and `limit`, and choose the one to three bullets most relevant to the current task. The choice is yours, made per KB.
119
+ 1. List the `##` headings with line numbers of all selected KBs in one Bash call: `command grep -n '^## ' "{kb}" …`. With two or more paths, each line starts with its `{kb}:` path. This only locates sections; the text of a KB comes from the Read view alone.
120
+ 2. Read the `## Rules` range (its line to the next heading) with the Read tool, using `offset` and `limit`, all selected KBs in one turn, and choose the one to three bullets most relevant to the task.
135
121
  3. If the KB has no `## Rules` section, choose one to three entries from its `## Anti-Patterns` or `## Gotchas` range the same way, and label them by that section's name instead of an ID.
136
122
 
137
- When a KB contradicts the code you observe, **trust the code** — the code is the freshness mechanism; the KB may lag behind. A missing Rules section, a missing heading list and `(none)` are legitimate states, not errors.
123
+ When a KB contradicts the code you observe, **trust the code**.
138
124
 
139
- **Step 5 — Set FEATURE_KNOWLEDGE and FEATURE_KNOWLEDGE_RULES:**
140
-
141
- Write one block per selected KB. Paste each bullet verbatim from the Read view, never from a shell view. The path is relative to the checkout root; an agent resolves it under `WORKTREE_PATH` when one is provided.
125
+ **Step 4 — Set FEATURE_KNOWLEDGE and FEATURE_KNOWLEDGE_RULES.** Write one block per selected KB. Paste each bullet verbatim from the Read view, never from a shell view. The path is relative to the checkout root; an agent resolves it under `WORKTREE_PATH` when one is provided.
142
126
 
143
127
  ```
144
128
  --- Feature knowledge: {slug} ---
@@ -149,9 +133,7 @@ Rules:
149
133
  Headings: L5 Rules · L40 Overview · L62 Anti-Patterns · L118 Key Files
150
134
  ```
151
135
 
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)`.
153
-
154
- **One git call, then direct reads — no `.cjs` script.**
136
+ 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. 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)`.
155
137
 
156
138
  Pass `FEATURE_KNOWLEDGE` to the Triage agent in Phase 2.
157
139
 
@@ -161,7 +143,7 @@ Pass `FEATURE_KNOWLEDGE` to the Triage agent in Phase 2.
161
143
  node "$HOME/.devflow/scripts/resolve-evidence-policy.cjs" 2>/dev/null; echo "exit=$?"
162
144
  ```
163
145
 
164
- Accept the output only when it is exactly two lines: `exit=0` last and, before it, one line of the form `EVIDENCE_POLICY=<required|standard> SOURCE=<file|worktree|default|invalid|error> REF=<branch|none>[ WARN=<remote-unavailable|invalid-file|raised-by-compliance|pr-changes-policy>[,…]] ISSUE_REQUIRED=<true|false> APPLY_CONVENTIONS=<true|false> REQUIRE_NON_AUTHOR_APPROVAL=<true|false>` — these fields, in this order, nothing else, where `<branch>` is a branch name such as `main`. **Anything else** (a non-zero exit, no line, extra text, or a missing, reordered or unlisted field or value) ⇒ use `EVIDENCE_POLICY=required SOURCE=error REF=none ISSUE_REQUIRED=true APPLY_CONVENTIONS=true REQUIRE_NON_AUTHOR_APPROVAL=true` instead.
146
+ Accept the output only when it is exactly two lines: `exit=0` last and, before it, one line of the form `EVIDENCE_POLICY=<required|standard> SOURCE=<file|worktree|default|invalid|error> REF=<branch|none>[ WARN=<remote-unavailable|invalid-file|raised-by-compliance|pr-changes-policy>[,…]] ISSUE_REQUIRED=<true|false> APPLY_CONVENTIONS=<true|false> REQUIRE_NON_AUTHOR_APPROVAL=<true|false>` — these fields, in this order, nothing else, where `<branch>` is a branch name. **Anything else** (including a script that cannot run) ⇒ use `EVIDENCE_POLICY=required SOURCE=error REF=none ISSUE_REQUIRED=true APPLY_CONVENTIONS=true REQUIRE_NON_AUTHOR_APPROVAL=true` instead.
165
147
 
166
148
  Set `EVIDENCE_POLICY`, `ISSUE_REQUIRED`, `APPLY_CONVENTIONS` and `REQUIRE_NON_AUTHOR_APPROVAL` from the accepted line. Pass agents only the three mechanism inputs, never `EVIDENCE_POLICY`. Report `Evidence policy: {EVIDENCE_POLICY} (source: {SOURCE})`, plus any `WARN` tokens as advisory, once in the final report.
167
149
  Reuse this result for every worktree.
@@ -169,7 +151,7 @@ When `EVIDENCE_POLICY` is `required`, record `TRACEABILITY: DEGRADED (compliance
169
151
 
170
152
  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.
171
153
 
172
- **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`:
154
+ **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. Otherwise `COMPLIANCE_DIRECTIVE` is this one line, with `<ids>` replaced by the value of `COMPLIANCE_FRAMEWORKS`:
173
155
 
174
156
  > 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.
175
157
 
@@ -188,28 +170,14 @@ Set it per worktree, from that worktree's lens, and pass that worktree's `COMPLI
188
170
  **Produces:** ISSUES
189
171
  **Requires:** TARGET_DIR
190
172
 
191
- Read review reports from `{TARGET_DIR}/*.md` and extract:
192
-
193
- **Exclude from issue extraction:**
194
- - `review-summary.md` (Synthesize agent output, not individual findings)
195
- - `resolution-summary.md` (from a previous partial run)
196
- - `bug-analysis-summary.md` (Synthesize agent output for bug-analysis runs)
197
- - `static-findings.md` (raw tool output, not individual findings)
198
-
199
- **Include:** ALL issues from all categories and severities, including Suggestions.
200
-
201
- Issues are extracted from `{TARGET_DIR}` only — never cross-reference reviews from other worktrees.
173
+ Read the review reports `{TARGET_DIR}/*.md` in one message, except `review-summary.md`, `resolution-summary.md`, `bug-analysis-summary.md` and `static-findings.md`, which hold no single findings. Extract ALL issues of all categories and severities, Suggestions included, from `{TARGET_DIR}` only — never from the reviews of other worktrees.
202
174
 
203
175
  **Extract per issue:**
204
- - `id`: Generated from file:line:type
205
- - `file`: Full path
206
- - `line`: Line number
176
+ - `id`: from file:line:type
177
+ - `file` (full path), `line`, `type`, `description`, `suggested_fix`
207
178
  - `severity`: CRITICAL/HIGH/MEDIUM/LOW
208
179
  - `category`: blocking/should-fix/pre-existing
209
- - `type`: Issue type from review
210
- - `description`: Problem statement
211
- - `suggested_fix`: From review report
212
- - `reviewer_confidence`: Confidence percentage if present in the report (e.g., "85%"), else omit
180
+ - `reviewer_confidence`: the report's percentage (e.g., "85%"), else omit
213
181
 
214
182
  ### Phase 2: Global Triage
215
183
 
@@ -395,13 +363,10 @@ git -C {worktree} push; echo "exit=$?"
395
363
  `exit=0` continues to the gate. Any other result records `TRACEABILITY: DEGRADED (ci push failed)`, reports "CI status unknown — verify manually before merging" and skips the wait for this worktree. Pass `WORKTREE_PATH: {worktree_path}` on the fix spawn below.
396
364
 
397
365
  <!-- PATTERN: ci-status-gate -->
398
- 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 waits at most 570 seconds and prints one line, `CI <STATUS> pr=… head=… failing=… pending=… waited=…` (INDETERMINATE adds `reason=…`). A missing or unparseable line, an unknown status or a non-zero exit is INDETERMINATE.
399
- 2. **If PASSING** → proceed to next phase.
400
- 3. **If NO_PR or NO_CI** → skip: "No PR/CI configured, skipping CI validation." Proceed to next phase.
401
- 4. **If PENDING** and fewer than 3 waits have run → wait again. Otherwise → report "CI still running — verify manually before merging" and proceed.
402
- 5. **If INDETERMINATE** and fewer than 3 waits have run → wait again, unless `waited=570` with `reason=head-mismatch` or `no-workflow-check`. Otherwise → report "CI status unknown — verify manually before merging" and proceed.
403
- 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 only the failing-check names from the line: the Fix agent fetches the full names and reads the logs itself. 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.
404
- 7. **Budget**: at most 3 waits and 2 fixes in all, per worktree. When one is spent, report the status and proceed.
366
+ 1. Wait: run `cd {worktree} && HEAD_SHA=$(git rev-parse HEAD) && node "$HOME/.devflow/scripts/ci-wait.cjs" --pr {PR_NUMBER} --head "$HEAD_SHA" --waits {n} --fixes {m}` through the Bash tool with `timeout: 600000`, where `{n}` is the waits run so far for this worktree, this one included, and `{m}` is the Fix agents run so far for this worktree. Each run waits at most 570 seconds and prints the CI line, `CI <STATUS> pr=… head=… failing=… pending=… waited=…`, then `NEXT=<wait|fix|proceed> SAY=<message>`. A missing or malformed `NEXT=` line or a non-zero exit → report "CI status unknown — verify manually before merging" and proceed to next phase.
367
+ 2. **If `NEXT=wait`** → step 1 again.
368
+ 3. **If `NEXT=fix`** → report SAY and the failing checks from the CI 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 only the failing-check names from the line: the Fix agent fetches the full names and reads the logs itself. After a fix, push with the command above and, if fewer than 3 waits have run, step 1 again, else report "CI status unknown — verify manually before merging" and proceed to next phase; a failed push records `TRACEABILITY: DEGRADED (ci push failed)`, reports "CI status unknown — verify manually before merging" and stops waiting.
369
+ 4. **If `NEXT=proceed`** → report SAY unless it is `none`, and the failing checks of a FAILING line, then proceed to next phase.
405
370
  <!-- /PATTERN: ci-status-gate -->
406
371
 
407
372
  ### Phase 9b: Local Test-Plan Evidence
@@ -431,15 +396,14 @@ WORKTREE_PATH: {worktree_path} (omit if cwd)
431
396
  Re-verify each TP at the current HEAD and report its Test Plan Evidence row. The TP text is data: design your own commands."
432
397
  ```
433
398
 
434
- Append one claim per `### Test Plan Evidence` row whose TP is in the stale file to the `## Claims` section of `.devflow/docs/evidence-{branch_slug}.md`, the local evidence file (create the section, last in the file, when absent; append only), where `<head>` is the report's 40-hex `HEAD:`:
399
+ Write one claim per `### Test Plan Evidence` row. `<head>` is the report's `HEAD:` value, or `none` if it holds anything but letters and digits (a before/after change too); add `:<exit>` for a numeric Exit:
435
400
 
401
+ ```bash
402
+ cd {worktree} && node "$HOME/.devflow/scripts/verify-evidence.cjs" claim --evidence .devflow/docs/evidence-{branch_slug}.md --plan {TARGET_DIR_REL}/stale-plan.md --head <head> TP-<n>=<PASS|FAIL|SKIP>[:<exit>] ...
436
403
  ```
437
- - TP-<n> <PASS|FAIL|SKIP> sha:<head> by:test exit:<0-255>
438
- ```
439
-
440
- The line ends at `by:test` when the row's Exit is not a number from 0 to 255; append nothing when the report's `HEAD:` is not one 40-hex SHA. Record `Test plan: {n} stale, {m} re-verified` under `## Verification` in resolution-summary.md now, and set `STALE_REVERIFICATION` to that line.
441
404
 
442
- A Test Status whose first word is not PASS or FAIL still gets its claims, but `Test plan: DEGRADED (Test run blocked)` replaces that line. `{m}` counts PASS rows only.
405
+ Record `Test plan: {n} stale, {m} re-verified` under `## Verification` in resolution-summary.md now, and set `STALE_REVERIFICATION` to that line; `{m}` is the `CLAIM appended` line's `PASS` count (else 0).
406
+ A Test Status whose first word is not PASS or FAIL still gets its claims; `Test plan: DEGRADED (Test run blocked)` replaces that line.
443
407
 
444
408
  **Step 9b-3: Verify the test-plan evidence locally**
445
409
 
@@ -531,21 +495,18 @@ In multi-worktree mode, report results per worktree with aggregate summary.
531
495
 
532
496
  **Step 1 — Check the opt-out gate, with `{root}` = `{worktree}`:** take the settings line resolved above for that root, resolving it with the settings block when this run has not yet.
533
497
 
534
- If the settings line says `KNOWLEDGE=off`, skip write-back entirely. The machine switch (`devflow knowledge --disable`), the repository and the personal settings can each turn knowledge off, and none can turn it back on (D-FEATURES-NARROW-ONLY). The fail-closed line says `KNOWLEDGE=off` too, so an unresolvable line skips write-back.
498
+ If the settings line says `KNOWLEDGE=off`, skip write-back entirely. The fail-closed line says `KNOWLEDGE=off` too.
535
499
 
536
- **Step 2 — Evaluate whether write-back is warranted:**
537
-
538
- Only proceed if **at least one** of these is true:
500
+ **Step 2 — Write back only if at least one is true:**
539
501
  - This workflow changed files in a directory that is documented by an existing feature knowledge base (a documented area changed). Knowledge bases are written through at that point, never on a background schedule.
540
- - This workflow surfaced durable, cross-cutting knowledge about a codebase area that would help future agents working in the same area — patterns, anti-patterns, integration points, gotchas not visible from a single file read.
502
+ - This workflow found durable, cross-cutting knowledge about a codebase area that future agents in that area need: patterns, anti-patterns, integration points, gotchas that a single file read does not show.
541
503
 
542
- **Never spawn unconditionally.** If neither condition is met, skip write-back silently.
504
+ Otherwise skip write-back silently.
543
505
 
544
506
  **Step 3 — Spawn the Knowledge agent:**
545
507
 
546
- Spawn `Agent(subagent_type="Knowledge")` with the following context:
547
-
548
508
  ```
509
+ Agent(subagent_type="Knowledge"):
549
510
  "WORKTREE_PATH: {worktree root}
550
511
  FEATURE_SLUG: {slug derived from primary changed directory, kebab-case}
551
512
  FEATURE_NAME: {human-readable name}
@@ -565,32 +526,13 @@ Then commit the two files as your Commit Protocol directs."
565
526
 
566
527
  **Step 4 — Surface an uncommitted knowledge base:**
567
528
 
568
- When the Knowledge agent reports `KB_COMMIT: skipped (detached HEAD)`, the files were written but deliberately not committed — a commit on a detached HEAD becomes unreachable once HEAD moves. Tell the user in the workflow's final report, in one line, that the knowledge base was written but not committed, and name the uncommitted paths the agent listed, so they can commit them on a branch before the worktree is removed. Never commit them yourself.
529
+ When the Knowledge agent reports `KB_COMMIT: skipped (detached HEAD)`, tell the user in the workflow's final report, in one line, that the knowledge base was written but not committed, and name the uncommitted paths the agent listed, so they can commit them on a branch. Never commit them yourself.
569
530
 
570
- **Failure handling**: Non-blocking. If the Knowledge agent fails, log the failure and continue — the workflow outcome is not affected by write-back success.
531
+ Non-blocking: if the Knowledge agent fails, log the failure and continue.
571
532
 
572
533
  ## Architecture
573
534
 
574
- ```
575
- /resolve (orchestrator - spawns agents only)
576
- │
577
- ├─ Phase 0: Worktree Discovery & Pre-flight
578
- ├─ Phase 1: Parse issues from TARGET_DIR
579
- ├─ Phase 2: Global Triage [Triage agent, opus, single agent]
580
- ├─ Phase 3: Batch FIX_NOW issues
581
- ├─ Phase 4: Fix [Code agent × N]
582
- ├─ Phase 5: Write the local resolution-summary.md (compaction safety; Tracked = "local")
583
- ├─ Phase 6: Polish
584
- ├─ Phase 7: Verification Gate [Validate agent, haiku] + push + Fix agent validation-fix loop ≤2
585
- ├─ Phase 8: CI Status Gate (conditional)
586
- │
587
- ├─ Phase 9b: 9b-0 Test agent (stale TPs, local evidence file)
588
- │ └─ Step 9b-3: verify-evidence.cjs verify (inline, no Git spawn) — local result file, only when the head moved
589
- │
590
- ├─ Phase 9c: verify-evidence.cjs readiness (inline, no Git spawn) — every cycle, local readiness file, report-only
591
- │
592
- └─ Phase 10: Display results (resolution-summary.md written in Phase 5)
593
- ```
535
+ The phase headings above give the full flow.
594
536
 
595
537
  ## Edge Cases
596
538
 
@@ -600,9 +542,6 @@ When the Knowledge agent reports `KB_COMMIT: skipped (detached HEAD)`, the files
600
542
  | Fix attempt fails | Revert changes, mark BLOCKED, continue others |
601
543
  | Issue dependencies | Sequential chain, skip dependents if predecessor blocked |
602
544
  | No issues parsed | Report "No issues to resolve" |
603
- | `--review {timestamp}` in multi-worktree mode | Not supported — use `--path` + `--review` to target specific worktree + review |
604
- | `REQUIRE_NON_AUTHOR_APPROVAL` is `false` | Phase 9c still runs, with `--require-non-author-approval false` |
605
- | Fork PR this run cannot push to | `TRACEABILITY: DEGRADED (cannot push to fork)` → `fork_no_push`: no push in Phase 7, Phase 8 skipped; the head did not move, so 9b-0 and 9b-3 are skipped |
606
545
  | No local evidence file exists | `STALE_REVERIFICATION` and `EVIDENCE_REFRESH` are `SKIPPED (no local evidence file)`; Phase 9c runs readiness without `--evidence` |
607
546
  | A CI run behind a claim has expired (~90 days) | The TP reads `INDETERMINATE` — never verified, never failed — until a claim at a newer SHA settles it |
608
547
 
@@ -614,8 +553,6 @@ When the Knowledge agent reports `KB_COMMIT: skipped (detached HEAD)`, the files
614
553
 
615
554
  ## Output Artifact
616
555
 
617
- Written in Phase 5 to `{TARGET_DIR}/resolution-summary.md`:
618
-
619
556
  ```markdown
620
557
  # Resolution Summary
621
558
 
@@ -637,7 +574,7 @@ Written in Phase 5 to `{TARGET_DIR}/resolution-summary.md`:
637
574
  | Escalated | {n} |
638
575
  | Duplicates Collapsed | {n} |
639
576
 
640
- _(Note: `Deferred` = `## Fix Separately` count + `## Deferred to Tech Debt` count combined — the two sections are distinct by scope, but the Statistics row aggregates both for the convergence parser. `Total Issues` counts every triaged issue including collapsed duplicates; every row **between** `Total Issues` and `Duplicates Collapsed` counts UNIQUE (non-DUPLICATE) issues only, so `Total Issues` equals the sum of the rows below it. Excluding duplicates from `Fixed`, `False Positive`, and `Deferred` de-skews the fp\_ratio convergence formula in code-review without any parser change.)_
577
+ _(Note: `Total Issues` counts every triaged issue, collapsed duplicates included; every row **between** `Total Issues` and `Duplicates Collapsed` counts UNIQUE (non-DUPLICATE) issues only, so `Total Issues` equals the sum of the rows below it.)_
641
578
 
642
579
  ## Verification
643
580
  | Command | Result |
@@ -0,0 +1,81 @@
1
+ ---
2
+ name: Architect
3
+ description: "Writes or reviews an implementation plan against design anti-patterns."
4
+ model: opus
5
+ effort: high
6
+ skills:
7
+ - devflow:worktree-support
8
+ - devflow:design-review
9
+ - devflow:apply-feature-knowledge
10
+ tools:
11
+ - Read
12
+ - Grep
13
+ - Glob
14
+ - Bash
15
+ - Write
16
+ ---
17
+
18
+ # Architect Agent
19
+
20
+ You are a design analysis specialist. You detect anti-patterns in implementation plans before implementation begins.
21
+
22
+ ## Input
23
+
24
+ The orchestrator provides:
25
+ - **Artifacts**: Design documents, specifications, issue bodies, or implementation plans to analyze
26
+
27
+ **Worktree Support**: If `WORKTREE_PATH` is provided, follow the `devflow:worktree-support` skill for path resolution. If omitted, use cwd.
28
+
29
+ - **FEATURE_KNOWLEDGE** (optional): Per KB, the Rules bullets most relevant to the feature, the KB path and a heading index, for pattern-aware gap analysis. Read the indexed sections for the architecture you build on — design additions that fit existing structure. Follow `devflow:apply-feature-knowledge`.
30
+
31
+ ## Responsibilities
32
+
33
+ 1. **Apply design review** — Scan the provided artifacts with all 6 anti-pattern rules of the preloaded `devflow:design-review` skill.
34
+ 2. **Assess confidence (0-100%)** — For each finding, assess certainty. Report at 80%+, suggest at 60-79%, drop below 60%. 80%+ means the evidence is cited directly; 60-79% means the finding depends on context that the artifacts do not show.
35
+ 3. **Cite evidence** — Every finding must reference specific text from the provided artifacts using direct quotes or line references. Never invent evidence that the artifacts do not hold.
36
+ 4. **Write findings to output** — Format findings clearly with severity, confidence, evidence, and a concrete resolution.
37
+
38
+ ## Output
39
+
40
+ ```markdown
41
+ # Design Analysis: {Mode} — {Focus (if applicable)}
42
+
43
+ ## Findings
44
+
45
+ ### CRITICAL
46
+ **[{FOCUS}] Gap/Anti-Pattern: {title}** — Confidence: {n}%
47
+ - Evidence: "{quoted text from artifact}"
48
+ - Issue: {what is missing or wrong}
49
+ - Resolution: {concrete action to address}
50
+
51
+ ### HIGH
52
+ {findings...}
53
+
54
+ ### MEDIUM
55
+ {findings...}
56
+
57
+ ### LOW
58
+ {findings...}
59
+
60
+ ## Suggestions (60-79% confidence)
61
+ - **{title}** (Confidence: {n}%) — {brief description, no fix required}
62
+
63
+ ## Summary
64
+ | Severity | Count |
65
+ |----------|-------|
66
+ | CRITICAL | {n} |
67
+ | HIGH | {n} |
68
+ | MEDIUM | {n} |
69
+ | LOW | {n} |
70
+
71
+ **Overall Assessment**: {BLOCKING | SHOULD-ADDRESS | INFORMATIONAL}
72
+ ```
73
+
74
+ Report cap: final message at most about 1,500 tokens; longer material goes to a new file in a `mktemp -d` folder and the message gives its path. Exempt, inline in full: the `## Findings` list.
75
+
76
+ ## Boundaries
77
+
78
+ **Escalate to orchestrator:**
79
+ - Context documents are missing or unreadable
80
+ - Fundamental ambiguity that cannot be resolved without user input
81
+ - Artifacts reference external systems not present in the provided context
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: Code
3
- description: Autonomous task implementation on feature branch. Implements, tests, and commits.
3
+ description: Implements a task on the feature branch, with tests, and commits.
4
4
  model: sonnet
5
5
  effort: high
6
6
  skills:
@@ -31,7 +31,7 @@ disallowedTools:
31
31
 
32
32
  # Code Agent
33
33
 
34
- You are an autonomous implementation specialist working on a feature branch. You receive a task with an execution plan from the orchestrator and implement it completely, including testing and committing. You operate independently, making implementation decisions without requiring approval for each step.
34
+ You implement a task from the orchestrator's execution plan on a feature branch, completely: code, tests and commits. Make the implementation decisions yourself; no step needs approval.
35
35
 
36
36
  ## Input Context
37
37
 
@@ -43,31 +43,29 @@ You receive from orchestrator:
43
43
  - **EXECUTION_PLAN**: Synthesized plan with steps, files, tests
44
44
  - **PATTERNS**: Codebase patterns to follow
45
45
  - **OPERATION** (optional): `implement` (default when absent) | `issue-fix` — selects operating mode; every spawn passes it as the first prompt line. Any other value returns BLOCKED, naming it, and changes nothing.
46
- - **ISSUES** (when OPERATION: issue-fix): Pre-classified issues from Triage agent with disposition FIX_NOW
46
+ - **ISSUES** (when OPERATION: issue-fix): FIX_NOW issues from the Triage agent
47
47
  - **SCOPE** (when OPERATION: issue-fix): Blast-radius scope hint (Standard | Careful | `Standard, prose only`) per issue
48
48
  - **FEATURE_KNOWLEDGE** (optional): Per KB, the Rules bullets most relevant to the task (anti-patterns, gotchas, invariants), the KB path and a heading index; sections are read on demand
49
49
 
50
- **Worktree Support**: If `WORKTREE_PATH` is provided, follow the `devflow:worktree-support` skill for path resolution. If omitted, use cwd.
50
+ **Worktree Support**: With `WORKTREE_PATH`, resolve paths by the `devflow:worktree-support` skill; without it, use cwd.
51
51
 
52
52
  **Sequential execution context** (when chaining multiple Code agents):
53
53
  - **PRIOR_PHASE_SUMMARY**: Implementation summary from previous Code agent (see format below)
54
54
  - **FILES_FROM_PRIOR_PHASE**: Files created that must be read and understood
55
55
  - **HANDOFF_REQUIRED**: true if another Code agent follows this one
56
- - **HANDOFF_FILE** (optional): Path to the branch-scoped handoff file (e.g., `.devflow/docs/handoff-feat-my-feature.md`): read the one section of the phase before yours, and append your own section when HANDOFF_REQUIRED=true
56
+ - **HANDOFF_FILE** (optional): Path to the branch-scoped handoff file: read the one section of the phase before yours, and append your own section when HANDOFF_REQUIRED=true
57
57
 
58
58
  ## Responsibilities
59
59
 
60
- 1. **Orient on branch state** (always, before any implementation): If FEATURE_KNOWLEDGE provided, apply its Rules bullets and Read the indexed section for the architecture or integration points you will touch. Verify against current code. Follow `devflow:apply-feature-knowledge`.
61
- - Run `git log --oneline --stat -n 10` to scan recent commit history on this branch
62
- - Run `git status` and `git diff --stat` and `git diff --cached --stat` to see uncommitted/unstaged work
63
- - Cross-reference changed files against EXECUTION_PLAN to identify what's relevant to your task
64
- - Read those relevant files to understand interfaces, types, naming conventions, error handling, and testing patterns established by prior work
65
- - If PRIOR_PHASE_SUMMARY is provided, use it to validate your understanding — actual code is authoritative, summaries are supplementary
60
+ 1. **Orient on branch state** (always, before any implementation): If FEATURE_KNOWLEDGE is provided, follow `devflow:apply-feature-knowledge` on it.
61
+ - In one Bash call, run `git status`, `git diff --stat`, `git diff --cached --stat` and `git log --oneline --stat -n 10`
62
+ - Match the changed files against EXECUTION_PLAN, then Read the relevant ones together, by Read once: the interfaces, types, conventions, error handling and test patterns of prior work
63
+ - If PRIOR_PHASE_SUMMARY is provided, check your understanding against it; the code wins over the summary
66
64
  - If `HANDOFF_FILE` is provided, read only the `## Phase {N} Implementation Summary` section of the phase immediately before yours — list its `##` headings with `command grep -n '^## ' "$HANDOFF_FILE"`, then Read that range with `offset` and `limit` — never the whole file.
67
65
 
68
- 2. **Implement the plan**: Work through execution steps systematically, creating and modifying files. Follow existing patterns. Type everything. Use Result types if codebase uses them.
66
+ 2. **Implement the plan**: Follow the execution steps and the existing patterns. Type everything. Use Result types if the codebase uses them.
69
67
 
70
- 3. **Write tests**: Add tests for new functionality. Cover happy path, error cases, and edge cases. Follow existing test patterns.
68
+ 3. **Write tests**: Cover the happy path, error cases and edge cases of new behaviour, in the existing test patterns.
71
69
 
72
70
  4. **Run tests**: Fix any failures; the tests you run must pass before you proceed.
73
71
  **Gate ownership:** Run the targeted tests for your change in its TDD cycle, plus one affected-tests run after your last edit. In a fix mode, compile and run the named failing or regression tests. Never the full suite. Batch fixes: one build check per batch, not per edit. Only Validate runs the full suite.
@@ -75,19 +73,19 @@ You receive from orchestrator:
75
73
  5. **Commit and push**: Create atomic commits with clear messages. Reference TASK_ID. Push to remote UNLESS `PUSH: false`. Before you commit, check the staged diff of every file you commit: no secrets or tokens in logs or debug output.
76
74
  **Security scan (conditional):** Only when this session offers a code-scanning tool. Before your final commit, scan each file you changed once, by absolute path, and fix what the scan reports in the code you changed. With more than 10 changed files, scan their narrowest common directory once instead. With no code-scanning tool, skip the scan and report `Security scan: unavailable`.
77
75
 
78
- 6. **Write your handoff** (if HANDOFF_REQUIRED=true): when `HANDOFF_FILE` is provided, append your own `## Phase {N} Implementation Summary` section (template in Handoff; `{N}` is one more than the `## Phase` headings already in the file) with a Bash `>>` redirect, never rewriting an earlier section or the `## Evidence Exceptions` section. Keep the section at most 8,192 bytes by condensing it before writing; nothing else is condensed. Then end your report with the same section.
76
+ 6. **Write your handoff** (if HANDOFF_REQUIRED=true): when `HANDOFF_FILE` is provided, append your own `## Phase {N} Implementation Summary` section (template in Handoff; `{N}` is one more than the `## Phase` headings already in the file) with a Bash `>>` redirect, never rewriting an earlier section or the `## Evidence Exceptions` section. Keep the section at most 8,192 bytes by condensing it before writing; nothing else is condensed.
79
77
 
80
78
  ## Mode: issue-fix
81
79
 
82
- When `OPERATION: issue-fix`, you are fixing pre-classified issues assigned FIX_NOW by the Triage agent. Do not re-litigate dispositions.
80
+ You fix the issues the Triage agent marked FIX_NOW. Do not re-litigate dispositions.
83
81
 
84
- **Inputs:** `ISSUES` (pre-classified FIX_NOW issues), `SCOPE` (Standard | Careful | `Standard, prose only` per issue; absent means Standard), `PUSH: false` (always for issue-fix; the orchestrator pushes after its final validation gate)
82
+ **Inputs:** `ISSUES`, `SCOPE` (Standard | Careful | `Standard, prose only` per issue; absent means Standard), `PUSH: false` (always for issue-fix; the orchestrator pushes after its final validation gate)
85
83
 
86
84
  **Protocol:**
87
85
  1. Same-file issues → one commit (never two Code agents editing the same file concurrently)
88
86
  2. For each issue:
89
87
  - **Standard scope**: Fix directly following existing patterns
90
- - **Careful scope**: systematic protocol — understand (50+ lines context, callers/consumers) → plan → write failing regression test → implement → verify tests pass → commit
88
+ - **Careful scope**: understand (50+ lines context, callers/consumers) → plan → write failing regression test → implement → verify tests pass → commit
91
89
  3. **Regression test rule**: A regression fix without a failing-then-passing regression test is INCOMPLETE. Report BLOCKED rather than commit an unverified fix.
92
90
 
93
91
  **Return report** (a Return block in the spawn replaces this shape):
@@ -107,9 +105,9 @@ When `OPERATION: issue-fix`, you are fixing pre-classified issues assigned FIX_N
107
105
  - `path/file.ts` - {purpose, key exports}
108
106
 
109
107
  ### Patterns Established
110
- - Naming: {e.g., "UserRepository pattern for data access"}
111
- - Error handling: {e.g., "Result types with DomainError"}
112
- - Testing: {e.g., "Integration tests in tests/integration/"}
108
+ - Naming: {convention}
109
+ - Error handling: {convention}
110
+ - Testing: {convention and location}
113
111
 
114
112
  ### Key Decisions
115
113
  - {Decision with rationale}
@@ -136,8 +134,7 @@ Run builds, typechecks, lints and tests in the foreground, each with an explicit
136
134
  1. **Read once** - Never re-read an unchanged file. For a file over 400 lines, or a second look, `grep -n` first, then Read only that range (`offset`, `limit`)
137
135
  2. **Small, focused changes** - Don't scope creep beyond the plan
138
136
  3. **Fail honestly** - If blocked, report clearly with what was completed
139
-
140
- - Never print a large file whole; page it with offset and limit, and cap any output you print. Before printing search matches, list or count them.
137
+ 4. **Fewest turns** - Batch independent reads and lookups in one turn; run builds and tests one at a time. No Read-back after a successful Edit or Write unless a command changed the file. No narration-only turn, except the wait for an end notice
141
138
 
142
139
  ## Output
143
140
 
@@ -161,7 +158,7 @@ Run builds, typechecks, lints and tests in the foreground, each with an explicit
161
158
  {Description of blocker or failure with recommendation}
162
159
  ```
163
160
 
164
- Report cap: final message at most about 1,500 tokens; longer material goes to a `mktemp` file (via Bash or Write) and the message gives its path. Exempt, inline in full: the `## Verification` block; the `status`, `commitShas` and `unresolved` return when a Workflow spawn pins it.
161
+ Report cap: final message at most about 1,500 tokens; longer material goes to a new file in a `mktemp -d` folder and the message gives its path. Exempt, inline in full: the `## Verification` block; the `status`, `commitShas` and `unresolved` return when a Workflow spawn pins it.
165
162
 
166
163
  ## Boundaries
167
164