devflow-kit 3.6.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 (80) hide show
  1. package/CHANGELOG.md +80 -1
  2. package/README.md +6 -2
  3. package/dist/agents/code.md +7 -11
  4. package/dist/agents/fix.md +5 -6
  5. package/dist/agents/refactor.md +5 -6
  6. package/dist/agents/review.md +2 -0
  7. package/dist/cli/commands/gates.js +276 -0
  8. package/dist/cli/commands/init-seed.js +9 -1
  9. package/dist/cli/commands/init.js +31 -8
  10. package/dist/cli/commands/memory.js +18 -0
  11. package/dist/cli.js +2 -0
  12. package/dist/commands/bug-analysis.md +2 -2
  13. package/dist/commands/code-review.md +52 -44
  14. package/dist/commands/debug.md +2 -2
  15. package/dist/commands/dynamic-build.md +53 -61
  16. package/dist/commands/dynamic-plan.md +2 -2
  17. package/dist/commands/dynamic-profile.md +2 -2
  18. package/dist/commands/dynamic-tickets.md +2 -2
  19. package/dist/commands/explore.md +2 -2
  20. package/dist/commands/implement.md +26 -31
  21. package/dist/commands/plan.md +15 -25
  22. package/dist/commands/release.md +2 -2
  23. package/dist/commands/research.md +2 -2
  24. package/dist/commands/resolve.md +2 -2
  25. package/dist/commands/self-review.md +2 -2
  26. package/dist/core/echo-value.js +42 -0
  27. package/dist/core/evidence-policy.js +17 -5
  28. package/dist/core/gate-level.js +213 -0
  29. package/dist/core/manifest.js +26 -10
  30. package/dist/core/model-discovery.js +7 -1
  31. package/dist/core/tracker.js +5 -33
  32. package/dist/learning-off/agents/code.md +7 -11
  33. package/dist/learning-off/agents/fix.md +5 -6
  34. package/dist/learning-off/agents/refactor.md +5 -6
  35. package/dist/learning-off/agents/review.md +2 -0
  36. package/dist/learning-off/commands/code-review.md +52 -44
  37. package/dist/learning-off/commands/debug.md +2 -2
  38. package/dist/learning-off/commands/dynamic-build.md +53 -61
  39. package/dist/learning-off/commands/explore.md +2 -2
  40. package/dist/learning-off/commands/implement.md +26 -31
  41. package/dist/learning-off/commands/plan.md +15 -25
  42. package/dist/learning-off/commands/resolve.md +2 -2
  43. package/dist/learning-off/commands/self-review.md +2 -2
  44. package/dist/skills/git/references/tracker/github/ensure-pr-ready.md +7 -9
  45. package/dist/skills/git/references/tracker/jira/ensure-pr-ready.md +7 -15
  46. package/dist/skills/git/references/tracker/linear/ensure-pr-ready.md +7 -15
  47. package/dist/targets/claude-code/learning-install.js +15 -3
  48. package/package.json +1 -1
  49. package/src/assets/agents/_partials/_code.mds +5 -6
  50. package/src/assets/agents/code.mds +2 -5
  51. package/src/assets/agents/curate.md +4 -6
  52. package/src/assets/agents/review.mds +2 -0
  53. package/src/assets/agents/synthesize.md +2 -2
  54. package/src/assets/commands/_partials/_settings.mds +2 -2
  55. package/src/assets/commands/_partials/_wave.mds +10 -17
  56. package/src/assets/commands/code-review.mds +50 -42
  57. package/src/assets/commands/dynamic-build.mds +41 -42
  58. package/src/assets/commands/implement.mds +24 -29
  59. package/src/assets/commands/plan.mds +14 -24
  60. package/src/assets/mds/git/_ops_steps.mds +3 -3
  61. package/src/assets/mds/tracker/_common.mds +23 -12
  62. package/src/assets/mds/tracker/_github.mds +2 -9
  63. package/src/assets/mds/tracker/_jira.mds +2 -15
  64. package/src/assets/mds/tracker/_linear.mds +2 -15
  65. package/src/assets/scripts/ci-wait.cjs +22 -4
  66. package/src/assets/scripts/claude-md-audit.cjs +66 -51
  67. package/src/assets/scripts/hooks/background-memory-update +404 -95
  68. package/src/assets/scripts/hooks/json-helper.cjs +11 -0
  69. package/src/assets/scripts/hooks/json-parse +18 -3
  70. package/src/assets/scripts/hooks/memory-permission +358 -0
  71. package/src/assets/scripts/hooks/session-start-context +2 -2
  72. package/src/assets/scripts/hooks/session-start-memory +26 -5
  73. package/src/assets/scripts/lib/project-config.cjs +19 -4
  74. package/src/assets/scripts/resolve-settings.cjs +200 -32
  75. package/src/assets/skills/agent-references/SKILL.md +6 -2
  76. package/src/assets/skills/agent-references/references/commands/code-review-levels.md +19 -0
  77. package/src/assets/skills/agent-references/references/commands/implement-revalidate.md +2 -2
  78. package/src/assets/skills/agent-references/references/commands/plan-levels.md +40 -0
  79. package/src/assets/skills/agent-references/references/synthesize/planning.md +9 -22
  80. package/src/assets/skills/agent-references/references/synthesize/review.md +11 -11
@@ -63,7 +63,7 @@ You receive from orchestrator:
63
63
  - Cross-reference changed files against EXECUTION_PLAN to identify what's relevant to your task
64
64
  - Read those relevant files to understand interfaces, types, naming conventions, error handling, and testing patterns established by prior work
65
65
  - If PRIOR_PHASE_SUMMARY is provided, use it to validate your understanding — actual code is authoritative, summaries are supplementary
66
- - If `HANDOFF_FILE` is provided, read only the `## Phase {N} Implementation Summary` section of the phase immediately before yours — list its `##` headings with `command grep -n '^## ' "$HANDOFF_FILE"`, then Read that range with `offset` and `limit` — never the whole file. Cross-reference against actual code — code is authoritative, handoff is supplementary.
66
+ - If `HANDOFF_FILE` is provided, read only the `## Phase {N} Implementation Summary` section of the phase immediately before yours — list its `##` headings with `command grep -n '^## ' "$HANDOFF_FILE"`, then Read that range with `offset` and `limit` — never the whole file.
67
67
 
68
68
  2. **Implement the plan**: Work through execution steps systematically, creating and modifying files. Follow existing patterns. Type everything. Use Result types if codebase uses them.
69
69
 
@@ -89,7 +89,6 @@ When `OPERATION: issue-fix`, you are fixing pre-classified issues assigned FIX_N
89
89
  - **Standard scope**: Fix directly following existing patterns
90
90
  - **Careful scope**: systematic protocol — understand (50+ lines context, callers/consumers) → plan → write failing regression test → implement → verify tests pass → commit
91
91
  3. **Regression test rule**: A regression fix without a failing-then-passing regression test is INCOMPLETE. Report BLOCKED rather than commit an unverified fix.
92
- 4. **Self-verification scope**: Run compile + the fix's regression test only. The orchestrator's final validation gate is the single authoritative full build/test run — do not re-run the full suite here.
93
92
 
94
93
  **Return report** (a Return block in the spawn replaces this shape):
95
94
  - Status: COMPLETE | PARTIAL | BLOCKED
@@ -116,9 +115,7 @@ When `OPERATION: issue-fix`, you are fixing pre-classified issues assigned FIX_N
116
115
  - {Decision with rationale}
117
116
 
118
117
  ### Integration Points for Next Phase
119
- - {Interfaces to implement against}
120
- - {Functions to call}
121
- - {Types to import}
118
+ - `path:line` of each interface, function or type the next phase builds on
122
119
  ```
123
120
 
124
121
  ## Running commands
@@ -136,11 +133,11 @@ Run builds, typechecks, lints and tests in the foreground, each with an explicit
136
133
 
137
134
  ## Principles
138
135
 
139
- 1. **Work on feature branch** - All operations happen on the current feature branch
140
- 2. **Orient, then match patterns** - Before writing code, orient on branch state and find similar implementations; match their conventions, don't invent new ones
141
- 3. **Be decisive** - Make confident implementation choices. Don't present alternatives or ask permission for tactical decisions
142
- 4. **Small, focused changes** - Don't scope creep beyond the plan
143
- 5. **Fail honestly** - If blocked, report clearly with what was completed
136
+ 1. **Read once** - Never re-read an unchanged file. For a file over 400 lines, or a second look, `grep -n` first, then Read only that range (`offset`, `limit`)
137
+ 2. **Small, focused changes** - Don't scope creep beyond the plan
138
+ 3. **Fail honestly** - If blocked, report clearly with what was completed
139
+
140
+ - Never print a large file whole; page it with offset and limit, and cap any output you print. Before printing search matches, list or count them.
144
141
 
145
142
  ## Output
146
143
 
@@ -180,4 +177,3 @@ Report cap: final message at most about 1,500 tokens; longer material goes to a
180
177
  - Switch branches during implementation
181
178
  - Push to branches other than your feature branch
182
179
  - Merge PRs (orchestrator handles this)
183
- - Trust handoff summaries without reading actual code
@@ -114,11 +114,11 @@ Run builds, typechecks, lints and tests in the foreground, each with an explicit
114
114
 
115
115
  ## Principles
116
116
 
117
- 1. **Work on feature branch** - All operations happen on the current feature branch
118
- 2. **Orient, then match patterns** - Before writing code, orient on branch state and find similar implementations; match their conventions, don't invent new ones
119
- 3. **Be decisive** - Make confident implementation choices. Don't present alternatives or ask permission for tactical decisions
120
- 4. **Small, focused changes** - Don't scope creep beyond the plan
121
- 5. **Fail honestly** - If blocked, report clearly with what was completed
117
+ 1. **Read once** - Never re-read an unchanged file. For a file over 400 lines, or a second look, `grep -n` first, then Read only that range (`offset`, `limit`)
118
+ 2. **Small, focused changes** - Don't scope creep beyond the plan
119
+ 3. **Fail honestly** - If blocked, report clearly with what was completed
120
+
121
+ - Never print a large file whole; page it with offset and limit, and cap any output you print. Before printing search matches, list or count them.
122
122
 
123
123
  ## Output
124
124
 
@@ -158,4 +158,3 @@ Report cap: final message at most about 1,500 tokens; longer material goes to a
158
158
  - Switch branches during implementation
159
159
  - Push to branches other than your feature branch
160
160
  - Merge PRs (orchestrator handles this)
161
- - Trust handoff summaries without reading actual code
@@ -82,11 +82,11 @@ Run builds, typechecks, lints and tests in the foreground, each with an explicit
82
82
 
83
83
  ## Principles
84
84
 
85
- 1. **Work on feature branch** - All operations happen on the current feature branch
86
- 2. **Orient, then match patterns** - Before writing code, orient on branch state and find similar implementations; match their conventions, don't invent new ones
87
- 3. **Be decisive** - Make confident implementation choices. Don't present alternatives or ask permission for tactical decisions
88
- 4. **Small, focused changes** - Don't scope creep beyond the plan
89
- 5. **Fail honestly** - If blocked, report clearly with what was completed
85
+ 1. **Read once** - Never re-read an unchanged file. For a file over 400 lines, or a second look, `grep -n` first, then Read only that range (`offset`, `limit`)
86
+ 2. **Small, focused changes** - Don't scope creep beyond the plan
87
+ 3. **Fail honestly** - If blocked, report clearly with what was completed
88
+
89
+ - Never print a large file whole; page it with offset and limit, and cap any output you print. Before printing search matches, list or count them.
90
90
 
91
91
  ## Output
92
92
 
@@ -126,4 +126,3 @@ Report cap: final message at most about 1,500 tokens; longer material goes to a
126
126
  - Switch branches during implementation
127
127
  - Push to branches other than your feature branch
128
128
  - Merge PRs (orchestrator handles this)
129
- - Trust handoff summaries without reading actual code
@@ -222,3 +222,5 @@ use the same prefix so values are not double-masked.
222
222
  | java | If .java files changed |
223
223
  | python | If .py files changed |
224
224
  | rust | If .rs files changed |
225
+
226
+ The gate level (`GATE_LEVEL`, `/code-review` Step 1.2b) removes focuses from this table at `standard` and `lean`.
@@ -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
 
@@ -346,9 +360,9 @@ Pass `FEATURE_KNOWLEDGE` to all Review agents.
346
360
  **Produces:** REVIEW_FOCUS_OUTPUTS
347
361
  **Requires:** DIFF_RANGE, REVIEW_DIR, TIMESTAMP, FEATURE_KNOWLEDGE, PR_DESCRIPTION, PRIOR_RESOLUTIONS, REVIEW_FOCUS_LIST, DIFF_CLASS, DIFF_FILES
348
362
 
349
- Spawn Review agents **in a single message**, for the focus set `DIFF_CLASS` selects (max 20 per worktree):
363
+ Spawn Review agents **in a single message**, one per focus in REVIEW_FOCUS_LIST (max 20 per worktree):
350
364
 
351
- - `code`: the 8 core reviews on the full `diff.patch`, plus the language and conditional focuses Phase 1 added.
365
+ - `code`: the 8 core reviews on the full `diff.patch` (lean keeps 3), plus the language and conditional focuses Phase 1 added.
352
366
  - `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.
353
367
 
354
368
  | Focus | Runs | Pattern Skill | DIFF_FILE |
@@ -374,7 +388,7 @@ Spawn Review agents **in a single message**, for the focus set `DIFF_CLASS` sele
374
388
  | documentation | conditional | devflow:documentation | diff.patch |
375
389
  | compliance | diff-driven | devflow:compliance | diff.patch |
376
390
 
377
- 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.
391
+ 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.
378
392
 
379
393
  **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:
380
394
 
@@ -398,16 +412,16 @@ Follow devflow:apply-feature-knowledge for FEATURE_KNOWLEDGE — feature-specifi
398
412
  IMPORTANT: Write report to {worktree_path}/.devflow/docs/reviews/{branch-slug}/{timestamp}/{focus}.md using Write tool"
399
413
  ```
400
414
 
401
- 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.
415
+ In multi-worktree mode, process worktrees **sequentially**: complete Phases 1-4 for one worktree before starting the next, so Review spawns never pile up.
402
416
 
403
417
  ### Phase 3: Synthesis → Review Comment (Sequential)
404
418
 
405
419
  **Produces:** REVIEW_SUMMARY, PR_COMMENT
406
- **Requires:** REVIEW_FOCUS_OUTPUTS, REVIEW_DIR, PR_INFO
420
+ **Requires:** REVIEW_FOCUS_OUTPUTS, REVIEW_DIR, PR_INFO, GATE_LEVEL, REVIEW_FOCUS_LIST
407
421
 
408
422
  **WAIT** for Phase 2. For each worktree, run steps 3a and 3b in sequence:
409
423
 
410
- **Step 3a — Synthesize agent** per worktree (wait for completion before 3b):
424
+ **Step 3a — Synthesize agent** per worktree:
411
425
  ```
412
426
  Agent(subagent_type="Synthesize", run_in_background=false):
413
427
  "Mode: review
@@ -415,6 +429,8 @@ WORKTREE_PATH: {worktree_path} (omit if cwd)
415
429
  REVIEW_BASE_DIR: {worktree_path}/.devflow/docs/reviews/{branch-slug}/{timestamp}
416
430
  TIMESTAMP: {timestamp}
417
431
  CYCLE_NUMBER: {cycle_number}
432
+ GATE_LEVEL: {GATE_LEVEL}
433
+ FOCUSES: {REVIEW_FOCUS_LIST}
418
434
  PRIOR_RESOLUTIONS: <prior-resolution-summary>{prior_resolutions}</prior-resolution-summary>
419
435
  Include Convergence Status section in review-summary.md.
420
436
  Aggregate findings, determine merge recommendation.
@@ -447,8 +463,6 @@ Per worktree, after successful completion:
447
463
  - 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)
448
464
  - Artifact paths
449
465
 
450
- In multi-worktree mode, report results per worktree.
451
-
452
466
  ## Architecture
453
467
 
454
468
  ```
@@ -456,29 +470,27 @@ In multi-worktree mode, report results per worktree.
456
470
  │
457
471
  ├─ Phase 0: Worktree Discovery & Pre-flight
458
472
  │ ├─ Step 0a: git worktree list → filter reviewable
459
- │ ├─ Step 0b: Resolve the compliance lens
473
+ │ ├─ Step 0b: Resolve the compliance lens and gate level
460
474
  │ ├─ Step 0c: Git agent (ensure-pr-ready) per worktree [parallel]
461
475
  │ ├─ Step 0d: Incremental detection + timestamp setup per worktree
462
476
  │ ├─ Step 0e-i: Load prior resolution-summary.md
463
- │ ├─ Step 0e-ii: Convergence assessment (warn if FP ratio > 70%)
477
+ │ ├─ Step 0e-ii: Convergence assessment (warn only)
464
478
  │ └─ Step 0f: Resolve REVIEW_PUBLICATION per worktree (publication gate)
465
479
  │
466
480
  ├─ Per worktree (SEQUENTIAL — one worktree at a time):
467
481
  │ │
468
482
  │ ├─ Phase 1: Analyze changed files
469
483
  │ │ ├─ Classify the diff (paths.txt → DIFF_CLASS)
470
- │ │ ├─ Choose the focuses (code class: file types + the language stamp)
484
+ │ │ ├─ Choose the focuses (code: file types + the language stamp; all: the gate level)
471
485
  │ │ └─ Write diff.patch and diff-{focus}.patch, by redirect
472
486
  │ │
473
- │ ├─ Phase 2: Reviews (PARALLEL within worktree)
474
- │ │ ├─ code: Review agents security, architecture, performance, complexity,
475
- │ │ │ consistency, regression, testing, reliability (diff.patch)
476
- │ │ ├─ code: + language (diff-{focus}.patch) and conditional Review agents
487
+ │ ├─ Phase 2: Reviews (PARALLEL within worktree), one per REVIEW_FOCUS_LIST focus
488
+ │ │ ├─ code: core (diff.patch), language (diff-{focus}.patch), conditional
477
489
  │ │ └─ docs-only / tests-only / lockfile-only: the reduced set (diff.patch)
478
490
  │ │
479
491
  │ ├─ Phase 3: Synthesis → Review Comment (SEQUENTIAL within worktree)
480
492
  │ │ ├─ Step 3a: Synthesize agent (mode: review, writes review-summary.md)
481
- │ │ └─ Step 3b: Git agent (post-review-summary, D7 marker-dedup, REVIEW_PUBLICATION)
493
+ │ │ └─ Step 3b: Git agent (post-review-summary)
482
494
  │ │
483
495
  │ └─ Phase 4: Write .last-review-head + display results
484
496
  ```
@@ -487,31 +499,27 @@ In multi-worktree mode, report results per worktree.
487
499
 
488
500
  | Case | Handling |
489
501
  |------|----------|
490
- | `--full` in multi-worktree mode | Applies to all worktrees (global modifier) |
502
+ | `--full` in multi-worktree mode | Applies to all worktrees (global modifier). It sets the diff range, never the gate level |
491
503
  | 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 |
492
- | Concurrent sessions | Advisory only, each session computes independently |
493
- | Docs-only diff | `docs-only`: documentation, consistency, security on `diff.patch`; no language or conditional focus |
494
- | Tests-only diff | `tests-only`: testing, reliability, consistency, security on `diff.patch`; no language or conditional focus |
495
- | Lockfile-only diff | `lockfile-only`: dependencies, security on `diff.patch` |
496
- | Mixed non-code diff (docs with tests, tests with a lockfile) | The union of the matching sets, on `diff.patch` |
497
- | A path matching no class pattern, or an empty path list | `code` (fail-safe): the 8 core focuses on the full diff |
498
- | A file moved across classes | `--no-renames` lists the old and the new path, so a code path makes the diff `code` |
499
- | Path listing above about 40 lines | The count is printed; `paths.txt` is read in ranges of about 40 lines |
504
+ | Docs-only diff | Its Step 1.1 set, narrowed by level |
505
+ | Tests-only diff | Its Step 1.1 set, narrowed by level |
506
+ | Lockfile-only diff | Its Step 1.1 set, narrowed by level |
507
+ | Mixed non-code diff | The union of the matching sets |
508
+ | A path matching no class pattern, or an empty path list | `code` (fail-safe) |
509
+ | A file moved across classes | `--no-renames` lists both paths, so a code path makes the diff `code` |
510
+ | Path listing above about 40 lines | Read in ranges (Step 1.1) |
500
511
  | Language files changed, plugin not installed | The focus is absent from the stamped line: not spawned |
501
512
  | Public repo (`auto` mode) | Git agent probes visibility, posts counts-only STUB comment; full report stays local |
502
513
  | `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 |
503
514
 
504
515
  ## Backwards Compatibility
505
516
 
506
- - **Single worktree**: Auto-discovery finds only one worktree → proceeds exactly as before. Zero behavior change.
507
- - **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.
517
+ - **Gate level**: `full` runs the sets named here; the default `standard` and `lean` narrow them. `devflow gates --set full` keeps them.
508
518
 
509
519
  ## Principles
510
520
 
511
521
  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
512
522
  2. **Parallel, not background** - Multiple agents in one message, but `run_in_background=false` so phases complete before proceeding
513
523
  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
514
- 4. **Clear ownership** - Each agent owns its output completely
515
- 5. **Honest reporting** - Display agent outputs directly
516
- 6. **Incremental by default** - Only review new changes unless `--full` specified
517
- 7. **Auto-discover worktrees** - One command handles all reviewable branches
524
+ 4. **Honest reporting** - Display agent outputs directly
525
+ 5. **Incremental by default** - Only review new changes unless `--full` specified
@@ -36,9 +36,9 @@ $ARGUMENTS
36
36
  node "$HOME/.devflow/scripts/resolve-settings.cjs" "{root}" 2>/dev/null; echo "exit=$?"
37
37
  ```
38
38
 
39
- 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.
39
+ 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.
40
40
 
41
- 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.
41
+ The accepted line is the only source of these values.
42
42
 
43
43
  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.
44
44