sequant 2.2.0 → 2.3.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 (137) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +73 -0
  4. package/dist/bin/cli.js +94 -9
  5. package/dist/src/commands/doctor.d.ts +25 -0
  6. package/dist/src/commands/doctor.js +36 -1
  7. package/dist/src/commands/locks.d.ts +67 -0
  8. package/dist/src/commands/locks.js +290 -0
  9. package/dist/src/commands/merge.js +11 -0
  10. package/dist/src/commands/prompt.d.ts +39 -0
  11. package/dist/src/commands/prompt.js +179 -0
  12. package/dist/src/commands/run-display.d.ts +11 -2
  13. package/dist/src/commands/run-display.js +62 -28
  14. package/dist/src/commands/run-progress.d.ts +32 -0
  15. package/dist/src/commands/run-progress.js +76 -0
  16. package/dist/src/commands/run.js +80 -18
  17. package/dist/src/commands/stats.d.ts +2 -0
  18. package/dist/src/commands/stats.js +94 -8
  19. package/dist/src/commands/status.js +12 -0
  20. package/dist/src/commands/watch.d.ts +16 -0
  21. package/dist/src/commands/watch.js +147 -0
  22. package/dist/src/lib/ac-linter.d.ts +1 -1
  23. package/dist/src/lib/ac-linter.js +81 -0
  24. package/dist/src/lib/assess-collision-detect.d.ts +91 -0
  25. package/dist/src/lib/assess-collision-detect.js +217 -0
  26. package/dist/src/lib/assess-comment-parser.d.ts +59 -1
  27. package/dist/src/lib/assess-comment-parser.js +124 -2
  28. package/dist/src/lib/cli-ui/format.d.ts +19 -0
  29. package/dist/src/lib/cli-ui/format.js +34 -0
  30. package/dist/src/lib/cli-ui/run-renderer-types.d.ts +181 -0
  31. package/dist/src/lib/cli-ui/run-renderer-types.js +7 -0
  32. package/dist/src/lib/cli-ui/run-renderer.d.ts +239 -0
  33. package/dist/src/lib/cli-ui/run-renderer.js +1173 -0
  34. package/dist/src/lib/heuristics/behavior-rule-detector.d.ts +94 -0
  35. package/dist/src/lib/heuristics/behavior-rule-detector.js +467 -0
  36. package/dist/src/lib/locks/index.d.ts +7 -0
  37. package/dist/src/lib/locks/index.js +5 -0
  38. package/dist/src/lib/locks/lock-manager.d.ts +168 -0
  39. package/dist/src/lib/locks/lock-manager.js +433 -0
  40. package/dist/src/lib/locks/types.d.ts +59 -0
  41. package/dist/src/lib/locks/types.js +31 -0
  42. package/dist/src/lib/qa/markdown-only-ci.d.ts +46 -0
  43. package/dist/src/lib/qa/markdown-only-ci.js +74 -0
  44. package/dist/src/lib/relay/activation.d.ts +60 -0
  45. package/dist/src/lib/relay/activation.js +122 -0
  46. package/dist/src/lib/relay/archive.d.ts +34 -0
  47. package/dist/src/lib/relay/archive.js +106 -0
  48. package/dist/src/lib/relay/frame.d.ts +20 -0
  49. package/dist/src/lib/relay/frame.js +76 -0
  50. package/dist/src/lib/relay/index.d.ts +13 -0
  51. package/dist/src/lib/relay/index.js +13 -0
  52. package/dist/src/lib/relay/paths.d.ts +43 -0
  53. package/dist/src/lib/relay/paths.js +59 -0
  54. package/dist/src/lib/relay/pid.d.ts +34 -0
  55. package/dist/src/lib/relay/pid.js +72 -0
  56. package/dist/src/lib/relay/reader.d.ts +35 -0
  57. package/dist/src/lib/relay/reader.js +115 -0
  58. package/dist/src/lib/relay/types.d.ts +68 -0
  59. package/dist/src/lib/relay/types.js +76 -0
  60. package/dist/src/lib/relay/writer.d.ts +48 -0
  61. package/dist/src/lib/relay/writer.js +113 -0
  62. package/dist/src/lib/settings.d.ts +31 -1
  63. package/dist/src/lib/settings.js +18 -3
  64. package/dist/src/lib/version-check.d.ts +60 -5
  65. package/dist/src/lib/version-check.js +97 -9
  66. package/dist/src/lib/workflow/batch-executor.d.ts +20 -1
  67. package/dist/src/lib/workflow/batch-executor.js +248 -175
  68. package/dist/src/lib/workflow/config-resolver.js +4 -0
  69. package/dist/src/lib/workflow/heartbeat.d.ts +71 -0
  70. package/dist/src/lib/workflow/heartbeat.js +194 -0
  71. package/dist/src/lib/workflow/phase-executor.d.ts +62 -8
  72. package/dist/src/lib/workflow/phase-executor.js +157 -16
  73. package/dist/src/lib/workflow/phase-mapper.d.ts +3 -2
  74. package/dist/src/lib/workflow/phase-mapper.js +17 -20
  75. package/dist/src/lib/workflow/platforms/github.d.ts +1 -1
  76. package/dist/src/lib/workflow/platforms/github.js +20 -3
  77. package/dist/src/lib/workflow/pr-status.d.ts +18 -2
  78. package/dist/src/lib/workflow/pr-status.js +41 -9
  79. package/dist/src/lib/workflow/qa-stagnation.d.ts +117 -0
  80. package/dist/src/lib/workflow/qa-stagnation.js +179 -0
  81. package/dist/src/lib/workflow/run-orchestrator.d.ts +39 -0
  82. package/dist/src/lib/workflow/run-orchestrator.js +340 -15
  83. package/dist/src/lib/workflow/run-reflect.js +1 -1
  84. package/dist/src/lib/workflow/run-state.d.ts +71 -0
  85. package/dist/src/lib/workflow/run-state.js +14 -0
  86. package/dist/src/lib/workflow/state-cleanup.d.ts +13 -5
  87. package/dist/src/lib/workflow/state-cleanup.js +17 -5
  88. package/dist/src/lib/workflow/state-manager.d.ts +12 -1
  89. package/dist/src/lib/workflow/state-manager.js +37 -0
  90. package/dist/src/lib/workflow/state-schema.d.ts +62 -0
  91. package/dist/src/lib/workflow/state-schema.js +35 -1
  92. package/dist/src/lib/workflow/types.d.ts +74 -1
  93. package/dist/src/lib/workflow/worktree-manager.d.ts +8 -1
  94. package/dist/src/lib/workflow/worktree-manager.js +15 -6
  95. package/dist/src/mcp/tools/run.d.ts +44 -0
  96. package/dist/src/mcp/tools/run.js +104 -13
  97. package/dist/src/ui/tui/App.d.ts +14 -0
  98. package/dist/src/ui/tui/App.js +41 -0
  99. package/dist/src/ui/tui/ElapsedTimer.d.ts +10 -0
  100. package/dist/src/ui/tui/ElapsedTimer.js +31 -0
  101. package/dist/src/ui/tui/Header.d.ts +6 -0
  102. package/dist/src/ui/tui/Header.js +15 -0
  103. package/dist/src/ui/tui/IssueBox.d.ts +16 -0
  104. package/dist/src/ui/tui/IssueBox.js +68 -0
  105. package/dist/src/ui/tui/Spinner.d.ts +9 -0
  106. package/dist/src/ui/tui/Spinner.js +18 -0
  107. package/dist/src/ui/tui/index.d.ts +15 -0
  108. package/dist/src/ui/tui/index.js +29 -0
  109. package/dist/src/ui/tui/theme.d.ts +29 -0
  110. package/dist/src/ui/tui/theme.js +52 -0
  111. package/dist/src/ui/tui/truncate.d.ts +11 -0
  112. package/dist/src/ui/tui/truncate.js +31 -0
  113. package/package.json +10 -3
  114. package/templates/agents/sequant-explorer.md +1 -0
  115. package/templates/agents/sequant-qa-checker.md +2 -1
  116. package/templates/agents/sequant-testgen.md +1 -0
  117. package/templates/hooks/post-tool.sh +11 -0
  118. package/templates/hooks/pre-tool.sh +18 -9
  119. package/templates/hooks/relay-check.sh +107 -0
  120. package/templates/relay/frame.txt +11 -0
  121. package/templates/scripts/cleanup-worktree.sh +25 -3
  122. package/templates/scripts/new-feature.sh +6 -0
  123. package/templates/skills/_shared/references/behavior-rule-detection.md +205 -0
  124. package/templates/skills/_shared/references/subagent-types.md +21 -8
  125. package/templates/skills/assess/SKILL.md +103 -49
  126. package/templates/skills/assess/references/predicted-collision-detection.md +109 -0
  127. package/templates/skills/docs/SKILL.md +141 -22
  128. package/templates/skills/exec/SKILL.md +10 -8
  129. package/templates/skills/fullsolve/SKILL.md +79 -5
  130. package/templates/skills/loop/SKILL.md +28 -0
  131. package/templates/skills/merger/SKILL.md +621 -0
  132. package/templates/skills/qa/SKILL.md +727 -8
  133. package/templates/skills/setup/SKILL.md +6 -0
  134. package/templates/skills/spec/SKILL.md +52 -0
  135. package/templates/skills/spec/references/parallel-groups.md +7 -0
  136. package/templates/skills/spec/references/recommended-workflow.md +4 -2
  137. package/templates/skills/testgen/SKILL.md +24 -17
@@ -52,6 +52,20 @@ Every issue gets exactly ONE action:
52
52
 
53
53
  ### Step 1: Context Gathering
54
54
 
55
+ **Concurrency check (#625, read-only):**
56
+
57
+ Probe the per-issue concurrency lock so the dashboard can flag issues another session is actively working on. `/assess` never acquires the lock — it only reports.
58
+
59
+ ```bash
60
+ # Single batch call. Empty output = no issues are locked. Held issues print one
61
+ # pre-formatted `⚠ #<N> held by ...` line each, ready to paste above the dashboard.
62
+ npx sequant locks check-batch <N1> <N2> ... 2>/dev/null || true
63
+ ```
64
+
65
+ If the output is non-empty, paste every line verbatim above the dashboard table (or, in single-issue detail mode, immediately above the action verdict). Do not gate the recommendation — `/assess` is read-only and must still produce its action verdict even when an issue is locked.
66
+
67
+ The orchestrator/MCP mode (`SEQUANT_ORCHESTRATOR` set) returns no output, so the call is safe to make unconditionally.
68
+
55
69
  **From GitHub (parallel for all issues):**
56
70
 
57
71
  ```bash
@@ -78,6 +92,27 @@ gh pr list --search "<N> in:title" --json number,title,state,headRefName,mergeab
78
92
  - Grep for TODOs: `Grep(pattern="TODO.*#<N>")`
79
93
  - Check files referenced in issue body exist
80
94
  - Identify modified files if branch exists
95
+ - For predicted-collision detection (see Step 5), pass each PROCEED candidate's body through `extractPathsFromIssueBody` from `src/lib/assess-collision-detect.ts` to build the issue → paths map used in Step 5
96
+
97
+ #### Prior Assessment Detection
98
+
99
+ Before generating output, scan the issue's existing comments for prior `<!-- assess:action=... -->` markers. The parser exposes four pure functions in `src/lib/assess-comment-parser.ts`:
100
+
101
+ | Function | Purpose |
102
+ |----------|---------|
103
+ | `findAllAssessComments(comments)` | Returns prior assess comments in chronological order (oldest first). |
104
+ | `buildSupersessionHeader(priors)` | Returns `Supersedes prior assess from <date> (<action>)` for 1 prior, `Supersedes N prior assessments (most recent: <date>)` for ≥2, or `null` for 0. |
105
+ | `detectChurn(priors, allComments)` | Returns `{ isChurn, count, firstDate }`. Fires (`isChurn=true`) only when ≥3 priors exist AND no exec phase marker (`<!-- SEQUANT_PHASE: {"phase":"exec",...} -->`) appears in any comment dated after the first prior. |
106
+ | `shouldPromptOnConflict(prior, new)` | Returns `true` only when prior action ∈ {`PROCEED`, `REWRITE`} AND differs from the new action. |
107
+
108
+ **Supersession protocol:**
109
+
110
+ 1. **No priors** → omit the supersession header entirely.
111
+ 2. **1+ priors** → prepend the header line returned by `buildSupersessionHeader` to the new comment body, immediately above the `→ ACTION — reason` line.
112
+ 3. **Churn detected** (`detectChurn(...).isChurn === true`) → emit a dashboard warning: `⚠ #<N> Re-assessed N times since <firstDate> without execution — possible blocker or low priority`.
113
+ 4. **Conflict detected** (`shouldPromptOnConflict(prior, new) === true`) → confirm with the user via `AskUserQuestion` before posting. Skip the prompt when actions match or when the prior was `CLOSE`/`PARK`/`CLARIFY`/`MERGE`.
114
+
115
+ **This pass is read-only — never edit or delete prior assess comments.** The append-only history is the audit trail; new comments add context, they do not rewrite it.
81
116
 
82
117
  ### Step 2: Health Checks
83
118
 
@@ -117,14 +152,14 @@ Surface red flags. Only track signals that change the recommendation.
117
152
  | complex, refactor, breaking, major | Modifier | `spec → exec → qa` + `-q` |
118
153
  | (ui/frontend) + (enhancement/feature), or testable-AC signals | Modifier | inserts `testgen` before `exec` (see Testgen detection below) |
119
154
  | enhancement, feature (default) | Generic | `spec → exec → qa` |
120
- | bug, fix, hotfix, patch | Generic | `exec → qa` |
121
- | docs, documentation, readme | Generic | `exec → qa` |
155
+ | bug, fix, hotfix, patch | Generic | `spec → exec → qa` |
156
+ | docs, documentation, readme | Generic | `spec → exec → qa` |
122
157
 
123
- **Label priority:** Domain labels take precedence over generic labels. When an issue has both a domain label and a generic label (e.g., `bug` + `auth`), use the domain-specific workflow. Example: an issue labeled `bug` + `auth` gets `spec → security-review → exec → qa`, not `exec qa`. Similarly, `bug` + `ui` gets `spec → exec → test → qa`.
158
+ **Label priority:** Domain labels take precedence over generic labels. When an issue has both a domain label and a generic label (e.g., `bug` + `auth`), the domain label adds its extra phase. Example: an issue labeled `bug` + `auth` gets `spec → security-review → exec → qa` (adds `security-review` from `auth`); `bug` + `ui` gets `spec → exec → test → qa` (adds `test` from `ui`).
124
159
 
125
160
  **Valid phases (from `PhaseSchema` in `src/lib/workflow/types.ts`):** `spec`, `security-review`, `exec`, `testgen`, `test`, `verify`, `qa`, `loop`, `merger`
126
161
 
127
- **Skip spec when:** (bug/docs label AND no domain labels like security/auth/ui/frontend), OR spec comment already exists on issue.
162
+ **Skip spec when:** a prior `spec` phase marker already exists on the issue. Otherwise, always include spec — bug and docs issues often contain design decisions (scope boundaries, edge cases, test-strategy shifts) that benefit from a spec pass.
128
163
 
129
164
  **Resume detection:** Branch exists with commits ahead of main → mark as resume (`◂`).
130
165
 
@@ -153,12 +188,31 @@ Flag references:
153
188
 
154
189
  ### Step 5: Conflict Detection
155
190
 
191
+ **Active-worktree overlap.** For each in-flight worktree, check whether its diff overlaps with files the assessed issues are likely to touch.
192
+
156
193
  ```bash
157
194
  git worktree list --porcelain 2>/dev/null | grep "^worktree" | cut -d' ' -f2 || true
158
195
  ```
159
196
 
160
197
  For each active worktree, check `git diff --name-only main...HEAD` for file overlap with assessed issues.
161
198
 
199
+ **Predicted file-collision (PROCEED issues).** Step 5 also runs a heuristic across the bodies of unstarted PROCEED issues to predict pairs that will modify the same file once executed in parallel. The detector lives in `src/lib/assess-collision-detect.ts` and exposes three pure functions:
200
+
201
+ | Function | Purpose |
202
+ |----------|---------|
203
+ | `extractPathsFromIssueBody(body)` | Strips fenced code blocks and HTML comments, then returns the set of canonical paths the body names. Backtick-quoted paths under `.claude/`, `templates/`, `skills/`, `src/`, `bin/`, `docs/` matching `*.md`, `*.ts`, `*.tsx`, `*.json`, `*.sh` are extracted; skill-mirror prefixes (`.claude/skills/`, `templates/skills/`, `skills/`) are normalized away so `qa/SKILL.md` is the canonical form. When the body also mentions "3-dir sync" (or "across all three skill directories"), bare `<name>/SKILL.md` references and `/<skill>` slash-command mentions are also added. Globally excluded paths (`CHANGELOG.md`, `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`) are stripped. |
204
+ | `detectFileCollisions(issuePaths)` | Computes pairwise file-path intersections across the PROCEED issues. Returns one `CollisionResult` per shared file: `{ issues: number[], file: string }`. When N issues share a file, that's a single result with `issues.length === N`. Because paths are canonical, mirrored skill files emit one collision, not three. |
205
+ | `formatCollisionAnnotations(results)` | Returns `{ orderLines, warnings, chainSuggestion? }`. Each pair (or group) emits an `Order: A → B (path)` line and one `⚠ #N Modifies <path> (overlaps #M); land sequentially` per affected issue. When ≥3 issues collide on the same file, a `Chain:` suggestion is also returned (suggest-only — never auto-applied). |
206
+
207
+ **Output integration:**
208
+
209
+ 1. Step 1 (Context Gathering) already calls `extractPathsFromIssueBody` per PROCEED candidate to build the issue → paths map.
210
+ 2. After Step 4 produces the PROCEED set, pass the map to `detectFileCollisions`.
211
+ 3. Render the formatted annotations in the dashboard alongside the active-worktree overlap warnings — same `Order:` / `⚠` / `Chain:` blocks defined in "Annotation Rules" below.
212
+ 4. The bare-filename `Order:` exception (e.g. `Order: 551 → 552 (qa/SKILL.md)`) applies here — predicted collisions are file-collision reasons by definition.
213
+
214
+ False-positive guards and tunables (excluded paths, the path regex, the slash-command-skill derivation rule) are documented in [`references/predicted-collision-detection.md`](references/predicted-collision-detection.md) so they can change without editing this skill.
215
+
162
216
  ---
163
217
 
164
218
  ## Output Format
@@ -208,7 +262,7 @@ Cleanup:
208
262
  | Symbol | Meaning | Example |
209
263
  |--------|---------|---------|
210
264
  | `spec → exec → qa` | Full workflow | Standard feature |
211
- | `exec → qa` | Skip spec | Bug, docs, or spec exists |
265
+ | `exec → qa` | Skip spec | Prior spec marker exists |
212
266
  | `◂ exec → qa` | Resume existing work | Branch has commits |
213
267
  | `◂ qa` | PR needs review/QA | Open PR, impl done |
214
268
  | `⟳ spec → exec → qa` | Restart (fresh) | Stale PR abandoned |
@@ -228,6 +282,7 @@ The commands block is headed by `Commands:` — no box-drawing, no character cou
228
282
  5. Chain mode issues use `--chain` flag (see `Chain:` annotation rules below)
229
283
  6. If ALL issues share the same workflow, emit a single command
230
284
  7. **Line splitting:** When a single command would contain more than 6 issue numbers, split into multiple commands of at most 6 issues each, grouped by compatible workflow. Example: 11 issues → two commands (6 + 5)
285
+ 8. **Minimal flags:** Omit `--phases` when the resulting workflow equals the CLI default (registered at `bin/cli.ts:186`, defined as `DEFAULT_PHASES` in `src/lib/workflow/types.ts`). Prefer additive flags over restating phases — additive flags: `--testgen` and `--security-review` (`bin/cli.ts:208-209`). Use `--testgen` instead of `--phases spec,testgen,exec,qa` (or `…,testgen,…,test,qa` for ui-labelled issues, since `phase-mapper.determinePhasesForIssue` auto-adds `test` from the ui label). Use `--security-review` instead of `--phases spec,security-review,exec,qa`. The posted marker (`<!-- assess:phases=… -->`) records the full resolved workflow regardless — markers are machine-readable, displayed commands are human shorthand. This intentional divergence is fine: parsers consume markers, humans copy commands.
231
286
 
232
287
  #### Annotation Rules
233
288
 
@@ -238,6 +293,7 @@ Emit annotations in this order between the separators that follow `Commands:`:
238
293
  - Good: `Order: 185 → 186 (185 changes fetchApi error format that 186 consumes)`
239
294
  - Good: `Order: 460 → 461 (460 adds batch-executor tests that 461's label matching depends on)`
240
295
  - Avoid bare filenames when a reason is clearer.
296
+ - **Exception:** When the sequencing reason **is** a file collision (two issues both modify the same file), the filename **is** the reason and is acceptable verbatim. Example: `Order: 460 → 461 (qa/SKILL.md)` — the bare filename communicates the conflict directly.
241
297
 
242
298
  - **`⚠` warnings** — Only non-obvious signals (complexity, staleness, dual concerns, partial-AC satisfaction). One line each, prefixed with issue number. Warnings can note when part of an AC is already satisfied in the codebase:
243
299
  - `⚠ #185 Domain errors already exist in repository layer — scope may be smaller than expected`
@@ -265,19 +321,18 @@ Not all issues have explicit `- [ ]` checkboxes, so the `ACs` column is omitted.
265
321
  ```
266
322
  # Action Reason Run
267
323
  462 PARK Manual measurement task ‖
268
- 461 PROCEED Exact label matching exec → qa
269
- 460 PROCEED batch-executor tests exec → qa
324
+ 461 PROCEED Exact label matching spec → exec → qa
325
+ 460 PROCEED batch-executor tests spec → exec → qa
270
326
  458 PROCEED Parallel UX + race condition spec → exec → qa
271
327
  447 CLOSE PR #457 merged —
272
328
  443 PROCEED Consolidate gh calls spec → exec → qa
273
- 412 PROCEED Auth bug (domain: auth overrides bug) spec → security-review → exec → qa
329
+ 412 PROCEED Auth bug (domain: auth adds review) spec → security-review → exec → qa
274
330
  411 PROCEED Config path normalization ◂ exec → qa
275
331
  405 REWRITE PR #380 200+ commits behind ⟳ spec → exec → qa
276
332
  ────────────────────────────────────────────────────────────────
277
333
  Commands:
278
- npx sequant run 461 460 -q --phases exec,qa
279
- npx sequant run 458 443 -q
280
- npx sequant run 412 -q --phases spec,security-review,exec,qa
334
+ npx sequant run 461 460 458 443 -q
335
+ npx sequant run 412 -q --security-review
281
336
  npx sequant run 411 -q --phases exec,qa # resume
282
337
  npx sequant run 405 -q # restart
283
338
  ────────────────────────────────────────────────────────────────
@@ -285,11 +340,12 @@ Order: 460 → 461 (460 adds batch-executor tests that 461's label matching depe
285
340
 
286
341
  ⚠ #458 Dual concern (UX + race) across 4 files
287
342
  ⚠ #405 Stale 30+ days, ACs still valid
288
- ⚠ #412 bug + auth labels — domain label (auth) takes priority over bug
343
+ ⚠ #412 bug + auth labels — auth (domain) adds security-review phase
289
344
 
290
345
  Flags:
291
- -q multi-file scope across most PROCEED issues
292
- --phases spec,... spec phase added for 458/443/412/405 (standard features)
346
+ -q multi-file scope across most PROCEED issues
347
+ --security-review #412 auth label security review required
348
+ --phases exec,qa #411 resume — prior spec marker already exists
293
349
  ────────────────────────────────────────────────────────────────
294
350
  Cleanup:
295
351
  git worktree remove .../447-... # merged, stale worktree
@@ -298,8 +354,8 @@ Cleanup:
298
354
  ────────────────────────────────────────────────────────────────
299
355
 
300
356
  <!-- #462 assess:action=PARK -->
301
- <!-- #461 assess:action=PROCEED assess:phases=exec,qa assess:quality-loop=true -->
302
- <!-- #460 assess:action=PROCEED assess:phases=exec,qa assess:quality-loop=true -->
357
+ <!-- #461 assess:action=PROCEED assess:phases=spec,exec,qa assess:quality-loop=true -->
358
+ <!-- #460 assess:action=PROCEED assess:phases=spec,exec,qa assess:quality-loop=true -->
303
359
  <!-- #458 assess:action=PROCEED assess:phases=spec,exec,qa assess:quality-loop=true -->
304
360
  <!-- #447 assess:action=CLOSE -->
305
361
  <!-- #443 assess:action=PROCEED assess:phases=spec,exec,qa assess:quality-loop=true -->
@@ -319,19 +375,18 @@ All issues have explicit checkbox ACs, so the `ACs` column is shown. A dependenc
319
375
  ────────────────────────────────────────────────────────────────
320
376
  Commands:
321
377
  npx sequant run 185 -q
322
- npx sequant run 186 -q --phases spec,testgen,exec,test,qa
378
+ npx sequant run 186 -q --testgen
323
379
  ────────────────────────────────────────────────────────────────
324
380
  Order: 185 → 186 (185 changes fetchApi error format that 186 consumes)
325
381
 
326
382
  ⚠ #185 Domain errors already exist in repository layer — scope may be smaller than expected
327
383
  ⚠ #186 @tanstack/react-query not installed; large scope (9 hooks + optimistic updates)
328
384
 
329
- Chain: npx sequant run 185 186 --chain --qa-gate -q --phases spec,testgen,exec,test,qa
385
+ Chain: npx sequant run 185 186 --chain --qa-gate -q --testgen
330
386
  # alternative — use if 186 should branch from 185's work
331
387
 
332
388
  Flags:
333
- --testgen #186 has testable ACs (UI hooks + API integration)
334
- --phases ...,test #186 ui label → browser verification
389
+ --testgen #186 testable ACs (UI hooks + API integration); ui label auto-adds test phase
335
390
  ────────────────────────────────────────────────────────────────
336
391
 
337
392
  <!-- #185 assess:action=PROCEED assess:phases=spec,exec,qa assess:quality-loop=true -->
@@ -344,17 +399,16 @@ When every issue is PROCEED with no warnings, no dependencies, and no non-defaul
344
399
 
345
400
  ```
346
401
  # Action Reason Run
347
- 461 PROCEED Exact label matching exec → qa
348
- 460 PROCEED batch-executor tests exec → qa
402
+ 461 PROCEED Exact label matching spec → exec → qa
403
+ 460 PROCEED batch-executor tests spec → exec → qa
349
404
  443 PROCEED Consolidate gh calls spec → exec → qa
350
405
  ────────────────────────────────────────────────────────────────
351
406
  Commands:
352
- npx sequant run 461 460 -q --phases exec,qa
353
- npx sequant run 443 -q
407
+ npx sequant run 461 460 443 -q
354
408
  ────────────────────────────────────────────────────────────────
355
409
 
356
- <!-- #461 assess:action=PROCEED assess:phases=exec,qa assess:quality-loop=true -->
357
- <!-- #460 assess:action=PROCEED assess:phases=exec,qa assess:quality-loop=true -->
410
+ <!-- #461 assess:action=PROCEED assess:phases=spec,exec,qa assess:quality-loop=true -->
411
+ <!-- #460 assess:action=PROCEED assess:phases=spec,exec,qa assess:quality-loop=true -->
358
412
  <!-- #443 assess:action=PROCEED assess:phases=spec,exec,qa assess:quality-loop=true -->
359
413
  ```
360
414
 
@@ -366,53 +420,50 @@ When assessing 9+ issues, commands are split per Rule 7 (max 6 issue numbers per
366
420
 
367
421
  ```
368
422
  # Action Reason Run
369
- 503 PROCEED Fix typo in error output exec → qa
370
- 502 PROCEED Update deprecated API call exec → qa
371
- 501 PROCEED Add retry logic to API client exec → qa
423
+ 503 PROCEED Fix typo in error output spec → exec → qa
424
+ 502 PROCEED Update deprecated API call spec → exec → qa
425
+ 501 PROCEED Add retry logic to API client spec → exec → qa
372
426
  500 PROCEED Fix token refresh race condition spec → security-review → exec → qa
373
427
  499 PROCEED Dashboard chart rendering bug spec → exec → test → qa
374
- 498 PROCEED Update error messages exec → qa
428
+ 498 PROCEED Update error messages spec → exec → qa
375
429
  497 PROCEED Refactor batch executor spec → exec → qa
376
430
  496 PARK Blocked on #490 schema migration ‖
377
- 495 PROCEED CLI help text improvements exec → qa
378
- 494 PROCEED Assess batch formatting fix exec → qa
431
+ 495 PROCEED CLI help text improvements spec → exec → qa
432
+ 494 PROCEED Assess batch formatting fix spec → exec → qa
379
433
  493 CLOSE Duplicate of #491 —
380
434
  492 PROCEED Add export command spec → exec → qa
381
- 491 PROCEED Normalize config paths exec → qa
435
+ 491 PROCEED Normalize config paths spec → exec → qa
382
436
  ────────────────────────────────────────────────────────────────
383
437
  Commands:
384
- npx sequant run 503 502 501 498 495 494 -q --phases exec,qa
385
- npx sequant run 491 -q --phases exec,qa
386
- npx sequant run 499 -q --phases spec,exec,test,qa
387
- npx sequant run 500 -q --phases spec,security-review,exec,qa
388
- npx sequant run 497 492 -q
438
+ npx sequant run 503 502 501 499 498 497 -q
439
+ npx sequant run 495 494 492 491 -q
440
+ npx sequant run 500 -q --security-review
389
441
  ────────────────────────────────────────────────────────────────
390
442
  Order: 497 → 492 (497 refactors batch-executor internals that 492's export command uses)
391
443
 
392
- ⚠ #500 bug + auth labels — domain label takes priority
393
- ⚠ #499 bug + ui labels — domain label triggers test phase
444
+ ⚠ #500 bug + auth labels — auth (domain) adds security-review phase
445
+ ⚠ #499 bug + ui labels — ui (domain) adds test phase
394
446
 
395
447
  Flags:
396
- --phases ...,security-review #500 auth label → security review required
397
- --phases ...,test #499 ui label → browser verification
448
+ --security-review #500 auth label → security review required
398
449
  ────────────────────────────────────────────────────────────────
399
450
  Cleanup:
400
451
  gh issue close 493 # duplicate of #491
401
452
  ────────────────────────────────────────────────────────────────
402
453
 
403
- <!-- #503 assess:action=PROCEED assess:phases=exec,qa assess:quality-loop=true -->
404
- <!-- #502 assess:action=PROCEED assess:phases=exec,qa assess:quality-loop=true -->
405
- <!-- #501 assess:action=PROCEED assess:phases=exec,qa assess:quality-loop=true -->
454
+ <!-- #503 assess:action=PROCEED assess:phases=spec,exec,qa assess:quality-loop=true -->
455
+ <!-- #502 assess:action=PROCEED assess:phases=spec,exec,qa assess:quality-loop=true -->
456
+ <!-- #501 assess:action=PROCEED assess:phases=spec,exec,qa assess:quality-loop=true -->
406
457
  <!-- #500 assess:action=PROCEED assess:phases=spec,security-review,exec,qa assess:quality-loop=true -->
407
458
  <!-- #499 assess:action=PROCEED assess:phases=spec,exec,test,qa assess:quality-loop=true -->
408
- <!-- #498 assess:action=PROCEED assess:phases=exec,qa assess:quality-loop=true -->
459
+ <!-- #498 assess:action=PROCEED assess:phases=spec,exec,qa assess:quality-loop=true -->
409
460
  <!-- #497 assess:action=PROCEED assess:phases=spec,exec,qa assess:quality-loop=true -->
410
461
  <!-- #496 assess:action=PARK -->
411
- <!-- #495 assess:action=PROCEED assess:phases=exec,qa assess:quality-loop=true -->
412
- <!-- #494 assess:action=PROCEED assess:phases=exec,qa assess:quality-loop=true -->
462
+ <!-- #495 assess:action=PROCEED assess:phases=spec,exec,qa assess:quality-loop=true -->
463
+ <!-- #494 assess:action=PROCEED assess:phases=spec,exec,qa assess:quality-loop=true -->
413
464
  <!-- #493 assess:action=CLOSE -->
414
465
  <!-- #492 assess:action=PROCEED assess:phases=spec,exec,qa assess:quality-loop=true -->
415
- <!-- #491 assess:action=PROCEED assess:phases=exec,qa assess:quality-loop=true -->
466
+ <!-- #491 assess:action=PROCEED assess:phases=spec,exec,qa assess:quality-loop=true -->
416
467
  ```
417
468
 
418
469
  ---
@@ -599,6 +650,7 @@ Every separator and section is conditional. If there are no warnings, no chain,
599
650
  After displaying output, prompt the user to save using `AskUserQuestion` with options "Yes (Recommended)" and "No".
600
651
 
601
652
  If confirmed, post a structured comment to each issue via `gh issue comment`. Each posted comment should include:
653
+ - **Supersession header** (when priors exist): If `findAllAssessComments` returned ≥1 prior, prepend `buildSupersessionHeader(priors)` immediately above the `→ ACTION — reason` line. When `detectChurn(...).isChurn === true`, also emit a `⚠ Re-assessed N times since <firstDate> without execution — possible blocker or low priority` warning in the dashboard. When `shouldPromptOnConflict(prior, new) === true`, confirm with the user via `AskUserQuestion` before posting. See "Prior Assessment Detection" in Step 1 for full protocol.
602
654
  - The action headline (`→ ACTION — reason`)
603
655
  - The workflow (for PROCEED/REWRITE)
604
656
  - Standard HTML markers on separate lines:
@@ -634,5 +686,7 @@ If confirmed, post a structured comment to each issue via `gh issue comment`. Ea
634
686
  - [ ] Separators appear between every shown section; omitted when adjacent section is omitted
635
687
  - [ ] Annotations/sections omitted when not applicable (silence = healthy)
636
688
  - [ ] HTML markers present for every assessed issue
689
+ - [ ] Supersession header prepended when prior assess comments exist (`buildSupersessionHeader`)
690
+ - [ ] Churn warning included in dashboard when `detectChurn(...).isChurn === true`
637
691
  - [ ] Batch mode: table is the primary output, no per-issue detail sections
638
692
  - [ ] Single mode: focused summary with separators between sections
@@ -0,0 +1,109 @@
1
+ # Predicted file-collision detection
2
+
3
+ `/assess` Step 5 inspects two sources of overlap between PROCEED issues:
4
+
5
+ 1. **Active-worktree overlap.** For each running worktree, `git diff --name-only main...HEAD` is intersected with the assessed issues' likely-touched files. Catches in-flight work.
6
+ 2. **Predicted file-collision (this document).** For each pair of unstarted PROCEED issues, the detector reads issue bodies and predicts which pairs will modify the same file once both run in parallel worktrees.
7
+
8
+ This document is the tunable surface for the predicted-collision heuristic. The skill prose in `SKILL.md` names the detection functions; the patterns and the exclusion list live here so they can change without skill edits.
9
+
10
+ ## Trigger
11
+
12
+ The detector runs automatically during Step 5 whenever ≥2 PROCEED issues are present in the assessment. Single-issue assessments skip it.
13
+
14
+ ## Path-extraction heuristics
15
+
16
+ For each issue body, paths are extracted in this order:
17
+
18
+ ### 1. Strip code blocks and HTML comments
19
+
20
+ Fenced code blocks (```` ``` … ``` ````) and HTML comments (`<!-- … -->`) are removed before any path matching. This is the **AC-5 false-positive guard**: paths quoted as code in prose count, paths inside a code block don't.
21
+
22
+ ### 2. Backtick-quoted source paths (PATH_REGEX)
23
+
24
+ Backtick-quoted paths starting with one of the tracked roots and ending in a known source extension are extracted verbatim:
25
+
26
+ ```
27
+ `(.claude|templates|skills|src|bin|docs)/<path-segment>+\.(md|ts|tsx|json|sh)`
28
+ ```
29
+
30
+ Examples that match:
31
+
32
+ - `` `.claude/skills/assess/SKILL.md` ``
33
+ - `` `src/lib/foo.ts` ``
34
+ - `` `templates/scripts/dev/foo.sh` ``
35
+
36
+ Examples that **don't** match:
37
+
38
+ - `` `phase-mapper.ts` `` — no directory prefix; too generic to disambiguate
39
+ - `` `.claude/skills/**/*.md` `` — glob, not a literal path
40
+ - `` `references/foo.md` `` — `references` is not a tracked root (it lives under `skills/<name>/`)
41
+
42
+ ### 3. Canonical bare form for skill files
43
+
44
+ Skill files have three byte-identical mirrors at `.claude/skills/<name>/...`, `templates/skills/<name>/...`, `skills/<name>/...`. Treating the mirrors as separate paths would produce 3× the `Order:` lines and 6× the warnings for one logical conflict.
45
+
46
+ The detector normalizes all three mirror prefixes to the bare subpath at extraction time:
47
+
48
+ | Input (in issue body) | Canonical |
49
+ |-----------------------|-----------|
50
+ | `` `.claude/skills/qa/SKILL.md` `` | `qa/SKILL.md` |
51
+ | `` `templates/skills/qa/SKILL.md` `` | `qa/SKILL.md` |
52
+ | `` `skills/qa/SKILL.md` `` | `qa/SKILL.md` |
53
+ | `` `qa/SKILL.md` `` (under 3-dir sync) | `qa/SKILL.md` |
54
+
55
+ This is the form that appears in `Order:` lines and `⚠` warnings.
56
+
57
+ ### 4. Bare `<name>/SKILL.md` references (gated on 3-dir sync)
58
+
59
+ When the body also signals "3-dir sync" (regex below), bare skill-file mentions like `` `qa/SKILL.md` `` and `` `spec/SKILL.md` `` are added to the path set in canonical form. The 3-dir-sync gate prevents over-extraction from incidental skill-file references in prose.
60
+
61
+ 3-dir-sync language is matched by:
62
+
63
+ ```
64
+ /3[- ]dir(?:ectory)?\s+sync|across\s+all\s+three\s+skill\s+directories|across\s+(?:the\s+)?three\s+skill\s+directories/i
65
+ ```
66
+
67
+ ### 5. Slash-command-skill derivation (gated on 3-dir sync)
68
+
69
+ When the body signals 3-dir sync, every `/<skill>` slash-command mention is also added as `<skill>/SKILL.md` (canonical bare form) — provided `<skill>` matches a known skill name. This catches issues that describe section changes via `/qa Section 6c`-style notation rather than naming the file path.
70
+
71
+ The known-skill-name list lives in `KNOWN_SKILL_NAMES` in `src/lib/assess-collision-detect.ts`. Keep it in sync with the actual skill set under `skills/`. Adding a new skill? Append its name here.
72
+
73
+ Slash-command derivation requires the same fenced-code-block / HTML-comment stripping — `/qa` mentioned only inside a code block does **not** trigger derivation.
74
+
75
+ ## False-positive guards
76
+
77
+ ### Globally excluded paths
78
+
79
+ These paths are stripped from every issue's path set before pairwise intersection. They are paths that virtually every PROCEED issue tends to touch — including them would flag every batch as colliding and train users to ignore the warning.
80
+
81
+ - `CHANGELOG.md` — every PROCEED issue updates the unreleased section
82
+ - `package-lock.json` — alphabetically merged in practice; collisions are rare in practice
83
+ - `yarn.lock`
84
+ - `pnpm-lock.yaml`
85
+
86
+ `EXCLUDED_PATHS` in `src/lib/assess-collision-detect.ts` is the canonical list. To add or remove an entry, edit that constant; this document and the skill prose pick up the change automatically.
87
+
88
+ ### Code block / HTML comment stripping
89
+
90
+ Step 1 of the extraction (above) removes all fenced code blocks and HTML comments before path matching. A path mentioned **only** inside one of those will not contribute to the issue's path set.
91
+
92
+ ### Path-shape constraints
93
+
94
+ The PATH_REGEX requires a directory prefix (one of the six tracked roots) and a known source extension. Bare filenames in prose (e.g. "phase-mapper.ts behavior") and glob patterns (`**/*.md`) are not extracted.
95
+
96
+ ## Tuning notes
97
+
98
+ - **Proximity weighting** is not implemented. The original feature design proposed weighting paths inside `- [ ] **AC-N:**` bullets higher than paths in "Motivation" or "Additional context". Adding it is a follow-up if the false-positive rate becomes a problem in practice; leave it out until evidence demands it.
99
+ - **Cost.** For 13 issues (the realistic batch ceiling), pairwise comparison is 78 pairs — cheap, no real performance concern. Don't optimize prematurely.
100
+
101
+ ## Output rules
102
+
103
+ The detector returns `CollisionResult[]` from `detectFileCollisions`. The formatter (`formatCollisionAnnotations`) renders annotations in the dashboard format:
104
+
105
+ - `Order: A → B (path)` per pair (or `Order: A → B → C (path)` for 3+ on the same file). `path` is the canonical bare form (e.g. `qa/SKILL.md`).
106
+ - `⚠ #N Modifies <path> (overlaps #M); land sequentially` per affected issue.
107
+ - `Chain: npx sequant run A B C --chain --qa-gate -q # alternative — N issues modify <path> (chain length≥3 historically 1/6 = 17%; see docs/reference/chain-mode-analysis-2026-05.md)` only when ≥3 issues collide on the same file (suggest-only). The historical-rate annotation comes from the #604 forensic write-up; users see the suggestion alongside the parallel default and can weigh the trade-off.
108
+
109
+ The bare-filename `Order:` exception (defined in the skill's "Annotation Rules") applies here — predicted collisions are file-collision reasons by definition, so the filename in parentheses is the reason verbatim.