sequant 1.11.0 → 1.13.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 (66) hide show
  1. package/README.md +93 -7
  2. package/dist/bin/cli.js +12 -9
  3. package/dist/src/commands/doctor.js +25 -20
  4. package/dist/src/commands/init.js +152 -65
  5. package/dist/src/commands/logs.js +7 -6
  6. package/dist/src/commands/run.d.ts +13 -1
  7. package/dist/src/commands/run.js +75 -12
  8. package/dist/src/commands/stats.js +67 -48
  9. package/dist/src/commands/status.js +30 -12
  10. package/dist/src/index.d.ts +6 -0
  11. package/dist/src/index.js +4 -0
  12. package/dist/src/lib/ac-linter.d.ts +116 -0
  13. package/dist/src/lib/ac-linter.js +304 -0
  14. package/dist/src/lib/cli-ui.d.ts +196 -0
  15. package/dist/src/lib/cli-ui.js +544 -0
  16. package/dist/src/lib/content-analyzer.d.ts +89 -0
  17. package/dist/src/lib/content-analyzer.js +437 -0
  18. package/dist/src/lib/phase-signal.d.ts +94 -0
  19. package/dist/src/lib/phase-signal.js +171 -0
  20. package/dist/src/lib/plugin-version-sync.d.ts +26 -0
  21. package/dist/src/lib/plugin-version-sync.js +91 -0
  22. package/dist/src/lib/project-name.d.ts +40 -0
  23. package/dist/src/lib/project-name.js +191 -0
  24. package/dist/src/lib/semgrep.d.ts +136 -0
  25. package/dist/src/lib/semgrep.js +406 -0
  26. package/dist/src/lib/solve-comment-parser.d.ts +84 -0
  27. package/dist/src/lib/solve-comment-parser.js +200 -0
  28. package/dist/src/lib/stack-config.d.ts +51 -0
  29. package/dist/src/lib/stack-config.js +77 -0
  30. package/dist/src/lib/stacks.d.ts +66 -0
  31. package/dist/src/lib/stacks.js +332 -0
  32. package/dist/src/lib/templates.d.ts +2 -0
  33. package/dist/src/lib/templates.js +12 -3
  34. package/dist/src/lib/upstream/assessment.d.ts +70 -0
  35. package/dist/src/lib/upstream/assessment.js +385 -0
  36. package/dist/src/lib/upstream/index.d.ts +11 -0
  37. package/dist/src/lib/upstream/index.js +14 -0
  38. package/dist/src/lib/upstream/issues.d.ts +38 -0
  39. package/dist/src/lib/upstream/issues.js +267 -0
  40. package/dist/src/lib/upstream/relevance.d.ts +50 -0
  41. package/dist/src/lib/upstream/relevance.js +209 -0
  42. package/dist/src/lib/upstream/report.d.ts +29 -0
  43. package/dist/src/lib/upstream/report.js +391 -0
  44. package/dist/src/lib/upstream/types.d.ts +207 -0
  45. package/dist/src/lib/upstream/types.js +5 -0
  46. package/dist/src/lib/workflow/log-writer.d.ts +1 -1
  47. package/dist/src/lib/workflow/metrics-schema.d.ts +3 -3
  48. package/dist/src/lib/workflow/qa-cache.d.ts +199 -0
  49. package/dist/src/lib/workflow/qa-cache.js +440 -0
  50. package/dist/src/lib/workflow/run-log-schema.d.ts +34 -6
  51. package/dist/src/lib/workflow/run-log-schema.js +12 -1
  52. package/dist/src/lib/workflow/state-schema.d.ts +4 -4
  53. package/dist/src/lib/workflow/types.d.ts +4 -0
  54. package/package.json +6 -1
  55. package/templates/hooks/pre-tool.sh +6 -0
  56. package/templates/memory/constitution.md +1 -5
  57. package/templates/skills/_shared/references/prompt-templates.md +350 -0
  58. package/templates/skills/_shared/references/subagent-types.md +131 -0
  59. package/templates/skills/exec/SKILL.md +82 -0
  60. package/templates/skills/fullsolve/SKILL.md +19 -2
  61. package/templates/skills/loop/SKILL.md +3 -1
  62. package/templates/skills/qa/SKILL.md +79 -9
  63. package/templates/skills/qa/references/quality-gates.md +85 -1
  64. package/templates/skills/qa/references/semgrep-rules.md +207 -0
  65. package/templates/skills/qa/scripts/quality-checks.sh +525 -15
  66. package/templates/skills/spec/SKILL.md +322 -9
@@ -0,0 +1,131 @@
1
+ # Claude Code Subagent Types
2
+
3
+ Reference for valid subagent types when spawning agents via the `Task` tool.
4
+
5
+ ## Valid Types
6
+
7
+ Claude Code supports exactly **4 subagent types**:
8
+
9
+ | Type | Purpose | Tools Available |
10
+ |------|---------|-----------------|
11
+ | `Bash` | Command execution, git operations, terminal tasks | Bash only |
12
+ | `general-purpose` | Multi-step tasks needing file access + commands | All tools |
13
+ | `Explore` | Codebase exploration, file search, pattern finding | Read-only tools |
14
+ | `Plan` | Architecture planning, implementation design | Read-only tools |
15
+
16
+ ## When to Use Each
17
+
18
+ ### `Bash`
19
+ Best for: Single command execution, git operations, build commands
20
+
21
+ ```
22
+ Task(subagent_type="Bash", prompt="Run npm test and report results")
23
+ ```
24
+
25
+ ### `general-purpose`
26
+ Best for: Implementation tasks, quality checks, multi-file operations
27
+
28
+ ```
29
+ Task(subagent_type="general-purpose",
30
+ prompt="Run type safety checks on the diff. Report: type issues, verdict.")
31
+ ```
32
+
33
+ **Use cases:**
34
+ - Quality checks (type safety, security scan, scope analysis)
35
+ - Implementation tasks requiring edits
36
+ - Tasks needing both file reading and command execution
37
+
38
+ ### `Explore`
39
+ Best for: Codebase search, pattern discovery, schema inspection
40
+
41
+ ```
42
+ Task(subagent_type="Explore",
43
+ prompt="Find similar components in components/admin/. Report patterns.")
44
+ ```
45
+
46
+ **Use cases:**
47
+ - Finding existing patterns before implementing new features
48
+ - Searching for file locations
49
+ - Understanding codebase structure
50
+ - Schema and database inspection
51
+
52
+ ### `Plan`
53
+ Best for: Designing implementation approaches, architectural decisions
54
+
55
+ ```
56
+ Task(subagent_type="Plan",
57
+ prompt="Design the implementation approach for adding user auth.")
58
+ ```
59
+
60
+ **Use cases:**
61
+ - Creating implementation plans
62
+ - Evaluating architectural trade-offs
63
+ - Breaking down complex features
64
+
65
+ ## Model Selection
66
+
67
+ | Model | When to Use | Cost |
68
+ |-------|-------------|------|
69
+ | `haiku` | Quick tasks, exploration, quality checks | Low |
70
+ | `sonnet` | Complex implementation, nuanced decisions | Medium |
71
+ | `opus` | Critical analysis, complex architecture | High |
72
+
73
+ **Default:** Use `haiku` unless the task requires deep reasoning.
74
+
75
+ ```
76
+ Task(subagent_type="general-purpose",
77
+ model="haiku",
78
+ prompt="...")
79
+ ```
80
+
81
+ ## Common Patterns
82
+
83
+ ### Parallel Quality Checks
84
+ ```
85
+ Task(subagent_type="general-purpose", model="haiku",
86
+ prompt="Check type safety on diff vs main. Report issues count.")
87
+
88
+ Task(subagent_type="general-purpose", model="haiku",
89
+ prompt="Check for deleted tests in diff. Report count.")
90
+
91
+ Task(subagent_type="general-purpose", model="haiku",
92
+ prompt="Run security scan on changed files. Report findings.")
93
+ ```
94
+
95
+ ### Context Gathering (Spec Phase)
96
+ ```
97
+ Task(subagent_type="Explore", model="haiku",
98
+ prompt="Find similar features in components/. Report patterns.")
99
+
100
+ Task(subagent_type="Explore", model="haiku",
101
+ prompt="Explore database schema for user tables. Report structure.")
102
+ ```
103
+
104
+ ### Background Execution
105
+ ```
106
+ Task(subagent_type="general-purpose",
107
+ model="haiku",
108
+ run_in_background=true,
109
+ prompt="Implement the UserCard component...")
110
+ ```
111
+
112
+ Use `TaskOutput(task_id="...", block=true)` to wait for completion.
113
+
114
+ ## Invalid Types (Do Not Use)
115
+
116
+ These types do **not exist** and will cause silent failures:
117
+
118
+ - ~~`quality-checker`~~ → Use `general-purpose`
119
+ - ~~`pattern-scout`~~ → Use `Explore`
120
+ - ~~`schema-inspector`~~ → Use `Explore`
121
+ - ~~`code-reviewer`~~ → Use `general-purpose`
122
+ - ~~`implementation`~~ → Use `general-purpose`
123
+
124
+ See issue #170 for context on this fix.
125
+
126
+ ## References
127
+
128
+ - [Claude Code Task Tool Documentation](https://docs.anthropic.com/claude-code)
129
+ - [Prompt Templates](./prompt-templates.md) - Task-specific prompt templates for sub-agents
130
+ - `/exec` skill parallel execution: `templates/skills/exec/SKILL.md`
131
+ - `/qa` skill quality checks: `templates/skills/qa/SKILL.md`
@@ -497,6 +497,7 @@ Fall back to sequential execution (standard implementation loop).
497
497
  - Run Prettier on all modified files after each group (agents skip auto-format)
498
498
  - On any agent failure: stop remaining agents, log error, continue with sequential
499
499
  - File locking prevents concurrent edits to the same file
500
+ - **Use prompt templates** for each agent — see [Section 4c](#4c-prompt-templates-for-sub-agents)
500
501
 
501
502
  **Error Handling with Automatic Retry:**
502
503
 
@@ -536,6 +537,87 @@ Parse the agent's output text for these patterns to detect failures:
536
537
  | `blocked by hook` | Operation was blocked by pre-tool hook |
537
538
  | `I'm unable to` | Agent hit a blocking constraint |
538
539
 
540
+ ### 4c. Prompt Templates for Sub-Agents
541
+
542
+ When spawning sub-agents for implementation tasks, use task-specific prompt templates for better results. See [prompt-templates.md](../_shared/references/prompt-templates.md) for the full reference.
543
+
544
+ **Template Selection:**
545
+
546
+ Templates are selected automatically based on keywords in the task description:
547
+
548
+ | Keywords | Template |
549
+ |----------|----------|
550
+ | `component`, `Component`, `React` | Component Template |
551
+ | `type`, `interface`, `types/` | Type Definition Template |
552
+ | `CLI`, `command`, `script`, `bin/` | CLI/Script Template |
553
+ | `test`, `spec`, `.test.` | Test Template |
554
+ | `refactor`, `restructure`, `migrate` | Refactor Template |
555
+ | (none matched) | Generic Template |
556
+
557
+ **Explicit Override:**
558
+
559
+ Use `[template: X]` annotation to force a specific template:
560
+
561
+ ```
562
+ [template: component] Create UserCard in components/admin/
563
+ [template: cli] Add export command to scripts/
564
+ ```
565
+
566
+ **Example with Template:**
567
+
568
+ Instead of a generic prompt:
569
+ ```
570
+ Task(subagent_type="general-purpose",
571
+ model="haiku",
572
+ prompt="Create MetricsCard component in components/admin/")
573
+ ```
574
+
575
+ Use a structured template prompt:
576
+ ```
577
+ Task(subagent_type="general-purpose",
578
+ model="haiku",
579
+ prompt="## Task: Create React Component
580
+
581
+ **Component:** MetricsCard
582
+ **Location:** components/admin/metrics/MetricsCard.tsx
583
+
584
+ **Requirements:**
585
+ - [ ] TypeScript with proper prop types
586
+ - [ ] Follow existing component patterns
587
+ - [ ] Include displayName for debugging
588
+ - [ ] No inline styles
589
+
590
+ **Constraints:**
591
+ - Working directory: [worktree path]
592
+ - Do NOT create test files
593
+
594
+ **Deliverable:**
595
+ Report: files created, component name, props interface")
596
+ ```
597
+
598
+ **Error Recovery with Enhanced Context:**
599
+
600
+ When retrying a failed agent, use the error recovery template from [prompt-templates.md](../_shared/references/prompt-templates.md#error-recovery-template):
601
+
602
+ ```markdown
603
+ ## RETRY: Previous Attempt Failed
604
+
605
+ **Original Task:** [task]
606
+ **Previous Error:** [error from TaskOutput]
607
+
608
+ **Diagnosis Checklist:**
609
+ - [ ] Check imports are correct
610
+ - [ ] Verify file paths use worktree directory
611
+ - [ ] Confirm types match expected signatures
612
+ - [ ] Look for typos in identifiers
613
+
614
+ **Fix Strategy:**
615
+ 1. Read the failing file
616
+ 2. Identify the specific error location
617
+ 3. Apply minimal fix
618
+ 4. Verify fix compiles
619
+ ```
620
+
539
621
  ## Implementation Quality Standards
540
622
 
541
623
  Before each commit, self-check against these standards:
@@ -328,7 +328,16 @@ while qa_iteration < 2:
328
328
  if verdict == "READY_FOR_MERGE":
329
329
  break
330
330
 
331
- # Parse issues
331
+ if verdict == "AC_MET_BUT_NOT_A_PLUS":
332
+ # Good enough, proceed with notes
333
+ break
334
+
335
+ if verdict == "NEEDS_VERIFICATION":
336
+ # ACs are met but pending external verification
337
+ # Proceed to PR - verification can happen post-PR
338
+ break
339
+
340
+ # Parse issues (AC_NOT_MET)
332
341
  issues = parse_qa_issues()
333
342
 
334
343
  # Fix each issue
@@ -430,6 +439,13 @@ Track iterations to prevent infinite loops:
430
439
  - QA verdict: `AC_MET_BUT_NOT_A_PLUS`
431
440
  - PR created with notes
432
441
 
442
+ **Pending Verification:**
443
+
444
+ - All AC met or pending
445
+ - External verification required (CI, manual test)
446
+ - QA verdict: `NEEDS_VERIFICATION`
447
+ - PR created, verification can happen post-PR
448
+
433
449
  **Failure (manual intervention needed):**
434
450
  - Max iterations reached on test or QA loop
435
451
  - Blockers discovered
@@ -584,7 +600,8 @@ Each issue gets its own worktree, PR, and quality validation.
584
600
  - [ ] **AC Coverage** - Each AC marked MET/PARTIALLY_MET/NOT_MET
585
601
  - [ ] **Quality Metrics** - Tests passed, build status, type issues
586
602
  - [ ] **Iteration Summary** - Test loop and QA loop iteration counts
587
- - [ ] **Final Verdict** - READY_FOR_MERGE, AC_MET_BUT_NOT_A_PLUS, or AC_NOT_MET
603
+ - [ ] **Final Verdict** - READY_FOR_MERGE, AC_MET_BUT_NOT_A_PLUS, NEEDS_VERIFICATION,
604
+ or AC_NOT_MET
588
605
  - [ ] **PR Link** - Pull request URL (if created)
589
606
  - [ ] **Final GitHub Comment** - Summary posted to issue
590
607
 
@@ -54,7 +54,8 @@ cat /tmp/claude-issue-<issue-number>.log
54
54
 
55
55
  Parse the log to find:
56
56
  - **Last phase executed:** `/test` or `/qa`
57
- - **Verdict:** `READY_FOR_MERGE`, `AC_NOT_MET`, `AC_MET_BUT_NOT_A_PLUS`
57
+ - **Verdict:** `READY_FOR_MERGE`, `AC_MET_BUT_NOT_A_PLUS`, `NEEDS_VERIFICATION`,
58
+ or `AC_NOT_MET`
58
59
  - **Test results:** PASS/FAIL/BLOCKED counts
59
60
  - **Issues to fix:** Numbered recommendations or bug descriptions
60
61
 
@@ -87,6 +88,7 @@ Extract:
87
88
 
88
89
  **Exit loop if:**
89
90
  - Verdict is `READY_FOR_MERGE` - Nothing to fix!
91
+ - Verdict is `NEEDS_VERIFICATION` - Pending external verification
90
92
  - No actionable issues found
91
93
  - Max iterations reached (3 by default)
92
94
 
@@ -16,6 +16,9 @@ allowed-tools:
16
16
  - Bash(gh pr view:*)
17
17
  - Bash(gh pr diff:*)
18
18
  - Bash(gh pr comment:*)
19
+ - Bash(semgrep:*)
20
+ - Bash(npx semgrep:*)
21
+ - Bash(npx tsx scripts/semgrep-scan.ts:*)
19
22
  - Task
20
23
  - AgentOutputTool
21
24
  ---
@@ -120,11 +123,11 @@ If no feature worktree exists (work was done directly on main):
120
123
 
121
124
  **Spawn ALL THREE agents in a SINGLE message:**
122
125
 
123
- 1. `Task(subagent_type="quality-checker", model="haiku", prompt="Run type safety and deleted tests checks on the current branch vs main. Report: type issues count, deleted tests, verdict.")`
126
+ 1. `Task(subagent_type="general-purpose", model="haiku", prompt="Run type safety and deleted tests checks on the current branch vs main. Report: type issues count, deleted tests, verdict.")`
124
127
 
125
- 2. `Task(subagent_type="quality-checker", model="haiku", prompt="Run scope and size checks on the current branch vs main. Report: files count, diff size, size assessment.")`
128
+ 2. `Task(subagent_type="general-purpose", model="haiku", prompt="Run scope and size checks on the current branch vs main. Report: files count, diff size, size assessment.")`
126
129
 
127
- 3. `Task(subagent_type="quality-checker", model="haiku", prompt="Run security scan on changed files in current branch vs main. Report: critical/warning/info counts, verdict.")`
130
+ 3. `Task(subagent_type="general-purpose", model="haiku", prompt="Run security scan on changed files in current branch vs main. Report: critical/warning/info counts, verdict.")`
128
131
 
129
132
  **Add RLS check if admin files modified:**
130
133
  ```bash
@@ -133,10 +136,52 @@ admin_modified=$(git diff main...HEAD --name-only | grep -E "^app/admin/" | head
133
136
 
134
137
  See [quality-gates.md](references/quality-gates.md) for detailed verdict synthesis.
135
138
 
136
- ### Using MCP Tools (Optional)
139
+ ### MCP Tools (Optional - Graceful Degradation)
137
140
 
138
- - **Sequential Thinking:** For complex multi-step analysis
139
- - **Context7:** For broader pattern context and library documentation
141
+ MCP tools enhance `/qa` but are **not required**. The skill works fully without them.
142
+
143
+ #### MCP Availability Check
144
+
145
+ Before using MCP tools, verify they are available. If unavailable, use the fallback strategies.
146
+
147
+ | MCP Tool | Purpose | Fallback When Unavailable |
148
+ |----------|---------|---------------------------|
149
+ | Sequential Thinking | Complex multi-step analysis | Use explicit step-by-step reasoning in response |
150
+ | Context7 | Library documentation lookup | Use WebSearch or codebase pattern search |
151
+
152
+ #### Sequential Thinking Fallback
153
+
154
+ **When to use Sequential Thinking:**
155
+ - Complex architectural trade-offs during code review
156
+ - Multi-dimensional quality assessment
157
+ - Analyzing interconnected issues across files
158
+
159
+ **If unavailable:**
160
+ 1. Structure your analysis with explicit numbered steps
161
+ 2. Document each concern systematically before synthesizing verdict
162
+ 3. Use a pros/cons format for trade-off decisions
163
+
164
+ ```markdown
165
+ ## Analysis Steps (Manual Sequential Thinking)
166
+
167
+ **Step 1:** [Analyze first dimension - correctness]
168
+ **Step 2:** [Analyze second dimension - maintainability]
169
+ **Step 3:** [Analyze third dimension - performance]
170
+ **Step 4:** [Synthesize findings into verdict]
171
+ ```
172
+
173
+ #### Context7 Fallback
174
+
175
+ **When to use Context7:**
176
+ - Verifying implementation matches library best practices
177
+ - Checking if API usage follows recommended patterns
178
+ - Understanding framework-specific conventions in reviewed code
179
+
180
+ **If unavailable:**
181
+ 1. Search codebase with Grep for existing usage patterns
182
+ 2. Use WebSearch for official library documentation
183
+ 3. Check similar implementations in the codebase as reference
184
+ 4. Review library's README or documentation in node_modules
140
185
 
141
186
  ### 1. Context and AC Alignment
142
187
 
@@ -180,9 +225,32 @@ See [testing-requirements.md](references/testing-requirements.md) for edge case
180
225
 
181
226
  Provide an overall verdict:
182
227
 
183
- - `READY_FOR_MERGE` — AC met and code quality is high ("A+")
184
- - `AC_MET_BUT_NOT_A_PLUS` — AC met, but meaningful improvements recommended
185
- - `AC_NOT_MET` — AC not fully met; additional implementation needed
228
+ - `READY_FOR_MERGE` — ALL ACs are `MET` and code quality is high ("A+")
229
+ - `AC_MET_BUT_NOT_A_PLUS` — ALL ACs are `MET`, but meaningful improvements recommended
230
+ - `NEEDS_VERIFICATION` — ALL ACs are `MET` or `PENDING`, at least one requires external verification
231
+ - `AC_NOT_MET` — One or more ACs are `NOT_MET` or `PARTIALLY_MET`
232
+
233
+ **Verdict Determination Algorithm (REQUIRED):**
234
+
235
+ ```text
236
+ 1. Count AC statuses:
237
+ - met_count = ACs with status MET
238
+ - partial_count = ACs with status PARTIALLY_MET
239
+ - pending_count = ACs with status PENDING
240
+ - not_met_count = ACs with status NOT_MET
241
+
242
+ 2. Determine verdict (in order):
243
+ - IF not_met_count > 0 OR partial_count > 0:
244
+ → AC_NOT_MET (block merge)
245
+ - ELSE IF pending_count > 0:
246
+ → NEEDS_VERIFICATION (wait for verification)
247
+ - ELSE IF improvement_suggestions.length > 0:
248
+ → AC_MET_BUT_NOT_A_PLUS (can merge with notes)
249
+ - ELSE:
250
+ → READY_FOR_MERGE (A+ implementation)
251
+ ```
252
+
253
+ **CRITICAL:** `PARTIALLY_MET` is NOT sufficient for merge. It MUST be treated as `NOT_MET` for verdict purposes.
186
254
 
187
255
  See [quality-gates.md](references/quality-gates.md) for detailed verdict criteria.
188
256
 
@@ -221,9 +289,11 @@ Produce a Markdown snippet for the PR/issue:
221
289
  ### 7. Update GitHub Issue
222
290
 
223
291
  Post the draft comment to GitHub and update labels:
292
+
224
293
  - `AC_NOT_MET`: add `needs-work` label
225
294
  - `READY_FOR_MERGE`: add `ready-for-review` label
226
295
  - `AC_MET_BUT_NOT_A_PLUS`: add `needs-improvement` label
296
+ - `NEEDS_VERIFICATION`: add `needs-verification` label
227
297
 
228
298
  ### 8. Documentation Reminder
229
299
 
@@ -9,14 +9,56 @@ Combine agent outputs into a unified quality assessment:
9
9
  | Type Safety Checker | Type issues count, verdict | High - blocking if issues > 3 |
10
10
  | Scope/Size Checker | Files changed, LOC, assessment | Medium - warning if very large |
11
11
  | Security Scanner | Critical/warning/info counts | High - blocking if criticals > 0 |
12
+ | Semgrep Static Analysis | Critical/warning findings | High - blocking if criticals > 0 |
12
13
  | RLS Checker (conditional) | Violations found | High - blocking if violations |
13
14
 
14
15
  **Synthesis Rules:**
15
16
  - **Any FAIL verdict** → Flag as blocker in manual review
16
- - **Security criticals** → Block merge, require fix before proceeding
17
+ - **Security criticals (including Semgrep)** → Block merge, require fix before proceeding
17
18
  - **All PASS** → Proceed with confidence to manual review
18
19
  - **WARN verdicts** → Note in review, verify manually
19
20
 
21
+ ## Semgrep Integration
22
+
23
+ Semgrep provides static analysis for security vulnerabilities and anti-patterns.
24
+
25
+ ### Verdict Mapping
26
+
27
+ | Semgrep Result | QA Verdict Impact |
28
+ |----------------|-------------------|
29
+ | Critical findings > 0 | **BLOCKING** - `AC_NOT_MET` |
30
+ | Warning findings only | Non-blocking - note in review |
31
+ | No findings | Pass - no impact |
32
+ | Semgrep not installed | Skipped - graceful degradation |
33
+ | Semgrep error | Non-blocking - log error |
34
+
35
+ ### Output Format
36
+
37
+ ```markdown
38
+ ## Static Analysis (Semgrep)
39
+
40
+ ✅ No critical findings
41
+ ⚠️ 2 warnings:
42
+ - src/api/users.ts:47 - Potential SQL injection (user input in query)
43
+ - src/utils/exec.ts:12 - Command injection risk (unsanitized shell arg)
44
+ ```
45
+
46
+ ### Stack-Aware Rulesets
47
+
48
+ Semgrep uses stack-specific rulesets for targeted analysis:
49
+
50
+ | Stack | Rulesets |
51
+ |-------|----------|
52
+ | Next.js | p/typescript, p/javascript, p/react, p/security-audit, p/secrets |
53
+ | Python | p/python, p/django, p/flask, p/security-audit, p/secrets |
54
+ | Go | p/golang, p/security-audit, p/secrets |
55
+ | Rust | p/rust, p/security-audit, p/secrets |
56
+ | Generic | p/security-audit, p/secrets |
57
+
58
+ ### Custom Rules
59
+
60
+ Projects can add custom rules in `.sequant/semgrep-rules.yaml`. These are loaded alongside stack rules automatically.
61
+
20
62
  ## Verdict Criteria
21
63
 
22
64
  ### `READY_FOR_MERGE`
@@ -43,6 +85,17 @@ AC met, but one or more issues:
43
85
 
44
86
  **Action:** List specific improvements, but don't block merge if working
45
87
 
88
+ ### `NEEDS_VERIFICATION`
89
+
90
+ All AC items are `MET`, but one or more items have `PENDING` status requiring external verification:
91
+
92
+ - ⏳ CI/CD verification pending
93
+ - ⏳ Manual testing not yet performed
94
+ - ⏳ External dependency verification needed
95
+ - ⏳ Production environment validation required
96
+
97
+ **Action:** Complete pending verification, then re-run `/qa`
98
+
46
99
  ### `AC_NOT_MET`
47
100
 
48
101
  Any of:
@@ -55,6 +108,37 @@ Any of:
55
108
 
56
109
  **Action:** Block merge, list required fixes
57
110
 
111
+ ## Verdict Determination Algorithm
112
+
113
+ **CRITICAL:** Follow this algorithm exactly when determining the verdict. Do NOT give `READY_FOR_MERGE` unless ALL conditions are met.
114
+
115
+ ```text
116
+ 1. Count AC statuses:
117
+ - met_count = ACs with status MET
118
+ - partial_count = ACs with status PARTIALLY_MET
119
+ - pending_count = ACs with status PENDING
120
+ - not_met_count = ACs with status NOT_MET
121
+
122
+ 2. Determine verdict (in order):
123
+ - IF not_met_count > 0 OR partial_count > 0:
124
+ → AC_NOT_MET (block merge)
125
+ - ELSE IF pending_count > 0:
126
+ → NEEDS_VERIFICATION (wait for verification)
127
+ - ELSE IF improvement_suggestions.length > 0:
128
+ → AC_MET_BUT_NOT_A_PLUS (can merge with notes)
129
+ - ELSE:
130
+ → READY_FOR_MERGE (A+ implementation)
131
+ ```
132
+
133
+ | Verdict | When to Use |
134
+ |--------------------------|----------------------------------------------------------|
135
+ | `READY_FOR_MERGE` | ALL ACs are `MET`, no improvements needed |
136
+ | `AC_MET_BUT_NOT_A_PLUS` | ALL ACs are `MET`, but minor improvements suggested |
137
+ | `NEEDS_VERIFICATION` | ALL ACs are `MET` or `PENDING`, at least one is `PENDING`|
138
+ | `AC_NOT_MET` | ANY AC is `NOT_MET` or `PARTIALLY_MET` |
139
+
140
+ **Important:** `PARTIALLY_MET` is NOT sufficient for merge. It must be treated as `NOT_MET` for verdict purposes.
141
+
58
142
  ## Code Review Decision Framework
59
143
 
60
144
  ### 1. Purpose Test