devflow-kit 3.5.0 → 3.7.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 (146) hide show
  1. package/CHANGELOG.md +178 -1
  2. package/README.md +10 -6
  3. package/dist/agents/code.md +7 -11
  4. package/dist/agents/{diagnose.md → debug.md} +4 -4
  5. package/dist/agents/{code-fix.md → fix.md} +7 -8
  6. package/dist/agents/{scrutinize.md → harden.md} +6 -6
  7. package/dist/agents/{code-edit.md → refactor.md} +8 -9
  8. package/dist/agents/review.md +2 -0
  9. package/dist/cli/agents-view/render.js +1 -1
  10. package/dist/cli/commands/gates.js +276 -0
  11. package/dist/cli/commands/init-seed.js +9 -1
  12. package/dist/cli/commands/init.js +34 -11
  13. package/dist/cli/commands/learning.js +12 -12
  14. package/dist/cli/commands/legacy-hooks.js +1 -1
  15. package/dist/cli/commands/memory.js +18 -0
  16. package/dist/cli/commands/uninstall.js +111 -5
  17. package/dist/cli.js +2 -0
  18. package/dist/commands/bug-analysis.md +21 -17
  19. package/dist/commands/code-review.md +65 -66
  20. package/dist/commands/debug.md +17 -17
  21. package/dist/commands/dynamic-build.md +104 -116
  22. package/dist/commands/dynamic-plan.md +13 -11
  23. package/dist/commands/dynamic-profile.md +9 -7
  24. package/dist/commands/dynamic-tickets.md +13 -11
  25. package/dist/commands/explore.md +15 -15
  26. package/dist/commands/implement.md +80 -154
  27. package/dist/commands/plan.md +34 -66
  28. package/dist/commands/release.md +11 -7
  29. package/dist/commands/research.md +14 -10
  30. package/dist/commands/resolve.md +44 -88
  31. package/dist/commands/self-review.md +44 -44
  32. package/dist/core/agent-models.js +47 -11
  33. package/dist/core/{learning-tuning-config.js → curate-tuning-config.js} +14 -14
  34. package/dist/core/echo-value.js +42 -0
  35. package/dist/core/evidence-policy.js +17 -5
  36. package/dist/core/gate-level.js +213 -0
  37. package/dist/core/learning-queue-cleanup.js +1 -1
  38. package/dist/core/manifest.js +26 -10
  39. package/dist/core/migrations.js +63 -44
  40. package/dist/core/model-discovery.js +7 -1
  41. package/dist/core/plugins.js +14 -12
  42. package/dist/core/project-paths.js +3 -3
  43. package/dist/core/tracker.js +5 -33
  44. package/dist/hud/codex-usage.js +247 -0
  45. package/dist/hud/components/codex-quota.js +37 -0
  46. package/dist/hud/components/usage-quota.js +1 -1
  47. package/dist/hud/config.js +1 -0
  48. package/dist/hud/index.js +16 -3
  49. package/dist/hud/render.js +3 -1
  50. package/dist/learning-off/agents/code.md +7 -11
  51. package/dist/learning-off/agents/{diagnose.md → debug.md} +4 -4
  52. package/dist/learning-off/agents/{code-fix.md → fix.md} +7 -8
  53. package/dist/learning-off/agents/{scrutinize.md → harden.md} +6 -6
  54. package/dist/learning-off/agents/{code-edit.md → refactor.md} +8 -9
  55. package/dist/learning-off/agents/review.md +2 -0
  56. package/dist/learning-off/commands/bug-analysis.md +9 -9
  57. package/dist/learning-off/commands/code-review.md +54 -59
  58. package/dist/learning-off/commands/debug.md +6 -10
  59. package/dist/learning-off/commands/dynamic-build.md +98 -112
  60. package/dist/learning-off/commands/dynamic-plan.md +5 -5
  61. package/dist/learning-off/commands/dynamic-profile.md +1 -1
  62. package/dist/learning-off/commands/dynamic-tickets.md +5 -5
  63. package/dist/learning-off/commands/explore.md +4 -8
  64. package/dist/learning-off/commands/implement.md +68 -146
  65. package/dist/learning-off/commands/plan.md +23 -58
  66. package/dist/learning-off/commands/release.md +4 -2
  67. package/dist/learning-off/commands/research.md +2 -2
  68. package/dist/learning-off/commands/resolve.md +33 -81
  69. package/dist/learning-off/commands/self-review.md +32 -36
  70. package/dist/skills/git/references/pr/check-merge-readiness.md +2 -0
  71. package/dist/skills/git/references/pr/update-pr-evidence.md +4 -6
  72. package/dist/skills/git/references/tracker/github/ensure-pr-ready.md +7 -9
  73. package/dist/skills/git/references/tracker/jira/ensure-pr-ready.md +7 -15
  74. package/dist/skills/git/references/tracker/linear/ensure-pr-ready.md +7 -15
  75. package/dist/targets/claude-code/installer.js +117 -84
  76. package/dist/targets/claude-code/learning-install.js +15 -3
  77. package/dist/targets/claude-code/tracker-servers.js +1 -1
  78. package/package.json +1 -1
  79. package/src/assets/agents/_partials/_code.mds +7 -8
  80. package/src/assets/agents/code.mds +4 -7
  81. package/src/assets/agents/{learning.md → curate.md} +8 -10
  82. package/src/assets/agents/{diagnose.mds → debug.mds} +4 -4
  83. package/src/assets/agents/evaluate.md +4 -4
  84. package/src/assets/agents/{code-fix.mds → fix.mds} +5 -5
  85. package/src/assets/agents/{scrutinize.mds → harden.mds} +6 -6
  86. package/src/assets/agents/{simplify.md → polish.md} +4 -4
  87. package/src/assets/agents/{code-edit.mds → refactor.mds} +6 -6
  88. package/src/assets/agents/review.mds +2 -0
  89. package/src/assets/agents/synthesize.md +2 -2
  90. package/src/assets/agents/test.md +2 -2
  91. package/src/assets/commands/_partials/_compliance.mds +1 -1
  92. package/src/assets/commands/_partials/_decisions.mds +26 -6
  93. package/src/assets/commands/_partials/_engine.mds +15 -15
  94. package/src/assets/commands/_partials/_evidence_policy.mds +0 -17
  95. package/src/assets/commands/_partials/_knowledge.mds +14 -9
  96. package/src/assets/commands/_partials/_preamble.mds +4 -2
  97. package/src/assets/commands/_partials/_roster.mds +4 -4
  98. package/src/assets/commands/_partials/_settings.mds +2 -2
  99. package/src/assets/commands/_partials/_wave.mds +10 -17
  100. package/src/assets/commands/bug-analysis.mds +7 -7
  101. package/src/assets/commands/code-review.mds +51 -56
  102. package/src/assets/commands/debug.mds +2 -2
  103. package/src/assets/commands/dynamic-build.mds +67 -74
  104. package/src/assets/commands/implement.mds +65 -127
  105. package/src/assets/commands/plan.mds +21 -61
  106. package/src/assets/commands/release.mds +5 -1
  107. package/src/assets/commands/resolve.mds +28 -76
  108. package/src/assets/commands/self-review.mds +27 -27
  109. package/src/assets/mds/git/_ops_steps.mds +3 -3
  110. package/src/assets/mds/git/_pr.mds +6 -6
  111. package/src/assets/mds/tracker/_common.mds +23 -12
  112. package/src/assets/mds/tracker/_github.mds +2 -9
  113. package/src/assets/mds/tracker/_jira.mds +2 -15
  114. package/src/assets/mds/tracker/_linear.mds +2 -15
  115. package/src/assets/scripts/ci-wait.cjs +22 -4
  116. package/src/assets/scripts/claude-md-audit.cjs +66 -51
  117. package/src/assets/scripts/hooks/assets/orchestrator-charter.md +4 -3
  118. package/src/assets/scripts/hooks/background-memory-update +404 -95
  119. package/src/assets/scripts/hooks/capture-prompt +1 -1
  120. package/src/assets/scripts/hooks/capture-question +1 -1
  121. package/src/assets/scripts/hooks/capture-turn +1 -1
  122. package/src/assets/scripts/hooks/json-helper.cjs +13 -2
  123. package/src/assets/scripts/hooks/json-parse +18 -3
  124. package/src/assets/scripts/hooks/lib/learning-store.cjs +1 -1
  125. package/src/assets/scripts/hooks/lib/project-paths.cjs +4 -4
  126. package/src/assets/scripts/hooks/memory-permission +358 -0
  127. package/src/assets/scripts/hooks/preamble +1 -1
  128. package/src/assets/scripts/hooks/session-start-context +60 -47
  129. package/src/assets/scripts/hooks/session-start-memory +26 -5
  130. package/src/assets/scripts/lib/project-config.cjs +19 -4
  131. package/src/assets/scripts/resolve-settings.cjs +200 -32
  132. package/src/assets/scripts/verify-evidence.cjs +726 -9
  133. package/src/assets/skills/agent-references/SKILL.md +14 -6
  134. package/src/assets/skills/agent-references/references/commands/code-review-levels.md +19 -0
  135. package/src/assets/skills/agent-references/references/commands/implement-evidence-asks.md +35 -0
  136. package/src/assets/skills/agent-references/references/commands/implement-revalidate.md +15 -0
  137. package/src/assets/skills/agent-references/references/commands/plan-levels.md +40 -0
  138. package/src/assets/skills/agent-references/references/synthesize/bug-analysis.md +1 -1
  139. package/src/assets/skills/agent-references/references/synthesize/planning.md +9 -22
  140. package/src/assets/skills/agent-references/references/synthesize/review.md +11 -11
  141. package/src/assets/skills/apply-decisions/SKILL.md +6 -4
  142. package/src/assets/skills/docs-framework/SKILL.md +3 -3
  143. package/src/assets/skills/qa/SKILL.md +1 -1
  144. package/src/assets/skills/quality-gates/SKILL.md +7 -7
  145. package/src/assets/skills/quality-gates/references/report-template.md +7 -7
  146. /package/src/assets/skills/agent-references/references/{learning → curate}/maintain.md +0 -0
@@ -28,12 +28,12 @@ Run a comprehensive code review of the current branch by spawning parallel revie
28
28
  - **Exactly one listed:** load neither the skill nor the reference — that worktree is the only candidate, and Step 0c's Git agent validates its branch
29
29
  2. **If `--path` flag provided:** use only that worktree, skip discovery
30
30
  **`--path` validation**: Before proceeding, verify the path exists as a directory and appears in `git worktree list` output. If not: report error and stop.
31
- 3. **If only 1 reviewable worktree** (the common case): proceed as single-worktree flow — zero behavior change
31
+ 3. **If only 1 reviewable worktree**: proceed as single-worktree flow — zero behavior change
32
32
  4. **If multiple reviewable worktrees:** report "Found N worktrees with reviewable branches: {list with paths and branches}" and proceed with multi-worktree flow
33
33
 
34
- #### Step 0b: Resolve the compliance lens
34
+ #### Step 0b: Resolve the compliance lens and gate level
35
35
 
36
- **Produces:** COMPLIANCE_ACTIVE, COMPLIANCE_FRAMEWORKS
36
+ **Produces:** COMPLIANCE_ACTIVE, COMPLIANCE_FRAMEWORKS, GATE_LEVEL
37
37
 
38
38
  **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 when the run has one worktree:
39
39
 
@@ -41,16 +41,16 @@ Run a comprehensive code review of the current branch by spawning parallel revie
41
41
  node "$HOME/.devflow/scripts/resolve-settings.cjs" "{root}" 2>/dev/null; echo "exit=$?"
42
42
  ```
43
43
 
44
- 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> LEARNING=<on|off> KNOWLEDGE=<on|off>` — 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=on LEARNING=on KNOWLEDGE=off` instead.
44
+ 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> LEARNING=<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=on LEARNING=on KNOWLEDGE=off GATE_LEVEL=full` instead.
45
45
 
46
- The accepted line is the only source of these values: the script alone folds the committed `.devflow/project.json`, the personal `.devflow/config.json` and the machine manifest.
46
+ The accepted line is the only source of these values.
47
47
 
48
48
  **Resolve the compliance lens** for each worktree root, from its settings line — the line resolved above for that root, by the settings block when this run has not yet resolved it (every framework reference is installed on every machine, so no file check decides it).
49
49
 
50
50
  **Set the compliance lens** from that line: `COMPLIANCE_FRAMEWORKS` is the settings line's `COMPLIANCE` with `generic` written `none`: `off`, `none`, or the framework ids the machine and this repository declare.
51
51
 
52
52
  `COMPLIANCE_ACTIVE` is `true` unless `COMPLIANCE_FRAMEWORKS` is `off`.
53
- Keep each worktree's values for every downstream phase of that worktree.
53
+ Keep each worktree's values for every downstream phase.
54
54
 
55
55
  #### Step 0b-ii: Resolve the evidence policy
56
56
 
@@ -100,7 +100,7 @@ Validate branch, commit if needed, push, create PR if needed.
100
100
  Return: branch, base_branch, branch-slug, PR#"
101
101
  ```
102
102
 
103
- In multi-worktree mode, spawn all pre-flight agents **in a single message** (parallel).
103
+ In multi-worktree mode, spawn all pre-flight agents **in a single message**.
104
104
 
105
105
  **If BLOCKED:** In single-worktree mode, stop and report. In multi-worktree mode, report the failure but continue with other worktrees.
106
106
 
@@ -140,7 +140,7 @@ For each worktree, perform a single pass over timestamped directories:
140
140
  2. Iterate once: accumulate CYCLE_NUMBER count for each directory containing `resolution-summary.md`; capture the first (most-recent) such directory as PRIOR_DIR.
141
141
  3. If CYCLE_NUMBER = 0: set PRIOR_RESOLUTIONS=(none), CYCLE_NUMBER=1, proceed.
142
142
  4. Otherwise: set CYCLE_NUMBER = count + 1. Read `{PRIOR_DIR}/resolution-summary.md` as PRIOR_RESOLUTIONS.
143
- 5. If `--full`: still load PRIOR_RESOLUTIONS (valuable for Review agent cross-cycle awareness).
143
+ 5. If `--full`: still load PRIOR_RESOLUTIONS.
144
144
 
145
145
  #### Step 0e-ii: Convergence Assessment
146
146
 
@@ -186,7 +186,7 @@ Note: `auto` is NOT fail-open — under `auto`, the Git agent probes the reposit
186
186
  ### Phase 1: Analyze Changed Files
187
187
 
188
188
  **Produces:** REVIEW_FOCUS_LIST, DIFF_CLASS, DIFF_FILES
189
- **Requires:** DIFF_RANGE, REVIEW_DIR, COMPLIANCE_ACTIVE (from Step 0b)
189
+ **Requires:** DIFF_RANGE, REVIEW_DIR, COMPLIANCE_ACTIVE, GATE_LEVEL (from Step 0b)
190
190
 
191
191
  Per worktree, in order. Each `git` command here writes to a file and prints nothing.
192
192
 
@@ -202,7 +202,7 @@ git -C "{WORKTREE_PATH}" diff --name-only --no-renames {DIFF_RANGE} > "{REVIEW_D
202
202
  wc -l < "{REVIEW_DIR}/paths.txt"
203
203
  ```
204
204
 
205
- Read `paths.txt` once when the count is about 40 or fewer, and in ranges of about 40 lines (Read with offset and limit) when it is more. `--no-renames` lists a moved file under its old path and its new one, so a move cannot take a file out of its own class.
205
+ Read `paths.txt` once when the count is about 40 or fewer, and in ranges of about 40 lines (Read with offset and limit) when it is more.
206
206
 
207
207
  Set `DIFF_CLASS` by these rules, in order; the first that decides wins:
208
208
 
@@ -219,7 +219,7 @@ Each reduced class runs only its focus set, every member reading `diff.patch`:
219
219
  - `tests-only`: testing, reliability, consistency, security
220
220
  - `lockfile-only`: dependencies, security
221
221
 
222
- A mixed non-code diff runs the union of the sets of the classes it holds. Language and conditional triggers inside a reduced class are suppressed: they add no focus, and Step 1.2 applies to the `code` class only.
222
+ A mixed non-code diff runs the union of the sets of the classes it holds. Language and conditional triggers inside a reduced class are suppressed.
223
223
 
224
224
  #### Step 1.2: Choose the focuses
225
225
 
@@ -243,13 +243,27 @@ When `DIFF_CLASS` is `code`, read the file types from the paths in `paths.txt` t
243
243
  | Docs or significant code | documentation |
244
244
  | COMPLIANCE_ACTIVE AND diff touches regulated surface | compliance |
245
245
 
246
- If `COMPLIANCE_ACTIVE` AND the diff touches regulated surface (data models, auth flows, logging/observability, payments, IaC, retention): add `compliance` to REVIEW_FOCUS_LIST for this worktree.
246
+ If `COMPLIANCE_ACTIVE` AND the diff touches regulated surface (data models, auth flows, logging/observability, payments, IaC, retention): on a `code` diff, add `compliance`.
247
247
 
248
248
  **Language focus stamp.** The eight language focuses — `typescript`, `react`, `accessibility`, `ui-design`, `go`, `java`, `python`, `rust` — ship with optional plugins, and the installer stamps the ones installed on this machine onto this line, rewriting it on every install and on `uninstall --plugin`:
249
249
 
250
250
  Installed language focuses: (none)
251
251
 
252
- A language focus is spawned only when its file-type condition above fires AND its name appears in that stamped line. A focus missing from the line is never spawned, even when its trigger fires. The eight core focuses are unconditional and are never stamp-gated.
252
+ A language focus is spawned only when its file-type condition above fires AND its name appears in that stamped line. A focus missing from the line is never spawned, even when its trigger fires. On a `code` diff, REVIEW_FOCUS_LIST starts with the eight core focuses. Step 1.2b may narrow them; they are never stamp-gated.
253
+
254
+ #### Step 1.2b: Narrow by gate level
255
+
256
+ **Produces:** REVIEW_FOCUS_LIST, GATE_LEVEL
257
+ **Requires:** REVIEW_FOCUS_LIST, DIFF_CLASS, CHANGED_PATHS, GATE_LEVEL
258
+
259
+ **Gate level.** Narrow REVIEW_FOCUS_LIST, for every class, by this worktree's `GATE_LEVEL`. `full` keeps it and reads nothing.
260
+
261
+ At `standard` or `lean`, once per run, run `d="${CLAUDE_CONFIG_DIR:-}"; case "$d" in /*) ;; *) d="$HOME/.claude" ;; esac; printf '%s\n' "$d"` in Bash and Read `<that directory>/skills/devflow:agent-references/references/commands/code-review-levels.md` with the Read tool.
262
+
263
+ - Apply each class's row to that class's own set, then take the union of the results. A row only removes focuses.
264
+ - If the Read fails, or a row is missing or malformed, set `GATE_LEVEL` to `full` for every worktree of this run and say `level reference unreadable: full sets applied`.
265
+ - Security runs at every level and in every class.
266
+ - Compliance keeps the trigger above at every level.
253
267
 
254
268
  #### Step 1.3: Write the diff files
255
269
 
@@ -288,19 +302,19 @@ The core, database, dependencies, documentation and compliance focuses, and ever
288
302
 
289
303
  When the settings line says `LEARNING=off`, set `DECISIONS_CONTEXT` to `(none)` and skip this step, locating no ledger and reading no index.
290
304
 
291
- 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`):
305
+ 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`):
292
306
 
293
307
  ```bash
294
308
  git -C "{start}" rev-parse --path-format=absolute --show-toplevel --git-common-dir
295
309
  ```
296
310
 
297
- 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:
311
+ 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:
298
312
 
299
313
  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.
300
314
  2. **The toplevel** — line 1, or on an older git the line after the echoed flag.
301
315
  3. **The start directory itself** — when the command failed or printed no absolute toplevel (outside a git repository).
302
316
 
303
- This is the rule the learning hooks apply (D-LEDGER-MAIN-WORKTREE, D-PROMPT-ROOT), so you read the index the Learning agent writes.
317
+ This is the rule the learning hooks apply, so you read the index the Curate agent writes.
304
318
 
305
319
  **Step 1 — Read the pre-rendered index:**
306
320
 
@@ -309,13 +323,17 @@ Attempt to read `{ledger}/.devflow/learning/index.md`.
309
323
  - If the file exists and contains non-empty content: use that content as `DECISIONS_CONTEXT`.
310
324
  - If the file is absent or empty: set `DECISIONS_CONTEXT` to `(none)`.
311
325
 
312
- 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.
326
+ The index is one direct file read, written at render time by `render-decisions.cjs` — no `.cjs` script runs here.
327
+
328
+ **Step 2 — Slice the index, then hand it on:**
313
329
 
314
- **Step 2 — Agents apply the decisions:**
330
+ When `DECISIONS_CONTEXT` is not `(none)`, hand it only to the agents whose contract declares it.
315
331
 
316
- 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.
332
+ 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.
317
333
 
318
- This produces a compact index of active ADR/PF entries. Pass `DECISIONS_CONTEXT` to all Review agents. Review agents use `devflow:apply-decisions` to Read full entry bodies on demand.
334
+ Those agents follow `devflow:apply-decisions`. A host that uses the index in its own thread says so in its own step.
335
+
336
+ This produces a compact index of active ADR/PF entries. Pass `DECISIONS_CONTEXT` to all Review agents as one shared slice, cut over the diff's files. Review agents use `devflow:apply-decisions` to Read full entry bodies on demand.
319
337
 
320
338
  ### Load Feature Knowledge
321
339
 
@@ -339,7 +357,7 @@ If `index.md` exists and contains at least one entry line, use it for relevance
339
357
 
340
358
  **Step 2 — Fallback: glob frontmatter (if `index.md` is absent or empty):**
341
359
 
342
- 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.
360
+ Glob `{worktree}/.devflow/features/*/KNOWLEDGE.md`. For each file found, read only its YAML frontmatter block (between the opening and closing `---` delimiters).
343
361
 
344
362
  **Step 3 — Pick relevant KBs:**
345
363
 
@@ -370,7 +388,7 @@ Headings: L5 Rules · L40 Overview · L62 Anti-Patterns · L118 Key Files
370
388
 
371
389
  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)`.
372
390
 
373
- **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.
391
+ **One git call, then direct reads — no `.cjs` script.**
374
392
 
375
393
  Pass `FEATURE_KNOWLEDGE` to all Review agents alongside `DECISIONS_CONTEXT`.
376
394
 
@@ -379,9 +397,9 @@ Pass `FEATURE_KNOWLEDGE` to all Review agents alongside `DECISIONS_CONTEXT`.
379
397
  **Produces:** REVIEW_FOCUS_OUTPUTS
380
398
  **Requires:** DIFF_RANGE, REVIEW_DIR, TIMESTAMP, DECISIONS_CONTEXT, FEATURE_KNOWLEDGE, PR_DESCRIPTION, PRIOR_RESOLUTIONS, REVIEW_FOCUS_LIST, DIFF_CLASS, DIFF_FILES
381
399
 
382
- Spawn Review agents **in a single message**, for the focus set `DIFF_CLASS` selects (max 20 per worktree):
400
+ Spawn Review agents **in a single message**, one per focus in REVIEW_FOCUS_LIST (max 20 per worktree):
383
401
 
384
- - `code`: the 8 core reviews on the full `diff.patch`, plus the language and conditional focuses Phase 1 added.
402
+ - `code`: the 8 core reviews on the full `diff.patch` (lean keeps 3), plus the language and conditional focuses Phase 1 added.
385
403
  - `docs-only`, `tests-only`, `lockfile-only`: only the reduced set Phase 1 names, each reading `diff.patch`; a mixed non-code diff runs the union. No language or conditional focus is spawned, whatever its trigger.
386
404
 
387
405
  | Focus | Runs | Pattern Skill | DIFF_FILE |
@@ -407,7 +425,7 @@ Spawn Review agents **in a single message**, for the focus set `DIFF_CLASS` sele
407
425
  | documentation | conditional | devflow:documentation | diff.patch |
408
426
  | compliance | diff-driven | devflow:compliance | diff.patch |
409
427
 
410
- Review agent count: `code` runs 8 core, +1-12 added by Phase 1 (max 20 total per worktree); a reduced class or a mix runs 2-6.
428
+ Review agent count: at `full`, `code` runs 8 core +1-12; `standard` runs up to 2 fewer; lean `code` runs 3-4; a reduced class or a mix runs 2-6.
411
429
 
412
430
  **Set the compliance focus directive** from `COMPLIANCE_FRAMEWORKS`. `COMPLIANCE_FOCUS_DIRECTIVE` is this one line, with `<ids>` replaced by the value of `COMPLIANCE_FRAMEWORKS`; only the compliance focus's spawn carries it:
413
431
 
@@ -433,16 +451,16 @@ Follow devflow:apply-feature-knowledge for FEATURE_KNOWLEDGE — feature-specifi
433
451
  IMPORTANT: Write report to {worktree_path}/.devflow/docs/reviews/{branch-slug}/{timestamp}/{focus}.md using Write tool"
434
452
  ```
435
453
 
436
- In multi-worktree mode, process worktrees **sequentially** (one worktree at a time). Complete Phases 1-4 for each worktree before starting the next. This prevents agent overload — spawning 8-20 Review agents per worktree across multiple worktrees simultaneously overwhelms the system.
454
+ In multi-worktree mode, process worktrees **sequentially**: complete Phases 1-4 for one worktree before starting the next, so Review spawns never pile up.
437
455
 
438
456
  ### Phase 3: Synthesis → Review Comment (Sequential)
439
457
 
440
458
  **Produces:** REVIEW_SUMMARY, PR_COMMENT
441
- **Requires:** REVIEW_FOCUS_OUTPUTS, REVIEW_DIR, PR_INFO
459
+ **Requires:** REVIEW_FOCUS_OUTPUTS, REVIEW_DIR, PR_INFO, GATE_LEVEL, REVIEW_FOCUS_LIST
442
460
 
443
461
  **WAIT** for Phase 2. For each worktree, run steps 3a and 3b in sequence:
444
462
 
445
- **Step 3a — Synthesize agent** per worktree (wait for completion before 3b):
463
+ **Step 3a — Synthesize agent** per worktree:
446
464
  ```
447
465
  Agent(subagent_type="Synthesize", run_in_background=false):
448
466
  "Mode: review
@@ -450,6 +468,8 @@ WORKTREE_PATH: {worktree_path} (omit if cwd)
450
468
  REVIEW_BASE_DIR: {worktree_path}/.devflow/docs/reviews/{branch-slug}/{timestamp}
451
469
  TIMESTAMP: {timestamp}
452
470
  CYCLE_NUMBER: {cycle_number}
471
+ GATE_LEVEL: {GATE_LEVEL}
472
+ FOCUSES: {REVIEW_FOCUS_LIST}
453
473
  PRIOR_RESOLUTIONS: <prior-resolution-summary>{prior_resolutions}</prior-resolution-summary>
454
474
  Include Convergence Status section in review-summary.md.
455
475
  Aggregate findings, determine merge recommendation.
@@ -482,8 +502,6 @@ Per worktree, after successful completion:
482
502
  - Publication status: FULL (private repo) | FULL (config override) | STUB (public repository) | OFF (publication disabled by config) | STUB (visibility undeterminable) | STUB (evidence policy) (from Git agent)
483
503
  - Artifact paths
484
504
 
485
- In multi-worktree mode, report results per worktree.
486
-
487
505
  ## Architecture
488
506
 
489
507
  ```
@@ -491,29 +509,27 @@ In multi-worktree mode, report results per worktree.
491
509
  │
492
510
  ├─ Phase 0: Worktree Discovery & Pre-flight
493
511
  │ ├─ Step 0a: git worktree list → filter reviewable
494
- │ ├─ Step 0b: Resolve the compliance lens
512
+ │ ├─ Step 0b: Resolve the compliance lens and gate level
495
513
  │ ├─ Step 0c: Git agent (ensure-pr-ready) per worktree [parallel]
496
514
  │ ├─ Step 0d: Incremental detection + timestamp setup per worktree
497
515
  │ ├─ Step 0e-i: Load prior resolution-summary.md
498
- │ ├─ Step 0e-ii: Convergence assessment (warn if FP ratio > 70%)
516
+ │ ├─ Step 0e-ii: Convergence assessment (warn only)
499
517
  │ └─ Step 0f: Resolve REVIEW_PUBLICATION per worktree (publication gate)
500
518
  │
501
519
  ├─ Per worktree (SEQUENTIAL — one worktree at a time):
502
520
  │ │
503
521
  │ ├─ Phase 1: Analyze changed files
504
522
  │ │ ├─ Classify the diff (paths.txt → DIFF_CLASS)
505
- │ │ ├─ Choose the focuses (code class: file types + the language stamp)
523
+ │ │ ├─ Choose the focuses (code: file types + the language stamp; all: the gate level)
506
524
  │ │ └─ Write diff.patch and diff-{focus}.patch, by redirect
507
525
  │ │
508
- │ ├─ Phase 2: Reviews (PARALLEL within worktree)
509
- │ │ ├─ code: Review agents security, architecture, performance, complexity,
510
- │ │ │ consistency, regression, testing, reliability (diff.patch)
511
- │ │ ├─ code: + language (diff-{focus}.patch) and conditional Review agents
526
+ │ ├─ Phase 2: Reviews (PARALLEL within worktree), one per REVIEW_FOCUS_LIST focus
527
+ │ │ ├─ code: core (diff.patch), language (diff-{focus}.patch), conditional
512
528
  │ │ └─ docs-only / tests-only / lockfile-only: the reduced set (diff.patch)
513
529
  │ │
514
530
  │ ├─ Phase 3: Synthesis → Review Comment (SEQUENTIAL within worktree)
515
531
  │ │ ├─ Step 3a: Synthesize agent (mode: review, writes review-summary.md)
516
- │ │ └─ Step 3b: Git agent (post-review-summary, D7 marker-dedup, REVIEW_PUBLICATION)
532
+ │ │ └─ Step 3b: Git agent (post-review-summary)
517
533
  │ │
518
534
  │ └─ Phase 4: Write .last-review-head + display results
519
535
  ```
@@ -522,44 +538,27 @@ In multi-worktree mode, report results per worktree.
522
538
 
523
539
  | Case | Handling |
524
540
  |------|----------|
525
- | No new commits since last review | Skip review, report: "No new commits since last review. Use --full for a full re-review." |
526
- | Rebase invalidates `.last-review-head` SHA | `git cat-file -t` check fails → fallback to full diff |
527
- | Same-minute review collision | `mkdir` fails → retry with seconds appended (`YYYY-MM-DD_HHMMSS`) |
528
- | Worktree in detached HEAD | Filtered out (no branch name → not reviewable) |
529
- | Worktree mid-rebase or mid-merge | Filtered out by status check |
530
- | Two worktrees on same branch | Deduplicate by branch — review once, use first worktree's path |
531
- | Worktree on protected branch | Filtered out (not reviewable) |
532
- | Worktree pre-flight fails | Report failure, continue with other worktrees |
533
- | `--full` in multi-worktree mode | Applies to all worktrees (global modifier) |
534
- | Many worktrees (5+) | Report count and proceed — user manages their worktree count |
541
+ | `--full` in multi-worktree mode | Applies to all worktrees (global modifier). It sets the diff range, never the gate level |
535
542
  | Review comment already posted | Git agent matches its own marker on the `{cycle, timestamp}` pair → skip silently (D7); a re-review in the same cycle (different timestamp) posts its own comment. The marker's format belongs to the operation; this caller passes the pair and never restates the literal |
536
- | First review (no prior resolution) | PRIOR_RESOLUTIONS=(none), no convergence check |
537
- | fp_ratio denominator = 0 | fp_ratio = 0, no warning |
538
- | `--full` flag | Bypass incremental detection (Step 0d), still load PRIOR_RESOLUTIONS for cross-cycle awareness |
539
- | Parsing failure on resolution-summary.md | fp_ratio = 0, convergence tracking degraded (see Step 0e-ii) |
540
- | Concurrent sessions | Advisory only, each session computes independently |
541
- | Docs-only diff | `docs-only`: documentation, consistency, security on `diff.patch`; no language or conditional focus |
542
- | Tests-only diff | `tests-only`: testing, reliability, consistency, security on `diff.patch`; no language or conditional focus |
543
- | Lockfile-only diff | `lockfile-only`: dependencies, security on `diff.patch` |
544
- | Mixed non-code diff (docs with tests, tests with a lockfile) | The union of the matching sets, on `diff.patch` |
545
- | A path matching no class pattern, or an empty path list | `code` (fail-safe): the 8 core focuses on the full diff |
546
- | A file moved across classes | `--no-renames` lists the old and the new path, so a code path makes the diff `code` |
547
- | Path listing above about 40 lines | The count is printed; `paths.txt` is read in ranges of about 40 lines |
543
+ | Docs-only diff | Its Step 1.1 set, narrowed by level |
544
+ | Tests-only diff | Its Step 1.1 set, narrowed by level |
545
+ | Lockfile-only diff | Its Step 1.1 set, narrowed by level |
546
+ | Mixed non-code diff | The union of the matching sets |
547
+ | A path matching no class pattern, or an empty path list | `code` (fail-safe) |
548
+ | A file moved across classes | `--no-renames` lists both paths, so a code path makes the diff `code` |
549
+ | Path listing above about 40 lines | Read in ranges (Step 1.1) |
548
550
  | Language files changed, plugin not installed | The focus is absent from the stamped line: not spawned |
549
551
  | Public repo (`auto` mode) | Git agent probes visibility, posts counts-only STUB comment; full report stays local |
550
552
  | `reviewPublication: off` | Git agent skips posting the review comment (OFF) — except that, only when `EVIDENCE_POLICY` is `required`, Step 0f passes `stub` and a counts-only STUB comment posts |
551
553
 
552
554
  ## Backwards Compatibility
553
555
 
554
- - **Single worktree**: Auto-discovery finds only one worktree → proceeds exactly as before. Zero behavior change.
555
- - **Legacy flat layout**: If `{worktree}/.devflow/docs/reviews/{branch-slug}/` contains flat `*.md` files (no timestamped subdirectories), new runs create timestamped subdirectories. Old flat files remain untouched.
556
+ - **Gate level**: `full` runs the sets named here; the default `standard` and `lean` narrow them. `devflow gates --set full` keeps them.
556
557
 
557
558
  ## Principles
558
559
 
559
560
  1. **Orchestration only** - Command spawns agents, doesn't do git/review work itself. The exceptions are the read-only Phase 0 probes (`git worktree list`, `git -C ... branch --show-current`, `git -C ... cat-file -t`), the bounded Phase 1 path listing (a redirect into `paths.txt`, a `wc -l` count and ranged reads) and the redirect-only patch writes (`diff.patch`, `diff-{focus}.patch`). Redirect-only writes print nothing, so no diff content reaches this thread
560
561
  2. **Parallel, not background** - Multiple agents in one message, but `run_in_background=false` so phases complete before proceeding
561
562
  3. **Git agent for git work** - All git operations go through Git agent, except the exceptions named in Principle 1; redirect-only writes print nothing
562
- 4. **Clear ownership** - Each agent owns its output completely
563
- 5. **Honest reporting** - Display agent outputs directly
564
- 6. **Incremental by default** - Only review new changes unless `--full` specified
565
- 7. **Auto-discover worktrees** - One command handles all reviewable branches
563
+ 4. **Honest reporting** - Display agent outputs directly
564
+ 5. **Incremental by default** - Only review new changes unless `--full` specified
@@ -38,9 +38,9 @@ $ARGUMENTS
38
38
  node "$HOME/.devflow/scripts/resolve-settings.cjs" "{root}" 2>/dev/null; echo "exit=$?"
39
39
  ```
40
40
 
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> LEARNING=<on|off> KNOWLEDGE=<on|off>` — 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=on LEARNING=on KNOWLEDGE=off` instead.
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> LEARNING=<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=on LEARNING=on KNOWLEDGE=off GATE_LEVEL=full` instead.
42
42
 
43
- The accepted line is the only source of these values: the script alone folds the committed `.devflow/project.json`, the personal `.devflow/config.json` and the machine manifest.
43
+ The accepted line is the only source of these values.
44
44
 
45
45
  From the same line: `COMPLIANCE_FRAMEWORKS` is the settings line's `COMPLIANCE` with `generic` written `none`: `off`, `none`, or the framework ids the machine and this repository declare.
46
46
 
@@ -54,19 +54,19 @@ Phase 7 passes `COMPLIANCE_DIRECTIVE` to the Code agent that implements the fix,
54
54
 
55
55
  When the settings line says `LEARNING=off`, set `DECISIONS_CONTEXT` to `(none)` and skip this step, locating no ledger and reading no index.
56
56
 
57
- 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`):
57
+ 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`):
58
58
 
59
59
  ```bash
60
60
  git -C "{start}" rev-parse --path-format=absolute --show-toplevel --git-common-dir
61
61
  ```
62
62
 
63
- 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:
63
+ 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:
64
64
 
65
65
  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.
66
66
  2. **The toplevel** — line 1, or on an older git the line after the echoed flag.
67
67
  3. **The start directory itself** — when the command failed or printed no absolute toplevel (outside a git repository).
68
68
 
69
- This is the rule the learning hooks apply (D-LEDGER-MAIN-WORKTREE, D-PROMPT-ROOT), so you read the index the Learning agent writes.
69
+ This is the rule the learning hooks apply, so you read the index the Curate agent writes.
70
70
 
71
71
  **Step 1 — Read the pre-rendered index:**
72
72
 
@@ -75,11 +75,15 @@ Attempt to read `{ledger}/.devflow/learning/index.md`.
75
75
  - If the file exists and contains non-empty content: use that content as `DECISIONS_CONTEXT`.
76
76
  - If the file is absent or empty: set `DECISIONS_CONTEXT` to `(none)`.
77
77
 
78
- 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.
78
+ The index is one direct file read, written at render time by `render-decisions.cjs` — no `.cjs` script runs here.
79
79
 
80
- **Step 2 — Agents apply the decisions:**
80
+ **Step 2 — Slice the index, then hand it on:**
81
81
 
82
- 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.
82
+ When `DECISIONS_CONTEXT` is not `(none)`, hand it only to the agents whose contract declares it.
83
+
84
+ 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.
85
+
86
+ Those agents follow `devflow:apply-decisions`. A host that uses the index in its own thread says so in its own step.
83
87
 
84
88
  The orchestrator uses `DECISIONS_CONTEXT` locally when generating hypotheses (Phase 2) — prior pitfalls and decisions can suggest specific root causes to investigate. Follow `devflow:apply-decisions` to Read full entry bodies on demand. **Do NOT pass `DECISIONS_CONTEXT` to Explore investigators** — decisions context stays in the orchestrator; investigators examine code directly.
85
89
 
@@ -234,7 +238,7 @@ Produce the final report:
234
238
 
235
239
  Ask user via AskUserQuestion: "Want me to implement this fix?"
236
240
 
237
- - **YES** → implement the fix through the Code agent, never in this thread, then spawn `Agent(subagent_type="Simplify")` on the changed files. /debug loads no feature knowledge, so the fix gets none:
241
+ - **YES** → implement the fix through the Code agent, never in this thread, then spawn `Agent(subagent_type="Polish")` on the changed files. /debug loads no feature knowledge, so the fix gets none:
238
242
 
239
243
  ```
240
244
  Agent(subagent_type="Code"):
@@ -282,21 +286,17 @@ FEATURE_SLUG: {slug derived from primary changed directory, kebab-case}
282
286
  FEATURE_NAME: {human-readable name}
283
287
  DIRECTORIES: {list of primary directories touched by this workflow}
284
288
  FILES_CHANGED: {list of files changed}
285
- DECISIONS_CONTEXT: {DECISIONS_CONTEXT if available, else (none)}
289
+ DECISIONS_CONTEXT: {the slice for these directories, else (none)}
286
290
 
287
291
  Write the knowledge base to:
288
292
  {worktree}/.devflow/features/{slug}/KNOWLEDGE.md
289
293
 
290
- Then update the index cache by performing a read-modify-write on:
294
+ Then update the index cache:
291
295
  {worktree}/.devflow/features/index.md
292
296
 
293
297
  Index line format: `- **{slug}** — {areas} — {Use-when description}` — at most 300 characters, the description at most 220; reword a longer one, never cut it.
294
298
 
295
- 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.
296
-
297
- 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.
298
-
299
- 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."
299
+ Then commit the two files as your Commit Protocol directs."
300
300
  ```
301
301
 
302
302
  **Step 4 — Surface an uncommitted knowledge base:**
@@ -328,7 +328,7 @@ When the Knowledge agent reports `KB_COMMIT: skipped (detached HEAD)`, the files
328
328
  ├─ Phase 6: Root cause report with confidence level
329
329
  │
330
330
  ├─ Phase 7: Offer Fix
331
- │ └─ AskUserQuestion → Code agent (fix) + Simplify agent, or done
331
+ │ └─ AskUserQuestion → Code agent (fix) + Polish agent, or done
332
332
  │
333
333
  └─ Feature Knowledge Write-Back (Conditional)
334
334
  └─ Knowledge agent (if investigation surfaced durable cross-cutting knowledge)