Repository navigation
Closed
Labels
enhancementNew feature or requestmulti-agentMulti-agent backend support and agent-agnostic architectureplannedImplementation plan approvedready-for-reviewReady for code review
Description
Add Aider as Second Agent Backend
Epic: Multi-agent backend support
Depends on: #368 (AgentDriver interface)
Priority: P1 — proves the abstraction, broadens user base to any LLM
Context
Aider is the strongest candidate for Sequant's second agent backend because:
- CLI-first —
aider --yes --message "prompt"runs fully non-interactive - Open source — 73k+ stars, MIT license, active development (v0.86.x)
- Model-agnostic — supports Claude, GPT-4o, Gemini, DeepSeek, local models via OpenAI-compatible APIs
- Python scripting API — unofficial but functional (
from aider.coders import Coder) - Git-native — auto-commits changes, understands repo context
- Proven at SWE-bench — consistently top-ranked on coding benchmarks
Adding Aider proves the AgentDriver abstraction from #368 works with a fundamentally different execution model (subprocess CLI vs. in-process SDK).
Goal
Implement AiderDriver that allows npx sequant run 123 --agent aider to execute workflows using Aider instead of Claude Code.
Acceptance Criteria
-
AiderDriverimplements theAgentDriverinterface from Extract AgentDriver interface from phase-executor.ts #368 -
isAvailable()checks thataiderCLI is on PATH and runnable - Phase execution shells out to
aider --yes --no-auto-commits --message "<prompt>" --file <relevant-files> -
--no-auto-commitsflag used — Sequant manages git, not Aider - Output captured from stdout for QA verdict parsing
- Exit code mapped to
success: true/false - Timeout enforcement via process kill + abort signal
- Verbose mode streams Aider's stdout in real-time
- CLI:
npx sequant run 123 --agent aiderworks end-to-end - CLI:
npx sequant doctorchecks for Aider availability when configured - Settings:
settings.jsonsupports"agent": "aider"as default + Aider-specific config:{ "run": { "agent": "aider", "aider": { "model": "claude-3-sonnet", "editFormat": "diff", "extraArgs": ["--no-pretty"] } } }
Design
Prompt Adaptation
Aider doesn't have Claude Code's skill system. Phase prompts need to be self-contained instructions rather than skill invocations. The driver should transform the prompt:
// Instead of: "Run the /spec {issue} workflow"
// Aider needs: Full instructions for what to do
const AIDER_PHASE_PROMPTS: Record<Phase, string> = {
spec: `Read GitHub issue #{issue} using 'gh issue view {issue}'.
Create a spec comment on the issue with:
1. Implementation plan
2. Acceptance criteria as a checklist
3. Risk assessment
Post the comment using 'gh issue comment'.`,
exec: `Implement the feature described in GitHub issue #{issue}.
Follow any spec comments on the issue.
Write tests for new functionality.
Ensure the build passes with 'npm test'.`,
qa: `Review the changes for GitHub issue #{issue}.
Run 'npm test' and verify all tests pass.
Check acceptance criteria from the issue comments.
Output a verdict: READY_FOR_MERGE, AC_MET_BUT_NOT_A_PLUS, or AC_NOT_MET
with format "### Verdict: <VERDICT>"`,
};File Context
Aider works best when given specific files. The driver should:
- For
exec: pass files mentioned in the spec, or use--map-tokensfor repo-wide context - For
qa: pass changed files fromgit diff --name-only - For
spec: no file context needed (reads issue via shell)
Process Management
class AiderDriver implements AgentDriver {
name = "aider";
async executePhase(prompt: string, config: AgentExecutionConfig): Promise<AgentPhaseResult> {
const args = [
"--yes", // Non-interactive
"--no-auto-commits", // We manage git
"--no-pretty", // Clean output for parsing
"--message", prompt,
...this.getModelArgs(),
...this.getFileArgs(config),
];
const proc = spawn("aider", args, {
cwd: config.cwd,
env: config.env,
signal: config.abortSignal,
});
// Stream and capture output...
}
}Scope & Non-Goals
- Only the 3 core phases (
spec,exec,qa) need Aider prompt variants initially - No MCP support (Aider doesn't support MCP)
- No session resume (Aider is stateless per invocation)
- Aider's Python scripting API is NOT used — too fragile and unofficial. Shell out to CLI.
- Quality loop (
/loop) is a stretch goal, not required
Testing
- Unit:
AiderDriver.isAvailable()returns false whenaidernot on PATH - Unit: prompt transformation produces expected output for each phase
- Unit: exit code mapping (0 → success, non-zero → failure)
- Integration:
npx sequant run --dry-run --agent aidershows correct prompts - Manual: run
/spec+/exec+/qaon a real issue with Aider installed
Research Links
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestmulti-agentMulti-agent backend support and agent-agnostic architectureplannedImplementation plan approvedready-for-reviewReady for code review
Activity
admarble commentedon Mar 23, 2026
Spec Plan — #369 Add Aider as Second Agent Backend
Dependencies
mainbefore rebasing #369Conflict Risk
bin/cli.ts,run.ts,drivers/*/mergerbin/cli.ts,run.ts,drivers/*AC Quality Check
✅ All 11 AC items are clear and testable. No vague or unmeasurable criteria detected.
Non-Goals (from issue)
/loop) is a stretch goalScope
Acceptance Criteria with Verification
AC-1: AiderDriver implements AgentDriver interface
Verification: Unit Test
AiderDriverinstancename,executePhase(),isAvailable()exist with correct signaturesAC-2: isAvailable() checks aider CLI on PATH
Verification: Unit Test
aidernot on PATH → returnsfalseaideron PATH → returnstrueAC-3: Phase execution shells out with correct flags
Verification: Unit Test + Integration Test
executePhase()calledaider --yes --no-auto-commits --no-pretty --message "<prompt>" --file <files>AC-4: --no-auto-commits flag always present
Verification: Unit Test
AC-5: Output captured for QA verdict parsing
Verification: Unit Test
result.outputcontains full text; QA verdict regex can matchAC-6: Exit code mapped to success boolean
Verification: Unit Test
success: true; Exit non-zero →success: false+ errorAC-7: Timeout enforcement
Verification: Unit Test
phaseTimeout = 1AC-8: Verbose mode streams stdout
Verification: Integration Test
verbose = true,onOutputcallbackonOutputcalled incrementallyAC-9: CLI --agent aider end-to-end
Verification: Integration Test (dry-run)
npx sequant run 123 --dry-run --agent aiderAC-10: Doctor checks Aider availability
Verification: Unit Test
agent: "aider"in settingsAC-11: Settings support for aider config
Verification: Unit Test
settings.jsonwithrun.agent,run.aider.*getSettings()returns typedAiderSettingsDerived ACs
aiderbinary not foundImplementation Plan
Phase 1: AiderDriver Core (AC-1–8, AC-12)
src/lib/workflow/drivers/aider.ts— implementAgentDriverisAvailable()viawhich aider/aider --versionexecutePhase()—child_process.spawn()with abort signal, timeout, streamingAIDER_PHASE_PROMPTSmap (spec/exec/qa → self-contained instructions)--map-tokens), qa (git diff --name-only)aider.test.ts— mock spawn, test all pathsPhase 2: Settings & Registry (AC-11, AC-13)
AiderSettingsinterface +agentfield toRunSettingsin settings.ts"aider"indrivers/index.tsDRIVERS mapPhase 3: CLI & Doctor (AC-9, AC-10, AC-14)
--agentCLI flag wiring inbin/cli.tsdoctor.ts— conditional Aider check when configuredRecommended Workflow
Phases: spec → testgen → exec → qa
Quality Loop: enabled (auto — 11 AC items)
Pre-requisite: Merge #368 to
main, rebase #369Open Questions
--map-tokens 2048over explicit--filelist--modelflag (use Aider's own default)admarble commentedon Mar 23, 2026
Test Stubs Generated
Totals: 32 test stubs (17 happy path, 15 failure/error paths)
Unit Test Stubs
File:
src/lib/workflow/drivers/aider.test.tsSettings Test Stubs
File:
src/lib/workflow/drivers/aider-settings.test.tsIntegration Test Stubs
File:
src/lib/workflow/drivers/aider-integration.test.tsBrowser / Manual Test Scenarios
No ACs required browser or manual testing — all covered by unit + integration tests.
Next steps:
AiderDriverinsrc/lib/workflow/drivers/aider.tsthrow new Error(...)stubs with real test logic/exec 369to implement the featurenpx vitest src/lib/workflow/drivers/aider*Generated with Claude Code
feat(#369): add Aider as second agent backend
admarble commentedon Mar 23, 2026
Exec Phase Complete — #369 Add Aider as Second Agent Backend
AC Coverage
Key Files Changed
src/lib/workflow/drivers/aider.tssrc/lib/settings.tssrc/lib/workflow/drivers/index.tssrc/lib/workflow/types.tssrc/lib/workflow/phase-executor.tssrc/commands/run.tssrc/commands/doctor.tsQuality Gates
npm run buildnpm run lintnpm testQuality Plan Alignment
N/A — No quality plan in issue
PR
✅ Created: #385
admarble commentedon Mar 23, 2026
QA Review for Issue #369
AC Coverage
AiderDriverclass inaider.tshasname,executePhase(),isAvailable()matching interfaceexecSync("which aider"), returnstrue/false— tested in unit + integrationaider --yes --no-auto-commits --no-pretty --message— verified in testsbuildArgs()— dedicated test confirms presencecapturedOutputaccumulated from stdout, returned inresult.output— regex match testedcode === 0→success: true, elsefalsewith error message — tested both pathssetTimeout+proc.kill("SIGTERM")— abort signal wired with cleanup listenerconfig.onOutput?.()called per chunk whenconfig.verbose— 3-chunk streaming test--agent aiderworks end-to-end--agentregistered inbin/cli.ts:216, wired throughmergedOptions.agentinrun.ts:301doctor.ts:391-407— only whensettings.run.agent === "aider"AiderSettingsinterface +run.agent+run.aiderinRunSettings— parsed ingetSettings()validateAiderSettings()validates model (string), editFormat (string), extraArgs (string[]) — throws descriptive errors--message— integration test verifies prompt passthroughCoverage: 14/14 AC items fully met
Original ACs: 11/11 met
Derived ACs: 3/3 met
Quality Plan Verification
N/A — No quality plan found in issue comments
CI Status
build (20.x)build (22.x)typecheckvalidate-pluginvalidate-skillsCI Summary: 5 passed, 0 pending, 0 failed
Stale Branch Check
Feature branch is 10 commits behind main. Rebase recommended before merge:
git fetch origin && git rebase origin/mainQuality Metrics
any)Cache Status
N/A — First QA run
Build Verification
N/A — Build passed (
npm run buildexits 0)Test Coverage Analysis
src/lib/workflow/drivers/aider.tsaider.test.ts(20 tests)src/lib/workflow/drivers/index.tsindex.test.ts(4 tests)src/lib/workflow/drivers/claude-code.tsclaude-code.test.tssrc/lib/settings.tsaider-settings.test.ts(10 tests)src/commands/doctor.tsdoctor.test.tssrc/lib/workflow/phase-executor.tssrc/lib/workflow/drivers/agent-driver.tssrc/lib/workflow/types.tssrc/commands/run.tsrun-resume.test.tssrc/lib/workflow/platforms/*github.test.ts,index.test.tsCoverage: 8/8 changed source files with logic have corresponding tests
Critical paths without tests: None
Code Review
Strengths:
AiderDriveris self-contained, ~158 linesbuildArgs()cleanly encapsulates flag construction with settings passthroughClaudeCodeDriverpatternsIssues:
Suggestions:
for awaitinclaude-code.tsis the SDK streaming pattern — acceptable, not an N+1catch {}blocks (5 total across diff) are all in platform/system utility code — acceptable for "check if X exists" patternsTest Quality Review
child_processmocked — appropriate for subprocess drivervi.useFakeTimers()used properly for timeout tests, no flaky patternsAnti-Pattern Detection
Dependency Audit
N/A — No dependency changes in
package.jsonCode Patterns
No issues detected:
clearTimeout()properly called)Call-Site Review
New exported functions detected: 3
validateAiderSettings()settings.ts:326getDriver()phase-executor.ts:237config.agentpassedgetPlatform()Findings: All call sites correct. No missing guards.
CLI Registration Verification
Option files modified: Yes (
batch-executor.ts,bin/cli.ts)agentmergedOptions.agent(run.ts:301)--agentin bin/cli.ts:216Verification Status: Passed
Execution Evidence
N/A — No scripts/ changes. CLI flag
--agentis tested via integration tests.Skill Command Verification
N/A — No skill files changed
Smoke Test
Not Required — No workflow-affecting changes (skills, scripts unchanged)
CHANGELOG Verification
Result: CHANGELOG requirements met
Self-Evaluation
Verdict: READY_FOR_MERGE
All 14 AC items are MET. Implementation is clean, well-tested (37 new tests), builds and passes CI. The AiderDriver correctly implements the AgentDriver interface with proper subprocess management, timeout/abort handling, settings validation, and CLI registration.
git fetch origin && git rebase origin/mainbefore merging.Documentation
--helpcovers--agentflag)Next Steps
git fetch origin && git rebase origin/mainDocumentation: Before merging, run
/docs 369to generate feature documentation.admarble commentedon Mar 23, 2026
QA Review for Issue #369 — Add Aider as Second Agent Backend
AC Coverage
name,executePhase(),isAvailable()with correct signaturesexecSync("which aider")with try/catch. Tested both pathsspawn("aider", [...])with--yes,--no-auto-commits,--no-pretty,--message. Model/editFormat/extraArgs supportedsuccess: true, non-zero →success: falsewith error messagekill("SIGTERM"). AbortSignal support. Both testedonOutputcallback called per chunk when verbose=true, not called when false--agent aiderworks end-to-endbin/cli.ts→run.ts→batch-executor→phase-executor→getDriver().--agentappears in--helpcommandExists("aider")whensettings.run.agent === "aider". Pass/fail testedsettings.jsonsupports aider configAiderSettings(model, editFormat, extraArgs).validateAiderSettings()with strict type validation at load timeCoverage: 11/11 AC items fully met
CI Status
CI Summary: 5 passed, 0 pending, 0 failed
Quality Metrics
any)Test Coverage Analysis
src/lib/workflow/drivers/aider.tsaider.test.ts+aider-integration.test.tssrc/lib/workflow/drivers/claude-code.tsclaude-code.test.tssrc/lib/workflow/drivers/index.tsindex.test.tssrc/lib/workflow/drivers/agent-driver.tssrc/lib/workflow/platforms/github.tsgithub.test.tssrc/lib/workflow/platforms/index.tsindex.test.tssrc/lib/workflow/platforms/platform-provider.tssrc/lib/settings.tsaider-settings.test.ts(validateAiderSettings)src/commands/doctor.tsdoctor.test.tssrc/lib/workflow/phase-executor.tsrun-resume.test.tssrc/lib/workflow/phase-detection.tsphase-detection.test.tssrc/lib/workflow/types.tssrc/lib/workflow/batch-executor.tsbin/cli.tsCoverage: All standard-tier changed files have corresponding tests
Test results: 57 aider-specific tests pass across 7 test files
Code Review
Strengths:
AgentDriverinterface proven with two fundamentally different backends (in-process SDK vs subprocess CLI)spawn()with array args prevents shell injection. Settings validated at load timeGitHubProvidercentralizes allghCLI calls, replacing inlineexecSync/spawnSyncIssues:
Suggestions (non-blocking):
getPlatform()registry function exists but production code importsGitHubProviderdirectly — consider using the registry for consistency withgetDriver()pattern (future PR)Anti-Pattern Detection
Code Patterns
No anti-patterns detected:
awaitin loopsspawn()used correctly with array args (no shell injection)Call-Site Review
New exported functions detected: 3
validateAiderSettings()settings.ts:326getDriver()phase-executor.ts:237getPlatform()CLI Registration Verification
Option files modified: Yes
agentmergedOptions.agent(run.ts:300)--agent <name>(bin/cli.ts:212)Verification Status: Passed
Self-Evaluation
--agent, full wiring verified from CLI → driverextraArgsescape hatchCHANGELOG Verification
Verdict: READY_FOR_MERGE
All 11 AC items are fully met. The implementation is clean, well-tested (57 tests), and secure. The
AgentDriverabstraction is proven with two fundamentally different backends. CI is green across all checks.Next Steps
/docs 369to generate documentation before mergingfix(#369): add Aider-specific phase prompts and --file context
fix(#369): dry-run shows Aider-specific prompts (AC-14)
feat(#369): add Aider as second agent backend (#385)
fix: add missing mocks to doctor.test.ts after #372 merge
admarble commentedon Mar 23, 2026
Documentation Generated
File:
docs/features/aider-agent-backend.mdSections Included:
Next Steps:
Ready to merge!
docs(#369): add Aider agent backend documentation
fix: add AC literal verification check to QA skill