plugins/specweave/skills/auto/SKILL.md
Start autonomous execution with stop hook feedback loop. Works until all tasks complete or max iterations reached. Use when you want continuous unattended execution.
npx skillsauth add anton-abyzov/specweave plugins/specweave/skills/autoInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Skill Memories: If .specweave/skill-memories/auto.md exists, read and apply its learnings.
Project Context: If .specweave/config.json exists, read it for testing mode, TDD enforcement, and multi-project settings. Check for active increments in .specweave/increments/*/metadata.json.
Start autonomous execution session using Claude Code's Stop Hook.
sw:auto [INCREMENT_IDS...] [OPTIONS]
INCREMENT_IDS: One or more increment IDs (e.g., 0001, 0001-feature). If omitted, finds active increments or intelligently creates new ones.| Option | Description | Default |
|--------|-------------|---------|
| --max-turns N | Max hook invocations before hard stop | 20 |
| --simple | Minimal context mode | false |
| --dry-run | Preview without starting | false |
| --all-backlog | Process all backlog items | false |
| --skip-gates G1,G2 | Pre-approve specific gates | None |
| --no-increment | Require existing increments (no auto-creation) | false |
| --yes, -y | Auto-approve increment plan | false |
| --tdd, --strict | TDD strict mode (RED->GREEN->REFACTOR enforced) | false |
| --build | Build must pass before completion | false |
| --tests | Tests must pass before completion | false |
| --e2e | E2E tests must pass before completion | false |
| --lint | Linting must pass before completion | false |
| --types | Type-checking must pass before completion | false |
| --cov <n> | Code coverage threshold (%) | 80 |
| --cmd "<command>" | Custom command must pass | None |
--simple)When simple: true is set in the session marker, reduce context consumption per iteration:
spec.md on each task iteration. Read it once at session start, then rely on tasks.md alone for task-by-task execution.tasks.md, not the entire file. Use line offsets if the file is long.When to use: Primarily for sub-agents in team-lead mode where the team-lead has already loaded specs, assigned tasks, and the agent just needs to execute. Also useful for simple increments with <10 tasks.
IMPLEMENT task -> TEST -> FAIL? -> FIX -> PASS -> mark complete -> NEXT task -> ... -> ALL DONE -> sw:done --auto -> CLOSED
Stop hook blocks when tasks/ACs remain. When all work is complete, stop hook blocks with all_complete_needs_closure to trigger sw:done --auto. Model enforces quality gates (build/tests/lint) before closure.
Use Read/Write/Edit/Glob tools directly (no CLI needed):
1a. Read config — .specweave/config.json: auto.enabled, auto.maxTurns (default 20), testing.defaultTestMode, testing.tddEnforcement
1b. Find increments:
.specweave/increments/{ID}*/metadata.json, verify exists1c. Activate increments — Edit metadata.json: set "status": "active", update timestamp
1c.5. PR-Based Branch Setup (conditional):
PUSH_STRATEGY=$(jq -r '.cicd.pushStrategy // "direct"' .specweave/config.json 2>/dev/null)
If pr-based: create/checkout feature branch before starting work (same logic as sw:do Step 2.5). Branch name: {branchPrefix}{increment-id}. If direct: skip.
1d. Write session marker — .specweave/state/auto-mode.json:
{
"active": true,
"timestamp": "<ISO>",
"incrementIds": ["0001-feature"],
"simple": false,
"tddMode": false,
"requireTests": false,
"userGoal": null,
"successCriteria": [
{ "type": "tasks_complete", "description": "All tasks marked complete", "required": true },
{ "type": "acs_satisfied", "description": "All ACs satisfied", "required": true }
],
"successSummary": "All tasks and acceptance criteria complete"
}
Map flags to session marker fields:
--simple -> set "simple": true--tests -> { "type": "tests_pass", "required": true }--build -> { "type": "build_succeeds", "required": true }--e2e -> { "type": "tests_pass", "description": "E2E tests", "required": true }--lint -> { "type": "custom_command", "command": "<lint-cmd>", "required": true }--types -> { "type": "custom_command", "command": "npx tsc --noEmit", "required": true }--cov N -> { "type": "tests_pass", "threshold": N, "required": true }--cmd "X" -> { "type": "custom_command", "command": "X", "required": true }--tdd -> set "tddMode": trueAlways include tasks_complete and acs_satisfied as base criteria. Ensure .specweave/state/ dir exists.
userGoal field: Set to the user's stated intent from conversation context. If the user said "fix the auth bug", set userGoal to "fix the auth bug". If no clear intent is expressed, set to null. This field is read by the stop hook to provide context-aware feedback and guide sw:do to the correct increment.
Before starting autonomous execution, check if this increment needs team-lead:
Count pending tasks in tasks.md (count [ ] markers)
Detect domains from file paths in tasks.md and plan.md:
.tsx, src/components/, src/pages/, React/Vue keywordssrc/api/, src/services/, src/routes/, Express/NestJS keywordsprisma/, migrations/, SQL keywordsDockerfile, .github/, k8s/ keywordstests/, e2e/, .test. keywordssrc/auth/, auth keywordsios/, android/, React Native keywordsIf 3+ domains detected OR domain count suggests multi-agent benefit:
⚠️ COMPLEXITY ASSESSMENT
══════════════════════════════════════════
Tasks: [N] pending | Domains: [N] ([list])
──────────────────────────────────────────
This increment spans 3+ domains. sw:team-lead is recommended
for parallel execution with higher quality results.
⚡ Trade-off: ~2-3x more tokens, but parallel agents
produce better results for multi-domain work.
══════════════════════════════════════════
Then use AskUserQuestion:
In auto mode (no user present): Auto-invoke sw:team-lead for 3+ domains.
This is the default behavior per CLAUDE.md execution strategy.
You MUST output a stop conditions banner BEFORE starting work. Detect test frameworks, count test files, then show:
AUTO MODE STARTING
======================================================================
Increment: [ID] | Tasks: [N] pending
======================================================================
TESTS THAT MUST PASS:
Unit: [command] - [N] test files ([list key ones])
E2E: [command] - [N] test files (if applicable)
[NEW] files to be created during auto mode
======================================================================
COMPLETES WHEN: All tasks done + tests pass + sw:done passes
STOPS IF: 3 consecutive test failures | sw:cancel-auto | max turns
======================================================================
Fill ALL placeholders with real values. Be specific about test files and commands.
Check TDD priority: --tdd flag > increment metadata.json > config.json
If TDD enabled, validate tasks.md has [RED]/[GREEN]/[REFACTOR] markers. If no markers found:
strict: BLOCK — cannot proceed, fix tasks firstwarn: show warning, continue without enforcementoff: skip silentlyEnforcement rules: [RED] tasks complete freely. [GREEN] requires its [RED] done first. [REFACTOR] requires its [GREEN] done first.
Analyze context and decide:
sw:increment "description" then set up sessionThen return to Step 1c-1d to set up the session, then Step 1.5 for the banner.
sw:do in a loop (stop hook handles continuation)sw:done: verify all quality gates from successCriteriaall_complete_needs_closure):
sw-closer subagent per increment:
Agent({
subagent_type: "sw:sw-closer",
prompt: "Close increment <ID>. Increment path: .specweave/increments/<ID>/",
description: "Close increment <ID>"
})
The sw-closer runs grill, judge-llm, PM gates, and specweave complete in a fresh context.sw:done --auto <id> for each increment directly.sw:done) succeeds, clean up session state (rm -f auto-mode.json, turn counter, dedup files) and output <!-- auto-complete:DONE -->sw:done) fails (gate failure), report the failure and do NOT clean up session state. The stop hook will block again on the next turn for a retry.In auto mode, execute deployment commands directly using available credentials. Check .env, env vars, CLI auth (wrangler whoami, gh auth status). If credentials missing, ask user — never output manual steps.
sw:auto-statussw:cancel-autosw:do or claude --continuesw:team-lead instead| Mechanism | Default |
|-----------|---------|
| Turn limit | 20 |
| Staleness cleanup | 2h |
| Human gates | deploy, migrate, publish patterns |
| Command | Purpose |
|---------|---------|
| sw:auto-status | Check session status |
| sw:cancel-auto | Cancel session |
| sw:do | Execute tasks (standalone) |
| sw:progress | Show progress |
| sw:team-lead | Multi-agent orchestration |
tools
Generate AI videos from text prompts or images. Supports Google Veo 3.1 and Pollinations.ai (free). Use when generating video, creating animations, text-to-video, AI video, video generation, make clip, animate.
tools
Validate increment with rule-based checks and AI quality assessment. Use when saying "validate", "check quality", or "verify increment".
tools
Create and manage umbrella workspaces for multi-repo projects. Activate when the user wants to: create umbrella, umbrella init, wrap in umbrella, create workspace, setup multi-repo, migrate repos to umbrella, umbrella create, new workspace, restructure into umbrella, "wrap this repo", "create umbrella for these repos", "setup workspace with repos", "move repos into umbrella". Do NOT activate for: add a repo to existing umbrella (use sw:get), add a feature, add an increment, clone a repo (use sw:get).
tools
--- description: Merge completed parallel agent work and trigger GitHub sync per increment. Activates for: team merge, merge agents, combine work, team finish. --- # Team Merge **Verify all teammates completed, run quality gates, close increments, and trigger sync.** ## Usage ```bash sw:team-merge sw:team-merge --dry-run # Preview merge plan sw:team-merge --skip-sync # Merge without GitHub/JIRA sync ``` ## What This Skill Does 1. **Verify all teammates completed** -- bl