sequant 1.20.2 → 2.0.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 +2 -4
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +29 -9
  4. package/dist/bin/cli.js +25 -2
  5. package/dist/src/commands/doctor.js +42 -9
  6. package/dist/src/commands/init.d.ts +1 -0
  7. package/dist/src/commands/init.js +52 -0
  8. package/dist/src/commands/logs.d.ts +1 -0
  9. package/dist/src/commands/logs.js +18 -2
  10. package/dist/src/commands/run.d.ts +7 -0
  11. package/dist/src/commands/run.js +235 -68
  12. package/dist/src/commands/serve.d.ts +13 -0
  13. package/dist/src/commands/serve.js +131 -0
  14. package/dist/src/commands/stats.d.ts +1 -0
  15. package/dist/src/commands/stats.js +185 -26
  16. package/dist/src/commands/status.d.ts +2 -0
  17. package/dist/src/commands/status.js +99 -50
  18. package/dist/src/index.d.ts +2 -2
  19. package/dist/src/index.js +4 -1
  20. package/dist/src/lib/ac-parser.d.ts +2 -0
  21. package/dist/src/lib/ac-parser.js +12 -2
  22. package/dist/src/lib/assess-comment-parser.d.ts +137 -0
  23. package/dist/src/lib/assess-comment-parser.js +344 -0
  24. package/dist/src/lib/ci/config.d.ts +22 -0
  25. package/dist/src/lib/ci/config.js +134 -0
  26. package/dist/src/lib/ci/index.d.ts +12 -0
  27. package/dist/src/lib/ci/index.js +10 -0
  28. package/dist/src/lib/ci/inputs.d.ts +29 -0
  29. package/dist/src/lib/ci/inputs.js +103 -0
  30. package/dist/src/lib/ci/labels.d.ts +34 -0
  31. package/dist/src/lib/ci/labels.js +101 -0
  32. package/dist/src/lib/ci/outputs.d.ts +25 -0
  33. package/dist/src/lib/ci/outputs.js +84 -0
  34. package/dist/src/lib/ci/triggers.d.ts +9 -0
  35. package/dist/src/lib/ci/triggers.js +86 -0
  36. package/dist/src/lib/ci/types.d.ts +131 -0
  37. package/dist/src/lib/ci/types.js +47 -0
  38. package/dist/src/lib/mcp-config.d.ts +54 -0
  39. package/dist/src/lib/mcp-config.js +172 -0
  40. package/dist/src/lib/merge-check/index.js +6 -12
  41. package/dist/src/lib/merge-check/types.d.ts +20 -7
  42. package/dist/src/lib/merge-check/types.js +11 -0
  43. package/dist/src/lib/phase-signal.d.ts +3 -3
  44. package/dist/src/lib/phase-signal.js +5 -3
  45. package/dist/src/lib/settings.d.ts +52 -0
  46. package/dist/src/lib/settings.js +41 -0
  47. package/dist/src/lib/shutdown.d.ts +16 -5
  48. package/dist/src/lib/shutdown.js +32 -12
  49. package/dist/src/lib/solve-comment-parser.d.ts +9 -102
  50. package/dist/src/lib/solve-comment-parser.js +13 -248
  51. package/dist/src/lib/stacks.d.ts +8 -0
  52. package/dist/src/lib/stacks.js +34 -0
  53. package/dist/src/lib/system.js +3 -7
  54. package/dist/src/lib/test-tautology-detector.d.ts +10 -0
  55. package/dist/src/lib/test-tautology-detector.js +43 -4
  56. package/dist/src/lib/upstream/assessment.js +9 -59
  57. package/dist/src/lib/upstream/issues.js +12 -75
  58. package/dist/src/lib/version-check.d.ts +2 -2
  59. package/dist/src/lib/version-check.js +6 -3
  60. package/dist/src/lib/version.d.ts +4 -0
  61. package/dist/src/lib/version.js +25 -0
  62. package/dist/src/lib/workflow/batch-executor.d.ts +18 -86
  63. package/dist/src/lib/workflow/batch-executor.js +232 -55
  64. package/dist/src/lib/workflow/drivers/agent-driver.d.ts +56 -0
  65. package/dist/src/lib/workflow/drivers/agent-driver.js +8 -0
  66. package/dist/src/lib/workflow/drivers/aider.d.ts +18 -0
  67. package/dist/src/lib/workflow/drivers/aider.js +160 -0
  68. package/dist/src/lib/workflow/drivers/claude-code.d.ts +17 -0
  69. package/dist/src/lib/workflow/drivers/claude-code.js +165 -0
  70. package/dist/src/lib/workflow/drivers/index.d.ts +20 -0
  71. package/dist/src/lib/workflow/drivers/index.js +27 -0
  72. package/dist/src/lib/workflow/error-classifier.d.ts +16 -0
  73. package/dist/src/lib/workflow/error-classifier.js +90 -0
  74. package/dist/src/lib/workflow/log-writer.d.ts +6 -3
  75. package/dist/src/lib/workflow/log-writer.js +57 -27
  76. package/dist/src/lib/workflow/metrics-schema.d.ts +9 -9
  77. package/dist/src/lib/workflow/phase-detection.d.ts +23 -0
  78. package/dist/src/lib/workflow/phase-detection.js +45 -29
  79. package/dist/src/lib/workflow/phase-executor.d.ts +42 -3
  80. package/dist/src/lib/workflow/phase-executor.js +345 -220
  81. package/dist/src/lib/workflow/phase-mapper.d.ts +1 -1
  82. package/dist/src/lib/workflow/phase-mapper.js +7 -7
  83. package/dist/src/lib/workflow/platforms/github.d.ts +157 -0
  84. package/dist/src/lib/workflow/platforms/github.js +466 -0
  85. package/dist/src/lib/workflow/platforms/index.d.ts +17 -0
  86. package/dist/src/lib/workflow/platforms/index.js +25 -0
  87. package/dist/src/lib/workflow/platforms/platform-provider.d.ts +67 -0
  88. package/dist/src/lib/workflow/platforms/platform-provider.js +8 -0
  89. package/dist/src/lib/workflow/pr-status.d.ts +2 -4
  90. package/dist/src/lib/workflow/pr-status.js +3 -16
  91. package/dist/src/lib/workflow/qa-cache.d.ts +58 -0
  92. package/dist/src/lib/workflow/qa-cache.js +88 -0
  93. package/dist/src/lib/workflow/reconcile.d.ts +69 -0
  94. package/dist/src/lib/workflow/reconcile.js +290 -0
  95. package/dist/src/lib/workflow/ring-buffer.d.ts +17 -0
  96. package/dist/src/lib/workflow/ring-buffer.js +37 -0
  97. package/dist/src/lib/workflow/run-log-schema.d.ts +115 -24
  98. package/dist/src/lib/workflow/run-log-schema.js +47 -12
  99. package/dist/src/lib/workflow/run-reflect.js +1 -1
  100. package/dist/src/lib/workflow/state-cleanup.js +21 -0
  101. package/dist/src/lib/workflow/state-manager.d.ts +34 -3
  102. package/dist/src/lib/workflow/state-manager.js +278 -126
  103. package/dist/src/lib/workflow/state-schema.d.ts +34 -30
  104. package/dist/src/lib/workflow/state-schema.js +35 -25
  105. package/dist/src/lib/workflow/state-utils.d.ts +3 -1
  106. package/dist/src/lib/workflow/state-utils.js +1 -0
  107. package/dist/src/lib/workflow/types.d.ts +208 -6
  108. package/dist/src/lib/workflow/types.js +20 -1
  109. package/dist/src/lib/workflow/worktree-discovery.d.ts +1 -1
  110. package/dist/src/lib/workflow/worktree-discovery.js +6 -14
  111. package/dist/src/lib/workflow/worktree-manager.js +33 -51
  112. package/dist/src/mcp/index.d.ts +4 -0
  113. package/dist/src/mcp/index.js +4 -0
  114. package/dist/src/mcp/resources.d.ts +7 -0
  115. package/dist/src/mcp/resources.js +111 -0
  116. package/dist/src/mcp/run-registry.d.ts +34 -0
  117. package/dist/src/mcp/run-registry.js +42 -0
  118. package/dist/src/mcp/server.d.ts +12 -0
  119. package/dist/src/mcp/server.js +50 -0
  120. package/dist/src/mcp/tools/logs.d.ts +7 -0
  121. package/dist/src/mcp/tools/logs.js +149 -0
  122. package/dist/src/mcp/tools/run.d.ts +121 -0
  123. package/dist/src/mcp/tools/run.js +591 -0
  124. package/dist/src/mcp/tools/status.d.ts +7 -0
  125. package/dist/src/mcp/tools/status.js +127 -0
  126. package/package.json +10 -1
  127. package/templates/hooks/post-tool.sh +19 -8
  128. package/templates/hooks/pre-tool.sh +36 -49
  129. package/templates/mcp.json +6 -0
  130. package/templates/skills/assess/SKILL.md +354 -352
  131. package/templates/skills/exec/SKILL.md +64 -1
  132. package/templates/skills/fullsolve/SKILL.md +35 -4
  133. package/templates/skills/qa/SKILL.md +486 -9
  134. package/templates/skills/qa/scripts/quality-checks.sh +1 -1
  135. package/templates/skills/setup/SKILL.md +386 -0
  136. package/templates/skills/solve/SKILL.md +38 -664
  137. package/templates/skills/spec/SKILL.md +90 -31
@@ -1,10 +1,10 @@
1
1
  ---
2
2
  name: assess
3
- description: "Issue triage and status assessment - analyze current state and recommend next workflow phase."
3
+ description: "Issue triage and status assessment - analyze current state, detect health signals, and recommend next action with full workflow plan."
4
4
  license: MIT
5
5
  metadata:
6
6
  author: sequant
7
- version: "1.0"
7
+ version: "3.0"
8
8
  allowed-tools:
9
9
  - Read
10
10
  - Glob
@@ -13,462 +13,464 @@ allowed-tools:
13
13
  - Bash(gh *)
14
14
  ---
15
15
 
16
- # Issue Assessment & Triage
16
+ # Unified Issue Assessment & Triage
17
17
 
18
18
  You are the "Assessment Agent" for the current repository.
19
19
 
20
20
  ## Purpose
21
21
 
22
- When invoked as `/assess`, your job is to:
22
+ When invoked as `/assess <issue-numbers>`, your job is to:
23
23
 
24
- 1. Analyze the current state of a GitHub issue
25
- 2. Determine what phase it's in (planning, implementation, QA, complete, blocked)
26
- 3. Detect what artifacts exist (plan comments, branches, PRs, worktrees)
27
- 4. Identify blockers, missing information, or staleness
28
- 5. Show AC coverage status if applicable
29
- 6. **Recommend** the next appropriate slash command (but don't execute it)
24
+ 1. Gather issue context (GitHub, git, codebase)
25
+ 2. Run health checks to surface red flags
26
+ 3. Recommend exactly ONE action per issue from a fixed vocabulary
27
+ 4. Output a scannable dashboard (batch) or focused summary (single)
28
+ 5. Provide copy-pasteable CLI commands for actionable issues
30
29
 
31
- ## Behavior
30
+ **This command is read-only** — it analyzes and recommends but never takes action.
32
31
 
33
- Invocation:
32
+ ## Invocation
34
33
 
35
- - `/assess 123`:
36
- - Treat `123` as the GitHub issue number
37
- - Fetch issue details, comments, and related artifacts
38
- - `/assess <description>`:
39
- - Treat the text as context about what to assess
34
+ - `/assess 123` — Assess a single issue (detailed mode)
35
+ - `/assess 152 153 154` Assess multiple issues (dashboard mode)
36
+ - `/solve 123` Alias for `/assess` (deprecated, will show notice)
40
37
 
41
- ### When to Use This Command
38
+ ## Fixed Action Vocabulary
42
39
 
43
- **Good use cases:**
44
- - Picking up an unfamiliar issue ("What's the status of #147?")
45
- - Resuming work after days/weeks away ("Where did I leave off?")
46
- - Handoff scenarios ("What did the previous dev complete?")
47
- - Daily triage ("Which issues are ready for next steps?")
48
- - Debugging stalled issues ("Why isn't this progressing?")
40
+ Every issue gets exactly ONE action:
49
41
 
50
- **Not needed for:**
51
- - Active work on an issue you just touched (you know the state)
52
- - Simple "implement this feature" requests (just use `/spec` → `/exec`)
53
- - Issues where the next step is obvious
42
+ | Action | When |
43
+ |--------|------|
44
+ | **PROCEED** | Clear requirements, codebase matches, no blockers |
45
+ | **CLOSE** | Resolved by another PR, duplicate, outdated |
46
+ | **MERGE** | Two issues cover 70%+ same scope |
47
+ | **REWRITE** | Existing PR/branch too stale, needs fresh start |
48
+ | **CLARIFY** | No ACs, ambiguous requirements, unresolved questions |
49
+ | **PARK** | Blocked on dependency, deferred, not automatable |
54
50
 
55
51
  ## Assessment Process
56
52
 
57
- ### 1. Issue Context Gathering
53
+ ### Step 1: Context Gathering
58
54
 
59
- Collect information about the issue:
55
+ **From GitHub (parallel for all issues):**
60
56
 
61
- **From GitHub:**
57
+ ```bash
58
+ gh issue view <N> --json title,body,labels,state,comments,assignees
59
+ ```
62
60
 
63
- - Issue title, body, labels, status
61
+ - Title, body, labels, status, all comments
64
62
  - Acceptance Criteria (explicit or inferred)
65
- - **All comments** (read every comment to gather complete context):
66
- - Look for plan drafts, progress updates, QA reviews
67
- - Comments often contain clarifications, updates, or additional AC added after the initial issue description
68
- - Review discussion about implementation details, edge cases, or requirements mentioned in comments
69
- - Check for feedback from previous review cycles or iterations
70
63
  - Last activity timestamp
71
- - Assigned developer(s)
72
64
 
73
- **From Git:**
74
- - Check if branch exists: `git branch -a | grep <issue-number>`
75
- - Check if worktree exists: `git worktree list | grep <issue-number>`
76
- - Check for related PRs: `gh pr list --search "in:title <issue-number>"`
77
- - If branch exists, check commit history: `git log --oneline feature/<issue-number>*`
65
+ **From Git (parallel):**
66
+
67
+ ```bash
68
+ git branch -a | grep <N> || true
69
+ git worktree list | grep <N> || true
70
+ gh pr list --search "<N> in:title" --json number,title,state,headRefName,mergeable || true
71
+ ```
72
+
73
+ - If branch exists: `git log --oneline main..<branch>`
74
+ - If PR exists: `gh pr view <pr> --json state,mergedAt,mergeable,commits`
78
75
 
79
76
  **From Codebase:**
80
77
 
81
- - Look for TODOs mentioning the issue using the Grep tool: `Grep(pattern="TODO.*#<issue-number>")`
82
- - Check for test files related to the feature
83
- - Identify modified files (if branch exists)
78
+ - Grep for TODOs: `Grep(pattern="TODO.*#<N>")`
79
+ - Check files referenced in issue body exist
80
+ - Identify modified files if branch exists
81
+
82
+ ### Step 2: Health Checks
84
83
 
85
- ### 2. Phase Detection
84
+ Surface red flags. Only track signals that change the recommendation.
86
85
 
87
- Determine the current phase:
86
+ | Signal | Detection | Implication |
87
+ |--------|-----------|-------------|
88
+ | Referenced files don't exist | Glob/Grep | Issue may be outdated → CLOSE |
89
+ | PR has merge conflicts | `gh pr view` | Needs rebase → REWRITE |
90
+ | PR 100+ commits behind | `git rev-list --count` | Likely needs fresh start → REWRITE |
91
+ | Another issue covers same scope | Compare open issues | Consider → MERGE |
92
+ | Duplicate of closed issue | Compare recently closed | → CLOSE |
93
+ | No ACs, vague requirements | Issue body analysis | → CLARIFY |
94
+ | Open questions unanswered | Comment thread | → CLARIFY |
95
+ | Blocked on another issue | Body/comments mention deps | → PARK |
96
+ | No activity 14+ days | Timestamps | Flag as stale (warning only) |
97
+ | Stale worktree/branch from merged PR | Worktree list + PR state | → Cleanup annotation |
88
98
 
89
- **Planning Phase** - Issue needs a plan:
99
+ ### Step 3: Action Selection
90
100
 
91
- - No plan comment exists
92
- - AC are unclear or missing
93
- - No technical approach documented
94
- - **Indicators:** Issue just opened, labeled "needs planning", no detailed comments
101
+ **Decision tree (priority order):**
102
+ 1. No ACs, vague requirements → **CLARIFY**
103
+ 2. Blocked on dependency → **PARK**
104
+ 3. Resolved by another PR **CLOSE**
105
+ 4. 70%+ overlap with open issue → **MERGE**
106
+ 5. PR 100+ commits behind or files diverged → **REWRITE**
107
+ 6. Clear requirements, codebase matches → **PROCEED**
95
108
 
96
- **Implementation Phase** - Issue is being coded:
109
+ ### Step 4: Workflow Detection (PROCEED/REWRITE only)
97
110
 
98
- - Plan exists (in comments or inferred)
99
- - Branch/worktree exists with commits
100
- - Some AC partially met
101
- - **Indicators:** Branch exists, recent commits, labeled "in progress"
111
+ **Phase selection from labels:**
102
112
 
103
- **QA Phase** - Implementation complete, needs review:
104
- - Branch has commits
105
- - Developer claims implementation complete
106
- - No QA review exists yet
107
- - **Indicators:** PR open, labeled "ready for review", implementation comment exists
113
+ | Labels | Workflow |
114
+ |--------|----------|
115
+ | bug, fix, hotfix, patch | `exec → qa` |
116
+ | docs, documentation, readme | `exec → qa` |
117
+ | ui, frontend, admin, web, browser | `spec exec → test → qa` |
118
+ | security, auth, authentication, permissions | `spec → security-review → exec → qa` |
119
+ | complex, refactor, breaking, major | `spec → exec → qa` + `-q` |
120
+ | enhancement, feature (default) | `spec → exec → qa` |
108
121
 
109
- **Blocked Phase** - Issue is stuck:
110
- - No activity for 7+ days
111
- - Open questions in comments
112
- - Dependency on another issue
113
- - **Indicators:** Labeled "blocked", comments mention blockers, stale
122
+ **Valid phases (from `PhaseSchema` in `src/lib/workflow/types.ts`):** `spec`, `security-review`, `exec`, `testgen`, `test`, `verify`, `qa`, `loop`, `merger`
114
123
 
115
- **Complete Phase** - Issue is done:
116
- - PR merged
117
- - AC all met (based on QA review)
118
- - Issue closed
119
- - **Indicators:** Closed, PR merged, labeled "completed"
124
+ **Skip spec when:** bug/docs label, OR spec comment already exists on issue.
120
125
 
121
- **Unclear Phase** - Can't determine state:
122
- - Insufficient information
123
- - Conflicting indicators
124
- - **Action:** Request clarification
126
+ **Resume detection:** Branch exists with commits ahead of main → mark as resume (`◂`).
125
127
 
126
- ### 3. Artifact Detection
128
+ **PR review detection:** Open PR with implementation complete → mark as review-needed (`◂ qa`).
127
129
 
128
- List what exists:
130
+ **Quality loop (`-q`):** Recommend for everything except simple bug fixes and docs-only.
129
131
 
130
- **Planning Artifacts:**
131
- - [ ] AC checklist in issue or comments
132
- - [ ] Implementation plan (phases/steps)
133
- - [ ] Architecture decisions documented
134
- - [ ] Open questions identified
132
+ **Other flags:**
133
+ - `--chain` Chain issues: each branches from previous (implies --sequential)
134
+ - `--qa-gate` Pause chain on QA failure, preventing downstream issues from building on broken code (requires --chain)
135
+ - `--base <branch>` Issue references a feature branch
135
136
 
136
- **Implementation Artifacts:**
137
- - [ ] Feature branch: `feature/<issue-number>-<slug>`
138
- - [ ] Worktree: `../worktrees/feature/<branch-name>/`
139
- - [ ] Commits on branch: X commits since branching
140
- - [ ] Modified files: [list key files]
141
- - [ ] Tests written: [test file paths]
137
+ ### Step 5: Conflict Detection
142
138
 
143
- **QA Artifacts:**
144
- - [ ] PR open: #<pr-number>
145
- - [ ] QA review comment exists
146
- - [ ] Test results: [passing/failing]
147
- - [ ] Build status: [passing/failing]
139
+ ```bash
140
+ git worktree list --porcelain 2>/dev/null | grep "^worktree" | cut -d' ' -f2 || true
141
+ ```
148
142
 
149
- **Blockers/Issues:**
150
- - [ ] Open questions in comments
151
- - [ ] Failed tests or build
152
- - [ ] Dependency on issue #<other-issue>
153
- - [ ] Missing resources or access
154
- - [ ] Stale (no activity in X days)
143
+ For each active worktree, check `git diff --name-only main...HEAD` for file overlap with assessed issues.
155
144
 
156
- ### 4. AC Coverage Analysis
145
+ ---
157
146
 
158
- If AC exist, assess coverage:
147
+ ## Output Format
159
148
 
160
- **For each AC item:**
161
- - `MET` - Evidence suggests complete
162
- - `IN_PROGRESS` - Partially implemented
163
- - `NOT_STARTED` - No evidence of work
164
- - `UNCLEAR` - Can't determine from available info
149
+ ### Batch Mode (2+ issues)
165
150
 
166
- **Example:**
167
- ```
168
- AC Coverage:
169
- - AC-1: Display fact-check queue in admin panel - MET
170
- - AC-2: Allow editors to approve/reject items - IN_PROGRESS
171
- - AC-3: Send email notifications on approval - NOT_STARTED
172
- - AC-4: Log all actions in audit log - UNCLEAR (no audit log visible)
151
+ **Design principle:** Dashboard first. Copy-pasteable commands. Silence means healthy.
173
152
 
174
- Coverage: 1/4 complete, 1/4 in progress, 1/4 not started, 1/4 unclear
153
+ ```
154
+ # Action Reason Run
155
+ <N> <ACTION> <short reason> <workflow or symbol>
156
+ <N> <ACTION> <short reason> <workflow or symbol>
157
+ ...
158
+ ────────────────────────────────────────────────────────────────
159
+
160
+ ╭──────────────────────────────────────────────────────────────╮
161
+ │ npx sequant run <N1> <N2> <flags> │
162
+ │ npx sequant run <N3> <flags> # resume │
163
+ ╰──────────────────────────────────────────────────────────────╯
164
+
165
+ ────────────────────────────────────────────────────────────────
166
+ Order: <N> → <N> (<shared file>) · <N> → <N> (<dependency>)
167
+
168
+ ⚠ #<N> <warning>
169
+ ⚠ #<N> <warning>
170
+ ────────────────────────────────────────────────────────────────
171
+ Cleanup:
172
+ <executable command> # reason
173
+ <executable command> # reason
174
+ ────────────────────────────────────────────────────────────────
175
+
176
+ <!-- For posting to individual issues, use standard marker format: -->
177
+ <!-- assess:action=<ACTION> -->
178
+ <!-- assess:phases=<csv> -->
179
+ <!-- assess:quality-loop=<bool> -->
175
180
  ```
176
181
 
177
- ### 5. Staleness Check
178
-
179
- Flag if issue is stale:
182
+ #### Run Column Symbols
180
183
 
181
- - **Fresh:** Activity within 3 days
182
- - **Aging:** 3-7 days since last activity
183
- - **Stale:** 7-14 days since last activity
184
- - **Abandoned:** 14+ days since last activity
184
+ | Symbol | Meaning | Example |
185
+ |--------|---------|---------|
186
+ | `spec exec qa` | Full workflow | Standard feature |
187
+ | `exec qa` | Skip spec | Bug, docs, or spec exists |
188
+ | `◂ exec → qa` | Resume existing work | Branch has commits |
189
+ | `◂ qa` | PR needs review/QA | Open PR, impl done |
190
+ | `⟳ spec → exec → qa` | Restart (fresh) | Stale PR abandoned |
191
+ | `→ #N` | Merge into target | Overlapping issue |
192
+ | `?` | Needs info first | Missing ACs |
193
+ | `‖` | Blocked/deferred | Dependency or manual |
194
+ | `—` | No action needed | Already closed/merged |
185
195
 
186
- For stale/abandoned issues, identify:
187
- - Last actor (who touched it last)
188
- - Last action type (commit, comment, label change)
189
- - Likely cause of staleness (blocked, low priority, forgotten)
196
+ #### Command Block Rules
190
197
 
191
- ## Output Structure
198
+ 1. Only PROCEED and REWRITE issues get commands
199
+ 2. Group by identical phases + flags → same line
200
+ 3. Resume issues get `# resume` comment
201
+ 4. Rewrite issues get `# restart` comment
202
+ 5. Chain mode issues use `--chain` flag
203
+ 6. If ALL issues share the same workflow, emit a single command
192
204
 
193
- Produce a structured assessment:
205
+ #### Annotation Rules
194
206
 
195
- ### Issue Summary
196
- - **Issue:** #123 - <title>
197
- - **Status:** <Open|Closed> | <labels>
198
- - **Last Activity:** X days ago (<timestamp>)
199
- - **Phase:** <Planning|Implementation|QA|Blocked|Complete|Unclear>
207
+ - **`Order:`** — Only when sequencing matters (shared files or dependencies). Format: `A → B (reason)` joined by ` · `
208
+ - **`⚠` warnings** Only non-obvious signals (complexity, staleness, dual concerns). One line each. Prefix with issue number.
209
+ - **`Cleanup:`** Only when actionable (stale branches, merged-but-open issues, label changes). Show as executable commands with `# reason` comments.
210
+ - **Omit entire section** (including its separator) when no annotations of that type exist.
211
+ - **"All clear" is silence** — no annotation means no issues.
200
212
 
201
- ### Acceptance Criteria
202
- - AC-1: ... [MET|IN_PROGRESS|NOT_STARTED|UNCLEAR]
203
- - AC-2: ... [MET|IN_PROGRESS|NOT_STARTED|UNCLEAR]
204
- - ...
205
- - **Coverage:** X/Y complete
213
+ #### Batch Example (mixed states)
206
214
 
207
- (If AC don't exist or are unclear, note: "AC not clearly defined")
215
+ ```
216
+ # Action Reason Run
217
+ 462 PARK Manual measurement task ‖
218
+ 461 PROCEED Exact label matching exec → qa
219
+ 460 PROCEED batch-executor tests exec → qa
220
+ 458 PROCEED Parallel UX + race condition spec → exec → qa
221
+ 447 CLOSE PR #457 merged —
222
+ 443 PROCEED Consolidate gh calls spec → exec → qa
223
+ 412 PROCEED Auth token refresh ◂ exec → qa
224
+ 405 REWRITE PR #380 200+ commits behind ⟳ spec → exec → qa
225
+ ────────────────────────────────────────────────────────────────
226
+
227
+ ╭──────────────────────────────────────────────────────────────╮
228
+ │ npx sequant run 461 460 -q --phases exec,qa │
229
+ │ npx sequant run 458 443 -q │
230
+ │ npx sequant run 412 -q --phases exec,qa # resume │
231
+ │ npx sequant run 405 -q # restart │
232
+ ╰──────────────────────────────────────────────────────────────╯
233
+
234
+ ────────────────────────────────────────────────────────────────
235
+ Order: 460 → 461 (batch-executor.ts)
236
+
237
+ ⚠ #458 Dual concern (UX + race) across 4 files
238
+ ⚠ #405 Stale 30+ days, ACs still valid
239
+ ────────────────────────────────────────────────────────────────
240
+ Cleanup:
241
+ git worktree remove .../447-... # merged, stale worktree
242
+ gh issue close 447 # PR #457 merged
243
+ gh issue edit 461 --add-label cli # missing label
244
+ ────────────────────────────────────────────────────────────────
245
+
246
+ <!-- #462 assess:action=PARK -->
247
+ <!-- #461 assess:action=PROCEED assess:phases=exec,qa assess:quality-loop=true -->
248
+ <!-- #460 assess:action=PROCEED assess:phases=exec,qa assess:quality-loop=true -->
249
+ <!-- #458 assess:action=PROCEED assess:phases=spec,exec,qa assess:quality-loop=true -->
250
+ <!-- #447 assess:action=CLOSE -->
251
+ <!-- #443 assess:action=PROCEED assess:phases=spec,exec,qa assess:quality-loop=true -->
252
+ <!-- #412 assess:action=PROCEED assess:phases=exec,qa assess:quality-loop=true -->
253
+ <!-- #405 assess:action=REWRITE assess:phases=spec,exec,qa assess:quality-loop=true -->
254
+ ```
208
255
 
209
- ### Artifacts Found
210
- **Planning:**
211
- - [x] Plan comment in issue #<comment-id>
212
- - [ ] Architecture decisions documented
256
+ #### Batch Example (all clean)
213
257
 
214
- **Implementation:**
215
- - [x] Branch: `feature/123-issue-slug` (5 commits)
216
- - [x] Worktree: `../worktrees/feature/123-issue-slug/`
217
- - [x] Modified files: `components/admin/FactCheckQueue.tsx`, `lib/queries/fact-checks.ts`
218
- - [ ] Tests written
258
+ When every issue is PROCEED with no warnings, the output is minimal:
219
259
 
220
- **QA:**
221
- - [ ] PR open
222
- - [ ] QA review complete
260
+ ```
261
+ # Action Reason Run
262
+ 461 PROCEED Exact label matching exec qa
263
+ 460 PROCEED batch-executor tests exec → qa
264
+ 443 PROCEED Consolidate gh calls spec → exec → qa
265
+ ────────────────────────────────────────────────────────────────
266
+
267
+ ╭──────────────────────────────────────────────────────────────╮
268
+ │ npx sequant run 461 460 -q --phases exec,qa │
269
+ │ npx sequant run 443 -q │
270
+ ╰──────────────────────────────────────────────────────────────╯
271
+
272
+ ────────────────────────────────────────────────────────────────
273
+
274
+ <!-- #461 assess:action=PROCEED assess:phases=exec,qa assess:quality-loop=true -->
275
+ <!-- #460 assess:action=PROCEED assess:phases=exec,qa assess:quality-loop=true -->
276
+ <!-- #443 assess:action=PROCEED assess:phases=spec,exec,qa assess:quality-loop=true -->
277
+ ```
223
278
 
224
- ### Blockers & Issues
225
- - [ ] None identified
226
- - [x] Stale (10 days since last commit)
227
- - [x] Missing tests
228
- - [ ] Depends on issue #<other>
279
+ ---
229
280
 
230
- ### Label Review
281
+ ### Single Mode (1 issue)
231
282
 
232
- Analyze current labels vs issue content and suggest updates when mismatches are detected:
283
+ More context since you're focused on one issue. Separators between every section.
233
284
 
234
- **Current Labels:** `enhancement`, `admin`
235
- **Suggested Labels:** `enhancement`, `admin`, `refactor`
236
- **Reason:** Issue body mentions structural changes across multiple files
237
- **Quality Loop Impact:** Will auto-enable due to `refactor` label
285
+ #### PROCEED
238
286
 
239
- **Suggested Action:**
240
- ```bash
241
- gh issue edit <N> --add-label refactor
242
287
  ```
288
+ #<N> — <Title>
289
+ <State> · <labels>
290
+ ────────────────────────────────────────────────────────────────
243
291
 
244
- **Label Detection Hints:**
245
- - `refactor` - Keywords: "refactor", "restructure", "reorganize", "cleanup", "migration"
246
- - `complex` - Keywords: "complex", "major", "large-scale", "breaking"
247
- - `ui`/`frontend` - Keywords: "component", "UI", "page", "form", "button", "modal"
248
- - `backend` - Keywords: "API", "database", "query", "server", "endpoint"
249
- - `cli` - Keywords: "command", "CLI", "script", "terminal"
250
- - `docs` - Keywords: "documentation", "README", "guide", "tutorial"
251
- - `security` - Keywords: "auth", "permission", "vulnerability", "secret", "token"
252
- - `bug` - Keywords: "fix", "broken", "error", "crash", "doesn't work"
253
-
254
- **When to Suggest Label Updates:**
255
- - Issue body contains keywords not reflected in current labels
256
- - Complexity dropdown selection doesn't match actual labels
257
- - Quality loop would benefit from additional labels (complex/refactor/breaking)
258
- - Area dropdown selection doesn't match current labels (ui/backend/cli/docs)
292
+ PROCEED — <one-line reason>
259
293
 
260
- ### Recommendation
294
+ ╭──────────────────────────────────────────────────────────────╮
295
+ │ npx sequant run <N> <flags> │
296
+ ╰──────────────────────────────────────────────────────────────╯
261
297
 
262
- Based on the assessment, recommend one of:
298
+ <phases> · <N> ACs · <flag reasoning>
299
+ ────────────────────────────────────────────────────────────────
300
+ ⚠ <warning if any>
301
+ ⚠ Conflict: #<N> also modifies <path>
302
+ ────────────────────────────────────────────────────────────────
263
303
 
264
- **If Phase = Planning:**
265
- ```
266
- RECOMMENDATION: Run `/spec 123`
267
- - Issue needs a clear plan and AC before implementation
268
- - This will establish AC checklist and technical approach
304
+ <!-- assess:action=PROCEED -->
305
+ <!-- assess:phases=<csv> -->
306
+ <!-- assess:quality-loop=<bool> -->
269
307
  ```
270
308
 
271
- **If Phase = Implementation (not started):**
272
- ```
273
- RECOMMENDATION: Run `/exec 123`
274
- - Plan exists and AC are clear
275
- - Ready to begin implementation
276
- - This will create feature worktree and start coding
309
+ If no warnings exist, omit the warning section and its separator:
310
+
277
311
  ```
312
+ #458 — Parallel run UX freeze + reconcileState race condition
313
+ Open · bug, enhancement, cli
314
+ ────────────────────────────────────────────────────────────────
315
+
316
+ → PROCEED — Both root causes confirmed in codebase
278
317
 
279
- **If Phase = Implementation (in progress):**
318
+ ╭──────────────────────────────────────────────────────────────╮
319
+ │ npx sequant run 458 -q │
320
+ ╰──────────────────────────────────────────────────────────────╯
321
+
322
+ spec → exec → qa · 8 ACs · -q (dual concern)
323
+ ────────────────────────────────────────────────────────────────
324
+
325
+ <!-- assess:action=PROCEED -->
326
+ <!-- assess:phases=spec,exec,qa -->
327
+ <!-- assess:quality-loop=true -->
280
328
  ```
281
- RECOMMENDATION: Continue `/exec 123`
282
- - Implementation is underway (5 commits on branch)
283
- - Worktree exists at: ../worktrees/feature/123-issue-slug/
284
- - AC coverage: 1/4 complete, 2/4 in progress
285
- - Navigate to worktree and continue implementation
329
+
330
+ #### CLOSE
331
+
286
332
  ```
333
+ #<N> — <Title>
334
+ <State> · <labels>
335
+ ────────────────────────────────────────────────────────────────
336
+
337
+ → CLOSE — <reason with evidence>
338
+ ────────────────────────────────────────────────────────────────
339
+ Cleanup:
340
+ <executable commands> # reason
341
+ ────────────────────────────────────────────────────────────────
287
342
 
288
- **If Phase = QA:**
343
+ <!-- assess:action=CLOSE -->
289
344
  ```
290
- RECOMMENDATION: Run `/qa 123`
291
- - Implementation appears complete
292
- - Branch has 12 commits, last commit 2 days ago
293
- - No QA review exists yet
294
- - Review code and validate against AC
345
+
346
+ #### CLARIFY
347
+
295
348
  ```
349
+ #<N> — <Title>
350
+ <State> · <labels>
351
+ ────────────────────────────────────────────────────────────────
296
352
 
297
- **If Phase = Blocked:**
353
+ CLARIFY <what's missing>
354
+
355
+ Need: <specific information required>
356
+ <details about why this blocks work>
357
+ ────────────────────────────────────────────────────────────────
358
+
359
+ <!-- assess:action=CLARIFY -->
298
360
  ```
299
- RECOMMENDATION: Resolve blockers first
300
- - Issue depends on #145 (not yet merged)
301
- - Open question in comments: "Should we use email or in-app notifications?"
302
- - Suggest: Review #145 status, clarify notification approach with team
303
- - Once unblocked, run `/exec 123` to continue
361
+
362
+ #### PARK
363
+
304
364
  ```
365
+ #<N> — <Title>
366
+ <State> · <labels>
367
+ ────────────────────────────────────────────────────────────────
368
+
369
+ → PARK — <reason>
370
+ Resume after: <condition>
371
+ ────────────────────────────────────────────────────────────────
305
372
 
306
- **If Phase = Complete:**
373
+ <!-- assess:action=PARK -->
307
374
  ```
308
- RECOMMENDATION: No action needed
309
- - PR #156 merged 3 days ago
310
- - All AC met (per QA review)
311
- - Issue can be closed
375
+
376
+ #### MERGE
377
+
312
378
  ```
379
+ #<N> — <Title>
380
+ <State> · <labels>
381
+ ────────────────────────────────────────────────────────────────
382
+
383
+ → MERGE → #<target> — <overlap description>
384
+ This issue: <scope summary>
385
+ Target: <scope summary>
386
+ ────────────────────────────────────────────────────────────────
313
387
 
314
- **If Phase = Unclear:**
388
+ <!-- assess:action=MERGE -->
315
389
  ```
316
- RECOMMENDATION: Gather more information
317
- - Unable to determine current state
318
- - Missing information: [list what's unclear]
319
- - Suggest: Review issue comments, check with team, or run `/spec 123` to establish baseline
390
+
391
+ #### REWRITE
392
+
320
393
  ```
394
+ #<N> — <Title>
395
+ <State> · <labels>
396
+ ────────────────────────────────────────────────────────────────
321
397
 
322
- ### Context for Next Command
398
+ REWRITE <reason>
323
399
 
324
- Provide relevant context to help the next command:
400
+ ╭──────────────────────────────────────────────────────────────╮
401
+ │ npx sequant run <N> <flags> # fresh start │
402
+ ╰──────────────────────────────────────────────────────────────╯
325
403
 
326
- **Key Files to Review:**
327
- - List the main components/files involved
328
- - Point to relevant data layer code
329
- - Reference architecture documentation if exists
404
+ <phases> · <N> ACs
405
+ ────────────────────────────────────────────────────────────────
406
+ <stale/diverged details>
407
+ ────────────────────────────────────────────────────────────────
330
408
 
331
- **Similar Patterns:**
332
- - Reference similar features in the codebase
333
- - Point to reusable patterns
409
+ <!-- assess:action=REWRITE -->
410
+ <!-- assess:phases=<csv> -->
411
+ <!-- assess:quality-loop=<bool> -->
412
+ ```
334
413
 
335
- **Potential Risks:**
336
- - Identify any error handling gaps
337
- - Note external integrations not yet tested
338
- - Flag potential database migrations needed
414
+ ---
339
415
 
340
- ## Examples
416
+ ## Section Visibility Rules
341
417
 
342
- ### Example 1: Fresh Issue Needs Planning
418
+ | Section | Show when |
419
+ |---------|-----------|
420
+ | Command block | At least one PROCEED or REWRITE issue |
421
+ | `Order:` | File conflicts or dependencies require sequencing |
422
+ | `⚠` warnings | Non-obvious signals exist |
423
+ | `Cleanup:` | Stale branches, merged-but-open issues, or label changes |
424
+ | Separators | Between sections that are both shown; omit if adjacent section is omitted |
343
425
 
344
- ```
345
- Issue Summary
346
- - Issue: #147 - Add fact-check queue to admin panel
347
- - Status: Open | needs-planning, admin
348
- - Last Activity: 2 hours ago
349
- - Phase: Planning
350
-
351
- Acceptance Criteria
352
- AC not clearly defined in issue
353
- Inferred AC from description:
354
- - Display pending fact-check items in queue
355
- - Allow approval/rejection actions
356
- - Send notifications on status change
357
-
358
- Artifacts Found
359
- Planning: None
360
- Implementation: None
361
- QA: None
362
-
363
- Blockers & Issues
364
- - [ ] No blockers
365
-
366
- Recommendation
367
- RECOMMENDATION: Run `/spec 147`
368
- - Issue is fresh but lacks detailed AC and plan
369
- - Need to establish clear requirements before implementation
370
- ```
426
+ Every separator and section is conditional. If there are no warnings and no cleanup, the output is just: table → separator → command block → separator → markers.
371
427
 
372
- ### Example 2: Implementation In Progress, Stale
428
+ ---
373
429
 
374
- ```
375
- Issue Summary
376
- - Issue: #145 - Fix data validation edge cases
377
- - Status: Open | in-progress, bug
378
- - Last Activity: 10 days ago
379
- - Phase: Implementation (Stale)
380
-
381
- Acceptance Criteria
382
- - AC-1: Handle basic validation - MET
383
- - AC-2: Handle edge cases (empty, null, special chars) - IN_PROGRESS
384
- - AC-3: Add validation tests - NOT_STARTED
385
- Coverage: 1/3 complete
386
-
387
- Artifacts Found
388
- Implementation:
389
- - [x] Branch: feature/145-validation-fixes (3 commits)
390
- - [x] Worktree: ../worktrees/feature/145-validation-fixes/
391
- - [x] Modified: lib/utils/validation.ts
392
- - [ ] Tests not found
393
-
394
- Blockers & Issues
395
- - [x] Stale (10 days since last commit)
396
- - [x] Missing tests
397
- - [ ] No known blockers
398
-
399
- Recommendation
400
- RECOMMENDATION: Resume `/exec 145`
401
- - Implementation is 1/3 complete but stale
402
- - Worktree still exists, resume work there
403
- - Focus on AC-2 (edge cases) and AC-3 (tests)
404
- - Add tests before considering complete
405
- ```
430
+ ## State Tracking
406
431
 
407
- ### Example 3: Ready for QA
432
+ Initialize state for each assessed issue:
408
433
 
409
- ```
410
- Issue Summary
411
- - Issue: #148 - Add bulk publishing to content updates
412
- - Status: Open | ready-for-review
413
- - Last Activity: 1 day ago
414
- - Phase: QA
415
-
416
- Acceptance Criteria
417
- - AC-1: Multi-select in content updates list - UNCLEAR
418
- - AC-2: Bulk publish action button - UNCLEAR
419
- - AC-3: Confirmation dialog - UNCLEAR
420
- - AC-4: Success/error feedback - UNCLEAR
421
- Coverage: Unclear (need QA review to validate)
422
-
423
- Artifacts Found
424
- Implementation:
425
- - [x] Branch: feature/148-bulk-publishing (15 commits)
426
- - [x] Modified: components/admin/news/ContentUpdatesList.tsx, lib/admin/bulk-actions.ts
427
- - [x] Tests: __tests__/bulk-publishing.test.ts
428
- QA:
429
- - [ ] No PR yet
430
- - [ ] No QA review
431
-
432
- Blockers & Issues
433
- - [ ] No blockers
434
- - Developer marked as "ready for review" in last comment
435
-
436
- Recommendation
437
- RECOMMENDATION: Run `/qa 148`
438
- - Implementation appears complete (15 commits, tests added)
439
- - Developer believes AC are met
440
- - Need QA review to validate and assess A+ status
441
- - Create PR if not exists, review code and test against AC
434
+ ```bash
435
+ TITLE=$(gh issue view <N> --json title -q '.title')
436
+ npx tsx scripts/state/update.ts init <N> "$TITLE"
442
437
  ```
443
438
 
444
- ## Meta-Assessment
439
+ Note: `/assess` only initializes issues — actual phase tracking happens during workflow execution.
445
440
 
446
- After providing the assessment, briefly note:
441
+ ## Persist Analysis
447
442
 
448
- - **Confidence Level:** How certain are you about the phase detection? (High/Medium/Low)
449
- - **Information Gaps:** What information would improve this assessment?
450
- - **Alternative Interpretations:** Are there other ways to interpret the current state?
443
+ After displaying output, prompt the user to save using `AskUserQuestion` with options "Yes (Recommended)" and "No".
444
+
445
+ If confirmed, post a structured comment to each issue via `gh issue comment`. Each posted comment should include:
446
+ - The action headline (`→ ACTION — reason`)
447
+ - The workflow (for PROCEED/REWRITE)
448
+ - Standard HTML markers on separate lines:
449
+ ```
450
+ <!-- assess:action=PROCEED -->
451
+ <!-- assess:phases=spec,exec,qa -->
452
+ <!-- assess:quality-loop=true -->
453
+ ```
451
454
 
452
455
  ## Notes
453
456
 
454
- - This command is **read-only** - it analyzes but doesn't make changes
455
- - It recommends but doesn't execute the next command
456
- - Keep the assessment concise - aim for clarity, not exhaustiveness
457
- - When in doubt about phase, say so - better to acknowledge uncertainty
458
- - Use this to orient yourself, then proceed with the appropriate workflow command
457
+ - This command is **read-only** analyzes but doesn't make changes
458
+ - Batch mode should be scannable in under 5 seconds
459
+ - Downstream tools own detail spec owns AC breakdown, qa owns health
460
+ - When in doubt, acknowledge uncertainty in the reason column
459
461
 
460
462
  ---
461
463
 
462
464
  ## Output Verification
463
465
 
464
- **Before responding, verify your output includes ALL of these:**
465
-
466
- - [ ] **Issue Summary** - Issue number, title, status, last activity, phase
467
- - [ ] **AC Coverage** - Each AC marked MET/IN_PROGRESS/NOT_STARTED/UNCLEAR
468
- - [ ] **Artifacts Found** - Planning, implementation, and QA artifacts listed
469
- - [ ] **Blockers & Issues** - Any blockers or staleness identified
470
- - [ ] **Label Review** - Current vs suggested labels based on issue content analysis
471
- - [ ] **Recommendation** - Specific next command to run with rationale
472
- - [ ] **Confidence Level** - High/Medium/Low with information gaps noted
473
-
474
- **DO NOT respond until all items are verified.**
466
+ **Before responding, verify:**
467
+
468
+ - [ ] Every issue has exactly one action in the table
469
+ - [ ] Run column uses correct symbol for the action/state
470
+ - [ ] Command block only contains PROCEED and REWRITE issues
471
+ - [ ] Commands are grouped by compatible workflow
472
+ - [ ] Separators appear between every shown section
473
+ - [ ] Annotations omitted when not applicable (silence = healthy)
474
+ - [ ] HTML markers present for every assessed issue
475
+ - [ ] Batch mode: table is the primary output, no per-issue detail sections
476
+ - [ ] Single mode: focused summary with separators between sections