devflow-kit 2.5.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/CHANGELOG.md +82 -0
  2. package/README.md +44 -19
  3. package/dist/agents/git.md +13 -15
  4. package/dist/cli/commands/ambient.js +160 -145
  5. package/dist/cli/commands/capture.js +29 -55
  6. package/dist/cli/commands/compliance.js +32 -61
  7. package/dist/cli/commands/context.js +17 -32
  8. package/dist/cli/commands/debug.js +65 -26
  9. package/dist/cli/commands/flags.js +3 -3
  10. package/dist/cli/commands/hud.js +34 -10
  11. package/dist/cli/commands/init-seed.js +40 -4
  12. package/dist/cli/commands/init.js +249 -271
  13. package/dist/cli/commands/install-report.js +10 -15
  14. package/dist/cli/commands/knowledge/index.js +1 -1
  15. package/dist/cli/commands/knowledge/toggle.js +11 -3
  16. package/dist/cli/commands/learning.js +52 -37
  17. package/dist/cli/commands/legacy-hooks.js +11 -14
  18. package/dist/cli/commands/memory.js +67 -78
  19. package/dist/cli/commands/proxy.js +23 -41
  20. package/dist/cli/commands/security.js +5 -13
  21. package/dist/cli/commands/skills.js +21 -3
  22. package/dist/cli/commands/tracker.js +100 -228
  23. package/dist/cli/commands/uninstall.js +343 -138
  24. package/dist/commands/bug-analysis.md +38 -12
  25. package/dist/commands/code-review.md +70 -21
  26. package/dist/commands/debug.md +37 -7
  27. package/dist/commands/dynamic-build.md +66 -17
  28. package/dist/commands/dynamic-plan.md +19 -8
  29. package/dist/commands/dynamic-profile.md +24 -10
  30. package/dist/commands/dynamic-tickets.md +22 -11
  31. package/dist/commands/explore.md +37 -7
  32. package/dist/commands/implement.md +96 -32
  33. package/dist/commands/plan.md +62 -19
  34. package/dist/commands/release.md +2 -2
  35. package/dist/commands/research.md +34 -8
  36. package/dist/commands/resolve.md +65 -17
  37. package/dist/commands/self-review.md +45 -9
  38. package/dist/core/compliance-compose.js +27 -27
  39. package/dist/core/evidence-policy.js +240 -24
  40. package/dist/core/feature-config.js +94 -25
  41. package/dist/core/feature-switch.js +1 -1
  42. package/dist/core/flags.js +30 -2
  43. package/dist/core/fs-atomic.js +27 -0
  44. package/dist/core/hook-log-dirs.js +104 -0
  45. package/dist/core/learning-tuning-config.js +5 -3
  46. package/dist/core/ledger-root.js +102 -0
  47. package/dist/core/manifest.js +6 -4
  48. package/dist/core/mds-variants.js +34 -97
  49. package/dist/core/migrations.js +49 -23
  50. package/dist/core/plugins.js +5 -4
  51. package/dist/core/project-paths.js +0 -17
  52. package/dist/core/same-location.js +25 -0
  53. package/dist/core/tracker.js +226 -139
  54. package/dist/hud/components/config-counts.js +15 -4
  55. package/dist/hud/components/learning-counts.js +14 -0
  56. package/dist/hud/config.js +2 -1
  57. package/dist/hud/cost-history.js +2 -4
  58. package/dist/hud/git.js +52 -7
  59. package/dist/hud/index.js +7 -9
  60. package/dist/skills/git/references/pr/check-merge-readiness.md +1 -1
  61. package/dist/skills/git/references/pr/ensure-pr-ready.md +1 -1
  62. package/dist/skills/git/references/pr/update-pr-evidence.md +1 -1
  63. package/dist/skills/git/references/tracker/_mcp.md +1 -1
  64. package/dist/skills/git/references/tracker/github/backlink-shipped-issues.md +1 -1
  65. package/dist/skills/git/references/tracker/github/ensure-traceable-issue.md +1 -1
  66. package/dist/skills/git/references/tracker/github/gather-release-evidence.md +2 -2
  67. package/dist/skills/git/references/tracker/github/manage-debt.md +3 -3
  68. package/dist/skills/git/references/tracker/jira/backlink-shipped-issues.md +1 -1
  69. package/dist/skills/git/references/tracker/jira/ensure-traceable-issue.md +1 -1
  70. package/dist/skills/git/references/tracker/jira/gather-release-evidence.md +2 -2
  71. package/dist/skills/git/references/tracker/jira/manage-debt.md +1 -1
  72. package/dist/skills/git/references/tracker/jira/post-wave-report.md +1 -1
  73. package/dist/skills/git/references/tracker/jira/setup-task.md +1 -1
  74. package/dist/skills/git/references/tracker/linear/backlink-shipped-issues.md +1 -1
  75. package/dist/skills/git/references/tracker/linear/ensure-traceable-issue.md +1 -1
  76. package/dist/skills/git/references/tracker/linear/gather-release-evidence.md +2 -2
  77. package/dist/skills/git/references/tracker/linear/manage-debt.md +1 -1
  78. package/dist/skills/git/references/tracker/linear/post-wave-report.md +1 -1
  79. package/dist/skills/git/references/tracker/linear/setup-task.md +1 -1
  80. package/dist/targets/claude-code/claude-paths.js +59 -57
  81. package/dist/targets/claude-code/compliance-install.js +49 -65
  82. package/dist/targets/claude-code/hooks.js +108 -3
  83. package/dist/targets/claude-code/installer.js +30 -57
  84. package/dist/targets/claude-code/post-install.js +246 -139
  85. package/dist/targets/claude-code/tracker-install.js +38 -65
  86. package/package.json +5 -4
  87. package/src/assets/agents/code.md +4 -3
  88. package/src/assets/agents/design.md +1 -0
  89. package/src/assets/agents/git.mds +55 -57
  90. package/src/assets/agents/knowledge.md +2 -2
  91. package/src/assets/agents/review.md +3 -1
  92. package/src/assets/agents/tracker.md +37 -30
  93. package/src/assets/commands/_partials/_compliance.mds +19 -1
  94. package/src/assets/commands/_partials/_decisions.mds +15 -3
  95. package/src/assets/commands/_partials/_docs_root.mds +35 -0
  96. package/src/assets/commands/_partials/_engine.mds +2 -2
  97. package/src/assets/commands/_partials/_evidence_policy.mds +3 -3
  98. package/src/assets/commands/_partials/_factory.mds +1 -1
  99. package/src/assets/commands/_partials/_knowledge.mds +27 -9
  100. package/src/assets/commands/_partials/_plan_contract.mds +2 -2
  101. package/src/assets/commands/_partials/_preamble.mds +1 -1
  102. package/src/assets/commands/_partials/_publication.mds +6 -2
  103. package/src/assets/commands/_partials/_settings.mds +28 -0
  104. package/src/assets/commands/_partials/_ticket_template.mds +3 -3
  105. package/src/assets/commands/_partials/_tracker.mds +4 -4
  106. package/src/assets/commands/_partials/_wave.mds +4 -4
  107. package/src/assets/commands/bug-analysis.mds +19 -17
  108. package/src/assets/commands/code-review.mds +39 -33
  109. package/src/assets/commands/debug.mds +4 -5
  110. package/src/assets/commands/dynamic-build.mds +75 -53
  111. package/src/assets/commands/dynamic-plan.mds +20 -15
  112. package/src/assets/commands/dynamic-profile.mds +24 -11
  113. package/src/assets/commands/dynamic-tickets.mds +25 -20
  114. package/src/assets/commands/explore.mds +4 -5
  115. package/src/assets/commands/implement.mds +58 -45
  116. package/src/assets/commands/plan.mds +34 -29
  117. package/src/assets/commands/release.md +2 -2
  118. package/src/assets/commands/research.mds +11 -9
  119. package/src/assets/commands/resolve.mds +41 -39
  120. package/src/assets/commands/self-review.mds +24 -25
  121. package/src/assets/mds/git/_pr.mds +61 -61
  122. package/src/assets/mds/git/_references.mds +19 -19
  123. package/src/assets/mds/tracker/_common.mds +8 -8
  124. package/src/assets/mds/tracker/_github.mds +71 -71
  125. package/src/assets/mds/tracker/_jira.mds +74 -74
  126. package/src/assets/mds/tracker/_linear.mds +75 -75
  127. package/src/assets/mds/tracker/_mcp.mds +23 -17
  128. package/src/assets/scripts/hooks/background-memory-update +35 -19
  129. package/src/assets/scripts/hooks/capture-prompt +18 -12
  130. package/src/assets/scripts/hooks/capture-question +18 -12
  131. package/src/assets/scripts/hooks/capture-turn +27 -17
  132. package/src/assets/scripts/hooks/debug-trace +11 -6
  133. package/src/assets/scripts/hooks/ensure-devflow-init +33 -6
  134. package/src/assets/scripts/hooks/ensure-proxy +9 -8
  135. package/src/assets/scripts/hooks/ensure-root-gitignore +111 -36
  136. package/src/assets/scripts/hooks/git-marker +48 -0
  137. package/src/assets/scripts/hooks/json-helper.cjs +6 -1
  138. package/src/assets/scripts/hooks/lib/project-paths.cjs +0 -19
  139. package/src/assets/scripts/hooks/log-paths +80 -0
  140. package/src/assets/scripts/hooks/memory-worker +17 -15
  141. package/src/assets/scripts/hooks/pre-compact-memory +41 -16
  142. package/src/assets/scripts/hooks/queue-append +104 -30
  143. package/src/assets/scripts/hooks/resolve-project-root +101 -7
  144. package/src/assets/scripts/hooks/session-start-context +289 -122
  145. package/src/assets/scripts/hooks/session-start-memory +35 -16
  146. package/src/assets/scripts/lib/project-config.cjs +633 -0
  147. package/src/assets/scripts/resolve-evidence-policy.cjs +300 -220
  148. package/src/assets/scripts/resolve-settings.cjs +1054 -0
  149. package/src/assets/scripts/verify-evidence.cjs +1 -1
  150. package/src/assets/skills/compliance/SKILL.md +2 -2
  151. package/src/assets/skills/docs-framework/SKILL.md +6 -7
  152. package/src/assets/skills/docs-framework/references/patterns.md +10 -17
  153. package/src/assets/skills/gap-analysis/SKILL.md +2 -2
  154. package/src/assets/skills/git/references/github-api.md +9 -9
  155. package/src/assets/skills/git/references/patterns.md +1 -1
  156. package/src/assets/skills/worktree-support/SKILL.md +1 -1
  157. package/src/assets/skills/worktree-support/references/roots.md +29 -0
  158. package/src/targets/claude-code/templates/managed-settings.json +25 -9
@@ -4,8 +4,8 @@ output-dir: dist/commands
4
4
  ---
5
5
  @import { knowledge_load } from "./_partials/_knowledge.mds"
6
6
  @import { decisions_load } from "./_partials/_decisions.mds"
7
+ @import { docs_root } from "./_partials/_docs_root.mds"
7
8
  @import { evidence_policy } from "./_partials/_evidence_policy.mds"
8
-
9
9
  # Bug Analysis Command
10
10
 
11
11
  Run a proactive bug analysis on the current branch by combining static analysis tools with parallel semantic analyzers, then synthesizing results into an actionable bug report. Supports incremental analysis, timestamped report directories, and `/resolve` compatibility.
@@ -24,14 +24,16 @@ Run a proactive bug analysis on the current branch by combining static analysis
24
24
 
25
25
  **Produces:** BRANCH_INFO, PR_DESCRIPTION, EVIDENCE_POLICY, ISSUE_REQUIRED, APPLY_CONVENTIONS, REQUIRE_NON_AUTHOR_APPROVAL
26
26
 
27
- {evidence_policy()}
27
+ {{evidence_policy()}}
28
+
29
+ {{docs_root()}}
28
30
 
29
31
  Render the test-plan block from `/implement`'s evidence file, and from nothing else:
30
32
  1. `branch_slug` is `git branch --show-current` with every `/` replaced by `-`.
31
- 2. Only when `branch_slug` matches `^[A-Za-z0-9._-]\{1,200\}$` and the file exists, run (the path double-quoted):
33
+ 2. Only when `branch_slug` matches `^[A-Za-z0-9._-]{1,200}$` and the file exists, run (the path double-quoted):
32
34
 
33
35
  ```bash
34
- node "${DEVFLOW_DIR:-$HOME/.devflow}/scripts/verify-evidence.cjs" render --plan ".devflow/docs/evidence-{branch_slug}.md"; echo "exit=$?"
36
+ node "$HOME/.devflow/scripts/verify-evidence.cjs" render --plan "{worktree}/.devflow/docs/evidence-{branch_slug}.md"; echo "exit=$?"
35
37
  ```
36
38
 
37
39
  3. On `exit=0`, `PR_TEST_PLAN_BLOCK` is its stdout byte for byte without that `exit=` line; in every other case it is `(none)`. Nothing here waits on it: the Git agent pastes it only behind its own check, and only into a PR it creates.
@@ -64,16 +66,16 @@ If `pr_number` is absent or the command fails, set `PR_DESCRIPTION` to `(none)`.
64
66
  **Produces:** DIFF_RANGE, ANALYSIS_DIR
65
67
  **Requires:** BRANCH_INFO
66
68
 
67
- 1. Check `.devflow/docs/bug-analysis/\{branch-slug\}/.last-analysis-head`:
69
+ 1. Check `{worktree}/.devflow/docs/bug-analysis/{branch-slug}/.last-analysis-head`:
68
70
  - **If exists AND `--full` NOT set:**
69
71
  - Read the SHA from the file
70
- - Verify reachable: `git cat-file -t \{sha\}` — if exit code non-zero (rebase invalidated SHA), fall through to full
72
+ - Verify reachable: `git cat-file -t {sha}` — if exit code non-zero (rebase invalidated SHA), fall through to full
71
73
  - If SHA == current HEAD → "No new commits since last analysis. Use --full for a full re-analysis." Stop.
72
- - Set `DIFF_RANGE` to `\{sha\}...HEAD`
74
+ - Set `DIFF_RANGE` to `{sha}...HEAD`
73
75
  - **If not exists, unreachable SHA, or `--full`:**
74
- - Set `DIFF_RANGE` to `\{base_branch\}...HEAD`
76
+ - Set `DIFF_RANGE` to `{base_branch}...HEAD`
75
77
  2. Generate timestamp: `YYYY-MM-DD_HHMM`. If directory already exists (same-minute collision), append seconds (`YYYY-MM-DD_HHMMSS`).
76
- 3. Create timestamped analysis directory: `mkdir -p .devflow/docs/bug-analysis/\{branch-slug\}/\{timestamp\}/`
78
+ 3. Create timestamped analysis directory: `mkdir -p "{worktree}/.devflow/docs/bug-analysis/{branch-slug}/{timestamp}/"`
77
79
  4. Set `ANALYSIS_DIR` to that path.
78
80
 
79
81
  #### Step 2b: Check Changed Files
@@ -158,9 +160,9 @@ Parse `CODEQL_SARIF` → extract findings. If database creation fails, `CODEQL_E
158
160
 
159
161
  | Tool | File:Line | CWE | Severity | Title | Description |
160
162
  |------|-----------|-----|----------|-------|-------------|
161
- | \{tool\} | \{file\}:\{line\} | \{CWE or —\} | \{CRITICAL/HIGH/MEDIUM/LOW\} | \{title\} | \{description truncated to 200 chars\} |
163
+ | {tool} | {file}:{line} | {CWE or —} | {CRITICAL/HIGH/MEDIUM/LOW} | {title} | {description truncated to 200 chars} |
162
164
 
163
- Write ALL raw findings to `\{ANALYSIS_DIR\}/static-findings.md`. Set `STATIC_FINDINGS` to the top-50 table.
165
+ Write ALL raw findings to `{ANALYSIS_DIR}/static-findings.md`. Set `STATIC_FINDINGS` to the top-50 table.
164
166
 
165
167
  If no tool produced findings: set `STATIC_FINDINGS` to `(none)`.
166
168
 
@@ -170,15 +172,15 @@ If no tool produced findings: set `STATIC_FINDINGS` to `(none)`.
170
172
 
171
173
  #### Decisions Index
172
174
 
173
- {decisions_load()}
175
+ {{decisions_load()}}
174
176
 
175
177
  #### Feature Knowledge
176
178
 
177
- {knowledge_load()}
179
+ {{knowledge_load()}}
178
180
 
179
181
  #### Plan Artifact
180
182
 
181
- 1. List `.devflow/docs/design/*.md` — sort descending by filename (timestamps are naturally sortable), scan the 10 most recent
183
+ 1. List `{worktree}/.devflow/docs/design/*.md` — sort descending by filename (timestamps are naturally sortable), scan the 10 most recent
182
184
  2. Read the most recent file if it exists
183
185
  3. Extract `## Acceptance Criteria` section → parse into table: `| ID | Criterion | Type | Testable Condition |`
184
186
  4. Set `PLAN_CONTEXT` to plan summary; `ACCEPTANCE_RULES` to the table
@@ -248,7 +250,7 @@ Output: {ANALYSIS_DIR}/bug-analysis-summary.md"
248
250
 
249
251
  **Requires:** BRANCH_INFO, ANALYSIS_DIR
250
252
 
251
- 1. Write current HEAD SHA to `.devflow/docs/bug-analysis/\{branch-slug\}/.last-analysis-head`
253
+ 1. Write current HEAD SHA to `{worktree}/.devflow/docs/bug-analysis/{branch-slug}/.last-analysis-head`
252
254
  2. Report to user:
253
255
 
254
256
  ```
@@ -299,7 +301,7 @@ Run `/resolve` to process and fix these findings.
299
301
  ├─ Phase 3: Context Loading
300
302
  │ ├─ index.md (pre-rendered) → DECISIONS_CONTEXT
301
303
  │ ├─ Feature knowledge load → FEATURE_KNOWLEDGE
302
- │ └─ .devflow/docs/design/*.md → PLAN_CONTEXT + ACCEPTANCE_RULES
304
+ │ └─ {worktree}/.devflow/docs/design/*.md → PLAN_CONTEXT + ACCEPTANCE_RULES
303
305
  │
304
306
  ├─ Phase 4: File Analysis
305
307
  │ └─ Detect active focuses (security + functional always; integration + usability conditional)
@@ -357,7 +359,7 @@ Before reporting results, verify every phase was executed:
357
359
  - [ ] Phase 3: Context Loading → DECISIONS_CONTEXT captured, FEATURE_KNOWLEDGE loaded (or `(none)`), PLAN_CONTEXT and ACCEPTANCE_RULES captured (or `(none)`)
358
360
  - [ ] Phase 4: File Analysis → ACTIVE_FOCUSES determined (security + functional always present)
359
361
  - [ ] Phase 5: Parallel Bug Analysis → ANALYZER_OUTPUTS captured per active focus; all reports written to ANALYSIS_DIR
360
- - [ ] Phase 6: Synthesis → BUG_ANALYSIS_SUMMARY written to `\{ANALYSIS_DIR\}/bug-analysis-summary.md`
362
+ - [ ] Phase 6: Synthesis → BUG_ANALYSIS_SUMMARY written to `{ANALYSIS_DIR}/bug-analysis-summary.md`
361
363
  - [ ] Phase 7: Finalize → `.last-analysis-head` updated; results displayed to user
362
364
 
363
365
  If any phase is unchecked, execute it before proceeding.
@@ -7,7 +7,6 @@ output-dir: dist/commands
7
7
  @import { compliance_gate } from "./_partials/_compliance.mds"
8
8
  @import { evidence_policy } from "./_partials/_evidence_policy.mds"
9
9
  @import { publication_gate } from "./_partials/_publication.mds"
10
-
11
10
  # Code Review Command
12
11
 
13
12
  Run a comprehensive code review of the current branch by spawning parallel review agents, then synthesizing results into PR comments. Supports incremental reviews, timestamped report directories, and multi-worktree auto-discovery.
@@ -31,24 +30,24 @@ Run a comprehensive code review of the current branch by spawning parallel revie
31
30
 
32
31
  1. **Discover reviewable worktrees** using the `devflow:worktree-support` skill discovery algorithm:
33
32
  - Run `git worktree list --porcelain` → parse, filter (skip protected/detached/mid-rebase), dedup by branch, sort by recent commit
34
- - See `~/.claude/skills/devflow:worktree-support/SKILL.md` for the full 7-step algorithm and canonical protected branch list
33
+ - See the `devflow:worktree-support` skill for the full 7-step algorithm and canonical protected branch list
35
34
  2. **If `--path` flag provided:** use only that worktree, skip discovery
36
35
  **`--path` validation**: Before proceeding, verify the path exists as a directory and appears in `git worktree list` output. If not: report error and stop.
37
36
  3. **If only 1 reviewable worktree** (the common case): proceed as single-worktree flow — zero behavior change
38
- 4. **If multiple reviewable worktrees:** report "Found N worktrees with reviewable branches: \{list with paths and branches\}" and proceed with multi-worktree flow
37
+ 4. **If multiple reviewable worktrees:** report "Found N worktrees with reviewable branches: {list with paths and branches}" and proceed with multi-worktree flow
39
38
 
40
- #### Step 0b: Resolve COMPLIANCE_SKILL_INSTALLED
39
+ #### Step 0b: Resolve the compliance lens
41
40
 
42
- **Produces:** COMPLIANCE_SKILL_INSTALLED
41
+ **Produces:** COMPLIANCE_ACTIVE, COMPLIANCE_FRAMEWORKS
43
42
 
44
- {compliance_gate()}
45
- Reuse this result for every worktree and every downstream phase.
43
+ {{compliance_gate()}}
44
+ Keep each worktree's values for every downstream phase of that worktree.
46
45
 
47
46
  #### Step 0b-ii: Resolve the evidence policy
48
47
 
49
48
  **Produces:** EVIDENCE_POLICY, ISSUE_REQUIRED, APPLY_CONVENTIONS, REQUIRE_NON_AUTHOR_APPROVAL
50
49
 
51
- {evidence_policy()}
50
+ {{evidence_policy()}}
52
51
 
53
52
  #### Step 0c: Per-Worktree Pre-Flight (Git Agent)
54
53
 
@@ -56,17 +55,17 @@ Reuse this result for every worktree and every downstream phase.
56
55
  **Requires:** WORKTREES
57
56
 
58
57
  Discover PR description guidance from plan artifact (per worktree):
59
- 1. List `\{worktree\}/.devflow/docs/design/*.md` files
58
+ 1. List `{worktree}/.devflow/docs/design/*.md` files
60
59
  2. Sort by timestamp in filename (descending -- timestamps are YYYY-MM-DD_HHMM, naturally sortable)
61
60
  3. Read the most recent file, extract `## PR Description Guidance` section
62
61
  4. If no plan files exist or section not found, set `PR_DESCRIPTION_GUIDANCE` to `(none)`
63
62
 
64
63
  Render the test-plan block (per worktree) from `/implement`'s evidence file, and from nothing else:
65
- 1. `branch_slug` is `git -C "\{worktree\}" branch --show-current` with every `/` replaced by `-`.
66
- 2. Only when `branch_slug` matches `^[A-Za-z0-9._-]\{1,200\}$` and the file exists, run (the path double-quoted):
64
+ 1. `branch_slug` is `git -C "{worktree}" branch --show-current` with every `/` replaced by `-`.
65
+ 2. Only when `branch_slug` matches `^[A-Za-z0-9._-]{1,200}$` and the file exists, run (the path double-quoted):
67
66
 
68
67
  ```bash
69
- node "${DEVFLOW_DIR:-$HOME/.devflow}/scripts/verify-evidence.cjs" render --plan "{worktree}/.devflow/docs/evidence-{branch_slug}.md"; echo "exit=$?"
68
+ node "$HOME/.devflow/scripts/verify-evidence.cjs" render --plan "{worktree}/.devflow/docs/evidence-{branch_slug}.md"; echo "exit=$?"
70
69
  ```
71
70
 
72
71
  3. On `exit=0`, `PR_TEST_PLAN_BLOCK` is its stdout byte for byte without that `exit=` line; in every other case it is `(none)`. Nothing here waits on it: the Git agent pastes it only behind its own check, and only into a PR it creates.
@@ -104,15 +103,15 @@ If `pr_number` is absent or the command fails, set `PR_DESCRIPTION` to `(none)`.
104
103
  For each worktree:
105
104
 
106
105
  1. Generate timestamp: `YYYY-MM-DD_HHMM`. If directory already exists (same-minute collision), append seconds (`YYYY-MM-DD_HHMMSS`).
107
- 2. Create timestamped review directory: `mkdir -p \{worktree\}/.devflow/docs/reviews/\{branch-slug\}/\{timestamp\}/`
108
- 3. Check if `\{worktree\}/.devflow/docs/reviews/\{branch-slug\}/.last-review-head` exists:
106
+ 2. Create timestamped review directory: `mkdir -p {worktree}/.devflow/docs/reviews/{branch-slug}/{timestamp}/`
107
+ 3. Check if `{worktree}/.devflow/docs/reviews/{branch-slug}/.last-review-head` exists:
109
108
  - **If yes AND `--full` NOT set:**
110
109
  - Read the SHA from the file
111
- - Verify reachable: `git -C \{worktree\} cat-file -t \{sha\}` (handles rebases — if unreachable, fallback to full)
110
+ - Verify reachable: `git -C {worktree} cat-file -t {sha}` (handles rebases — if unreachable, fallback to full)
112
111
  - Check if SHA == current HEAD → if so, skip review: "No new commits since last review. Use --full for a full re-review."
113
- - Set `DIFF_RANGE` to `\{last-review-sha\}...HEAD`
112
+ - Set `DIFF_RANGE` to `{last-review-sha}...HEAD`
114
113
  - **If no (first review), or `--full`:**
115
- - Set `DIFF_RANGE` to `\{base_branch\}...HEAD`
114
+ - Set `DIFF_RANGE` to `{base_branch}...HEAD`
116
115
 
117
116
  #### Step 0e-i: Load Prior Resolution and Count Cycles
118
117
 
@@ -120,10 +119,10 @@ For each worktree:
120
119
  **Requires:** BRANCH_INFO
121
120
 
122
121
  For each worktree, perform a single pass over timestamped directories:
123
- 1. List timestamped directories in `\{worktree\}/.devflow/docs/reviews/\{branch-slug\}/` sorted descending: `ls -1d \{worktree\}/.devflow/docs/reviews/\{branch-slug\}/20* 2>/dev/null | sort -r`
122
+ 1. List timestamped directories in `{worktree}/.devflow/docs/reviews/{branch-slug}/` sorted descending: `ls -1d {worktree}/.devflow/docs/reviews/{branch-slug}/20* 2>/dev/null | sort -r`
124
123
  2. Iterate once: accumulate CYCLE_NUMBER count for each directory containing `resolution-summary.md`; capture the first (most-recent) such directory as PRIOR_DIR.
125
124
  3. If CYCLE_NUMBER = 0: set PRIOR_RESOLUTIONS=(none), CYCLE_NUMBER=1, proceed.
126
- 4. Otherwise: set CYCLE_NUMBER = count + 1. Read `\{PRIOR_DIR\}/resolution-summary.md` as PRIOR_RESOLUTIONS.
125
+ 4. Otherwise: set CYCLE_NUMBER = count + 1. Read `{PRIOR_DIR}/resolution-summary.md` as PRIOR_RESOLUTIONS.
127
126
  5. If `--full`: still load PRIOR_RESOLUTIONS (valuable for Review agent cross-cycle awareness).
128
127
 
129
128
  #### Step 0e-ii: Convergence Assessment
@@ -134,7 +133,7 @@ For each worktree, perform a single pass over timestamped directories:
134
133
  MAX_REVIEW_CYCLES = 10
135
134
 
136
135
  1. If CYCLE_NUMBER > MAX_REVIEW_CYCLES:
137
- Warn in output: "⚠️ Review pipeline has run \{CYCLE_NUMBER-1\} cycles (exceeds MAX_REVIEW_CYCLES=10). Consider merging or manual inspection."
136
+ Warn in output: "⚠️ Review pipeline has run {CYCLE_NUMBER-1} cycles (exceeds MAX_REVIEW_CYCLES=10). Consider merging or manual inspection."
138
137
  Continue with review.
139
138
  2. Parse Statistics table from PRIOR_RESOLUTIONS:
140
139
  - Extract False Positive, Fixed, Deferred counts
@@ -143,7 +142,7 @@ MAX_REVIEW_CYCLES = 10
143
142
  - If denominator = 0: fp_ratio = 0, skip warning
144
143
  - If parsing fails: fp_ratio = 0, skip warning; note in output: "Warning: Could not parse Statistics table from prior resolution. FP ratio unavailable — convergence tracking degraded."
145
144
  3. If fp_ratio > 0.7 AND CYCLE_NUMBER >= 3:
146
- Warn in output: "⚠️ Convergence: \{ratio\}% false positives in cycle \{N-1\}. Consider merging or manual inspection."
145
+ Warn in output: "⚠️ Convergence: {ratio}% false positives in cycle {N-1}. Consider merging or manual inspection."
147
146
  Continue with review.
148
147
 
149
148
  **Decision table — Step 0e-ii paths:**
@@ -161,12 +160,12 @@ MAX_REVIEW_CYCLES = 10
161
160
 
162
161
  For each reviewable worktree, call:
163
162
 
164
- {publication_gate()}
163
+ {{publication_gate()}}
165
164
 
166
165
  ### Phase 1: Analyze Changed Files
167
166
 
168
167
  **Produces:** REVIEW_FOCUS_LIST
169
- **Requires:** DIFF_RANGE, COMPLIANCE_SKILL_INSTALLED (from Step 0b)
168
+ **Requires:** DIFF_RANGE, COMPLIANCE_ACTIVE (from Step 0b)
170
169
 
171
170
  Per worktree, detect file types in diff using `DIFF_RANGE` to determine conditional reviews.
172
171
 
@@ -183,23 +182,29 @@ Per worktree, detect file types in diff using `DIFF_RANGE` to determine conditio
183
182
  | DB/migration files | database |
184
183
  | Dependency files changed | dependencies |
185
184
  | Docs or significant code | documentation |
186
- | COMPLIANCE_SKILL_INSTALLED AND diff touches regulated surface | compliance |
185
+ | COMPLIANCE_ACTIVE AND diff touches regulated surface | compliance |
186
+
187
+ 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.
188
+
189
+ **Language focus presence gate.** The eight language focuses — `typescript`, `react`, `accessibility`, `ui-design`, `go`, `java`, `python`, `rust` — ship with optional plugins, so their pattern skills are installed only when the user selected that plugin. Gate them by presence: for each language focus the table above would add, check whether `{claude_dir}/skills/devflow:{focus}/SKILL.md` exists, `{claude_dir}` being Claude Code's directory as the installer resolves it — `CLAUDE_CONFIG_DIR` when that is set to an absolute path, else `$HOME/.claude` (D-CLAUDE-DIR-PROMPTS). Run one read-only, silent check per candidate focus:
187
190
 
188
- If `COMPLIANCE_SKILL_INSTALLED` AND the diff touches regulated surface (data models, auth flows, logging/observability, payments, IaC, retention): add `compliance` to REVIEW_FOCUS_LIST for this worktree.
191
+ ```bash
192
+ d="${CLAUDE_CONFIG_DIR:-}"; case "$d" in /*) ;; *) d="$HOME/.claude" ;; esac; test -f "$d/skills/devflow:{focus}/SKILL.md"; echo "exit=$?"
193
+ ```
189
194
 
190
- **Language focus presence gate.** The eight language focuses — `typescript`, `react`, `accessibility`, `ui-design`, `go`, `java`, `python`, `rust` — ship with optional plugins, so their pattern skills are installed only when the user selected that plugin. Gate them exactly as `compliance` is gated: for each language focus the table above would add, check whether `~/.claude/skills/devflow:\{focus\}/SKILL.md` exists (one file-existence check per candidate focus, read-only, silent). If it does not exist, do NOT add that focus to `REVIEW_FOCUS_LIST` and do NOT spawn a Review agent for it — the file-type condition alone never spawns a language focus. The eight core focuses are unconditional and are never presence-gated.
195
+ Only `exit=0` means the skill is installed. On any other result, do NOT add that focus to `REVIEW_FOCUS_LIST` and do NOT spawn a Review agent for it — the file-type condition alone never spawns a language focus. The eight core focuses are unconditional and are never presence-gated.
191
196
 
192
197
  ### Phase 1b: Load Decisions Index
193
198
 
194
- **Produces:** DECISIONS_CONTEXT, FEATURE_KNOWLEDGE, COMPLIANCE_SKILL_INSTALLED (carried from Step 0b)
199
+ **Produces:** DECISIONS_CONTEXT, FEATURE_KNOWLEDGE, COMPLIANCE_FRAMEWORKS (carried from Step 0b)
195
200
 
196
201
  **Load Companion Skills** — Load via Skill tool: `devflow:quality-gates`, `devflow:software-design`. If a skill fails to load, continue without it.
197
202
 
198
- {decisions_load()}
203
+ {{decisions_load()}}
199
204
 
200
205
  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.
201
206
 
202
- {knowledge_load()}
207
+ {{knowledge_load()}}
203
208
 
204
209
  Pass `FEATURE_KNOWLEDGE` to all Review agents alongside `DECISIONS_CONTEXT`.
205
210
 
@@ -247,6 +252,7 @@ DECISIONS_CONTEXT: {decisions_context}
247
252
  FEATURE_KNOWLEDGE: {feature_knowledge}
248
253
  PR_DESCRIPTION: <pr-description>{pr_description}</pr-description>
249
254
  PRIOR_RESOLUTIONS: <prior-resolution-summary>{prior_resolutions}</prior-resolution-summary>
255
+ COMPLIANCE_FRAMEWORKS: {COMPLIANCE_FRAMEWORKS} (compliance focus only)
250
256
  If PRIOR_RESOLUTIONS is not (none), follow Cross-Cycle Awareness in review.md.
251
257
  Follow devflow:apply-decisions to scan the index and Read full ADR/PF bodies on demand.
252
258
  Follow devflow:apply-feature-knowledge for FEATURE_KNOWLEDGE — feature-specific patterns and anti-patterns inform findings.
@@ -294,7 +300,7 @@ Posts the consolidated review-summary comment (marker-deduped by the operation o
294
300
  **Requires:** BRANCH_INFO, REVIEW_DIR
295
301
 
296
302
  Per worktree, after successful completion:
297
- 1. Write current HEAD SHA to `\{worktree_path\}/.devflow/docs/reviews/\{branch-slug\}/.last-review-head`
303
+ 1. Write current HEAD SHA to `{worktree_path}/.devflow/docs/reviews/{branch-slug}/.last-review-head`
298
304
  2. Display results from all agents:
299
305
  - Merge recommendation (from Synthesize agent)
300
306
  - Issue counts by category (🔴 blocking / ⚠️ should-fix / ℹ️ pre-existing)
@@ -311,7 +317,7 @@ In multi-worktree mode, report results per worktree.
311
317
  │
312
318
  ├─ Phase 0: Worktree Discovery & Pre-flight
313
319
  │ ├─ Step 0a: git worktree list → filter reviewable
314
- │ ├─ Step 0b: Resolve COMPLIANCE_SKILL_INSTALLED
320
+ │ ├─ Step 0b: Resolve the compliance lens
315
321
  │ ├─ Step 0c: Git agent (ensure-pr-ready) per worktree [parallel]
316
322
  │ ├─ Step 0d: Incremental detection + timestamp setup per worktree
317
323
  │ ├─ Step 0e-i: Load prior resolution-summary.md
@@ -350,7 +356,7 @@ In multi-worktree mode, report results per worktree.
350
356
  | Worktree pre-flight fails | Report failure, continue with other worktrees |
351
357
  | `--full` in multi-worktree mode | Applies to all worktrees (global modifier) |
352
358
  | Many worktrees (5+) | Report count and proceed — user manages their worktree count |
353
- | 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 |
359
+ | 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 |
354
360
  | First review (no prior resolution) | PRIOR_RESOLUTIONS=(none), no convergence check |
355
361
  | fp_ratio denominator = 0 | fp_ratio = 0, no warning |
356
362
  | `--full` flag | Bypass incremental detection (Step 0d), still load PRIOR_RESOLUTIONS for cross-cycle awareness |
@@ -362,7 +368,7 @@ In multi-worktree mode, report results per worktree.
362
368
  ## Backwards Compatibility
363
369
 
364
370
  - **Single worktree**: Auto-discovery finds only one worktree → proceeds exactly as before. Zero behavior change.
365
- - **Legacy flat layout**: If `.devflow/docs/reviews/\{branch-slug\}/` contains flat `*.md` files (no timestamped subdirectories), new runs create timestamped subdirectories. Old flat files remain untouched.
371
+ - **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.
366
372
 
367
373
  ## Principles
368
374
 
@@ -5,7 +5,6 @@ output-dir: dist/commands
5
5
  @import { knowledge_writeback } from "./_partials/_knowledge.mds"
6
6
  @import { decisions_load } from "./_partials/_decisions.mds"
7
7
  @import { issue_ref_grammar, issue_capture_contract } from "./_partials/_tracker.mds"
8
-
9
8
  # Debug Command
10
9
 
11
10
  Investigate bugs by spawning parallel agents, each pursuing a different hypothesis. Evidence is aggregated and synthesized to identify the root cause.
@@ -33,7 +32,7 @@ Investigate bugs by spawning parallel agents, each pursuing a different hypothes
33
32
 
34
33
  **Load Companion Skills** — Load via Skill tool: `devflow:test-driven-development`, `devflow:software-design`, `devflow:testing`. If a skill fails to load, continue without it.
35
34
 
36
- {decisions_load()}
35
+ {{decisions_load()}}
37
36
 
38
37
  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.
39
38
 
@@ -46,7 +45,7 @@ The orchestrator uses `DECISIONS_CONTEXT` locally when generating hypotheses (Ph
46
45
 
47
46
  If `$ARGUMENTS` opens with a candidate issue reference, fetch the issue:
48
47
 
49
- {issue_ref_grammar()}
48
+ {{issue_ref_grammar()}}
50
49
 
51
50
  ```
52
51
  Agent(subagent_type="Git"):
@@ -55,7 +54,7 @@ ISSUE_INPUT: {issue reference}
55
54
  Return issue title, body, labels, and any linked error logs."
56
55
  ```
57
56
 
58
- {issue_capture_contract()}
57
+ {{issue_capture_contract()}}
59
58
 
60
59
  If the Git agent returns only a TRACEABILITY: DEGRADED line and no issue content, report that line verbatim to the user and use AskUserQuestion to request the bug description before generating any hypotheses — do not fabricate a description from the raw candidate token alone.
61
60
 
@@ -182,7 +181,7 @@ Ask user via AskUserQuestion: "Want me to implement this fix?"
182
181
  - **YES** → Load `devflow:patterns` and `devflow:test-driven-development` skills, implement the fix, then spawn `Agent(subagent_type="Simplify")` on changed files.
183
182
  - **NO** → Done. Report stands as documentation.
184
183
 
185
- {knowledge_writeback()}
184
+ {{knowledge_writeback()}}
186
185
 
187
186
  ## Architecture
188
187