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: Explore codebase with structured analysis and optional feature knowledge creation
2
+ description: Explore codebase with structured analysis; optionally build feature knowledge
3
3
  ---
4
4
  # Explore Command
5
5
 
6
- Explore a codebase area by spawning parallel agents for flow tracing, dependency mapping, and pattern analysis. Findings are synthesized into structured output with file:line references, with optional feature knowledge created as a byproduct.
7
-
8
6
  ## Usage
9
7
 
10
8
  ```
@@ -21,10 +19,7 @@ What follows `/explore` is bound once, here. Every later step names it `COMMAND_
21
19
  $ARGUMENTS
22
20
  </command-input>
23
21
 
24
- `COMMAND_INPUT` is one of:
25
- - Area description: "how does the auth system work"
26
- - Flow question: "trace the request lifecycle"
27
- - Empty: use conversation context
22
+ An empty `COMMAND_INPUT` means: use the conversation context.
28
23
 
29
24
  ## Phases
30
25
 
@@ -32,42 +27,33 @@ $ARGUMENTS
32
27
 
33
28
  **Produces:** DECISIONS_CONTEXT
34
29
 
35
- **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:
30
+ **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:
36
31
 
37
32
  ```bash
38
33
  node "$HOME/.devflow/scripts/resolve-settings.cjs" "{root}" 2>/dev/null; echo "exit=$?"
39
34
  ```
40
35
 
41
- 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.
36
+ 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.
42
37
 
43
38
  The accepted line is the only source of these values.
44
39
 
45
40
  ### Load DECISIONS_CONTEXT
46
41
 
47
- When the settings line says `CURATION=off`, set `DECISIONS_CONTEXT` to `(none)` and skip this step, locating no ledger and reading no index.
42
+ When the settings line says `CURATION=off`, set `DECISIONS_CONTEXT` to `(none)` and skip this step, reading no index.
43
+
44
+ The decisions ledger belongs to the repository, not to one checkout: a linked worktree reads the main worktree's copy.
48
45
 
49
- 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`):
46
+ Once per start directory (`WORKTREE_PATH` if provided, otherwise cwd), run from it:
50
47
 
51
48
  ```bash
52
- git -C "{start}" rev-parse --path-format=absolute --show-toplevel --git-common-dir
49
+ node "$HOME/.devflow/scripts/resolve-root.cjs" "{start}"; echo "exit=$?"
53
50
  ```
54
51
 
55
- 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:
56
-
57
- 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.
58
- 2. **The toplevel** — line 1, or on an older git the line after the echoed flag.
59
- 3. **The start directory itself** — when the command failed or printed no absolute toplevel (outside a git repository).
60
-
61
- This is the rule the curation hooks apply, so you read the index the Curate agent writes.
52
+ 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.
62
53
 
63
- **Step 1 — Read the pre-rendered index:**
54
+ **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)`.
64
55
 
65
- Attempt to read `{ledger}/.devflow/curation/index.md`.
66
-
67
- - If the file exists and contains non-empty content: use that content as `DECISIONS_CONTEXT`.
68
- - If the file is absent or empty: set `DECISIONS_CONTEXT` to `(none)`.
69
-
70
- The index is one direct file read, written at render time by `render-decisions.cjs` — no `.cjs` script runs here.
56
+ The index is one direct file read.
71
57
 
72
58
  **Step 2 — Slice the index, then hand it on:**
73
59
 
@@ -75,11 +61,9 @@ When `DECISIONS_CONTEXT` is not `(none)`, hand it only to the agents whose contr
75
61
 
76
62
  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.
77
63
 
78
- Those agents follow `devflow:apply-decisions`. A host that uses the index in its own thread says so in its own step.
79
-
80
- The orchestrator uses `DECISIONS_CONTEXT` locally when framing exploration — prior decisions and pitfalls suggest specific areas to investigate. Follow `devflow:apply-decisions` to Read full entry bodies on demand. **Do NOT pass `DECISIONS_CONTEXT` to Explore sub-agents** — decisions context stays in the orchestrator, not in the investigation workers.
64
+ Use `DECISIONS_CONTEXT` locally to frame the exploration. Follow `devflow:apply-decisions` to Read full entry bodies on demand. **Do NOT pass `DECISIONS_CONTEXT` to Explore sub-agents** — decisions context stays in the orchestrator, not in the investigation workers.
81
65
 
82
- **No up-front feature knowledge load** — explore investigation workers read code directly to avoid confirmation bias. Feature knowledge is only created as a write-back at the end, after exploration is complete.
66
+ **No up-front feature knowledge load** — explore investigation workers read code directly to avoid confirmation bias.
83
67
 
84
68
  ### Phase 2: Orient
85
69
 
@@ -141,31 +125,30 @@ Present findings to user. Use AskUserQuestion to offer focused follow-up explora
141
125
 
142
126
  ### Feature Knowledge Write-Back (Conditional)
143
127
 
144
- 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
128
+ Once per start directory (`WORKTREE_PATH` if provided, otherwise cwd), run from it:
145
129
 
146
130
  ```bash
147
- git -C "{start}" rev-parse --show-toplevel
131
+ node "$HOME/.devflow/scripts/resolve-root.cjs" "{start}"; echo "exit=$?"
148
132
  ```
149
133
 
150
- 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}`.
134
+ 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.
151
135
 
152
- **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.
136
+ All paths below are relative to `{worktree}`.
153
137
 
154
- 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.
138
+ **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.
155
139
 
156
- **Step 2 — Evaluate whether write-back is warranted:**
140
+ If the settings line says `KNOWLEDGE=off`, skip write-back entirely. The fail-closed line says `KNOWLEDGE=off` too.
157
141
 
158
- Only proceed if **at least one** of these is true:
142
+ **Step 2 — Write back only if at least one is true:**
159
143
  - 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.
160
- - 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.
144
+ - 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.
161
145
 
162
- **Never spawn unconditionally.** If neither condition is met, skip write-back silently.
146
+ Otherwise skip write-back silently.
163
147
 
164
148
  **Step 3 — Spawn the Knowledge agent:**
165
149
 
166
- Spawn `Agent(subagent_type="Knowledge")` with the following context:
167
-
168
150
  ```
151
+ Agent(subagent_type="Knowledge"):
169
152
  "WORKTREE_PATH: {worktree root}
170
153
  FEATURE_SLUG: {slug derived from primary changed directory, kebab-case}
171
154
  FEATURE_NAME: {human-readable name}
@@ -186,9 +169,9 @@ Then commit the two files as your Commit Protocol directs."
186
169
 
187
170
  **Step 4 — Surface an uncommitted knowledge base:**
188
171
 
189
- 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.
172
+ 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.
190
173
 
191
- **Failure handling**: Non-blocking. If the Knowledge agent fails, log the failure and continue — the workflow outcome is not affected by write-back success.
174
+ Non-blocking: if the Knowledge agent fails, log the failure and continue.
192
175
 
193
176
  Set FEATURE_KNOWLEDGE_STATUS = created (if agent spawned) or skipped.
194
177
 
@@ -196,7 +179,7 @@ Set FEATURE_KNOWLEDGE_STATUS = created (if agent spawned) or skipped.
196
179
 
197
180
  ## Worktree Support
198
181
 
199
- 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.
182
+ If the orchestrator receives a `WORKTREE_PATH` context, pass it through to all spawned agents.
200
183
 
201
184
  ## Output
202
185
 
@@ -209,38 +192,12 @@ Structured exploration findings with concrete code references:
209
192
  - Patterns (recurring conventions, design decisions observed)
210
193
  - Key Insights (non-obvious findings, surprises, potential concerns)
211
194
 
212
- ## Architecture
213
-
214
- ```
215
- /explore (orchestrator)
216
- │
217
- ├─ Phase 1: Load Decisions (Orchestrator-Local)
218
- │
219
- ├─ Phase 2: Orient
220
- │ └─ Skim agent (codebase overview)
221
- │
222
- ├─ Phase 3: Parallel exploration
223
- │ └─ 2-3 Explore agents (flow, dependency, pattern) in single message
224
- │
225
- ├─ Phase 4: Synthesize
226
- │ └─ Synthesize agent aggregates findings in exploration mode
227
- │
228
- ├─ Phase 5: Present findings with drill-down offer
229
- │
230
- └─ Phase 6: Suggest feature knowledge creation (conditional)
231
- └─ Knowledge agent write-back (if user accepts and no existing feature knowledge)
232
- ```
233
-
234
195
  ## Principles
235
196
 
236
197
  1. **Structure over browsing** - Every claim must cite file:line references
237
- 2. **Parallel execution** - All explorers run simultaneously for speed
238
- 3. **Knowledge-informed** - Prior decisions guide where to look; NO pre-loaded feature knowledge in sub-agents (avoids confirmation bias)
239
- 4. **User-driven depth** - Present findings, then offer drill-down into specific areas
240
198
 
241
199
  ## Error Handling
242
200
 
243
201
  - If Skim agent returns no relevant files: report "No files found matching exploration scope"
244
202
  - If all explorers error: report partial findings from any that succeeded, note gaps
245
203
  - If an explorer errors: continue with remaining results, note the gap
246
- - If feature knowledge creation fails: log failure, report exploration results normally