sequant 2.1.2 → 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 (146) 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 +95 -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/init.d.ts +1 -0
  8. package/dist/src/commands/init.js +118 -0
  9. package/dist/src/commands/locks.d.ts +67 -0
  10. package/dist/src/commands/locks.js +290 -0
  11. package/dist/src/commands/merge.js +11 -0
  12. package/dist/src/commands/prompt.d.ts +39 -0
  13. package/dist/src/commands/prompt.js +179 -0
  14. package/dist/src/commands/run-display.d.ts +26 -0
  15. package/dist/src/commands/run-display.js +150 -0
  16. package/dist/src/commands/run-progress.d.ts +32 -0
  17. package/dist/src/commands/run-progress.js +76 -0
  18. package/dist/src/commands/run.js +83 -73
  19. package/dist/src/commands/stats.d.ts +2 -0
  20. package/dist/src/commands/stats.js +94 -8
  21. package/dist/src/commands/status.js +27 -1
  22. package/dist/src/commands/watch.d.ts +16 -0
  23. package/dist/src/commands/watch.js +147 -0
  24. package/dist/src/lib/ac-linter.d.ts +1 -1
  25. package/dist/src/lib/ac-linter.js +81 -0
  26. package/dist/src/lib/assess-collision-detect.d.ts +91 -0
  27. package/dist/src/lib/assess-collision-detect.js +217 -0
  28. package/dist/src/lib/assess-comment-parser.d.ts +59 -1
  29. package/dist/src/lib/assess-comment-parser.js +124 -2
  30. package/dist/src/lib/cli-ui/format.d.ts +19 -0
  31. package/dist/src/lib/cli-ui/format.js +34 -0
  32. package/dist/src/lib/cli-ui/run-renderer-types.d.ts +181 -0
  33. package/dist/src/lib/cli-ui/run-renderer-types.js +7 -0
  34. package/dist/src/lib/cli-ui/run-renderer.d.ts +239 -0
  35. package/dist/src/lib/cli-ui/run-renderer.js +1173 -0
  36. package/dist/src/lib/heuristics/behavior-rule-detector.d.ts +94 -0
  37. package/dist/src/lib/heuristics/behavior-rule-detector.js +467 -0
  38. package/dist/src/lib/locks/index.d.ts +7 -0
  39. package/dist/src/lib/locks/index.js +5 -0
  40. package/dist/src/lib/locks/lock-manager.d.ts +168 -0
  41. package/dist/src/lib/locks/lock-manager.js +433 -0
  42. package/dist/src/lib/locks/types.d.ts +59 -0
  43. package/dist/src/lib/locks/types.js +31 -0
  44. package/dist/src/lib/qa/markdown-only-ci.d.ts +46 -0
  45. package/dist/src/lib/qa/markdown-only-ci.js +74 -0
  46. package/dist/src/lib/relay/activation.d.ts +60 -0
  47. package/dist/src/lib/relay/activation.js +122 -0
  48. package/dist/src/lib/relay/archive.d.ts +34 -0
  49. package/dist/src/lib/relay/archive.js +106 -0
  50. package/dist/src/lib/relay/frame.d.ts +20 -0
  51. package/dist/src/lib/relay/frame.js +76 -0
  52. package/dist/src/lib/relay/index.d.ts +13 -0
  53. package/dist/src/lib/relay/index.js +13 -0
  54. package/dist/src/lib/relay/paths.d.ts +43 -0
  55. package/dist/src/lib/relay/paths.js +59 -0
  56. package/dist/src/lib/relay/pid.d.ts +34 -0
  57. package/dist/src/lib/relay/pid.js +72 -0
  58. package/dist/src/lib/relay/reader.d.ts +35 -0
  59. package/dist/src/lib/relay/reader.js +115 -0
  60. package/dist/src/lib/relay/types.d.ts +68 -0
  61. package/dist/src/lib/relay/types.js +76 -0
  62. package/dist/src/lib/relay/writer.d.ts +48 -0
  63. package/dist/src/lib/relay/writer.js +113 -0
  64. package/dist/src/lib/settings.d.ts +31 -1
  65. package/dist/src/lib/settings.js +18 -3
  66. package/dist/src/lib/skill-version.d.ts +19 -0
  67. package/dist/src/lib/skill-version.js +68 -0
  68. package/dist/src/lib/templates.d.ts +1 -0
  69. package/dist/src/lib/templates.js +1 -1
  70. package/dist/src/lib/version-check.d.ts +60 -5
  71. package/dist/src/lib/version-check.js +97 -9
  72. package/dist/src/lib/workflow/batch-executor.d.ts +20 -1
  73. package/dist/src/lib/workflow/batch-executor.js +249 -176
  74. package/dist/src/lib/workflow/config-resolver.js +4 -0
  75. package/dist/src/lib/workflow/heartbeat.d.ts +71 -0
  76. package/dist/src/lib/workflow/heartbeat.js +194 -0
  77. package/dist/src/lib/workflow/phase-executor.d.ts +88 -3
  78. package/dist/src/lib/workflow/phase-executor.js +276 -52
  79. package/dist/src/lib/workflow/phase-mapper.d.ts +3 -2
  80. package/dist/src/lib/workflow/phase-mapper.js +17 -20
  81. package/dist/src/lib/workflow/platforms/github.d.ts +1 -1
  82. package/dist/src/lib/workflow/platforms/github.js +20 -3
  83. package/dist/src/lib/workflow/pr-status.d.ts +18 -2
  84. package/dist/src/lib/workflow/pr-status.js +41 -9
  85. package/dist/src/lib/workflow/qa-stagnation.d.ts +117 -0
  86. package/dist/src/lib/workflow/qa-stagnation.js +179 -0
  87. package/dist/src/lib/workflow/run-orchestrator.d.ts +76 -0
  88. package/dist/src/lib/workflow/run-orchestrator.js +382 -29
  89. package/dist/src/lib/workflow/run-reflect.js +1 -1
  90. package/dist/src/lib/workflow/run-state.d.ts +71 -0
  91. package/dist/src/lib/workflow/run-state.js +14 -0
  92. package/dist/src/lib/workflow/state-cleanup.d.ts +13 -5
  93. package/dist/src/lib/workflow/state-cleanup.js +17 -5
  94. package/dist/src/lib/workflow/state-manager.d.ts +12 -1
  95. package/dist/src/lib/workflow/state-manager.js +37 -0
  96. package/dist/src/lib/workflow/state-schema.d.ts +62 -0
  97. package/dist/src/lib/workflow/state-schema.js +35 -1
  98. package/dist/src/lib/workflow/types.d.ts +74 -1
  99. package/dist/src/lib/workflow/worktree-manager.d.ts +12 -4
  100. package/dist/src/lib/workflow/worktree-manager.js +76 -17
  101. package/dist/src/mcp/tools/run.d.ts +44 -0
  102. package/dist/src/mcp/tools/run.js +104 -13
  103. package/dist/src/ui/tui/App.d.ts +14 -0
  104. package/dist/src/ui/tui/App.js +41 -0
  105. package/dist/src/ui/tui/ElapsedTimer.d.ts +10 -0
  106. package/dist/src/ui/tui/ElapsedTimer.js +31 -0
  107. package/dist/src/ui/tui/Header.d.ts +6 -0
  108. package/dist/src/ui/tui/Header.js +15 -0
  109. package/dist/src/ui/tui/IssueBox.d.ts +16 -0
  110. package/dist/src/ui/tui/IssueBox.js +68 -0
  111. package/dist/src/ui/tui/Spinner.d.ts +9 -0
  112. package/dist/src/ui/tui/Spinner.js +18 -0
  113. package/dist/src/ui/tui/index.d.ts +15 -0
  114. package/dist/src/ui/tui/index.js +29 -0
  115. package/dist/src/ui/tui/theme.d.ts +29 -0
  116. package/dist/src/ui/tui/theme.js +52 -0
  117. package/dist/src/ui/tui/truncate.d.ts +11 -0
  118. package/dist/src/ui/tui/truncate.js +31 -0
  119. package/package.json +10 -3
  120. package/templates/agents/sequant-explorer.md +1 -0
  121. package/templates/agents/sequant-qa-checker.md +2 -1
  122. package/templates/agents/sequant-testgen.md +1 -0
  123. package/templates/hooks/post-tool.sh +11 -0
  124. package/templates/hooks/pre-tool.sh +18 -9
  125. package/templates/hooks/relay-check.sh +107 -0
  126. package/templates/relay/frame.txt +11 -0
  127. package/templates/scripts/cleanup-worktree.sh +25 -3
  128. package/templates/scripts/new-feature.sh +6 -0
  129. package/templates/skills/_shared/references/behavior-rule-detection.md +205 -0
  130. package/templates/skills/_shared/references/subagent-types.md +21 -8
  131. package/templates/skills/assess/SKILL.md +261 -94
  132. package/templates/skills/assess/references/predicted-collision-detection.md +109 -0
  133. package/templates/skills/docs/SKILL.md +141 -22
  134. package/templates/skills/exec/SKILL.md +10 -49
  135. package/templates/skills/fullsolve/SKILL.md +80 -32
  136. package/templates/skills/loop/SKILL.md +28 -0
  137. package/templates/skills/merger/SKILL.md +621 -0
  138. package/templates/skills/qa/SKILL.md +746 -8
  139. package/templates/skills/qa/scripts/quality-checks.sh +47 -1
  140. package/templates/skills/setup/SKILL.md +6 -0
  141. package/templates/skills/spec/SKILL.md +217 -964
  142. package/templates/skills/spec/references/parallel-groups.md +7 -0
  143. package/templates/skills/spec/references/quality-checklist.md +75 -0
  144. package/templates/skills/spec/references/recommended-workflow.md +4 -2
  145. package/templates/skills/test/SKILL.md +0 -27
  146. package/templates/skills/testgen/SKILL.md +24 -44
@@ -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
 
@@ -115,15 +150,16 @@ Surface red flags. Only track signals that change the recommendation.
115
150
  | security, auth, authentication, permissions | Domain | `spec → security-review → exec → qa` |
116
151
  | ui, frontend, admin, web, browser | Domain | `spec → exec → test → qa` |
117
152
  | complex, refactor, breaking, major | Modifier | `spec → exec → qa` + `-q` |
153
+ | (ui/frontend) + (enhancement/feature), or testable-AC signals | Modifier | inserts `testgen` before `exec` (see Testgen detection below) |
118
154
  | enhancement, feature (default) | Generic | `spec → exec → qa` |
119
- | bug, fix, hotfix, patch | Generic | `exec → qa` |
120
- | docs, documentation, readme | Generic | `exec → qa` |
155
+ | bug, fix, hotfix, patch | Generic | `spec → exec → qa` |
156
+ | docs, documentation, readme | Generic | `spec → exec → qa` |
121
157
 
122
- **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`).
123
159
 
124
160
  **Valid phases (from `PhaseSchema` in `src/lib/workflow/types.ts`):** `spec`, `security-review`, `exec`, `testgen`, `test`, `verify`, `qa`, `loop`, `merger`
125
161
 
126
- **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.
127
163
 
128
164
  **Resume detection:** Branch exists with commits ahead of main → mark as resume (`◂`).
129
165
 
@@ -131,19 +167,52 @@ Surface red flags. Only track signals that change the recommendation.
131
167
 
132
168
  **Quality loop (`-q`):** Recommend for everything except simple bug fixes and docs-only.
133
169
 
134
- **Other flags:**
135
- - `--chain` Chain issues: each branches from previous (implies --sequential)
136
- - `--qa-gate` Pause chain on QA failure, preventing downstream issues from building on broken code (requires --chain)
137
- - `--base <branch>` — Issue references a feature branch
170
+ **Testgen detection:** Add `testgen` to the workflow when any apply:
171
+ - Labels include (`ui` or `frontend`) AND (`enhancement` or `feature`)
172
+ - ACs reference "unit test", "integration test", or list "Automated Test" as a verification method
173
+
174
+ Skip when: only `bug`/`fix` labels present, only `docs` label present, or a prior `testgen` phase marker exists in issue comments.
175
+
176
+ **Chain detection (suggest-only, never auto-apply):** When 2+ assessed issues have a detected dependency, emit a `Chain:` line alongside (not replacing) the default per-issue commands. False dependency inference produces silently-wrong branch topology, so the user decides.
177
+
178
+ Triggers (any one):
179
+ - Issue body or comments mention `"depends on #N"`, `"blocked by #N"`, or `"after #N"`
180
+ - One issue's described output is another issue's input (e.g., A changes a function signature that B consumes)
181
+
182
+ Format: `Chain: npx sequant run <N1> <N2> --chain --qa-gate -q <phases> # alternative — <one-line reason>`
183
+
184
+ Flag references:
185
+ - `--chain` chains issues (each branches from previous; implies `--sequential`)
186
+ - `--qa-gate` pauses chain on QA failure (requires `--chain`)
187
+ - `--base <branch>` — issue references a feature branch
138
188
 
139
189
  ### Step 5: Conflict Detection
140
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
+
141
193
  ```bash
142
194
  git worktree list --porcelain 2>/dev/null | grep "^worktree" | cut -d' ' -f2 || true
143
195
  ```
144
196
 
145
197
  For each active worktree, check `git diff --name-only main...HEAD` for file overlap with assessed issues.
146
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
+
147
216
  ---
148
217
 
149
218
  ## Output Format
@@ -155,20 +224,25 @@ For each active worktree, check `git diff --name-only main...HEAD` for file over
155
224
  **Table column rules:** The "Reason" column must not be truncated mid-word. If a row's reason text would exceed the column width, prefer abbreviating the reason to a shorter synonym rather than cutting a word in half. Column widths should adapt to content — do not force a fixed table width.
156
225
 
157
226
  ```
158
- # Action Reason Run
159
- <N> <ACTION> <short reason> <workflow or symbol>
160
- <N> <ACTION> <short reason> <workflow or symbol>
227
+ # Action [ACs] Reason Run
228
+ <N> <ACTION> [N] <short reason> <workflow or symbol>
229
+ <N> <ACTION> [N] <short reason> <workflow or symbol>
161
230
  ...
162
231
  ────────────────────────────────────────────────────────────────
163
-
164
- npx sequant run <N1> <N2> <flags>
165
- npx sequant run <N3> <flags> # resume
166
-
232
+ Commands:
233
+ npx sequant run <N1> <N2> <flags>
234
+ npx sequant run <N3> <flags> # resume
167
235
  ────────────────────────────────────────────────────────────────
168
- Order: <N> → <N> (<shared file>) · <N> → <N> (<dependency>)
236
+ Order: <N> → <N> (<dependency reason>)
169
237
 
170
238
  ⚠ #<N> <warning>
171
239
  ⚠ #<N> <warning>
240
+
241
+ Chain: npx sequant run <N1> <N2> --chain --qa-gate -q <phases> # alternative — <reason>
242
+
243
+ Flags:
244
+ <flag> <one-line reason>
245
+ <flag> <one-line reason>
172
246
  ────────────────────────────────────────────────────────────────
173
247
  Cleanup:
174
248
  <executable command> # reason
@@ -181,12 +255,14 @@ Cleanup:
181
255
  <!-- assess:quality-loop=<bool> -->
182
256
  ```
183
257
 
258
+ **`ACs` column (conditional):** Include the `ACs` column only when every assessed issue has at least one explicit `- [ ]` checkbox AC in its body. Otherwise omit the column entirely — do not show partial values. The counter prevents eroding table trust when some issues use implicit/narrative ACs.
259
+
184
260
  #### Run Column Symbols
185
261
 
186
262
  | Symbol | Meaning | Example |
187
263
  |--------|---------|---------|
188
264
  | `spec → exec → qa` | Full workflow | Standard feature |
189
- | `exec → qa` | Skip spec | Bug, docs, or spec exists |
265
+ | `exec → qa` | Skip spec | Prior spec marker exists |
190
266
  | `◂ exec → qa` | Resume existing work | Branch has commits |
191
267
  | `◂ qa` | PR needs review/QA | Open PR, impl done |
192
268
  | `⟳ spec → exec → qa` | Restart (fresh) | Stale PR abandoned |
@@ -195,51 +271,81 @@ Cleanup:
195
271
  | `‖` | Blocked/deferred | Dependency or manual |
196
272
  | `—` | No action needed | Already closed/merged |
197
273
 
198
- #### Command Block Rules
274
+ #### Commands Block Rules
275
+
276
+ The commands block is headed by `Commands:` — no box-drawing, no character counting. The header label is the visual anchor.
199
277
 
200
278
  1. Only PROCEED and REWRITE issues get commands
201
279
  2. Group by identical phases + flags → same line
202
280
  3. Resume issues get `# resume` comment
203
281
  4. Rewrite issues get `# restart` comment
204
- 5. Chain mode issues use `--chain` flag
282
+ 5. Chain mode issues use `--chain` flag (see `Chain:` annotation rules below)
205
283
  6. If ALL issues share the same workflow, emit a single command
206
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.
207
286
 
208
287
  #### Annotation Rules
209
288
 
210
- - **`Order:`** Only when sequencing matters (shared files or dependencies). Format: `A → B (reason)` joined by ` · `
211
- - **`⚠` warnings** Only non-obvious signals (complexity, staleness, dual concerns). One line each. Prefix with issue number.
289
+ Emit annotations in this order between the separators that follow `Commands:`:
290
+ `Order:` `⚠` warnings `Chain:` `Flags:`. `Cleanup:` goes in its own block after. Omit any section (and its surrounding blank line) when it has no content.
291
+
292
+ - **`Order:`** — Only when sequencing matters. Include the **reason** for the ordering, not just `(<filename>)`. Prefer dependency reasoning over filename.
293
+ - Good: `Order: 185 → 186 (185 changes fetchApi error format that 186 consumes)`
294
+ - Good: `Order: 460 → 461 (460 adds batch-executor tests that 461's label matching depends on)`
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.
297
+
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:
299
+ - `⚠ #185 Domain errors already exist in repository layer — scope may be smaller than expected`
300
+ - `⚠ #412 bug + auth labels — domain label (auth) takes priority over bug`
301
+
302
+ - **`Chain:`** — Only when 2+ PROCEED issues have a detected dependency (see "Chain detection" in Step 4). Suggests an alternative execution topology. Does not replace the default per-issue commands. Format:
303
+ `Chain: npx sequant run <N1> <N2> --chain --qa-gate -q <phases> # alternative — <one-line reason>`
304
+
305
+ - **`Flags:`** — Only when non-default flags appear in the commands and the reason isn't obvious. One line per **distinct** flag used across all commands. Omit entire section when `-q` is the only non-default flag AND its reason is obvious (e.g., all issues are enhancements). Format:
306
+ ```
307
+ Flags:
308
+ -q 9+ ACs or multi-file scope
309
+ --testgen testable ACs detected (UI hooks + API integration)
310
+ --phases ...,test ui label → browser verification
311
+ ```
312
+
212
313
  - **`Cleanup:`** — Only when actionable (stale branches, merged-but-open issues, label changes). Show as executable commands with `# reason` comments.
213
- - **Omit entire section** (including its separator) when no annotations of that type exist.
314
+
214
315
  - **"All clear" is silence** — no annotation means no issues.
215
316
 
216
317
  #### Batch Example (mixed states, with label priority)
217
318
 
319
+ Not all issues have explicit `- [ ]` checkboxes, so the `ACs` column is omitted.
320
+
218
321
  ```
219
322
  # Action Reason Run
220
323
  462 PARK Manual measurement task ‖
221
- 461 PROCEED Exact label matching exec → qa
222
- 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
223
326
  458 PROCEED Parallel UX + race condition spec → exec → qa
224
327
  447 CLOSE PR #457 merged —
225
328
  443 PROCEED Consolidate gh calls spec → exec → qa
226
- 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
227
330
  411 PROCEED Config path normalization ◂ exec → qa
228
331
  405 REWRITE PR #380 200+ commits behind ⟳ spec → exec → qa
229
332
  ────────────────────────────────────────────────────────────────
230
-
231
- npx sequant run 461 460 -q --phases exec,qa
232
- npx sequant run 458 443 -q
233
- npx sequant run 412 -q --phases spec,security-review,exec,qa
234
- npx sequant run 411 -q --phases exec,qa # resume
235
- npx sequant run 405 -q # restart
236
-
333
+ Commands:
334
+ npx sequant run 461 460 458 443 -q
335
+ npx sequant run 412 -q --security-review
336
+ npx sequant run 411 -q --phases exec,qa # resume
337
+ npx sequant run 405 -q # restart
237
338
  ────────────────────────────────────────────────────────────────
238
- Order: 460 → 461 (batch-executor.ts)
339
+ Order: 460 → 461 (460 adds batch-executor tests that 461's label matching depends on)
239
340
 
240
341
  ⚠ #458 Dual concern (UX + race) across 4 files
241
342
  ⚠ #405 Stale 30+ days, ACs still valid
242
- ⚠ #412 bug + auth labels — domain label (auth) takes priority over bug
343
+ ⚠ #412 bug + auth labels — auth (domain) adds security-review phase
344
+
345
+ Flags:
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
243
349
  ────────────────────────────────────────────────────────────────
244
350
  Cleanup:
245
351
  git worktree remove .../447-... # merged, stale worktree
@@ -248,8 +354,8 @@ Cleanup:
248
354
  ────────────────────────────────────────────────────────────────
249
355
 
250
356
  <!-- #462 assess:action=PARK -->
251
- <!-- #461 assess:action=PROCEED assess:phases=exec,qa assess:quality-loop=true -->
252
- <!-- #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 -->
253
359
  <!-- #458 assess:action=PROCEED assess:phases=spec,exec,qa assess:quality-loop=true -->
254
360
  <!-- #447 assess:action=CLOSE -->
255
361
  <!-- #443 assess:action=PROCEED assess:phases=spec,exec,qa assess:quality-loop=true -->
@@ -258,77 +364,106 @@ Cleanup:
258
364
  <!-- #405 assess:action=REWRITE assess:phases=spec,exec,qa assess:quality-loop=true -->
259
365
  ```
260
366
 
367
+ #### Batch Example (dependent issues with testgen, chain suggestion)
368
+
369
+ All issues have explicit checkbox ACs, so the `ACs` column is shown. A dependency is detected (185 → 186), so a `Chain:` suggestion appears alongside the default commands.
370
+
371
+ ```
372
+ # Action ACs Reason Run
373
+ 185 PROCEED 6 Domain error standardization spec → exec → qa
374
+ 186 PROCEED 9 React Query hooks migration spec → testgen → exec → test → qa
375
+ ────────────────────────────────────────────────────────────────
376
+ Commands:
377
+ npx sequant run 185 -q
378
+ npx sequant run 186 -q --testgen
379
+ ────────────────────────────────────────────────────────────────
380
+ Order: 185 → 186 (185 changes fetchApi error format that 186 consumes)
381
+
382
+ ⚠ #185 Domain errors already exist in repository layer — scope may be smaller than expected
383
+ ⚠ #186 @tanstack/react-query not installed; large scope (9 hooks + optimistic updates)
384
+
385
+ Chain: npx sequant run 185 186 --chain --qa-gate -q --testgen
386
+ # alternative — use if 186 should branch from 185's work
387
+
388
+ Flags:
389
+ --testgen #186 testable ACs (UI hooks + API integration); ui label auto-adds test phase
390
+ ────────────────────────────────────────────────────────────────
391
+
392
+ <!-- #185 assess:action=PROCEED assess:phases=spec,exec,qa assess:quality-loop=true -->
393
+ <!-- #186 assess:action=PROCEED assess:phases=spec,testgen,exec,test,qa assess:quality-loop=true -->
394
+ ```
395
+
261
396
  #### Batch Example (all clean)
262
397
 
263
- When every issue is PROCEED with no warnings, the output is minimal:
398
+ When every issue is PROCEED with no warnings, no dependencies, and no non-default flags beyond an obvious `-q`, the output is minimal. The `Flags:` section is omitted because `-q` is obvious here (all PROCEED enhancements).
264
399
 
265
400
  ```
266
401
  # Action Reason Run
267
- 461 PROCEED Exact label matching exec → qa
268
- 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
269
404
  443 PROCEED Consolidate gh calls spec → exec → qa
270
405
  ────────────────────────────────────────────────────────────────
271
-
272
- npx sequant run 461 460 -q --phases exec,qa
273
- npx sequant run 443 -q
274
-
406
+ Commands:
407
+ npx sequant run 461 460 443 -q
275
408
  ────────────────────────────────────────────────────────────────
276
409
 
277
- <!-- #461 assess:action=PROCEED assess:phases=exec,qa assess:quality-loop=true -->
278
- <!-- #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 -->
279
412
  <!-- #443 assess:action=PROCEED assess:phases=spec,exec,qa assess:quality-loop=true -->
280
413
  ```
281
414
 
415
+ Silence means clean — no `Order:`, no `⚠`, no `Chain:`, no `Flags:`, no `Cleanup:`.
416
+
282
417
  #### Batch Example (large batch, 13 issues with Rule 7 split)
283
418
 
284
- When assessing 9+ issues, commands are split per Rule 7 (max 6 issue numbers per line), and the table adapts to content width:
419
+ When assessing 9+ issues, commands are split per Rule 7 (max 6 issue numbers per line), and the table adapts to content width. Mixed AC styles across issues → `ACs` column omitted.
285
420
 
286
421
  ```
287
422
  # Action Reason Run
288
- 503 PROCEED Fix typo in error output exec → qa
289
- 502 PROCEED Update deprecated API call exec → qa
290
- 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
291
426
  500 PROCEED Fix token refresh race condition spec → security-review → exec → qa
292
427
  499 PROCEED Dashboard chart rendering bug spec → exec → test → qa
293
- 498 PROCEED Update error messages exec → qa
428
+ 498 PROCEED Update error messages spec → exec → qa
294
429
  497 PROCEED Refactor batch executor spec → exec → qa
295
430
  496 PARK Blocked on #490 schema migration ‖
296
- 495 PROCEED CLI help text improvements exec → qa
297
- 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
298
433
  493 CLOSE Duplicate of #491 —
299
434
  492 PROCEED Add export command spec → exec → qa
300
- 491 PROCEED Normalize config paths exec → qa
435
+ 491 PROCEED Normalize config paths spec → exec → qa
301
436
  ────────────────────────────────────────────────────────────────
302
-
303
- npx sequant run 503 502 501 498 495 494 -q --phases exec,qa
304
- npx sequant run 491 -q --phases exec,qa
305
- npx sequant run 499 -q --phases spec,exec,test,qa
306
- npx sequant run 500 -q --phases spec,security-review,exec,qa
307
- npx sequant run 497 492 -q
308
-
437
+ Commands:
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
309
441
  ────────────────────────────────────────────────────────────────
310
- Order: 497 → 492 (batch-executor.ts)
442
+ Order: 497 → 492 (497 refactors batch-executor internals that 492's export command uses)
443
+
444
+ ⚠ #500 bug + auth labels — auth (domain) adds security-review phase
445
+ ⚠ #499 bug + ui labels — ui (domain) adds test phase
311
446
 
312
- ⚠ #500 bug + auth labels — domain label takes priority
313
- #499 bug + ui labels domain label triggers test phase
447
+ Flags:
448
+ --security-review #500 auth label security review required
314
449
  ────────────────────────────────────────────────────────────────
315
450
  Cleanup:
316
451
  gh issue close 493 # duplicate of #491
317
452
  ────────────────────────────────────────────────────────────────
318
453
 
319
- <!-- #503 assess:action=PROCEED assess:phases=exec,qa assess:quality-loop=true -->
320
- <!-- #502 assess:action=PROCEED assess:phases=exec,qa assess:quality-loop=true -->
321
- <!-- #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 -->
322
457
  <!-- #500 assess:action=PROCEED assess:phases=spec,security-review,exec,qa assess:quality-loop=true -->
323
458
  <!-- #499 assess:action=PROCEED assess:phases=spec,exec,test,qa assess:quality-loop=true -->
324
- <!-- #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 -->
325
460
  <!-- #497 assess:action=PROCEED assess:phases=spec,exec,qa assess:quality-loop=true -->
326
461
  <!-- #496 assess:action=PARK -->
327
- <!-- #495 assess:action=PROCEED assess:phases=exec,qa assess:quality-loop=true -->
328
- <!-- #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 -->
329
464
  <!-- #493 assess:action=CLOSE -->
330
465
  <!-- #492 assess:action=PROCEED assess:phases=spec,exec,qa assess:quality-loop=true -->
331
- <!-- #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 -->
332
467
  ```
333
468
 
334
469
  ---
@@ -346,9 +481,13 @@ More context since you're focused on one issue. Separators between every section
346
481
 
347
482
  → PROCEED — <one-line reason>
348
483
 
349
- npx sequant run <N> <flags>
484
+ Commands:
485
+ npx sequant run <N> <flags>
486
+
487
+ <phases> · <N> ACs
350
488
 
351
- <phases> · <N> ACs · <flag reasoning>
489
+ Flags:
490
+ <flag> <one-line reason>
352
491
  ────────────────────────────────────────────────────────────────
353
492
  ⚠ <warning if any>
354
493
  ⚠ Conflict: #<N> also modifies <path>
@@ -359,7 +498,9 @@ More context since you're focused on one issue. Separators between every section
359
498
  <!-- assess:quality-loop=<bool> -->
360
499
  ```
361
500
 
362
- If no warnings exist, omit the warning section and its separator:
501
+ **`Flags:` (single mode):** Indented list of each enabled non-default flag with a one-line reason. Omit the entire `Flags:` section when `-q` is the only non-default flag AND the reason is obvious (e.g., a straightforward enhancement). Do not repeat obvious flags.
502
+
503
+ Example with `Flags:` (non-obvious `-q` + `--testgen`):
363
504
 
364
505
  ```
365
506
  #458 — Parallel run UX freeze + reconcileState race condition
@@ -368,9 +509,33 @@ Open · bug, enhancement, cli
368
509
 
369
510
  → PROCEED — Both root causes confirmed in codebase
370
511
 
371
- npx sequant run 458 -q
512
+ Commands:
513
+ npx sequant run 458 -q
514
+
515
+ spec → exec → qa · 8 ACs
372
516
 
373
- spec → exec → qa · 8 ACs · -q (dual concern)
517
+ Flags:
518
+ -q dual concern across 4 files
519
+ ────────────────────────────────────────────────────────────────
520
+
521
+ <!-- assess:action=PROCEED -->
522
+ <!-- assess:phases=spec,exec,qa -->
523
+ <!-- assess:quality-loop=true -->
524
+ ```
525
+
526
+ Example omitting `Flags:` (obvious `-q` for a standard enhancement):
527
+
528
+ ```
529
+ #443 — Consolidate gh CLI calls
530
+ Open · enhancement
531
+ ────────────────────────────────────────────────────────────────
532
+
533
+ → PROCEED — Codebase matches spec, 5 ACs
534
+
535
+ Commands:
536
+ npx sequant run 443 -q
537
+
538
+ spec → exec → qa · 5 ACs
374
539
  ────────────────────────────────────────────────────────────────
375
540
 
376
541
  <!-- assess:action=PROCEED -->
@@ -448,7 +613,8 @@ Need: <specific information required>
448
613
 
449
614
  → REWRITE — <reason>
450
615
 
451
- npx sequant run <N> <flags> # fresh start
616
+ Commands:
617
+ npx sequant run <N> <flags> # fresh start
452
618
 
453
619
  <phases> · <N> ACs
454
620
  ────────────────────────────────────────────────────────────────
@@ -466,32 +632,25 @@ Need: <specific information required>
466
632
 
467
633
  | Section | Show when |
468
634
  |---------|-----------|
469
- | Command block | At least one PROCEED or REWRITE issue |
635
+ | `ACs` column (batch) | Every assessed issue has ≥1 explicit `- [ ]` checkbox AC |
636
+ | `Commands:` block | At least one PROCEED or REWRITE issue |
470
637
  | `Order:` | File conflicts or dependencies require sequencing |
471
- | `⚠` warnings | Non-obvious signals exist |
638
+ | `⚠` warnings | Non-obvious signals exist (complexity, staleness, dual concerns, partial-AC satisfaction) |
639
+ | `Chain:` | 2+ PROCEED issues with detected dependency (suggest-only) |
640
+ | `Flags:` | Non-default flags appear AND `-q` is not the sole flag with an obvious reason |
472
641
  | `Cleanup:` | Stale branches, merged-but-open issues, or label changes |
473
642
  | Separators | Between sections that are both shown; omit if adjacent section is omitted |
474
643
 
475
- Every separator and section is conditional. If there are no warnings and no cleanup, the output is just: table → separator → command block → separator → markers.
644
+ Every separator and section is conditional. If there are no warnings, no chain, no flags, and no cleanup, the output is just: table → separator → `Commands:` block → separator → markers.
476
645
 
477
646
  ---
478
647
 
479
- ## State Tracking
480
-
481
- Initialize state for each assessed issue:
482
-
483
- ```bash
484
- TITLE=$(gh issue view <N> --json title -q '.title')
485
- npx tsx scripts/state/update.ts init <N> "$TITLE"
486
- ```
487
-
488
- Note: `/assess` only initializes issues — actual phase tracking happens during workflow execution.
489
-
490
648
  ## Persist Analysis
491
649
 
492
650
  After displaying output, prompt the user to save using `AskUserQuestion` with options "Yes (Recommended)" and "No".
493
651
 
494
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.
495
654
  - The action headline (`→ ACTION — reason`)
496
655
  - The workflow (for PROCEED/REWRITE)
497
656
  - Standard HTML markers on separate lines:
@@ -516,10 +675,18 @@ If confirmed, post a structured comment to each issue via `gh issue comment`. Ea
516
675
 
517
676
  - [ ] Every issue has exactly one action in the table
518
677
  - [ ] Run column uses correct symbol for the action/state
519
- - [ ] Command block only contains PROCEED and REWRITE issues
520
- - [ ] Commands are grouped by compatible workflow
521
- - [ ] Separators appear between every shown section
522
- - [ ] Annotations omitted when not applicable (silence = healthy)
678
+ - [ ] `ACs` column included only when every issue has explicit `- [ ]` checkboxes
679
+ - [ ] Commands appear under a `Commands:` header (no bare indented block, no box-drawing)
680
+ - [ ] Commands block only contains PROCEED and REWRITE issues, grouped by compatible workflow
681
+ - [ ] `testgen` included when ui/frontend + enhancement/feature labels OR testable-AC signals
682
+ - [ ] `Chain:` suggested (not auto-applied) when 2+ PROCEED issues have a detected dependency
683
+ - [ ] `Flags:` section present when non-default flags appear (unless only obvious `-q`)
684
+ - [ ] `Order:` annotations carry dependency **reasoning**, not bare filenames
685
+ - [ ] `⚠` warnings include partial-AC satisfaction where applicable
686
+ - [ ] Separators appear between every shown section; omitted when adjacent section is omitted
687
+ - [ ] Annotations/sections omitted when not applicable (silence = healthy)
523
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`
524
691
  - [ ] Batch mode: table is the primary output, no per-issue detail sections
525
692
  - [ ] Single mode: focused summary with separators between sections