specweave 1.0.256 → 1.0.259
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.
- package/CLAUDE.md +56 -221
- package/README.md +31 -0
- package/bin/specweave.js +17 -0
- package/dist/src/adapters/README.md +4 -4
- package/dist/src/adapters/agents-md-generator.d.ts.map +1 -1
- package/dist/src/adapters/agents-md-generator.js +0 -2
- package/dist/src/adapters/agents-md-generator.js.map +1 -1
- package/dist/src/adapters/claude/README.md +3 -3
- package/dist/src/adapters/claude/adapter.js +3 -3
- package/dist/src/adapters/claude-md-generator.js +1 -1
- package/dist/src/adapters/claude-md-generator.js.map +1 -1
- package/dist/src/adapters/registry.yaml +1 -1
- package/dist/src/cli/commands/create-increment.d.ts +24 -0
- package/dist/src/cli/commands/create-increment.d.ts.map +1 -0
- package/dist/src/cli/commands/create-increment.js +53 -0
- package/dist/src/cli/commands/create-increment.js.map +1 -0
- package/dist/src/cli/commands/init.d.ts.map +1 -1
- package/dist/src/cli/commands/init.js +48 -31
- package/dist/src/cli/commands/init.js.map +1 -1
- package/dist/src/cli/commands/update.d.ts.map +1 -1
- package/dist/src/cli/commands/update.js +36 -0
- package/dist/src/cli/commands/update.js.map +1 -1
- package/dist/src/cli/helpers/init/directory-structure.d.ts.map +1 -1
- package/dist/src/cli/helpers/init/directory-structure.js +13 -1
- package/dist/src/cli/helpers/init/directory-structure.js.map +1 -1
- package/dist/src/cli/helpers/init/summary-banner.d.ts +11 -0
- package/dist/src/cli/helpers/init/summary-banner.d.ts.map +1 -1
- package/dist/src/cli/helpers/init/summary-banner.js +49 -3
- package/dist/src/cli/helpers/init/summary-banner.js.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/index.d.ts.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/index.js +0 -1
- package/dist/src/cli/helpers/issue-tracker/index.js.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/sync-config-writer.d.ts.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/sync-config-writer.js +6 -2
- package/dist/src/cli/helpers/issue-tracker/sync-config-writer.js.map +1 -1
- package/dist/src/core/ac-progress-sync.d.ts +13 -0
- package/dist/src/core/ac-progress-sync.d.ts.map +1 -1
- package/dist/src/core/ac-progress-sync.js +28 -0
- package/dist/src/core/ac-progress-sync.js.map +1 -1
- package/dist/src/core/config/types.d.ts +24 -1
- package/dist/src/core/config/types.d.ts.map +1 -1
- package/dist/src/core/config/types.js +6 -1
- package/dist/src/core/config/types.js.map +1 -1
- package/dist/src/core/doctor/checkers/project-structure-checker.d.ts +1 -0
- package/dist/src/core/doctor/checkers/project-structure-checker.d.ts.map +1 -1
- package/dist/src/core/doctor/checkers/project-structure-checker.js +53 -3
- package/dist/src/core/doctor/checkers/project-structure-checker.js.map +1 -1
- package/dist/src/core/fabric/security-scanner.d.ts.map +1 -1
- package/dist/src/core/fabric/security-scanner.js +70 -9
- package/dist/src/core/fabric/security-scanner.js.map +1 -1
- package/dist/src/core/increment/increment-utils.d.ts +6 -0
- package/dist/src/core/increment/increment-utils.d.ts.map +1 -1
- package/dist/src/core/increment/increment-utils.js +5 -0
- package/dist/src/core/increment/increment-utils.js.map +1 -1
- package/dist/src/core/living-docs/discovery.d.ts +2 -0
- package/dist/src/core/living-docs/discovery.d.ts.map +1 -1
- package/dist/src/core/living-docs/discovery.js +91 -17
- package/dist/src/core/living-docs/discovery.js.map +1 -1
- package/dist/src/core/living-docs/intelligent-analyzer/index.d.ts +5 -0
- package/dist/src/core/living-docs/intelligent-analyzer/index.d.ts.map +1 -1
- package/dist/src/core/living-docs/intelligent-analyzer/index.js +3 -3
- package/dist/src/core/living-docs/intelligent-analyzer/index.js.map +1 -1
- package/dist/src/core/living-docs/lsp-bootstrapper.d.ts +64 -0
- package/dist/src/core/living-docs/lsp-bootstrapper.d.ts.map +1 -0
- package/dist/src/core/living-docs/lsp-bootstrapper.js +118 -0
- package/dist/src/core/living-docs/lsp-bootstrapper.js.map +1 -0
- package/dist/src/core/project/project-service.d.ts +10 -1
- package/dist/src/core/project/project-service.d.ts.map +1 -1
- package/dist/src/core/project/project-service.js +37 -2
- package/dist/src/core/project/project-service.js.map +1 -1
- package/dist/src/core/universal-auto-create.d.ts +64 -0
- package/dist/src/core/universal-auto-create.d.ts.map +1 -0
- package/dist/src/core/universal-auto-create.js +228 -0
- package/dist/src/core/universal-auto-create.js.map +1 -0
- package/package.json +1 -1
- package/plugins/specweave/PLUGIN.md +0 -3
- package/plugins/specweave/commands/living-docs.md +0 -2
- package/plugins/specweave/hooks/stop-sync.sh +34 -5
- package/plugins/specweave/hooks/user-prompt-submit.sh +115 -326
- package/plugins/specweave/hooks/v2/dispatchers/post-tool-use.sh +19 -5
- package/plugins/specweave/hooks/v2/handlers/ac-sync-dispatcher.sh +14 -4
- package/plugins/specweave/hooks/v2/handlers/universal-auto-create-dispatcher.sh +181 -0
- package/plugins/specweave/lib/hooks/sync-living-docs.js +4 -2
- package/plugins/specweave/scripts/skill-context.sh +160 -0
- package/plugins/specweave/skills/architect/SKILL.md +1 -1
- package/plugins/specweave/skills/archive-increments/SKILL.md +13 -3
- package/plugins/specweave/skills/auto/SKILL.md +92 -1038
- package/plugins/specweave/skills/do/SKILL.md +66 -1106
- package/plugins/specweave/skills/docs/SKILL.md +124 -56
- package/plugins/specweave/skills/done/SKILL.md +76 -1406
- package/plugins/specweave/skills/framework/SKILL.md +1 -1
- package/plugins/specweave/skills/increment/SKILL.md +1 -1
- package/plugins/specweave/skills/increment-planner/SKILL.md +29 -19
- package/plugins/specweave/skills/jobs/SKILL.md +52 -0
- package/plugins/specweave/skills/multi-project-spec-mapper/SKILL.md +1 -1
- package/plugins/specweave/skills/save/SKILL.md +51 -1372
- package/plugins/specweave/skills/smart-reopen-detector/SKILL.md +1 -1
- package/plugins/specweave/skills/tdd-orchestrator/SKILL.md +1 -1
- package/plugins/specweave/skills/validate/SKILL.md +65 -848
- package/plugins/specweave-backend/skills/database-optimizer/SKILL.md +1 -1
- package/plugins/specweave-backend/skills/graphql/SKILL.md +1 -1
- package/plugins/specweave-frontend/skills/design-system-architect/SKILL.md +1 -1
- package/plugins/specweave-frontend/skills/frontend/SKILL.md +1 -1
- package/plugins/specweave-frontend/skills/frontend-architect/SKILL.md +1 -1
- package/plugins/specweave-frontend/skills/frontend-design/SKILL.md +1 -1
- package/plugins/specweave-frontend/skills/i18n-expert/SKILL.md +1 -1
- package/plugins/specweave-payments/skills/billing-automation/SKILL.md +1 -1
- package/plugins/specweave-testing/skills/accessibility-testing/SKILL.md +1 -1
- package/src/templates/CLAUDE.md.template +50 -356
- package/src/templates/config.json.template +5 -1
- package/plugins/specweave/commands/brownfield-analyzer.md +0 -408
- package/plugins/specweave/commands/brownfield-onboarder.md +0 -837
- package/plugins/specweave/commands/export-skills.md +0 -179
|
@@ -10,23 +10,11 @@ argument-hint: "[INCREMENT_IDS...] [OPTIONS]"
|
|
|
10
10
|
|
|
11
11
|
!`s="auto"; for d in .specweave/skill-memories .claude/skill-memories "$HOME/.claude/skill-memories"; do p="$d/$s.md"; [ -f "$p" ] && awk '/^## Learnings$/{ok=1;next}/^## /{ok=0}ok' "$p" && break; done 2>/dev/null; true`
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
## How to Use
|
|
16
|
-
|
|
17
|
-
When user says "auto" or "autonomous" or "keep working" or provides a task description, you should:
|
|
13
|
+
## Project Context
|
|
18
14
|
|
|
19
|
-
|
|
20
|
-
2. **Find or create the increment**: Check for active increments, or create new ones if needed
|
|
21
|
-
3. **Set up auto session directly** (see Execution section):
|
|
22
|
-
- Read config and find increments using Read/Glob tools
|
|
23
|
-
- Activate increments by editing metadata.json via Edit tool
|
|
24
|
-
- Write session marker (`.specweave/state/auto-mode.json`) via Write tool
|
|
25
|
-
- Map quality flags to `successCriteria` in the marker
|
|
26
|
-
4. **MANDATORY: Display stop conditions banner** - Users MUST see when auto mode will stop BEFORE work begins! See "Step 1.5" in Execution section.
|
|
27
|
-
5. **Start working**: Execute /sw:do on tasks, mark them complete, let framework hooks handle sync
|
|
15
|
+
!`.specweave/scripts/skill-context.sh auto 2>/dev/null; true`
|
|
28
16
|
|
|
29
|
-
|
|
17
|
+
**Start autonomous execution session using Claude Code's Stop Hook.**
|
|
30
18
|
|
|
31
19
|
## Usage
|
|
32
20
|
|
|
@@ -34,1082 +22,149 @@ Now work on the increment tasks. When you try to exit, the stop hook will check
|
|
|
34
22
|
/sw:auto [INCREMENT_IDS...] [OPTIONS]
|
|
35
23
|
```
|
|
36
24
|
|
|
37
|
-
|
|
38
|
-
**Compact Command (VSCode)** — Use `compact` mode to keep Claude Code inside your VSCode window. Work continuously for **hours** in the same session without context switching between terminal and editor. Perfect for long auto mode sessions!
|
|
39
|
-
|
|
40
|
-
**STOP Hooks with Subagents** — Stop hooks now work with spawned subagents! This means `/sw:auto` can validate quality gates at EVERY level of execution. When auto mode spawns specialized agents (QA, Security, Performance), the stop hook validates their results before allowing the session to continue.
|
|
41
|
-
|
|
42
|
-
:::
|
|
43
|
-
|
|
44
|
-
## Arguments
|
|
45
|
-
|
|
46
|
-
- `INCREMENT_IDS`: One or more increment IDs to process (e.g., `0001`, `0001-feature`)
|
|
47
|
-
- **NEW BEHAVIOR**: If omitted, auto mode will:
|
|
48
|
-
1. Check for active/in-progress increments
|
|
49
|
-
2. If none found, **intelligently create increments** based on user context
|
|
50
|
-
3. Match existing planned increments to user intent OR extend them
|
|
25
|
+
- `INCREMENT_IDS`: One or more increment IDs (e.g., `0001`, `0001-feature`). If omitted, finds active increments or intelligently creates new ones.
|
|
51
26
|
|
|
52
27
|
## Options
|
|
53
28
|
|
|
54
29
|
| Option | Description | Default |
|
|
55
30
|
|--------|-------------|---------|
|
|
56
|
-
| `--max-turns N` |
|
|
57
|
-
| `--simple` |
|
|
31
|
+
| `--max-turns N` | Max hook invocations before hard stop | 20 |
|
|
32
|
+
| `--simple` | Minimal context mode | false |
|
|
58
33
|
| `--dry-run` | Preview without starting | false |
|
|
59
34
|
| `--all-backlog` | Process all backlog items | false |
|
|
60
35
|
| `--skip-gates G1,G2` | Pre-approve specific gates | None |
|
|
61
|
-
| `--no-increment
|
|
62
|
-
| `--yes`, `-y` | Auto-approve increment plan
|
|
63
|
-
| `--tdd`, `--strict` |
|
|
64
|
-
|
|
|
65
|
-
|
|
|
66
|
-
|
|
|
67
|
-
|
|
|
68
|
-
|
|
|
69
|
-
|
|
|
70
|
-
|
|
|
71
|
-
| **`--cmd "<command>"`** | Custom command must pass before completion | None |
|
|
72
|
-
|
|
73
|
-
:::warning Turn limit is a SAFETY NET
|
|
74
|
-
The primary completion criteria is **all tasks complete + all ACs satisfied** (grep-based, reliable). The turn limit (default: 20) is a backup safety net. Quality gates (tests, build, coverage) are enforced by the MODEL before running `/sw:done`, NOT by the stop hook.
|
|
75
|
-
:::
|
|
76
|
-
|
|
77
|
-
## Completion Architecture (v5)
|
|
78
|
-
|
|
79
|
-
**Two-layer design**: Stop hook gates exit. Model enforces quality before `/sw:done`.
|
|
80
|
-
|
|
81
|
-
### What the Stop Hook Does (v5)
|
|
82
|
-
|
|
83
|
-
The stop hook (`stop-auto-v5.sh`, ~166 lines) is a **simple gate**:
|
|
84
|
-
|
|
85
|
-
1. Checks if auto mode is active (auto-mode.json marker)
|
|
86
|
-
2. Counts pending tasks in `tasks.md` (grep-based, reliable)
|
|
87
|
-
3. Counts open ACs in `spec.md` (grep-based, reliable)
|
|
88
|
-
4. If work remains: **block** with concise message
|
|
89
|
-
5. If all complete: **approve** (model should then run `/sw:done`)
|
|
90
|
-
|
|
91
|
-
The hook does NOT run tests, builds, or any external commands. It has no PATH dependency.
|
|
92
|
-
|
|
93
|
-
### What the Model Does (before /sw:done)
|
|
94
|
-
|
|
95
|
-
When `--build`, `--tests`, etc. flags are passed, they are stored as **success criteria** in `auto-mode.json`. The model reads these criteria and MUST verify them before running `/sw:done`:
|
|
96
|
-
|
|
97
|
-
| Flag | successCriteria type | Model Responsibility |
|
|
98
|
-
|------|---------------------|---------------------|
|
|
99
|
-
| `--build` | `build_succeeds` | Run build command, fix failures |
|
|
100
|
-
| `--tests` | `tests_pass` | Run tests, fix failures |
|
|
101
|
-
| `--e2e` | `tests_pass` (description: "E2E tests") | Run E2E tests, fix failures |
|
|
102
|
-
| `--lint` | `custom_command` (command: lint cmd) | Run linter, fix issues |
|
|
103
|
-
| `--types` | `custom_command` (command: tsc) | Run type checker, fix errors |
|
|
104
|
-
| `--cov N` | `tests_pass` (threshold: N) | Write tests to meet threshold |
|
|
105
|
-
| `--cmd "..."` | `custom_command` | Run custom command |
|
|
106
|
-
|
|
107
|
-
The model runs in a proper shell environment where npm/node ARE available.
|
|
108
|
-
|
|
109
|
-
### Completion Flow
|
|
110
|
-
|
|
111
|
-
```
|
|
112
|
-
Tasks done + ACs satisfied
|
|
113
|
-
→ Hook approves exit
|
|
114
|
-
→ Model verifies quality criteria (build, tests, etc.)
|
|
115
|
-
→ Model runs /sw:done
|
|
116
|
-
→ /sw:done runs PM validation gates
|
|
117
|
-
→ Increment closed
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
### Safety Nets
|
|
121
|
-
|
|
122
|
-
| Mechanism | Default | Purpose |
|
|
123
|
-
|-----------|---------|---------|
|
|
124
|
-
| Turn limit | 20 | Hard stop after N hook invocations |
|
|
125
|
-
| Staleness | 2h | Auto-cleanup sessions inactive > 2 hours |
|
|
126
|
-
| Dedup | 30s | Prevent rapid-fire blocks |
|
|
127
|
-
|
|
128
|
-
Configure in `.specweave/config.json`:
|
|
129
|
-
```json
|
|
130
|
-
{ "auto": { "maxTurns": 50, "maxSessionAge": 7200 } }
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
### Best Practices
|
|
134
|
-
|
|
135
|
-
1. **Start Simple**: Use `--build --tests` for basic quality gates
|
|
136
|
-
2. **Add Coverage Gradually**: Start with `--cov 70`, increase over time
|
|
137
|
-
3. **Don't Skip E2E**: Use `--e2e` for user-facing features
|
|
138
|
-
4. **Custom Commands**: Use `--cmd` for project-specific checks
|
|
139
|
-
|
|
140
|
-
## Intelligent Increment Creation (NEW!)
|
|
141
|
-
|
|
142
|
-
**Auto mode now creates increments automatically when none exist!**
|
|
143
|
-
|
|
144
|
-
### Decision Flow
|
|
145
|
-
|
|
146
|
-
```
|
|
147
|
-
/sw:auto invoked
|
|
148
|
-
│
|
|
149
|
-
▼
|
|
150
|
-
Are INCREMENT_IDS specified? ──YES──> Use specified increments
|
|
151
|
-
│
|
|
152
|
-
NO
|
|
153
|
-
▼
|
|
154
|
-
Active increment exists? ──YES──> Use active increment
|
|
155
|
-
│
|
|
156
|
-
NO
|
|
157
|
-
▼
|
|
158
|
-
--no-increment/--no-inc flag? ──YES──> ERROR: No increments found
|
|
159
|
-
│
|
|
160
|
-
NO (DEFAULT)
|
|
161
|
-
▼
|
|
162
|
-
INTELLIGENT INCREMENT CREATION
|
|
163
|
-
│
|
|
164
|
-
├─> Analyze user context
|
|
165
|
-
├─> Check for matching planned/backlog increments
|
|
166
|
-
├─> Match existing OR create new increment(s)
|
|
167
|
-
│
|
|
168
|
-
▼
|
|
169
|
-
Auto mode starts with new/matched increment(s)
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
### Intelligence Patterns
|
|
173
|
-
|
|
174
|
-
The LLM will analyze the context and decide:
|
|
175
|
-
|
|
176
|
-
1. **Match Existing**: If user says "continue the auth feature" → finds `0002-user-authentication`
|
|
177
|
-
2. **Extend Existing**: If user says "add password reset" → extends auth increment with new tasks
|
|
178
|
-
3. **Create New**: If user says "build a payment system" → creates `0003-payment-integration`
|
|
179
|
-
4. **Multiple Increments**: If user says "finish all pending features" → creates queue from backlog
|
|
180
|
-
5. **Ask User**: If ambiguous, LLM will ask clarifying questions before creating
|
|
36
|
+
| `--no-increment` | Require existing increments (no auto-creation) | false |
|
|
37
|
+
| `--yes`, `-y` | Auto-approve increment plan | false |
|
|
38
|
+
| `--tdd`, `--strict` | TDD strict mode (RED->GREEN->REFACTOR enforced) | false |
|
|
39
|
+
| `--build` | Build must pass before completion | false |
|
|
40
|
+
| `--tests` | Tests must pass before completion | false |
|
|
41
|
+
| `--e2e` | E2E tests must pass before completion | false |
|
|
42
|
+
| `--lint` | Linting must pass before completion | false |
|
|
43
|
+
| `--types` | Type-checking must pass before completion | false |
|
|
44
|
+
| `--cov <n>` | Code coverage threshold (%) | 80 |
|
|
45
|
+
| `--cmd "<command>"` | Custom command must pass | None |
|
|
181
46
|
|
|
182
|
-
|
|
47
|
+
## Core Loop
|
|
183
48
|
|
|
184
|
-
```bash
|
|
185
|
-
# User says: "Let's ship the dashboard feature"
|
|
186
|
-
/sw:auto
|
|
187
|
-
# → LLM finds 0004-dashboard in backlog, activates it
|
|
188
|
-
|
|
189
|
-
# User says: "Build a user profile page with avatar upload"
|
|
190
|
-
/sw:auto
|
|
191
|
-
# → LLM creates 0005-user-profile-page with spec + tasks
|
|
192
|
-
|
|
193
|
-
# User says: "I want to work on auth and notifications"
|
|
194
|
-
/sw:auto
|
|
195
|
-
# → LLM creates queue: [0001-authentication, 0002-notifications]
|
|
196
|
-
|
|
197
|
-
# User says: "Just work on what's already planned"
|
|
198
|
-
/sw:auto --no-increment # or --no-inc
|
|
199
|
-
# → ERROR if no active increment (strict mode)
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
## How It Works
|
|
203
|
-
|
|
204
|
-
```
|
|
205
|
-
1. User runs /sw:auto (with or without IDs)
|
|
206
|
-
│
|
|
207
|
-
▼
|
|
208
|
-
2. Skill sets up session directly (no CLI needed):
|
|
209
|
-
├─ Read config.json for TDD mode, auto settings
|
|
210
|
-
├─ Glob/Read increments to find active/backlog
|
|
211
|
-
├─ Edit metadata.json to activate increments
|
|
212
|
-
└─ Write .specweave/state/auto-mode.json (session marker)
|
|
213
|
-
│
|
|
214
|
-
▼
|
|
215
|
-
3. Claude starts working on tasks
|
|
216
|
-
└─ /sw:do executes tasks
|
|
217
|
-
│
|
|
218
|
-
▼
|
|
219
|
-
4. Claude tries to exit (naturally)
|
|
220
|
-
│
|
|
221
|
-
▼
|
|
222
|
-
5. Stop Hook intercepts (stop-auto-v5.sh)
|
|
223
|
-
├─ Checks: auto-mode.json exists with active=true
|
|
224
|
-
├─ Checks: All tasks complete? (grep [ ] in tasks.md)
|
|
225
|
-
├─ Checks: All ACs satisfied? (grep [ ] in spec.md)
|
|
226
|
-
└─ Checks: Turn limit reached?
|
|
227
|
-
│
|
|
228
|
-
┌──────┴──────┐
|
|
229
|
-
▼ ▼
|
|
230
|
-
INCOMPLETE COMPLETE
|
|
231
|
-
│ │
|
|
232
|
-
▼ ▼
|
|
233
|
-
Block exit Approve exit
|
|
234
|
-
Re-feed Session ends
|
|
235
|
-
prompt
|
|
236
49
|
```
|
|
237
|
-
|
|
238
|
-
## Examples
|
|
239
|
-
|
|
240
|
-
### Basic Usage
|
|
241
|
-
|
|
242
|
-
```bash
|
|
243
|
-
# Start auto on current increment
|
|
244
|
-
/sw:auto
|
|
245
|
-
|
|
246
|
-
# Start on specific increment
|
|
247
|
-
/sw:auto 0001-user-auth
|
|
248
|
-
|
|
249
|
-
# Multiple increments
|
|
250
|
-
/sw:auto 0001 0002 0003
|
|
50
|
+
IMPLEMENT task -> TEST -> FAIL? -> FIX -> PASS -> mark complete -> NEXT task
|
|
251
51
|
```
|
|
252
52
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
```bash
|
|
256
|
-
# Increase turn limit
|
|
257
|
-
/sw:auto --max-turns 50
|
|
258
|
-
|
|
259
|
-
# Simple mode (minimal context)
|
|
260
|
-
/sw:auto --simple
|
|
261
|
-
|
|
262
|
-
# Preview only
|
|
263
|
-
/sw:auto --dry-run
|
|
264
|
-
|
|
265
|
-
# All backlog items
|
|
266
|
-
/sw:auto --all-backlog
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
### Pre-approve Gates
|
|
270
|
-
|
|
271
|
-
```bash
|
|
272
|
-
# Skip deploy gate (pre-approved)
|
|
273
|
-
/sw:auto --skip-gates deploy
|
|
274
|
-
|
|
275
|
-
# Multiple gates
|
|
276
|
-
/sw:auto --skip-gates "deploy,migrate"
|
|
277
|
-
```
|
|
278
|
-
|
|
279
|
-
## Session Management
|
|
280
|
-
|
|
281
|
-
### Check Status
|
|
282
|
-
|
|
283
|
-
```bash
|
|
284
|
-
/sw:auto-status
|
|
285
|
-
```
|
|
286
|
-
|
|
287
|
-
### Cancel Session
|
|
288
|
-
|
|
289
|
-
```bash
|
|
290
|
-
/sw:cancel-auto
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
### Resume After Crash
|
|
294
|
-
|
|
295
|
-
Just run `/sw:do` - it will detect incomplete tasks and continue.
|
|
296
|
-
|
|
297
|
-
Or use Claude Code's built-in:
|
|
298
|
-
```bash
|
|
299
|
-
/resume # Pick session to resume
|
|
300
|
-
claude --continue # Continue last session
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
## Configuration
|
|
304
|
-
|
|
305
|
-
In `.specweave/config.json`:
|
|
306
|
-
|
|
307
|
-
```json
|
|
308
|
-
{
|
|
309
|
-
"auto": {
|
|
310
|
-
"enabled": true,
|
|
311
|
-
"maxIterations": 500,
|
|
312
|
-
"maxHours": 120,
|
|
313
|
-
"testCommand": "npm test",
|
|
314
|
-
"coverageThreshold": 80,
|
|
315
|
-
"enforceTestFirst": false,
|
|
316
|
-
"humanGated": {
|
|
317
|
-
"patterns": ["deploy", "migrate", "publish"],
|
|
318
|
-
"timeout": 1800
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
```
|
|
323
|
-
|
|
324
|
-
**Note**: The stop hook checks task/AC completion via grep. Quality gates (tests, build) are the model's responsibility before running `/sw:done`.
|
|
325
|
-
|
|
326
|
-
## Completion Signals
|
|
327
|
-
|
|
328
|
-
The session ends when ANY of these occur:
|
|
329
|
-
|
|
330
|
-
1. **All tasks complete + tests passed** - tasks.md has all `[x]` AND tests were executed
|
|
331
|
-
2. **Completion promise** - Output contains `<!-- auto-complete:DONE -->`
|
|
332
|
-
3. **Max iterations** - Reached configured limit (default: 500)
|
|
333
|
-
4. **Max hours** - Time limit exceeded (default: 120 hours / 5 days)
|
|
334
|
-
5. **User cancellation** - `/sw:cancel-auto`
|
|
335
|
-
6. **Human gate timeout** - Gate pending too long
|
|
336
|
-
|
|
337
|
-
**IMPORTANT**: When tasks are all marked done, the stop hook approves exit. The model MUST verify quality criteria (from `--build`, `--tests`, etc. flags stored in `auto-mode.json`) before running `/sw:done`.
|
|
338
|
-
|
|
339
|
-
## Simple Mode (--simple)
|
|
340
|
-
|
|
341
|
-
Pure stop hook loop behavior:
|
|
342
|
-
- Minimal context in re-feed prompt
|
|
343
|
-
- No session state UI
|
|
344
|
-
- No queue management
|
|
345
|
-
- Just: loop + tasks.md completion + max iterations
|
|
346
|
-
|
|
347
|
-
```bash
|
|
348
|
-
/sw:auto --simple
|
|
349
|
-
```
|
|
350
|
-
|
|
351
|
-
## Safety Features
|
|
352
|
-
|
|
353
|
-
- **Human Gates**: Sensitive operations require approval
|
|
354
|
-
- **Circuit Breakers**: External service failures handled gracefully
|
|
355
|
-
- **Turn Limit**: Hard stop after maxTurns (default: 20)
|
|
356
|
-
- **stop_hook_active**: Prevents infinite continuation loops
|
|
357
|
-
- **Sound Notifications**: Audible alerts when Claude stops working
|
|
358
|
-
|
|
359
|
-
## Sound Notifications
|
|
360
|
-
|
|
361
|
-
**Auto mode plays a satisfying sound when work completes successfully!**
|
|
362
|
-
|
|
363
|
-
### When Sound Plays
|
|
364
|
-
|
|
365
|
-
| Event | Sound | Platforms | Meaning |
|
|
366
|
-
|-------|-------|-----------|---------|
|
|
367
|
-
| **Session Complete (Success)** | Glass.aiff (macOS)<br>complete.oga (Linux)<br>Windows Notify (Windows) | All | All tasks done, tests passing - work finished! |
|
|
368
|
-
|
|
369
|
-
**Sound plays ONLY on complete success** - when all tasks are done AND all tests pass. This way you know when to check back without being interrupted during ongoing work.
|
|
370
|
-
|
|
371
|
-
### Cross-Platform Support
|
|
372
|
-
|
|
373
|
-
The sound notification works automatically on:
|
|
374
|
-
- **macOS**: Glass.aiff (satisfying chime)
|
|
375
|
-
- **Linux**: PulseAudio/ALSA/speaker-test fallbacks
|
|
376
|
-
- **Windows**: PowerShell beeps
|
|
377
|
-
|
|
378
|
-
Sounds fail gracefully on systems without audio support.
|
|
379
|
-
|
|
380
|
-
## v2.3 Per-Agent Stop Hook Behavior (NEW!)
|
|
381
|
-
|
|
382
|
-
**CRITICAL: The stop hook runs PER AGENT, not globally!**
|
|
383
|
-
|
|
384
|
-
### How It Works
|
|
385
|
-
|
|
386
|
-
```
|
|
387
|
-
Main Agent (Claude Code)
|
|
388
|
-
│
|
|
389
|
-
├── Stop hook invoked when main agent tries to exit
|
|
390
|
-
│
|
|
391
|
-
├── Spawns Subagent A (Task tool)
|
|
392
|
-
│ └── Subagent A completes → returns to main agent
|
|
393
|
-
│ (NO stop hook for subagent exit by default)
|
|
394
|
-
│
|
|
395
|
-
├── Spawns Subagent B (Task tool with stop_hooks enabled)
|
|
396
|
-
│ └── Stop hook CAN be invoked if configured
|
|
397
|
-
│
|
|
398
|
-
└── Main agent tries to exit → Stop hook invoked
|
|
399
|
-
```
|
|
400
|
-
|
|
401
|
-
### Key Implications
|
|
402
|
-
|
|
403
|
-
1. **Turn count = main agent loops**: When you see "Turn 8/20", that's 8 times the MAIN agent tried to exit, not subagent work.
|
|
404
|
-
|
|
405
|
-
2. **Subagent work is "free"**: Spawning specialized agents (QA, Security, etc.) doesn't consume turns from the main loop.
|
|
406
|
-
|
|
407
|
-
3. **Shared session state**: All agents (main + sub) share the same `auto-session.json`, so task completion is tracked globally.
|
|
408
|
-
|
|
409
|
-
4. **Completion validation at main level**: The stop hook checks task/AC completion when the MAIN agent tries to exit.
|
|
410
|
-
|
|
411
|
-
### Configuration
|
|
412
|
-
|
|
413
|
-
To enable stop hooks for subagents (advanced):
|
|
414
|
-
```typescript
|
|
415
|
-
// In Task tool call
|
|
416
|
-
{
|
|
417
|
-
"stop_hooks": true, // Enable stop hook for this subagent
|
|
418
|
-
"inherit_session": true // Share session state with parent
|
|
419
|
-
}
|
|
420
|
-
```
|
|
421
|
-
|
|
422
|
-
### Best Practices
|
|
423
|
-
|
|
424
|
-
- Let subagents do specialized work without worrying about iterations
|
|
425
|
-
- Main agent orchestrates and validates via stop hook
|
|
426
|
-
- Use `--max-turns` as a safety net, not a target
|
|
427
|
-
- Primary completion = tasks complete + ACs satisfied
|
|
428
|
-
|
|
429
|
-
## v2.1 Reliability Improvements
|
|
430
|
-
|
|
431
|
-
Auto mode includes reliability features for long-running sessions:
|
|
432
|
-
|
|
433
|
-
| Feature | Description |
|
|
434
|
-
|---------|-------------|
|
|
435
|
-
| **Context Management** | Triggers compaction at ~150k tokens, saves checkpoints |
|
|
436
|
-
| **Heartbeat/Watchdog** | Detects stale sessions (>5 min no activity) |
|
|
437
|
-
| **Failure Classification** | Transient (retry), Fixable (AI fix), External (pause) |
|
|
438
|
-
| **Checkpoints** | Task-level recovery from crashes |
|
|
439
|
-
| **Command Timeouts** | 10 min test, 5 min build (configurable) |
|
|
440
|
-
|
|
441
|
-
**Configuration** (`config.json`):
|
|
442
|
-
```json
|
|
443
|
-
{
|
|
444
|
-
"auto": {
|
|
445
|
-
"contextThreshold": 150000,
|
|
446
|
-
"timeouts": { "test": 600, "build": 300 }
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
```
|
|
450
|
-
|
|
451
|
-
**Logs**: `.specweave/logs/auto-iterations.log`
|
|
452
|
-
|
|
453
|
-
## v2.2 TDD Strict Mode & Stop Reason Tracking
|
|
454
|
-
|
|
455
|
-
### TDD Strict Mode
|
|
456
|
-
|
|
457
|
-
**Enable TDD strict mode for RED->GREEN->REFACTOR discipline:**
|
|
458
|
-
|
|
459
|
-
```bash
|
|
460
|
-
/sw:auto --tdd 0001-feature # or --strict
|
|
461
|
-
```
|
|
462
|
-
|
|
463
|
-
**TDD configuration priority** (highest to lowest):
|
|
464
|
-
1. Command flag (`--tdd`, `--strict`)
|
|
465
|
-
2. Increment `metadata.json` (`"tddMode": true`)
|
|
466
|
-
3. spec.md frontmatter (`tdd: true`)
|
|
467
|
-
4. Global `config.json` (`testing.defaultTestMode: "TDD"`)
|
|
468
|
-
|
|
469
|
-
**For full TDD workflow details, see:** `sw:tdd-orchestrator` skill
|
|
470
|
-
|
|
471
|
-
### Test Framework Auto-Detection
|
|
472
|
-
|
|
473
|
-
Auto mode discovers and runs test commands automatically:
|
|
474
|
-
|
|
475
|
-
| Framework | Detection |
|
|
476
|
-
|-----------|-----------|
|
|
477
|
-
| npm/Vitest/Jest | `package.json`, config files |
|
|
478
|
-
| Playwright/Cypress | Config files, `/e2e` dirs |
|
|
479
|
-
| Pytest/Go/Cargo | `go.mod`, `Cargo.toml`, `pytest.ini` |
|
|
480
|
-
| Xcode/Swift | `.xcodeproj`, `Package.swift` |
|
|
481
|
-
|
|
482
|
-
### Stop Reason Tracking
|
|
483
|
-
|
|
484
|
-
Stop reasons logged to `.specweave/logs/auto-stop-reasons.log`:
|
|
485
|
-
|
|
486
|
-
| Category | Success | Description |
|
|
487
|
-
|----------|---------|-------------|
|
|
488
|
-
| `all_tasks_complete` | Yes | All tests pass, all tasks done |
|
|
489
|
-
| `completion_promise` | Yes | `<!-- auto-complete:DONE -->` |
|
|
490
|
-
| `max_iterations_reached` | No | Safety limit hit |
|
|
491
|
-
| `test_failures_exhausted` | No | 3 retry attempts failed |
|
|
492
|
-
| `human_gate_pending` | Paused | Waiting for approval |
|
|
493
|
-
|
|
494
|
-
## UI/UX Quality Gates (NEW!)
|
|
495
|
-
|
|
496
|
-
Auto mode now includes comprehensive UI/UX quality gates that run automatically when E2E tests are detected.
|
|
497
|
-
|
|
498
|
-
### Accessibility Audit
|
|
499
|
-
|
|
500
|
-
When `@axe-core/playwright` or similar accessibility testing tools are detected, auto mode:
|
|
501
|
-
- Parses accessibility audit results from test output
|
|
502
|
-
- **Blocks** on critical and serious violations (WCAG Level A/AA)
|
|
503
|
-
- **Warns** on moderate and minor violations
|
|
504
|
-
- Shows detailed violation report with fix suggestions
|
|
505
|
-
|
|
506
|
-
**Violation Severity Handling:**
|
|
507
|
-
|
|
508
|
-
| Severity | Action | Example |
|
|
509
|
-
|----------|--------|---------|
|
|
510
|
-
| Critical | **BLOCKS** completion | Missing alt text, form without labels |
|
|
511
|
-
| Serious | **BLOCKS** completion | Color contrast, missing document lang |
|
|
512
|
-
| Moderate | Warning only | Landmark regions |
|
|
513
|
-
| Minor | Warning only | Empty headings |
|
|
514
|
-
|
|
515
|
-
**Enable in your tests:**
|
|
516
|
-
```typescript
|
|
517
|
-
import { injectAxe, checkA11y } from '@axe-core/playwright';
|
|
518
|
-
|
|
519
|
-
test('page is accessible', async ({ page }) => {
|
|
520
|
-
await page.goto('/');
|
|
521
|
-
await injectAxe(page);
|
|
522
|
-
await checkA11y(page);
|
|
523
|
-
});
|
|
524
|
-
```
|
|
525
|
-
|
|
526
|
-
### Console Error Detection
|
|
527
|
-
|
|
528
|
-
Auto mode parses E2E test output for console errors:
|
|
529
|
-
- **Blocks** on uncaught exceptions
|
|
530
|
-
- **Blocks** on `console.error` from application code
|
|
531
|
-
- **Excludes** expected dev tool messages (React DevTools, HMR, etc.)
|
|
532
|
-
|
|
533
|
-
**Automatic exclusions:**
|
|
534
|
-
- React/Apollo DevTools prompts
|
|
535
|
-
- HMR messages
|
|
536
|
-
- Vite dev server messages
|
|
537
|
-
- Favicon loading failures
|
|
538
|
-
|
|
539
|
-
**Add custom exclusions in config:**
|
|
540
|
-
```json
|
|
541
|
-
{
|
|
542
|
-
"auto": {
|
|
543
|
-
"consoleErrors": {
|
|
544
|
-
"excludePatterns": ["Expected test error"]
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
```
|
|
549
|
-
|
|
550
|
-
### UI State Coverage
|
|
551
|
-
|
|
552
|
-
Auto mode detects and reports on UI state test coverage:
|
|
553
|
-
|
|
554
|
-
| State | Detection | Recommendation |
|
|
555
|
-
|-------|-----------|----------------|
|
|
556
|
-
| Loading | Spinners, skeletons, `aria-busy` | Test loading/skeleton states |
|
|
557
|
-
| Error | Error boundaries, 404/500 pages | Test error handling |
|
|
558
|
-
| Empty | No data, no results | Test empty state displays |
|
|
559
|
-
|
|
560
|
-
Shows warning if states are detected but not explicitly tested.
|
|
561
|
-
|
|
562
|
-
## Increment Queue Transition (NEW!)
|
|
563
|
-
|
|
564
|
-
Auto mode now handles multi-increment queues with smooth transitions.
|
|
565
|
-
|
|
566
|
-
### Completion Summary
|
|
567
|
-
|
|
568
|
-
When an increment completes, auto mode shows:
|
|
569
|
-
```
|
|
570
|
-
INCREMENT COMPLETE: 0001-user-auth
|
|
571
|
-
|
|
572
|
-
SUMMARY:
|
|
573
|
-
Tasks: 15/15 | Duration: 45m
|
|
574
|
-
Tests: 42 passed, 0 failed
|
|
575
|
-
Status: All acceptance criteria met
|
|
576
|
-
|
|
577
|
-
NEXT INCREMENT: 0002-notifications
|
|
578
|
-
Queue: 2 increment(s) remaining
|
|
579
|
-
```
|
|
580
|
-
|
|
581
|
-
### Skip Failed Increments
|
|
582
|
-
|
|
583
|
-
If an increment fails after 3 retry attempts, you can skip it:
|
|
584
|
-
|
|
585
|
-
```bash
|
|
586
|
-
/sw:skip-increment
|
|
587
|
-
```
|
|
588
|
-
|
|
589
|
-
This will:
|
|
590
|
-
1. Mark the increment as "skipped" (not failed, not completed)
|
|
591
|
-
2. Log failure details for later review
|
|
592
|
-
3. Move to the next increment in queue
|
|
593
|
-
4. Continue auto mode execution
|
|
594
|
-
|
|
595
|
-
**Use when:**
|
|
596
|
-
- A blocking issue requires external resolution
|
|
597
|
-
- You want to prioritize other work
|
|
598
|
-
- The issue needs human investigation
|
|
599
|
-
|
|
600
|
-
## Auto-Execute with Credentials (MANDATORY)
|
|
601
|
-
|
|
602
|
-
**In auto mode, ALL agents MUST follow the auto-execute skill rules:**
|
|
603
|
-
|
|
604
|
-
### The Golden Rule
|
|
605
|
-
|
|
606
|
-
```
|
|
607
|
-
FORBIDDEN: "Next Steps: Run wrangler deploy"
|
|
608
|
-
FORBIDDEN: "Execute the schema in Supabase SQL Editor"
|
|
609
|
-
FORBIDDEN: "Set secret via: wrangler secret put..."
|
|
610
|
-
|
|
611
|
-
REQUIRED: Execute commands DIRECTLY using available credentials
|
|
612
|
-
```
|
|
613
|
-
|
|
614
|
-
### Credential Lookup Order
|
|
615
|
-
|
|
616
|
-
Before ANY deployment task, check for credentials:
|
|
617
|
-
|
|
618
|
-
1. **`.env` file** - Primary credential storage
|
|
619
|
-
2. **Environment variables** - Already loaded in session
|
|
620
|
-
3. **CLI tool auth** - `wrangler whoami`, `gh auth status`, etc.
|
|
621
|
-
4. **Config files** - `wrangler.toml`, `.specweave/config.json`
|
|
622
|
-
|
|
623
|
-
### If Credentials Found -> AUTO-EXECUTE
|
|
624
|
-
|
|
625
|
-
```bash
|
|
626
|
-
# Example: Supabase migration
|
|
627
|
-
if grep -q "DATABASE_URL" .env; then
|
|
628
|
-
source .env
|
|
629
|
-
psql "$DATABASE_URL" -f schema.sql
|
|
630
|
-
fi
|
|
631
|
-
|
|
632
|
-
# Example: Wrangler deployment
|
|
633
|
-
if wrangler whoami 2>/dev/null; then
|
|
634
|
-
wrangler deploy
|
|
635
|
-
fi
|
|
636
|
-
```
|
|
637
|
-
|
|
638
|
-
### If Credentials Missing -> ASK, Don't Show Manual Steps
|
|
639
|
-
|
|
640
|
-
```markdown
|
|
641
|
-
**Credential Required for Auto-Execution**
|
|
642
|
-
|
|
643
|
-
I need your Supabase database URL to execute the migration.
|
|
644
|
-
|
|
645
|
-
**Please paste your DATABASE_URL:**
|
|
646
|
-
[I will save to .env and continue automatically]
|
|
647
|
-
```
|
|
648
|
-
|
|
649
|
-
**After user provides credential:**
|
|
650
|
-
1. Save to `.env`
|
|
651
|
-
2. EXECUTE immediately
|
|
652
|
-
3. Continue auto mode
|
|
653
|
-
|
|
654
|
-
---
|
|
655
|
-
|
|
656
|
-
## Quality Gates
|
|
657
|
-
|
|
658
|
-
**Before running `/sw:done`, verify these gates based on success criteria in `auto-mode.json`:**
|
|
659
|
-
|
|
660
|
-
1. All tasks marked `[x]` in tasks.md
|
|
661
|
-
2. All ACs marked `[x]` in spec.md
|
|
662
|
-
3. If `--build` flag: build passes
|
|
663
|
-
4. If `--tests` flag: tests pass
|
|
664
|
-
5. If `--e2e` flag: E2E tests pass
|
|
665
|
-
6. If `--lint` flag: linting passes
|
|
666
|
-
7. If `--types` flag: type-checking passes
|
|
667
|
-
8. If `--cov N` flag: coverage meets threshold
|
|
668
|
-
|
|
669
|
-
The stop hook validates gates 1-2 via grep. Gates 3-8 are the model's responsibility.
|
|
670
|
-
|
|
671
|
-
---
|
|
53
|
+
Stop hook gates exit when tasks/ACs remain. Model enforces quality gates (build/tests/lint) before `/sw:done`.
|
|
672
54
|
|
|
673
55
|
## Execution
|
|
674
56
|
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
When this command is invoked:
|
|
57
|
+
### Step 1: Set Up Auto Session
|
|
678
58
|
|
|
679
|
-
|
|
59
|
+
Use Read/Write/Edit/Glob tools directly (no CLI needed):
|
|
680
60
|
|
|
681
|
-
**
|
|
61
|
+
**1a. Read config** — `.specweave/config.json`: `auto.enabled`, `auto.maxTurns` (default 20), `testing.defaultTestMode`, `testing.tddEnforcement`
|
|
682
62
|
|
|
683
|
-
|
|
63
|
+
**1b. Find increments:**
|
|
64
|
+
- If IDs specified: Glob `.specweave/increments/{ID}*/metadata.json`, verify exists
|
|
65
|
+
- If no IDs: find active/in-progress increments. If none, check backlog/planned. If none at all, go to Step 2 (Intelligent Creation).
|
|
684
66
|
|
|
685
|
-
|
|
686
|
-
Read .specweave/config.json to extract:
|
|
687
|
-
- auto.enabled (default: true) — if false, STOP
|
|
688
|
-
- auto.maxTurns (default: 20)
|
|
689
|
-
- testing.defaultTestMode — check for "TDD"
|
|
690
|
-
- testing.tddEnforcement — "strict" | "warn" | "off"
|
|
691
|
-
- auto.requireTests (default: false)
|
|
692
|
-
```
|
|
693
|
-
|
|
694
|
-
#### Step 1b: Find Increments
|
|
695
|
-
|
|
696
|
-
**If INCREMENT_IDS specified by user:**
|
|
697
|
-
- For each ID, Glob `.specweave/increments/{ID}*/metadata.json`
|
|
698
|
-
- Read each metadata.json, verify it exists
|
|
699
|
-
- If not found, warn user and STOP
|
|
700
|
-
|
|
701
|
-
**If no IDs specified:**
|
|
702
|
-
- Glob `.specweave/increments/*/metadata.json`
|
|
703
|
-
- Read each, find ones with status "active" or "in-progress"
|
|
704
|
-
- If none active, check for "backlog" or "planned"
|
|
705
|
-
- If none at all → proceed to Step 2 (Intelligent Increment Creation)
|
|
67
|
+
**1c. Activate increments** — Edit `metadata.json`: set `"status": "active"`, update timestamp
|
|
706
68
|
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
For each increment that needs activation:
|
|
710
|
-
- Edit its `metadata.json`: set `"status": "active"` and `"updated"` to current ISO timestamp
|
|
711
|
-
|
|
712
|
-
#### Step 1d: Create Session Marker
|
|
713
|
-
|
|
714
|
-
**Write `.specweave/state/auto-mode.json` using the Write tool** with this schema:
|
|
69
|
+
**1d. Write session marker** — `.specweave/state/auto-mode.json`:
|
|
715
70
|
|
|
716
71
|
```json
|
|
717
72
|
{
|
|
718
73
|
"active": true,
|
|
719
|
-
"timestamp": "
|
|
720
|
-
"incrementIds": ["0001-feature
|
|
74
|
+
"timestamp": "<ISO>",
|
|
75
|
+
"incrementIds": ["0001-feature"],
|
|
721
76
|
"tddMode": false,
|
|
722
77
|
"requireTests": false,
|
|
723
|
-
"userGoal": "optional
|
|
78
|
+
"userGoal": "optional",
|
|
724
79
|
"successCriteria": [
|
|
725
|
-
{ "type": "tasks_complete", "description": "All tasks marked complete
|
|
726
|
-
{ "type": "acs_satisfied", "description": "All
|
|
80
|
+
{ "type": "tasks_complete", "description": "All tasks marked complete", "required": true },
|
|
81
|
+
{ "type": "acs_satisfied", "description": "All ACs satisfied", "required": true }
|
|
727
82
|
],
|
|
728
83
|
"successSummary": "All tasks and acceptance criteria complete"
|
|
729
84
|
}
|
|
730
85
|
```
|
|
731
86
|
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
| `--cov N` | `{ "type": "tests_pass", "description": "Coverage must meet N%", "required": true, "threshold": N }` |
|
|
742
|
-
| `--cmd "X"` | `{ "type": "custom_command", "description": "Custom: X", "required": true, "command": "X" }` |
|
|
743
|
-
| `--tdd` | Set `"tddMode": true` in marker |
|
|
744
|
-
|
|
745
|
-
**Always include `tasks_complete` and `acs_satisfied` as base criteria.**
|
|
746
|
-
|
|
747
|
-
Ensure `.specweave/state/` directory exists (create with Bash `mkdir -p` if needed).
|
|
748
|
-
|
|
749
|
-
**Proceed to Step 1.5**
|
|
750
|
-
|
|
751
|
-
### Step 1.5: MANDATORY - Analyze Tests & Display Stop Conditions
|
|
752
|
-
|
|
753
|
-
**CRITICAL: You MUST analyze the test situation and output SPECIFIC stop conditions BEFORE starting any task work!**
|
|
754
|
-
|
|
755
|
-
#### Step 1.5a: Detect Existing Tests
|
|
756
|
-
|
|
757
|
-
Run these commands to detect what tests exist:
|
|
758
|
-
|
|
759
|
-
```bash
|
|
760
|
-
# Check for test frameworks
|
|
761
|
-
ls package.json 2>/dev/null && cat package.json | grep -E '"(jest|vitest|mocha|playwright|cypress)"' || true
|
|
762
|
-
ls vitest.config.* jest.config.* playwright.config.* cypress.config.* 2>/dev/null || true
|
|
763
|
-
|
|
764
|
-
# Count existing test files
|
|
765
|
-
find . -name "*.test.ts" -o -name "*.test.tsx" -o -name "*.spec.ts" -o -name "*.test.js" 2>/dev/null | wc -l
|
|
766
|
-
find . -name "*.e2e.ts" -o -name "*.e2e-spec.ts" -path "*/e2e/*" -name "*.spec.ts" 2>/dev/null | wc -l
|
|
767
|
-
|
|
768
|
-
# Check if tests can run
|
|
769
|
-
npm test --help 2>/dev/null | head -1 || true
|
|
770
|
-
```
|
|
771
|
-
|
|
772
|
-
#### Step 1.5b: Determine Test Strategy
|
|
773
|
-
|
|
774
|
-
Based on what you find, determine:
|
|
775
|
-
|
|
776
|
-
**IF tests exist:**
|
|
777
|
-
- List the EXACT test commands that will be run
|
|
778
|
-
- List the SPECIFIC test files that will validate this work
|
|
87
|
+
Map flags to extra `successCriteria` entries:
|
|
88
|
+
- `--tests` -> `{ "type": "tests_pass", "required": true }`
|
|
89
|
+
- `--build` -> `{ "type": "build_succeeds", "required": true }`
|
|
90
|
+
- `--e2e` -> `{ "type": "tests_pass", "description": "E2E tests", "required": true }`
|
|
91
|
+
- `--lint` -> `{ "type": "custom_command", "command": "<lint-cmd>", "required": true }`
|
|
92
|
+
- `--types` -> `{ "type": "custom_command", "command": "npx tsc --noEmit", "required": true }`
|
|
93
|
+
- `--cov N` -> `{ "type": "tests_pass", "threshold": N, "required": true }`
|
|
94
|
+
- `--cmd "X"` -> `{ "type": "custom_command", "command": "X", "required": true }`
|
|
95
|
+
- `--tdd` -> set `"tddMode": true`
|
|
779
96
|
|
|
780
|
-
|
|
781
|
-
- You MUST plan what tests need to be created as part of the tasks
|
|
782
|
-
- List the specific test files you will CREATE during auto mode
|
|
783
|
-
- These tests become part of the stop criteria
|
|
97
|
+
Always include `tasks_complete` and `acs_satisfied` as base criteria. Ensure `.specweave/state/` dir exists.
|
|
784
98
|
|
|
785
|
-
|
|
99
|
+
### Step 1.5: MANDATORY - Display Stop Conditions
|
|
786
100
|
|
|
787
|
-
**
|
|
101
|
+
**You MUST output a stop conditions banner BEFORE starting work.** Detect test frameworks, count test files, then show:
|
|
788
102
|
|
|
789
103
|
```
|
|
790
104
|
AUTO MODE STARTING
|
|
791
|
-
|
|
792
|
-
Increment: [
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
- [NEW] [test-file-3.test.ts] - [will be created for X]
|
|
803
|
-
|
|
804
|
-
E2E Tests (if applicable):
|
|
805
|
-
Command: [EXACT_E2E_COMMAND]
|
|
806
|
-
Files:
|
|
807
|
-
- [auth.e2e.ts] - [login/logout flows]
|
|
808
|
-
- [NEW] [checkout.e2e.ts] - [will be created for payment flow]
|
|
809
|
-
|
|
810
|
-
══════════════════════════════════════════════════════════════════════════════
|
|
811
|
-
SESSION WILL COMPLETE WHEN:
|
|
812
|
-
- All [X] tasks marked complete
|
|
813
|
-
- [TEST_COMMAND] passes (0 failures)
|
|
814
|
-
- [E2E_COMMAND] passes (if E2E tests exist)
|
|
815
|
-
- /sw:done validation passes
|
|
816
|
-
|
|
817
|
-
SESSION WILL PAUSE/STOP IF:
|
|
818
|
-
- Tests fail 3 times in a row → pauses for human review
|
|
819
|
-
- User runs /sw:cancel-auto
|
|
820
|
-
- Max iterations reached (safety limit)
|
|
821
|
-
══════════════════════════════════════════════════════════════════════════════
|
|
822
|
-
Check progress: /sw:auto-status
|
|
823
|
-
Cancel: close session or /sw:cancel-auto
|
|
824
|
-
══════════════════════════════════════════════════════════════════════════════
|
|
825
|
-
```
|
|
826
|
-
|
|
827
|
-
#### Step 1.5d: Fill in ALL placeholders with REAL values
|
|
828
|
-
|
|
829
|
-
**Required placeholders:**
|
|
830
|
-
- `[INCREMENT_ID]`: Actual increment ID (e.g., `0001-user-auth`)
|
|
831
|
-
- `[X]`: Number of pending tasks from tasks.md
|
|
832
|
-
- `[EXACT_TEST_COMMAND]`: Real command like `npm test` or `npx vitest run`
|
|
833
|
-
- `[EXACT_E2E_COMMAND]`: Real command like `npx playwright test`
|
|
834
|
-
- `[test-file-*.ts]`: Real test file names with brief description
|
|
835
|
-
- `[NEW]`: Mark any test files that will be CREATED during auto mode
|
|
836
|
-
|
|
837
|
-
**Examples of GOOD vs BAD:**
|
|
838
|
-
|
|
839
|
-
BAD (vague):
|
|
840
|
-
```
|
|
841
|
-
Tests: All tests passing (unit + E2E if present)
|
|
105
|
+
======================================================================
|
|
106
|
+
Increment: [ID] | Tasks: [N] pending
|
|
107
|
+
======================================================================
|
|
108
|
+
TESTS THAT MUST PASS:
|
|
109
|
+
Unit: [command] - [N] test files ([list key ones])
|
|
110
|
+
E2E: [command] - [N] test files (if applicable)
|
|
111
|
+
[NEW] files to be created during auto mode
|
|
112
|
+
======================================================================
|
|
113
|
+
COMPLETES WHEN: All tasks done + tests pass + /sw:done passes
|
|
114
|
+
STOPS IF: 3 consecutive test failures | /sw:cancel-auto | max turns
|
|
115
|
+
======================================================================
|
|
842
116
|
```
|
|
843
117
|
|
|
844
|
-
|
|
845
|
-
```
|
|
846
|
-
Unit Tests:
|
|
847
|
-
Command: npm test
|
|
848
|
-
Files:
|
|
849
|
-
- src/auth/auth.service.test.ts - JWT token generation
|
|
850
|
-
- src/auth/login.test.ts - login validation
|
|
851
|
-
- [NEW] src/auth/logout.test.ts - will create for logout flow
|
|
118
|
+
Fill ALL placeholders with real values. Be specific about test files and commands.
|
|
852
119
|
|
|
853
|
-
|
|
854
|
-
Command: npx playwright test
|
|
855
|
-
Files:
|
|
856
|
-
- tests/auth.e2e.ts - full login/logout user journey
|
|
857
|
-
```
|
|
120
|
+
### Step 1.6: TDD Enforcement (if TDD mode enabled)
|
|
858
121
|
|
|
859
|
-
|
|
122
|
+
Check TDD priority: `--tdd` flag > increment `metadata.json` > `config.json`
|
|
860
123
|
|
|
861
|
-
|
|
124
|
+
If TDD enabled, validate tasks.md has `[RED]`/`[GREEN]`/`[REFACTOR]` markers. If no markers found:
|
|
125
|
+
- `strict`: BLOCK — cannot proceed, fix tasks first
|
|
126
|
+
- `warn`: show warning, continue without enforcement
|
|
127
|
+
- `off`: skip silently
|
|
862
128
|
|
|
863
|
-
|
|
129
|
+
Enforcement rules: `[RED]` tasks complete freely. `[GREEN]` requires its `[RED]` done first. `[REFACTOR]` requires its `[GREEN]` done first.
|
|
864
130
|
|
|
865
|
-
|
|
131
|
+
### Step 2: Intelligent Increment Creation (when none found)
|
|
866
132
|
|
|
867
|
-
|
|
133
|
+
Analyze context and decide:
|
|
134
|
+
- **Match existing**: find planned/backlog increment matching user intent, activate it
|
|
135
|
+
- **Extend existing**: add tasks to active incomplete increment
|
|
136
|
+
- **Create new**: invoke `/sw:increment "description"` then set up session
|
|
137
|
+
- **Multiple**: activate all matching, include in session marker
|
|
138
|
+
- **Ambiguous**: ask user to choose
|
|
868
139
|
|
|
869
|
-
|
|
870
|
-
INCREMENT_PATH=".specweave/increments/<id>"
|
|
871
|
-
TASKS_FILE="$INCREMENT_PATH/tasks.md"
|
|
140
|
+
Then return to Step 1c-1d to set up the session, then Step 1.5 for the banner.
|
|
872
141
|
|
|
873
|
-
|
|
874
|
-
RED_COUNT=$(grep -c '\[RED\]' "$TASKS_FILE" 2>/dev/null || echo "0")
|
|
875
|
-
GREEN_COUNT=$(grep -c '\[GREEN\]' "$TASKS_FILE" 2>/dev/null || echo "0")
|
|
876
|
-
REFACTOR_COUNT=$(grep -c '\[REFACTOR\]' "$TASKS_FILE" 2>/dev/null || echo "0")
|
|
877
|
-
TOTAL_MARKERS=$((RED_COUNT + GREEN_COUNT + REFACTOR_COUNT))
|
|
878
|
-
|
|
879
|
-
echo "TDD Marker Check: RED=$RED_COUNT, GREEN=$GREEN_COUNT, REFACTOR=$REFACTOR_COUNT"
|
|
880
|
-
```
|
|
142
|
+
### Step 3: Execute Tasks
|
|
881
143
|
|
|
882
|
-
|
|
144
|
+
1. Run `/sw:do` in a loop (stop hook handles continuation)
|
|
145
|
+
2. Mark tasks complete in tasks.md, update spec.md ACs
|
|
146
|
+
3. Run tests after each task
|
|
147
|
+
4. Before `/sw:done`: verify all quality gates from `successCriteria`
|
|
148
|
+
5. On completion output `<!-- auto-complete:DONE -->`
|
|
883
149
|
|
|
884
|
-
|
|
885
|
-
TDD MODE ENABLED BUT NO TDD MARKERS IN TASKS
|
|
886
|
-
|
|
887
|
-
Your configuration has TDD mode enabled:
|
|
888
|
-
- --tdd flag: [yes/no]
|
|
889
|
-
- config.json: testing.defaultTestMode = "TDD"
|
|
890
|
-
- Enforcement level: [strict/warn/off]
|
|
891
|
-
|
|
892
|
-
But tasks.md contains NO [RED], [GREEN], [REFACTOR] markers:
|
|
893
|
-
- [RED] markers found: 0
|
|
894
|
-
- [GREEN] markers found: 0
|
|
895
|
-
- [REFACTOR] markers found: 0
|
|
896
|
-
|
|
897
|
-
TDD ORDER ENFORCEMENT WILL BE BYPASSED!
|
|
898
|
-
|
|
899
|
-
The enforcement checks for task markers to validate RED->GREEN->REFACTOR order.
|
|
900
|
-
Without markers, tasks can be completed in ANY order - defeating TDD discipline.
|
|
901
|
-
|
|
902
|
-
CAUSE: Tasks were likely created:
|
|
903
|
-
- Manually (without using /sw:increment)
|
|
904
|
-
- Before TDD mode was enabled in config
|
|
905
|
-
- By copying from a non-TDD template
|
|
906
|
-
|
|
907
|
-
FIX OPTIONS:
|
|
908
|
-
|
|
909
|
-
1. (Recommended) Regenerate tasks with TDD structure:
|
|
910
|
-
/sw:increment "your-feature"
|
|
911
|
-
This will create proper RED->GREEN->REFACTOR triplets
|
|
912
|
-
|
|
913
|
-
2. Add markers manually to existing tasks:
|
|
914
|
-
### T-001: [RED] Write failing test for feature
|
|
915
|
-
### T-002: [GREEN] Implement feature to pass test
|
|
916
|
-
### T-003: [REFACTOR] Clean up feature code
|
|
917
|
-
|
|
918
|
-
3. Disable TDD mode if not needed:
|
|
919
|
-
Set testing.defaultTestMode: "test-after" in config.json
|
|
920
|
-
|
|
921
|
-
4. Continue without TDD enforcement (not recommended):
|
|
922
|
-
Set testing.tddEnforcement: "off" in config.json
|
|
923
|
-
```
|
|
924
|
-
|
|
925
|
-
**Behavior based on tddEnforcement:**
|
|
926
|
-
|
|
927
|
-
| Enforcement | TDD Enabled + No Markers | Action |
|
|
928
|
-
|-------------|--------------------------|--------|
|
|
929
|
-
| `strict` | **BLOCKS** | Cannot proceed - fix tasks.md first |
|
|
930
|
-
| `warn` | **WARNS** | Shows warning, continues without enforcement |
|
|
931
|
-
| `off` | **Silent** | Skips all TDD checks |
|
|
932
|
-
|
|
933
|
-
**Example (strict mode, no markers):**
|
|
934
|
-
```
|
|
935
|
-
TDD MARKER VALIDATION FAILED (strict mode)
|
|
936
|
-
|
|
937
|
-
Cannot start auto mode with TDD enabled but no task markers.
|
|
938
|
-
Run /sw:increment to regenerate tasks with TDD structure.
|
|
939
|
-
|
|
940
|
-
Or set tddEnforcement: "warn" to continue anyway.
|
|
941
|
-
```
|
|
150
|
+
## Credential Auto-Execution
|
|
942
151
|
|
|
943
|
-
|
|
152
|
+
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.
|
|
944
153
|
|
|
945
|
-
|
|
946
|
-
# Check TDD mode from multiple sources (priority order)
|
|
947
|
-
TDD_MODE=false
|
|
948
|
-
TDD_ENFORCEMENT="warn" # Default
|
|
949
|
-
|
|
950
|
-
# 1. Check command-line flag (highest priority)
|
|
951
|
-
if [[ "$*" == *"--tdd"* ]] || [[ "$*" == *"--strict"* ]]; then
|
|
952
|
-
TDD_MODE=true
|
|
953
|
-
TDD_ENFORCEMENT="strict"
|
|
954
|
-
fi
|
|
955
|
-
|
|
956
|
-
# 2. Check increment metadata
|
|
957
|
-
if [[ -f "$INCREMENT_PATH/metadata.json" ]]; then
|
|
958
|
-
INC_TDD=$(jq -r '.tddMode // .testMode' "$INCREMENT_PATH/metadata.json" 2>/dev/null)
|
|
959
|
-
[[ "$INC_TDD" == "true" || "$INC_TDD" == "TDD" || "$INC_TDD" == "tdd" ]] && TDD_MODE=true
|
|
960
|
-
fi
|
|
961
|
-
|
|
962
|
-
# 3. Check global config
|
|
963
|
-
if [[ -f ".specweave/config.json" ]]; then
|
|
964
|
-
GLOBAL_TDD=$(jq -r '.testing.defaultTestMode' ".specweave/config.json" 2>/dev/null)
|
|
965
|
-
[[ "$GLOBAL_TDD" == "TDD" || "$GLOBAL_TDD" == "tdd" ]] && TDD_MODE=true
|
|
966
|
-
# Check enforcement level
|
|
967
|
-
TDD_ENFORCEMENT=$(jq -r '.testing.tddEnforcement // "warn"' ".specweave/config.json" 2>/dev/null)
|
|
968
|
-
fi
|
|
969
|
-
```
|
|
970
|
-
|
|
971
|
-
**If TDD_MODE == true, add TDD enforcement to stop conditions banner:**
|
|
972
|
-
|
|
973
|
-
```
|
|
974
|
-
TDD MODE ACTIVE - RED->GREEN->REFACTOR ENFORCEMENT
|
|
975
|
-
|
|
976
|
-
TDD Task Order Enforcement:
|
|
977
|
-
Enforcement Level: [strict|warn|off]
|
|
978
|
-
|
|
979
|
-
[RED] tasks can be completed freely
|
|
980
|
-
[GREEN] tasks REQUIRE their [RED] counterpart completed first
|
|
981
|
-
[REFACTOR] tasks REQUIRE their [GREEN] counterpart completed first
|
|
982
|
-
|
|
983
|
-
strict mode: BLOCKS completion of out-of-order tasks
|
|
984
|
-
warn mode: Shows warning but allows (not recommended)
|
|
985
|
-
```
|
|
986
|
-
|
|
987
|
-
**TDD Enforcement during task execution:**
|
|
988
|
-
|
|
989
|
-
```typescript
|
|
990
|
-
// Before marking ANY [GREEN] or [REFACTOR] task complete:
|
|
991
|
-
function enforceTDDOrder(task: Task, allTasks: Task[], enforcement: string): void {
|
|
992
|
-
const phase = extractPhase(task.title); // [RED], [GREEN], [REFACTOR]
|
|
993
|
-
if (!phase || phase === 'RED') return; // RED can always proceed
|
|
994
|
-
|
|
995
|
-
const tripletBase = Math.floor((task.number - 1) / 3) * 3 + 1;
|
|
996
|
-
|
|
997
|
-
if (phase === 'GREEN') {
|
|
998
|
-
const redTask = allTasks.find(t => t.number === tripletBase && t.title.includes('[RED]'));
|
|
999
|
-
if (redTask && redTask.status !== 'completed') {
|
|
1000
|
-
const msg = `TDD VIOLATION: Cannot complete ${task.id} [GREEN] before ${redTask.id} [RED]`;
|
|
1001
|
-
if (enforcement === 'strict') {
|
|
1002
|
-
throw new Error(msg); // BLOCKS completion
|
|
1003
|
-
} else {
|
|
1004
|
-
console.warn(`${msg}`); // Warns but allows
|
|
1005
|
-
}
|
|
1006
|
-
}
|
|
1007
|
-
}
|
|
1008
|
-
|
|
1009
|
-
if (phase === 'REFACTOR') {
|
|
1010
|
-
const greenTask = allTasks.find(t => t.number === tripletBase + 1 && t.title.includes('[GREEN]'));
|
|
1011
|
-
if (greenTask && greenTask.status !== 'completed') {
|
|
1012
|
-
const msg = `TDD VIOLATION: Cannot complete ${task.id} [REFACTOR] before ${greenTask.id} [GREEN]`;
|
|
1013
|
-
if (enforcement === 'strict') {
|
|
1014
|
-
throw new Error(msg); // BLOCKS completion
|
|
1015
|
-
} else {
|
|
1016
|
-
console.warn(`${msg}`); // Warns but allows
|
|
1017
|
-
}
|
|
1018
|
-
}
|
|
1019
|
-
}
|
|
1020
|
-
}
|
|
1021
|
-
```
|
|
1022
|
-
|
|
1023
|
-
**Best practice for TDD in auto mode:**
|
|
1024
|
-
1. Enable `--tdd` flag for strict enforcement: `/sw:auto --tdd 0001`
|
|
1025
|
-
2. Or set globally: `testing.defaultTestMode: "TDD"` + `testing.tddEnforcement: "strict"`
|
|
1026
|
-
3. Tasks should be grouped in triplets: T-001 [RED], T-002 [GREEN], T-003 [REFACTOR]
|
|
1027
|
-
|
|
1028
|
-
### Step 2: INTELLIGENT INCREMENT CREATION (when no increments found)
|
|
1029
|
-
|
|
1030
|
-
**When no active or matching increments were found in Step 1b:**
|
|
1031
|
-
|
|
1032
|
-
1. **Analyze context** (ULTRATHINK):
|
|
1033
|
-
- Read recent conversation history
|
|
1034
|
-
- Check user prompt for feature descriptions
|
|
1035
|
-
- Scan `.specweave/increments/` for planned/backlog items
|
|
1036
|
-
- Look for patterns: "build X", "implement Y", "add Z feature"
|
|
1037
|
-
|
|
1038
|
-
3. **Make intelligent decision:**
|
|
1039
|
-
|
|
1040
|
-
**A. Match existing increment:**
|
|
1041
|
-
```
|
|
1042
|
-
# User said: "work on the login feature"
|
|
1043
|
-
# Found: .specweave/increments/0002-user-login-system (status: planned)
|
|
1044
|
-
# Action: Activate it via Edit metadata.json, then set up session (Step 1c-1d)
|
|
1045
|
-
```
|
|
1046
|
-
|
|
1047
|
-
**B. Extend existing increment:**
|
|
1048
|
-
```
|
|
1049
|
-
# User said: "add password reset to auth"
|
|
1050
|
-
# Found: .specweave/increments/0001-authentication (status: active, incomplete)
|
|
1051
|
-
# Action: Add tasks to existing tasks.md, include in session marker
|
|
1052
|
-
```
|
|
1053
|
-
|
|
1054
|
-
**C. Create new increment(s):**
|
|
1055
|
-
```
|
|
1056
|
-
# User said: "build a payment integration with Stripe"
|
|
1057
|
-
# No matching increments found
|
|
1058
|
-
# Action: Create new increment via /sw:increment, then set up session (Step 1c-1d)
|
|
1059
|
-
/sw:increment "Payment integration with Stripe"
|
|
1060
|
-
```
|
|
1061
|
-
|
|
1062
|
-
**D. Multiple increments:**
|
|
1063
|
-
```
|
|
1064
|
-
# User said: "finish all pending features"
|
|
1065
|
-
# Found: multiple backlog/planned increments
|
|
1066
|
-
# Action: Activate all via Edit metadata.json, include all in session marker
|
|
1067
|
-
```
|
|
1068
|
-
|
|
1069
|
-
**E. Ask user (if ambiguous):**
|
|
1070
|
-
```markdown
|
|
1071
|
-
I found several potential matches for your request:
|
|
1072
|
-
|
|
1073
|
-
1. **0002-user-authentication** (planned) - Add auth system
|
|
1074
|
-
2. **0005-oauth-integration** (backlog) - Third-party auth
|
|
1075
|
-
|
|
1076
|
-
Which would you like to work on?
|
|
1077
|
-
- Both (in sequence)
|
|
1078
|
-
- Just authentication
|
|
1079
|
-
- Just OAuth
|
|
1080
|
-
- Something else (please describe)
|
|
1081
|
-
```
|
|
1082
|
-
|
|
1083
|
-
4. **Set up session** — Go back to Step 1c-1d to activate and create the marker.
|
|
1084
|
-
|
|
1085
|
-
5. **Proceed to Step 1.5** - Display the stop conditions banner!
|
|
1086
|
-
|
|
1087
|
-
### Step 3: Start Task Execution
|
|
1088
|
-
|
|
1089
|
-
**After displaying the stop conditions banner (Step 1.5), begin work:**
|
|
1090
|
-
|
|
1091
|
-
1. **Execute /sw:do in a loop** (stop hook handles continuation):
|
|
1092
|
-
- Work on tasks
|
|
1093
|
-
- Mark complete in tasks.md
|
|
1094
|
-
- Update spec.md ACs
|
|
1095
|
-
- Sync to external tools
|
|
1096
|
-
- Run tests after each task
|
|
1097
|
-
|
|
1098
|
-
2. **On completion**:
|
|
1099
|
-
```
|
|
1100
|
-
Auto Session Complete!
|
|
1101
|
-
<!-- auto-complete:DONE -->
|
|
154
|
+
## Session Management
|
|
1102
155
|
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
Coverage: 87%
|
|
1108
|
-
```
|
|
156
|
+
- **Status**: `/sw:auto-status`
|
|
157
|
+
- **Cancel**: `/sw:cancel-auto`
|
|
158
|
+
- **Resume after crash**: `/sw:do` or `claude --continue`
|
|
159
|
+
- **Multi-agent**: use `/sw:team-lead` instead
|
|
1109
160
|
|
|
1110
|
-
##
|
|
161
|
+
## Safety
|
|
1111
162
|
|
|
1112
|
-
|
|
163
|
+
| Mechanism | Default |
|
|
164
|
+
|-----------|---------|
|
|
165
|
+
| Turn limit | 20 |
|
|
166
|
+
| Staleness cleanup | 2h |
|
|
167
|
+
| Human gates | `deploy`, `migrate`, `publish` patterns |
|
|
1113
168
|
|
|
1114
169
|
## Related Commands
|
|
1115
170
|
|
|
@@ -1117,7 +172,6 @@ For coordinated multi-agent execution across different workstreams (frontend, ba
|
|
|
1117
172
|
|---------|---------|
|
|
1118
173
|
| `/sw:auto-status` | Check session status |
|
|
1119
174
|
| `/sw:cancel-auto` | Cancel session |
|
|
1120
|
-
| `/sw:
|
|
1121
|
-
| `/sw:
|
|
1122
|
-
| `/sw:progress` | Show increment progress |
|
|
175
|
+
| `/sw:do` | Execute tasks (standalone) |
|
|
176
|
+
| `/sw:progress` | Show progress |
|
|
1123
177
|
| `/sw:team-lead` | Multi-agent orchestration |
|