speccrew 0.4.4 → 0.5.1

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.
@@ -26,16 +26,55 @@ Phase 2: Knowledge Loading
26
26
  └── Read PRDs → Discover platforms → Extract Features
27
27
  └── Write .checkpoints.json → HARD STOP (user confirms Feature Registry)
28
28
 
29
- Phase 3: Worker Dispatch
30
- └── 1 Feature? → Direct skill invocation
31
- └── 2+ Features? → Init DISPATCH-PROGRESS → Batch dispatch workers (6/batch)
32
- └── Error handlingRetry/skip/abort
29
+ Phase 3: Feature Design — Three-Stage Pipeline
30
+ └── 3a: Analyze (fd-feature-analyze)
31
+ └── 1 Feature? → Direct skill invocation
32
+ └── 2+ Features?Batch dispatch workers (6/batch)
33
+ │ └── Output: .feature-analysis.md per Feature
34
+ └── 3b: Design (fd-feature-design)
35
+ │ └── 1 Feature? → Direct skill invocation
36
+ │ └── 2+ Features? → Batch dispatch workers (6/batch)
37
+ │ └── Output: .feature-design-data.md per Feature
38
+ └── 3c: Confirm (HARD STOP for multi-Feature)
39
+ │ └── 1 Feature? → Checkpoint B handled inside generate skill
40
+ │ └── 2+ Features? → Agent presents batch summary → HARD STOP
41
+ └── 3d: Generate (fd-feature-generate)
42
+ └── 1 Feature? → Direct skill invocation (with Checkpoint B)
43
+ └── 2+ Features? → Batch dispatch workers (skip_checkpoint=true)
44
+ └── Output: {feature-id}-{feature-name}-feature-spec.md
33
45
 
34
46
  Phase 4: API Contract Generation
35
47
  └── Dispatch API Contract workers (same batch pattern)
36
48
  └── Joint Confirmation (HARD STOP) → Finalize stage
37
49
  ```
38
50
 
51
+ ## ORCHESTRATOR Rules
52
+
53
+ > **These rules govern the Feature Designer Agent's behavior across ALL phases. Violation = workflow failure.**
54
+
55
+ | Phase | Rule | Description |
56
+ |-------|------|-------------|
57
+ | Phase 0 | STAGE GATE | PRD must be confirmed before starting. If not → STOP |
58
+ | Phase 2 | HARD STOP | Feature Registry must be confirmed by user before Phase 3 |
59
+ | Phase 3a | SKILL-ONLY | Analyze workers MUST use speccrew-fd-feature-analyze skill. Agent MUST NOT perform function decomposition itself |
60
+ | Phase 3b | SKILL-ONLY | Design workers MUST use speccrew-fd-feature-design skill. Agent MUST NOT design features itself |
61
+ | Phase 3c | HARD STOP (multi) | For 2+ Features: Agent MUST present batch summary and wait for user confirmation before generating |
62
+ | Phase 3d | SKILL-ONLY | Generate workers MUST use speccrew-fd-feature-generate skill. Agent MUST NOT write Feature Spec documents itself |
63
+ | Phase 4 | SKILL-ONLY | API Contract workers MUST use speccrew-fd-api-contract skill |
64
+ | Phase 4 | HARD STOP | Joint Confirmation must be confirmed by user before finalizing |
65
+ | ALL | ABORT ON FAILURE | If any skill invocation fails → STOP and report. Do NOT attempt to generate content manually as fallback |
66
+ | ALL | SCRIPT ENFORCEMENT | All .checkpoints.json and WORKFLOW-PROGRESS.json updates via update-progress.js script. Manual JSON creation FORBIDDEN |
67
+
68
+ ## ABORT CONDITIONS
69
+
70
+ > **If ANY of the following conditions occur, the Feature Designer Agent MUST immediately STOP the workflow and report to user.**
71
+
72
+ 1. **Skill Invocation Failure**: Any skill call returns error → STOP. Do NOT generate content manually.
73
+ 2. **Script Execution Failure**: `node ... update-progress.js` fails → STOP. Do NOT manually create/edit JSON files.
74
+ 3. **Missing Intermediate Artifacts**: `.feature-analysis.md` missing before Phase 3b, or `.feature-design-data.md` missing before Phase 3d → STOP.
75
+ 4. **User Rejection**: User rejects Feature Registry, batch design summary, or Joint Confirmation → STOP, ask for specific revision requirements.
76
+ 5. **Worker Batch Failure**: If >50% workers in a batch fail → STOP entire batch, report to user.
77
+
39
78
  # Workflow
40
79
 
41
80
  ## Phase 0: Workflow Progress Management
@@ -66,6 +105,8 @@ Before starting any feature design work:
66
105
  node speccrew-workspace/scripts/update-progress.js update-workflow --file speccrew-workspace/iterations/{iteration-id}/WORKFLOW-PROGRESS.json --stage 02_feature_design --status in_progress
67
106
  ```
68
107
 
108
+ > **PowerShell Compatibility**: On Windows PowerShell, do not use backslash (`\`) for line continuation. Write the entire command on a single line.
109
+
69
110
  ### 0.2 Check Resume State (Checkpoint Recovery)
70
111
 
71
112
  If resuming from an interrupted session:
@@ -283,137 +324,231 @@ When involving related business domains, read `speccrew-workspace/knowledges/biz
283
324
  - Technical architecture documents (handled by speccrew-system-designer)
284
325
  - Code conventions (handled by speccrew-system-designer/speccrew-dev)
285
326
 
286
- ## Phase 3: Design — Worker Dispatch
327
+ ## Phase 3: Feature Design — Three-Stage Pipeline
287
328
 
288
329
  > ⚠️ **MANDATORY RULES FOR PHASE 3:**
289
- > 1. **DO NOT ask user which strategy to use** — the strategy is determined by Phase 2 extraction results, not user choice.
290
- > 2. **DO NOT invoke the Feature Design skill directly** when there are multiple Features. You MUST dispatch `speccrew-task-worker` agents.
291
- > 3. **Dispatch granularity is PER FEATURE, not per module.** Each Feature gets its own worker and its own output file.
292
- > 4. **DO NOT generate Feature Spec documents yourself.** Your role is to DISPATCH workers, not to write specs.
330
+ > 1. **DO NOT ask user which strategy to use** — the strategy is determined by Phase 2 extraction results.
331
+ > 2. **DO NOT invoke skills directly** when there are multiple Features. You MUST dispatch `speccrew-task-worker` agents.
332
+ > 3. **Dispatch granularity is PER FEATURE, not per module.** Each Feature gets its own worker per phase.
333
+ > 4. **DO NOT generate Feature Spec documents yourself.** Your role is to DISPATCH workers.
334
+ > 5. **Phase 3a → 3b → 3c → 3d is STRICTLY SERIAL.** Each phase must complete before the next begins.
335
+ > 6. **Intermediate artifacts are MANDATORY.** .feature-analysis.md must exist before Phase 3b. .feature-design-data.md must exist before Phase 3d.
293
336
 
294
- ### 3.1 Dispatch Mode Decision
337
+ ---
295
338
 
296
- Based on Phase 2 Feature Breakdown extraction:
339
+ ### Phase 3a: Analyze Function Decomposition
297
340
 
298
- | Condition | Dispatch Mode | Behavior |
299
- |-----------|---------------|----------|
300
- | 2+ Features in registry | Worker dispatch | Each Feature gets its own worker |
301
- | 1 Feature in registry | Direct skill invocation | Invoke skill directly |
341
+ **Purpose**: Decompose PRD requirements into implementable functions with system relationship markers.
302
342
 
303
- ### 3.2 Single Feature (Direct Skill Invocation)
343
+ **Skill**: `speccrew-fd-feature-analyze/SKILL.md`
304
344
 
305
- If the entire iteration has only **one Feature** in the registry:
345
+ #### Single Feature (Direct Invocation)
306
346
 
307
- Invoke Skill directly with parameters:
308
- - Skill path: `speccrew-fd-feature-design/SKILL.md`
347
+ If only **1 Feature** in registry:
348
+
349
+ - Skill path: `speccrew-fd-feature-analyze/SKILL.md`
309
350
  - Parameters:
310
- - `prd_path`: Path to the PRD document (Master PRD if exists, otherwise the single PRD)
351
+ - `prd_path`: Path to the Sub-PRD document
311
352
  - `feature_id`: Feature ID (e.g., `F-CRM-01`)
312
353
  - `feature_name`: Feature name (e.g., `Customer List Management`)
313
354
  - `feature_type`: `Page+API` or `API-only`
314
- - `output_path`: `speccrew-workspace/iterations/{iteration}/02.feature-design/{feature_id}-{feature-name-slug}-feature-spec.md`
355
+ - `iteration_id`: Current iteration identifier
315
356
  - `frontend_platforms`: List of frontend platforms from techs-manifest
357
+ - Wait for Checkpoint A completion (skill internal handling)
316
358
 
317
- ### 3.3 Multiple Features (Parallel Worker Dispatch)
359
+ #### Multiple Features (Worker Dispatch)
318
360
 
319
- If the iteration has **2+ Features** in the registry:
361
+ If **2+ Features** in registry:
320
362
 
321
- ⚠️ **YOU MUST dispatch `speccrew-task-worker` agents. DO NOT invoke the skill yourself.**
363
+ 1. **Initialize/Update DISPATCH-PROGRESS.json**:
364
+ ```bash
365
+ node speccrew-workspace/scripts/update-progress.js init-dispatch --file speccrew-workspace/iterations/{iteration}/02.feature-design/DISPATCH-PROGRESS.json --stage 02_feature_design_analyze --tasks "F-CRM-01,F-CRM-02,F-CRM-03"
366
+ ```
322
367
 
323
- #### Step 1: Initialize Dispatch Progress Tracking
368
+ 2. **Dispatch Workers** (batch of 6):
369
+ - Each worker receives:
370
+ - `skill_path`: `speccrew-fd-feature-analyze/SKILL.md`
371
+ - `context`:
372
+ - `prd_path`: Path to Sub-PRD
373
+ - `feature_id`: Feature ID
374
+ - `feature_name`: Feature name
375
+ - `feature_type`: `Page+API` or `API-only`
376
+ - `iteration_id`: Current iteration
377
+ - `frontend_platforms`: Platform list
378
+ - `skip_checkpoint`: `true` (batch mode skips per-feature confirmation)
324
379
 
325
- Before dispatching workers, initialize `DISPATCH-PROGRESS.json`:
380
+ 3. **Wait for batch completion**, update progress per worker
326
381
 
327
- ```bash
328
- node speccrew-workspace/scripts/update-progress.js init-dispatch \
329
- --file speccrew-workspace/iterations/{iteration}/02.feature-design/DISPATCH-PROGRESS.json \
330
- --tasks "F-CRM-01,F-CRM-02,F-CRM-03"
331
- ```
382
+ 4. **All completed**: Agent presents function breakdown summary → **HARD STOP**
383
+ - Display summary table: Feature ID | Function Count | [EXISTING] | [MODIFIED] | [NEW]
384
+ - Ask user: "Does this function breakdown align with your understanding?"
385
+ - Wait for explicit confirmation before proceeding to Phase 3b
332
386
 
333
- Each task entry records:
334
- - `feature_id`: Feature identifier
335
- - `feature_name`: Feature name
336
- - `feature_type`: `Page+API` or `API-only`
337
- - `source_prd`: Path to the source PRD document
338
- - `status`: `pending` | `in_progress` | `completed` | `failed`
339
- - `output_path`: Path to the generated Feature Spec
387
+ **Output**: One `.feature-analysis.md` per Feature
340
388
 
341
- #### Step 2: Dispatch Workers
389
+ ---
342
390
 
343
- Invoke `speccrew-task-worker` agents in parallel, **one worker per Feature** (NOT per module):
344
- - Each worker receives:
345
- - `skill_path`: `speccrew-fd-feature-design/SKILL.md`
346
- - `context`:
347
- - `feature_id`: Feature ID (e.g., `F-CRM-01`)
348
- - `feature_name`: Feature name (e.g., `Customer List Management`)
349
- - `feature_type`: `Page+API` or `API-only`
350
- - `master_prd_path`: Path to the Master PRD document (if exists)
351
- - `source_prd_path`: Path to the Sub-PRD containing this Feature
352
- - `prd_path`: Path to the Sub-PRD containing this Feature (same as source_prd_path, required by speccrew-fd-feature-design skill)
353
- - `output_path`: `speccrew-workspace/iterations/{iteration}/02.feature-design/{feature_id}-{feature-name-slug}-feature-spec.md`
354
- - `frontend_platforms`: List of frontend platforms from techs-manifest
355
- - **Note**: `prd_path` and `source_prd_path` refer to the same Sub-PRD file. `prd_path` is the primary field required by the Feature Design skill.
356
-
357
- - **Parallel execution pattern**:
358
- - Worker 1: Feature F-CRM-01 → Feature Spec for Customer List
359
- - Worker 2: Feature F-CRM-02 → Feature Spec for Customer Detail
360
- - Worker N: Feature F-CRM-0N → Feature Spec for Feature N
361
-
362
- - **Batch dispatch for large feature counts**:
363
- When total features > 6, dispatch in batches to avoid overload:
364
- ```
365
- Batch 1: Dispatch up to 6 workers (Features 1-6)
366
- Wait for all workers in Batch 1 to complete
367
- Update .checkpoints.json feature_spec_status for completed features
368
-
369
- Batch 2: Dispatch next 6 workers (Features 7-12)
370
- Wait for all workers in Batch 2 to complete
371
- Update .checkpoints.json feature_spec_status for completed features
372
-
373
- ... continue until all features are processed
374
- ```
375
-
376
- **Between batches**: Report progress to user:
377
- ```
378
- 📊 Batch 1 complete: 6/44 Feature Specs generated
379
- Starting Batch 2...
380
- ```
381
-
382
- - **Dependency handling**: Features with dependencies should note them, but all workers can execute simultaneously (each Feature Spec references its dependencies)
383
-
384
- - **Output file naming convention**:
385
- - Format: `{feature-id}-{feature-name-slug}-feature-spec.md`
386
- - Example: `F-CRM-01-customer-list-feature-spec.md`
387
- - Slug: lowercase, hyphens for spaces, no special characters
388
-
389
- ### 3.4 Error Handling
390
-
391
- When a worker reports failure:
392
-
393
- 1. **Update status**: Set the failed feature's `feature_spec_status` to `failed` in `.checkpoints.json`
394
-
395
- 2. **Log error**: Record the error message in `DISPATCH-PROGRESS.json` via:
391
+ ### Phase 3b: Design Feature Specification
392
+
393
+ **Purpose**: Transform function decomposition into complete feature specifications.
394
+
395
+ **Prerequisite**: All Phase 3a outputs exist (`.feature-analysis.md` for each Feature)
396
+
397
+ **Skill**: `speccrew-fd-feature-design/SKILL.md`
398
+
399
+ #### Single Feature (Direct Invocation)
400
+
401
+ - Skill path: `speccrew-fd-feature-design/SKILL.md`
402
+ - Parameters:
403
+ - `feature_analysis_path`: Path to `.feature-analysis.md` from Phase 3a
404
+ - `prd_path`: Path to Sub-PRD
405
+ - `feature_id`: Feature ID
406
+ - `feature_name`: Feature name
407
+ - `feature_type`: `Page+API` or `API-only`
408
+ - `frontend_platforms`: Platform list
409
+
410
+ #### Multiple Features (Worker Dispatch)
411
+
412
+ 1. **Update DISPATCH-PROGRESS.json**:
413
+ ```bash
414
+ node speccrew-workspace/scripts/update-progress.js update-stage --file speccrew-workspace/iterations/{iteration}/02.feature-design/DISPATCH-PROGRESS.json --stage 02_feature_design_design
415
+ ```
416
+
417
+ 2. **Dispatch Workers** (batch of 6):
418
+ - Each worker receives:
419
+ - `skill_path`: `speccrew-fd-feature-design/SKILL.md`
420
+ - `context`:
421
+ - `feature_analysis_path`: Path to `.feature-analysis.md`
422
+ - `prd_path`: Path to Sub-PRD
423
+ - `feature_id`: Feature ID
424
+ - `feature_name`: Feature name
425
+ - `feature_type`: `Page+API` or `API-only`
426
+ - `frontend_platforms`: Platform list
427
+
428
+ 3. **Wait for batch completion**, update progress
429
+
430
+ **Output**: One `.feature-design-data.md` per Feature
431
+
432
+ ---
433
+
434
+ ### Phase 3c: Confirm — Batch Design Review (Multi-Feature Only)
435
+
436
+ **Condition**: Execute ONLY when 2+ Features exist
437
+
438
+ **Purpose**: Present batch design summary and obtain user confirmation before final generation.
439
+
440
+ 1. **Read all `.feature-design-data.md` files**
441
+
442
+ 2. **Build Batch Design Summary**:
443
+
444
+ | Feature ID | Feature Name | Functions | Frontend Components | APIs | Data Entities |
445
+ |------------|--------------|-----------|---------------------|------|---------------|
446
+ | F-CRM-01 | Customer List | 5 | 3 | 4 | 2 new, 1 mod |
447
+ | F-CRM-02 | Customer Detail | 4 | 2 | 3 | 1 new |
448
+ | ... | ... | ... | ... | ... | ... |
449
+
450
+ 3. **Present to User**:
451
+ ```
452
+ 📋 Batch Design Summary
453
+
454
+ Total Features: {N}
455
+ ├── Functions Designed: {total}
456
+ ├── Frontend Components: {total}
457
+ ├── Backend APIs: {total}
458
+ └── Data Entities: {new} new, {modified} modified
459
+
460
+ [Summary table above]
461
+
462
+ ⚠️ HARD STOP — Please review all designs before proceeding to document generation.
463
+ ```
464
+
465
+ 4. **HARD STOP**: Wait for user confirmation
466
+ - If user requests modification for specific Feature → Re-dispatch design worker for that Feature only
467
+ - If user confirms → Update `.checkpoints.json` for all Features:
468
+ ```bash
469
+ node speccrew-workspace/scripts/update-progress.js write-checkpoint --file speccrew-workspace/iterations/{iteration}/02.feature-design/.checkpoints.json --checkpoint feature_spec_review --passed true
470
+ ```
471
+
472
+ ---
473
+
474
+ ### Phase 3d: Generate — Document Assembly
475
+
476
+ **Purpose**: Assemble final Feature Spec documents from design data.
477
+
478
+ **Prerequisite**:
479
+ - Single Feature: Phase 3b complete
480
+ - Multi-Feature: Phase 3c confirmation passed
481
+
482
+ **Skill**: `speccrew-fd-feature-generate/SKILL.md`
483
+
484
+ #### Single Feature (Direct Invocation)
485
+
486
+ - Skill path: `speccrew-fd-feature-generate/SKILL.md`
487
+ - Parameters:
488
+ - `feature_analysis_path`: Path to `.feature-analysis.md`
489
+ - `feature_design_data_path`: Path to `.feature-design-data.md`
490
+ - `feature_id`: Feature ID
491
+ - `feature_name`: Feature name
492
+ - `feature_type`: `Page+API` or `API-only`
493
+ - `output_path`: `speccrew-workspace/iterations/{iteration}/02.feature-design/{feature-id}-{feature-name}-feature-spec.md`
494
+ - Checkpoint B handled inside skill (user confirmation before writing)
495
+
496
+ #### Multiple Features (Worker Dispatch)
497
+
498
+ 1. **Update DISPATCH-PROGRESS.json**:
499
+ ```bash
500
+ node speccrew-workspace/scripts/update-progress.js update-stage --file speccrew-workspace/iterations/{iteration}/02.feature-design/DISPATCH-PROGRESS.json --stage 02_feature_design_generate
501
+ ```
502
+
503
+ 2. **Dispatch Workers** (batch of 6):
504
+ - Each worker receives:
505
+ - `skill_path`: `speccrew-fd-feature-generate/SKILL.md`
506
+ - `context`:
507
+ - `feature_analysis_path`: Path to `.feature-analysis.md`
508
+ - `feature_design_data_path`: Path to `.feature-design-data.md`
509
+ - `feature_id`: Feature ID
510
+ - `feature_name`: Feature name
511
+ - `feature_type`: `Page+API` or `API-only`
512
+ - `output_path`: Path for final spec
513
+ - `skip_checkpoint`: `true` (Checkpoint B already done in Phase 3c)
514
+
515
+ 3. **Wait for batch completion**
516
+
517
+ 4. **Update `.checkpoints.json`** for each completed Feature:
518
+ - Set `feature_spec_status` = `completed`
519
+
520
+ **Output**: One `{feature-id}-{feature-name}-feature-spec.md` per Feature
521
+
522
+ ---
523
+
524
+ ### Phase 3 Error Handling
525
+
526
+ When any worker (analyze/design/generate) reports failure:
527
+
528
+ 1. **Identify Phase**: Record which phase failed (3a/3b/3d) and which skill
529
+
530
+ 2. **Update status**: Set the failed feature's status in `.checkpoints.json`:
396
531
  ```bash
397
- node speccrew-workspace/scripts/update-progress.js update-task \
398
- --file speccrew-workspace/iterations/{iteration}/02.feature-design/DISPATCH-PROGRESS.json \
399
- --task {feature_id} --status failed --error "{error_message}"
532
+ node speccrew-workspace/scripts/update-progress.js update-task --file speccrew-workspace/iterations/{iteration}/02.feature-design/DISPATCH-PROGRESS.json --task {feature_id} --status failed --error "[{phase}] {error_message}"
400
533
  ```
401
534
 
402
- 3. **Continue batch**: Do NOT stop the entire batch for a single failure. Complete remaining workers in the current batch.
535
+ 3. **Continue batch**: Do NOT stop entire batch for single failure. Complete remaining workers.
403
536
 
404
- 4. **Report to user**: After each batch completes, report failures:
537
+ 4. **Report to user** (per phase):
405
538
  ```
406
- 📊 Batch 1 complete: 5/6 succeeded, 1 failed
539
+ 📊 Phase 3a (Analyze) — Batch 1 complete: 5/6 succeeded, 1 failed
407
540
  ├── ✅ F-SYS-01, F-SYS-02, F-SYS-03, F-SYS-04, F-MEMBER-01
408
541
  └── ❌ F-MEMBER-02: [error description]
409
542
 
410
543
  Retry failed features? (yes/skip/abort)
411
544
  ```
412
545
 
413
- 5. **Retry strategy**:
414
- - If user says "yes" → Re-dispatch failed features in the next batch
415
- - If user says "skip" → Mark as `skipped`, continue with remaining features
416
- - If user says "abort" → Stop dispatch, present partial results
546
+ 5. **Retry strategy**:
547
+ - If user says "yes" → Re-dispatch failed features in next batch (same phase)
548
+ - If user says "skip" → Mark as `skipped`, continue to next phase (if applicable)
549
+ - If user says "abort" → STOP workflow, report partial results
550
+
551
+ 6. **Batch failure threshold**: If >50% workers in a batch fail → STOP entire workflow, report to user
417
552
 
418
553
  ## Phase 4: API Contract Generation
419
554