specweave 1.0.235 → 1.0.239

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.
Files changed (196) hide show
  1. package/README.md +89 -193
  2. package/dist/plugins/specweave-github/lib/github-ac-comment-poster.d.ts +37 -0
  3. package/dist/plugins/specweave-github/lib/github-ac-comment-poster.d.ts.map +1 -0
  4. package/dist/plugins/specweave-github/lib/github-ac-comment-poster.js +176 -0
  5. package/dist/plugins/specweave-github/lib/github-ac-comment-poster.js.map +1 -0
  6. package/dist/plugins/specweave-github/lib/github-batch-sync.d.ts +36 -0
  7. package/dist/plugins/specweave-github/lib/github-batch-sync.d.ts.map +1 -0
  8. package/dist/plugins/specweave-github/lib/github-batch-sync.js +115 -0
  9. package/dist/plugins/specweave-github/lib/github-batch-sync.js.map +1 -0
  10. package/dist/plugins/specweave-github/lib/github-board-resolver-v2.d.ts +37 -0
  11. package/dist/plugins/specweave-github/lib/github-board-resolver-v2.d.ts.map +1 -0
  12. package/dist/plugins/specweave-github/lib/github-board-resolver-v2.js +56 -0
  13. package/dist/plugins/specweave-github/lib/github-board-resolver-v2.js.map +1 -0
  14. package/dist/plugins/specweave-github/lib/github-conflict-resolver.d.ts +68 -0
  15. package/dist/plugins/specweave-github/lib/github-conflict-resolver.d.ts.map +1 -0
  16. package/dist/plugins/specweave-github/lib/github-conflict-resolver.js +102 -0
  17. package/dist/plugins/specweave-github/lib/github-conflict-resolver.js.map +1 -0
  18. package/dist/plugins/specweave-github/lib/github-cross-repo-sync.d.ts +64 -0
  19. package/dist/plugins/specweave-github/lib/github-cross-repo-sync.d.ts.map +1 -0
  20. package/dist/plugins/specweave-github/lib/github-cross-repo-sync.js +162 -0
  21. package/dist/plugins/specweave-github/lib/github-cross-repo-sync.js.map +1 -0
  22. package/dist/plugins/specweave-github/lib/github-field-sync.d.ts +50 -0
  23. package/dist/plugins/specweave-github/lib/github-field-sync.d.ts.map +1 -0
  24. package/dist/plugins/specweave-github/lib/github-field-sync.js +107 -0
  25. package/dist/plugins/specweave-github/lib/github-field-sync.js.map +1 -0
  26. package/dist/plugins/specweave-github/lib/github-graphql-client.d.ts +53 -0
  27. package/dist/plugins/specweave-github/lib/github-graphql-client.d.ts.map +1 -0
  28. package/dist/plugins/specweave-github/lib/github-graphql-client.js +138 -0
  29. package/dist/plugins/specweave-github/lib/github-graphql-client.js.map +1 -0
  30. package/dist/plugins/specweave-github/lib/github-issue-body-generator.d.ts +40 -0
  31. package/dist/plugins/specweave-github/lib/github-issue-body-generator.d.ts.map +1 -0
  32. package/dist/plugins/specweave-github/lib/github-issue-body-generator.js +50 -0
  33. package/dist/plugins/specweave-github/lib/github-issue-body-generator.js.map +1 -0
  34. package/dist/plugins/specweave-github/lib/github-issue-body-parser.d.ts +30 -0
  35. package/dist/plugins/specweave-github/lib/github-issue-body-parser.d.ts.map +1 -0
  36. package/dist/plugins/specweave-github/lib/github-issue-body-parser.js +75 -0
  37. package/dist/plugins/specweave-github/lib/github-issue-body-parser.js.map +1 -0
  38. package/dist/plugins/specweave-github/lib/github-pull-sync.d.ts +94 -0
  39. package/dist/plugins/specweave-github/lib/github-pull-sync.d.ts.map +1 -0
  40. package/dist/plugins/specweave-github/lib/github-pull-sync.js +232 -0
  41. package/dist/plugins/specweave-github/lib/github-pull-sync.js.map +1 -0
  42. package/dist/plugins/specweave-github/lib/github-push-sync.d.ts +50 -0
  43. package/dist/plugins/specweave-github/lib/github-push-sync.d.ts.map +1 -0
  44. package/dist/plugins/specweave-github/lib/github-push-sync.js +114 -0
  45. package/dist/plugins/specweave-github/lib/github-push-sync.js.map +1 -0
  46. package/dist/plugins/specweave-github/lib/github-rate-limiter.d.ts +53 -0
  47. package/dist/plugins/specweave-github/lib/github-rate-limiter.d.ts.map +1 -0
  48. package/dist/plugins/specweave-github/lib/github-rate-limiter.js +109 -0
  49. package/dist/plugins/specweave-github/lib/github-rate-limiter.js.map +1 -0
  50. package/dist/plugins/specweave-github/lib/github-spec-frontmatter-updater.d.ts +21 -0
  51. package/dist/plugins/specweave-github/lib/github-spec-frontmatter-updater.d.ts.map +1 -0
  52. package/dist/plugins/specweave-github/lib/github-spec-frontmatter-updater.js +161 -0
  53. package/dist/plugins/specweave-github/lib/github-spec-frontmatter-updater.js.map +1 -0
  54. package/dist/plugins/specweave-github/lib/github-sync-orchestrator.d.ts +46 -0
  55. package/dist/plugins/specweave-github/lib/github-sync-orchestrator.d.ts.map +1 -0
  56. package/dist/plugins/specweave-github/lib/github-sync-orchestrator.js +99 -0
  57. package/dist/plugins/specweave-github/lib/github-sync-orchestrator.js.map +1 -0
  58. package/dist/plugins/specweave-github/lib/github-us-auto-closer.d.ts +43 -0
  59. package/dist/plugins/specweave-github/lib/github-us-auto-closer.d.ts.map +1 -0
  60. package/dist/plugins/specweave-github/lib/github-us-auto-closer.js +153 -0
  61. package/dist/plugins/specweave-github/lib/github-us-auto-closer.js.map +1 -0
  62. package/dist/plugins/specweave-github/lib/index.d.ts +1 -4
  63. package/dist/plugins/specweave-github/lib/index.d.ts.map +1 -1
  64. package/dist/plugins/specweave-github/lib/index.js +1 -4
  65. package/dist/plugins/specweave-github/lib/index.js.map +1 -1
  66. package/dist/plugins/specweave-testing/lib/playwright-ci-defaults.d.ts +7 -0
  67. package/dist/plugins/specweave-testing/lib/playwright-ci-defaults.d.ts.map +1 -0
  68. package/dist/plugins/specweave-testing/lib/playwright-ci-defaults.js +15 -0
  69. package/dist/plugins/specweave-testing/lib/playwright-ci-defaults.js.map +1 -0
  70. package/dist/plugins/specweave-testing/lib/playwright-cli-detector.d.ts +10 -0
  71. package/dist/plugins/specweave-testing/lib/playwright-cli-detector.d.ts.map +1 -0
  72. package/dist/plugins/specweave-testing/lib/playwright-cli-detector.js +36 -0
  73. package/dist/plugins/specweave-testing/lib/playwright-cli-detector.js.map +1 -0
  74. package/dist/plugins/specweave-testing/lib/playwright-cli-runner.d.ts +25 -0
  75. package/dist/plugins/specweave-testing/lib/playwright-cli-runner.d.ts.map +1 -0
  76. package/dist/plugins/specweave-testing/lib/playwright-cli-runner.js +57 -0
  77. package/dist/plugins/specweave-testing/lib/playwright-cli-runner.js.map +1 -0
  78. package/dist/plugins/specweave-testing/lib/playwright-routing.d.ts +7 -0
  79. package/dist/plugins/specweave-testing/lib/playwright-routing.d.ts.map +1 -0
  80. package/dist/plugins/specweave-testing/lib/playwright-routing.js +17 -0
  81. package/dist/plugins/specweave-testing/lib/playwright-routing.js.map +1 -0
  82. package/dist/src/cli/commands/auto.d.ts.map +1 -1
  83. package/dist/src/cli/commands/auto.js +1 -2
  84. package/dist/src/cli/commands/auto.js.map +1 -1
  85. package/dist/src/cli/commands/cancel-auto.js +1 -2
  86. package/dist/src/cli/commands/cancel-auto.js.map +1 -1
  87. package/dist/src/cli/commands/living-docs.js +2 -2
  88. package/dist/src/cli/commands/living-docs.js.map +1 -1
  89. package/dist/src/cli/commands/update.d.ts.map +1 -1
  90. package/dist/src/cli/commands/update.js +1 -2
  91. package/dist/src/cli/commands/update.js.map +1 -1
  92. package/dist/src/core/config/types.d.ts +8 -0
  93. package/dist/src/core/config/types.d.ts.map +1 -1
  94. package/dist/src/core/config/types.js +3 -0
  95. package/dist/src/core/config/types.js.map +1 -1
  96. package/dist/src/core/types/sync-profile.d.ts +72 -0
  97. package/dist/src/core/types/sync-profile.d.ts.map +1 -1
  98. package/dist/src/core/types/sync-profile.js +6 -0
  99. package/dist/src/core/types/sync-profile.js.map +1 -1
  100. package/package.json +2 -2
  101. package/plugins/specweave/hooks/hooks.json +2 -2
  102. package/plugins/specweave/hooks/startup-health-check.sh +1 -1
  103. package/plugins/specweave/hooks/stop-auto-v5.sh +166 -0
  104. package/plugins/specweave/hooks/user-prompt-submit.sh +10 -0
  105. package/plugins/specweave/hooks/v2/dispatchers/post-tool-use.sh +21 -1
  106. package/plugins/specweave/hooks/v2/dispatchers/session-start.sh +1 -1
  107. package/plugins/specweave/skills/auto/SKILL.md +71 -251
  108. package/plugins/specweave/skills/team-build/SKILL.md +370 -0
  109. package/plugins/specweave/skills/team-merge/SKILL.md +123 -0
  110. package/plugins/specweave/skills/team-orchestrate/SKILL.md +800 -0
  111. package/plugins/specweave/skills/team-status/SKILL.md +89 -0
  112. package/plugins/specweave-github/MULTI-PROJECT-SYNC-ARCHITECTURE.md +94 -8
  113. package/plugins/specweave-github/commands/sync.md +17 -3
  114. package/plugins/specweave-github/hooks/github-ac-sync-handler.sh +255 -0
  115. package/plugins/specweave-github/hooks/github-auto-create-handler.sh +455 -0
  116. package/plugins/specweave-github/lib/github-ac-comment-poster.js +150 -0
  117. package/plugins/specweave-github/lib/github-ac-comment-poster.ts +245 -0
  118. package/plugins/specweave-github/lib/github-batch-sync.js +93 -0
  119. package/plugins/specweave-github/lib/github-batch-sync.ts +152 -0
  120. package/plugins/specweave-github/lib/github-board-resolver-v2.js +47 -0
  121. package/plugins/specweave-github/lib/github-board-resolver-v2.ts +73 -0
  122. package/plugins/specweave-github/lib/github-conflict-resolver.js +90 -0
  123. package/plugins/specweave-github/lib/github-conflict-resolver.ts +154 -0
  124. package/plugins/specweave-github/lib/github-cross-repo-sync.js +168 -0
  125. package/plugins/specweave-github/lib/github-cross-repo-sync.ts +252 -0
  126. package/plugins/specweave-github/lib/github-field-sync.js +116 -0
  127. package/plugins/specweave-github/lib/github-field-sync.ts +165 -0
  128. package/plugins/specweave-github/lib/github-graphql-client.js +129 -0
  129. package/plugins/specweave-github/lib/github-graphql-client.ts +181 -0
  130. package/plugins/specweave-github/lib/github-issue-body-generator.js +30 -0
  131. package/plugins/specweave-github/lib/github-issue-body-generator.ts +76 -0
  132. package/plugins/specweave-github/lib/github-issue-body-parser.js +55 -0
  133. package/plugins/specweave-github/lib/github-issue-body-parser.ts +92 -0
  134. package/plugins/specweave-github/lib/github-pull-sync.js +185 -0
  135. package/plugins/specweave-github/lib/github-pull-sync.ts +343 -0
  136. package/plugins/specweave-github/lib/github-push-sync.js +119 -0
  137. package/plugins/specweave-github/lib/github-push-sync.ts +174 -0
  138. package/plugins/specweave-github/lib/github-rate-limiter.js +96 -0
  139. package/plugins/specweave-github/lib/github-rate-limiter.ts +143 -0
  140. package/plugins/specweave-github/lib/github-spec-frontmatter-updater.js +117 -0
  141. package/plugins/specweave-github/lib/github-spec-frontmatter-updater.ts +180 -0
  142. package/plugins/specweave-github/lib/github-sync-orchestrator.js +84 -0
  143. package/plugins/specweave-github/lib/github-sync-orchestrator.ts +156 -0
  144. package/plugins/specweave-github/lib/github-us-auto-closer.js +134 -0
  145. package/plugins/specweave-github/lib/github-us-auto-closer.ts +226 -0
  146. package/plugins/specweave-github/lib/index.js +1 -7
  147. package/plugins/specweave-github/lib/index.ts +1 -4
  148. package/plugins/specweave-github/skills/github-sync/SKILL.md +76 -4
  149. package/plugins/specweave-testing/commands/e2e-setup.md +18 -0
  150. package/plugins/specweave-testing/commands/ui-automate.md +2 -0
  151. package/plugins/specweave-testing/commands/ui-inspect.md +8 -0
  152. package/plugins/specweave-testing/lib/playwright-ci-defaults.d.ts +6 -0
  153. package/plugins/specweave-testing/lib/playwright-ci-defaults.js +14 -0
  154. package/plugins/specweave-testing/lib/playwright-ci-defaults.ts +24 -0
  155. package/plugins/specweave-testing/lib/playwright-cli-detector.js +33 -0
  156. package/plugins/specweave-testing/lib/playwright-cli-detector.ts +48 -0
  157. package/plugins/specweave-testing/lib/playwright-cli-runner.js +58 -0
  158. package/plugins/specweave-testing/lib/playwright-cli-runner.ts +80 -0
  159. package/plugins/specweave-testing/lib/playwright-routing.js +16 -0
  160. package/plugins/specweave-testing/lib/playwright-routing.ts +38 -0
  161. package/plugins/specweave-testing/skills/e2e-testing/SKILL.md +38 -0
  162. package/src/templates/CLAUDE.md.template +7 -0
  163. package/src/templates/config.json.template +9 -1
  164. package/dist/plugins/specweave-github/lib/subtask-sync.d.ts +0 -51
  165. package/dist/plugins/specweave-github/lib/subtask-sync.d.ts.map +0 -1
  166. package/dist/plugins/specweave-github/lib/subtask-sync.js +0 -147
  167. package/dist/plugins/specweave-github/lib/subtask-sync.js.map +0 -1
  168. package/dist/plugins/specweave-github/lib/task-parser.d.ts +0 -37
  169. package/dist/plugins/specweave-github/lib/task-parser.d.ts.map +0 -1
  170. package/dist/plugins/specweave-github/lib/task-parser.js +0 -211
  171. package/dist/plugins/specweave-github/lib/task-parser.js.map +0 -1
  172. package/dist/plugins/specweave-github/lib/task-sync.d.ts +0 -56
  173. package/dist/plugins/specweave-github/lib/task-sync.d.ts.map +0 -1
  174. package/dist/plugins/specweave-github/lib/task-sync.js +0 -375
  175. package/dist/plugins/specweave-github/lib/task-sync.js.map +0 -1
  176. package/plugins/specweave/hooks/validate-completion-conditions.sh +0 -474
  177. package/plugins/specweave-github/lib/subtask-sync.d.ts +0 -51
  178. package/plugins/specweave-github/lib/subtask-sync.d.ts.map +0 -1
  179. package/plugins/specweave-github/lib/subtask-sync.js +0 -154
  180. package/plugins/specweave-github/lib/subtask-sync.js.map +0 -1
  181. package/plugins/specweave-github/lib/subtask-sync.ts +0 -225
  182. package/plugins/specweave-github/lib/task-parser.d.js +0 -0
  183. package/plugins/specweave-github/lib/task-parser.d.ts +0 -37
  184. package/plugins/specweave-github/lib/task-parser.d.ts.map +0 -1
  185. package/plugins/specweave-github/lib/task-parser.js +0 -195
  186. package/plugins/specweave-github/lib/task-parser.js.map +0 -1
  187. package/plugins/specweave-github/lib/task-parser.ts +0 -246
  188. package/plugins/specweave-github/lib/task-sync.d.js +0 -0
  189. package/plugins/specweave-github/lib/task-sync.d.ts +0 -51
  190. package/plugins/specweave-github/lib/task-sync.d.ts.map +0 -1
  191. package/plugins/specweave-github/lib/task-sync.js +0 -415
  192. package/plugins/specweave-github/lib/task-sync.js.map +0 -1
  193. package/plugins/specweave-github/lib/task-sync.ts +0 -451
  194. package/plugins/specweave-github/skills/github-issue-tracker/SKILL.md +0 -496
  195. /package/plugins/specweave/hooks/{stop-auto.sh → _archive/stop-auto-v4-legacy.sh} +0 -0
  196. /package/plugins/{specweave-github/lib/subtask-sync.d.js → specweave-testing/lib/playwright-ci-defaults.d.js} +0 -0
@@ -35,7 +35,6 @@ Now work on the increment tasks. When you try to exit, the stop hook will check
35
35
 
36
36
  **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.
37
37
 
38
- **Real-world proof**: Boris Cherny (Claude Code creator) shipped 259 PRs, 497 commits, 40,000 lines in one month without opening an IDE — using autonomous execution with stop hooks. [See demo](https://x.com/bcherny/status/2004916410687050167)
39
38
  :::
40
39
 
41
40
  ## Arguments
@@ -50,8 +49,7 @@ Now work on the increment tasks. When you try to exit, the stop hook will check
50
49
 
51
50
  | Option | Description | Default |
52
51
  |--------|-------------|---------|
53
- | `--max-iterations N` | Maximum iterations (safety net, not primary stop) | **2500** |
54
- | `--max-hours N` | Maximum hours to run | **600 hours** (25 days) |
52
+ | `--max-turns N` | Maximum hook invocations before hard stop | **20** |
55
53
  | `--simple` | Simple mode (minimal context) | false |
56
54
  | `--dry-run` | Preview without starting | false |
57
55
  | `--all-backlog` | Process all backlog items | false |
@@ -60,232 +58,81 @@ Now work on the increment tasks. When you try to exit, the stop hook will check
60
58
  | `--prompt "text"` | Analyze prompt and create increments (intelligent chunking) | None |
61
59
  | `--yes`, `-y` | Auto-approve increment plan (skip user approval) | false |
62
60
  | `--tdd`, `--strict` | Enable TDD strict mode - ALL tests must pass | false |
63
- | **`--build`** | Build must pass before completion (auto-heal: 3 retries) | false |
61
+ | **`--build`** | Build must pass before completion | false |
64
62
  | **`--tests`** | Tests must pass before completion (unit + integration) | false |
65
63
  | **`--e2e`** | E2E tests must pass before completion | false |
66
- | **`--lint`** | Linting must pass before completion (auto-heal: 3 retries) | false |
67
- | **`--types`** | Type-checking must pass before completion (auto-heal: 3 retries) | false |
64
+ | **`--lint`** | Linting must pass before completion | false |
65
+ | **`--types`** | Type-checking must pass before completion | false |
68
66
  | **`--cov <n>`** | Code coverage must meet threshold (%) | 80 |
69
67
  | **`--e2e-cov <n>`** | E2E coverage must meet threshold (%) | 70 |
70
68
  | **`--cmd "<command>"`** | Custom command must pass before completion | None |
71
69
 
72
- :::warning Iteration limits are SAFETY NETS
73
- The primary completion criteria is **tests passing + tasks complete**. Iteration limits (2500 iterations, 600 hours) are backup safety nets. Completion should be detected through **external verification** (test results), not self-assessment.
74
-
75
- **IMPORTANT: Stop hook runs PER AGENT** - Each spawned subagent gets its own hook invocation. Iteration count is shared via session file, reflecting main agent loops.
70
+ :::warning Turn limit is a SAFETY NET
71
+ 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.
76
72
  :::
77
73
 
78
- ## Completion Conditions
79
-
80
- **Auto mode will NOT stop until ALL specified conditions pass.**
74
+ ## Completion Architecture (v5)
81
75
 
82
- ### What Are Completion Conditions?
76
+ **Two-layer design**: Stop hook gates exit. Model enforces quality before `/sw:done`.
83
77
 
84
- Completion conditions are **quality gates** that prevent auto mode from completing until specific checks pass:
78
+ ### What the Stop Hook Does (v5)
85
79
 
86
- - **`--build`**: Build must succeed (auto-heal enabled, max 3 retries)
87
- - **`--tests`**: All tests must pass (unit + integration tests)
88
- - **`--e2e`**: E2E tests must pass (Playwright, Cypress, etc.)
89
- - **`--lint`**: Linting must pass (ESLint, Black, Clippy, etc.)
90
- - **`--types`**: Type-checking must pass (TypeScript, mypy, etc.)
91
- - **`--cov N`**: Code coverage must meet threshold (e.g., `--cov 80` = 80% minimum)
92
- - **`--e2e-cov N`**: E2E coverage must meet threshold
93
- - **`--cmd "..."`**: Custom command must pass (e.g., `--cmd "make verify"`)
80
+ The stop hook (`stop-auto-v5.sh`, ~166 lines) is a **simple gate**:
94
81
 
95
- ### Auto-Heal vs Manual Fix
82
+ 1. Checks if auto mode is active (auto-mode.json marker)
83
+ 2. Counts pending tasks in `tasks.md` (grep-based, reliable)
84
+ 3. Counts open ACs in `spec.md` (grep-based, reliable)
85
+ 4. If work remains: **block** with concise message
86
+ 5. If all complete: **approve** (model should then run `/sw:done`)
96
87
 
97
- | Condition | Auto-Heal? | Behavior |
98
- |-----------|-----------|----------|
99
- | `--build` | ✅ Yes (3 retries) | Build failures auto-fixed by LLM |
100
- | `--lint` | ✅ Yes (3 retries) | Lint errors auto-fixed by LLM |
101
- | `--types` | ✅ Yes (3 retries) | Type errors auto-fixed by LLM |
102
- | `--tests` | ❌ No | Tests must be fixed manually by LLM |
103
- | `--e2e` | ❌ No | E2E tests must be fixed manually |
104
- | `--cov` | ❌ No | Must write more tests to meet threshold |
105
- | `--cmd` | ❌ No | Custom commands run as-is |
88
+ The hook does NOT run tests, builds, or any external commands. It has no PATH dependency.
106
89
 
107
- **Auto-heal** means the hook will:
108
- 1. Run the command
109
- 2. If it fails, ask LLM to fix the issue
110
- 3. Retry up to 3 times
111
- 4. Block completion if still failing after 3 attempts
90
+ ### What the Model Does (before /sw:done)
112
91
 
113
- **Manual fix** means:
114
- 1. Run the command
115
- 2. If it fails, BLOCK immediately
116
- 3. LLM must fix the issue manually
117
- 4. Re-run to validate
92
+ 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`:
118
93
 
119
- ### Framework Auto-Detection
94
+ | Flag | Stored As | Model Responsibility |
95
+ |------|-----------|---------------------|
96
+ | `--build` | `successCriteria[type=build]` | Run build command, fix failures |
97
+ | `--tests` | `successCriteria[type=tests]` | Run tests, fix failures |
98
+ | `--e2e` | `successCriteria[type=e2e]` | Run E2E tests, fix failures |
99
+ | `--lint` | `successCriteria[type=lint]` | Run linter, fix issues |
100
+ | `--types` | `successCriteria[type=types]` | Run type checker, fix errors |
101
+ | `--cov N` | `successCriteria[type=coverage]` | Write tests to meet threshold |
102
+ | `--cmd "..."` | `successCriteria[type=custom]` | Run custom command |
120
103
 
121
- Commands are auto-detected based on your project structure:
122
-
123
- **TypeScript/Node:**
124
- ```bash
125
- # Detected from package.json, jest.config.js, vitest.config.ts
126
- build: npm run build
127
- tests: npm test OR npx vitest run
128
- e2e: npx playwright test OR npx cypress run
129
- lint: npm run lint OR npx eslint .
130
- types: npx tsc --noEmit
131
- ```
132
-
133
- **Python:**
134
- ```bash
135
- # Detected from requirements.txt, pyproject.toml, pytest.ini
136
- build: python -m build
137
- tests: pytest
138
- e2e: (none)
139
- lint: black --check . OR flake8
140
- types: mypy .
141
- ```
104
+ The model runs in a proper shell environment where npm/node ARE available.
142
105
 
143
- **Go:**
144
- ```bash
145
- # Detected from go.mod
146
- build: go build ./...
147
- tests: go test ./...
148
- lint: golangci-lint run
149
- ```
106
+ ### Completion Flow
150
107
 
151
- **Rust:**
152
- ```bash
153
- # Detected from Cargo.toml
154
- build: cargo build
155
- tests: cargo test
156
- lint: cargo clippy
157
108
  ```
158
-
159
- ### Example Usage
160
-
161
- **Basic - Build + Tests:**
162
- ```bash
163
- /sw:auto --build --tests
164
- # → Auto mode will NOT stop until build passes AND all tests pass
109
+ Tasks done + ACs satisfied
110
+ Hook approves exit
111
+ → Model verifies quality criteria (build, tests, etc.)
112
+ Model runs /sw:done
113
+ → /sw:done runs PM validation gates
114
+ Increment closed
165
115
  ```
166
116
 
167
- **Strict Quality:**
168
- ```bash
169
- /sw:auto --build --tests --e2e --lint --types --cov 80
170
- # → ALL conditions must pass:
171
- # ✅ Build succeeds
172
- # ✅ Tests pass
173
- # ✅ E2E tests pass
174
- # ✅ Lint passes
175
- # ✅ Type-check passes
176
- # ✅ Coverage ≥80%
177
- ```
178
-
179
- **Custom Command:**
180
- ```bash
181
- /sw:auto --cmd "make verify"
182
- # → Auto mode will run `make verify` before completion
183
- ```
184
-
185
- **Combined with Other Flags:**
186
- ```bash
187
- /sw:auto --prompt "Build auth system" --yes --build --tests --cov 85
188
- # → Intelligent chunking + auto-approve + quality gates
189
- ```
190
-
191
- ### Session Output
192
-
193
- When you start auto mode with completion conditions, you'll see:
194
-
195
- ```
196
- 🚀 Auto Session Started
197
-
198
- Session ID: auto-2026-01-04-abc123
199
- Max Iterations: 2500
200
- Max Hours: 600
201
- Simple Mode: false
202
-
203
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
204
- ⚙️ COMPLETION CONDITIONS
205
- Auto mode will NOT stop until ALL conditions pass:
206
-
207
- • 🔨 Build must pass (auto-heal enabled, max 3 retries)
208
- • ✅ Tests must pass (unit + integration)
209
- • 🎭 E2E tests must pass
210
- • 📊 Code coverage must be ≥80%
211
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
212
-
213
- Increment Queue (1):
214
- • 0001-auth-system
215
-
216
- Current: 0001-auth-system
217
-
218
- The session will continue until:
219
- • All tasks complete AND tests pass
220
- • ALL 4 completion conditions pass
221
- • Max iterations (2500) reached
222
- • Max hours (600) exceeded
223
- • You run specweave cancel-auto
224
- • A human gate requires approval
225
- ```
117
+ ### Safety Nets
226
118
 
227
- ### Stop Hook Validation
228
-
229
- The stop hook (`stop-auto.sh`) validates completion conditions:
230
-
231
- 1. **Before allowing completion**, the hook runs:
232
- ```bash
233
- plugins/specweave/hooks/validate-completion-conditions.sh
234
- ```
235
-
236
- 2. **For each condition**:
237
- - Auto-detects the framework-specific command
238
- - Runs the command
239
- - Parses the output
240
- - If auto-heal enabled, retries on failure (max 3x)
241
- - BLOCKS completion if ANY condition fails
242
-
243
- 3. **Only when ALL conditions pass**:
244
- - Hook approves completion
245
- - Auto mode stops successfully
246
- - Celebration sound plays 🎉
247
-
248
- ### Per-Increment Override
249
-
250
- You can override completion conditions per increment in `metadata.json`:
119
+ | Mechanism | Default | Purpose |
120
+ |-----------|---------|---------|
121
+ | Turn limit | 20 | Hard stop after N hook invocations |
122
+ | Staleness | 2h | Auto-cleanup sessions inactive > 2 hours |
123
+ | Dedup | 30s | Prevent rapid-fire blocks |
251
124
 
125
+ Configure in `.specweave/config.json`:
252
126
  ```json
253
- {
254
- "increment": "0001-auth-system",
255
- "autoCompletion": {
256
- "conditions": [
257
- { "type": "build" },
258
- { "type": "tests" },
259
- { "type": "coverage", "threshold": 90 }
260
- ],
261
- "override": true
262
- }
263
- }
127
+ { "auto": { "maxTurns": 50, "maxSessionAge": 7200 } }
264
128
  ```
265
129
 
266
- When `override: true`, the increment-specific conditions replace the session-level conditions.
267
-
268
- ### Troubleshooting
269
-
270
- **Issue**: "Build command not detected"
271
- - **Fix**: Add `scripts.build` to `package.json` OR use `--cmd "your-build-cmd"`
272
-
273
- **Issue**: "Tests pass but coverage below threshold"
274
- - **Fix**: Write more tests to cover untested code paths
275
-
276
- **Issue**: "Auto-heal keeps retrying but failing"
277
- - **Fix**: After 3 retries, the hook will BLOCK. Fix the issue manually, then resume.
278
-
279
- **Issue**: "E2E tests not detected"
280
- - **Fix**: Ensure `playwright.config.ts` or `cypress.config.js` exists
281
-
282
130
  ### Best Practices
283
131
 
284
132
  1. **Start Simple**: Use `--build --tests` for basic quality gates
285
- 2. **Add Coverage Gradually**: Start with `--cov 70`, increase to 80-90 over time
286
- 3. **Use Auto-Heal**: Let build/lint/types auto-fix (saves manual work)
287
- 4. **Don't Skip E2E**: Use `--e2e` for user-facing features
288
- 5. **Custom Commands**: Use `--cmd` for project-specific checks (e.g., security scans)
133
+ 2. **Add Coverage Gradually**: Start with `--cov 70`, increase over time
134
+ 3. **Don't Skip E2E**: Use `--e2e` for user-facing features
135
+ 4. **Custom Commands**: Use `--cmd` for project-specific checks
289
136
 
290
137
  ## Intelligent Increment Creation (NEW!)
291
138
 
@@ -450,11 +297,10 @@ Analyze & Show Plan
450
297
  4. Claude tries to exit (naturally)
451
298
 
452
299
 
453
- 5. Stop Hook intercepts (stop-auto.sh)
454
- ├─ Checks: All tasks complete?
455
- ├─ Checks: Max iterations reached?
456
- ├─ Checks: Completion promise?
457
- └─ Checks: Human gate pending?
300
+ 5. Stop Hook intercepts (stop-auto-v5.sh)
301
+ ├─ Checks: All tasks complete? (grep)
302
+ ├─ Checks: All ACs satisfied? (grep)
303
+ └─ Checks: Turn limit reached?
458
304
 
459
305
  ┌──────┴──────┐
460
306
  ▼ ▼
@@ -484,11 +330,8 @@ prompt
484
330
  ### With Options
485
331
 
486
332
  ```bash
487
- # Limit iterations
488
- /sw:auto --max-iterations 50
489
-
490
- # Time limit
491
- /sw:auto --max-hours 8
333
+ # Increase turn limit
334
+ /sw:auto --max-turns 50
492
335
 
493
336
  # Simple mode (minimal context)
494
337
  /sw:auto --simple
@@ -555,7 +398,7 @@ In `.specweave/config.json`:
555
398
  }
556
399
  ```
557
400
 
558
- **Note**: The stop hook will NOT allow completion until tests are actually executed. If test files exist (`.test.ts`, `.spec.ts`, `playwright.config.ts`, etc.), auto mode will block exit and require test runs.
401
+ **Note**: The stop hook checks task/AC completion via grep. Quality gates (tests, build) are the model's responsibility before running `/sw:done`.
559
402
 
560
403
  ## Completion Signals
561
404
 
@@ -568,9 +411,7 @@ The session ends when ANY of these occur:
568
411
  5. **User cancellation** - `/sw:cancel-auto`
569
412
  6. **Human gate timeout** - Gate pending too long
570
413
 
571
- **⚠️ IMPORTANT**: Auto mode will NOT complete just because tasks are marked done. If test files exist in the project, the stop hook ENFORCES test execution. You'll see messages like:
572
- - "🧪 MANDATORY: All tasks marked complete but NO TEST EXECUTION detected"
573
- - "🎭 MANDATORY: E2E tests exist but were NOT executed"
414
+ **⚠️ 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`.
574
415
 
575
416
  ## Simple Mode (--simple)
576
417
 
@@ -588,8 +429,7 @@ Pure stop hook loop behavior:
588
429
 
589
430
  - **Human Gates**: Sensitive operations require approval
590
431
  - **Circuit Breakers**: External service failures handled gracefully
591
- - **Max Iterations**: Prevents runaway loops (2500 default)
592
- - **Max Hours**: Time boxing (600 hours / 25 days default)
432
+ - **Turn Limit**: Hard stop after maxTurns (default: 20)
593
433
  - **stop_hook_active**: Prevents infinite continuation loops
594
434
  - **Sound Notifications**: Audible alerts when Claude stops working
595
435
 
@@ -637,13 +477,13 @@ Main Agent (Claude Code)
637
477
 
638
478
  ### Key Implications
639
479
 
640
- 1. **Iteration count = main agent loops**: When you see "Iteration 42/2500", that's 42 times the MAIN agent tried to exit, not subagent work.
480
+ 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.
641
481
 
642
- 2. **Subagent work is "free"**: Spawning specialized agents (QA, Security, etc.) doesn't consume iterations from the main loop.
482
+ 2. **Subagent work is "free"**: Spawning specialized agents (QA, Security, etc.) doesn't consume turns from the main loop.
643
483
 
644
484
  3. **Shared session state**: All agents (main + sub) share the same `auto-session.json`, so task completion is tracked globally.
645
485
 
646
- 4. **Test validation at main level**: The stop hook validates test results when the MAIN agent tries to complete, ensuring all subagent work is verified.
486
+ 4. **Completion validation at main level**: The stop hook checks task/AC completion when the MAIN agent tries to exit.
647
487
 
648
488
  ### Configuration
649
489
 
@@ -660,8 +500,8 @@ To enable stop hooks for subagents (advanced):
660
500
 
661
501
  - Let subagents do specialized work without worrying about iterations
662
502
  - Main agent orchestrates and validates via stop hook
663
- - Use `--max-iterations` as a safety net, not a target
664
- - Primary completion = tests pass + tasks complete
503
+ - Use `--max-turns` as a safety net, not a target
504
+ - Primary completion = tasks complete + ACs satisfied
665
505
 
666
506
  ## 🔧 v2.1 Reliability Improvements
667
507
 
@@ -894,40 +734,20 @@ I need your Supabase database URL to execute the migration.
894
734
 
895
735
  ---
896
736
 
897
- ## 🎯 Self-Assessment & Quality Gates
898
-
899
- **Auto mode self-assesses each task and enforces quality gates:**
900
-
901
- ### Confidence Thresholds
737
+ ## Quality Gates
902
738
 
903
- | Score | Action |
904
- |-------|--------|
905
- | ≥ 0.90 | ✅ Continue confidently |
906
- | 0.70-0.89 | ⚠️ Continue with caution |
907
- | 0.50-0.69 | 🟡 Pause for self-review |
908
- | < 0.50 | 🔴 Stop for human review |
909
-
910
- ### Quality Gates (verify before continuing)
911
-
912
- 1. ✅ Task marked complete in tasks.md + ACs in spec.md
913
- 2. ✅ All tests pass (3 retry attempts on failure)
914
- 3. ✅ E2E tests pass (if UI task)
915
- 4. ✅ Self-assessment score ≥ 0.70
916
-
917
- ### Test Status Reporting (MANDATORY)
918
-
919
- After EVERY task, output test status:
920
- ```markdown
921
- ## 🧪 Test Status (T-003)
922
- | Type | Status | Pass/Total |
923
- |------|--------|------------|
924
- | Unit | ✅ | 42/42 |
925
- | E2E | ⚠️ | 8/10 |
926
- ```
739
+ **Before running `/sw:done`, verify these gates based on success criteria in `auto-mode.json`:**
927
740
 
928
- ### Local-First Development
741
+ 1. All tasks marked `[x]` in tasks.md
742
+ 2. All ACs marked `[x]` in spec.md
743
+ 3. If `--build` flag: build passes
744
+ 4. If `--tests` flag: tests pass
745
+ 5. If `--e2e` flag: E2E tests pass
746
+ 6. If `--lint` flag: linting passes
747
+ 7. If `--types` flag: type-checking passes
748
+ 8. If `--cov N` flag: coverage meets threshold
929
749
 
930
- Build and test locally first. Don't assume deployment target - ask user when ready
750
+ The stop hook validates gates 1-2 via grep. Gates 3-8 are the model's responsibility.
931
751
 
932
752
  ---
933
753