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,10 +1,8 @@
1
1
  ---
2
- description: Self-review workflow - Polish agent (code clarity) then Harden agent (9-pillar quality gate)
2
+ description: Polish (code clarity), then Harden (9-pillar quality gate)
3
3
  ---
4
4
  # Self-Review Command
5
5
 
6
- Run Polish agent and Harden agent sequentially on changed files for post-implementation quality refinement.
7
-
8
6
  ## Usage
9
7
 
10
8
  /self-review (auto-detect changed files from git)
@@ -24,42 +22,33 @@ Detect changed files and build context:
24
22
  4. Build TASK_DESCRIPTION from recent commit messages or branch name
25
23
  5. Record `HEAD_BEFORE` (`git rev-parse HEAD`) now, before Polish runs — Phase 3 compares against it
26
24
 
27
- **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:
25
+ **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:
28
26
 
29
27
  ```bash
30
28
  node "$HOME/.devflow/scripts/resolve-settings.cjs" "{root}" 2>/dev/null; echo "exit=$?"
31
29
  ```
32
30
 
33
- 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.
31
+ 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.
34
32
 
35
33
  The accepted line is the only source of these values.
36
34
 
37
35
  ### Load DECISIONS_CONTEXT
38
36
 
39
- When the settings line says `CURATION=off`, set `DECISIONS_CONTEXT` to `(none)` and skip this step, locating no ledger and reading no index.
37
+ When the settings line says `CURATION=off`, set `DECISIONS_CONTEXT` to `(none)` and skip this step, reading no index.
38
+
39
+ The decisions ledger belongs to the repository, not to one checkout: a linked worktree reads the main worktree's copy.
40
40
 
41
- The decisions ledger belongs to the repository, not to one checkout: a linked worktree reads the main worktree's copy, a subdirectory session the repository root's. Locate it with ONE git call, run from the start directory — `WORKTREE_PATH` if provided, otherwise cwd (`devflow:worktree-support`):
41
+ Once per start directory (`WORKTREE_PATH` if provided, otherwise cwd), run from it:
42
42
 
43
43
  ```bash
44
- git -C "{start}" rev-parse --path-format=absolute --show-toplevel --git-common-dir
44
+ node "$HOME/.devflow/scripts/resolve-root.cjs" "{start}"; echo "exit=$?"
45
45
  ```
46
46
 
47
- Line 1 is the checkout's toplevel, line 2 the common git directory. A git older than 2.31 echoes `--path-format=absolute` back as a line of its own first. `{ledger}` is the first that applies:
48
-
49
- 1. **The main worktree** — line 2 without its trailing `/.git`, when the output is exactly two lines each beginning with `/`, line 2 ends in `/.git`, and the directory left once it is removed is not your home directory and contains a `.devflow/` directory.
50
- 2. **The toplevel** — line 1, or on an older git the line after the echoed flag.
51
- 3. **The start directory itself** — when the command failed or printed no absolute toplevel (outside a git repository).
52
-
53
- This is the rule the curation hooks apply, so you read the index the Curate agent writes.
54
-
55
- **Step 1 — Read the pre-rendered index:**
56
-
57
- Attempt to read `{ledger}/.devflow/curation/index.md`.
47
+ 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.
58
48
 
59
- - If the file exists and contains non-empty content: use that content as `DECISIONS_CONTEXT`.
60
- - If the file is absent or empty: set `DECISIONS_CONTEXT` to `(none)`.
49
+ **Step 1 — Read the pre-rendered index** `{ledger}/.devflow/curation/index.md`. Its content is `DECISIONS_CONTEXT`; if it is absent or empty, `DECISIONS_CONTEXT` is `(none)`.
61
50
 
62
- The index is one direct file read, written at render time by `render-decisions.cjs` — no `.cjs` script runs here.
51
+ The index is one direct file read.
63
52
 
64
53
  **Step 2 — Slice the index, then hand it on:**
65
54
 
@@ -67,51 +56,33 @@ When `DECISIONS_CONTEXT` is not `(none)`, hand it only to the agents whose contr
67
56
 
68
57
  Hand each agent that takes `DECISIONS_CONTEXT` a slice, not the whole index: the index lines whose title, scope or area touch the files and task it works on, verbatim, led by `(slice: N of M entries — full index: <absolute index path>)` and closed by the index footer. When unsure, include the line. Siblings over one diff share ONE slice.
69
58
 
70
- Those agents follow `devflow:apply-decisions`. A host that uses the index in its own thread says so in its own step.
71
-
72
- Pass `DECISIONS_CONTEXT` to Harden agent — the compact index lists active ADR/PF entries; Harden agent uses `devflow:apply-decisions` to Read full entry bodies on demand. Known pitfalls help identify reintroduced issues, prior decisions help validate architectural consistency. (Polish agent does not consume decisions — it operates at code-shape level and Harden agent runs after to catch any architectural drift.)
59
+ Pass `DECISIONS_CONTEXT` to the Harden agent only. The Polish agent takes no decisions.
73
60
 
74
61
  ### Load Feature Knowledge
75
62
 
76
- 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
63
+ Once per start directory (`WORKTREE_PATH` if provided, otherwise cwd), run from it:
77
64
 
78
65
  ```bash
79
- git -C "{start}" rev-parse --show-toplevel
80
- ```
81
-
82
- 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}`.
83
-
84
- **Step 1 — Read the index cache:**
85
-
86
- Attempt to read `{worktree}/.devflow/features/index.md`. Each line follows the format:
87
-
88
- ```
89
- - **{slug}** — {areas} — {Use-when description}
66
+ node "$HOME/.devflow/scripts/resolve-root.cjs" "{start}"; echo "exit=$?"
90
67
  ```
91
68
 
92
- If `index.md` exists and contains at least one entry line, use it for relevance matching.
93
-
94
- **Step 2 — Fallback: glob frontmatter (if `index.md` is absent or empty):**
69
+ 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.
95
70
 
96
- Glob `{worktree}/.devflow/features/*/KNOWLEDGE.md`. For each file found, read only its YAML frontmatter block (between the opening and closing `---` delimiters).
71
+ All paths below are relative to `{worktree}`.
97
72
 
98
- **Step 3 — Pick relevant KBs:**
73
+ **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.
99
74
 
100
- 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.
75
+ **Step 2 — Pick relevant KBs:** select the entries whose documented area overlaps the current task (index line, or frontmatter `description` and `directories` on fallback).
101
76
 
102
- **Step 4 — Read each selected KB's Rules:**
77
+ **Step 3 — Read each selected KB's Rules.** `{kb}` is `{worktree}/.devflow/features/{slug}/KNOWLEDGE.md`:
103
78
 
104
- For each selected entry, `{kb}` is `{worktree}/.devflow/features/{slug}/KNOWLEDGE.md`:
105
-
106
- 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.
107
- 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.
79
+ 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.
80
+ 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.
108
81
  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.
109
82
 
110
- 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.
111
-
112
- **Step 5 — Set FEATURE_KNOWLEDGE and FEATURE_KNOWLEDGE_RULES:**
83
+ When a KB contradicts the code you observe, **trust the code**.
113
84
 
114
- 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.
85
+ **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.
115
86
 
116
87
  ```
117
88
  --- Feature knowledge: {slug} ---
@@ -122,14 +93,10 @@ Rules:
122
93
  Headings: L5 Rules · L40 Overview · L62 Anti-Patterns · L118 Key Files
123
94
  ```
124
95
 
125
- 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)`.
126
-
127
- **One git call, then direct reads — no `.cjs` script.**
96
+ 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)`.
128
97
 
129
98
  Pass `FEATURE_KNOWLEDGE_RULES` to Harden agent.
130
99
 
131
- **Extract:** FILES_CHANGED (list), TASK_DESCRIPTION (string), DECISIONS_CONTEXT (string, optional), FEATURE_KNOWLEDGE (string, optional), FEATURE_KNOWLEDGE_RULES (string, optional), HEAD_BEFORE (40-hex SHA)
132
-
133
100
  ### Phase 1: Polish agent (Code Refinement)
134
101
 
135
102
  **Produces:** POLISH_COMMITS
@@ -143,8 +110,6 @@ FILES_CHANGED: {files_changed}
143
110
  Polish and refine the code for clarity and consistency while preserving functionality.
144
111
  Commit any improvements with a conventional-commit message."
145
112
 
146
- **Wait for completion.** Polish agent commits changes directly.
147
-
148
113
  ### Phase 2: Harden agent (9-Pillar Quality Gate)
149
114
 
150
115
  **Produces:** HARDEN_STATUS
@@ -161,7 +126,7 @@ Evaluate against 9-pillar framework. Fix P0/P1 issues. Return structured report.
161
126
  Follow devflow:apply-decisions to scan DECISIONS_CONTEXT and Read full ADR/PF bodies on demand. Skip if (none).
162
127
  Follow devflow:apply-feature-knowledge for FEATURE_KNOWLEDGE. Skip if (none)."
163
128
 
164
- **Wait for completion.** Extract: STATUS (PASS|FIXED|BLOCKED) from the `### Status` line
129
+ Extract: STATUS (PASS|FIXED|BLOCKED) from the `### Status` line
165
130
 
166
131
  ### Phase 3: Conditional Validation
167
132
 
@@ -217,21 +182,18 @@ Display summary:
217
182
 
218
183
  **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.
219
184
 
220
- 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.
221
-
222
- **Step 2 — Evaluate whether write-back is warranted:**
185
+ If the settings line says `KNOWLEDGE=off`, skip write-back entirely. The fail-closed line says `KNOWLEDGE=off` too.
223
186
 
224
- Only proceed if **at least one** of these is true:
187
+ **Step 2 — Write back only if at least one is true:**
225
188
  - 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.
226
- - 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.
189
+ - 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.
227
190
 
228
- **Never spawn unconditionally.** If neither condition is met, skip write-back silently.
191
+ Otherwise skip write-back silently.
229
192
 
230
193
  **Step 3 — Spawn the Knowledge agent:**
231
194
 
232
- Spawn `Agent(subagent_type="Knowledge")` with the following context:
233
-
234
195
  ```
196
+ Agent(subagent_type="Knowledge"):
235
197
  "WORKTREE_PATH: {worktree root}
236
198
  FEATURE_SLUG: {slug derived from primary changed directory, kebab-case}
237
199
  FEATURE_NAME: {human-readable name}
@@ -252,45 +214,19 @@ Then commit the two files as your Commit Protocol directs."
252
214
 
253
215
  **Step 4 — Surface an uncommitted knowledge base:**
254
216
 
255
- 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.
256
-
257
- **Failure handling**: Non-blocking. If the Knowledge agent fails, log the failure and continue — the workflow outcome is not affected by write-back success.
258
-
259
- ## Architecture
260
-
261
- /self-review (orchestrator)
262
- │
263
- ├─ Phase 0: Context gathering
264
- │ ├─ Git diff for changed files
265
- │ ├─ Record HEAD_BEFORE
266
- │ └─ Read index.md → DECISIONS_CONTEXT
267
- │
268
- ├─ Phase 1: Polish agent
269
- │ └─ Code refinement (commits directly)
270
- │
271
- ├─ Phase 2: Harden agent
272
- │ └─ 9-pillar quality gate (may fix and commit)
273
- │
274
- ├─ Phase 3: Validate agent (conditional)
275
- │ └─ If HEAD moved: changed-only over HEAD_BEFORE..HEAD
276
- │
277
- └─ Phase 4: Report
278
- └─ Display summary with pillar status
217
+ 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.
218
+
219
+ Non-blocking: if the Knowledge agent fails, log the failure and continue.
279
220
 
280
221
  ## Edge Cases
281
222
 
282
223
  | Case | Handling |
283
224
  |------|----------|
284
- | No changes | Report "No changes to review" and exit |
285
- | Polish agent finds nothing | Normal, continue to Harden agent |
286
225
  | Harden agent BLOCKED | Report blocking issue, halt workflow |
287
- | Validation fails | Report failures, halt |
288
- | Validate not PASS or FAIL | Report status and cause, halt |
289
226
  | Not in git repo | Report error, suggest running in git repo |
290
227
 
291
228
  ## Principles
292
229
 
293
230
  1. **Orchestration only** - Command spawns agents, doesn't do the work
294
- 2. **Validation gate** - If Polish agent or Harden agent committed, the changes must pass validation
295
- 3. **Honest reporting** - Display actual agent outputs
296
- 4. **Fail fast** - Stop on BLOCKED or a Validate status other than PASS
231
+ 2. **Honest reporting** - Display actual agent outputs
232
+ 3. **Fail fast** - Stop on BLOCKED or a Validate status other than PASS
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: Git
3
- description: Unified agent for all git/GitHub operations - issues, releases
3
+ description: All git/GitHub operations - issues, releases
4
4
  model: haiku
5
5
  effort: medium
6
6
  skills:
@@ -12,15 +12,12 @@ omitClaudeMd: true
12
12
 
13
13
  # Git Agent
14
14
 
15
- You are the Git/GitHub operations specialist.
16
-
17
15
  ## Input
18
16
 
19
- The orchestrator provides:
20
17
  - **OPERATION**: Which task to perform
21
18
  - **Operation-specific parameters**: See the operation's `**Input:**` in its reference
22
19
 
23
- **Worktree Support**: If `WORKTREE_PATH` is provided, follow the `devflow:worktree-support` skill for path resolution. If omitted, use cwd.
20
+ **Worktree Support**: If `WORKTREE_PATH` is provided, follow the `devflow:worktree-support` skill. If omitted, use cwd.
24
21
 
25
22
  **Degradation contract (D4):** Any operation that requires remote access (GitHub API, push, PR) MUST degrade gracefully:
26
23
  - No remote / the tracker unauthenticated or unreachable / no PR → emit `TRACEABILITY: DEGRADED ({reason})`, warn in output, and continue — never abort the caller's workflow.
@@ -65,25 +62,25 @@ A pipeline's exit status swallows a scrubber crash (fail-open). Chain with `&&`
65
62
 
66
63
  | Operation | Purpose |
67
64
  |-----------|---------|
68
- | `ensure-pr-ready` | Pre-flight: commit, push, open the PR |
69
- | `validate-branch` | Pre-flight for /resolve: check branch state |
70
- | `setup-task` | Create feature branch and optionally fetch/create issue |
71
- | `fetch-issue` | Fetch tracker issue for implementation |
72
- | `fetch-issues-batch` | Fetch multiple tracker issues for multi-issue planning |
73
- | `check-ci-status` | Check CI/PR check status for a branch |
65
+ | `ensure-pr-ready` | Commit, push, open the PR |
66
+ | `validate-branch` | Check branch state for /resolve |
67
+ | `setup-task` | Create the branch; optionally fetch or create the issue |
68
+ | `fetch-issue` | Fetch one tracker issue |
69
+ | `fetch-issues-batch` | Fetch several tracker issues |
70
+ | `check-ci-status` | Check the CI status of a branch |
74
71
  | `create-release` | Create GitHub release with version tag |
75
- | `gather-release-evidence` | Collect commits, shipped issues and a per-commit trace map since the last release (D4) |
76
- | `learn-conventions` | Bounded scan → write .devflow/conventions.md once (D1) |
77
- | `fetch-review-threads` | GraphQL reviewThreads, filter devflow-authored, return ext-* records (D2) |
78
- | `check-merge-readiness` | Report-only: unresolved threads + review decision + CI status (D6) |
79
- | `ensure-traceable-issue` | Create or enrich a tracker issue from the D3 template (D5) |
72
+ | `gather-release-evidence` | Commits, shipped issues and trace map since the last release |
73
+ | `learn-conventions` | Bounded scan, then write .devflow/conventions.md once |
74
+ | `fetch-review-threads` | Return external review threads as ext-* records |
75
+ | `check-merge-readiness` | Report-only: threads, review decision, CI status |
76
+ | `ensure-traceable-issue` | Create or enrich a tracker issue |
80
77
 
81
78
  **Decision Marker Legend:**
82
79
 
83
80
  | Marker | Meaning |
84
81
  |--------|---------|
85
- | D4 | Degradation contract — every remote-dependent op degrades gracefully with `TRACEABILITY: DEGRADED ({reason})`, never aborting the caller's workflow |
86
- | D11 | Comment-sink scrub — unconditional secret redaction on every body-posting op; fail-closed (`TRACEABILITY: DEGRADED (redaction unavailable)`) on scrubber error or missing script |
82
+ | D4 | Degradation contract (section above) |
83
+ | D11 | Comment-sink scrub (section above) |
87
84
 
88
85
  D4 and D11 are defined here; every other `D{N}` label is defined in the `devflow:git` skill's `references/decision-markers.md`.
89
86
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: Triage
3
- description: Validates review issues against blast-radius disposition matrix. Assigns one verdict per issue. Never edits code.
3
+ description: Assigns one blast-radius disposition verdict to each review issue. Never edits code.
4
4
  model: opus
5
5
  effort: high
6
6
  skills:
@@ -17,7 +17,7 @@ omitClaudeMd: true
17
17
 
18
18
  # Triage Agent
19
19
 
20
- You are an issue triage specialist. You validate every review issue and assign exactly one disposition from the blast-radius matrix. **You NEVER edit code, create commits, or run build commands.** Your role is judgment only.
20
+ You validate every review issue and assign exactly one disposition from the blast-radius matrix. You judge only (see Boundaries).
21
21
 
22
22
  ## Input Context
23
23
 
@@ -33,11 +33,9 @@ You receive from orchestrator:
33
33
 
34
34
  ## Responsibilities
35
35
 
36
- 1. **Read context per issue**: For each issue, Read 30 lines around the reported file:line to understand the actual code.
36
+ 1. **Read context per issue**: Read 30 lines around each reported file:line. Send the Reads of all issues in one message, with the Gate Level print at `standard` or `lean`, and the first evidence greps of all issues in one message; a grep that needs an earlier result follows it.
37
37
  2. **Apply Decisions**: Scan the DECISIONS_CONTEXT index to identify relevant ADR and PF entries. Read full bodies on demand. State each one that bears on a verdict in words in your Reasoning column, never by its ID — /resolve posts that column to the PR in its resolution summary. Skip when DECISIONS_CONTEXT is empty or `(none)`. Rely only on entries whose verbatim ID is in the index — do not fabricate.
38
38
  3. **Assign disposition**: Run the duplicate grouping pre-pass, then apply the blast-radius matrix to each group's primary. Every issue gets exactly one verdict (DUPLICATE included) — none may vanish.
39
- 4. **Document evidence**: FALSE_POSITIVE requires cited grep/file:line. BY_DESIGN requires a recorded decision, stated in words, or an inline comment/doc citation.
40
- 5. **Assign risk tier**: For every FIX_NOW issue, annotate Standard or Careful.
41
39
 
42
40
  ## Duplicate Grouping Pre-Pass
43
41
 
@@ -69,14 +67,14 @@ REQUIRES: an ADR whose body you have read, stated in words, or a comment/doc in
69
67
  - The affected file is in DIFF_FILES (touched in this branch)
70
68
  - The fix is isolated (Standard-risk) anywhere in the codebase
71
69
  - Security or correctness issue in any code path touched by this branch
72
- Annotate risk tier: **Standard** (isolated, low blast radius) or **Careful** (public API, shared state, >3 files, core logic, multi-service interface, auth flow).
70
+ Annotate every FIX_NOW verdict, from any clause, Standard or Careful (Risk Tier Definitions).
73
71
 
74
72
  **4. FIX_SEPARATE** — valid but exceeds diff blast radius:
75
73
  - Unrelated files not in DIFF_FILES that require wide refactor
76
74
  - Public API changes unrelated to branch purpose
77
75
  - Branch is purpose-constrained (move-only refactor, release branch)
78
76
 
79
- **5. TECH_DEBT** — LAST RESORT: only for issues requiring complete architectural overhaul. "Touches many files" or "changes public API" are NOT reasons (those are FIX_NOW/Careful or FIX_SEPARATE). Use only when a fix requires complete system redesign or coordinated multi-service database migrations.
77
+ **5. TECH_DEBT** — LAST RESORT: only when the fix requires complete system redesign or coordinated multi-service database migrations. "Touches many files" or "changes public API" are NOT reasons (those are FIX_NOW/Careful or FIX_SEPARATE).
80
78
 
81
79
  **Terminal catch-all (no clause matched):** Any valid issue that did not match clauses 3–5: assess blast radius — if the fix scope is contained within the branch's purpose, assign **FIX_NOW** at the appropriate risk tier (Standard or Careful); if the fix scope clearly exceeds the branch's purpose, assign **FIX_SEPARATE**.
82
80
 
@@ -92,7 +90,7 @@ Annotate risk tier: **Standard** (isolated, low blast radius) or **Careful** (pu
92
90
  - Adding tests or improving logging
93
91
  - Security fixes in isolated scope
94
92
 
95
- **Careful** (Code agent uses test-first protocol — understand → plan → test → implement → verify → commit):
93
+ **Careful** (Code agent works test-first):
96
94
  - Public API or function signature changes
97
95
  - Shared state or data model modifications
98
96
  - Changes touching more than 3 files
@@ -168,12 +166,7 @@ Report cap: final message at most about 1,500 tokens; longer material goes to a
168
166
 
169
167
  ## Boundaries
170
168
 
171
- **You are TRIAGE ONLY — read and judge, never write:**
172
- - Read files for 30-line context around each issue
173
- - Run grep/Read for FALSE_POSITIVE evidence
174
- - Read ADR/PF bodies through the decisions index
175
-
176
- **Never:**
169
+ You read and judge, and never write. **Never:**
177
170
  - Edit any file
178
171
  - Run builds, tests, or lint
179
172
  - Create commits or branches
@@ -1,10 +1,8 @@
1
1
  ---
2
- description: Proactive bug finding with static and semantic analysis — hunts real bugs in changed code before merge
2
+ description: Proactive bug finding in changed code before merge, with static and semantic analysis
3
3
  ---
4
4
  # Bug Analysis Command
5
5
 
6
- Run a proactive bug analysis on the current branch: static analysis tools and parallel semantic analyzers, synthesized into one bug report.
7
-
8
6
  ## Usage
9
7
 
10
8
  `/bug-analysis [--full] [--no-static]`: `--full` ignores incremental state; `--no-static` skips static analysis.
@@ -21,17 +19,19 @@ Run a proactive bug analysis on the current branch: static analysis tools and pa
21
19
  node "$HOME/.devflow/scripts/resolve-evidence-policy.cjs" 2>/dev/null; echo "exit=$?"
22
20
  ```
23
21
 
24
- 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.
22
+ 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.
25
23
 
26
24
  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.
27
25
 
28
- **Docs root (D-DOCS-ROOT).** Every `.devflow/docs/` path this command reads or writes lives at the checkout's toplevel, never under the directory the session started in. Resolve `{worktree}` from the start directory — `WORKTREE_PATH` if provided, otherwise cwd (`devflow:worktree-support`) — by running
26
+ **Docs root (D-DOCS-ROOT).** Every `.devflow/docs/` path is `{worktree}/.devflow/docs/…`. A repo-relative docs path handed to an agent travels with a `WORKTREE_PATH` naming its checkout.
27
+
28
+ Once per start directory (`WORKTREE_PATH` if provided, otherwise cwd), run from it:
29
29
 
30
30
  ```bash
31
- git -C "{start}" rev-parse --show-toplevel
31
+ node "$HOME/.devflow/scripts/resolve-root.cjs" "{start}"; echo "exit=$?"
32
32
  ```
33
33
 
34
- and using its one-line output. If the command fails (outside a git repository), `{worktree}` is the start directory itself. Every docs path below is written `{worktree}/.devflow/docs/…`; a repo-relative docs path handed to an agent always travels with a `WORKTREE_PATH` naming the checkout it is relative to.
34
+ 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.
35
35
  When `EVIDENCE_POLICY` is `required`, record `TRACEABILITY: DEGRADED (compliance off on this machine; the repository requires evidence)` once, for the Phase 7 report.
36
36
 
37
37
  Spawn Git agent:
@@ -172,42 +172,33 @@ Set `STATIC_STATUS` to one `{tool}: {value}` per tool: `completed`, `not install
172
172
 
173
173
  #### Decisions Index
174
174
 
175
- **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:
175
+ **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:
176
176
 
177
177
  ```bash
178
178
  node "$HOME/.devflow/scripts/resolve-settings.cjs" "{root}" 2>/dev/null; echo "exit=$?"
179
179
  ```
180
180
 
181
- 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.
181
+ 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.
182
182
 
183
183
  The accepted line is the only source of these values.
184
184
 
185
185
  ### Load DECISIONS_CONTEXT
186
186
 
187
- When the settings line says `CURATION=off`, set `DECISIONS_CONTEXT` to `(none)` and skip this step, locating no ledger and reading no index.
187
+ When the settings line says `CURATION=off`, set `DECISIONS_CONTEXT` to `(none)` and skip this step, reading no index.
188
+
189
+ The decisions ledger belongs to the repository, not to one checkout: a linked worktree reads the main worktree's copy.
188
190
 
189
- The decisions ledger belongs to the repository, not to one checkout: a linked worktree reads the main worktree's copy, a subdirectory session the repository root's. Locate it with ONE git call, run from the start directory — `WORKTREE_PATH` if provided, otherwise cwd (`devflow:worktree-support`):
191
+ Once per start directory (`WORKTREE_PATH` if provided, otherwise cwd), run from it:
190
192
 
191
193
  ```bash
192
- git -C "{start}" rev-parse --path-format=absolute --show-toplevel --git-common-dir
194
+ node "$HOME/.devflow/scripts/resolve-root.cjs" "{start}"; echo "exit=$?"
193
195
  ```
194
196
 
195
- Line 1 is the checkout's toplevel, line 2 the common git directory. A git older than 2.31 echoes `--path-format=absolute` back as a line of its own first. `{ledger}` is the first that applies:
196
-
197
- 1. **The main worktree** — line 2 without its trailing `/.git`, when the output is exactly two lines each beginning with `/`, line 2 ends in `/.git`, and the directory left once it is removed is not your home directory and contains a `.devflow/` directory.
198
- 2. **The toplevel** — line 1, or on an older git the line after the echoed flag.
199
- 3. **The start directory itself** — when the command failed or printed no absolute toplevel (outside a git repository).
200
-
201
- This is the rule the curation hooks apply, so you read the index the Curate agent writes.
197
+ 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.
202
198
 
203
- **Step 1 — Read the pre-rendered index:**
199
+ **Step 1 — Read the pre-rendered index** `{ledger}/.devflow/curation/index.md`. Its content is `DECISIONS_CONTEXT`; if it is absent or empty, `DECISIONS_CONTEXT` is `(none)`.
204
200
 
205
- Attempt to read `{ledger}/.devflow/curation/index.md`.
206
-
207
- - If the file exists and contains non-empty content: use that content as `DECISIONS_CONTEXT`.
208
- - If the file is absent or empty: set `DECISIONS_CONTEXT` to `(none)`.
209
-
210
- The index is one direct file read, written at render time by `render-decisions.cjs` — no `.cjs` script runs here.
201
+ The index is one direct file read.
211
202
 
212
203
  **Step 2 — Slice the index, then hand it on:**
213
204
 
@@ -215,51 +206,33 @@ When `DECISIONS_CONTEXT` is not `(none)`, hand it only to the agents whose contr
215
206
 
216
207
  Hand each agent that takes `DECISIONS_CONTEXT` a slice, not the whole index: the index lines whose title, scope or area touch the files and task it works on, verbatim, led by `(slice: N of M entries — full index: <absolute index path>)` and closed by the index footer. When unsure, include the line. Siblings over one diff share ONE slice.
217
208
 
218
- Those agents follow `devflow:apply-decisions`. A host that uses the index in its own thread says so in its own step.
219
-
220
209
  #### Feature Knowledge
221
210
 
222
211
  ### Load Feature Knowledge
223
212
 
224
- 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
213
+ Once per start directory (`WORKTREE_PATH` if provided, otherwise cwd), run from it:
225
214
 
226
215
  ```bash
227
- git -C "{start}" rev-parse --show-toplevel
216
+ node "$HOME/.devflow/scripts/resolve-root.cjs" "{start}"; echo "exit=$?"
228
217
  ```
229
218
 
230
- 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}`.
219
+ 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.
231
220
 
232
- **Step 1 — Read the index cache:**
221
+ All paths below are relative to `{worktree}`.
233
222
 
234
- Attempt to read `{worktree}/.devflow/features/index.md`. Each line follows the format:
223
+ **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.
235
224
 
236
- ```
237
- - **{slug}** — {areas} — {Use-when description}
238
- ```
225
+ **Step 2 — Pick relevant KBs:** select the entries whose documented area overlaps the current task (index line, or frontmatter `description` and `directories` on fallback).
239
226
 
240
- If `index.md` exists and contains at least one entry line, use it for relevance matching.
227
+ **Step 3 — Read each selected KB's Rules.** `{kb}` is `{worktree}/.devflow/features/{slug}/KNOWLEDGE.md`:
241
228
 
242
- **Step 2 — Fallback: glob frontmatter (if `index.md` is absent or empty):**
243
-
244
- Glob `{worktree}/.devflow/features/*/KNOWLEDGE.md`. For each file found, read only its YAML frontmatter block (between the opening and closing `---` delimiters).
245
-
246
- **Step 3 — Pick relevant KBs:**
247
-
248
- 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.
249
-
250
- **Step 4 — Read each selected KB's Rules:**
251
-
252
- For each selected entry, `{kb}` is `{worktree}/.devflow/features/{slug}/KNOWLEDGE.md`:
253
-
254
- 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.
255
- 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.
229
+ 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.
230
+ 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.
256
231
  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.
257
232
 
258
- 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.
259
-
260
- **Step 5 — Set FEATURE_KNOWLEDGE and FEATURE_KNOWLEDGE_RULES:**
233
+ When a KB contradicts the code you observe, **trust the code**.
261
234
 
262
- 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.
235
+ **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.
263
236
 
264
237
  ```
265
238
  --- Feature knowledge: {slug} ---
@@ -270,9 +243,7 @@ Rules:
270
243
  Headings: L5 Rules · L40 Overview · L62 Anti-Patterns · L118 Key Files
271
244
  ```
272
245
 
273
- 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)`.
274
-
275
- **One git call, then direct reads — no `.cjs` script.**
246
+ 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)`.
276
247
 
277
248
  #### Plan Artifact
278
249
 
@@ -300,9 +271,7 @@ Pick the focus analyzers from `CHANGED_FILES` (Step 2b; do not re-run `git diff`
300
271
  **Produces:** ANALYZER_OUTPUTS
301
272
  **Requires:** DIFF_RANGE, ANALYSIS_DIR, ACTIVE_FOCUSES, STATIC_FINDINGS, ACCEPTANCE_RULES, PLAN_CONTEXT, DECISIONS_CONTEXT, FEATURE_KNOWLEDGE
302
273
 
303
- Spawn ALL active Debug agents **in a single message** (parallel, NOT background):
304
-
305
- For each active focus, spawn:
274
+ Spawn one Debug agent for each active focus, all in a single message (parallel, not background):
306
275
  ```
307
276
  Agent(subagent_type="Debug", run_in_background=false):
308
277
  "Analyze focusing on {focus}.
@@ -381,7 +350,7 @@ Seven phases: Phase 1 to Phase 7.
381
350
  |------|----------|
382
351
  | Rebase invalidates `.last-analysis-head` SHA | `git cat-file -t` check fails → fallback to full diff |
383
352
  | Zero changed files in DIFF_RANGE with exit 0 | Stop: "No changes to analyze." |
384
- | `--full` flag | Bypass incremental detection (Step 2a), run full diff from base |
353
+ | `--full` flag | Step 2a takes the full-range path |
385
354
  | A scanner did not run or did not complete | Name the tool and why in `STATIC_FINDINGS`, not `(none)`; a tool that did not complete keeps the marker |
386
355
 
387
356
  ## Resolve Compatibility