specweave 1.0.261 → 1.0.263

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 (133) hide show
  1. package/.claude-plugin/README.md +0 -2
  2. package/CLAUDE.md +27 -27
  3. package/bin/specweave.js +14 -85
  4. package/dist/dashboard/assets/index-Cv1XUAKk.css +1 -0
  5. package/dist/dashboard/assets/index-DHOztQSu.js +11 -0
  6. package/dist/dashboard/index.html +2 -2
  7. package/dist/src/adapters/README.md +1 -1
  8. package/dist/src/adapters/agents-md-generator.js +1 -1
  9. package/dist/src/adapters/agents-md-generator.js.map +1 -1
  10. package/dist/src/adapters/claude/README.md +8 -8
  11. package/dist/src/adapters/claude/adapter.js +2 -2
  12. package/dist/src/adapters/claude-md-generator.js +2 -2
  13. package/dist/src/adapters/claude-md-generator.js.map +1 -1
  14. package/dist/src/adapters/cursor/README.md +7 -7
  15. package/dist/src/adapters/generic/README.md +2 -2
  16. package/dist/src/cli/commands/create-increment.d.ts +1 -1
  17. package/dist/src/cli/commands/create-increment.js +1 -1
  18. package/dist/src/cli/commands/update.d.ts.map +1 -1
  19. package/dist/src/cli/commands/update.js +64 -1
  20. package/dist/src/cli/commands/update.js.map +1 -1
  21. package/dist/src/cli/helpers/init/api-docs-config.js +7 -7
  22. package/dist/src/cli/helpers/init/api-docs-config.js.map +1 -1
  23. package/dist/src/core/config/types.d.ts +18 -0
  24. package/dist/src/core/config/types.d.ts.map +1 -1
  25. package/dist/src/core/config/types.js +4 -0
  26. package/dist/src/core/config/types.js.map +1 -1
  27. package/dist/src/core/external-tools/external-items-display.d.ts.map +1 -1
  28. package/dist/src/core/external-tools/external-items-display.js +1 -11
  29. package/dist/src/core/external-tools/external-items-display.js.map +1 -1
  30. package/dist/src/core/increment/increment-archiver.js +1 -1
  31. package/dist/src/core/increment/increment-archiver.js.map +1 -1
  32. package/dist/src/core/increment/metadata-manager.js +2 -2
  33. package/dist/src/core/increment/metadata-manager.js.map +1 -1
  34. package/dist/src/core/increment/template-creator.d.ts +1 -1
  35. package/dist/src/core/increment/template-creator.js +4 -4
  36. package/dist/src/core/lazy-loading/llm-plugin-detector.d.ts +2 -2
  37. package/dist/src/core/lazy-loading/llm-plugin-detector.d.ts.map +1 -1
  38. package/dist/src/core/lazy-loading/llm-plugin-detector.js +15 -5
  39. package/dist/src/core/lazy-loading/llm-plugin-detector.js.map +1 -1
  40. package/dist/src/core/living-docs/feature-consistency-validator.js +1 -1
  41. package/dist/src/core/living-docs/feature-consistency-validator.js.map +1 -1
  42. package/dist/src/core/living-docs/scaffolding/scaffold.js +3 -3
  43. package/dist/src/core/notifications/command-integration.d.ts.map +1 -1
  44. package/dist/src/core/notifications/command-integration.js +0 -1
  45. package/dist/src/core/notifications/command-integration.js.map +1 -1
  46. package/dist/src/core/reflection/reflect-handler.js +2 -2
  47. package/dist/src/core/reflection/reflect-handler.js.map +1 -1
  48. package/dist/src/core/validators/ac-presence-validator.d.ts +1 -1
  49. package/dist/src/core/validators/ac-presence-validator.js +3 -3
  50. package/dist/src/core/validators/ac-presence-validator.js.map +1 -1
  51. package/dist/src/dashboard/server/command-runner.d.ts.map +1 -1
  52. package/dist/src/dashboard/server/command-runner.js +2 -2
  53. package/dist/src/dashboard/server/command-runner.js.map +1 -1
  54. package/dist/src/dashboard/server/dashboard-server.d.ts.map +1 -1
  55. package/dist/src/dashboard/server/dashboard-server.js +22 -10
  56. package/dist/src/dashboard/server/dashboard-server.js.map +1 -1
  57. package/dist/src/dashboard/server/data/dashboard-data-aggregator.d.ts +9 -1
  58. package/dist/src/dashboard/server/data/dashboard-data-aggregator.d.ts.map +1 -1
  59. package/dist/src/dashboard/server/data/dashboard-data-aggregator.js +140 -13
  60. package/dist/src/dashboard/server/data/dashboard-data-aggregator.js.map +1 -1
  61. package/dist/src/dashboard/server/data/plugin-scanner.d.ts +1 -1
  62. package/dist/src/dashboard/server/data/plugin-scanner.d.ts.map +1 -1
  63. package/dist/src/dashboard/server/data/plugin-scanner.js +2 -2
  64. package/dist/src/dashboard/server/data/plugin-scanner.js.map +1 -1
  65. package/dist/src/utils/agents-md-compiler.js +1 -1
  66. package/dist/src/utils/agents-md-compiler.js.map +1 -1
  67. package/dist/src/utils/find-project-root.d.ts +5 -4
  68. package/dist/src/utils/find-project-root.d.ts.map +1 -1
  69. package/dist/src/utils/find-project-root.js +8 -10
  70. package/dist/src/utils/find-project-root.js.map +1 -1
  71. package/dist/src/utils/generate-skills-index.js +3 -3
  72. package/dist/src/utils/notification-constants.js +1 -1
  73. package/dist/src/utils/notification-constants.js.map +1 -1
  74. package/package.json +1 -1
  75. package/plugins/FINAL-AUDIT-RECOMMENDATIONS.md +3 -3
  76. package/plugins/specweave/PLUGIN.md +0 -22
  77. package/plugins/specweave/commands/analytics.md +1 -1
  78. package/plugins/specweave/commands/discrepancies.md +0 -1
  79. package/plugins/specweave/commands/living-docs.md +0 -1
  80. package/plugins/specweave/commands/reconcile.md +1 -1
  81. package/plugins/specweave/hooks/hooks.json +19 -0
  82. package/plugins/specweave/hooks/pre-compact.sh +39 -0
  83. package/plugins/specweave/hooks/stop-sync.sh +23 -1
  84. package/plugins/specweave/hooks/universal/fail-fast-wrapper.sh +4 -0
  85. package/plugins/specweave/hooks/user-prompt-submit.sh +193 -59
  86. package/plugins/specweave/hooks/v2/dispatchers/post-tool-use-analytics.sh +83 -0
  87. package/plugins/specweave/hooks/v2/dispatchers/session-start.sh +7 -0
  88. package/plugins/specweave/hooks/v2/guards/spec-template-enforcement-guard.sh +1 -1
  89. package/plugins/specweave/hooks/v2/handlers/ac-sync-dispatcher.sh +25 -6
  90. package/plugins/specweave/hooks/v2/handlers/universal-auto-create-dispatcher.sh +21 -3
  91. package/plugins/specweave/hooks/v2/lib/check-provider-enabled.sh +52 -0
  92. package/plugins/specweave/lib/vendor/core/increment/metadata-manager.js +2 -2
  93. package/plugins/specweave/lib/vendor/core/increment/metadata-manager.js.map +1 -1
  94. package/plugins/specweave/scripts/track-analytics.sh +4 -0
  95. package/plugins/specweave/skills/do/SKILL.md +1 -1
  96. package/plugins/specweave/skills/done/SKILL.md +1 -1
  97. package/plugins/specweave/skills/framework/SKILL.md +4 -4
  98. package/plugins/specweave/skills/increment/SKILL.md +192 -25
  99. package/plugins/specweave/skills/next/SKILL.md +36 -630
  100. package/plugins/specweave/skills/pm/phases/00-deep-interview.md +2 -2
  101. package/plugins/specweave/skills/progress-sync/SKILL.md +7 -25
  102. package/plugins/specweave/skills/spec-generator/SKILL.md +44 -626
  103. package/plugins/specweave/skills/tdd-green/SKILL.md +10 -798
  104. package/plugins/specweave/skills/tdd-red/SKILL.md +8 -136
  105. package/plugins/specweave/skills/tdd-refactor/SKILL.md +15 -147
  106. package/plugins/specweave-github/hooks/github-auto-create-handler.sh +23 -5
  107. package/src/templates/AGENTS.md.template +11 -11
  108. package/src/templates/CLAUDE.md.template +1 -1
  109. package/dist/dashboard/assets/index-CDl14O5G.css +0 -1
  110. package/dist/dashboard/assets/index-CmqBqnWd.js +0 -11
  111. package/plugins/specweave/commands/api-docs.md +0 -672
  112. package/plugins/specweave/commands/check-hooks.md +0 -241
  113. package/plugins/specweave/commands/embed-acs.md +0 -445
  114. package/plugins/specweave/commands/external.md +0 -145
  115. package/plugins/specweave/commands/import-docs.md +0 -212
  116. package/plugins/specweave/commands/migrate-config.md +0 -104
  117. package/plugins/specweave/commands/notifications.md +0 -94
  118. package/plugins/specweave/commands/plugin-validator.md +0 -429
  119. package/plugins/specweave/commands/revert-wip-limit.md +0 -82
  120. package/plugins/specweave/commands/sync-acs.md +0 -342
  121. package/plugins/specweave/commands/sync-specs.md +0 -339
  122. package/plugins/specweave/commands/sync-tasks.md +0 -255
  123. package/plugins/specweave/commands/update-scope.md +0 -351
  124. package/plugins/specweave/commands/validate-features.md +0 -207
  125. package/plugins/specweave/skills/archive-increments/SKILL.md +0 -209
  126. package/plugins/specweave/skills/code-review/SKILL.md +0 -598
  127. package/plugins/specweave/skills/increment-planner/SKILL.md +0 -238
  128. package/plugins/specweave/skills/increment-work-router/SKILL.md +0 -562
  129. package/plugins/specweave/skills/multi-project-spec-mapper/SKILL.md +0 -423
  130. package/plugins/specweave/skills/pm-closure-validation/SKILL.md +0 -542
  131. package/plugins/specweave/skills/smart-reopen-detector/SKILL.md +0 -245
  132. package/plugins/specweave/skills/tdd-orchestrator/SKILL.md +0 -228
  133. package/plugins/specweave/skills/umbrella-repo-detector/SKILL.md +0 -301
@@ -1,562 +0,0 @@
1
- ---
2
- description: Smart work continuation system that detects implementation intent and routes appropriately. Use when saying "implement X", "continue working", "build feature", or "resume increment". Checks active increments, relevance matching, and TDD mode to route to /sw:do or /sw:increment automatically.
3
- user-invocable: false
4
- ---
5
-
6
- # Increment Work Router - Smart Work Continuation
7
-
8
- ## Purpose
9
-
10
- The increment-work-router skill is an **intelligent work continuation system** that:
11
- - ✅ Detects implementation/continuation intent (not just new projects)
12
- - ✅ Checks for active increments automatically
13
- - ✅ Routes to existing increment OR creates new one
14
- - ✅ Bridges the gap between planning and execution
15
-
16
- **Key Insight**: When user says "implement X" or "complete Y", they expect the system to handle routing intelligently without manual commands.
17
-
18
- ## When to Activate
19
-
20
- This skill activates when user expresses **implementation/continuation intent**:
21
-
22
- ### High-Confidence Triggers (Auto-Route)
23
-
24
- **Action Verbs** (with specific target):
25
- - "Implement [feature]"
26
- - "Complete [task]"
27
- - "Build [component]"
28
- - "Add [functionality]"
29
- - "Develop [module]"
30
- - "Create [feature]"
31
-
32
- **Continuation Phrases**:
33
- - "Work on [feature]"
34
- - "Continue [increment]"
35
- - "Resume [work]"
36
- - "Finish [task]"
37
- - "Let's implement [X]"
38
- - "Let's build [Y]"
39
- - "Start working on [Z]"
40
-
41
- **Bug/Fix Intent**:
42
- - "Fix [issue]"
43
- - "Resolve [bug]"
44
- - "Address [problem]"
45
-
46
- ### Medium-Confidence Triggers (Clarify)
47
-
48
- **Vague Intent** (needs target clarification):
49
- - "Let's continue"
50
- - "Keep working"
51
- - "What's next?"
52
- - "Continue where we left off"
53
-
54
- ### Don't Activate For
55
-
56
- **Planning/Discussion** (let other skills handle):
57
- - "What should we build?" → increment-planner
58
- - "How does X work?" → Regular conversation
59
- - "Should we use Y?" → Technical discussion
60
- - "Plan a new feature" → increment-planner
61
-
62
- **Already in Workflow**:
63
- - User is already executing `/sw:do`
64
- - Increment planning is in progress
65
- - Another skill is handling the request
66
-
67
- ## Core Algorithm
68
-
69
- ### Step 1: Detect Intent
70
-
71
- Scan user message for implementation keywords:
72
- ```
73
- Action verbs: implement, complete, build, add, develop, create
74
- Continuation: work on, continue, resume, finish, start
75
- Bug/Fix: fix, resolve, address
76
- ```
77
-
78
- Calculate confidence:
79
- - **High (>80%)**: Action verb + specific target ("implement user auth")
80
- - **Medium (50-80%)**: Action verb only ("let's continue")
81
- - **Low (<50%)**: No clear intent
82
-
83
- ### Step 2: Check Active Increments
84
-
85
- **Read increment state:**
86
- ```bash
87
- # Find all increments with status = "active"
88
- find .specweave/increments -name "metadata.json" -type f \
89
- -exec jq -r 'select(.status == "active") | .id' {} \;
90
- ```
91
-
92
- **Three scenarios:**
93
- 1. **One active increment** → Check relevance and route
94
- 2. **Multiple active increments** → Ask user to select
95
- 3. **No active increments** → Suggest creating new one
96
-
97
- ### Step 3: Check Relevance (if active increment exists)
98
-
99
- **Relatedness Analysis:**
100
- Compare user's request against active increment:
101
- - Check increment title/description
102
- - Check task list (tasks.md)
103
- - Check spec.md for related features
104
-
105
- **Scoring:**
106
- - **High match (>70%)**: Same feature area → Auto-resume
107
- - **Medium match (40-70%)**: Related area → Ask confirmation
108
- - **Low match (<40%)**: Unrelated → Suggest new increment
109
-
110
- ### Step 3.5: Assess Complexity (before routing)
111
-
112
- **Before routing to `/sw:do`, assess the target increment's complexity:**
113
-
114
- ```bash
115
- # Count pending tasks
116
- PENDING=$(grep -c '^\- \[ \]\|Status\*\*: \[ \]' "$INCREMENT_PATH/tasks.md" 2>/dev/null || echo 0)
117
-
118
- # Count domains from spec.md + plan.md
119
- DOMAINS=$(grep -ciE 'frontend|backend|database|api|devops|security|mobile|ml|ai' "$INCREMENT_PATH/spec.md" "$INCREMENT_PATH/plan.md" 2>/dev/null | sort -u | wc -l)
120
- ```
121
-
122
- **Modify routing based on complexity** (see CLAUDE.md Execution Strategy):
123
-
124
- | Tasks | Domains | Routing Modification |
125
- |-------|---------|---------------------|
126
- | ≤8 | 1 | Route to `/sw:do` as usual |
127
- | 9-15 | 1-2 | Route to `/sw:do` + add tip: "Tip: use `/sw:auto <id>` for unattended execution" |
128
- | >15 | 1-2 | Suggest `/sw:auto <id>` — "This increment has [N] tasks. Consider `/sw:auto` for autonomous execution." |
129
- | any | 3+ | Suggest `/sw:team-lead` — "This increment spans [M] domains. Consider `/sw:team-lead` for parallel multi-agent execution (higher quality, uses more tokens)." |
130
-
131
- In non-auto mode: always ask user before switching mode. In auto mode: use team-lead automatically for 3+ domains.
132
-
133
- ### Step 4: Route Intelligently
134
-
135
- **Scenario A: High relevance to active increment**
136
- ```
137
- User: "Implement user authentication"
138
- Active: 0031-user-authentication-system
139
-
140
- ✅ High match → Auto-resume:
141
-
142
- "I see you have an active increment for user authentication (0031).
143
- Resuming work on that increment now with /sw:do..."
144
-
145
- [Automatically invokes /sw:do]
146
- ```
147
-
148
- **Scenario B: Unrelated to active increment**
149
- ```
150
- User: "Implement payment processing"
151
- Active: 0031-user-authentication-system
152
-
153
- ⚠️ Low match → Ask:
154
-
155
- "I see you have an active increment (0031-user-authentication-system).
156
-
157
- Your request for payment processing seems unrelated. Would you like to:
158
- 1. **Create new increment** for payment processing (recommended)
159
- 2. **Continue current increment** (0031) and add payment to it
160
- 3. **Pause current** and create new increment
161
-
162
- What would you prefer?"
163
- ```
164
-
165
- **Scenario C: No active increment**
166
- ```
167
- User: "Implement user authentication"
168
- Active: None
169
-
170
- → Suggest new increment:
171
-
172
- "No active increment found. Let's create one for user authentication.
173
-
174
- I'm going to create a SpecWeave increment with:
175
- - Specification (WHAT & WHY)
176
- - Technical plan (HOW)
177
- - Task breakdown (STEPS with embedded tests)
178
-
179
- Creating increment now with /sw:increment..."
180
-
181
- [Automatically invokes /sw:increment "user authentication"]
182
- ```
183
-
184
- **Scenario D: Multiple active increments**
185
- ```
186
- User: "Continue working"
187
- Active: 0031-user-auth, 0032-payment-system
188
-
189
- → Ask to clarify:
190
-
191
- "You have 2 active increments:
192
- 1. **0031-user-authentication-system** (3/10 tasks complete)
193
- 2. **0032-payment-processing** (1/8 tasks complete)
194
-
195
- Which one would you like to work on?"
196
- ```
197
-
198
- **Scenario E: Vague continuation intent**
199
- ```
200
- User: "Let's continue"
201
- Active: 0031-user-authentication-system
202
-
203
- ✅ Auto-resume (only one active):
204
-
205
- "Resuming increment 0031-user-authentication-system...
206
- Progress: 3/10 tasks complete (30%)
207
-
208
- Next task: T-004 Implement password hashing
209
-
210
- [Automatically invokes /sw:do]"
211
- ```
212
-
213
- ## Integration Architecture
214
-
215
- **Workflow:**
216
- ```
217
- User: "Implement [feature]"
218
-
219
- increment-work-router (detects intent)
220
-
221
- [Check .specweave/increments/*/metadata.json]
222
-
223
- ┌───────────────────┬──────────────────┬────────────────┐
224
- │ Active increment │ Multiple active │ No active │
225
- │ (relevant) │ (ambiguous) │ (none) │
226
- └─────┬─────────────┴──────┬───────────┴──────┬─────────┘
227
- │ │ │
228
- ↓ ↓ ↓
229
- /sw:do Ask to select /sw:increment
230
- (auto-resume) (clarify) (create new)
231
- ```
232
-
233
- **Calls:**
234
- - `/sw:do` - Resume active increment
235
- - `/sw:increment` - Create new increment
236
- - `/sw:status` - Check increment state (if needed)
237
- - `/sw:tdd-cycle` - TDD workflow (when TDD mode enabled)
238
-
239
- **Called By:**
240
- - Automatically when implementation intent detected
241
- - Works alongside `increment-planner` (planning) and `detector` (context checking)
242
-
243
- ## TDD-Aware Routing (CRITICAL)
244
-
245
- **When routing to an active increment, check TDD mode first:**
246
-
247
- ```bash
248
- # Check if increment uses TDD
249
- CONFIG_PATH=".specweave/config.json"
250
- METADATA_PATH=".specweave/increments/<id>/metadata.json"
251
-
252
- # Check global config
253
- TDD_MODE=$(cat "$CONFIG_PATH" | jq -r '.testing.defaultTestMode // "test-after"')
254
-
255
- # Check increment-specific override
256
- INCREMENT_TDD=$(cat "$METADATA_PATH" | jq -r '.testMode // ""')
257
- [[ -n "$INCREMENT_TDD" ]] && TDD_MODE="$INCREMENT_TDD"
258
- ```
259
-
260
- **If TDD mode is enabled, modify routing behavior:**
261
-
262
- | Scenario | Without TDD | With TDD |
263
- |----------|-------------|----------|
264
- | "Implement X" (new feature) | → `/sw:do` | → Suggest `/sw:tdd-cycle` first |
265
- | "Let's continue" | → `/sw:do` | → Show TDD phase reminder + `/sw:do` |
266
- | "Add test for X" | → `/sw:do` | → Confirm starting RED phase |
267
- | "Fix the implementation" | → `/sw:do` | → Check if GREEN phase complete |
268
-
269
- **TDD-aware resume output:**
270
-
271
- ```
272
- ✅ Resuming increment 0031-user-authentication-system...
273
-
274
- 🔴 TDD MODE ACTIVE
275
-
276
- Current TDD Status:
277
- ├─ T-001: [RED] Write login test ✅ completed
278
- ├─ T-002: [GREEN] Implement login ⏳ in progress
279
- └─ T-003: [REFACTOR] Clean up login ⏸️ blocked (waiting for GREEN)
280
-
281
- Current Phase: 🟢 GREEN - Making test pass
282
-
283
- 💡 You're in the GREEN phase. Implement just enough to make T-001's test pass.
284
- After GREEN completes, you can proceed to REFACTOR.
285
-
286
- [Proceeding with /sw:do...]
287
- ```
288
-
289
- **TDD workflow suggestion (for new work):**
290
-
291
- ```
292
- User: "Implement user registration"
293
-
294
- 🔴 TDD MODE DETECTED
295
-
296
- This increment uses Test-Driven Development.
297
-
298
- For new features, I recommend using the TDD workflow:
299
- 1. /sw:tdd-red "user registration" - Write failing test first
300
- 2. /sw:tdd-green - Implement to pass the test
301
- 3. /sw:tdd-refactor - Clean up the code
302
-
303
- Would you like to:
304
- 1. Start TDD cycle (/sw:tdd-cycle) - Recommended
305
- 2. Continue with regular /sw:do - Skip TDD guidance
306
-
307
- [1/2]:
308
- ```
309
-
310
- ## Decision Matrix
311
-
312
- | User Intent | Active Increments | Relevance | Complexity | Action |
313
- |-------------|------------------|-----------|------------|--------|
314
- | "Implement auth" | 1 (auth-related) | High (>70%) | Low | Auto `/sw:do` |
315
- | "Implement auth" | 1 (auth-related) | High (>70%) | Medium | Auto `/sw:do` + suggest `/sw:auto` |
316
- | "Implement auth" | 1 (auth-related) | High (>70%) | High | Suggest `/sw:auto` or `/sw:team-lead` |
317
- | "Implement auth" | 1 (unrelated) | Low (<40%) | Any | Ask: New or add to current? |
318
- | "Implement auth" | 0 | N/A | Any | Auto `/sw:increment` |
319
- | "Implement auth" | 2+ | N/A | Any | Ask which increment |
320
- | "Let's continue" | 1 | N/A | Low/Med | Auto `/sw:do` |
321
- | "Let's continue" | 1 | N/A | High | Auto `/sw:do` + suggest mode switch |
322
- | "Let's continue" | 2+ | N/A | Any | Ask which increment |
323
- | "Let's continue" | 0 | N/A | Any | "No active increment. What should we build?" |
324
-
325
- **Complexity**: Low (≤8 tasks, 1 domain) | Medium (9-15 tasks, 1-2 domains) | High (>15 tasks OR 3+ domains)
326
-
327
- ## Relevance Matching Logic
328
-
329
- **How to determine if request relates to active increment:**
330
-
331
- ```typescript
332
- function calculateRelevance(userRequest: string, increment: Increment): number {
333
- let score = 0;
334
-
335
- // 1. Title/ID match (strongest signal)
336
- if (increment.title.toLowerCase().includes(extractKeywords(userRequest))) {
337
- score += 40;
338
- }
339
-
340
- // 2. Tasks match (check tasks.md)
341
- const tasks = readTasksFile(increment);
342
- const matchingTasks = tasks.filter(t =>
343
- t.title.toLowerCase().includes(extractKeywords(userRequest))
344
- );
345
- score += (matchingTasks.length / tasks.length) * 30;
346
-
347
- // 3. Spec match (check spec.md user stories)
348
- const spec = readSpecFile(increment);
349
- if (spec.includes(extractKeywords(userRequest))) {
350
- score += 20;
351
- }
352
-
353
- // 4. Type match (feature vs bug vs hotfix)
354
- const requestType = detectType(userRequest);
355
- if (requestType === increment.type) {
356
- score += 10;
357
- }
358
-
359
- return score; // 0-100
360
- }
361
- ```
362
-
363
- **Example:**
364
- ```
365
- User: "Implement JWT token refresh"
366
- Active: 0031-user-authentication-system
367
-
368
- Checks:
369
- ✅ Title contains "authentication" (user mentions "JWT token") → +40 points
370
- ✅ Tasks.md has "T-005: Implement JWT refresh logic" → +30 points
371
- ✅ Spec.md mentions "token management" → +20 points
372
- ✅ Both are "feature" type → +10 points
373
-
374
- Total: 100/100 → High relevance → Auto-resume
375
- ```
376
-
377
- ## Examples
378
-
379
- ### Example 1: Auto-Resume (High Relevance)
380
-
381
- **Context:**
382
- ```
383
- Active: 0031-user-authentication-system
384
- Progress: 3/10 tasks complete
385
- ```
386
-
387
- **User:**
388
- ```
389
- Implement JWT token refresh
390
- ```
391
-
392
- **increment-work-router:**
393
- ```
394
- ✅ Intent detected: "implement" + specific target
395
- ✅ Active increment found: 0031-user-authentication-system
396
- ✅ Relevance check: 95% match (authentication-related)
397
-
398
- → AUTO-RESUME
399
-
400
- "I see you have an active increment for user authentication (0031).
401
- Task T-005 'Implement JWT token refresh' is already in your plan.
402
-
403
- Resuming increment 0031 now with /sw:do...
404
-
405
- [Automatically invokes /sw:do]
406
- ```
407
-
408
- ### Example 2: Create New (No Active Increment)
409
-
410
- **Context:**
411
- ```
412
- Active: None
413
- ```
414
-
415
- **User:**
416
- ```
417
- Implement payment processing with Stripe
418
- ```
419
-
420
- **increment-work-router:**
421
- ```
422
- ✅ Intent detected: "implement" + specific target
423
- ❌ No active increment found
424
-
425
- → CREATE NEW
426
-
427
- "No active increment found. Let's create one for payment processing.
428
-
429
- I'm going to create a SpecWeave increment with:
430
- - Specification (Stripe integration requirements)
431
- - Technical plan (API integration, webhooks, security)
432
- - Task breakdown (implementation steps with tests)
433
-
434
- Creating increment now with /sw:increment...
435
-
436
- [Automatically invokes /sw:increment "payment processing with Stripe"]
437
- ```
438
-
439
- ### Example 3: Unrelated Request (Ask)
440
-
441
- **Context:**
442
- ```
443
- Active: 0031-user-authentication-system
444
- Progress: 3/10 tasks complete
445
- ```
446
-
447
- **User:**
448
- ```
449
- Implement email notifications
450
- ```
451
-
452
- **increment-work-router:**
453
- ```
454
- ✅ Intent detected: "implement" + specific target
455
- ✅ Active increment found: 0031-user-authentication-system
456
- ⚠️ Relevance check: 15% match (unrelated)
457
-
458
- → ASK FOR CLARIFICATION
459
-
460
- "I see you have an active increment (0031-user-authentication-system) with 3/10 tasks complete.
461
-
462
- Your request for email notifications seems unrelated. Would you like to:
463
- 1. **Create new increment** for email notifications (recommended - keeps work focused)
464
- 2. **Add to current increment** (0031) - if notifications are for auth emails
465
- 3. **Pause current increment** and start notifications
466
-
467
- SpecWeave works best with focused increments. What would you prefer?"
468
- ```
469
-
470
- ### Example 4: Multiple Active (Clarify)
471
-
472
- **Context:**
473
- ```
474
- Active: 0031-user-authentication-system (3/10 tasks)
475
- Active: 0032-payment-processing (1/8 tasks)
476
- ```
477
-
478
- **User:**
479
- ```
480
- Let's continue working
481
- ```
482
-
483
- **increment-work-router:**
484
- ```
485
- ✅ Intent detected: "continue" (vague)
486
- ✅ Multiple active increments found: 2
487
-
488
- → ASK TO SELECT
489
-
490
- "You have 2 active increments:
491
-
492
- 1. **0031-user-authentication-system**
493
- - Progress: 3/10 tasks (30%)
494
- - Next: T-004 Implement password hashing
495
-
496
- 2. **0032-payment-processing**
497
- - Progress: 1/8 tasks (12%)
498
- - Next: T-002 Set up Stripe SDK
499
-
500
- Which one would you like to work on?"
501
-
502
- [Wait for user selection, then invoke /sw:do {selected-id}]
503
- ```
504
-
505
- ### Example 5: Vague Intent + Single Active (Auto-Resume)
506
-
507
- **Context:**
508
- ```
509
- Active: 0031-user-authentication-system (3/10 tasks)
510
- ```
511
-
512
- **User:**
513
- ```
514
- What's next?
515
- ```
516
-
517
- **increment-work-router:**
518
- ```
519
- ✅ Intent detected: "what's next" (continuation)
520
- ✅ One active increment: 0031-user-authentication-system
521
-
522
- → AUTO-RESUME
523
-
524
- "Resuming increment 0031-user-authentication-system...
525
- Progress: 3/10 tasks complete (30%)
526
-
527
- Next task: **T-004 Implement password hashing**
528
-
529
- [Automatically invokes /sw:do]"
530
- ```
531
-
532
- ## Opt-Out Mechanism
533
-
534
- Users can override auto-routing with explicit instructions:
535
- - "Don't resume, create new" → Forces new increment
536
- - "Just discuss first" → Regular conversation
537
- - "Plan without implementing" → Routes to `/sw:increment` only
538
- - "Show me the current state" → Uses `/sw:status` instead
539
-
540
- ## Success Criteria
541
-
542
- - ✅ Users can say "implement X" and work starts automatically
543
- - ✅ Smart routing to active increments (no manual `/sw:do`)
544
- - ✅ Detects unrelated requests and prevents scope creep
545
- - ✅ No "which increment?" confusion (auto-handles single active)
546
- - ✅ Clear choices when ambiguous (multiple active or unrelated)
547
- - ✅ Seamless integration with existing skills (increment-planner, detector)
548
-
549
- ## Related Skills
550
-
551
- - **increment-planner**: For creating increment structure (invoked by this skill for new projects)
552
- - **detector**: For checking SpecWeave context
553
-
554
- ---
555
-
556
- **Key Distinction:**
557
- - `increment-planner` = "PLAN this increment" or "I want to BUILD a new product" (planning-level)
558
- - `increment-work-router` = "IMPLEMENT this feature/task" (execution-level)
559
-
560
- This skill bridges planning → execution by auto-detecting implementation intent.
561
-
562
-