devflow-kit 3.3.0 → 3.5.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.
- package/CHANGELOG.md +47 -0
- package/README.md +8 -4
- package/dist/agents/code-edit.md +133 -0
- package/dist/agents/code-fix.md +165 -0
- package/dist/agents/code.md +187 -0
- package/{src/assets → dist}/agents/design.md +1 -2
- package/{src/assets → dist}/agents/diagnose.md +1 -2
- package/dist/agents/git.md +33 -722
- package/{src/assets → dist}/agents/knowledge.md +12 -5
- package/{src/assets → dist}/agents/research.md +8 -2
- package/{src/assets → dist}/agents/review.md +8 -11
- package/{src/assets → dist}/agents/scrutinize.md +4 -1
- package/dist/agents/skim.md +152 -0
- package/{src/assets → dist}/agents/triage.md +9 -2
- package/dist/cli/commands/behavior-prompts.js +77 -0
- package/dist/cli/commands/behavior.js +123 -0
- package/dist/cli/commands/flags.js +8 -2
- package/dist/cli/commands/init-seed.js +7 -3
- package/dist/cli/commands/init.js +134 -5
- package/dist/cli/commands/learning.js +38 -3
- package/dist/cli/commands/rules.js +16 -0
- package/dist/cli/commands/tracker.js +112 -15
- package/dist/cli/commands/uninstall.js +42 -1
- package/dist/cli.js +2 -0
- package/dist/commands/bug-analysis.md +35 -13
- package/dist/commands/code-review.md +155 -69
- package/dist/commands/debug.md +39 -16
- package/dist/commands/dynamic-build.md +61 -72
- package/dist/commands/dynamic-plan.md +39 -25
- package/dist/commands/dynamic-profile.md +28 -14
- package/dist/commands/dynamic-tickets.md +38 -22
- package/dist/commands/explore.md +18 -16
- package/dist/commands/implement.md +121 -150
- package/dist/commands/plan.md +51 -31
- package/dist/commands/release.md +72 -6
- package/dist/commands/research.md +49 -20
- package/dist/commands/resolve.md +54 -46
- package/dist/commands/self-review.md +38 -25
- package/dist/core/agent-frontmatter.js +101 -0
- package/dist/core/agent-models.js +43 -0
- package/dist/core/assets.js +55 -10
- package/dist/core/claude-md-audit.js +190 -0
- package/dist/core/compliance-compose.js +6 -4
- package/dist/core/feature-switch.js +41 -1
- package/dist/core/flags.js +139 -0
- package/dist/core/fs-atomic.js +8 -3
- package/dist/core/learning-variants.js +213 -0
- package/dist/core/manifest.js +73 -3
- package/dist/core/mds-variants.js +98 -19
- package/dist/core/plugins.js +111 -72
- package/dist/core/project-paths.js +0 -4
- package/dist/core/proxy-log.js +1 -1
- package/dist/core/proxy-state.js +1 -1
- package/dist/core/tracker.js +120 -2
- package/dist/learning-off/agents/code-edit.md +129 -0
- package/dist/learning-off/agents/code-fix.md +161 -0
- package/dist/learning-off/agents/code.md +183 -0
- package/dist/learning-off/agents/design.md +118 -0
- package/dist/learning-off/agents/diagnose.md +210 -0
- package/dist/learning-off/agents/knowledge.md +96 -0
- package/dist/learning-off/agents/research.md +155 -0
- package/dist/learning-off/agents/review.md +224 -0
- package/dist/learning-off/agents/scrutinize.md +120 -0
- package/{src/assets → dist/learning-off}/agents/skim.md +5 -8
- package/dist/learning-off/agents/triage.md +170 -0
- package/dist/learning-off/commands/bug-analysis.md +420 -0
- package/dist/learning-off/commands/code-review.md +530 -0
- package/dist/learning-off/commands/debug.md +314 -0
- package/dist/learning-off/commands/dynamic-build.md +1245 -0
- package/dist/learning-off/commands/dynamic-plan.md +426 -0
- package/dist/learning-off/commands/dynamic-profile.md +214 -0
- package/dist/learning-off/commands/dynamic-tickets.md +634 -0
- package/dist/learning-off/commands/explore.md +210 -0
- package/dist/learning-off/commands/implement.md +774 -0
- package/dist/learning-off/commands/plan.md +671 -0
- package/dist/learning-off/commands/release.md +311 -0
- package/dist/learning-off/commands/research.md +229 -0
- package/dist/learning-off/commands/resolve.md +842 -0
- package/dist/learning-off/commands/self-review.md +266 -0
- package/dist/skills/git/references/learn-conventions.md +27 -3
- package/dist/skills/git/references/pr/check-ci-status.md +19 -0
- package/dist/skills/git/references/pr/check-merge-readiness.md +19 -0
- package/dist/skills/git/references/pr/fetch-review-threads.md +30 -0
- package/dist/skills/git/references/pr/post-resolution-summary.md +18 -0
- package/dist/skills/git/references/pr/post-review-summary.md +20 -0
- package/dist/skills/git/references/pr/resolve-review-threads.md +28 -4
- package/dist/skills/git/references/pr/update-pr-evidence.md +13 -0
- package/dist/skills/git/references/pr/validate-branch.md +26 -0
- package/dist/skills/git/references/tracker/_contract.md +33 -0
- package/dist/skills/git/references/tracker/github/associate-release.md +24 -0
- package/dist/skills/git/references/tracker/github/backlink-shipped-issues.md +31 -1
- package/dist/skills/git/references/tracker/github/create-release.md +30 -1
- package/dist/skills/git/references/tracker/github/ensure-pr-ready.md +89 -2
- package/dist/skills/git/references/tracker/github/ensure-traceable-issue.md +16 -1
- package/dist/skills/git/references/tracker/github/fetch-issue.md +38 -1
- package/dist/skills/git/references/tracker/github/fetch-issues-batch.md +49 -1
- package/dist/skills/git/references/tracker/github/gather-release-evidence.md +29 -0
- package/dist/skills/git/references/tracker/github/manage-debt.md +21 -1
- package/dist/skills/git/references/tracker/github/post-wave-report.md +17 -1
- package/dist/skills/git/references/tracker/github/setup-task.md +53 -1
- package/dist/skills/git/references/tracker/jira/associate-release.md +25 -1
- package/dist/skills/git/references/tracker/jira/backlink-shipped-issues.md +31 -1
- package/dist/skills/git/references/tracker/jira/create-release.md +30 -1
- package/dist/skills/git/references/tracker/jira/ensure-pr-ready.md +89 -2
- package/dist/skills/git/references/tracker/jira/ensure-traceable-issue.md +16 -1
- package/dist/skills/git/references/tracker/jira/fetch-issue.md +38 -1
- package/dist/skills/git/references/tracker/jira/fetch-issues-batch.md +49 -1
- package/dist/skills/git/references/tracker/jira/gather-release-evidence.md +29 -0
- package/dist/skills/git/references/tracker/jira/manage-debt.md +21 -1
- package/dist/skills/git/references/tracker/jira/post-wave-report.md +17 -1
- package/dist/skills/git/references/tracker/jira/setup-task.md +55 -3
- package/dist/skills/git/references/tracker/linear/associate-release.md +25 -1
- package/dist/skills/git/references/tracker/linear/backlink-shipped-issues.md +31 -1
- package/dist/skills/git/references/tracker/linear/create-release.md +30 -1
- package/dist/skills/git/references/tracker/linear/ensure-pr-ready.md +89 -2
- package/dist/skills/git/references/tracker/linear/ensure-traceable-issue.md +16 -1
- package/dist/skills/git/references/tracker/linear/fetch-issue.md +38 -1
- package/dist/skills/git/references/tracker/linear/fetch-issues-batch.md +49 -1
- package/dist/skills/git/references/tracker/linear/gather-release-evidence.md +29 -0
- package/dist/skills/git/references/tracker/linear/manage-debt.md +21 -1
- package/dist/skills/git/references/tracker/linear/post-wave-report.md +17 -1
- package/dist/skills/git/references/tracker/linear/setup-task.md +55 -3
- package/dist/targets/claude-code/agent-type-owner.js +164 -0
- package/dist/targets/claude-code/behavior-install.js +111 -0
- package/dist/targets/claude-code/installer.js +140 -37
- package/dist/targets/claude-code/language-stamp.js +185 -0
- package/dist/targets/claude-code/learning-install.js +497 -0
- package/dist/targets/claude-code/tracker-install.js +33 -16
- package/dist/targets/claude-code/tracker-servers.js +107 -0
- package/package.json +4 -3
- package/src/assets/agents/_partials/_code.mds +109 -0
- package/src/assets/agents/code-edit.mds +81 -0
- package/src/assets/agents/code-fix.mds +113 -0
- package/src/assets/agents/code.mds +135 -0
- package/src/assets/agents/design.mds +148 -0
- package/src/assets/agents/diagnose.mds +225 -0
- package/src/assets/agents/evaluate.md +8 -4
- package/src/assets/agents/explore.md +58 -0
- package/src/assets/agents/git.mds +33 -722
- package/src/assets/agents/knowledge.mds +131 -0
- package/src/assets/agents/learning.md +19 -69
- package/src/assets/agents/research.mds +182 -0
- package/src/assets/agents/review.mds +282 -0
- package/src/assets/agents/scrutinize.mds +135 -0
- package/src/assets/agents/simplify.md +3 -0
- package/src/assets/agents/skim.mds +165 -0
- package/src/assets/agents/synthesize.md +26 -352
- package/src/assets/agents/test.md +8 -0
- package/src/assets/agents/tracker.md +20 -7
- package/src/assets/agents/triage.mds +201 -0
- package/src/assets/agents/validate.md +13 -6
- package/src/assets/commands/_partials/_compliance.mds +41 -4
- package/src/assets/commands/_partials/_decisions.mds +33 -2
- package/src/assets/commands/_partials/_engine.mds +14 -6
- package/src/assets/commands/_partials/_knowledge.mds +25 -12
- package/src/assets/commands/_partials/_preamble.mds +34 -10
- package/src/assets/commands/_partials/_publication.mds +5 -4
- package/src/assets/commands/_partials/_roster.mds +4 -3
- package/src/assets/commands/_partials/_settings.mds +13 -5
- package/src/assets/commands/_partials/_wave.mds +9 -1
- package/src/assets/commands/bug-analysis.mds +27 -5
- package/src/assets/commands/code-review.mds +158 -52
- package/src/assets/commands/debug.mds +41 -3
- package/src/assets/commands/dynamic-build.mds +47 -27
- package/src/assets/commands/dynamic-plan.mds +40 -9
- package/src/assets/commands/dynamic-profile.mds +9 -1
- package/src/assets/commands/dynamic-tickets.mds +21 -6
- package/src/assets/commands/explore.mds +28 -2
- package/src/assets/commands/implement.mds +126 -129
- package/src/assets/commands/plan.mds +58 -14
- package/src/assets/commands/{release.md → release.mds} +30 -26
- package/src/assets/commands/research.mds +42 -11
- package/src/assets/commands/resolve.mds +59 -15
- package/src/assets/commands/self-review.mds +30 -5
- package/src/assets/mds/.mdsroot +4 -0
- package/src/assets/mds/git/_ops.mds +383 -0
- package/src/assets/mds/git/_ops_pr.mds +201 -0
- package/src/assets/mds/git/_ops_steps.mds +147 -0
- package/src/assets/mds/git/_pr.mds +39 -44
- package/src/assets/mds/git/_references.mds +6 -3
- package/src/assets/mds/tracker/_common.mds +5 -5
- package/src/assets/mds/tracker/_contract.mds +73 -0
- package/src/assets/mds/tracker/_github.mds +73 -16
- package/src/assets/mds/tracker/_jira.mds +77 -19
- package/src/assets/mds/tracker/_linear.mds +77 -19
- package/src/assets/mds/tracker/_mcp.mds +2 -2
- package/src/assets/mds/tracker/_steps.mds +98 -0
- package/src/assets/rules/behavior.md +6 -0
- package/src/assets/rules/context-economy.md +10 -0
- package/src/assets/rules/go.md +1 -0
- package/src/assets/rules/java.md +1 -0
- package/src/assets/rules/python.md +1 -0
- package/src/assets/rules/rust.md +1 -0
- package/src/assets/rules/typescript.md +1 -0
- package/src/assets/scripts/claude-md-audit.cjs +611 -0
- package/src/assets/scripts/hooks/assets/orchestrator-charter.md +3 -3
- package/src/assets/scripts/hooks/json-helper.cjs +13 -5
- package/src/assets/scripts/hooks/json-parse +34 -10
- package/src/assets/scripts/hooks/lib/project-paths.cjs +0 -6
- package/src/assets/scripts/hooks/session-start-context +315 -7
- package/src/assets/skills/agent-references/SKILL.md +33 -0
- package/src/assets/skills/agent-references/references/learning/maintain.md +71 -0
- package/src/assets/skills/agent-references/references/synthesize/bug-analysis.md +71 -0
- package/src/assets/skills/agent-references/references/synthesize/design.md +36 -0
- package/src/assets/skills/agent-references/references/synthesize/exploration.md +38 -0
- package/src/assets/skills/agent-references/references/synthesize/planning.md +60 -0
- package/src/assets/skills/agent-references/references/synthesize/research.md +61 -0
- package/src/assets/skills/agent-references/references/synthesize/review.md +76 -0
- package/src/assets/skills/apply-decisions/SKILL.md +1 -1
- package/src/assets/skills/apply-feature-knowledge/SKILL.md +5 -5
- package/src/assets/skills/compliance/SKILL.md +1 -1
- package/src/assets/skills/docs-framework/SKILL.md +80 -83
- package/src/assets/skills/docs-framework/references/patterns.md +14 -25
- package/src/assets/skills/docs-framework/references/violations.md +7 -7
- package/src/assets/skills/feature-knowledge/SKILL.md +43 -12
- package/src/assets/skills/gap-analysis/SKILL.md +0 -16
- package/src/assets/skills/gap-analysis/references/compliance.md +19 -0
- package/src/assets/skills/quality-gates/SKILL.md +1 -1
- package/dist/skills/git/references/pr/ensure-pr-ready.md +0 -24
- package/src/assets/agents/code.md +0 -330
|
@@ -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
|
-
|
|
88
|
+
<!-- learning:on -->
|
|
89
|
+
2. Spawn a Code agent whose prompt opens with `OPERATION: implement` and carries `COMPLIANCE_DIRECTIVE` (when it is not empty) and `DECISIONS_CONTEXT`, with FULL intent context:
|
|
90
|
+
<!-- learning:off -->
|
|
91
|
+
2. Spawn a Code agent whose prompt opens with `OPERATION: implement` and carries `COMPLIANCE_DIRECTIVE` (when it is not empty), 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.
|
|
@@ -29,7 +30,7 @@ Run a proactive bug analysis on the current branch by combining static analysis
|
|
|
29
30
|
{{docs_root()}}
|
|
30
31
|
|
|
31
32
|
Render the test-plan block from `/implement`'s evidence file, and from nothing else:
|
|
32
|
-
1. `branch_slug` is `git branch --show-current` with every `/` replaced by `-`.
|
|
33
|
+
1. `branch_slug` is `git -C "{worktree}" branch --show-current` with every `/` replaced by `-`.
|
|
33
34
|
2. Only when `branch_slug` matches `^[A-Za-z0-9._-]{1,200}$` and the file exists, run (the path double-quoted):
|
|
34
35
|
|
|
35
36
|
```bash
|
|
@@ -168,20 +169,27 @@ If no tool produced findings: set `STATIC_FINDINGS` to `(none)`.
|
|
|
168
169
|
|
|
169
170
|
### Phase 3: Context Loading
|
|
170
171
|
|
|
171
|
-
|
|
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
|
-
{{
|
|
181
|
+
{{settings.settings_resolve()}}
|
|
176
182
|
|
|
183
|
+
<!-- learning:end -->
|
|
184
|
+
{{decisions_load()}}
|
|
177
185
|
#### Feature Knowledge
|
|
178
186
|
|
|
179
187
|
{{knowledge_load()}}
|
|
180
188
|
|
|
181
189
|
#### Plan Artifact
|
|
182
190
|
|
|
183
|
-
1. List `{worktree}/.devflow/docs/design/*.md`
|
|
184
|
-
2. Read the most recent file
|
|
191
|
+
1. List the design plans: `{worktree}/.devflow/docs/design/*.md` (a `/plan` artifact) and `{worktree}/.devflow/docs/design/*/*/*-plan.md` (a `/dynamic-plan` per-ticket plan). Sort by timestamp, newest first, and scan the 10 most recent. A `/plan` artifact's timestamp is the `YYYY-MM-DD_HHMM` before its `.md`; a per-ticket plan's is the name of its parent directory. Never sort by file name, which starts with an issue ID or a ticket slug. A per-ticket plan counts only when its `{ticket-slug}` (its file name without `-plan.md`) appears in the worktree's branch name
|
|
192
|
+
2. Read the most recent file that carries an `## Acceptance Criteria` section
|
|
185
193
|
3. Extract `## Acceptance Criteria` section → parse into table: `| ID | Criterion | Type | Testable Condition |`
|
|
186
194
|
4. Set `PLAN_CONTEXT` to plan summary; `ACCEPTANCE_RULES` to the table
|
|
187
195
|
5. If no plan files exist or section not found: `PLAN_CONTEXT=(none)`, `ACCEPTANCE_RULES=(none)`
|
|
@@ -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`
|
|
@@ -4,9 +4,10 @@ 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 { compliance_gate } from "./_partials/_compliance.mds"
|
|
7
|
+
@import { compliance_gate, compliance_focus_inject } 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.
|
|
@@ -28,9 +29,10 @@ Run a comprehensive code review of the current branch by spawning parallel revie
|
|
|
28
29
|
|
|
29
30
|
**Produces:** WORKTREES
|
|
30
31
|
|
|
31
|
-
1. **Discover reviewable worktrees
|
|
32
|
-
- Run `git worktree list --porcelain`
|
|
33
|
-
- Invoke the `devflow:worktree-support` skill, then Read its `references/discovery.md` from the skill's base directory for the full 7-step algorithm; the canonical protected branch list stays in the skill
|
|
32
|
+
1. **Discover reviewable worktrees**:
|
|
33
|
+
- Run `git worktree list --porcelain` and count the worktrees it lists
|
|
34
|
+
- **More than one listed:** Invoke the `devflow:worktree-support` skill, then Read its `references/discovery.md` from the skill's base directory for the full 7-step algorithm; the canonical protected branch list stays in the skill. Parse the list, filter (skip protected/detached/mid-rebase), dedup by branch, sort by recent commit
|
|
35
|
+
- **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
|
|
34
36
|
2. **If `--path` flag provided:** use only that worktree, skip discovery
|
|
35
37
|
**`--path` validation**: Before proceeding, verify the path exists as a directory and appears in `git worktree list` output. If not: report error and stop.
|
|
36
38
|
3. **If only 1 reviewable worktree** (the common case): proceed as single-worktree flow — zero behavior change
|
|
@@ -40,6 +42,8 @@ Run a comprehensive code review of the current branch by spawning parallel revie
|
|
|
40
42
|
|
|
41
43
|
**Produces:** COMPLIANCE_ACTIVE, COMPLIANCE_FRAMEWORKS
|
|
42
44
|
|
|
45
|
+
{{settings.settings_resolve()}}
|
|
46
|
+
|
|
43
47
|
{{compliance_gate()}}
|
|
44
48
|
Keep each worktree's values for every downstream phase of that worktree.
|
|
45
49
|
|
|
@@ -55,9 +59,9 @@ Keep each worktree's values for every downstream phase of that worktree.
|
|
|
55
59
|
**Requires:** WORKTREES
|
|
56
60
|
|
|
57
61
|
Discover PR description guidance from plan artifact (per worktree):
|
|
58
|
-
1. List `{worktree}/.devflow/docs/design/*.md`
|
|
59
|
-
2. Sort by timestamp
|
|
60
|
-
3. Read the most recent file, extract `## PR Description Guidance` section
|
|
62
|
+
1. List the design plans: `{worktree}/.devflow/docs/design/*.md` (a `/plan` artifact) and `{worktree}/.devflow/docs/design/*/*/*-plan.md` (a `/dynamic-plan` per-ticket plan)
|
|
63
|
+
2. Sort by timestamp, newest first, and scan the 10 most recent. A `/plan` artifact's timestamp is the `YYYY-MM-DD_HHMM` before its `.md`; a per-ticket plan's is the name of its parent directory. Never sort by file name, which starts with an issue ID or a ticket slug. A per-ticket plan counts only when its `{ticket-slug}` (its file name without `-plan.md`) appears in the worktree's branch name
|
|
64
|
+
3. Read the most recent file that carries the section, extract `## PR Description Guidance` section
|
|
61
65
|
4. If no plan files exist or section not found, set `PR_DESCRIPTION_GUIDANCE` to `(none)`
|
|
62
66
|
|
|
63
67
|
Render the test-plan block (per worktree) from `/implement`'s evidence file, and from nothing else:
|
|
@@ -164,10 +168,48 @@ For each reviewable worktree, call:
|
|
|
164
168
|
|
|
165
169
|
### Phase 1: Analyze Changed Files
|
|
166
170
|
|
|
167
|
-
**Produces:** REVIEW_FOCUS_LIST
|
|
168
|
-
**Requires:** DIFF_RANGE, COMPLIANCE_ACTIVE (from Step 0b)
|
|
171
|
+
**Produces:** REVIEW_FOCUS_LIST, DIFF_CLASS, DIFF_FILES
|
|
172
|
+
**Requires:** DIFF_RANGE, REVIEW_DIR, COMPLIANCE_ACTIVE (from Step 0b)
|
|
173
|
+
|
|
174
|
+
Per worktree, in order. Each `git` command here writes to a file and prints nothing.
|
|
175
|
+
|
|
176
|
+
#### Step 1.1: Classify the diff
|
|
177
|
+
|
|
178
|
+
**Produces:** DIFF_CLASS, CHANGED_PATHS, REVIEW_FOCUS_LIST (reduced classes)
|
|
179
|
+
**Requires:** DIFF_RANGE, REVIEW_DIR
|
|
180
|
+
|
|
181
|
+
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`):
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
git -C "{WORKTREE_PATH}" diff --name-only --no-renames {DIFF_RANGE} > "{REVIEW_DIR}/paths.txt"
|
|
185
|
+
wc -l < "{REVIEW_DIR}/paths.txt"
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
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.
|
|
189
|
+
|
|
190
|
+
Set `DIFF_CLASS` by these rules, in order; the first that decides wins:
|
|
191
|
+
|
|
192
|
+
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`.
|
|
193
|
+
2. **`docs-only`.** Every changed path matches `*.md`, `*.mdx`, `*.rst`, `*.txt`, `docs/**` or `CHANGELOG*`.
|
|
194
|
+
3. **`tests-only`.** Every changed path matches `tests/**`, `**/__tests__/**`, `*.test.*`, `*.spec.*`, `*_test.go`, `test_*.py` or `*_test.py`.
|
|
195
|
+
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`.
|
|
196
|
+
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.
|
|
197
|
+
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`.
|
|
198
|
+
|
|
199
|
+
Each reduced class runs only its focus set, every member reading `diff.patch`:
|
|
200
|
+
|
|
201
|
+
- `docs-only`: documentation, consistency, security
|
|
202
|
+
- `tests-only`: testing, reliability, consistency, security
|
|
203
|
+
- `lockfile-only`: dependencies, security
|
|
204
|
+
|
|
205
|
+
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
206
|
|
|
170
|
-
|
|
207
|
+
#### Step 1.2: Choose the focuses
|
|
208
|
+
|
|
209
|
+
**Produces:** REVIEW_FOCUS_LIST (code class)
|
|
210
|
+
**Requires:** DIFF_CLASS, CHANGED_PATHS, COMPLIANCE_ACTIVE
|
|
211
|
+
|
|
212
|
+
When `DIFF_CLASS` is `code`, read the file types from the paths in `paths.txt` to determine conditional reviews:
|
|
171
213
|
|
|
172
214
|
| Condition | Adds Review |
|
|
173
215
|
|-----------|-------------|
|
|
@@ -186,57 +228,106 @@ Per worktree, detect file types in diff using `DIFF_RANGE` to determine conditio
|
|
|
186
228
|
|
|
187
229
|
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
230
|
|
|
189
|
-
**Language focus
|
|
231
|
+
**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`:
|
|
232
|
+
|
|
233
|
+
Installed language focuses: (none)
|
|
234
|
+
|
|
235
|
+
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.
|
|
236
|
+
|
|
237
|
+
#### Step 1.3: Write the diff files
|
|
238
|
+
|
|
239
|
+
**Produces:** DIFF_FILES
|
|
240
|
+
**Requires:** DIFF_RANGE, REVIEW_DIR, REVIEW_FOCUS_LIST
|
|
241
|
+
|
|
242
|
+
Write `diff.patch` once per worktree, by redirect:
|
|
190
243
|
|
|
191
244
|
```bash
|
|
192
|
-
|
|
245
|
+
git -C "{WORKTREE_PATH}" diff --no-color --no-ext-diff --no-textconv {DIFF_RANGE} > "{REVIEW_DIR}/diff.patch"
|
|
193
246
|
```
|
|
194
247
|
|
|
195
|
-
|
|
248
|
+
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
249
|
|
|
250
|
+
```bash
|
|
251
|
+
git -C "{WORKTREE_PATH}" diff --no-color --no-ext-diff --no-textconv {DIFF_RANGE} -- '<pathspec>' ... > "{REVIEW_DIR}/diff-{focus}.patch"
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
| Focus | Pathspecs |
|
|
255
|
+
|-------|-----------|
|
|
256
|
+
| typescript | `'*.ts' '*.tsx'` |
|
|
257
|
+
| react, accessibility | `'*.tsx' '*.jsx'` |
|
|
258
|
+
| ui-design | `'*.tsx' '*.jsx' '*.css' '*.scss'` |
|
|
259
|
+
| go | `'*.go'` |
|
|
260
|
+
| java | `'*.java'` |
|
|
261
|
+
| python | `'*.py'` |
|
|
262
|
+
| rust | `'*.rs'` |
|
|
263
|
+
|
|
264
|
+
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.
|
|
265
|
+
|
|
266
|
+
<!-- learning:on -->
|
|
197
267
|
### Phase 1b: Load Decisions Index
|
|
268
|
+
<!-- learning:off -->
|
|
269
|
+
### Phase 1b: Load Context
|
|
270
|
+
<!-- learning:end -->
|
|
198
271
|
|
|
199
|
-
|
|
272
|
+
<!-- learning:on -->
|
|
273
|
+
**Produces:** DECISIONS_CONTEXT, FEATURE_KNOWLEDGE, FEATURE_KNOWLEDGE_RULES, COMPLIANCE_FRAMEWORKS (carried from Step 0b)
|
|
274
|
+
<!-- learning:off -->
|
|
275
|
+
**Produces:** FEATURE_KNOWLEDGE, FEATURE_KNOWLEDGE_RULES, COMPLIANCE_FRAMEWORKS (carried from Step 0b)
|
|
276
|
+
<!-- learning:end -->
|
|
200
277
|
|
|
201
278
|
{{decisions_load()}}
|
|
202
|
-
|
|
279
|
+
<!-- learning:on -->
|
|
203
280
|
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
281
|
|
|
282
|
+
<!-- learning:end -->
|
|
205
283
|
{{knowledge_load()}}
|
|
206
284
|
|
|
285
|
+
<!-- learning:on -->
|
|
207
286
|
Pass `FEATURE_KNOWLEDGE` to all Review agents alongside `DECISIONS_CONTEXT`.
|
|
287
|
+
<!-- learning:off -->
|
|
288
|
+
Pass `FEATURE_KNOWLEDGE` to all Review agents.
|
|
289
|
+
<!-- learning:end -->
|
|
208
290
|
|
|
209
291
|
### Phase 2: Run Reviews (Parallel)
|
|
210
292
|
|
|
211
293
|
**Produces:** REVIEW_FOCUS_OUTPUTS
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
|
224
|
-
|
|
225
|
-
|
|
|
226
|
-
|
|
|
227
|
-
|
|
|
228
|
-
|
|
|
229
|
-
|
|
|
230
|
-
|
|
|
231
|
-
|
|
|
232
|
-
|
|
|
233
|
-
|
|
|
234
|
-
|
|
|
235
|
-
|
|
|
236
|
-
|
|
|
237
|
-
|
|
|
238
|
-
|
|
239
|
-
|
|
294
|
+
<!-- learning:on -->
|
|
295
|
+
**Requires:** DIFF_RANGE, REVIEW_DIR, TIMESTAMP, DECISIONS_CONTEXT, FEATURE_KNOWLEDGE, PR_DESCRIPTION, PRIOR_RESOLUTIONS, REVIEW_FOCUS_LIST, DIFF_CLASS, DIFF_FILES
|
|
296
|
+
<!-- learning:off -->
|
|
297
|
+
**Requires:** DIFF_RANGE, REVIEW_DIR, TIMESTAMP, FEATURE_KNOWLEDGE, PR_DESCRIPTION, PRIOR_RESOLUTIONS, REVIEW_FOCUS_LIST, DIFF_CLASS, DIFF_FILES
|
|
298
|
+
<!-- learning:end -->
|
|
299
|
+
|
|
300
|
+
Spawn Review agents **in a single message**, for the focus set `DIFF_CLASS` selects (max 20 per worktree):
|
|
301
|
+
|
|
302
|
+
- `code`: the 8 core reviews on the full `diff.patch`, plus the language and conditional focuses Phase 1 added.
|
|
303
|
+
- `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.
|
|
304
|
+
|
|
305
|
+
| Focus | Runs | Pattern Skill | DIFF_FILE |
|
|
306
|
+
|-------|------|---------------|-----------|
|
|
307
|
+
| security | ✓ | devflow:security | diff.patch |
|
|
308
|
+
| architecture | ✓ | devflow:architecture | diff.patch |
|
|
309
|
+
| performance | ✓ | devflow:performance | diff.patch |
|
|
310
|
+
| complexity | ✓ | devflow:complexity | diff.patch |
|
|
311
|
+
| consistency | ✓ | devflow:consistency | diff.patch |
|
|
312
|
+
| regression | ✓ | devflow:regression | diff.patch |
|
|
313
|
+
| testing | ✓ | devflow:testing | diff.patch |
|
|
314
|
+
| reliability | ✓ | devflow:reliability | diff.patch |
|
|
315
|
+
| typescript | stamp-gated | devflow:typescript | diff-typescript.patch |
|
|
316
|
+
| react | stamp-gated | devflow:react | diff-react.patch |
|
|
317
|
+
| accessibility | stamp-gated | devflow:accessibility | diff-accessibility.patch |
|
|
318
|
+
| ui-design | stamp-gated | devflow:ui-design | diff-ui-design.patch |
|
|
319
|
+
| go | stamp-gated | devflow:go | diff-go.patch |
|
|
320
|
+
| java | stamp-gated | devflow:java | diff-java.patch |
|
|
321
|
+
| python | stamp-gated | devflow:python | diff-python.patch |
|
|
322
|
+
| rust | stamp-gated | devflow:rust | diff-rust.patch |
|
|
323
|
+
| database | conditional | devflow:database | diff.patch |
|
|
324
|
+
| dependencies | conditional | devflow:dependencies | diff.patch |
|
|
325
|
+
| documentation | conditional | devflow:documentation | diff.patch |
|
|
326
|
+
| compliance | diff-driven | devflow:compliance | diff.patch |
|
|
327
|
+
|
|
328
|
+
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.
|
|
329
|
+
|
|
330
|
+
{{compliance_focus_inject()}}
|
|
240
331
|
|
|
241
332
|
Each Review agent invocation (all in one message, **NOT background**):
|
|
242
333
|
```
|
|
@@ -245,14 +336,19 @@ Agent(subagent_type="Review", run_in_background=false):
|
|
|
245
336
|
Follow 6-step process from devflow:review-methodology.
|
|
246
337
|
PR: #{pr_number}, Base: {base_branch}
|
|
247
338
|
WORKTREE_PATH: {worktree_path} (omit if cwd)
|
|
248
|
-
|
|
339
|
+
DIFF_FILE: {diff_file} (absolute: {REVIEW_DIR}/diff.patch, or {REVIEW_DIR}/diff-{focus}.patch for a language focus, per the table)
|
|
340
|
+
DIFF_RANGE: {DIFF_RANGE} (information only)
|
|
341
|
+
<!-- learning:on -->
|
|
249
342
|
DECISIONS_CONTEXT: {decisions_context}
|
|
343
|
+
<!-- learning:end -->
|
|
250
344
|
FEATURE_KNOWLEDGE: {feature_knowledge}
|
|
251
345
|
PR_DESCRIPTION: <pr-description>{pr_description}</pr-description>
|
|
252
346
|
PRIOR_RESOLUTIONS: <prior-resolution-summary>{prior_resolutions}</prior-resolution-summary>
|
|
253
|
-
|
|
347
|
+
{COMPLIANCE_FOCUS_DIRECTIVE} (compliance focus only)
|
|
254
348
|
If PRIOR_RESOLUTIONS is not (none), follow Cross-Cycle Awareness in review.md.
|
|
349
|
+
<!-- learning:on -->
|
|
255
350
|
Follow devflow:apply-decisions to scan the index and Read full ADR/PF bodies on demand.
|
|
351
|
+
<!-- learning:end -->
|
|
256
352
|
Follow devflow:apply-feature-knowledge for FEATURE_KNOWLEDGE — feature-specific patterns and anti-patterns inform findings.
|
|
257
353
|
IMPORTANT: Write report to {worktree_path}/.devflow/docs/reviews/{branch-slug}/{timestamp}/{focus}.md using Write tool"
|
|
258
354
|
```
|
|
@@ -325,13 +421,15 @@ In multi-worktree mode, report results per worktree.
|
|
|
325
421
|
├─ Per worktree (SEQUENTIAL — one worktree at a time):
|
|
326
422
|
│ │
|
|
327
423
|
│ ├─ Phase 1: Analyze changed files
|
|
328
|
-
│ │
|
|
424
|
+
│ │ ├─ Classify the diff (paths.txt → DIFF_CLASS)
|
|
425
|
+
│ │ ├─ Choose the focuses (code class: file types + the language stamp)
|
|
426
|
+
│ │ └─ Write diff.patch and diff-{focus}.patch, by redirect
|
|
329
427
|
│ │
|
|
330
428
|
│ ├─ Phase 2: Reviews (PARALLEL within worktree)
|
|
331
|
-
│ │ ├─ Review
|
|
332
|
-
│ │
|
|
333
|
-
│ │ ├─
|
|
334
|
-
│ │ └─
|
|
429
|
+
│ │ ├─ code: Review agents security, architecture, performance, complexity,
|
|
430
|
+
│ │ │ consistency, regression, testing, reliability (diff.patch)
|
|
431
|
+
│ │ ├─ code: + language (diff-{focus}.patch) and conditional Review agents
|
|
432
|
+
│ │ └─ docs-only / tests-only / lockfile-only: the reduced set (diff.patch)
|
|
335
433
|
│ │
|
|
336
434
|
│ ├─ Phase 3: Synthesis → Review Comment (SEQUENTIAL within worktree)
|
|
337
435
|
│ │ ├─ Step 3a: Synthesize agent (mode: review, writes review-summary.md)
|
|
@@ -360,6 +458,14 @@ In multi-worktree mode, report results per worktree.
|
|
|
360
458
|
| `--full` flag | Bypass incremental detection (Step 0d), still load PRIOR_RESOLUTIONS for cross-cycle awareness |
|
|
361
459
|
| Parsing failure on resolution-summary.md | fp_ratio = 0, convergence tracking degraded (see Step 0e-ii) |
|
|
362
460
|
| Concurrent sessions | Advisory only, each session computes independently |
|
|
461
|
+
| Docs-only diff | `docs-only`: documentation, consistency, security on `diff.patch`; no language or conditional focus |
|
|
462
|
+
| Tests-only diff | `tests-only`: testing, reliability, consistency, security on `diff.patch`; no language or conditional focus |
|
|
463
|
+
| Lockfile-only diff | `lockfile-only`: dependencies, security on `diff.patch` |
|
|
464
|
+
| Mixed non-code diff (docs with tests, tests with a lockfile) | The union of the matching sets, on `diff.patch` |
|
|
465
|
+
| A path matching no class pattern, or an empty path list | `code` (fail-safe): the 8 core focuses on the full diff |
|
|
466
|
+
| A file moved across classes | `--no-renames` lists the old and the new path, so a code path makes the diff `code` |
|
|
467
|
+
| Path listing above about 40 lines | The count is printed; `paths.txt` is read in ranges of about 40 lines |
|
|
468
|
+
| Language files changed, plugin not installed | The focus is absent from the stamped line: not spawned |
|
|
363
469
|
| Public repo (`auto` mode) | Git agent probes visibility, posts counts-only STUB comment; full report stays local |
|
|
364
470
|
| `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
471
|
|
|
@@ -370,9 +476,9 @@ In multi-worktree mode, report results per worktree.
|
|
|
370
476
|
|
|
371
477
|
## Principles
|
|
372
478
|
|
|
373
|
-
1. **Orchestration only** - Command spawns agents, doesn't do git/review work itself
|
|
479
|
+
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
480
|
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
|
|
481
|
+
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
482
|
4. **Clear ownership** - Each agent owns its output completely
|
|
377
483
|
5. **Honest reporting** - Display agent outputs directly
|
|
378
484
|
6. **Incremental by default** - Only review new changes unless `--full` specified
|
|
@@ -5,6 +5,8 @@ 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
|
|
9
|
+
@import "./_partials/_compliance.mds" as compliance
|
|
8
10
|
# Debug Command
|
|
9
11
|
|
|
10
12
|
Investigate bugs by spawning parallel agents, each pursuing a different hypothesis. Evidence is aggregated and synthesized to identify the root cause.
|
|
@@ -32,20 +34,37 @@ $ARGUMENTS
|
|
|
32
34
|
|
|
33
35
|
## Phases
|
|
34
36
|
|
|
37
|
+
<!-- learning:on -->
|
|
35
38
|
### Phase 1: Load Decisions Index (Orchestrator-Local)
|
|
39
|
+
<!-- learning:off -->
|
|
40
|
+
### Phase 1: Resolve Settings
|
|
41
|
+
<!-- learning:end -->
|
|
36
42
|
|
|
43
|
+
<!-- learning:on -->
|
|
37
44
|
**Produces:** DECISIONS_CONTEXT
|
|
38
45
|
|
|
39
|
-
|
|
46
|
+
<!-- learning:end -->
|
|
47
|
+
{{settings.settings_resolve()}}
|
|
48
|
+
|
|
49
|
+
From the same line: {{compliance.compliance_frameworks()}}
|
|
50
|
+
|
|
51
|
+
{{compliance.compliance_inject()}}
|
|
40
52
|
|
|
53
|
+
Phase 7 passes `COMPLIANCE_DIRECTIVE` to the Code agent that implements the fix, on a line of its own.
|
|
54
|
+
|
|
55
|
+
{{decisions_load()}}
|
|
56
|
+
<!-- learning:on -->
|
|
41
57
|
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
58
|
|
|
59
|
+
<!-- learning:end -->
|
|
43
60
|
**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
61
|
|
|
45
62
|
### Phase 2: Context Gathering
|
|
46
63
|
|
|
47
64
|
**Produces:** HYPOTHESES, BUG_CONTEXT
|
|
65
|
+
<!-- learning:on -->
|
|
48
66
|
**Requires:** DECISIONS_CONTEXT
|
|
67
|
+
<!-- learning:end -->
|
|
49
68
|
|
|
50
69
|
If `COMMAND_INPUT` opens with a candidate issue reference, fetch the issue:
|
|
51
70
|
|
|
@@ -183,7 +202,22 @@ Produce the final report:
|
|
|
183
202
|
|
|
184
203
|
Ask user via AskUserQuestion: "Want me to implement this fix?"
|
|
185
204
|
|
|
186
|
-
- **YES** →
|
|
205
|
+
- **YES** → implement the fix through the Code agent, never in this thread, then spawn `Agent(subagent_type="Simplify")` on the changed files. /debug loads no feature knowledge, so the fix gets none:
|
|
206
|
+
|
|
207
|
+
```
|
|
208
|
+
Agent(subagent_type="Code"):
|
|
209
|
+
"OPERATION: implement
|
|
210
|
+
TASK_ID: debug-{YYYY-MM-DD_HHMM}
|
|
211
|
+
TASK_DESCRIPTION: Implement the fix for this root cause: {bug description}
|
|
212
|
+
EXECUTION_PLAN: {Root Cause, Key Findings and Recommended Fix from Phase 6, with their file:line references}
|
|
213
|
+
PUSH: false
|
|
214
|
+
<!-- learning:on -->
|
|
215
|
+
DECISIONS_CONTEXT: {decisions_context}
|
|
216
|
+
<!-- learning:end -->
|
|
217
|
+
FEATURE_KNOWLEDGE: (none)
|
|
218
|
+
{COMPLIANCE_DIRECTIVE}"
|
|
219
|
+
```
|
|
220
|
+
|
|
187
221
|
- **NO** → Done. Report stands as documentation.
|
|
188
222
|
|
|
189
223
|
{{knowledge_writeback()}}
|
|
@@ -193,7 +227,11 @@ Ask user via AskUserQuestion: "Want me to implement this fix?"
|
|
|
193
227
|
```
|
|
194
228
|
/debug (orchestrator)
|
|
195
229
|
│
|
|
230
|
+
<!-- learning:on -->
|
|
196
231
|
├─ Phase 1: Load Decisions Index (Orchestrator-Local)
|
|
232
|
+
<!-- learning:off -->
|
|
233
|
+
├─ Phase 1: Resolve Settings
|
|
234
|
+
<!-- learning:end -->
|
|
197
235
|
│ └─ No up-front feature knowledge load (avoids confirmation bias in investigators)
|
|
198
236
|
│
|
|
199
237
|
├─ Phase 2: Context gathering
|
|
@@ -211,7 +249,7 @@ Ask user via AskUserQuestion: "Want me to implement this fix?"
|
|
|
211
249
|
├─ Phase 6: Root cause report with confidence level
|
|
212
250
|
│
|
|
213
251
|
├─ Phase 7: Offer Fix
|
|
214
|
-
│ └─ AskUserQuestion →
|
|
252
|
+
│ └─ AskUserQuestion → Code agent (fix) + Simplify agent, or done
|
|
215
253
|
│
|
|
216
254
|
└─ Feature Knowledge Write-Back (Conditional)
|
|
217
255
|
└─ Knowledge agent (if investigation surfaced durable cross-cutting knowledge)
|