devflow-kit 3.11.0 → 3.12.1

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 (206) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/dist/agents/architect.md +91 -0
  3. package/dist/agents/code.md +21 -25
  4. package/dist/agents/debug.md +22 -50
  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/uninstall.js +1 -1
  16. package/dist/commands/bug-analysis.md +32 -63
  17. package/dist/commands/code-review.md +39 -88
  18. package/dist/commands/debug.md +32 -82
  19. package/dist/commands/dynamic-build.md +157 -211
  20. package/dist/commands/dynamic-plan.md +71 -93
  21. package/dist/commands/dynamic-profile.md +7 -155
  22. package/dist/commands/dynamic-tickets.md +65 -186
  23. package/dist/commands/explore.md +27 -70
  24. package/dist/commands/implement.md +101 -189
  25. package/dist/commands/plan.md +61 -108
  26. package/dist/commands/release.md +26 -92
  27. package/dist/commands/research.md +37 -106
  28. package/dist/commands/resolve.md +65 -129
  29. package/dist/commands/self-review.md +36 -100
  30. package/dist/compliance-off/agents/git.md +15 -18
  31. package/dist/compliance-off/agents/triage.md +7 -14
  32. package/dist/compliance-off/commands/bug-analysis.md +32 -63
  33. package/dist/compliance-off/commands/code-review.md +35 -83
  34. package/dist/compliance-off/commands/dynamic-build.md +151 -205
  35. package/dist/compliance-off/commands/dynamic-tickets.md +65 -186
  36. package/dist/compliance-off/commands/implement.md +97 -183
  37. package/dist/compliance-off/commands/plan.md +61 -108
  38. package/dist/compliance-off/commands/release.md +26 -91
  39. package/dist/compliance-off/commands/resolve.md +55 -129
  40. package/dist/compliance-off/skills/git/references/tracker/github/ensure-pr-ready.md +3 -3
  41. package/dist/compliance-off/skills/git/references/tracker/jira/ensure-pr-ready.md +3 -3
  42. package/dist/compliance-off/skills/git/references/tracker/linear/ensure-pr-ready.md +3 -3
  43. package/dist/core/plugins.js +3 -3
  44. package/dist/curation-compliance-off/agents/triage.md +7 -13
  45. package/dist/curation-compliance-off/commands/bug-analysis.md +22 -42
  46. package/dist/curation-compliance-off/commands/code-review.md +26 -63
  47. package/dist/curation-compliance-off/commands/dynamic-build.md +144 -194
  48. package/dist/curation-compliance-off/commands/dynamic-tickets.md +54 -173
  49. package/dist/curation-compliance-off/commands/implement.md +89 -164
  50. package/dist/curation-compliance-off/commands/plan.md +52 -87
  51. package/dist/curation-compliance-off/commands/release.md +18 -79
  52. package/dist/curation-compliance-off/commands/resolve.md +46 -109
  53. package/dist/curation-off/agents/architect.md +85 -0
  54. package/dist/curation-off/agents/code.md +20 -23
  55. package/dist/curation-off/agents/debug.md +20 -48
  56. package/dist/curation-off/agents/design.md +8 -41
  57. package/dist/curation-off/agents/fix.md +14 -27
  58. package/dist/curation-off/agents/harden.md +13 -18
  59. package/dist/curation-off/agents/knowledge.md +9 -17
  60. package/dist/curation-off/agents/refactor.md +8 -12
  61. package/dist/curation-off/agents/research.md +9 -32
  62. package/dist/curation-off/agents/review.md +11 -40
  63. package/dist/curation-off/agents/skim.md +7 -17
  64. package/dist/curation-off/agents/triage.md +7 -13
  65. package/dist/curation-off/commands/bug-analysis.md +22 -42
  66. package/dist/curation-off/commands/code-review.md +30 -68
  67. package/dist/curation-off/commands/debug.md +24 -63
  68. package/dist/curation-off/commands/dynamic-build.md +150 -200
  69. package/dist/curation-off/commands/dynamic-plan.md +60 -80
  70. package/dist/curation-off/commands/dynamic-tickets.md +54 -173
  71. package/dist/curation-off/commands/explore.md +18 -50
  72. package/dist/curation-off/commands/implement.md +93 -170
  73. package/dist/curation-off/commands/plan.md +52 -87
  74. package/dist/curation-off/commands/release.md +18 -80
  75. package/dist/curation-off/commands/research.md +26 -84
  76. package/dist/curation-off/commands/resolve.md +56 -109
  77. package/dist/curation-off/commands/self-review.md +27 -79
  78. package/dist/hud/components/version-badge.js +1 -1
  79. package/dist/skills/git/references/pr/update-pr-evidence.md +2 -1
  80. package/dist/skills/git/references/tracker/github/ensure-pr-ready.md +3 -3
  81. package/dist/skills/git/references/tracker/jira/ensure-pr-ready.md +3 -3
  82. package/dist/skills/git/references/tracker/linear/ensure-pr-ready.md +3 -3
  83. package/dist/targets/claude-code/curation-install.js +2 -2
  84. package/dist/variant-axes.json +5 -1
  85. package/package.json +1 -1
  86. package/src/assets/agents/_partials/_code.mds +3 -5
  87. package/src/assets/agents/_partials/_design.mds +86 -0
  88. package/src/assets/agents/architect.mds +45 -0
  89. package/src/assets/agents/code.mds +18 -20
  90. package/src/assets/agents/curate.md +26 -35
  91. package/src/assets/agents/debug.mds +22 -50
  92. package/src/assets/agents/design.mds +11 -114
  93. package/src/assets/agents/evaluate.md +6 -16
  94. package/src/assets/agents/explore.md +1 -2
  95. package/src/assets/agents/fix.mds +12 -24
  96. package/src/assets/agents/git.mds +20 -23
  97. package/src/assets/agents/harden.mds +14 -19
  98. package/src/assets/agents/knowledge.mds +10 -38
  99. package/src/assets/agents/polish.md +13 -39
  100. package/src/assets/agents/refactor.mds +6 -9
  101. package/src/assets/agents/research.mds +11 -34
  102. package/src/assets/agents/review.mds +12 -84
  103. package/src/assets/agents/skim.mds +7 -17
  104. package/src/assets/agents/synthesize.md +3 -21
  105. package/src/assets/agents/test.md +31 -32
  106. package/src/assets/agents/tracker.md +116 -229
  107. package/src/assets/agents/triage.mds +7 -26
  108. package/src/assets/agents/validate.md +1 -3
  109. package/src/assets/commands/_partials/_compliance.mds +2 -2
  110. package/src/assets/commands/_partials/_decisions.mds +17 -24
  111. package/src/assets/commands/_partials/_docs_root.mds +31 -10
  112. package/src/assets/commands/_partials/_engine.mds +36 -56
  113. package/src/assets/commands/_partials/_evidence_policy.mds +1 -1
  114. package/src/assets/commands/_partials/_factory.mds +10 -104
  115. package/src/assets/commands/_partials/_knowledge.mds +48 -52
  116. package/src/assets/commands/_partials/_plan_contract.mds +2 -2
  117. package/src/assets/commands/_partials/_preamble.mds +21 -21
  118. package/src/assets/commands/_partials/_publication.mds +3 -3
  119. package/src/assets/commands/_partials/_roster.mds +12 -13
  120. package/src/assets/commands/_partials/_settings.mds +6 -3
  121. package/src/assets/commands/_partials/_ticket_template.mds +3 -7
  122. package/src/assets/commands/_partials/_tracker.mds +10 -5
  123. package/src/assets/commands/_partials/_wave.mds +23 -32
  124. package/src/assets/commands/bug-analysis.mds +3 -7
  125. package/src/assets/commands/code-review.mds +12 -33
  126. package/src/assets/commands/debug.mds +5 -47
  127. package/src/assets/commands/dynamic-build.mds +48 -70
  128. package/src/assets/commands/dynamic-plan.mds +23 -42
  129. package/src/assets/commands/dynamic-profile.mds +7 -57
  130. package/src/assets/commands/dynamic-tickets.mds +9 -29
  131. package/src/assets/commands/explore.mds +5 -44
  132. package/src/assets/commands/implement.mds +77 -119
  133. package/src/assets/commands/plan.mds +27 -57
  134. package/src/assets/commands/release.mds +4 -62
  135. package/src/assets/commands/research.mds +9 -55
  136. package/src/assets/commands/resolve.mds +40 -87
  137. package/src/assets/commands/self-review.mds +5 -45
  138. package/src/assets/mds/git/_ops_pr.mds +1 -0
  139. package/src/assets/mds/git/_ops_steps.mds +4 -4
  140. package/src/assets/mds/git/_pr.mds +1 -1
  141. package/src/assets/rules/engineering.md +1 -1
  142. package/src/assets/rules/quality.md +2 -2
  143. package/src/assets/scripts/ci-wait.cjs +154 -19
  144. package/src/assets/scripts/hooks/assets/orchestrator-charter.md +3 -3
  145. package/src/assets/scripts/hooks/preamble +2 -3
  146. package/src/assets/scripts/pr-evidence.cjs +1 -0
  147. package/src/assets/scripts/resolve-evidence-policy.cjs +14 -13
  148. package/src/assets/scripts/resolve-root.cjs +190 -0
  149. package/src/assets/scripts/resolve-settings.cjs +14 -9
  150. package/src/assets/scripts/verify-evidence.cjs +551 -25
  151. package/src/assets/skills/accessibility/SKILL.md +28 -95
  152. package/src/assets/skills/agent-references/SKILL.md +2 -4
  153. package/src/assets/skills/agent-references/references/commands/implement-evidence-asks.md +1 -1
  154. package/src/assets/skills/agent-references/references/commands/implement-levels.md +4 -7
  155. package/src/assets/skills/agent-references/references/commands/implement-revalidate.md +1 -1
  156. package/src/assets/skills/agent-references/references/commands/plan-levels.md +2 -2
  157. package/src/assets/skills/apply-decisions/SKILL.md +5 -6
  158. package/src/assets/skills/apply-feature-knowledge/SKILL.md +3 -13
  159. package/src/assets/skills/architecture/SKILL.md +29 -105
  160. package/src/assets/skills/boundary-validation/SKILL.md +27 -78
  161. package/src/assets/skills/complexity/SKILL.md +8 -104
  162. package/src/assets/skills/compliance/SKILL.md +9 -67
  163. package/src/assets/skills/consistency/SKILL.md +7 -107
  164. package/src/assets/skills/database/SKILL.md +7 -72
  165. package/src/assets/skills/dependencies/SKILL.md +9 -109
  166. package/src/assets/skills/dependencies/references/detection.md +10 -0
  167. package/src/assets/skills/dependency-research/SKILL.md +9 -63
  168. package/src/assets/skills/design-review/SKILL.md +14 -37
  169. package/src/assets/skills/docs-framework/SKILL.md +4 -47
  170. package/src/assets/skills/documentation/SKILL.md +7 -71
  171. package/src/assets/skills/documentation/references/patterns.md +1 -1
  172. package/src/assets/skills/documentation/references/violations.md +1 -1
  173. package/src/assets/skills/feature-knowledge/SKILL.md +19 -222
  174. package/src/assets/skills/feature-knowledge/references/new-kb.md +128 -0
  175. package/src/assets/skills/gap-analysis/SKILL.md +1 -31
  176. package/src/assets/skills/git/SKILL.md +2 -22
  177. package/src/assets/skills/go/SKILL.md +24 -113
  178. package/src/assets/skills/java/SKILL.md +12 -98
  179. package/src/assets/skills/patterns/SKILL.md +8 -93
  180. package/src/assets/skills/performance/SKILL.md +29 -88
  181. package/src/assets/skills/python/SKILL.md +22 -120
  182. package/src/assets/skills/qa/SKILL.md +16 -54
  183. package/src/assets/skills/qa/references/browser-testing.md +0 -24
  184. package/src/assets/skills/qa/references/sources.md +2 -2
  185. package/src/assets/skills/quality-gates/SKILL.md +13 -100
  186. package/src/assets/skills/react/SKILL.md +33 -95
  187. package/src/assets/skills/regression/SKILL.md +8 -73
  188. package/src/assets/skills/reliability/SKILL.md +11 -120
  189. package/src/assets/skills/research-codebase/SKILL.md +7 -49
  190. package/src/assets/skills/research-competitor/SKILL.md +4 -39
  191. package/src/assets/skills/research-external/SKILL.md +5 -43
  192. package/src/assets/skills/research-market/SKILL.md +5 -43
  193. package/src/assets/skills/research-technology/SKILL.md +8 -68
  194. package/src/assets/skills/review-methodology/SKILL.md +10 -56
  195. package/src/assets/skills/rust/SKILL.md +19 -109
  196. package/src/assets/skills/security/SKILL.md +39 -66
  197. package/src/assets/skills/software-design/SKILL.md +20 -105
  198. package/src/assets/skills/software-design/references/patterns.md +84 -2
  199. package/src/assets/skills/software-design/references/violations.md +1 -1
  200. package/src/assets/skills/test-driven-development/SKILL.md +32 -107
  201. package/src/assets/skills/test-driven-development/references/rationalization-prevention.md +33 -1
  202. package/src/assets/skills/testing/SKILL.md +35 -53
  203. package/src/assets/skills/typescript/SKILL.md +23 -102
  204. package/src/assets/skills/ui-design/SKILL.md +26 -74
  205. package/src/assets/skills/worktree-support/SKILL.md +4 -10
  206. package/dist/curation-off/commands/dynamic-profile.md +0 -214
@@ -1,10 +1,8 @@
1
1
  ---
2
- description: Research a topic using parallel multi-type Research agents with trust-aware synthesis
2
+ description: Research a topic with parallel multi-type Research agents and trust-aware synthesis
3
3
  ---
4
4
  # Research Command
5
5
 
6
- Research a topic by spawning parallel Research agents across multiple research types (codebase, external, market, competitor, technology). Findings are trust-annotated and synthesized into structured output.
7
-
8
6
  ## Usage
9
7
 
10
8
  ```
@@ -16,16 +14,13 @@ Research a topic by spawning parallel Research agents across multiple research t
16
14
 
17
15
  ## Input
18
16
 
19
- What follows `/research` is bound once, here. Every later step names it `COMMAND_INPUT` and never restates it:
17
+ What follows `/research` is bound once, here. Every later step names it `COMMAND_INPUT`:
20
18
 
21
19
  <command-input>
22
20
  $ARGUMENTS
23
21
  </command-input>
24
22
 
25
- `COMMAND_INPUT` is one of:
26
- - Research question: "best caching strategies"
27
- - Comparison question: "compare React vs Svelte for our use case"
28
- - Empty: use conversation context
23
+ An empty `COMMAND_INPUT` means: use the conversation context.
29
24
 
30
25
  ## Phases
31
26
 
@@ -33,50 +28,43 @@ $ARGUMENTS
33
28
 
34
29
  **Produces:** DECISIONS_CONTEXT, FEATURE_KNOWLEDGE, FEATURE_KNOWLEDGE_RULES
35
30
 
36
- **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
31
+ **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.
32
+
33
+ Once per start directory (`WORKTREE_PATH` if provided, otherwise cwd), run from it:
37
34
 
38
35
  ```bash
39
- git -C "{start}" rev-parse --show-toplevel
36
+ node "$HOME/.devflow/scripts/resolve-root.cjs" "{start}"; echo "exit=$?"
40
37
  ```
41
38
 
42
- 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.
39
+ 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.
43
40
 
44
- **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:
41
+ **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:
45
42
 
46
43
  ```bash
47
44
  node "$HOME/.devflow/scripts/resolve-settings.cjs" "{root}" 2>/dev/null; echo "exit=$?"
48
45
  ```
49
46
 
50
- 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.
47
+ 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.
51
48
 
52
49
  The accepted line is the only source of these values.
53
50
 
54
51
  ### Load DECISIONS_CONTEXT
55
52
 
56
- When the settings line says `CURATION=off`, set `DECISIONS_CONTEXT` to `(none)` and skip this step, locating no ledger and reading no index.
53
+ When the settings line says `CURATION=off`, set `DECISIONS_CONTEXT` to `(none)` and skip this step, reading no index.
57
54
 
58
- 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`):
55
+ The decisions ledger belongs to the repository, not to one checkout: a linked worktree reads the main worktree's copy.
56
+
57
+ Once per start directory (`WORKTREE_PATH` if provided, otherwise cwd), run from it:
59
58
 
60
59
  ```bash
61
- git -C "{start}" rev-parse --path-format=absolute --show-toplevel --git-common-dir
60
+ node "$HOME/.devflow/scripts/resolve-root.cjs" "{start}"; echo "exit=$?"
62
61
  ```
63
62
 
64
- 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:
65
-
66
- 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.
67
- 2. **The toplevel** — line 1, or on an older git the line after the echoed flag.
68
- 3. **The start directory itself** — when the command failed or printed no absolute toplevel (outside a git repository).
69
-
70
- This is the rule the curation hooks apply, so you read the index the Curate agent writes.
71
-
72
- **Step 1 — Read the pre-rendered index:**
73
-
74
- Attempt to read `{ledger}/.devflow/curation/index.md`.
63
+ 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.
75
64
 
76
- - If the file exists and contains non-empty content: use that content as `DECISIONS_CONTEXT`.
77
- - If the file is absent or empty: set `DECISIONS_CONTEXT` to `(none)`.
65
+ **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)`.
78
66
 
79
- The index is one direct file read, written at render time by `render-decisions.cjs` — no `.cjs` script runs here.
67
+ The index is one direct file read.
80
68
 
81
69
  **Step 2 — Slice the index, then hand it on:**
82
70
 
@@ -84,51 +72,33 @@ When `DECISIONS_CONTEXT` is not `(none)`, hand it only to the agents whose contr
84
72
 
85
73
  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.
86
74
 
87
- Those agents follow `devflow:apply-decisions`. A host that uses the index in its own thread says so in its own step.
88
-
89
- Use `DECISIONS_CONTEXT` locally when framing research — prior decisions and pitfalls suggest areas to investigate. Follow `devflow:apply-decisions` to Read full entry bodies on demand. Pass `DECISIONS_CONTEXT` to each Research agent in Phase 4 so their findings can account for relevant decisions.
75
+ Use `DECISIONS_CONTEXT` locally to frame the research. Follow `devflow:apply-decisions` to Read full entry bodies on demand. Pass `DECISIONS_CONTEXT` to each Research agent in Phase 4.
90
76
 
91
77
  ### Load Feature Knowledge
92
78
 
93
- 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
79
+ Once per start directory (`WORKTREE_PATH` if provided, otherwise cwd), run from it:
94
80
 
95
81
  ```bash
96
- git -C "{start}" rev-parse --show-toplevel
82
+ node "$HOME/.devflow/scripts/resolve-root.cjs" "{start}"; echo "exit=$?"
97
83
  ```
98
84
 
99
- 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}`.
100
-
101
- **Step 1 — Read the index cache:**
102
-
103
- Attempt to read `{worktree}/.devflow/features/index.md`. Each line follows the format:
104
-
105
- ```
106
- - **{slug}** — {areas} — {Use-when description}
107
- ```
85
+ 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.
108
86
 
109
- If `index.md` exists and contains at least one entry line, use it for relevance matching.
87
+ All paths below are relative to `{worktree}`.
110
88
 
111
- **Step 2 — Fallback: glob frontmatter (if `index.md` is absent or empty):**
89
+ **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.
112
90
 
113
- Glob `{worktree}/.devflow/features/*/KNOWLEDGE.md`. For each file found, read only its YAML frontmatter block (between the opening and closing `---` delimiters).
91
+ **Step 2 — Pick relevant KBs:** select the entries whose documented area overlaps the current task (index line, or frontmatter `description` and `directories` on fallback). Prefer the most specific entries.
114
92
 
115
- **Step 3 — Pick relevant KBs:**
93
+ **Step 3 — Read each selected KB's Rules.** `{kb}` is `{worktree}/.devflow/features/{slug}/KNOWLEDGE.md`:
116
94
 
117
- 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.
95
+ 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.
96
+ 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.
97
+ 3. If the KB has no `## Rules` section, choose one to three entries from its `## Anti-Patterns` or `## Gotchas` range the same way.
118
98
 
119
- **Step 4 — Read each selected KB's Rules:**
99
+ When a KB contradicts the code, **trust the code**. A missing Rules section, a missing heading list and `(none)` are normal, not errors.
120
100
 
121
- For each selected entry, `{kb}` is `{worktree}/.devflow/features/{slug}/KNOWLEDGE.md`:
122
-
123
- 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.
124
- 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.
125
- 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.
126
-
127
- 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.
128
-
129
- **Step 5 — Set FEATURE_KNOWLEDGE and FEATURE_KNOWLEDGE_RULES:**
130
-
131
- 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.
101
+ **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.
132
102
 
133
103
  ```
134
104
  --- Feature knowledge: {slug} ---
@@ -139,11 +109,9 @@ Rules:
139
109
  Headings: L5 Rules · L40 Overview · L62 Anti-Patterns · L118 Key Files
140
110
  ```
141
111
 
142
- 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)`.
143
-
144
- **One git call, then direct reads — no `.cjs` script.**
112
+ 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. If no KBs exist, no KBs are relevant, or `.devflow/features/` is absent, set both to `(none)`.
145
113
 
146
- Use `FEATURE_KNOWLEDGE` **locally** for research framing. Pass to each Research agent in Phase 4.
114
+ Use `FEATURE_KNOWLEDGE` locally for research framing. Pass to each Research agent in Phase 4.
147
115
 
148
116
  ### Phase 2: Requirements
149
117
 
@@ -158,7 +126,7 @@ Analyze the research question to infer research types needed (min 2, max 5). For
158
126
  - `RESEARCH_QUESTION`: Focused sub-question for this type
159
127
  - `OUTPUT_PATH`: `{worktree}/.devflow/docs/research/{topic-slug}/{YYYY-MM-DD_HHMM}/{type}.md`
160
128
 
161
- **Tool availability check**: If WebSearch/WebFetch are unavailable, restrict to `codebase` type only.
129
+ **Tool availability check**: If WebSearch/WebFetch are unavailable, restrict to `codebase` type only, telling the user why.
162
130
 
163
131
  ### Phase 3: Orient (Conditional)
164
132
 
@@ -184,8 +152,6 @@ Each Research agent receives:
184
152
  - `ORIENT_OUTPUT`: Only for `codebase` type
185
153
  - `WORKTREE_PATH`: If in a worktree context
186
154
 
187
- Each Research agent writes findings to disk at OUTPUT_PATH.
188
-
189
155
  ### Phase 5: Synthesize
190
156
 
191
157
  **Produces:** RESEARCH_SUMMARY
@@ -208,6 +174,7 @@ Output: {worktree}/.devflow/docs/research/{topic-slug}/{YYYY-MM-DD_HHMM}/researc
208
174
  **Requires:** RESEARCH_SUMMARY
209
175
 
210
176
  Present findings to user with:
177
+ - The research folder `{worktree}/.devflow/docs/research/{topic-slug}/{YYYY-MM-DD_HHMM}/`
211
178
  - Trust annotations per finding: (trusted) for codebase, (untrusted) for web, (mixed) for technology
212
179
  - Explicit conflicts between codebase and web findings
213
180
  - Drill-down offer via AskUserQuestion
@@ -229,49 +196,13 @@ If external research was skipped due to tool unavailability: inform user.
229
196
 
230
197
  ## Worktree Support
231
198
 
232
- If the orchestrator receives a `WORKTREE_PATH` context (e.g., from multi-worktree workflows), pass it through to all spawned agents. Each agent's "Worktree Support" section handles path resolution.
233
-
234
- ## Output
235
-
236
- Research findings saved to `{worktree}/.devflow/docs/research/{topic-slug}/{YYYY-MM-DD_HHMM}/`:
237
- - `{type}.md` per research type (codebase.md, external.md, etc.)
238
- - `research-summary.md` — synthesized findings with trust annotations
239
-
240
- ## Architecture
241
-
242
- ```
243
- /research (orchestrator)
244
- │
245
- ├─ Phase 1: Load Decisions (Orchestrator-Local)
246
- │
247
- ├─ Phase 2: Requirements
248
- │ └─ Infer 2-5 research types from question
249
- │
250
- ├─ Phase 3: Orient (conditional — codebase type only)
251
- │ └─ Skim agent (codebase overview)
252
- │
253
- ├─ Phase 4: Parallel Research agents
254
- │ └─ 2-5 Research agents in single message (all types simultaneously)
255
- │
256
- ├─ Phase 5: Synthesize
257
- │ └─ Synthesize agent merges findings with trust-aware aggregation
258
- │
259
- ├─ Phase 6: Present findings with trust annotations and drill-down offer
260
- │
261
- └─ Phase 7: Suggest feature knowledge creation (conditional)
262
- └─ Knowledge agent (if codebase type researched + user accepts)
263
- ```
199
+ If the orchestrator receives a `WORKTREE_PATH` context, pass it through to all spawned agents.
264
200
 
265
201
  ## Principles
266
202
 
267
- 1. **Parallel perspectives** — Multiple research types converge on truth better than any single perspective
268
- 2. **Trust transparency** — Every finding is labeled with its trust level (trusted/untrusted/mixed)
269
- 3. **Conflict surfacing** — Contradictions between codebase and web findings are highlighted, not hidden
270
- 4. **Evidence over opinion** — All claims require citations (file:line or URL)
203
+ 1. **Evidence over opinion** — All claims require citations (file:line or URL)
271
204
 
272
205
  ## Error Handling
273
206
 
274
- - If WebSearch/WebFetch unavailable: restrict to codebase type, inform user
275
207
  - If a Research agent fails: continue with remaining outputs, note gap in synthesis
276
208
  - If Synthesize agent fails: present individual Research agent outputs directly
277
- - If feature knowledge creation fails: log failure, report research results normally