devflow-kit 3.5.0 → 3.6.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 (107) hide show
  1. package/CHANGELOG.md +98 -0
  2. package/README.md +4 -4
  3. package/dist/agents/{diagnose.md → debug.md} +4 -4
  4. package/dist/agents/{code-fix.md → fix.md} +2 -2
  5. package/dist/agents/{scrutinize.md → harden.md} +6 -6
  6. package/dist/agents/{code-edit.md → refactor.md} +3 -3
  7. package/dist/cli/agents-view/render.js +1 -1
  8. package/dist/cli/commands/init.js +3 -3
  9. package/dist/cli/commands/learning.js +12 -12
  10. package/dist/cli/commands/legacy-hooks.js +1 -1
  11. package/dist/cli/commands/uninstall.js +111 -5
  12. package/dist/commands/bug-analysis.md +19 -15
  13. package/dist/commands/code-review.md +13 -22
  14. package/dist/commands/debug.md +15 -15
  15. package/dist/commands/dynamic-build.md +51 -55
  16. package/dist/commands/dynamic-plan.md +11 -9
  17. package/dist/commands/dynamic-profile.md +7 -5
  18. package/dist/commands/dynamic-tickets.md +11 -9
  19. package/dist/commands/explore.md +13 -13
  20. package/dist/commands/implement.md +58 -127
  21. package/dist/commands/plan.md +19 -41
  22. package/dist/commands/release.md +9 -5
  23. package/dist/commands/research.md +12 -8
  24. package/dist/commands/resolve.md +42 -86
  25. package/dist/commands/self-review.md +42 -42
  26. package/dist/core/agent-models.js +47 -11
  27. package/dist/core/{learning-tuning-config.js → curate-tuning-config.js} +14 -14
  28. package/dist/core/learning-queue-cleanup.js +1 -1
  29. package/dist/core/migrations.js +63 -44
  30. package/dist/core/plugins.js +14 -12
  31. package/dist/core/project-paths.js +3 -3
  32. package/dist/hud/codex-usage.js +247 -0
  33. package/dist/hud/components/codex-quota.js +37 -0
  34. package/dist/hud/components/usage-quota.js +1 -1
  35. package/dist/hud/config.js +1 -0
  36. package/dist/hud/index.js +16 -3
  37. package/dist/hud/render.js +3 -1
  38. package/dist/learning-off/agents/{diagnose.md → debug.md} +4 -4
  39. package/dist/learning-off/agents/{code-fix.md → fix.md} +2 -2
  40. package/dist/learning-off/agents/{scrutinize.md → harden.md} +6 -6
  41. package/dist/learning-off/agents/{code-edit.md → refactor.md} +3 -3
  42. package/dist/learning-off/commands/bug-analysis.md +9 -9
  43. package/dist/learning-off/commands/code-review.md +2 -15
  44. package/dist/learning-off/commands/debug.md +4 -8
  45. package/dist/learning-off/commands/dynamic-build.md +45 -51
  46. package/dist/learning-off/commands/dynamic-plan.md +5 -5
  47. package/dist/learning-off/commands/dynamic-profile.md +1 -1
  48. package/dist/learning-off/commands/dynamic-tickets.md +5 -5
  49. package/dist/learning-off/commands/explore.md +2 -6
  50. package/dist/learning-off/commands/implement.md +46 -119
  51. package/dist/learning-off/commands/plan.md +8 -33
  52. package/dist/learning-off/commands/release.md +4 -2
  53. package/dist/learning-off/commands/research.md +2 -2
  54. package/dist/learning-off/commands/resolve.md +31 -79
  55. package/dist/learning-off/commands/self-review.md +30 -34
  56. package/dist/skills/git/references/pr/check-merge-readiness.md +2 -0
  57. package/dist/skills/git/references/pr/update-pr-evidence.md +4 -6
  58. package/dist/targets/claude-code/installer.js +117 -84
  59. package/dist/targets/claude-code/tracker-servers.js +1 -1
  60. package/package.json +1 -1
  61. package/src/assets/agents/_partials/_code.mds +2 -2
  62. package/src/assets/agents/code.mds +2 -2
  63. package/src/assets/agents/{learning.md → curate.md} +4 -4
  64. package/src/assets/agents/{diagnose.mds → debug.mds} +4 -4
  65. package/src/assets/agents/evaluate.md +4 -4
  66. package/src/assets/agents/{code-fix.mds → fix.mds} +5 -5
  67. package/src/assets/agents/{scrutinize.mds → harden.mds} +6 -6
  68. package/src/assets/agents/{simplify.md → polish.md} +4 -4
  69. package/src/assets/agents/{code-edit.mds → refactor.mds} +6 -6
  70. package/src/assets/agents/test.md +2 -2
  71. package/src/assets/commands/_partials/_compliance.mds +1 -1
  72. package/src/assets/commands/_partials/_decisions.mds +26 -6
  73. package/src/assets/commands/_partials/_engine.mds +15 -15
  74. package/src/assets/commands/_partials/_evidence_policy.mds +0 -17
  75. package/src/assets/commands/_partials/_knowledge.mds +14 -9
  76. package/src/assets/commands/_partials/_preamble.mds +4 -2
  77. package/src/assets/commands/_partials/_roster.mds +4 -4
  78. package/src/assets/commands/bug-analysis.mds +7 -7
  79. package/src/assets/commands/code-review.mds +1 -14
  80. package/src/assets/commands/debug.mds +2 -2
  81. package/src/assets/commands/dynamic-build.mds +26 -32
  82. package/src/assets/commands/implement.mds +45 -102
  83. package/src/assets/commands/plan.mds +7 -37
  84. package/src/assets/commands/release.mds +5 -1
  85. package/src/assets/commands/resolve.mds +28 -76
  86. package/src/assets/commands/self-review.mds +27 -27
  87. package/src/assets/mds/git/_pr.mds +6 -6
  88. package/src/assets/scripts/hooks/assets/orchestrator-charter.md +4 -3
  89. package/src/assets/scripts/hooks/capture-prompt +1 -1
  90. package/src/assets/scripts/hooks/capture-question +1 -1
  91. package/src/assets/scripts/hooks/capture-turn +1 -1
  92. package/src/assets/scripts/hooks/json-helper.cjs +2 -2
  93. package/src/assets/scripts/hooks/lib/learning-store.cjs +1 -1
  94. package/src/assets/scripts/hooks/lib/project-paths.cjs +4 -4
  95. package/src/assets/scripts/hooks/preamble +1 -1
  96. package/src/assets/scripts/hooks/session-start-context +58 -45
  97. package/src/assets/scripts/verify-evidence.cjs +726 -9
  98. package/src/assets/skills/agent-references/SKILL.md +9 -5
  99. package/src/assets/skills/agent-references/references/commands/implement-evidence-asks.md +35 -0
  100. package/src/assets/skills/agent-references/references/commands/implement-revalidate.md +15 -0
  101. package/src/assets/skills/agent-references/references/synthesize/bug-analysis.md +1 -1
  102. package/src/assets/skills/apply-decisions/SKILL.md +6 -4
  103. package/src/assets/skills/docs-framework/SKILL.md +3 -3
  104. package/src/assets/skills/qa/SKILL.md +1 -1
  105. package/src/assets/skills/quality-gates/SKILL.md +7 -7
  106. package/src/assets/skills/quality-gates/references/report-template.md +7 -7
  107. /package/src/assets/skills/agent-references/references/{learning → curate}/maintain.md +0 -0
@@ -64,22 +64,24 @@ The accepted line is the only source of these values: the script alone folds the
64
64
 
65
65
  When the settings line says `LEARNING=off`, set `DECISIONS_CONTEXT` to `(none)` and skip this step, locating no ledger and reading no index.
66
66
 
67
- The decisions ledger belongs to the repository, not to one checkout: in a linked worktree it lives in the main worktree, and a session started in a subdirectory reads the copy at the repository root. Locate it with ONE git call, run from the start directory — `WORKTREE_PATH` if provided, otherwise cwd (`devflow:worktree-support`):
67
+ 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`):
68
68
 
69
69
  ```bash
70
70
  git -C "{start}" rev-parse --path-format=absolute --show-toplevel --git-common-dir
71
71
  ```
72
72
 
73
- Line 1 is the checkout's toplevel, line 2 the repository's 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 of these that applies:
73
+ 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:
74
74
 
75
75
  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.
76
76
  2. **The toplevel** — line 1, or on an older git the line after the echoed flag.
77
77
  3. **The start directory itself** — when the command failed or printed no absolute toplevel (outside a git repository).
78
78
 
79
- This is the rule the learning hooks apply (D-LEDGER-MAIN-WORKTREE, D-PROMPT-ROOT), so you read the index the Learning agent writes.
79
+ This is the rule the learning hooks apply, so you read the index the Curate agent writes.
80
80
 
81
81
  Read `{ledger}/.devflow/learning/index.md`. If the file is absent or empty, set `DECISIONS_CONTEXT` to `(none)`; otherwise use the file content as `DECISIONS_CONTEXT`.
82
82
 
83
+ 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.
84
+
83
85
  ### Load Feature Knowledge
84
86
 
85
87
  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
@@ -102,7 +104,7 @@ If `index.md` exists and contains at least one entry line, use it for relevance
102
104
 
103
105
  **Step 2 — Fallback: glob frontmatter (if `index.md` is absent or empty):**
104
106
 
105
- Glob `{worktree}/.devflow/features/*/KNOWLEDGE.md`. For each file found, read only its YAML frontmatter block (between the opening and closing `---` delimiters). The frontmatter fields `name`, `description`, and `directories` are the authoritative relevance surface — `index.md` is only a cache.
107
+ Glob `{worktree}/.devflow/features/*/KNOWLEDGE.md`. For each file found, read only its YAML frontmatter block (between the opening and closing `---` delimiters).
106
108
 
107
109
  **Step 3 — Pick relevant KBs:**
108
110
 
@@ -133,7 +135,7 @@ Headings: L5 Rules · L40 Overview · L62 Anti-Patterns · L118 Key Files
133
135
 
134
136
  A KB with no Rules section labels its entries `Rules ({section name}):` and gives them no ID. `FEATURE_KNOWLEDGE` is these blocks; `FEATURE_KNOWLEDGE_RULES` is the same blocks without the `Headings:` line. 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)`.
135
137
 
136
- **One git call, then direct reads — no `.cjs` script.** After resolving `{worktree}`, this step is 1 index read (or N frontmatter reads on fallback), plus one heading listing and one Rules read per selected KB, bounded by KB count.
138
+ **One git call, then direct reads — no `.cjs` script.**
137
139
 
138
140
  Pass `DECISIONS_CONTEXT` and `FEATURE_KNOWLEDGE` only to agents whose contract declares them; the Validate and Git agents this command spawns do not.
139
141
 
@@ -229,10 +231,12 @@ Arm 1 or 2 ⇒ ask once, via AskUserQuestion: "{u} untraced commits{, coverage u
229
231
  ## Traceability exceptions
230
232
  - `untraced` <sha12> (<author>) self-attested by @<login> at <utc>: <reason>
231
233
  - `coverage` <bound-hit|trace-unavailable|gather-indeterminate|untraced-beyond-list> self-attested by @<login> at <utc>: <reason>
234
+
232
235
  Exempt (not attested): release <n> · revert <n> · bot <n> — <sha12>, …
233
236
  ```
234
237
 
235
238
  - One `untraced` line per listed untraced commit (≤100), its `<sha12>` and `<author>` copied from that `### TRACE_MAP` line. One `coverage` line per arm-1 cause — `bound-hit` for `bound:hit`, `gather-indeterminate` for status `INDETERMINATE` or none of the five, `trace-unavailable` for any other — plus `untraced-beyond-list` when an `…and <n> more` line closes the untraced list. The `Exempt` line counts each exempt kind (its listed lines plus its `…and <n> more`) and names every listed exempt SHA.
239
+ - A blank line separates the last bullet from the `Exempt` line, so Markdown renders that line as its own paragraph and not inside the bullet. Compose the block with that blank line every time.
236
240
  - `@<login>` is `@` followed by the output of `gh api user --jq .login` when that output matches `^[A-Za-z0-9][A-Za-z0-9-]{0,38}$`. On any other output, or a failed call, it is `(login unavailable)` instead, with no `@`.
237
241
  - `<utc>` is the output of `date -u +%Y-%m-%dT%H:%M:%SZ`.
238
242
  - `<reason>` is the user's own words, made inert: replace every character outside printable ASCII (newlines and tabs included) with a space, remove every `<`, `>`, `` ` ``, `[`, `]`, `\`, `/`, `#`, `@`, `&` and `$`, collapse runs of spaces, trim, keep the first 200 characters, and trim again. A reason that is empty after this is no reason.
@@ -55,19 +55,19 @@ The accepted line is the only source of these values: the script alone folds the
55
55
 
56
56
  When the settings line says `LEARNING=off`, set `DECISIONS_CONTEXT` to `(none)` and skip this step, locating no ledger and reading no index.
57
57
 
58
- The decisions ledger belongs to the repository, not to one checkout: in a linked worktree it lives in the main worktree, and a session started in a subdirectory reads the copy at the repository root. Locate it with ONE git call, run from the start directory — `WORKTREE_PATH` if provided, otherwise cwd (`devflow:worktree-support`):
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`):
59
59
 
60
60
  ```bash
61
61
  git -C "{start}" rev-parse --path-format=absolute --show-toplevel --git-common-dir
62
62
  ```
63
63
 
64
- Line 1 is the checkout's toplevel, line 2 the repository's 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 of these that applies:
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
65
 
66
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
67
  2. **The toplevel** — line 1, or on an older git the line after the echoed flag.
68
68
  3. **The start directory itself** — when the command failed or printed no absolute toplevel (outside a git repository).
69
69
 
70
- This is the rule the learning hooks apply (D-LEDGER-MAIN-WORKTREE, D-PROMPT-ROOT), so you read the index the Learning agent writes.
70
+ This is the rule the learning hooks apply, so you read the index the Curate agent writes.
71
71
 
72
72
  **Step 1 — Read the pre-rendered index:**
73
73
 
@@ -76,11 +76,15 @@ Attempt to read `{ledger}/.devflow/learning/index.md`.
76
76
  - If the file exists and contains non-empty content: use that content as `DECISIONS_CONTEXT`.
77
77
  - If the file is absent or empty: set `DECISIONS_CONTEXT` to `(none)`.
78
78
 
79
- The index is one direct file read, written at render time by `render-decisions.cjs` alongside `decisions.md`/`pitfalls.md` — no `.cjs` script runs here, and the index's own footer names the files that hold each entry's full body.
79
+ The index is one direct file read, written at render time by `render-decisions.cjs` — no `.cjs` script runs here.
80
80
 
81
- **Step 2 — Agents apply the decisions:**
81
+ **Step 2 — Slice the index, then hand it on:**
82
82
 
83
- When `DECISIONS_CONTEXT` is not `(none)`, hand it only to the agents whose contract declares it. They follow `devflow:apply-decisions`: scan the index, identify plausibly-relevant entries, Read full entry bodies on demand, and cite verbatim IDs in their reasoning. A host that uses the index in its own thread says so in its own step.
83
+ When `DECISIONS_CONTEXT` is not `(none)`, hand it only to the agents whose contract declares it.
84
+
85
+ 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
+
87
+ Those agents follow `devflow:apply-decisions`. A host that uses the index in its own thread says so in its own step.
84
88
 
85
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.
86
90
 
@@ -106,7 +110,7 @@ If `index.md` exists and contains at least one entry line, use it for relevance
106
110
 
107
111
  **Step 2 — Fallback: glob frontmatter (if `index.md` is absent or empty):**
108
112
 
109
- Glob `{worktree}/.devflow/features/*/KNOWLEDGE.md`. For each file found, read only its YAML frontmatter block (between the opening and closing `---` delimiters). The frontmatter fields `name`, `description`, and `directories` are the authoritative relevance surface — `index.md` is only a cache.
113
+ Glob `{worktree}/.devflow/features/*/KNOWLEDGE.md`. For each file found, read only its YAML frontmatter block (between the opening and closing `---` delimiters).
110
114
 
111
115
  **Step 3 — Pick relevant KBs:**
112
116
 
@@ -137,7 +141,7 @@ Headings: L5 Rules · L40 Overview · L62 Anti-Patterns · L118 Key Files
137
141
 
138
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)`.
139
143
 
140
- **One git call, then direct reads — no `.cjs` script.** After resolving `{worktree}`, this step is 1 index read (or N frontmatter reads on fallback), plus one heading listing and one Rules read per selected KB, bounded by KB count.
144
+ **One git call, then direct reads — no `.cjs` script.**
141
145
 
142
146
  Use `FEATURE_KNOWLEDGE` **locally** for research framing. Pass to each Research agent in Phase 4.
143
147
 
@@ -102,19 +102,19 @@ The accepted line is the only source of these values: the script alone folds the
102
102
 
103
103
  When the settings line says `LEARNING=off`, set `DECISIONS_CONTEXT` to `(none)` and skip this step, locating no ledger and reading no index.
104
104
 
105
- The decisions ledger belongs to the repository, not to one checkout: in a linked worktree it lives in the main worktree, and a session started in a subdirectory reads the copy at the repository root. Locate it with ONE git call, run from the start directory — `WORKTREE_PATH` if provided, otherwise cwd (`devflow:worktree-support`):
105
+ 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`):
106
106
 
107
107
  ```bash
108
108
  git -C "{start}" rev-parse --path-format=absolute --show-toplevel --git-common-dir
109
109
  ```
110
110
 
111
- Line 1 is the checkout's toplevel, line 2 the repository's 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 of these that applies:
111
+ 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:
112
112
 
113
113
  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.
114
114
  2. **The toplevel** — line 1, or on an older git the line after the echoed flag.
115
115
  3. **The start directory itself** — when the command failed or printed no absolute toplevel (outside a git repository).
116
116
 
117
- This is the rule the learning hooks apply (D-LEDGER-MAIN-WORKTREE, D-PROMPT-ROOT), so you read the index the Learning agent writes.
117
+ This is the rule the learning hooks apply, so you read the index the Curate agent writes.
118
118
 
119
119
  **Step 1 — Read the pre-rendered index:**
120
120
 
@@ -123,11 +123,15 @@ Attempt to read `{ledger}/.devflow/learning/index.md`.
123
123
  - If the file exists and contains non-empty content: use that content as `DECISIONS_CONTEXT`.
124
124
  - If the file is absent or empty: set `DECISIONS_CONTEXT` to `(none)`.
125
125
 
126
- The index is one direct file read, written at render time by `render-decisions.cjs` alongside `decisions.md`/`pitfalls.md` — no `.cjs` script runs here, and the index's own footer names the files that hold each entry's full body.
126
+ The index is one direct file read, written at render time by `render-decisions.cjs` — no `.cjs` script runs here.
127
127
 
128
- **Step 2 — Agents apply the decisions:**
128
+ **Step 2 — Slice the index, then hand it on:**
129
129
 
130
- When `DECISIONS_CONTEXT` is not `(none)`, hand it only to the agents whose contract declares it. They follow `devflow:apply-decisions`: scan the index, identify plausibly-relevant entries, Read full entry bodies on demand, and cite verbatim IDs in their reasoning. A host that uses the index in its own thread says so in its own step.
130
+ When `DECISIONS_CONTEXT` is not `(none)`, hand it only to the agents whose contract declares it.
131
+
132
+ 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.
133
+
134
+ Those agents follow `devflow:apply-decisions`. A host that uses the index in its own thread says so in its own step.
131
135
 
132
136
  This produces a compact index of active ADR/PF entries written at render time — Deprecated/Superseded entries are already stripped. Pass `DECISIONS_CONTEXT` to the Triage agent in Phase 2 and to Code agents in Phase 4.
133
137
 
@@ -153,7 +157,7 @@ If `index.md` exists and contains at least one entry line, use it for relevance
153
157
 
154
158
  **Step 2 — Fallback: glob frontmatter (if `index.md` is absent or empty):**
155
159
 
156
- Glob `{worktree}/.devflow/features/*/KNOWLEDGE.md`. For each file found, read only its YAML frontmatter block (between the opening and closing `---` delimiters). The frontmatter fields `name`, `description`, and `directories` are the authoritative relevance surface — `index.md` is only a cache.
160
+ Glob `{worktree}/.devflow/features/*/KNOWLEDGE.md`. For each file found, read only its YAML frontmatter block (between the opening and closing `---` delimiters).
157
161
 
158
162
  **Step 3 — Pick relevant KBs:**
159
163
 
@@ -184,7 +188,7 @@ Headings: L5 Rules · L40 Overview · L62 Anti-Patterns · L118 Key Files
184
188
 
185
189
  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)`.
186
190
 
187
- **One git call, then direct reads — no `.cjs` script.** After resolving `{worktree}`, this step is 1 index read (or N frontmatter reads on fallback), plus one heading listing and one Rules read per selected KB, bounded by KB count.
191
+ **One git call, then direct reads — no `.cjs` script.**
188
192
 
189
193
  Pass `FEATURE_KNOWLEDGE` to the Triage agent in Phase 2.
190
194
 
@@ -210,7 +214,7 @@ Resolve this per worktree — unlike the evidence policy above, the settings lin
210
214
 
211
215
  > When the task touches regulated surface (data models, auth flows, logging/observability, payments, IaC, retention), invoke Skill(skill="devflow:compliance") and load references/{id}.md only for the ids in <ids> (none: generic controls only); never fabricate guidance for a framework you were not given.
212
216
 
213
- Set it per worktree, from that worktree's lens, and pass that worktree's `COMPLIANCE_DIRECTIVE` to each of its Code and Code-fix spawns, on a line of its own.
217
+ Set it per worktree, from that worktree's lens, and pass that worktree's `COMPLIANCE_DIRECTIVE` to each of its Code and Fix spawns, on a line of its own.
214
218
 
215
219
  **Mint `RESOLUTION_TS` once per run:** `date -u +%Y-%m-%dT%H:%M:%SZ`. Every worktree reuses it — the resolution comment's dedup marker is searched per PR, so one run key keeps a retry of this run deduplicated while the next /resolve on the same PR posts. Phase 5 writes it as the summary's `**Date**:` and Phase 9b-2 passes it, so the local file and the posted marker agree.
216
220
 
@@ -346,7 +350,7 @@ Collect from each Code agent:
346
350
  **Produces:** RESOLUTION_FILE (early write for compaction safety)
347
351
  **Requires:** TRIAGE_RESULTS, CODE_AGENT_RESULTS, TARGET_DIR, TARGET_DIR_REL, BRANCH_INFO, RESOLUTION_TS
348
352
 
349
- **Immediately write `resolution-summary.md`** to `{TARGET_DIR}` using the Write tool. Do this now — not in Phase 9 — while results are fresh in context. This ensures the record is persisted even if later phases (Simplify, Verification Gate, CI gate, Tech Debt) trigger context compaction.
353
+ **Immediately write `resolution-summary.md`** to `{TARGET_DIR}` using the Write tool. Do this now — not in Phase 9 — while results are fresh in context. This ensures the record is persisted even if later phases (Polish, Verification Gate, CI gate, Tech Debt) trigger context compaction.
350
354
 
351
355
  Set `Tracked` for FIX_SEPARATE and TECH_DEBT items to `(pending)` — to be backfilled after Phase 9 manage-debt (or `TRACEABILITY: DEGRADED ({reason})` if manage-debt degrades).
352
356
 
@@ -354,19 +358,19 @@ DUPLICATE issues are listed **only** in `## Duplicates` — never in `## Fixed I
354
358
 
355
359
  Use the template from the Output Artifact section below.
356
360
 
357
- ### Phase 6: Simplify
361
+ ### Phase 6: Polish
358
362
 
359
- **Produces:** SIMPLIFICATION_RESULT
363
+ **Produces:** POLISH_RESULT
360
364
  **Requires:** CODE_AGENT_RESULTS
361
365
 
362
- If any fixes were made, spawn Simplify agent to refine the changed code:
366
+ If any fixes were made, spawn Polish agent to refine the changed code:
363
367
 
364
368
  ```
365
- Agent(subagent_type="Simplify", run_in_background=false):
369
+ Agent(subagent_type="Polish", run_in_background=false):
366
370
  "TASK_DESCRIPTION: Issue resolution fixes
367
371
  WORKTREE_PATH: {worktree_path} (omit if cwd)
368
372
  FILES_CHANGED: {list of files modified by Code agents}
369
- Simplify and refine the fixes for clarity and consistency
373
+ Polish and refine the fixes for clarity and consistency
370
374
  Commit any improvements with a conventional-commit message."
371
375
  ```
372
376
 
@@ -392,9 +396,9 @@ Run build, typecheck, lint, test. Report pass/fail with failure details."
392
396
  1. Extract failure details from Validate agent output
393
397
  2. Increment `validation_retry_count`
394
398
  3. If `validation_retry_count <= 2`:
395
- - Spawn Code-fix agent with fix context:
399
+ - Spawn Fix agent with fix context:
396
400
  ```
397
- Agent(subagent_type="Code-fix"):
401
+ Agent(subagent_type="Fix"):
398
402
  "OPERATION: validation-fix
399
403
  TASK_ID: resolve-{batch-id}-valfix-{count}
400
404
  VALIDATION_FAILURES: {parsed failures from Validate agent}
@@ -412,7 +416,7 @@ Run build, typecheck, lint, test. Report pass/fail with failure details."
412
416
  Record `## Verification` outcome in resolution-summary.md (runs unconditionally after the validation loop exits):
413
417
  - Rewrite the `## Verification` section with | Command | Result | table + `Final gate: PASS | FAILED after N attempts`
414
418
 
415
- Push all commits to remote once (Code and Code-fix agents ran with PUSH: false — runs whether the gate PASSED or FAILED, so the branch is always visible before Phase 9 or CI runs):
419
+ Push all commits to remote once (Code and Fix agents ran with PUSH: false — runs whether the gate PASSED or FAILED, so the branch is always visible before Phase 9 or CI runs):
416
420
  ```bash
417
421
  git -C {worktree} push
418
422
  ```
@@ -450,7 +454,7 @@ Phase 7 has pushed already, so this is a no-op unless the head moved since. `exi
450
454
  3. **If NO_PR or NO_CI** → skip: "No PR/CI configured, skipping CI validation." Proceed to next phase.
451
455
  4. **If PENDING** and fewer than 3 waits have run → wait again (step 1). After the third wait → report "CI still running — verify manually before merging" and proceed.
452
456
  5. **If INDETERMINATE** and fewer than 3 waits have run → wait again (step 1). After the third wait → report "CI status unknown — verify manually before merging" and proceed.
453
- 6. **If FAILING** and fewer than 2 fixes have run → report the failing checks from the line. Spawn `Agent(subagent_type="Code-fix")` whose prompt opens with `OPERATION: ci-fix`, with `COMPLIANCE_DIRECTIVE` (when it is not empty), `CI_FAILURES`, `DECISIONS_CONTEXT` and `PUSH: false`; `CI_FAILURES` holds the failing-check names from the line and nothing else, because the Code-fix agent fetches the full names and reads the logs itself and this command reads none. After a fix, push with the command above and, if a wait remains, wait again (step 1); a failed push records `TRACEABILITY: DEGRADED (ci push failed)`, reports "CI status unknown — verify manually before merging" and stops waiting. After the second fix still FAILING → report the failing checks and proceed.
457
+ 6. **If FAILING** and fewer than 2 fixes have run → report the failing checks from the line. Spawn `Agent(subagent_type="Fix")` whose prompt opens with `OPERATION: ci-fix`, with `COMPLIANCE_DIRECTIVE` (when it is not empty), `CI_FAILURES`, `DECISIONS_CONTEXT` and `PUSH: false`; `CI_FAILURES` holds the failing-check names from the line and nothing else, because the Fix agent fetches the full names and reads the logs itself and this command reads none. After a fix, push with the command above and, if a wait remains, wait again (step 1); a failed push records `TRACEABILITY: DEGRADED (ci push failed)`, reports "CI status unknown — verify manually before merging" and stops waiting. After the second fix still FAILING → report the failing checks and proceed.
454
458
  7. **Budget**: at most 3 waits and 2 fixes in all, per worktree. When one is spent, report the current status and proceed.
455
459
  <!-- /PATTERN: ci-status-gate -->
456
460
 
@@ -560,19 +564,13 @@ Capture the Git agent's `**Publication**:` and `**Status**:` lines as `PR_COMMEN
560
564
 
561
565
  **Step 9b-3: Refresh the test-plan evidence**
562
566
 
563
- Run this step only when Step 9b-0 ran — the head moved — and its `EVIDENCE` line did not read `total:0` with `exceptions:none` (nothing to record); otherwise record `EVIDENCE_REFRESH` as `SKIPPED ({reason})`. Spawn Git agent:
567
+ Run this step only when Step 9b-0 ran — the head moved — and its `EVIDENCE` line did not read `total:0` with `exceptions:none` (nothing to record); otherwise record `EVIDENCE_REFRESH` as `SKIPPED ({reason})`. Run the script inline — it is the whole `update-pr-evidence` operation, with no Git agent spawn — through the Bash tool with `timeout: 180000`:
564
568
 
565
- ```
566
- Agent(subagent_type="Git"):
567
- "OPERATION: update-pr-evidence
568
- PR_NUMBER: {pr_number}
569
- EVIDENCE_FILE: {TARGET_DIR_REL}/evidence.md
570
- REVIEW_PUBLICATION: {9b-2's publication mode}
571
- WORKTREE_PATH: {worktree_path} (omit if cwd)
572
- Refresh the PR's test-plan block and post its evidence comment."
569
+ ```bash
570
+ cd {worktree} && node "$HOME/.devflow/scripts/verify-evidence.cjs" publish --pr {pr_number} --evidence "{TARGET_DIR_REL}/evidence.md" --publication {9b-2's publication mode}; echo "exit=$?"
573
571
  ```
574
572
 
575
- Omit the `EVIDENCE_FILE` line when Step 9b-0 appended no claim. `REVIEW_PUBLICATION` is the mode 9b-2 reported on its `**Publication**:` line — `FULL…` → `full`, `STUB…` → `stub`, `OFF…` → `off` — else `{REVIEW_PUBLICATION}` as resolved in Step 0d. Capture its `EVIDENCE` line and its `**Body**:` / `**Comment**:` line, or its `TRACEABILITY: DEGRADED ({reason})` line, as `EVIDENCE_REFRESH`. It never blocks.
573
+ Drop the `--evidence` pair when Step 9b-0 appended no claim. Run it only when `TARGET_DIR_REL` matches `^[A-Za-z0-9._/-]+$` — it carries the branch name, which a fork author picks — and `{pr_number}` is digits only; treat any other value as a failed run. The publication value is the mode 9b-2 reported on its `**Publication**:` line — `FULL…` → `full`, `STUB…` → `stub`, `OFF…` → `off` — else `{REVIEW_PUBLICATION}` as resolved in Step 0d. Capture its stdout as `EVIDENCE_REFRESH`: the `## PR Evidence` block's `EVIDENCE` line and its `**Body**:` / `**Comment**:` line, with any `TRACEABILITY: DEGRADED ({reason})` lines after them (exit 0), or the one line `TRACEABILITY: DEGRADED (evidence unavailable)` (exit 2). Empty stdout or any other exit is `TRACEABILITY: DEGRADED (evidence unavailable)`. It never blocks.
576
574
 
577
575
  ### Phase 9c: Merge Readiness (Report-only)
578
576
 
@@ -581,19 +579,17 @@ Omit the `EVIDENCE_FILE` line when Step 9b-0 appended no claim. `REVIEW_PUBLICAT
581
579
 
582
580
  Run this phase only when `REQUIRE_NON_AUTHOR_APPROVAL` is `true`; otherwise skip it and report it as SKIPPED.
583
581
 
584
- Spawn Git agent:
582
+ Run the script inline — it is the whole `check-merge-readiness` operation, with no Git agent spawn — through the Bash tool with `timeout: 180000`:
585
583
 
584
+ ```bash
585
+ cd {worktree} && node "$HOME/.devflow/scripts/verify-evidence.cjs" readiness --pr {pr_number} --require-non-author-approval true; echo "exit=$?"
586
586
  ```
587
- Agent(subagent_type="Git"):
588
- "OPERATION: check-merge-readiness
589
- PR_NUMBER: {pr_number}
590
- REQUIRE_NON_AUTHOR_APPROVAL: {REQUIRE_NON_AUTHOR_APPROVAL}
591
- WORKTREE_PATH: {worktree_path} (omit if cwd)"
592
- ```
587
+
588
+ Pass `--require-non-author-approval true`: `REQUIRE_NON_AUTHOR_APPROVAL` is `true` here, or this phase would not run. `{pr_number}` is digits only. Its stdout is the `## Merge Readiness` block (exit 0), or the same block with `**Status**: DEGRADED ({reason})` and a `TRACEABILITY: DEGRADED ({reason})` line after it (exit 2); empty stdout or any other exit is `TRACEABILITY: DEGRADED (readiness unavailable)`.
593
589
 
594
590
  Include merge readiness verdict (READY / NOT_READY / DEGRADED) and its `- Test plan:` detail line in Phase 10 report. Never block on this result — report-only.
595
591
 
596
- If Git agent returns `TRACEABILITY: DEGRADED`: warn, proceed to Phase 10.
592
+ If the script prints a `TRACEABILITY: DEGRADED` line: warn, proceed to Phase 10.
597
593
 
598
594
  ### Phase 10: Report
599
595
 
@@ -682,21 +678,17 @@ FEATURE_SLUG: {slug derived from primary changed directory, kebab-case}
682
678
  FEATURE_NAME: {human-readable name}
683
679
  DIRECTORIES: {list of primary directories touched by this workflow}
684
680
  FILES_CHANGED: {list of files changed}
685
- DECISIONS_CONTEXT: {DECISIONS_CONTEXT if available, else (none)}
681
+ DECISIONS_CONTEXT: {the slice for these directories, else (none)}
686
682
 
687
683
  Write the knowledge base to:
688
684
  {worktree}/.devflow/features/{slug}/KNOWLEDGE.md
689
685
 
690
- Then update the index cache by performing a read-modify-write on:
686
+ Then update the index cache:
691
687
  {worktree}/.devflow/features/index.md
692
688
 
693
689
  Index line format: `- **{slug}** — {areas} — {Use-when description}` — at most 300 characters, the description at most 220; reword a longer one, never cut it.
694
690
 
695
- If the line for this slug already exists in index.md, replace it. If it does not exist, append it. If index.md does not exist, create it with just this line.
696
-
697
- The frontmatter in KNOWLEDGE.md is the source of truth — index.md is only a cache. Write the two files directly — no intermediate result JSON files, no external scripts.
698
-
699
- After writing, commit the two files to the current worktree branch yourself by running git via your Bash tool (do not use a script). Stage ONLY .devflow/features/index.md and .devflow/features/{slug}/KNOWLEDGE.md, then commit just those paths with a docs(knowledge): message. Do NOT push, do NOT force, do NOT stage anything else. Follow your Commit Protocol — it is non-blocking, so if any git step fails, report KB_COMMIT and finish normally."
691
+ Then commit the two files as your Commit Protocol directs."
700
692
  ```
701
693
 
702
694
  **Step 4 — Surface an uncommitted knowledge base:**
@@ -711,44 +703,24 @@ When the Knowledge agent reports `KB_COMMIT: skipped (detached HEAD)`, the files
711
703
  /resolve (orchestrator - spawns agents only)
712
704
  │
713
705
  ├─ Phase 0: Worktree Discovery & Pre-flight
714
- │ ├─ Step 0a: git worktree list → filter resolvable
715
- │ ├─ Step 0b: Git agent (validate-branch) per worktree [parallel] ← + DIFF_FILES
716
- │ ├─ Step 0c: Target latest review directory per worktree
717
- │ └─ Step 0d: Load project decisions → DECISIONS_CONTEXT + EVIDENCE_POLICY + REVIEW_PUBLICATION
718
- │
719
706
  ├─ Phase 1: Parse issues from TARGET_DIR + extract confidence %
720
- │
721
707
  ├─ Phase 1b: Fetch external threads (evidence policy required)
722
- │ └─ Git agent (fetch-review-threads) → THREAD_MAP
723
- │
724
708
  ├─ Phase 2: Global Triage [Triage agent, opus, single agent]
725
- │ └─ ALL issues → verdict ledger by disposition (incl. DUPLICATE with duplicate_of)
726
- │
727
709
  ├─ Phase 3: Batch FIX_NOW issues (skip if empty; DUPLICATE issues never dispatched)
728
- │ └─ same-file sequential, distinct-file parallel, max 5/batch
729
- │
730
710
  ├─ Phase 4: Fix [Code agent × N, OPERATION: issue-fix, PUSH: false]
731
- │ └─ Returns Verification block per batch
732
- │
733
711
  ├─ Phase 5: Write resolution-summary.md (compaction safety; Tracked = "(pending)" or "(pending — TRACEABILITY: DEGRADED)" if manage-debt degrades)
734
- │
735
- ├─ Phase 6: Simplify [Simplify agent]
736
- │
737
- ├─ Phase 7: Verification Gate [Validate agent, haiku] + push + Code-fix agent validation-fix loop ≤2
738
- │
712
+ ├─ Phase 6: Polish [Polish agent]
713
+ ├─ Phase 7: Verification Gate [Validate agent, haiku] + push + Fix agent validation-fix loop ≤2
739
714
  ├─ Phase 8: CI Status Gate (conditional — skipped if no fixes or verification FAILED)
740
- │ └─ push, then ci-wait.cjs (inline, one wait ≤ 570 s) → Code-fix agent on FAILING (3 waits + 2 fixes per worktree)
741
- │
742
715
  ├─ Phase 9: Git agent (manage-debt) — FIX_SEPARATE + TECH_DEBT → backfill Tracked={ISSUE_REF} (or TRACEABILITY: DEGRADED on failure)
743
- │ SEQUENTIAL across worktrees
744
716
  │
745
717
  ├─ Phase 9b: Thread resolution + resolution comment
746
718
  │ ├─ Step 9b-0: verify-evidence.cjs --stale-out → ≤1 Test agent on the stale TPs (wrapped) — only after this run's push
747
719
  │ ├─ Step 9b-1: Git agent (resolve-review-threads) — evidence policy required
748
720
  │ ├─ Step 9b-2: Git agent (post-resolution-summary, REVIEW_PUBLICATION) — always-on
749
- │ └─ Step 9b-3: Git agent (update-pr-evidence) — only when the head moved
721
+ │ └─ Step 9b-3: verify-evidence.cjs publish (inline, no Git spawn) — only when the head moved
750
722
  │
751
- ├─ Phase 9c: Git agent (check-merge-readiness) — non-author approval required, report-only
723
+ ├─ Phase 9c: verify-evidence.cjs readiness (inline, no Git spawn) — non-author approval required, report-only
752
724
  │
753
725
  └─ Phase 10: Display results (resolution-summary.md written in Phase 5)
754
726
  ```
@@ -762,21 +734,11 @@ When the Knowledge agent reports `KB_COMMIT: skipped (detached HEAD)`, the files
762
734
  | Fix attempt fails | Revert changes, mark BLOCKED, continue others |
763
735
  | Issue dependencies | Sequential chain, skip dependents if predecessor blocked |
764
736
  | No actionable issues | Report "No issues to resolve" |
765
- | Incomplete review directory (no review-summary.md) | Skip — resolve only targets complete reviews |
766
737
  | Latest review already resolved | Check bug-analysis fallback (Step 0c-5b); if also absent, skip worktree and suggest `/code-review` or `/bug-analysis` |
767
- | Legacy flat layout (no subdirectories) | Read flat *.md files directly (backwards compatible) |
768
738
  | `--review {timestamp}` in multi-worktree mode | Not supported — use `--path` + `--review` to target specific worktree + review |
769
- | Worktree pre-flight fails | Report failure, continue with other worktrees |
770
- | Empty FIX_NOW list | Skip Phases 3-4/6-8; still write full summary + run manage-debt if FIX_SEPARATE/TECH_DEBT exist |
771
- | ESCALATED security issues | Surfaced in ## Escalations + display callout; never routed to manage-debt |
772
- | DUPLICATE verdict without duplicate_of, or chained to another DUPLICATE | Treated as Triage failure — same retry-then-abort as a vanished id |
773
- | DUPLICATE issues in THREAD_MAP | Map ext-{N} to primary's verdict/verification status for thread reply |
774
- | Verification Gate FAILED after 2 attempts | Recorded as FAILED in ## Verification + blocking callout; CI gate skipped; proceed to Phase 9 (manage-debt) then Phase 10 (display) |
775
739
  | gh/GitHub absent | manage-debt degrades (`TRACEABILITY: DEGRADED ({reason})`); Tracked stays `(pending — TRACEABILITY: DEGRADED ({reason}))` — recorded, not dropped |
776
740
  | `EVIDENCE_POLICY` is `standard` | Phases 1b and 9b-step-1 are skipped; post-resolution-summary (Phase 9b step 2) still runs if a PR is known |
777
741
  | `REQUIRE_NON_AUTHOR_APPROVAL` is `false` | Phase 9c is skipped and reported as SKIPPED |
778
- | THREAD_MAP empty or DEGRADED | Phase 9b-1 skipped; resolution comment (Phase 9b-2) still posted if PR known |
779
- | No PR exists for post-resolution-summary | Git agent returns TRACEABILITY: DEGRADED; resolution-summary.md already on disk — not a blocker |
780
742
  | Public repo (`auto` mode) | Git agent probes visibility, posts counts-only STUB comment; full resolution report stays local |
781
743
  | `reviewPublication: off` | Git agent skips posting the resolution comment (OFF) — except that, only when `EVIDENCE_POLICY` is `required`, Step 0d passes `stub` and a counts-only STUB comment posts |
782
744
  | Fork PR this run cannot push to (no maintainer edits, no push access of its own) | validate-branch emits `TRACEABILITY: DEGRADED (cannot push to fork)` → `fork_no_push`: Phase 7 skips the push, Phase 8 is skipped, 9b-1 records FIXED threads as DEGRADED instead of citing unpushed commits; 9b-2 still posts the resolution comment; the head did not move, so 9b-0 and 9b-3 are skipped |
@@ -787,14 +749,8 @@ When the Knowledge agent reports `KB_COMMIT: skipped (detached HEAD)`, the files
787
749
 
788
750
  1. **Orchestration only** - Command spawns agents, doesn't do git/resolve work itself
789
751
  2. **No agent grades its own homework** - Triage agent validates, Code agents fix, Validate agent verifies
790
- 3. **Global triage first** - Single Triage agent sees all issues for cross-issue consistency; no issue may vanish
791
- 4. **Git agent for git work** - All git operations go through Git agent
792
- 5. **Parallel execution** - Distinct-file Code agent batches run in parallel; same-file batches sequential
793
- 6. **Honest reporting** - Verification failure is recorded and displayed, never silenced
794
- 7. **Complete tracking** - Every issue gets exactly one verdict in the ledger
795
- 8. **Latest review by default** - Only process the most recent complete review
796
- 9. **Auto-discover worktrees** - One command handles all resolvable branches
797
- 10. **Traceability-aware** - Policy-gated ops (thread fetch/resolve, merge readiness) are skipped cleanly when the evidence policy does not ask for them; resolution comment (Phase 9b-2) is always-on; test-plan evidence is re-verified (≤1 Test agent) and refreshed only when this run moved the head (Steps 9b-0, 9b-3)
752
+ 3. **Git agent for git work** - All git operations go through Git agent; the CI wait, the evidence refresh and the merge-readiness check are inline scripts (plumbing, no model work)
753
+ 4. **Traceability-aware** - Policy-gated ops (thread fetch/resolve, merge readiness) are skipped cleanly when the evidence policy does not ask for them; resolution comment (Phase 9b-2) is always-on; test-plan evidence is re-verified (≤1 Test agent) and refreshed only when this run moved the head (Steps 9b-0, 9b-3)
798
754
 
799
755
  ## Output Artifact
800
756