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
@@ -190,6 +190,12 @@ Create `.sequant/settings.json` with sensible defaults:
190
190
  }
191
191
  ```
192
192
 
193
+ > **Note:** `agents.model` is currently **inert** per
194
+ > [anthropics/claude-code#43869](https://github.com/anthropics/claude-code/issues/43869).
195
+ > Subagents inherit the parent session's model regardless of this value. The
196
+ > field is kept for forward compatibility so existing settings.json files
197
+ > continue to parse without error.
198
+
193
199
  Use the Write tool to create `.sequant/settings.json` with the above content.
194
200
 
195
201
  ### 5. Detect Package Manager
@@ -86,6 +86,7 @@ Mark tier in HTML comment for downstream parsing: `<!-- SEQUANT_SPEC_TIER: [tier
86
86
  | Unmeasurable | "fast", "performant" | No threshold defined |
87
87
  | Incomplete | "handle errors", "edge cases" | Scenarios not enumerated |
88
88
  | Open-ended | "etc.", "and more" | Scope undefined |
89
+ | Title/body tension | doc-noun title ("note", "comment", "snippet") + runtime-imperative body ("execute", "trigger", "capture", incl. inflections like `triggered`/`captured`, `run /<cmd>`); separators `.`/`\n`/`:`/`—` | Two different verification bars |
89
90
 
90
91
  3. **Scope Assessment** (unless `--skip-scope-check`): Use `performScopeAssessment` from `./src/lib/scope/index.ts` with settings from `getSettings()`. Verdicts: SCOPE_OK (green), SCOPE_WARNING (yellow, auto-enables quality loop), SCOPE_SPLIT_RECOMMENDED (red). Store results in state.
91
92
 
@@ -142,6 +143,57 @@ Check for explicit dependencies: `gh issue view <issue> --json body,labels`. If
142
143
 
143
144
  Check issue body/labels for feature branch references (`feature/`, `based on`, epic labels). If found, recommend `--base feature/<branch>` in the plan.
144
145
 
146
+ ### Sibling-site Scan (Conditional)
147
+
148
+ **When to apply:** Focused AC + a localized fix where the same root-cause pattern likely exists at sibling sites in the same file (≥3 instances of the affected pattern in the same file — e.g. the regex blocks in `pre-tool.sh`).
149
+
150
+ **During planning**, scan the same file/module for sibling code matching the bug's root cause. If sibling sites are found, surface them as either: **(a)** an Open Question (in `## Open Questions`) proposing scope expansion (only when trivially co-located), or **(b)** a recommended follow-up issue (in `## Implementation Plan` or as a separate plan step). When findings mix trivial and non-trivial sites, surface each separately. **Don't silently widen scope — the user decides.**
151
+
152
+ This operationalizes the principle in `feedback_qa_second_look.md` (structured analysis biases positive on the literal AC; an adversarial re-read of adjacent code surfaces hidden scope) — `/spec` is the front line, `/qa` the safety net, so catching siblings here is strictly cheaper than at QA. Don't automate via grep — false-positive risk; this is a "look at adjacent code" planner prompt.
153
+
154
+ ### Rule Touchpoints (Conditional)
155
+
156
+ **When to apply:** Any AC whose description matches the behavior-rule heuristic — i.e. >= 2 distinct keywords from `default | always | never | rule | behavior | skip` (case-insensitive), OR an explicit pattern like `always X unless Y` / `never X unless Y` / `default X when Y`.
157
+
158
+ **Why:** Behavior-rule ACs are routinely implemented at multiple touchpoints — typically a skill prompt (LLM-interpreted) AND runtime TypeScript that duplicates the same rule. Without this check, edits land at one site and the other goes stale. Motivating miss: issue #533 (default /assess spec phase ON) where the runtime CLI's `BUG_LABELS`/`DOCS_LABELS` short-circuit survived the SKILL.md edit and was caught only by manual user follow-up. See [behavior-rule-detection.md](../_shared/references/behavior-rule-detection.md).
159
+
160
+ **During context gathering**, run the detector on every AC. For each AC that triggers, list its touchpoints under a new `## Rule Touchpoints` section in the plan output.
161
+
162
+ ```bash
163
+ # Per-AC touchpoint enumeration. Run once per AC in the issue body.
164
+ # Skip entirely when no AC triggers (cheap short-circuit).
165
+ SPEC_AC_ID="AC-1" \
166
+ SPEC_AC_TEXT="<verbatim AC description from the issue body>" \
167
+ npx tsx -e '
168
+ (async () => {
169
+ const m = await import("./src/lib/heuristics/behavior-rule-detector.ts");
170
+ const ac = {
171
+ id: process.env.SPEC_AC_ID,
172
+ description: process.env.SPEC_AC_TEXT,
173
+ verificationMethod: "manual",
174
+ status: "pending",
175
+ };
176
+ const detection = m.detectBehaviorRule(ac);
177
+ if (!detection.triggered) { console.log(JSON.stringify({ triggered: false })); return; }
178
+ const touchpoints = m.findTouchpoints(ac, process.cwd());
179
+ console.log(JSON.stringify({ triggered: true, keywords: detection.keywords, touchpoints }));
180
+ })();
181
+ '
182
+ ```
183
+
184
+ **If any AC triggers and `touchpoints` is non-empty**, add this section to the plan output (between **Implementation Plan** and **Design Review**):
185
+
186
+ ```markdown
187
+ ## Rule Touchpoints
188
+
189
+ | AC | Touchpoint | Snippet |
190
+ |----|------------|---------|
191
+ | AC-N | path/to/file.ts:LINE | `<one-line snippet>` |
192
+ ```
193
+
194
+ **If every AC short-circuits** (`triggered: false`) **or `touchpoints` is empty**, omit the section entirely — keeps cost cheap per the Performance budget in the reference doc.
195
+
196
+
145
197
  ## Verification Method Decision Framework
146
198
 
147
199
  Use this table when assigning verification methods to each AC:
@@ -25,6 +25,13 @@ When the implementation involves 3+ independent tasks that could be parallelized
25
25
 
26
26
  ## Model Selection
27
27
 
28
+ > **Note:** Per anthropics/claude-code#43869, the `[model: ...]` annotation
29
+ > below and the `model=` parameter `/exec` passes to `Agent(...)` are currently
30
+ > ignored — every spawned subagent inherits the parent session's model. The
31
+ > guidance here reflects the *intended* tier for each task once upstream fixes
32
+ > ship; the parser in `exec/SKILL.md` is kept intact so it reactivates
33
+ > automatically.
34
+
28
35
  Include a `[model: haiku]` or `[model: sonnet]` annotation at the end of each task line:
29
36
 
30
37
  | Task Type | Recommended Model |
@@ -14,16 +14,18 @@ This document shows the expected output format for the `## Recommended Workflow`
14
14
 
15
15
  ## Examples
16
16
 
17
- ### Simple Bug Fix
17
+ ### Simple Bug Fix (spec confirms straightforward scope)
18
18
 
19
19
  ```markdown
20
20
  ## Recommended Workflow
21
21
 
22
22
  **Phases:** exec → qa
23
23
  **Quality Loop:** disabled
24
- **Reasoning:** Straightforward bug fix with clear root cause. No planning needed.
24
+ **Reasoning:** This spec pass confirmed a clear root cause and narrow scope — no testgen or additional phases required; proceed to exec.
25
25
  ```
26
26
 
27
+ *Note:* Since #533, spec always runs by default. `**Phases:**` lists phases **after** spec — use `exec → qa` here to indicate "spec is done; only exec and qa remain."
28
+
27
29
  ### Standard Feature
28
30
 
29
31
  ```markdown
@@ -39,9 +39,16 @@ When invoked as `/testgen <issue-number>`, your job is to:
39
39
  - `/testgen 123` - Generate test stubs for issue #123 based on /spec comment
40
40
  - `/testgen` - Generate stubs for the most recently discussed issue in conversation
41
41
 
42
- ## Token Optimization with Haiku Sub-Agents
42
+ ## Sub-Agent Delegation for Stub Generation
43
43
 
44
- **Purpose:** Test stub generation is highly mechanical and benefits from using haiku sub-agents to minimize token cost.
44
+ **Purpose:** Test stub generation is highly mechanical and is delegated to `sequant-testgen` so the main agent focuses on orchestration.
45
+
46
+ > **Upstream caveat:** `sequant-testgen` declares `model: haiku`, but per
47
+ > anthropics/claude-code#43869 that declaration is currently ignored — the
48
+ > subagent inherits the parent session's model. Older versions of this doc
49
+ > claimed concrete token-cost savings from haiku. Those numbers are not
50
+ > achievable until the upstream fix ships; treat the haiku claim as the
51
+ > *intended* tier, not the runtime one.
45
52
 
46
53
  **Pattern:** Use `Agent(subagent_type="sequant-testgen")` for:
47
54
  1. Parsing verification criteria from /spec comments
@@ -49,13 +56,12 @@ When invoked as `/testgen <issue-number>`, your job is to:
49
56
  3. Writing test file content
50
57
 
51
58
  **Benefits:**
52
- - 90% token cost reduction for mechanical generation
53
- - Faster execution for templated operations
54
- - Main agent focuses on orchestration and decisions
59
+ - Main agent focuses on orchestration and decisions, not stub templating
60
+ - Designated tier (`haiku`) will yield token savings once anthropics/claude-code#43869 is fixed; today subagents inherit the parent's model
55
61
 
56
62
  ### Sub-Agent Usage
57
63
 
58
- **Step 1: Parse Verification Criteria (use haiku)**
64
+ **Step 1: Parse Verification Criteria (designated haiku — currently inert per anthropics/claude-code#43869)**
59
65
 
60
66
  ```javascript
61
67
  Agent(subagent_type="sequant-testgen", prompt=`
@@ -87,7 +93,7 @@ ${specComment}
87
93
  `)
88
94
  ```
89
95
 
90
- **Step 2: Generate Test Stubs (use haiku for each AC)**
96
+ **Step 2: Generate Test Stubs (designated haiku currently inert per anthropics/claude-code#43869)**
91
97
 
92
98
  ```javascript
93
99
  // For each AC with Unit Test or Integration Test verification method
@@ -122,16 +128,16 @@ The main agent handles file operations to ensure proper coordination:
122
128
 
123
129
  | Task | Agent | Reasoning |
124
130
  |------|-------|-----------|
125
- | Parse /spec comment | haiku | Mechanical text extraction |
126
- | Generate test stub code | haiku | Templated generation |
127
- | Identify failure scenarios | haiku | Pattern matching |
131
+ | Parse /spec comment | `sequant-testgen` (declared haiku, inert per #43869) | Mechanical text extraction |
132
+ | Generate test stub code | `sequant-testgen` (declared haiku, inert per #43869) | Templated generation |
133
+ | Identify failure scenarios | `sequant-testgen` (declared haiku, inert per #43869) | Pattern matching |
128
134
  | Decide file locations | main | Requires codebase context |
129
135
  | Write files | main | File system coordination |
130
136
  | Post GitHub comment | main | Session context needed |
131
137
 
132
138
  ### Parallel Sub-Agent Execution
133
139
 
134
- When multiple ACs need test stubs, spawn haiku agents in parallel:
140
+ When multiple ACs need test stubs, spawn `sequant-testgen` agents in parallel (declared haiku tier, currently inert per anthropics/claude-code#43869):
135
141
 
136
142
  ```javascript
137
143
  // Spawn all stub generation agents in a single message
@@ -143,11 +149,12 @@ const stubPromises = criteria
143
149
  // Main agent writes all files
144
150
  ```
145
151
 
146
- **Cost savings example:**
147
- - 5 AC items with Unit Test verification
148
- - Without haiku: ~50K tokens (main agent generates all)
149
- - With haiku: ~5K tokens (main orchestrates, haiku generates)
150
- - Savings: ~90%
152
+ **Cost savings (when upstream lands):**
153
+ Once anthropics/claude-code#43869 is fixed and the declared haiku tier takes
154
+ effect, delegating mechanical stub generation to `sequant-testgen` will
155
+ substantially reduce token cost vs. having the main agent generate every stub.
156
+ Concrete savings are not measured here because the declaration is currently
157
+ inert.
151
158
 
152
159
  ## Workflow
153
160
 
@@ -626,7 +633,7 @@ Cannot generate test files - no feature worktree exists for Issue #<N>.
626
633
 
627
634
  **Options:**
628
635
  1. Run `/exec <issue>` first (creates worktree automatically)
629
- 2. Create worktree manually: `./scripts/dev/new-feature.sh <issue>`
636
+ 2. Create worktree manually: `./scripts/new-feature.sh <issue>`
630
637
  3. Use the browser/manual test scenarios from this comment
631
638
  ```
632
639