Repository navigation
Description
Summary
The sequant run command doesn't work because it tries to invoke skills via CLI syntax (/spec, /exec) in print mode, which is not supported. Skills are model-invoked, not command-invoked. Additionally, it's missing key features from the old execute-issues.ts script.
Current (Broken) Implementation
// src/commands/run.ts:81-89
const proc = spawn(
"claude",
["--print", "--dangerously-skip-permissions", "-p", command], // command = "/spec 5"
{ ... }
);Problem: Slash commands like /spec only work in interactive mode. In -p mode, Claude expects natural language prompts and chooses skills based on task description matching.
Root Cause
From Claude Code docs:
"Slash commands like
/commitare only available in interactive mode. In-pmode, describe the task you want to accomplish instead."
Solution
Rewrite sequant run using the Claude Agent SDK TypeScript library:
import { query } from "@anthropic-ai/claude-agent-sdk";
const phasePrompts = {
'spec': 'Review GitHub issue #{issue} and create implementation plan with verification criteria',
'exec': 'Implement the feature for issue #{issue} following the spec',
'qa': 'Review implementation for issue #{issue} against acceptance criteria'
};
async function executePhase(issueNumber: number, phase: Phase) {
const prompt = phasePrompts[phase].replace('{issue}', String(issueNumber));
for await (const message of query({
prompt,
options: {
settingSources: ['project'], // Loads .claude/skills/
permissionMode: 'bypassPermissions',
allowedTools: ['Read', 'Edit', 'Bash', 'Glob', 'Grep', 'Task']
}
})) {
if (message.type === 'result') {
return { success: true, result: message.result };
}
}
}New Features to Add
1. Quality Loop (--quality-loop)
Auto-retry failed phases with fix iterations:
sequant run 12 --quality-loop
sequant run 12 --quality-loop --max-iterations 3Behavior:
- After
/exec, if tests fail → run/loopto fix → retry (up to N iterations) - After
/qa, if issues found → run/loopto fix → retry - Exit when all phases pass or max iterations reached
2. Batch Execution (--batch)
Run groups of issues sequentially while issues within a batch run in parallel:
sequant run --batch "12 13" --batch "14 15"Use case: Issue 14 depends on 12+13 being merged first.
3. Smart Tests Integration (--smart-tests / --no-smart-tests)
Auto-run related tests after file edits during /exec:
sequant run 12 --smart-tests # Enable (could be default)
sequant run 12 --no-smart-tests # Disable for speed4. Auto-detect UI Issues
Automatically add /test phase if issue has ui, frontend, or admin labels:
sequant run 12 # Auto-detects labels and adjusts phases5. Testgen Integration (--testgen)
Run /testgen after /spec to generate test stubs before implementation:
sequant run 12 --testgen
sequant run 12 --quality-loop # Could auto-include testgenProposed CLI Interface
# Basic
sequant run 12
# With quality loop (auto-fix iterations)
sequant run 12 --quality-loop
sequant run 12 -q # Short form
# Batch execution
sequant run --batch "12 13" --batch "14"
# Full options
sequant run 12 \
--quality-loop \
--max-iterations 3 \
--phases spec,exec,test,qa \
--testgen \
--smart-tests \
--verbose
# Speed mode (no smart tests, no quality loop)
sequant run 12 13 14 --no-smart-testsAcceptance Criteria
Core Rewrite (Agent SDK)
- AC-1: Install
@anthropic-ai/claude-agent-sdkdependency - AC-2: Rewrite
executePhase()to usequery()instead ofspawn() - AC-3: Use
settingSources: ['project']to load project skills - AC-4: Capture and display streaming output during execution
- AC-5: Handle errors and timeouts properly
- AC-6: Support session resumption for multi-phase workflows
- AC-7: Verify skills are actually invoked (check GitHub issue comments)
New Features
- AC-8: Implement
--quality-loop/-qflag with auto-retry logic - AC-9: Implement
--max-iterationsoption (default: 3) - AC-10: Implement
--batchoption for grouped sequential execution - AC-11: Implement
--smart-tests/--no-smart-testsflags - AC-12: Implement
--testgenflag to run testgen after spec - AC-13: Auto-detect UI issues by label and add test phase
- AC-14: Support environment variables for CI (
SEQUANT_QUALITY_LOOP,SEQUANT_MAX_ITERATIONS)
Implementation Notes
Dependencies to Add
{
"dependencies": {
"@anthropic-ai/claude-agent-sdk": "^latest"
}
}Key Changes
- Remove
spawn()calls toclaudeCLI - Use Agent SDK
query()function - Define natural language prompts for each phase
- Stream output in real-time using async iterator
- Optionally use
--json-schemafor structured results
Session Management
For multi-phase workflows, capture session ID to maintain context:
let sessionId: string;
for await (const msg of query({...})) {
if (msg.type === 'system' && msg.subtype === 'init') {
sessionId = msg.session_id;
}
}
// Resume later with: options: { resume: sessionId }Quality Loop Logic
- Already exists in
/fullsolveand/loopskills - extract and reuse - Smart tests need hook integration (pre/post tool hooks)
- Label detection can use
gh issue view --json labels
References
Workaround
Until fixed, invoke skills manually in Claude Code interactive mode:
/spec 5
/exec 5
/qa 5Or use /fullsolve 5 for the complete workflow.
Activity
feat(run): Rewrite sequant run to use Claude Agent SDK
admarble commentedon Jan 8, 2026
/fullsolve Complete
Issue: #19
Status: READY_FOR_MERGE
Summary
anytypes, no deleted testsKey Changes
executePhase()to use Claude Agent SDKquery()function-q,--max-iterations)--batch)--testgen)--smart-tests,--no-smart-tests)Iterations
PR: #24
Ready for human review and merge.
feat(run): Rewrite sequant run to use Claude Agent SDK (#24)
admarble commentedon Jan 8, 2026
Post-Merge Verification
Tested
sequant runwith the Claude Agent SDK against a real issue (#18).Test Configuration
Results
AC-7 Verification Confirmed
The skill was successfully invoked via the Claude Agent SDK:
.claude/settings.jsonviasettingSources: ['project']/spec 18workflowWhat Worked
query()function invoked correctly with all options-v) streamed Claude's response in real-timeObservations for Future Improvement
Verbose output is very verbose - In
-vmode, the entire Claude response streams inline. For long phases, this is substantial. Consider:--quietmode that only shows phase status--verbose=summaryUntested features (work for follow-up testing):
-q) with failing phases--batch)Conclusion
The Claude Agent SDK integration is working correctly. The core issue (slash commands not working in
-pmode) is resolved - skills are now properly invoked via natural language prompts with the SDK'squery()function.feat(#813): pre-flight the skills install — missing .claude/skills/ f…
feat(#813): pre-flight the skills install so a missing .claude/skills…