devflow-kit 3.3.0 → 3.4.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 (138) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/agents/code.md +330 -0
  3. package/{src/assets → dist}/agents/design.md +1 -1
  4. package/{src/assets → dist}/agents/diagnose.md +1 -2
  5. package/dist/agents/git.md +29 -56
  6. package/{src/assets → dist}/agents/knowledge.md +4 -3
  7. package/{src/assets → dist}/agents/research.md +2 -2
  8. package/{src/assets → dist}/agents/review.md +8 -7
  9. package/{src/assets → dist}/agents/scrutinize.md +1 -1
  10. package/dist/agents/skim.md +148 -0
  11. package/{src/assets → dist}/agents/triage.md +1 -1
  12. package/dist/cli/commands/init.js +62 -0
  13. package/dist/cli/commands/learning.js +38 -3
  14. package/dist/cli/commands/uninstall.js +42 -1
  15. package/dist/commands/bug-analysis.md +30 -8
  16. package/dist/commands/code-review.md +141 -60
  17. package/dist/commands/debug.md +14 -12
  18. package/dist/commands/dynamic-build.md +37 -38
  19. package/dist/commands/dynamic-plan.md +30 -18
  20. package/dist/commands/dynamic-profile.md +27 -13
  21. package/dist/commands/dynamic-tickets.md +28 -14
  22. package/dist/commands/explore.md +15 -13
  23. package/dist/commands/implement.md +33 -28
  24. package/dist/commands/plan.md +37 -24
  25. package/dist/commands/release.md +69 -4
  26. package/dist/commands/research.md +33 -11
  27. package/dist/commands/resolve.md +35 -32
  28. package/dist/commands/self-review.md +36 -23
  29. package/dist/core/agent-models.js +43 -0
  30. package/dist/core/assets.js +55 -10
  31. package/dist/core/claude-md-audit.js +190 -0
  32. package/dist/core/feature-switch.js +20 -1
  33. package/dist/core/flags.js +28 -0
  34. package/dist/core/fs-atomic.js +8 -3
  35. package/dist/core/learning-variants.js +213 -0
  36. package/dist/core/manifest.js +62 -0
  37. package/dist/core/mds-variants.js +38 -1
  38. package/dist/core/plugins.js +71 -9
  39. package/{src/assets → dist/learning-off}/agents/code.md +6 -10
  40. package/dist/learning-off/agents/design.md +119 -0
  41. package/dist/learning-off/agents/diagnose.md +210 -0
  42. package/dist/learning-off/agents/knowledge.md +90 -0
  43. package/dist/learning-off/agents/research.md +149 -0
  44. package/dist/learning-off/agents/review.md +228 -0
  45. package/dist/learning-off/agents/scrutinize.md +117 -0
  46. package/{src/assets → dist/learning-off}/agents/skim.md +1 -8
  47. package/dist/learning-off/agents/triage.md +163 -0
  48. package/dist/learning-off/commands/bug-analysis.md +420 -0
  49. package/dist/learning-off/commands/code-review.md +525 -0
  50. package/dist/learning-off/commands/debug.md +294 -0
  51. package/dist/learning-off/commands/dynamic-build.md +1255 -0
  52. package/dist/learning-off/commands/dynamic-plan.md +424 -0
  53. package/dist/learning-off/commands/dynamic-profile.md +214 -0
  54. package/dist/learning-off/commands/dynamic-tickets.md +632 -0
  55. package/dist/learning-off/commands/explore.md +210 -0
  56. package/dist/learning-off/commands/implement.md +808 -0
  57. package/dist/learning-off/commands/plan.md +664 -0
  58. package/dist/learning-off/commands/release.md +310 -0
  59. package/dist/learning-off/commands/research.md +222 -0
  60. package/dist/learning-off/commands/resolve.md +837 -0
  61. package/dist/learning-off/commands/self-review.md +266 -0
  62. package/dist/skills/git/references/tracker/_contract.md +33 -0
  63. package/dist/skills/git/references/tracker/github/fetch-issue.md +2 -0
  64. package/dist/skills/git/references/tracker/github/fetch-issues-batch.md +2 -0
  65. package/dist/skills/git/references/tracker/github/gather-release-evidence.md +4 -0
  66. package/dist/skills/git/references/tracker/github/post-wave-report.md +2 -0
  67. package/dist/skills/git/references/tracker/github/setup-task.md +12 -0
  68. package/dist/skills/git/references/tracker/jira/associate-release.md +1 -1
  69. package/dist/skills/git/references/tracker/jira/fetch-issue.md +2 -0
  70. package/dist/skills/git/references/tracker/jira/fetch-issues-batch.md +2 -0
  71. package/dist/skills/git/references/tracker/jira/gather-release-evidence.md +4 -0
  72. package/dist/skills/git/references/tracker/jira/post-wave-report.md +2 -0
  73. package/dist/skills/git/references/tracker/jira/setup-task.md +14 -2
  74. package/dist/skills/git/references/tracker/linear/associate-release.md +1 -1
  75. package/dist/skills/git/references/tracker/linear/fetch-issue.md +2 -0
  76. package/dist/skills/git/references/tracker/linear/fetch-issues-batch.md +2 -0
  77. package/dist/skills/git/references/tracker/linear/gather-release-evidence.md +4 -0
  78. package/dist/skills/git/references/tracker/linear/post-wave-report.md +2 -0
  79. package/dist/skills/git/references/tracker/linear/setup-task.md +14 -2
  80. package/dist/targets/claude-code/installer.js +72 -36
  81. package/dist/targets/claude-code/language-stamp.js +185 -0
  82. package/dist/targets/claude-code/learning-install.js +489 -0
  83. package/package.json +1 -1
  84. package/src/assets/agents/code.mds +339 -0
  85. package/src/assets/agents/design.mds +149 -0
  86. package/src/assets/agents/diagnose.mds +225 -0
  87. package/src/assets/agents/evaluate.md +1 -3
  88. package/src/assets/agents/git.mds +29 -56
  89. package/src/assets/agents/knowledge.mds +125 -0
  90. package/src/assets/agents/research.mds +176 -0
  91. package/src/assets/agents/review.mds +286 -0
  92. package/src/assets/agents/scrutinize.mds +132 -0
  93. package/src/assets/agents/skim.mds +161 -0
  94. package/src/assets/agents/triage.mds +194 -0
  95. package/src/assets/agents/validate.md +8 -6
  96. package/src/assets/commands/_partials/_compliance.mds +5 -4
  97. package/src/assets/commands/_partials/_decisions.mds +31 -0
  98. package/src/assets/commands/_partials/_engine.mds +9 -1
  99. package/src/assets/commands/_partials/_knowledge.mds +25 -12
  100. package/src/assets/commands/_partials/_preamble.mds +33 -9
  101. package/src/assets/commands/_partials/_publication.mds +5 -4
  102. package/src/assets/commands/_partials/_settings.mds +13 -5
  103. package/src/assets/commands/_partials/_wave.mds +8 -0
  104. package/src/assets/commands/bug-analysis.mds +24 -2
  105. package/src/assets/commands/code-review.mds +147 -44
  106. package/src/assets/commands/debug.mds +17 -1
  107. package/src/assets/commands/dynamic-build.mds +33 -2
  108. package/src/assets/commands/dynamic-plan.mds +36 -6
  109. package/src/assets/commands/dynamic-profile.mds +9 -1
  110. package/src/assets/commands/dynamic-tickets.mds +16 -2
  111. package/src/assets/commands/explore.mds +27 -1
  112. package/src/assets/commands/implement.mds +41 -8
  113. package/src/assets/commands/plan.mds +47 -8
  114. package/src/assets/commands/{release.md → release.mds} +27 -24
  115. package/src/assets/commands/research.mds +28 -4
  116. package/src/assets/commands/resolve.mds +43 -2
  117. package/src/assets/commands/self-review.mds +30 -5
  118. package/src/assets/mds/tracker/_contract.mds +72 -0
  119. package/src/assets/mds/tracker/_github.mds +13 -2
  120. package/src/assets/mds/tracker/_jira.mds +17 -5
  121. package/src/assets/mds/tracker/_linear.mds +17 -5
  122. package/src/assets/mds/tracker/_mcp.mds +2 -2
  123. package/src/assets/mds/tracker/_steps.mds +97 -0
  124. package/src/assets/rules/context-economy.md +10 -0
  125. package/src/assets/rules/go.md +1 -0
  126. package/src/assets/rules/java.md +1 -0
  127. package/src/assets/rules/python.md +1 -0
  128. package/src/assets/rules/rust.md +1 -0
  129. package/src/assets/rules/typescript.md +1 -0
  130. package/src/assets/scripts/claude-md-audit.cjs +611 -0
  131. package/src/assets/scripts/hooks/assets/orchestrator-charter.md +1 -2
  132. package/src/assets/scripts/hooks/json-helper.cjs +13 -5
  133. package/src/assets/scripts/hooks/json-parse +34 -10
  134. package/src/assets/scripts/hooks/session-start-context +315 -7
  135. package/src/assets/skills/apply-decisions/SKILL.md +1 -1
  136. package/src/assets/skills/apply-feature-knowledge/SKILL.md +5 -5
  137. package/src/assets/skills/feature-knowledge/SKILL.md +43 -12
  138. package/src/assets/skills/quality-gates/SKILL.md +1 -1
@@ -3,11 +3,19 @@ A partial: the one way a prompt learns the repository's settings (D-SETTINGS-LIN
3
3
  machine manifest for a value this line carries — `resolve-settings.cjs` folds all
4
4
  three, and `tests/guards/no-config-read.test.ts` holds every compiled prompt to it.
5
5
 
6
- Imported by `_publication.mds`, `_compliance.mds` and `_knowledge.mds` themselves,
7
- as ALIAS imports (a selective import deep-clones this module's scope into every
8
- define of the importer). A command that runs two of those gates carries the
9
- block twice; the text says "reuse a line this run already resolved for the same
10
- root", so the second copy costs bytes and never a second resolution.
6
+ Each command host that has a consumer imports this file itself, as an ALIAS import
7
+ (a selective import deep-clones this module's scope into every define of the
8
+ importer), and expands `settings_resolve()` exactly once, immediately before the
9
+ earliest of its consumers: its decisions load or gate, its compliance lens, its
10
+ publication gate, its knowledge write-back Step 1, or a Skim spawn that takes
11
+ `LEARNING`. The gate partials import nothing from here: their text refers to the
12
+ settings line resolved above and keeps each gate's own condition inside its own step.
13
+
14
+ The block stays a per-root procedure: "reusing a line this run already resolved for
15
+ the same root". A consumer whose `{root}` may differ from the first-resolved root
16
+ names that root and says its line is the one for that root, resolved by the block
17
+ above when this run has not yet resolved it. The guard counts textual invocations,
18
+ not runtime calls.
11
19
 
12
20
  The accepted shape below is `SETTINGS_LINE_RE` written out, and the fallback is
13
21
  `SETTINGS_FAIL_CLOSED_LINE`, both exported by `resolve-settings.cjs`;
@@ -85,17 +85,25 @@ Two parallel sibling tickets can produce real git conflicts. The resolution is *
85
85
  **Resolution procedure:**
86
86
 
87
87
  1. Git agent detects the conflict and reports the conflicting files + sections
88
+ <!-- learning:on -->
89
+ 2. Spawn a Code agent whose prompt opens with `OPERATION: implement` and carries `COMPLIANCE_FRAMEWORKS` and `DECISIONS_CONTEXT`, with FULL intent context:
90
+ <!-- learning:off -->
88
91
  2. Spawn a Code agent whose prompt opens with `OPERATION: implement` and carries `COMPLIANCE_FRAMEWORKS`, with FULL intent context:
92
+ <!-- learning:end -->
89
93
  - Both ticket descriptions and plans
90
94
  - The conflicting diff sections (both sides)
95
+ <!-- learning:on -->
91
96
  - Relevant ADRs from DECISIONS_CONTEXT (loaded by main model before authoring)
97
+ <!-- learning:end -->
92
98
  3. Code agent resolves to PRESERVE BOTH INTENTS — the resolution must honor what both tickets were trying to achieve
93
99
  4. If the correct resolution is NOT UNAMBIGUOUS from the intent context: **do NOT guess** → quarantine + escalate
94
100
  5. After any resolution: the post-merge Validate covers it — the workflow spawns it after the merge, and no Validate is requested from Git
95
101
 
96
102
  **Conservative-or-escalate is absolute.** An LLM silently guessing a wrong merge is the highest-danger failure mode in the whole design. When in doubt: quarantine + surface in report. The user re-runs (resume) with the escalated context.
103
+ <!-- learning:on -->
97
104
 
98
105
  **New decisions surfaced during resolution** (a conflict that reveals an undocumented architectural choice) are noted in the run report for the user to write back as ADRs.
106
+ <!-- learning:end -->
99
107
  @end
100
108
 
101
109
  @define escalation_model():
@@ -6,6 +6,7 @@ output-dir: dist/commands
6
6
  @import { decisions_load } from "./_partials/_decisions.mds"
7
7
  @import { docs_root } from "./_partials/_docs_root.mds"
8
8
  @import { evidence_policy } from "./_partials/_evidence_policy.mds"
9
+ @import "./_partials/_settings.mds" as settings
9
10
  # Bug Analysis Command
10
11
 
11
12
  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.
@@ -168,12 +169,19 @@ If no tool produced findings: set `STATIC_FINDINGS` to `(none)`.
168
169
 
169
170
  ### Phase 3: Context Loading
170
171
 
171
- **Produces:** DECISIONS_CONTEXT, FEATURE_KNOWLEDGE, PLAN_CONTEXT, ACCEPTANCE_RULES
172
+ <!-- learning:on -->
173
+ **Produces:** DECISIONS_CONTEXT, FEATURE_KNOWLEDGE, FEATURE_KNOWLEDGE_RULES, PLAN_CONTEXT, ACCEPTANCE_RULES
174
+ <!-- learning:off -->
175
+ **Produces:** FEATURE_KNOWLEDGE, FEATURE_KNOWLEDGE_RULES, PLAN_CONTEXT, ACCEPTANCE_RULES
176
+ <!-- learning:end -->
172
177
 
178
+ <!-- learning:on -->
173
179
  #### Decisions Index
174
180
 
175
- {{decisions_load()}}
181
+ {{settings.settings_resolve()}}
176
182
 
183
+ <!-- learning:end -->
184
+ {{decisions_load()}}
177
185
  #### Feature Knowledge
178
186
 
179
187
  {{knowledge_load()}}
@@ -203,7 +211,11 @@ Determine which focus analyzers to run using `CHANGED_FILES` (already computed i
203
211
  ### Phase 5: Parallel Bug Analysis
204
212
 
205
213
  **Produces:** ANALYZER_OUTPUTS
214
+ <!-- learning:on -->
206
215
  **Requires:** DIFF_RANGE, ANALYSIS_DIR, ACTIVE_FOCUSES, STATIC_FINDINGS, ACCEPTANCE_RULES, PLAN_CONTEXT, DECISIONS_CONTEXT, FEATURE_KNOWLEDGE
216
+ <!-- learning:off -->
217
+ **Requires:** DIFF_RANGE, ANALYSIS_DIR, ACTIVE_FOCUSES, STATIC_FINDINGS, ACCEPTANCE_RULES, PLAN_CONTEXT, FEATURE_KNOWLEDGE
218
+ <!-- learning:end -->
207
219
 
208
220
  Spawn ALL active Diagnose agents **in a single message** (parallel, NOT background):
209
221
 
@@ -216,11 +228,15 @@ DIFF_COMMAND: git diff {DIFF_RANGE}
216
228
  ACCEPTANCE_RULES: {ACCEPTANCE_RULES filtered to this focus type, or (none)}
217
229
  PLAN_CONTEXT: {PLAN_CONTEXT}
218
230
  STATIC_FINDINGS: {STATIC_FINDINGS if focus == security, else (none)}
231
+ <!-- learning:on -->
219
232
  DECISIONS_CONTEXT: {DECISIONS_CONTEXT}
233
+ <!-- learning:end -->
220
234
  FEATURE_KNOWLEDGE: {FEATURE_KNOWLEDGE}
221
235
  PR_DESCRIPTION: <pr-description>{PR_DESCRIPTION}</pr-description>
222
236
  OUTPUT_PATH: {ANALYSIS_DIR}/{focus}.md
237
+ <!-- learning:on -->
223
238
  Follow devflow:apply-decisions to Read full ADR/PF bodies on demand.
239
+ <!-- learning:end -->
224
240
  Follow devflow:apply-feature-knowledge for FEATURE_KNOWLEDGE.
225
241
  IMPORTANT: Write report to {ANALYSIS_DIR}/{focus}.md using Write tool"
226
242
  ```
@@ -299,7 +315,9 @@ Run `/resolve` to process and fix these findings.
299
315
  │ Write static-findings.md
300
316
  │
301
317
  ├─ Phase 3: Context Loading
318
+ <!-- learning:on -->
302
319
  │ ├─ index.md (pre-rendered) → DECISIONS_CONTEXT
320
+ <!-- learning:end -->
303
321
  │ ├─ Feature knowledge load → FEATURE_KNOWLEDGE
304
322
  │ └─ {worktree}/.devflow/docs/design/*.md → PLAN_CONTEXT + ACCEPTANCE_RULES
305
323
  │
@@ -356,7 +374,11 @@ Before reporting results, verify every phase was executed:
356
374
 
357
375
  - [ ] Phase 1: Pre-flight → BRANCH_INFO captured, PR_DESCRIPTION fetched (or `(none)`)
358
376
  - [ ] Phase 2: Static Analysis → STATIC_FINDINGS captured (or `(none)` if skipped/no tools/no findings); ANALYSIS_DIR created; CHANGED_FILES populated
377
+ <!-- learning:on -->
359
378
  - [ ] Phase 3: Context Loading → DECISIONS_CONTEXT captured, FEATURE_KNOWLEDGE loaded (or `(none)`), PLAN_CONTEXT and ACCEPTANCE_RULES captured (or `(none)`)
379
+ <!-- learning:off -->
380
+ - [ ] Phase 3: Context Loading → FEATURE_KNOWLEDGE loaded (or `(none)`), PLAN_CONTEXT and ACCEPTANCE_RULES captured (or `(none)`)
381
+ <!-- learning:end -->
360
382
  - [ ] Phase 4: File Analysis → ACTIVE_FOCUSES determined (security + functional always present)
361
383
  - [ ] Phase 5: Parallel Bug Analysis → ANALYZER_OUTPUTS captured per active focus; all reports written to ANALYSIS_DIR
362
384
  - [ ] Phase 6: Synthesis → BUG_ANALYSIS_SUMMARY written to `{ANALYSIS_DIR}/bug-analysis-summary.md`
@@ -7,6 +7,7 @@ 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
+ @import "./_partials/_settings.mds" as settings
10
11
  # Code Review Command
11
12
 
12
13
  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.
@@ -40,6 +41,8 @@ Run a comprehensive code review of the current branch by spawning parallel revie
40
41
 
41
42
  **Produces:** COMPLIANCE_ACTIVE, COMPLIANCE_FRAMEWORKS
42
43
 
44
+ {{settings.settings_resolve()}}
45
+
43
46
  {{compliance_gate()}}
44
47
  Keep each worktree's values for every downstream phase of that worktree.
45
48
 
@@ -164,10 +167,48 @@ For each reviewable worktree, call:
164
167
 
165
168
  ### Phase 1: Analyze Changed Files
166
169
 
167
- **Produces:** REVIEW_FOCUS_LIST
168
- **Requires:** DIFF_RANGE, COMPLIANCE_ACTIVE (from Step 0b)
170
+ **Produces:** REVIEW_FOCUS_LIST, DIFF_CLASS, DIFF_FILES
171
+ **Requires:** DIFF_RANGE, REVIEW_DIR, COMPLIANCE_ACTIVE (from Step 0b)
172
+
173
+ Per worktree, in order. Each `git` command here writes to a file and prints nothing.
174
+
175
+ #### Step 1.1: Classify the diff
176
+
177
+ **Produces:** DIFF_CLASS, CHANGED_PATHS, REVIEW_FOCUS_LIST (reduced classes)
178
+ **Requires:** DIFF_RANGE, REVIEW_DIR
179
+
180
+ List the changed paths into `{REVIEW_DIR}/paths.txt` and print only the line count (drop `-C "{WORKTREE_PATH}"` when there is no `WORKTREE_PATH`):
181
+
182
+ ```bash
183
+ git -C "{WORKTREE_PATH}" diff --name-only --no-renames {DIFF_RANGE} > "{REVIEW_DIR}/paths.txt"
184
+ wc -l < "{REVIEW_DIR}/paths.txt"
185
+ ```
186
+
187
+ 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.
188
+
189
+ Set `DIFF_CLASS` by these rules, in order; the first that decides wins:
190
+
191
+ 1. **Instruction and config paths are `code`.** Any changed path that is `CLAUDE.md`, `AGENTS.md`, under `.claude/` or `src/assets/`, a `*.mds` file, under a plugin's `agents/`, `skills/` or `commands/` directory, `.devflow/project.json`, `.devflow/conventions.md`, or a manifest or build file (`package.json`, `go.mod`, `Cargo.toml`, `pyproject.toml`, `requirements*.txt`, `CMakeLists.txt`). This rule runs first, so a diff made only of such files is `code` and never `docs-only`.
192
+ 2. **`docs-only`.** Every changed path matches `*.md`, `*.mdx`, `*.rst`, `*.txt`, `docs/**` or `CHANGELOG*`.
193
+ 3. **`tests-only`.** Every changed path matches `tests/**`, `**/__tests__/**`, `*.test.*`, `*.spec.*`, `*_test.go`, `test_*.py` or `*_test.py`.
194
+ 4. **`lockfile-only`.** Every changed path is `package-lock.json`, `pnpm-lock.yaml`, `yarn.lock`, `bun.lockb`, `Cargo.lock`, `go.sum`, `poetry.lock`, `uv.lock`, `Gemfile.lock` or `composer.lock`.
195
+ 5. **Mixed non-code.** Every changed path matches the docs, tests or lockfile patterns, but no single rule above holds (docs with tests, tests with a lockfile): `DIFF_CLASS` names each class involved.
196
+ 6. **Fail-safe is `code`.** A changed path that matches no class pattern makes the diff `code`, and so does an empty path list. A manifest change is `code` and never `lockfile-only`.
197
+
198
+ Each reduced class runs only its focus set, every member reading `diff.patch`:
199
+
200
+ - `docs-only`: documentation, consistency, security
201
+ - `tests-only`: testing, reliability, consistency, security
202
+ - `lockfile-only`: dependencies, security
203
+
204
+ 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.
169
205
 
170
- Per worktree, detect file types in diff using `DIFF_RANGE` to determine conditional reviews.
206
+ #### Step 1.2: Choose the focuses
207
+
208
+ **Produces:** REVIEW_FOCUS_LIST (code class)
209
+ **Requires:** DIFF_CLASS, CHANGED_PATHS, COMPLIANCE_ACTIVE
210
+
211
+ When `DIFF_CLASS` is `code`, read the file types from the paths in `paths.txt` to determine conditional reviews:
171
212
 
172
213
  | Condition | Adds Review |
173
214
  |-----------|-------------|
@@ -186,57 +227,104 @@ Per worktree, detect file types in diff using `DIFF_RANGE` to determine conditio
186
227
 
187
228
  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
229
 
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:
230
+ **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`:
231
+
232
+ Installed language focuses: (none)
233
+
234
+ 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.
235
+
236
+ #### Step 1.3: Write the diff files
237
+
238
+ **Produces:** DIFF_FILES
239
+ **Requires:** DIFF_RANGE, REVIEW_DIR, REVIEW_FOCUS_LIST
240
+
241
+ Write `diff.patch` once per worktree, by redirect:
190
242
 
191
243
  ```bash
192
- d="${CLAUDE_CONFIG_DIR:-}"; case "$d" in /*) ;; *) d="$HOME/.claude" ;; esac; test -f "$d/skills/devflow:{focus}/SKILL.md"; echo "exit=$?"
244
+ git -C "{WORKTREE_PATH}" diff --no-color --no-ext-diff --no-textconv {DIFF_RANGE} > "{REVIEW_DIR}/diff.patch"
193
245
  ```
194
246
 
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.
247
+ It holds the whole diff of `DIFF_RANGE`. On a `code` diff, add one patch for each language focus in REVIEW_FOCUS_LIST, by the same command with quoted pathspecs from this table:
196
248
 
249
+ ```bash
250
+ git -C "{WORKTREE_PATH}" diff --no-color --no-ext-diff --no-textconv {DIFF_RANGE} -- '<pathspec>' ... > "{REVIEW_DIR}/diff-{focus}.patch"
251
+ ```
252
+
253
+ | Focus | Pathspecs |
254
+ |-------|-----------|
255
+ | typescript | `'*.ts' '*.tsx'` |
256
+ | react, accessibility | `'*.tsx' '*.jsx'` |
257
+ | ui-design | `'*.tsx' '*.jsx' '*.css' '*.scss'` |
258
+ | go | `'*.go'` |
259
+ | java | `'*.java'` |
260
+ | python | `'*.py'` |
261
+ | rust | `'*.rs'` |
262
+
263
+ The core, database, dependencies, documentation and compliance focuses, and every reduced-class focus, read `diff.patch`. A language focus sees only its own extensions and reaches anything else through `DIFF_RANGE`. Set `DIFF_FILES` to the files written. They live in `REVIEW_DIR`, under the gitignored `.devflow/` tree, with `paths.txt`: never committed, posted or passed to the Git agent.
264
+
265
+ <!-- learning:on -->
197
266
  ### Phase 1b: Load Decisions Index
267
+ <!-- learning:off -->
268
+ ### Phase 1b: Load Context
269
+ <!-- learning:end -->
198
270
 
199
- **Produces:** DECISIONS_CONTEXT, FEATURE_KNOWLEDGE, COMPLIANCE_FRAMEWORKS (carried from Step 0b)
271
+ <!-- learning:on -->
272
+ **Produces:** DECISIONS_CONTEXT, FEATURE_KNOWLEDGE, FEATURE_KNOWLEDGE_RULES, COMPLIANCE_FRAMEWORKS (carried from Step 0b)
273
+ <!-- learning:off -->
274
+ **Produces:** FEATURE_KNOWLEDGE, FEATURE_KNOWLEDGE_RULES, COMPLIANCE_FRAMEWORKS (carried from Step 0b)
275
+ <!-- learning:end -->
200
276
 
201
277
  {{decisions_load()}}
202
-
278
+ <!-- learning:on -->
203
279
  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.
204
280
 
281
+ <!-- learning:end -->
205
282
  {{knowledge_load()}}
206
283
 
284
+ <!-- learning:on -->
207
285
  Pass `FEATURE_KNOWLEDGE` to all Review agents alongside `DECISIONS_CONTEXT`.
286
+ <!-- learning:off -->
287
+ Pass `FEATURE_KNOWLEDGE` to all Review agents.
288
+ <!-- learning:end -->
208
289
 
209
290
  ### Phase 2: Run Reviews (Parallel)
210
291
 
211
292
  **Produces:** REVIEW_FOCUS_OUTPUTS
212
- **Requires:** DIFF_RANGE, REVIEW_DIR, TIMESTAMP, DECISIONS_CONTEXT, FEATURE_KNOWLEDGE, PR_DESCRIPTION, PRIOR_RESOLUTIONS, REVIEW_FOCUS_LIST
213
-
214
- Spawn Review agents **in a single message**. Always run 8 core reviews; conditionally add more based on changed file types (max 20 per worktree):
215
-
216
- | Focus | Always | Pattern Skill |
217
- |-------|--------|---------------|
218
- | security | ✓ | devflow:security |
219
- | architecture | ✓ | devflow:architecture |
220
- | performance | ✓ | devflow:performance |
221
- | complexity | ✓ | devflow:complexity |
222
- | consistency | ✓ | devflow:consistency |
223
- | regression | ✓ | devflow:regression |
224
- | testing | ✓ | devflow:testing |
225
- | reliability | ✓ | devflow:reliability |
226
- | typescript | presence-gated | devflow:typescript |
227
- | react | presence-gated | devflow:react |
228
- | accessibility | presence-gated | devflow:accessibility |
229
- | ui-design | presence-gated | devflow:ui-design |
230
- | go | presence-gated | devflow:go |
231
- | java | presence-gated | devflow:java |
232
- | python | presence-gated | devflow:python |
233
- | rust | presence-gated | devflow:rust |
234
- | database | conditional | devflow:database |
235
- | dependencies | conditional | devflow:dependencies |
236
- | documentation | conditional | devflow:documentation |
237
- | compliance | diff-driven | devflow:compliance |
238
-
239
- Review agent count: 8 always-active, +1-12 diff-driven conditional (max 20 total per worktree).
293
+ <!-- learning:on -->
294
+ **Requires:** DIFF_RANGE, REVIEW_DIR, TIMESTAMP, DECISIONS_CONTEXT, FEATURE_KNOWLEDGE, PR_DESCRIPTION, PRIOR_RESOLUTIONS, REVIEW_FOCUS_LIST, DIFF_CLASS, DIFF_FILES
295
+ <!-- learning:off -->
296
+ **Requires:** DIFF_RANGE, REVIEW_DIR, TIMESTAMP, FEATURE_KNOWLEDGE, PR_DESCRIPTION, PRIOR_RESOLUTIONS, REVIEW_FOCUS_LIST, DIFF_CLASS, DIFF_FILES
297
+ <!-- learning:end -->
298
+
299
+ Spawn Review agents **in a single message**, for the focus set `DIFF_CLASS` selects (max 20 per worktree):
300
+
301
+ - `code`: the 8 core reviews on the full `diff.patch`, plus the language and conditional focuses Phase 1 added.
302
+ - `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.
303
+
304
+ | Focus | Runs | Pattern Skill | DIFF_FILE |
305
+ |-------|------|---------------|-----------|
306
+ | security | ✓ | devflow:security | diff.patch |
307
+ | architecture | ✓ | devflow:architecture | diff.patch |
308
+ | performance | ✓ | devflow:performance | diff.patch |
309
+ | complexity | ✓ | devflow:complexity | diff.patch |
310
+ | consistency | ✓ | devflow:consistency | diff.patch |
311
+ | regression | ✓ | devflow:regression | diff.patch |
312
+ | testing | ✓ | devflow:testing | diff.patch |
313
+ | reliability | ✓ | devflow:reliability | diff.patch |
314
+ | typescript | stamp-gated | devflow:typescript | diff-typescript.patch |
315
+ | react | stamp-gated | devflow:react | diff-react.patch |
316
+ | accessibility | stamp-gated | devflow:accessibility | diff-accessibility.patch |
317
+ | ui-design | stamp-gated | devflow:ui-design | diff-ui-design.patch |
318
+ | go | stamp-gated | devflow:go | diff-go.patch |
319
+ | java | stamp-gated | devflow:java | diff-java.patch |
320
+ | python | stamp-gated | devflow:python | diff-python.patch |
321
+ | rust | stamp-gated | devflow:rust | diff-rust.patch |
322
+ | database | conditional | devflow:database | diff.patch |
323
+ | dependencies | conditional | devflow:dependencies | diff.patch |
324
+ | documentation | conditional | devflow:documentation | diff.patch |
325
+ | compliance | diff-driven | devflow:compliance | diff.patch |
326
+
327
+ 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.
240
328
 
241
329
  Each Review agent invocation (all in one message, **NOT background**):
242
330
  ```
@@ -245,14 +333,19 @@ Agent(subagent_type="Review", run_in_background=false):
245
333
  Follow 6-step process from devflow:review-methodology.
246
334
  PR: #{pr_number}, Base: {base_branch}
247
335
  WORKTREE_PATH: {worktree_path} (omit if cwd)
248
- DIFF_COMMAND: git -C {WORKTREE_PATH} diff {DIFF_RANGE} (omit -C flag if no WORKTREE_PATH)
336
+ DIFF_FILE: {diff_file} (absolute: {REVIEW_DIR}/diff.patch, or {REVIEW_DIR}/diff-{focus}.patch for a language focus, per the table)
337
+ DIFF_RANGE: {DIFF_RANGE} (information only)
338
+ <!-- learning:on -->
249
339
  DECISIONS_CONTEXT: {decisions_context}
340
+ <!-- learning:end -->
250
341
  FEATURE_KNOWLEDGE: {feature_knowledge}
251
342
  PR_DESCRIPTION: <pr-description>{pr_description}</pr-description>
252
343
  PRIOR_RESOLUTIONS: <prior-resolution-summary>{prior_resolutions}</prior-resolution-summary>
253
344
  COMPLIANCE_FRAMEWORKS: {COMPLIANCE_FRAMEWORKS} (compliance focus only)
254
345
  If PRIOR_RESOLUTIONS is not (none), follow Cross-Cycle Awareness in review.md.
346
+ <!-- learning:on -->
255
347
  Follow devflow:apply-decisions to scan the index and Read full ADR/PF bodies on demand.
348
+ <!-- learning:end -->
256
349
  Follow devflow:apply-feature-knowledge for FEATURE_KNOWLEDGE — feature-specific patterns and anti-patterns inform findings.
257
350
  IMPORTANT: Write report to {worktree_path}/.devflow/docs/reviews/{branch-slug}/{timestamp}/{focus}.md using Write tool"
258
351
  ```
@@ -325,13 +418,15 @@ In multi-worktree mode, report results per worktree.
325
418
  ├─ Per worktree (SEQUENTIAL — one worktree at a time):
326
419
  │ │
327
420
  │ ├─ Phase 1: Analyze changed files
328
- │ │ └─ Detect file types for conditional reviews
421
+ │ │ ├─ Classify the diff (paths.txt → DIFF_CLASS)
422
+ │ │ ├─ Choose the focuses (code class: file types + the language stamp)
423
+ │ │ └─ Write diff.patch and diff-{focus}.patch, by redirect
329
424
  │ │
330
425
  │ ├─ Phase 2: Reviews (PARALLEL within worktree)
331
- │ │ ├─ Review agent: security
332
- │ │ ├─ Review agent: architecture, performance, complexity
333
- │ │ ├─ Review agent: consistency, regression, testing
334
- │ │ └─ Review agent: [conditional]
426
+ │ │ ├─ code: Review agents security, architecture, performance, complexity,
427
+ │ │ │ consistency, regression, testing, reliability (diff.patch)
428
+ │ │ ├─ code: + language (diff-{focus}.patch) and conditional Review agents
429
+ │ │ └─ docs-only / tests-only / lockfile-only: the reduced set (diff.patch)
335
430
  │ │
336
431
  │ ├─ Phase 3: Synthesis → Review Comment (SEQUENTIAL within worktree)
337
432
  │ │ ├─ Step 3a: Synthesize agent (mode: review, writes review-summary.md)
@@ -360,6 +455,14 @@ In multi-worktree mode, report results per worktree.
360
455
  | `--full` flag | Bypass incremental detection (Step 0d), still load PRIOR_RESOLUTIONS for cross-cycle awareness |
361
456
  | Parsing failure on resolution-summary.md | fp_ratio = 0, convergence tracking degraded (see Step 0e-ii) |
362
457
  | Concurrent sessions | Advisory only, each session computes independently |
458
+ | Docs-only diff | `docs-only`: documentation, consistency, security on `diff.patch`; no language or conditional focus |
459
+ | Tests-only diff | `tests-only`: testing, reliability, consistency, security on `diff.patch`; no language or conditional focus |
460
+ | Lockfile-only diff | `lockfile-only`: dependencies, security on `diff.patch` |
461
+ | Mixed non-code diff (docs with tests, tests with a lockfile) | The union of the matching sets, on `diff.patch` |
462
+ | A path matching no class pattern, or an empty path list | `code` (fail-safe): the 8 core focuses on the full diff |
463
+ | A file moved across classes | `--no-renames` lists the old and the new path, so a code path makes the diff `code` |
464
+ | Path listing above about 40 lines | The count is printed; `paths.txt` is read in ranges of about 40 lines |
465
+ | Language files changed, plugin not installed | The focus is absent from the stamped line: not spawned |
363
466
  | Public repo (`auto` mode) | Git agent probes visibility, posts counts-only STUB comment; full report stays local |
364
467
  | `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 |
365
468
 
@@ -370,9 +473,9 @@ In multi-worktree mode, report results per worktree.
370
473
 
371
474
  ## Principles
372
475
 
373
- 1. **Orchestration only** - Command spawns agents, doesn't do git/review work itself
476
+ 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
374
477
  2. **Parallel, not background** - Multiple agents in one message, but `run_in_background=false` so phases complete before proceeding
375
- 3. **Git agent for git work** - All git operations go through Git agent
478
+ 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
376
479
  4. **Clear ownership** - Each agent owns its output completely
377
480
  5. **Honest reporting** - Display agent outputs directly
378
481
  6. **Incremental by default** - Only review new changes unless `--full` specified
@@ -5,6 +5,7 @@ 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
+ @import "./_partials/_settings.mds" as settings
8
9
  # Debug Command
9
10
 
10
11
  Investigate bugs by spawning parallel agents, each pursuing a different hypothesis. Evidence is aggregated and synthesized to identify the root cause.
@@ -32,20 +33,31 @@ $ARGUMENTS
32
33
 
33
34
  ## Phases
34
35
 
36
+ <!-- learning:on -->
35
37
  ### Phase 1: Load Decisions Index (Orchestrator-Local)
38
+ <!-- learning:off -->
39
+ ### Phase 1: Resolve Settings
40
+ <!-- learning:end -->
36
41
 
42
+ <!-- learning:on -->
37
43
  **Produces:** DECISIONS_CONTEXT
38
44
 
39
- {{decisions_load()}}
45
+ <!-- learning:end -->
46
+ {{settings.settings_resolve()}}
40
47
 
48
+ {{decisions_load()}}
49
+ <!-- learning:on -->
41
50
  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.
42
51
 
52
+ <!-- learning:end -->
43
53
  **No up-front feature knowledge load** — debug investigation workers read code directly to avoid confirmation bias. Feature knowledge is only written back at the end if the investigation surfaced durable, cross-cutting knowledge.
44
54
 
45
55
  ### Phase 2: Context Gathering
46
56
 
47
57
  **Produces:** HYPOTHESES, BUG_CONTEXT
58
+ <!-- learning:on -->
48
59
  **Requires:** DECISIONS_CONTEXT
60
+ <!-- learning:end -->
49
61
 
50
62
  If `COMMAND_INPUT` opens with a candidate issue reference, fetch the issue:
51
63
 
@@ -193,7 +205,11 @@ Ask user via AskUserQuestion: "Want me to implement this fix?"
193
205
  ```
194
206
  /debug (orchestrator)
195
207
  │
208
+ <!-- learning:on -->
196
209
  ├─ Phase 1: Load Decisions Index (Orchestrator-Local)
210
+ <!-- learning:off -->
211
+ ├─ Phase 1: Resolve Settings
212
+ <!-- learning:end -->
197
213
  │ └─ No up-front feature knowledge load (avoids confirmation bias in investigators)
198
214
  │
199
215
  ├─ Phase 2: Context gathering
@@ -3,7 +3,7 @@ description: Dependency-aware build engine — implement, review, and verify a s
3
3
  argument-hint: "[ticket | issue-url | plan-doc]"
4
4
  output-dir: dist/commands
5
5
  ---
6
- @import { authoring_preamble } from "./_partials/_preamble.mds"
6
+ @import { authoring_preamble, authoring_decisions } from "./_partials/_preamble.mds"
7
7
  @import { evidence_policy } from "./_partials/_evidence_policy.mds"
8
8
  @import { docs_root } from "./_partials/_docs_root.mds"
9
9
  @import { agent_roster, agent_caveats } from "./_partials/_roster.mds"
@@ -13,8 +13,14 @@ output-dir: dist/commands
13
13
  @import { issue_ref_grammar, issue_capture_contract } from "./_partials/_tracker.mds"
14
14
  @import "./_partials/_publication.mds" as pub
15
15
  @import "./_partials/_compliance.mds" as compliance
16
+ @import "./_partials/_settings.mds" as settings
16
17
  {{authoring_preamble()}}
17
18
 
19
+ ### Settings line
20
+
21
+ {{settings.settings_resolve()}}
22
+
23
+ {{authoring_decisions()}}
18
24
  ---
19
25
 
20
26
  ## dynamic-build — author and run a build workflow
@@ -69,10 +75,12 @@ Pass it as `complianceFrameworks` when invoking the workflow; the engine hands i
69
75
 
70
76
  `{integration worktree root}` is the toplevel of the checkout the integration branch is checked out in: `{worktree}` unless the wave runs in a linked worktree.
71
77
 
78
+ <!-- learning:on -->
72
79
  **1. Apply decisions context**
73
80
 
74
- Apply the `devflow:apply-decisions` algorithm to the DECISIONS_CONTEXT loaded per the preamble above: scan the index, Read relevant entries, note the verbatim ADR/PF IDs you will inject into Code agent and Evaluate agent prompts.
81
+ Apply the `devflow:apply-decisions` algorithm to the DECISIONS_CONTEXT loaded by the decisions step above: scan the index, Read relevant entries, note the verbatim ADR/PF IDs you will inject into Code agent prompts.
75
82
 
83
+ <!-- learning:end -->
76
84
  **2. Read budget**
77
85
 
78
86
  Note the `budget` value from the Workflow tool context (or default to "medium" if not provided). This governs Review agent roster size and verification vote count.
@@ -150,7 +158,9 @@ const TICKET = args.ticket || args[0] || "see task description";
150
158
  const PLAN = args.plan || null;
151
159
  const CRITERIA = args.criteria || null;
152
160
  const TEST_PLAN = args.testPlan || null; // the plan's checked TP lines, one string (Pre-authoring step 4)
161
+ <!-- learning:on -->
153
162
  const DECISIONS_CONTEXT = args.decisionsContext || ""; // injected before authoring
163
+ <!-- learning:end -->
154
164
  const ISSUE_INPUT = args.issueInput || args.issueNumber || "(none)"; // this ticket's OWN raw reference (Pre-authoring step 5; a wave passes issueInput) — setup-task's input, never a Code agent's
155
165
  const ISSUE_REQUIRED = String(args.issueRequired) === "false" ? "false" : "true"; // Pre-authoring step 0; only an explicit false turns it off — absent or unrecognised fails closed, like the resolver
156
166
  const APPLY_CONVENTIONS = String(args.applyConventions) === "false" ? "false" : "true";
@@ -194,9 +204,11 @@ ${TICKET}
194
204
 
195
205
  ${PLAN ? `Implementation plan:\n${PLAN}` : "No plan provided — use best judgment."}
196
206
 
207
+ <!-- learning:on -->
197
208
  Relevant architectural decisions (apply devflow:apply-decisions algorithm):
198
209
  ${DECISIONS_CONTEXT}
199
210
 
211
+ <!-- learning:end -->
200
212
  ISSUE_NUMBER: ${ISSUE_NUMBER}
201
213
  ISSUE_PR_LINK: ${ISSUE_PR_LINK}
202
214
  COMPLIANCE_FRAMEWORKS: ${COMPLIANCE_FRAMEWORKS}
@@ -233,6 +245,9 @@ Return: {"verdict": "PASS" | "FAIL", "details": "..."}`, { agentType: "Validate"
233
245
  await agent(`OPERATION: validation-fix
234
246
  Fix the validation failures on branch ${BRANCH}:
235
247
  ${failureDetails}
248
+ <!-- learning:on -->
249
+ DECISIONS_CONTEXT: ${DECISIONS_CONTEXT}
250
+ <!-- learning:end -->
236
251
  ISSUE_NUMBER: ${ISSUE_NUMBER}
237
252
  ISSUE_PR_LINK: ${ISSUE_PR_LINK}
238
253
  COMPLIANCE_FRAMEWORKS: ${COMPLIANCE_FRAMEWORKS}
@@ -275,6 +290,9 @@ Return: {"verdict": "PASS" | "FAIL", "rationale": "..."} — FAIL if either answ
275
290
  await agent(`OPERATION: alignment-fix
276
291
  Fix the alignment issues identified by the Evaluate agent on branch ${BRANCH}:
277
292
  ${evaluation?.rationale || "see the Evaluate agent's report"}
293
+ <!-- learning:on -->
294
+ DECISIONS_CONTEXT: ${DECISIONS_CONTEXT}
295
+ <!-- learning:end -->
278
296
  ISSUE_NUMBER: ${ISSUE_NUMBER}
279
297
  ISSUE_PR_LINK: ${ISSUE_PR_LINK}
280
298
  COMPLIANCE_FRAMEWORKS: ${COMPLIANCE_FRAMEWORKS}
@@ -296,6 +314,9 @@ Cover: functionality, API contracts, performance, and cover every TEST_PLAN scen
296
314
  await agent(`OPERATION: qa-fix
297
315
  Fix the failing acceptance test scenarios on branch ${BRANCH}:
298
316
  ${testResult.failures}
317
+ <!-- learning:on -->
318
+ DECISIONS_CONTEXT: ${DECISIONS_CONTEXT}
319
+ <!-- learning:end -->
299
320
  ISSUE_NUMBER: ${ISSUE_NUMBER}
300
321
  ISSUE_PR_LINK: ${ISSUE_PR_LINK}
301
322
  COMPLIANCE_FRAMEWORKS: ${COMPLIANCE_FRAMEWORKS}
@@ -415,6 +436,9 @@ ISSUES:
415
436
  ${chunk.map((f, n) => `${n + 1}. ${f.file ? `${f.file}${f.line ? `:${f.line}` : ""} — ` : ""}${f.description} (${f.severity})`).join("\n")}
416
437
  SCOPE: ${chunk.map((f, n) => `${n + 1}=${CAREFUL_SEVERITIES.has(String(f.severity).toLowerCase()) ? "Careful" : "Standard"}`).join(", ")}
417
438
  PUSH: false
439
+ <!-- learning:on -->
440
+ DECISIONS_CONTEXT: ${DECISIONS_CONTEXT}
441
+ <!-- learning:end -->
418
442
  ISSUE_NUMBER: ${ISSUE_NUMBER}
419
443
  ISSUE_PR_LINK: ${ISSUE_PR_LINK}
420
444
  COMPLIANCE_FRAMEWORKS: ${COMPLIANCE_FRAMEWORKS}
@@ -475,6 +499,9 @@ Return: {"verdict": "PASS" | "FAIL", "details": "..."}`, { agentType: "Validate"
475
499
  await agent(`OPERATION: validation-fix
476
500
  Fix the final validation failures on branch ${BRANCH}:
477
501
  ${failureDetails}
502
+ <!-- learning:on -->
503
+ DECISIONS_CONTEXT: ${DECISIONS_CONTEXT}
504
+ <!-- learning:end -->
478
505
  ISSUE_NUMBER: ${ISSUE_NUMBER}
479
506
  ISSUE_PR_LINK: ${ISSUE_PR_LINK}
480
507
  COMPLIANCE_FRAMEWORKS: ${COMPLIANCE_FRAMEWORKS}
@@ -604,7 +631,11 @@ Return: {"ready": [...ticket-ids], "blocked": [{"ticket": "id", "namedBlocker":
604
631
  try {
605
632
  // ticketId is the ISSUE_REF the pre-fetch heading printed — this ticket's OWN reference: the engine's `ticket` (its TICKET)
606
633
  // and its setup-task ISSUE_INPUT; the engine returns the branch that setup-task created, merged below; plans[ticketId] is its own plan, criteria and checked testPlan (Pre-authoring step 4)
634
+ <!-- learning:on -->
607
635
  const engineResult = await runSingleTicketEngine({ ticket: ticketId, baseBranch: INTEGRATION_BRANCH, ...(plans[ticketId] || {}), decisionsContext: DECISIONS_CONTEXT, issueRequired: ISSUE_REQUIRED, applyConventions: APPLY_CONVENTIONS, complianceFrameworks: COMPLIANCE_FRAMEWORKS, issueInput: ticketId });
636
+ <!-- learning:off -->
637
+ const engineResult = await runSingleTicketEngine({ ticket: ticketId, baseBranch: INTEGRATION_BRANCH, ...(plans[ticketId] || {}), issueRequired: ISSUE_REQUIRED, applyConventions: APPLY_CONVENTIONS, complianceFrameworks: COMPLIANCE_FRAMEWORKS, issueInput: ticketId });
638
+ <!-- learning:end -->
608
639
  // Check both verdict (engine_output_schema) and overallVerdict (SINGLE skeleton alias).
609
640
  // PASS and UNVERIFIED merge; PARTIAL, FAIL, ESCALATED (the ticket-link and branch stops included) or no verdict quarantine.
610
641
  if (["PASS", "UNVERIFIED"].includes(engineResult.verdict || engineResult.overallVerdict)) {