specweave 0.24.0 → 0.24.6

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 (42) hide show
  1. package/.claude-plugin/marketplace.json +55 -0
  2. package/CLAUDE.md +42 -0
  3. package/dist/src/cli/commands/init.d.ts.map +1 -1
  4. package/dist/src/cli/commands/init.js +80 -41
  5. package/dist/src/cli/commands/init.js.map +1 -1
  6. package/dist/src/cli/helpers/issue-tracker/types.d.ts +1 -1
  7. package/dist/src/cli/helpers/issue-tracker/types.d.ts.map +1 -1
  8. package/dist/src/config/types.d.ts +24 -24
  9. package/dist/src/core/config/types.d.ts +25 -0
  10. package/dist/src/core/config/types.d.ts.map +1 -1
  11. package/dist/src/core/config/types.js +6 -0
  12. package/dist/src/core/config/types.js.map +1 -1
  13. package/dist/src/core/repo-structure/repo-bulk-discovery.d.ts +33 -0
  14. package/dist/src/core/repo-structure/repo-bulk-discovery.d.ts.map +1 -0
  15. package/dist/src/core/repo-structure/repo-bulk-discovery.js +275 -0
  16. package/dist/src/core/repo-structure/repo-bulk-discovery.js.map +1 -0
  17. package/dist/src/core/repo-structure/repo-structure-manager.d.ts +9 -0
  18. package/dist/src/core/repo-structure/repo-structure-manager.d.ts.map +1 -1
  19. package/dist/src/core/repo-structure/repo-structure-manager.js +255 -87
  20. package/dist/src/core/repo-structure/repo-structure-manager.js.map +1 -1
  21. package/dist/src/init/architecture/types.d.ts +6 -6
  22. package/dist/src/utils/plugin-validator.d.ts.map +1 -1
  23. package/dist/src/utils/plugin-validator.js +15 -14
  24. package/dist/src/utils/plugin-validator.js.map +1 -1
  25. package/package.json +4 -4
  26. package/plugins/specweave/.claude-plugin/plugin.json +4 -4
  27. package/plugins/specweave/agents/pm/AGENT.md +2 -0
  28. package/plugins/specweave/commands/specweave-do.md +0 -47
  29. package/plugins/specweave/commands/specweave-increment.md +0 -82
  30. package/plugins/specweave/commands/specweave-next.md +0 -47
  31. package/plugins/specweave/hooks/post-task-completion.sh +67 -6
  32. package/plugins/specweave/hooks/pre-edit-spec.sh +11 -0
  33. package/plugins/specweave/hooks/pre-task-completion.sh +69 -2
  34. package/plugins/specweave/hooks/pre-write-spec.sh +11 -0
  35. package/plugins/specweave/skills/increment-planner/SKILL.md +124 -4
  36. package/plugins/specweave-frontend/agents/frontend-architect/AGENT.md +21 -0
  37. package/plugins/specweave-github/hooks/.specweave/logs/hooks-debug.log +150 -0
  38. package/plugins/specweave-payments/commands/stripe-setup.md +931 -0
  39. package/plugins/specweave-payments/commands/subscription-flow.md +1193 -0
  40. package/plugins/specweave-payments/commands/subscription-manage.md +386 -0
  41. package/plugins/specweave-payments/commands/webhook-setup.md +295 -0
  42. package/plugins/specweave-testing/agents/qa-engineer/AGENT.md +21 -0
@@ -32,53 +32,6 @@ The `/specweave:next` command is your **workflow continuation** command. It:
32
32
 
33
33
  ## Workflow
34
34
 
35
- ### Step 0: Plugin Validation (MANDATORY - ALWAYS FIRST! v0.9.4+)
36
-
37
- 🚨 **CRITICAL**: Before ANY workflow transition, validate SpecWeave plugin installation.
38
-
39
- **Why This Matters**:
40
- - Ensures SpecWeave marketplace is registered in Claude Code
41
- - Ensures core `specweave` plugin is installed
42
- - Prevents workflow interruptions from missing dependencies
43
- - Enables seamless environment migration (local → VM → Cloud IDE)
44
-
45
- **Implementation**:
46
-
47
- Use the Bash tool to run:
48
- ```bash
49
- npx specweave validate-plugins --auto-install
50
- ```
51
-
52
- **Expected Output (Success)**:
53
- ```
54
- ✅ All plugins validated!
55
- • Core plugin: installed (v0.9.4)
56
- ```
57
-
58
- **Expected Output (Missing Components)**:
59
- ```
60
- ❌ Missing components detected:
61
- • SpecWeave marketplace not registered
62
- • Core plugin (specweave) not installed
63
-
64
- 📦 Installing missing components...
65
- ✅ Marketplace registered (.claude/settings.json)
66
- ✅ Core plugin installed (specweave)
67
-
68
- 🎉 Environment ready! Proceeding with workflow transition...
69
- ```
70
-
71
- **What to Do After Validation**:
72
-
73
- 1. ✅ **If validation passes**: Proceed to Step 1
74
- 2. ⚠️ **If validation fails with errors**: Show error messages and STOP (do NOT proceed)
75
- 3. 🔄 **If auto-install succeeded**: Proceed to Step 1
76
- 4. ⚠️ **If auto-install failed**: Show manual instructions and STOP
77
-
78
- **DO NOT PROCEED** to Step 1 until plugin validation passes!
79
-
80
- ---
81
-
82
35
  ### Step 1: Find Active Increment
83
36
 
84
37
  ```bash
@@ -250,16 +250,48 @@ fi
250
250
  (
251
251
  set +e # Disable error propagation in background job
252
252
 
253
- # Detect current increment ONCE
254
- CURRENT_INCREMENT=$(ls -td .specweave/increments/*/ 2>/dev/null | xargs -n1 basename | grep -v "_backlog" | grep -v "_archive" | grep -v "_working" | head -1)
253
+ # ============================================================================
254
+ # CRITICAL FIX: Read active increments from state file (NOT time-based detection)
255
+ # ============================================================================
256
+ # WHY: The old logic used 'ls -td' which:
257
+ # 1. Could pick up completed increments if recently modified
258
+ # 2. Caused infinite loops on increments with bad AC data
259
+ # 3. Wasted resources syncing 50+ completed increments
260
+ #
261
+ # NEW: Only sync increments that are ACTIVELY being worked on
262
+ # Source of truth: .specweave/state/active-increment.json
263
+ # ============================================================================
264
+
265
+ ACTIVE_STATE_FILE=".specweave/state/active-increment.json"
266
+ ACTIVE_INCREMENTS=()
267
+
268
+ if [[ ! -f "$ACTIVE_STATE_FILE" ]]; then
269
+ echo "[$(date)] ⚠️ No active state file found, skipping all background work" >> "$DEBUG_LOG" 2>/dev/null || true
270
+ echo "0" > "$CIRCUIT_BREAKER_FILE" 2>/dev/null || true # Reset on success
271
+ exit 0
272
+ fi
273
+
274
+ if command -v jq >/dev/null 2>&1; then
275
+ # Use jq to parse the active increments array
276
+ # NOTE: mapfile requires bash 4+, macOS has bash 3.2, use while read instead
277
+ while IFS= read -r increment; do
278
+ ACTIVE_INCREMENTS+=("$increment")
279
+ done < <(jq -r '.ids[]' "$ACTIVE_STATE_FILE" 2>/dev/null)
280
+ else
281
+ # Fallback: simple grep parsing (less reliable, but works without jq)
282
+ # Match only increment IDs: 4 digits, dash, then letters/numbers/dashes
283
+ echo "[$(date)] ⚠️ jq not found, using fallback parsing" >> "$DEBUG_LOG" 2>/dev/null || true
284
+ ACTIVE_INCREMENTS=($(grep -o '"[0-9]\{4\}-[a-zA-Z0-9][a-zA-Z0-9_-]*"' "$ACTIVE_STATE_FILE" 2>/dev/null | tr -d '"'))
285
+ fi
255
286
 
256
- if [[ -z "$CURRENT_INCREMENT" ]]; then
257
- echo "[$(date)] No active increment, skipping all background work" >> "$DEBUG_LOG" 2>/dev/null || true
287
+ # If no active increments, skip all work
288
+ if [[ ${#ACTIVE_INCREMENTS[@]} -eq 0 ]]; then
289
+ echo "[$(date)] ✓ No active increments, skipping all background work (this is normal)" >> "$DEBUG_LOG" 2>/dev/null || true
258
290
  echo "0" > "$CIRCUIT_BREAKER_FILE" 2>/dev/null || true # Reset on success
259
291
  exit 0
260
292
  fi
261
293
 
262
- echo "[$(date)] Starting consolidated background work for $CURRENT_INCREMENT" >> "$DEBUG_LOG" 2>/dev/null || true
294
+ echo "[$(date)] 📋 Found ${#ACTIVE_INCREMENTS[@]} active increment(s): ${ACTIVE_INCREMENTS[*]}" >> "$DEBUG_LOG" 2>/dev/null || true
263
295
 
264
296
  # Only proceed if Node.js is available
265
297
  if ! command -v node &> /dev/null; then
@@ -271,6 +303,33 @@ fi
271
303
  # Track if ANY operation succeeded (for circuit breaker)
272
304
  ANY_SUCCESS=false
273
305
 
306
+ # ============================================================================
307
+ # PROCESS EACH ACTIVE INCREMENT
308
+ # ============================================================================
309
+ for CURRENT_INCREMENT in "${ACTIVE_INCREMENTS[@]}"; do
310
+ echo "[$(date)] 🔄 Processing increment: $CURRENT_INCREMENT" >> "$DEBUG_LOG" 2>/dev/null || true
311
+
312
+ # Safety check: Verify increment exists and is not archived
313
+ if [[ ! -d ".specweave/increments/$CURRENT_INCREMENT" ]]; then
314
+ echo "[$(date)] ⚠️ Increment $CURRENT_INCREMENT not found, skipping" >> "$DEBUG_LOG" 2>/dev/null || true
315
+ continue
316
+ fi
317
+
318
+ if [[ -d ".specweave/increments/_archive/$CURRENT_INCREMENT" ]]; then
319
+ echo "[$(date)] ⚠️ Increment $CURRENT_INCREMENT is archived, skipping" >> "$DEBUG_LOG" 2>/dev/null || true
320
+ continue
321
+ fi
322
+
323
+ # Additional safety: Check metadata status (skip completed/abandoned)
324
+ METADATA_FILE=".specweave/increments/$CURRENT_INCREMENT/metadata.json"
325
+ if [[ -f "$METADATA_FILE" ]] && command -v jq >/dev/null 2>&1; then
326
+ INCREMENT_STATUS=$(jq -r '.status // "active"' "$METADATA_FILE" 2>/dev/null || echo "active")
327
+ if [[ "$INCREMENT_STATUS" == "completed" ]] || [[ "$INCREMENT_STATUS" == "abandoned" ]]; then
328
+ echo "[$(date)] ⏭️ Skipping $CURRENT_INCREMENT (status: $INCREMENT_STATUS)" >> "$DEBUG_LOG" 2>/dev/null || true
329
+ continue
330
+ fi
331
+ fi
332
+
274
333
  # ============================================================================
275
334
  # 1. UPDATE TASKS.MD
276
335
  # ============================================================================
@@ -429,8 +488,10 @@ fi
429
488
  fi
430
489
  fi
431
490
 
491
+ done # End of ACTIVE_INCREMENTS loop
492
+
432
493
  # ============================================================================
433
- # 6. STATUS LINE UPDATE
494
+ # 6. STATUS LINE UPDATE (GLOBAL - outside loop)
434
495
  # ============================================================================
435
496
  echo "[$(date)] 📊 Updating status line" >> "$DEBUG_LOG" 2>/dev/null || true
436
497
 
@@ -101,6 +101,17 @@ else
101
101
  exit 0 # Let PostToolUse handle it with mtime fallback
102
102
  fi
103
103
 
104
+ # ============================================================================
105
+ # EARLY EXIT: Only process .specweave/ files (v0.24.4 Performance Fix)
106
+ # ============================================================================
107
+ # 90% of Edit operations are on non-SpecWeave files (src/, tests/, node_modules/)
108
+ # Exit immediately for non-.specweave/ files to reduce hook overhead by 90%
109
+
110
+ if [[ "$FILE_PATH" != *"/.specweave/"* ]]; then
111
+ echo "[$(date)] pre-edit-spec: Not a .specweave/ file, skipping (performance optimization)" >> "$DEBUG_LOG" 2>/dev/null || true
112
+ exit 0
113
+ fi
114
+
104
115
  # Check if this is a spec.md or tasks.md file in increments folder
105
116
  IS_SPEC_FILE=false
106
117
  if [[ "$FILE_PATH" == *"/spec.md" ]] || [[ "$FILE_PATH" == *"/tasks.md" ]]; then
@@ -44,14 +44,74 @@ PROJECT_ROOT="$(find_project_root "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
44
44
  cd "$PROJECT_ROOT" 2>/dev/null || true
45
45
 
46
46
  # ============================================================================
47
- # CONFIGURATION
47
+ # EMERGENCY SAFETY CHECKS (v0.24.4 - Performance Fix)
48
48
  # ============================================================================
49
49
 
50
50
  LOGS_DIR=".specweave/logs"
51
51
  DEBUG_LOG="$LOGS_DIR/hooks-debug.log"
52
-
53
52
  mkdir -p "$LOGS_DIR" 2>/dev/null || true
54
53
 
54
+ # CIRCUIT BREAKER: Auto-disable after consecutive failures
55
+ CIRCUIT_BREAKER_FILE=".specweave/state/.hook-circuit-breaker-pre"
56
+ CIRCUIT_BREAKER_THRESHOLD=3
57
+
58
+ mkdir -p ".specweave/state" 2>/dev/null || true
59
+
60
+ if [[ -f "$CIRCUIT_BREAKER_FILE" ]]; then
61
+ FAILURE_COUNT=$(cat "$CIRCUIT_BREAKER_FILE" 2>/dev/null || echo 0)
62
+ if (( FAILURE_COUNT >= CIRCUIT_BREAKER_THRESHOLD )); then
63
+ # Circuit breaker is OPEN - hooks are disabled
64
+ exit 0
65
+ fi
66
+ fi
67
+
68
+ # FILE LOCK: Only allow 1 pre-task-completion hook at a time
69
+ LOCK_FILE=".specweave/state/.hook-pre-task.lock"
70
+ LOCK_TIMEOUT=5 # seconds (shorter than PostToolUse)
71
+
72
+ LOCK_ACQUIRED=false
73
+ for i in {1..5}; do
74
+ if mkdir "$LOCK_FILE" 2>/dev/null; then
75
+ LOCK_ACQUIRED=true
76
+ trap 'rmdir "$LOCK_FILE" 2>/dev/null || true' EXIT
77
+ break
78
+ fi
79
+
80
+ # Check for stale lock
81
+ if [[ -d "$LOCK_FILE" ]]; then
82
+ LOCK_AGE=$(($(date +%s) - $(stat -f "%m" "$LOCK_FILE" 2>/dev/null || echo 0)))
83
+ if (( LOCK_AGE > LOCK_TIMEOUT )); then
84
+ rmdir "$LOCK_FILE" 2>/dev/null || true
85
+ continue
86
+ fi
87
+ fi
88
+
89
+ sleep 0.1
90
+ done
91
+
92
+ if [[ "$LOCK_ACQUIRED" == "false" ]]; then
93
+ # Another instance is running, skip
94
+ exit 0
95
+ fi
96
+
97
+ # DEBOUNCING: Prevent duplicate hook fires
98
+ LAST_FIRE_FILE="$LOGS_DIR/last-pre-hook-fire"
99
+ DEBOUNCE_SECONDS=5 # Same as PostToolUse
100
+
101
+ CURRENT_TIME=$(date +%s)
102
+
103
+ if [ -f "$LAST_FIRE_FILE" ]; then
104
+ LAST_FIRE=$(cat "$LAST_FIRE_FILE" 2>/dev/null || echo "0")
105
+ TIME_DIFF=$((CURRENT_TIME - LAST_FIRE))
106
+
107
+ if [ "$TIME_DIFF" -lt "$DEBOUNCE_SECONDS" ]; then
108
+ # Debounced - skip this execution
109
+ exit 0
110
+ fi
111
+ fi
112
+
113
+ echo "$CURRENT_TIME" > "$LAST_FIRE_FILE"
114
+
55
115
  echo "[$(date)] 🔒 Pre-task-completion hook fired" >> "$DEBUG_LOG" 2>/dev/null || true
56
116
 
57
117
  # ============================================================================
@@ -170,6 +230,9 @@ if [ "$VALIDATION_EXIT_CODE" = "0" ]; then
170
230
  # Validation passed - allow completion
171
231
  echo "[$(date)] ✅ AC test validation passed" >> "$DEBUG_LOG" 2>/dev/null || true
172
232
 
233
+ # Reset circuit breaker on success
234
+ echo "0" > "$CIRCUIT_BREAKER_FILE" 2>/dev/null || true
235
+
173
236
  VALIDATION_SUMMARY=$(cat "$VALIDATION_OUTPUT" | tail -5 | tr '\n' ' ')
174
237
 
175
238
  rm -f "$VALIDATION_OUTPUT"
@@ -184,6 +247,10 @@ else
184
247
  # Validation failed - block completion
185
248
  echo "[$(date)] ❌ AC test validation failed" >> "$DEBUG_LOG" 2>/dev/null || true
186
249
 
250
+ # Increment circuit breaker on failure
251
+ CURRENT_FAILURES=$(cat "$CIRCUIT_BREAKER_FILE" 2>/dev/null || echo 0)
252
+ echo "$((CURRENT_FAILURES + 1))" > "$CIRCUIT_BREAKER_FILE" 2>/dev/null || true
253
+
187
254
  VALIDATION_ERROR=$(cat "$VALIDATION_OUTPUT" | grep -A 10 "VALIDATION FAILED" | tr '\n' ' ' | cut -c 1-300)
188
255
 
189
256
  rm -f "$VALIDATION_OUTPUT"
@@ -101,6 +101,17 @@ else
101
101
  exit 0 # Let PostToolUse handle it with mtime fallback
102
102
  fi
103
103
 
104
+ # ============================================================================
105
+ # EARLY EXIT: Only process .specweave/ files (v0.24.4 Performance Fix)
106
+ # ============================================================================
107
+ # 90% of Write operations are on non-SpecWeave files (src/, tests/, node_modules/)
108
+ # Exit immediately for non-.specweave/ files to reduce hook overhead by 90%
109
+
110
+ if [[ "$FILE_PATH" != *"/.specweave/"* ]]; then
111
+ echo "[$(date)] pre-write-spec: Not a .specweave/ file, skipping (performance optimization)" >> "$DEBUG_LOG" 2>/dev/null || true
112
+ exit 0
113
+ fi
114
+
104
115
  # Check if this is a spec.md or tasks.md file in increments folder
105
116
  IS_SPEC_FILE=false
106
117
  if [[ "$FILE_PATH" == *"/spec.md" ]] || [[ "$FILE_PATH" == *"/tasks.md" ]]; then
@@ -28,13 +28,14 @@ This skill creates comprehensive, well-structured implementation plans for SpecW
28
28
  The increment-planner skill automates the creation of implementation plans for ANY type of work:
29
29
  - Auto-numbered increment directories (`0001-9999` 4-digit format)
30
30
  - Duplicate detection (prevents creating 0002 when 0002 already exists)
31
- - Complete increment artifacts (spec.md, plan.md, tasks.md with embedded tests)
31
+ - Complete increment artifacts (spec.md, plan.md, tasks.md with embedded tests, **metadata.json**)
32
32
  - Proper context manifests for selective loading
33
33
  - Constitutional compliance
34
34
  - Separation of WHAT/WHY (spec) from HOW (plan) from STEPS (tasks with test plans)
35
35
  - **v0.7.0+**: Test-Aware Planning (bidirectional AC↔Task↔Test linking)
36
36
  - **v0.8.0+**: Multi-Project Support (specs organized by project/team)
37
37
  - **v0.18.0+**: Bidirectional Task↔User Story Linking (automatic during `/specweave:done`)
38
+ - **v0.24.5+**: **MANDATORY metadata.json creation** (enables status tracking, WIP limits, external tool sync)
38
39
 
39
40
  ## Bidirectional Linking (v0.18.0+)
40
41
 
@@ -593,11 +594,18 @@ Generate the complete feature directory with all required files:
593
594
  ├── spec.md # Feature specification (WHAT and WHY)
594
595
  ├── plan.md # Implementation plan (HOW)
595
596
  ├── tasks.md # Executable tasks (STEPS) with embedded test plans (v0.7.0+)
597
+ ├── metadata.json # Increment metadata (MANDATORY - v0.24.5+)
596
598
  └── context-manifest.yaml # Context loading specification
597
599
  ```
598
600
 
599
601
  **v0.7.0 Change**: tests.md eliminated - tests are now embedded in each task in tasks.md
600
602
 
603
+ **⚠️ CRITICAL (v0.24.5+)**: `metadata.json` is **MANDATORY** regardless of invocation method (natural language prompt or `/specweave:increment`). Without it:
604
+ - ❌ Status line shows nothing (no active increment tracking)
605
+ - ❌ WIP limits don't work (can't count active increments)
606
+ - ❌ External sync breaks (no GitHub/JIRA/ADO links)
607
+ - ❌ All increment management commands fail (`/status`, `/pause`, `/resume`, `/done`)
608
+
601
609
  ### Step 5: Generate spec.md
602
610
 
603
611
  **Purpose**: Define WHAT this feature does and WHY it's needed.
@@ -1060,7 +1068,89 @@ tags:
1060
1068
  - Token budget to prevent bloat
1061
1069
  - Related features for dependency tracking
1062
1070
 
1063
- ### Step 10: Validate and Finalize
1071
+ ### Step 11: Generate metadata.json (⚠️ MANDATORY - v0.24.5+)
1072
+
1073
+ **Purpose**: Create increment metadata for status tracking, WIP limits, and external tool sync.
1074
+
1075
+ **CRITICAL**: This step is **NON-NEGOTIABLE** regardless of how the increment was created (natural language prompt, `/specweave:increment`, or any other method).
1076
+
1077
+ **Execution Workflow (MUST USE TOOLS)**:
1078
+
1079
+ **STEP 1: Check if metadata.json exists**
1080
+ ```
1081
+ Use Read tool:
1082
+ file_path: .specweave/increments/{incrementId}/metadata.json
1083
+ ```
1084
+
1085
+ **STEP 2: If missing (file not found), create it immediately**
1086
+ ```
1087
+ Use Write tool:
1088
+ file_path: .specweave/increments/{incrementId}/metadata.json
1089
+ content: {
1090
+ "id": "{incrementId}",
1091
+ "status": "planned",
1092
+ "type": "{type}",
1093
+ "priority": "{priority}",
1094
+ "created": "{ISO-8601-timestamp}",
1095
+ "lastActivity": "{ISO-8601-timestamp}",
1096
+ "testMode": "TDD",
1097
+ "coverageTarget": 95,
1098
+ "feature_id": null,
1099
+ "epic_id": null,
1100
+ "externalLinks": {}
1101
+ }
1102
+ ```
1103
+
1104
+ **Field Extraction (from spec.md frontmatter)**:
1105
+ - `id`: Increment directory name (e.g., "0001-user-authentication")
1106
+ - `type`: Extract from `type:` in spec.md frontmatter OR default to "feature"
1107
+ - `priority`: Extract from `priority:` in spec.md frontmatter OR default to "P1"
1108
+ - `created`/`lastActivity`: Current timestamp in ISO-8601 format (e.g., "2025-11-22T19:30:00Z")
1109
+ - `testMode`: Extract from `test_mode:` in spec.md frontmatter OR default to "TDD"
1110
+ - `coverageTarget`: Extract from `coverage_target:` in spec.md frontmatter OR default to 95
1111
+
1112
+ **STEP 3: Validate creation succeeded**
1113
+ ```
1114
+ Use Read tool again:
1115
+ file_path: .specweave/increments/{incrementId}/metadata.json
1116
+ ```
1117
+
1118
+ If Read succeeds, output:
1119
+ ```
1120
+ ✅ metadata.json created successfully
1121
+ Status: planned
1122
+ Type: {type}
1123
+ Ready for /specweave:do
1124
+ ```
1125
+
1126
+ **Why This Cannot Be Skipped**:
1127
+ Without metadata.json, the increment is **effectively broken**:
1128
+ - Status line won't show it as active
1129
+ - WIP limit enforcement fails (infinite increments possible!)
1130
+ - All increment commands fail (`/status`, `/pause`, `/resume`, `/done`)
1131
+ - External tool sync (GitHub/JIRA/ADO) completely broken
1132
+ - Hooks can't detect the increment
1133
+
1134
+ **Example metadata.json**:
1135
+ ```json
1136
+ {
1137
+ "id": "0001-user-authentication",
1138
+ "status": "planned",
1139
+ "type": "feature",
1140
+ "priority": "P1",
1141
+ "created": "2025-11-22T19:30:00Z",
1142
+ "lastActivity": "2025-11-22T19:30:00Z",
1143
+ "testMode": "TDD",
1144
+ "coverageTarget": 95,
1145
+ "feature_id": null,
1146
+ "epic_id": null,
1147
+ "externalLinks": {}
1148
+ }
1149
+ ```
1150
+
1151
+ **⚠️ ENFORCEMENT**: If you complete increment creation without creating metadata.json, you have **failed the task**. This is not optional.
1152
+
1153
+ ### Step 12: Validate and Finalize
1064
1154
 
1065
1155
  Before completing:
1066
1156
 
@@ -1074,6 +1164,7 @@ Before completing:
1074
1164
  - plan.md has sufficient technical detail + test strategy
1075
1165
  - tasks.md has exact file paths + embedded test plans (BDD format)
1076
1166
  - tasks.md covers all P1 AC-IDs with test cases
1167
+ - **metadata.json exists and is valid** (v0.24.5+ MANDATORY)
1077
1168
  - context-manifest.yaml is precise
1078
1169
 
1079
1170
  3. **Update Features Index**:
@@ -1260,11 +1351,39 @@ max_context_tokens: 8000
1260
1351
  priority: high
1261
1352
  ```
1262
1353
 
1263
- **Step 10**: Validate
1354
+ **Step 10**: Generate metadata.json (⚠️ MANDATORY v0.24.5+)
1355
+ ```typescript
1356
+ // Use Read tool to check if exists
1357
+ Read({ file_path: ".specweave/increments/0003-stripe-payment-integration/metadata.json" });
1358
+
1359
+ // If missing, use Write tool to create
1360
+ Write({
1361
+ file_path: ".specweave/increments/0003-stripe-payment-integration/metadata.json",
1362
+ content: JSON.stringify({
1363
+ "id": "0003-stripe-payment-integration",
1364
+ "status": "planned",
1365
+ "type": "feature",
1366
+ "priority": "P1",
1367
+ "created": "2025-11-22T19:30:00Z",
1368
+ "lastActivity": "2025-11-22T19:30:00Z",
1369
+ "testMode": "TDD",
1370
+ "coverageTarget": 95,
1371
+ "feature_id": null,
1372
+ "epic_id": null,
1373
+ "externalLinks": {}
1374
+ }, null, 2)
1375
+ });
1376
+
1377
+ // Validate creation succeeded
1378
+ Read({ file_path: ".specweave/increments/0003-stripe-payment-integration/metadata.json" });
1379
+ ```
1380
+
1381
+ **Step 11**: Validate
1264
1382
  - ✅ spec.md is technology-agnostic with AC-IDs
1265
1383
  - ✅ plan.md documents Stripe SDK choice + test strategy
1266
1384
  - ✅ tasks.md has embedded test plans (BDD format)
1267
1385
  - ✅ tasks.md covers all P1 AC-IDs with tests
1386
+ - ✅ **metadata.json exists and is valid** (v0.24.5+ MANDATORY)
1268
1387
  - ✅ Constitutional compliance verified
1269
1388
 
1270
1389
  **Output**:
@@ -1276,12 +1395,13 @@ Files created:
1276
1395
  - spec.md (12 user stories, 34 AC-IDs)
1277
1396
  - plan.md (5 phases, architecture diagrams, test strategy)
1278
1397
  - tasks.md (23 tasks with embedded tests, 85% coverage target)
1398
+ - metadata.json ✅ (status: planned, type: feature)
1279
1399
  - context-manifest.yaml
1280
1400
 
1281
1401
  Next steps:
1282
1402
  1. Review spec.md - verify user stories and acceptance criteria
1283
1403
  2. Approve plan.md - validate technical approach
1284
- 3. Start implementation: specweave implement 0003
1404
+ 3. Start implementation: /specweave:do 0003
1285
1405
  ```
1286
1406
 
1287
1407
  ## Helper Scripts
@@ -385,3 +385,24 @@ const useStore = create<State>((set) => ({
385
385
  ```
386
386
 
387
387
  You are ready to design and implement world-class frontend architectures!
388
+
389
+ ## How to Invoke This Agent
390
+
391
+ Use the Task tool with the following subagent type:
392
+
393
+ ```typescript
394
+ Task({
395
+ subagent_type: "specweave-frontend:frontend-architect:frontend-architect",
396
+ prompt: "Your frontend architecture task here",
397
+ description: "Brief task description"
398
+ })
399
+ ```
400
+
401
+ **Example**:
402
+ ```typescript
403
+ Task({
404
+ subagent_type: "specweave-frontend:frontend-architect:frontend-architect",
405
+ prompt: "Design a scalable component architecture for a React e-commerce application using Atomic Design principles",
406
+ description: "Design React component architecture"
407
+ })
408
+ ```