Skip to main content

/sw:do - Execute Tasks

Implementation Execution: Execute increment tasks following spec.md and plan.md.

This is the main command for doing work in SpecWeave. It smart-resumes from where you left off, runs tests continuously, and updates documentation after each task.

Usageโ€‹

# Auto-resumes from last incomplete task
/sw:do [increment-id]

# Or let it find active increment automatically
/sw:do

# Override model selection (advanced)
/sw:do 0007 --model haiku
/sw:do 0007 --model opus

Argumentsโ€‹

ArgumentDescription
increment-idOptional. Increment ID (e.g., "0007", "0001-feature")
--model <tier>Optional. Override model selection (haiku, sonnet, opus)

Smart Resumeโ€‹

The command automatically resumes from the last incomplete task:

๐Ÿ“Š Resume Context:

Completed: 3/12 tasks (25%)
โ”œโ”€ [โœ…] T001: โšก haiku - Setup auth module (P1)
โ”œโ”€ [โœ…] T002: โšก haiku - Create user model (P1)
โ”œโ”€ [โœ…] T003: ๐Ÿ’Ž opus - Implement JWT tokens (P1)
โ””โ”€ [โณ] T004: โšก haiku - Add password hashing (P1) โ† RESUMING HERE

Remaining: 9 tasks

Benefits:

  • โœ… No manual tracking needed
  • โœ… Seamlessly continue after breaks
  • โœ… Prevents duplicate work
  • โœ… Shows progress at a glance

Workflowโ€‹

Step 1: Load Contextโ€‹

  1. Find increment directory - Normalizes ID to 4-digit format
  2. Load specification and plan - Reads spec.md, plan.md, tasks.md
  3. Load Living Docs Context (optional) - Checks ADRs and related specs
  4. Verify readiness - Validates status and AC presence

Step 2: Smart Resumeโ€‹

  • Scans all tasks for completion status
  • Finds first incomplete task
  • Shows resume context with progress

Step 3: Execute Tasks Sequentiallyโ€‹

For each task:

  1. Read task details - ID, model hint, description, ACs
  2. Select execution model - Uses hints or --model override
  3. Execute task - Follows architecture from plan.md
  4. Mark task complete - Updates tasks.md with [x]
  5. Run hooks - Plays sound, shows reminder
  6. Sync to GitHub (if enabled) - Closes issues, updates progress
  7. Update docs - CLAUDE.md, README.md, CHANGELOG.md

Step 4: Handle Blockersโ€‹

If a task cannot be completed:

โš ๏ธ Blocker on Task T012: "Add email verification"

Issue: Email service provider not specified in plan.md

Options:
A) Use SendGrid (recommended)
B) Use AWS SES
C) Skip for now, add as new task

Step 5: Run Tests Continuouslyโ€‹

After completing tasks that affect testable functionality:

๐Ÿงช Running tests for auth module...

โœ“ User model validation
โœ“ Password hashing
โœ— JWT token generation (FAILED)

๐Ÿ”ง Fixing test failure...
โ€ข Updated JWT expiry config

Re-running tests...
โœ“ JWT token generation

โœ… All tests passing (3/3)

Step 6: Completionโ€‹

When all tasks complete:

๐ŸŽ‰ All tasks completed!

โœ… Tasks: 42/42 (100%)
โฑ๏ธ Time taken: 3.2 weeks

๐Ÿ“ Now syncing implementation learnings to living docs...

Next steps:
1. Run full test suite: npm test
2. Validate increment: /sw:validate 0001 --quality
3. Close increment: /sw:done 0001

Model Hints in Tasksโ€‹

Tasks can include model hints for cost optimization:

HintModelUse Case
โšกHaikuSimple mechanical tasks (3x faster, 20x cheaper)
๐Ÿง SonnetModerate complexity (legacy)
๐Ÿ’ŽOpusComplex reasoning (default)

Example tasks.md:

### T-001: Setup auth module โšก
**Status**: [ ] pending

### T-002: Implement JWT strategy ๐Ÿ’Ž
**Status**: [ ] pending

Hook Integrationโ€‹

After EVERY task completion, hooks run automatically:

  1. Play completion sound - Glass.aiff on macOS
  2. Show reminder - Update CLAUDE.md, README.md inline
  3. Log completion - Appends to .specweave/logs/tasks.log
  4. Sync to GitHub (if enabled) - Close task issue, update epic

Auto-Execute Rulesโ€‹

When executing deployment tasks:

โŒ FORBIDDEN: "Next Steps: Run wrangler deploy"
โœ… REQUIRED: Execute commands DIRECTLY using available credentials

Always check for credentials before deployment:

grep -E "SUPABASE|DATABASE_URL|CF_" .env 2>/dev/null
wrangler whoami 2>/dev/null
gh auth status 2>/dev/null

Examplesโ€‹

Example 1: Execute Complete Incrementโ€‹

/sw:do 0001

Output:

๐Ÿ“‚ Loading increment 0001-user-authentication...

โœ… Context loaded (spec.md, plan.md, tasks.md)

๐Ÿ”จ Starting execution (42 tasks)...

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
Task T001: Create User model
โœ… Completed | ๐Ÿช Docs updated
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

[... continues for all 42 tasks ...]

๐ŸŽ‰ All tasks completed (42/42)

Next: /sw:validate 0001 --quality

Example 2: Resume After Breakโ€‹

/sw:do

Output:

๐Ÿ“‚ Found active increment: 0003-payment-processing

๐Ÿ“Š Resume Context:
Completed: 15/42 tasks (36%)
โ† Resuming from T016: Add Stripe webhook handler

๐Ÿ”จ Executing Task T016...

Error Handlingโ€‹

Increment Not Foundโ€‹

โŒ Error: Increment 0001 not found

Available increments:
โ€ข 0002-core-enhancements (planned)
โ€ข 0003-payment-processing (in-progress)

No Tasks to Executeโ€‹

โš ๏ธ Warning: No tasks found in tasks.md

Options:
1. Re-plan increment: /sw:increment 0001
2. Add tasks manually: Edit tasks.md

CommandPurpose
/sw:incrementPlan increment (creates spec.md, plan.md, tasks.md)
/sw:progressCheck completion status
/sw:validateValidate quality before closing
/sw:doneClose increment (PM validates)
/sw:autoAutonomous execution mode

Best Practicesโ€‹

  1. Run /sw:validate --quality after execution to ensure quality
  2. Let hooks run - They update docs and sync to GitHub automatically
  3. Use model hints - Add โšก/๐Ÿ’Ž to tasks for cost optimization
  4. Check progress often - Run /sw:progress to see status

See Alsoโ€‹