speccrew 0.3.1 → 0.3.3

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.
@@ -175,12 +175,123 @@ Pass the following context to the Skill:
175
175
  - Pre-skill assessment results (clarification_status, expected_complexity, etc.)
176
176
  - Clarification Q&A records (if any)
177
177
 
178
+ ---
179
+
180
+ ## Phase 3: Sub-PRD Worker Dispatch (Master-Sub Structure Only)
181
+
182
+ **IF the Skill output includes a Sub-PRD Dispatch Plan (from Step 12c), execute this phase.**
183
+ **IF Single PRD structure, skip to Phase 4.**
184
+
185
+ After the Skill generates the Master PRD and outputs the dispatch plan, the PM Agent takes over to generate Sub-PRDs in parallel using worker agents.
186
+
187
+ ### 3.1 Read Dispatch Plan
188
+
189
+ From the Skill's Step 12c output, collect:
190
+ - `feature_name`: System-level feature name
191
+ - `template_path`: Path to PRD-TEMPLATE.md
192
+ - `master_prd_path`: Path to the generated Master PRD
193
+ - `output_dir`: Directory for Sub-PRD files (same as Master PRD directory)
194
+ - Module list with context for each module:
195
+ - `module_name`, `module_key`, `module_scope`, `module_entities`
196
+ - `module_user_stories`, `module_requirements`, `module_features`
197
+ - `module_dependencies`
198
+
199
+ ### 3.2 Dispatch Workers
200
+
201
+ Invoke `speccrew-task-worker` agents in parallel, one per module:
202
+
203
+ Each worker receives:
204
+ - `skill_path`: `speccrew-pm-sub-prd-generate/SKILL.md`
205
+ - `context`:
206
+ - `module_name`: Module name (e.g., "Customer Management")
207
+ - `module_key`: Module identifier for file naming (e.g., "customer")
208
+ - `module_scope`: What this module covers
209
+ - `module_entities`: Core business entities
210
+ - `module_user_stories`: Module-specific user stories
211
+ - `module_requirements`: Module-specific functional requirements (P0/P1/P2)
212
+ - `module_features`: Feature Breakdown entries for this module
213
+ - `module_dependencies`: Dependencies on other modules
214
+ - `master_prd_path`: Path to the Master PRD
215
+ - `feature_name`: System-level feature name
216
+ - `template_path`: Path to PRD-TEMPLATE.md
217
+ - `output_path`: `{output_dir}/{feature_name}-sub-{module_key}.md`
218
+
219
+ **Parallel execution pattern:**
220
+ ```
221
+ Worker 1: Module "customer" → crm-system-sub-customer.md
222
+ Worker 2: Module "contact" → crm-system-sub-contact.md
223
+ Worker 3: Module "opportunity" → crm-system-sub-opportunity.md
224
+ ...
225
+ Worker N: Module "{module-N}" → crm-system-sub-{module-N}.md
226
+ ```
227
+
228
+ **All workers execute simultaneously.** Wait for all workers to complete before proceeding.
229
+
230
+ ### 3.3 Collect Results
231
+
232
+ After all workers complete:
233
+
234
+ 1. **Check worker results**: Verify each worker reported success
235
+ 2. **List generated files**:
236
+ ```
237
+ 📊 Sub-PRD Generation Results:
238
+ ├── Worker 1: {module-1} → ✅ Generated ({file_size})
239
+ ├── Worker 2: {module-2} → ✅ Generated ({file_size})
240
+ ├── Worker N: {module-N} → ✅ Generated ({file_size})
241
+
242
+ Total: N workers | Completed: X | Failed: Y
243
+ ```
244
+
245
+ 3. **Handle failures**: If any worker failed:
246
+ - Report which modules failed and why
247
+ - Re-dispatch failed modules (retry once)
248
+ - If retry fails, report to user for manual intervention
249
+
250
+ ---
251
+
252
+ ## Phase 4: Verification & Confirmation
253
+
254
+ ### 4.1 Execute Verification Checklist
255
+
256
+ Return to the Skill's Step 12d for verification:
257
+ - Verify Master PRD exists and size > 2KB
258
+ - Verify all Sub-PRD files exist and each size > 3KB
259
+ - Verify Master PRD Sub-PRD Index matches actual files
260
+ - Verify each Sub-PRD contains Feature Breakdown (Section 3.4)
261
+
262
+ ### 4.2 Present Documents for User Review
263
+
264
+ Execute Skill's Step 12e to present document summary and ask user to review.
265
+
266
+ ⚠️ **HARD STOP — WAIT FOR USER CONFIRMATION**
267
+ - DO NOT update any status files yet
268
+ - DO NOT mark documents as confirmed
269
+ - DO NOT suggest proceeding to the next stage
270
+ - Wait for user to explicitly confirm (e.g., "确认", "OK", "没问题")
271
+ - IF user requests changes → make the changes, then re-present for review
272
+
273
+ ### 4.3 Finalize PRD Stage (ONLY after user explicitly confirms)
274
+
275
+ After user confirms the PRD documents are correct:
276
+
277
+ 1. Execute Skill's Step 13 to finalize:
278
+ - Use `update-progress.js` script to update WORKFLOW-PROGRESS.json with **real timestamps** (NOT LLM-generated)
279
+ - Write checkpoint file with **real timestamps** (use `node -e "console.log(new Date().toISOString())"` if script unavailable)
280
+ - Update all PRD document status lines from `📝 Draft` to `✅ Confirmed`
281
+ 2. Output completion message:
282
+ ```
283
+ ✅ PRD documents have been confirmed. PRD stage is complete.
284
+ When you are ready to proceed with Feature Design, please start a new conversation and invoke the Feature Designer Agent.
285
+ ```
286
+ 3. **END** — Do not proceed further. Do not invoke or suggest transitioning to the next stage agent.
287
+
178
288
  # Deliverables
179
289
 
180
290
  | Deliverable | Path | Notes |
181
291
  |-------------|------|-------|
182
292
  | PRD Document | `speccrew-workspace/iterations/{number}-{type}-{name}/01.prd/[feature-name]-prd.md` | Based on template from `speccrew-pm-requirement-analysis/templates/PRD-TEMPLATE.md` |
183
293
  | Business Modeling (complex) | `speccrew-workspace/iterations/{number}-{type}-{name}/01.prd/[feature-name]-bizs-modeling.md` | ISA-95 six-stage modeling, only for complex requirements |
294
+ | Sub-PRD Documents (complex) | `speccrew-workspace/iterations/{number}-{type}-{name}/01.prd/[feature-name]-sub-[module].md` | One per module, generated by worker dispatch |
184
295
 
185
296
  # Constraints
186
297
 
@@ -193,13 +304,15 @@ Pass the following context to the Skill:
193
304
  **Must do:**
194
305
  - Read business module list to confirm boundaries between requirements and existing features
195
306
  - Use templates from `speccrew-pm-requirement-analysis/templates/`
196
- - Explicitly prompt user for confirmation after PRD completion, only transition to speccrew-planner after confirmation
307
+ - Explicitly prompt user for review and confirmation after PRD completion
197
308
  - Execute Pre-Skill Requirement Assessment before invoking the Skill
198
309
  - Pass clarification context and complexity assessment to the Skill
310
+ - For complex requirements (2+ modules), dispatch Sub-PRD generation to parallel workers using `speccrew-pm-sub-prd-generate/SKILL.md`
199
311
 
200
312
  **Must not do:**
201
313
  - Do not make technical solution decisions (that's speccrew-planner's responsibility)
202
314
  - Do not skip manual confirmation to directly start the next stage
203
315
  - Do not assume business rules on your own; clarify unclear requirements with the user
204
316
  - Do not skip the clarification process, even when user provides detailed documents
317
+ - Do not automatically transition to or invoke the next stage agent (Feature Designer). The user will start the next stage in a new conversation window.
205
318
 
@@ -484,201 +484,241 @@ speccrew-workspace/iterations/{number}-{type}-{name}/01.product-requirement/
484
484
 
485
485
  If the iteration directory does not exist, refer to the `000-sample` directory structure to create it.
486
486
 
487
- ## Step 12: Write Files Using Template-Fill Workflow
487
+ ## Step 12: Write PRD Files
488
488
 
489
- ⚠️ **CRITICAL: For Master-Sub structure, you MUST generate ALL Sub-PRD files.**
490
- - **DO NOT put all module content into the Master PRD.**
491
- - **Each Sub-PRD is a SEPARATE file containing ONLY that module's requirements.**
489
+ ### Step 12a: Plan File List (MANDATORY FIRST STEP)
492
490
 
493
- ---
491
+ Before writing any file, create a complete list of ALL files to generate:
492
+
493
+ **For Single PRD Structure:**
494
+
495
+ | # | File | Path |
496
+ |---|------|------|
497
+ | 1 | PRD | {iteration}/01.prd/{feature-name}-prd.md |
494
498
 
495
- ### Step 12a: Generate Master PRD
499
+ **For Master-Sub Structure (present this table to user):**
496
500
 
497
- **For BOTH Single and Master-Sub structures:**
501
+ | # | File Type | Module | Path |
502
+ |---|-----------|--------|------|
503
+ | 1 | Master PRD | (system overview) | {iteration}/01.prd/{feature-name}-prd.md |
504
+ | 2 | Sub-PRD | {module-1-name} | {iteration}/01.prd/{feature-name}-sub-{module-1-key}.md |
505
+ | 3 | Sub-PRD | {module-2-name} | {iteration}/01.prd/{feature-name}-sub-{module-2-key}.md |
506
+ | ... | ... | ... | ... |
507
+ | N+1 | Sub-PRD | {module-N-name} | {iteration}/01.prd/{feature-name}-sub-{module-N-key}.md |
498
508
 
499
- 1. **Copy template to document path:**
500
- - Read `templates/PRD-TEMPLATE.md` (already loaded in Step 7)
501
- - Replace top-level placeholders (feature name, iteration, date)
502
- - Create document using `create_file` at: `{iteration}/01.product-requirement/{feature-name}-prd.md`
509
+ Total files: 1 (Master) + N (Sub-PRDs) = N+1 files.
503
510
 
504
- 2. **Fill Master-only content using `search_replace`:**
505
- - Section 1: Overall background, goals, success metrics
506
- - Section 2: System architecture overview (Mermaid graph TB)
507
- - Section 3: Module list with scope boundaries (from Step 6.1)
508
- - Section 4: Cross-module dependency matrix (from Step 6.2)
509
- - Section 5: Implementation phases and ordering (from Step 6.3)
510
- - Section 6: Shared entities and data contracts
511
- - Section 7: Global non-functional requirements
511
+ ⚠️ **Present this file list to user for confirmation before proceeding.**
512
+
513
+ ---
512
514
 
513
- 3. **DO NOT include module-specific content in Master:**
514
- - No module-specific user stories
515
- - No module-specific functional requirements
516
- - No module-specific Feature Breakdown tables
515
+ ### Step 12b: Generate Master PRD
516
+
517
+ 1. Read `templates/PRD-TEMPLATE.md` (already loaded in Step 7)
518
+ 2. Create document using `create_file` at: `{iteration}/01.prd/{feature-name}-prd.md`
519
+
520
+ 3. Fill content using `search_replace` per section:
521
+
522
+ **For Single PRD Structure** — fill ALL sections with full detail:
523
+ - Section 1 (Background & Goals): Full background, goals
524
+ - Section 2 (User Stories): All user stories with scenarios
525
+ - Section 3 (Functional Requirements): All requirements including Feature Breakdown (3.4)
526
+ - Section 4 (Non-functional Requirements): Performance, security, etc.
527
+ - Section 5 (Acceptance Criteria): All criteria
528
+ - Section 6 (Boundary Description): In/out scope
529
+ - Section 7 (Assumptions & Dependencies)
530
+
531
+ **For Master-Sub Structure** — fill ONLY system-level overview content:
532
+
533
+ > ⚠️ **Master PRD = System Overview ONLY. All module-specific details go into Sub-PRDs.**
534
+ > The Master PRD should read like an "executive summary" — a reader should understand
535
+ > WHAT the system does and HOW modules relate, but NOT the detailed features of each module.
536
+
537
+ - Section 1 (Background & Goals): System-wide background and goals (keep concise, 2-3 paragraphs max)
538
+ - Section 2 (User Stories):
539
+ - 2.1 Target Users: List all user roles with brief descriptions
540
+ - 2.2 User Scenarios: **Maximum 3-5 HIGH-LEVEL system stories.** Each story describes a MODULE-LEVEL capability, NOT individual features.
541
+ - ✅ Good: "As a store manager, I want a CRM system to manage customer relationships across all stores"
542
+ - ❌ Bad: "As a beautician, I want to upload before/after photos" (this is module-specific, belongs in Sub-PRD)
543
+ - Section 3 (Functional Requirements):
544
+ - 3.1 Use Case Diagram: System-level use case diagram showing modules as use case groups (NOT individual features)
545
+ - 3.2 Business Process Flow: ONE cross-module end-to-end process flow (the main business flow only)
546
+ - 3.3 Feature List: **ONE row per MODULE** (NOT per feature). Columns: Module, Priority, Scope Summary, Key Capabilities (brief). Maximum N rows for N modules.
547
+ - ✅ Good: `| M2-会员管理 | P0 | 顾客信息CRUD、自定义字段、公共池 |`
548
+ - ❌ Bad: Listing 24 individual features across all modules
549
+ - 3.4 Feature Breakdown: Write "See individual Sub-PRDs for module-specific Feature Breakdown"
550
+ - 3.5 Feature Details: Write "See individual Sub-PRDs for module-specific Feature Details"
551
+ - Section 4 (Non-functional Requirements): System-wide NFRs only (performance, security, compatibility — 1 line each)
552
+ - Section 5 (Acceptance Criteria): **System-wide milestones only** (e.g., "All Phase 1 modules deployed"). NOT module-specific acceptance items.
553
+ - Section 6 (Boundary Description): System-wide scope boundaries
554
+ - Section 7 (Assumptions & Dependencies): System-wide dependencies
555
+ - **APPEND after Section 7** using `search_replace` on the PRD Status line:
556
+ - **Section 8: Module Overview** — Module list table (from Step 6.1), Cross-module dependency matrix (from Step 6.2), Implementation phases (from Step 6.3)
557
+ - **Section 9: Sub-PRD Index** — List all Sub-PRD file paths with module names
517
558
 
518
559
  > ⚠️ **CRITICAL CONSTRAINTS:**
519
560
  > - **FORBIDDEN: `create_file` to rewrite the entire document**
520
561
  > - **MUST use `search_replace` to fill each section individually**
521
- > - **All section titles MUST be preserved**
562
+ > - **For Master-Sub: DO NOT include module-specific user stories, requirements, or Feature Breakdowns in the Master PRD**
522
563
 
523
564
  ---
524
565
 
525
- ### Step 12b: Generate Sub-PRDs (LOOP - MANDATORY for Master-Sub)
566
+ ### Step 12c: Sub-PRD Dispatch Plan (MANDATORY for Master-Sub)
526
567
 
527
- **IF Step 8 determined Master-Sub structure, execute this loop:**
568
+ **IF Step 8 determined Master-Sub structure:**
528
569
 
529
- ```
530
- FOR each module in module_list from Step 6.1:
531
-
532
- 12b.1: Copy template to sub_prd_path
533
- sub_prd_name = "{feature-name}-sub-{module-key}.md"
534
- sub_prd_path = "{iteration}/01.product-requirement/{sub_prd_name}"
535
-
536
- Action:
537
- 1. Read templates/PRD-TEMPLATE.md
538
- 2. Replace top-level placeholders
539
- 3. Create document using create_file at sub_prd_path
570
+ ⚠️ **IMPORTANT: Sub-PRD generation is handled by the PM Agent through parallel worker dispatch.**
571
+ **DO NOT generate Sub-PRD files sequentially in this skill.**
540
572
 
541
- 12b.2: Fill module-specific content using search_replace:
542
- - Section 1: Module-specific background and context
543
- - Section 2: Module-specific user stories
544
- - Section 3: Module-specific functional requirements
545
- - Section 3.4: Module-specific Feature Breakdown (REQUIRED)
546
- - Section 5: Module-specific acceptance criteria
547
- - Add: Interface Contracts (from Master dependency matrix)
573
+ Prepare and output the dispatch plan for the PM Agent:
548
574
 
549
- 12b.3: Verify file exists and is non-empty
550
- - Read sub_prd_path to confirm file was created
551
- - Verify file size > 1KB (not empty placeholder)
575
+ **Sub-PRD Dispatch Plan:**
552
576
 
553
- NEXT module
577
+ For each module from Step 6.1, prepare worker context:
554
578
 
555
- ⚠️ STOP condition: All modules in module_list have been processed.
556
- ```
579
+ | # | Module | module_key | Sub-PRD Path | Feature Count |
580
+ |---|--------|-----------|--------------|---------------|
581
+ | 1 | {module-1-name} | {module-1-key} | {feature-name}-sub-{module-1-key}.md | {count} |
582
+ | 2 | {module-2-name} | {module-2-key} | {feature-name}-sub-{module-2-key}.md | {count} |
583
+ | ... | ... | ... | ... | ... |
557
584
 
558
- **Example loop execution:**
559
- ```
560
- Iteration 1: Process module "inventory"
561
- Create: inventory-management-sub-inventory.md
562
- Fill: inventory-specific content
563
- Verify: file exists and has content
585
+ For each module, collect and output the following context data:
586
+ - `module_name`: Module name
587
+ - `module_key`: Module identifier (for file naming)
588
+ - `module_scope`: What this module covers (from Step 6.1)
589
+ - `module_entities`: Core entities (from Step 6.1)
590
+ - `module_user_stories`: User stories specific to this module (from Steps 1-5 analysis)
591
+ - `module_requirements`: Functional requirements for this module (P0/P1/P2)
592
+ - `module_features`: Feature Breakdown entries for this module (from Step 9.1 analysis)
593
+ - `module_dependencies`: Dependencies on other modules (from Step 6.2)
564
594
 
565
- Iteration 2: Process module "order"
566
- → Create: inventory-management-sub-order.md
567
- → Fill: order-specific content
568
- → Verify: file exists and has content
595
+ After outputting the dispatch plan:
569
596
 
570
- ... continue until all modules processed
597
+ ```
598
+ → RETURN to PM Agent for parallel worker dispatch.
599
+ → PM Agent will invoke speccrew-task-worker for each module.
600
+ → Each worker uses speccrew-pm-sub-prd-generate/SKILL.md to generate one Sub-PRD.
571
601
  ```
572
602
 
603
+ **IF Single PRD Structure:** Skip this step (no Sub-PRDs needed).
604
+
573
605
  ---
574
606
 
575
- ### Step 12c: Verification Checklist (MANDATORY)
607
+ ### Step 12d: Verification Checklist (Execute after all Sub-PRDs are generated)
576
608
 
577
- **After all PRD files are generated, verify:**
609
+ **After PM Agent confirms all workers have completed, verify:**
578
610
 
579
- ```
580
- Master PRD exists at {iteration}/01.product-requirement/{feature-name}-prd.md
581
- Master PRD file size > 2KB (not empty placeholder)
611
+ - [ ] Master PRD exists and file size > 2KB
612
+ - [ ] [Master-Sub] All {sub_prd_count} Sub-PRD files exist
613
+ - [ ] [Master-Sub] Each Sub-PRD file size > 3KB
614
+ - [ ] [Master-Sub] Master PRD Section 9 (Sub-PRD Index) matches actual files
615
+ - [ ] [Master-Sub] Each Sub-PRD contains Section 3.4 Feature Breakdown
582
616
 
583
- [For Master-Sub structure ONLY:]
584
- □ All {sub_prd_count} Sub-PRD files exist
585
- □ Each Sub-PRD file size > 3KB (not empty placeholder)
586
- □ Master PRD Section index links match actual Sub-PRD files
587
- □ No broken file references
588
- □ Each Sub-PRD contains module-specific Feature Breakdown
589
-
590
- IF any check fails → STOP and report error, fix before proceeding
591
- IF all checks pass → Proceed to Step 12d
592
- ```
617
+ IF any check fails → Report error and fix before proceeding.
593
618
 
594
619
  ---
595
620
 
596
- ### Step 12d: Request Confirmation
621
+ ### Step 12e: Present Documents for User Review
597
622
 
598
- After verification passes, show summary and request user confirmation:
623
+ Present the generated document summary to user:
599
624
 
600
- **Simple PRD Output:**
625
+ **Single PRD:**
601
626
  ```
602
- PRD generated: speccrew-workspace/iterations/XXX-{type}-{name}/01.product-requirement/[feature-name]-prd.md
627
+ PRD generated: {path}
603
628
  ```
604
629
 
605
- **Complex PRD Output (with modeling):**
630
+ **Master-Sub PRD:**
606
631
  ```
607
- Business Modeling generated: speccrew-workspace/iterations/XXX-{type}-{name}/01.product-requirement/[feature-name]-bizs-modeling.md
608
- PRD generated: speccrew-workspace/iterations/XXX-{type}-{name}/01.product-requirement/[feature-name]-prd.md
632
+ Master PRD: {master_path}
633
+ Sub-PRDs ({sub_prd_count} files):
634
+ 1. {module-1}: {sub_prd_1_path}
635
+ 2. {module-2}: {sub_prd_2_path}
636
+ ...
637
+ N. {module-N}: {sub_prd_N_path}
638
+
639
+ Total files generated: {sub_prd_count + 1}
609
640
  ```
610
641
 
611
- **Master-Sub PRD Output:**
642
+ Ask user to review the documents and check:
643
+ 1. Feature boundary accurate?
644
+ 2. Acceptance criteria quantifiable?
645
+ 3. Not In Scope complete?
646
+ 4. [Master-Sub] Module decomposition appropriate?
647
+ 5. [Existing features] EXISTING/MODIFIED/NEW markers accurate?
648
+
649
+ ⚠️ **HARD STOP — WAIT FOR USER CONFIRMATION**
650
+
612
651
  ```
613
- Master PRD generated: speccrew-workspace/iterations/XXX-{type}-{name}/01.product-requirement/[feature-name]-prd.md
614
- Sub-PRDs generated ({sub_prd_count} files):
615
- - [feature-name]-sub-[module1].md
616
- - [feature-name]-sub-[module2].md
617
- - ...
652
+ DO NOT proceed to Step 13 until user explicitly confirms.
653
+ DO NOT update any status files or mark documents as confirmed.
654
+ DO NOT suggest moving to the next stage.
655
+
656
+ Wait for user to respond with confirmation (e.g., "确认", "OK", "没问题").
657
+ IF user requests changes → make the changes, then re-present for review.
658
+ ONLY after user explicitly confirms → proceed to Step 13.
618
659
  ```
619
660
 
620
- Please confirm the following key points:
621
- 1. Is the feature boundary accurate?
622
- 2. Are the acceptance criteria quantifiable?
623
- 3. Is the Not In Scope complete?
624
- 4. **[For complex requirements]** Is the Master-Sub structure appropriate?
625
- 5. **[For existing features]** Are the [EXISTING]/[MODIFIED]/[NEW] markers accurate?
661
+ ## Step 13: Finalize PRD Stage (ONLY after user explicitly confirms)
662
+
663
+ ⚠️ **PREREQUISITE: User has explicitly confirmed the PRD documents in Step 12e.**
664
+ IF user has NOT confirmed yet → DO NOT execute this step. Return to Step 12e and wait.
626
665
 
627
- After confirmation, you can start the Solution Agent for solution planning.
666
+ ### 13a Update Workflow Progress
628
667
 
629
- ## Step 13: Write Progress Files
668
+ Use the `update-progress.js` script to update workflow status with real timestamps:
630
669
 
631
- After user confirms the PRD, write progress tracking files:
670
+ ```bash
671
+ node speccrew-workspace/scripts/update-progress.js update-workflow \
672
+ --file speccrew-workspace/iterations/{iteration}/WORKFLOW-PROGRESS.json \
673
+ --stage 01_prd --status confirmed \
674
+ --output "01.product-requirement/{feature-name}-prd.md,01.product-requirement/{feature-name}-sub-{module1}.md,..."
675
+ ```
632
676
 
633
- ### 13a Write Checkpoint File
677
+ > The script automatically generates real ISO timestamps for `completed_at` and `confirmed_at`.
678
+ > **DO NOT manually construct timestamps** — LLM-generated timestamps are always incorrect.
634
679
 
635
- Write or update the checkpoint file at:
680
+ IF the script is not available or fails, use the following shell command to get the real timestamp:
681
+ ```bash
682
+ node -e "console.log(new Date().toISOString())"
683
+ ```
684
+ Then use the output to fill in the JSON fields manually.
685
+
686
+ ### 13b Write Checkpoint File
687
+
688
+ 1. First, get the real current timestamp:
689
+ ```bash
690
+ node -e "console.log(new Date().toISOString())"
691
+ ```
692
+
693
+ 2. Write or update the checkpoint file using the REAL timestamp from the command above:
636
694
  ```
637
695
  speccrew-workspace/iterations/{iteration}/01.product-requirement/.checkpoints.json
638
696
  ```
639
697
 
640
- Content:
698
+ Content (use the REAL timestamp from the command output):
641
699
  ```json
642
700
  {
643
701
  "stage": "01_prd",
644
702
  "checkpoints": {
645
703
  "prd_review": {
646
704
  "passed": true,
647
- "confirmed_at": "<current-ISO-timestamp>",
705
+ "confirmed_at": "{REAL_TIMESTAMP_FROM_COMMAND}",
648
706
  "description": "PRD review and confirmation"
649
707
  }
650
708
  }
651
709
  }
652
710
  ```
653
711
 
654
- ### 13b Update Workflow Progress
655
-
656
- Read and update the WORKFLOW-PROGRESS.json file:
712
+ ### 13c Update PRD Document Status
657
713
 
658
- 1. **Read**: `speccrew-workspace/iterations/{iteration}/WORKFLOW-PROGRESS.json`
659
- 2. **Update the following fields**:
660
- - `current_stage` = "02_feature_design"
661
- - `01_prd.status` = "confirmed"
662
- - `01_prd.completed_at` = `<current-ISO-timestamp>`
663
- - `01_prd.confirmed_at` = `<current-ISO-timestamp>`
664
- - `01_prd.outputs` = `["01.product-requirement/{feature-name}-prd.md"]`
714
+ Update the PRD document status line from Draft to Confirmed:
665
715
 
666
- **Example updated stage entry**:
667
- ```json
668
- {
669
- "01_prd": {
670
- "status": "confirmed",
671
- "started_at": "2026-04-08T10:00:00Z",
672
- "completed_at": "2026-04-08T11:30:00Z",
673
- "confirmed_at": "2026-04-08T11:35:00Z",
674
- "outputs": [
675
- "01.product-requirement/user-management-prd.md"
676
- ]
677
- }
678
- }
679
- ```
716
+ Use `search_replace` on the Master PRD (and all Sub-PRDs if Master-Sub structure):
717
+ - Replace `📝 Draft` with `✅ Confirmed`
718
+ - Replace `[Date]` with the real date from the timestamp command
719
+ - Replace `[Name]` with `User`
680
720
 
681
- ### 13c Handle Missing Progress File
721
+ ### 13d Handle Missing Progress File
682
722
 
683
723
  If WORKFLOW-PROGRESS.json does not exist (backward compatibility):
684
724
  - Create the file with initial structure
@@ -687,6 +727,17 @@ If WORKFLOW-PROGRESS.json does not exist (backward compatibility):
687
727
 
688
728
  **Status Flow**: `pending` → `in_progress` → `completed` → `confirmed`
689
729
 
730
+ ### 13e Output Completion Message
731
+
732
+ After all status files are updated:
733
+
734
+ ```
735
+ ✅ PRD documents have been confirmed. PRD stage is complete.
736
+ When you are ready to proceed with Feature Design, please start a new conversation and invoke the Feature Designer Agent.
737
+ ```
738
+
739
+ **END** — Do not proceed further.
740
+
690
741
  ---
691
742
 
692
743
  # Knowledge Loading Strategy
@@ -0,0 +1,112 @@
1
+ ---
2
+ name: speccrew-pm-sub-prd-generate
3
+ description: Generate a single Sub-PRD document for one module. Used by PM Agent's worker dispatch to parallelize Sub-PRD generation across multiple modules. Each worker invocation generates one complete Sub-PRD file based on the PRD template.
4
+ tools: Read, Write, Glob, Grep
5
+ ---
6
+
7
+ # Trigger Scenarios
8
+
9
+ - PM Agent dispatches worker to generate Sub-PRD for a specific module
10
+ - Worker receives module context from PM Agent's dispatch plan
11
+
12
+ # Input Parameters
13
+
14
+ | Parameter | Required | Description |
15
+ |-----------|----------|-------------|
16
+ | module_name | Yes | Human-readable module name (e.g., "Customer Management") |
17
+ | module_key | Yes | Module identifier for file naming (e.g., "customer") |
18
+ | module_scope | Yes | What this module covers |
19
+ | module_entities | Yes | Core business entities in this module |
20
+ | module_user_stories | Yes | User stories specific to this module |
21
+ | module_requirements | Yes | Functional requirements for this module (P0/P1/P2) |
22
+ | module_features | Yes | Feature Breakdown entries for this module (Feature IDs, Types, Dependencies) |
23
+ | module_dependencies | No | Dependencies on other modules |
24
+ | master_prd_path | Yes | Path to the Master PRD (for cross-referencing) |
25
+ | feature_name | Yes | System-level feature name (for file naming prefix) |
26
+ | template_path | Yes | Path to PRD-TEMPLATE.md |
27
+ | output_path | Yes | Full path for the Sub-PRD output file |
28
+
29
+ # Absolute Constraints
30
+
31
+ > **These rules apply to ALL document generation steps. Violation = task failure.**
32
+
33
+ 1. **FORBIDDEN: Full-file rewrite** — NEVER replace the entire document content in a single operation. Always use targeted `search_replace` on specific sections.
34
+ 2. **MANDATORY: Template-first workflow** — Copy template MUST execute before filling sections.
35
+
36
+ # Workflow
37
+
38
+ ## Step 1: Load Context
39
+
40
+ 1. Read Master PRD at `{master_prd_path}` to understand:
41
+ - System-wide background and goals
42
+ - Cross-module dependency matrix
43
+ - This module's position in the overall system
44
+
45
+ 2. Read PRD template at `{template_path}`
46
+
47
+ ## Step 2: Create Sub-PRD File
48
+
49
+ 1. Copy template content to `{output_path}` using `create_file`
50
+ 2. Replace the title: `# PRD - [Feature Name]` → `# Sub-PRD - {module_name}`
51
+
52
+ ## Step 3: Fill Module-Specific Content
53
+
54
+ Fill each section using `search_replace`:
55
+
56
+ ### 3.1 Section 1: Background & Goals
57
+ - 1.1 Background: Why this module exists within the system, what problem it solves
58
+ - 1.2 Goals: Module-specific business objectives
59
+
60
+ ### 3.2 Section 2: User Stories
61
+ - 2.1 Target Users: Users who interact with this specific module
62
+ - 2.2 User Scenarios: Module-specific user stories in "As a / I want / So that" format
63
+
64
+ ### 3.3 Section 3: Functional Requirements
65
+ - 3.1 Use Case Diagram: Module-specific use case diagram (Mermaid flowchart TB)
66
+ - 3.2 Business Process Flow: Module-internal process flow
67
+ - 3.3 Feature List: Module features with P0/P1/P2 priority
68
+ - 3.4 Feature Breakdown: **REQUIRED** — Fill with `{module_features}` data:
69
+ - Feature ID, Feature Name, Type (Page+API / API-only), Pages/Endpoints count, Description
70
+ - Feature Dependencies table
71
+ - 3.5 Feature Details: Detailed descriptions for each feature including:
72
+ - Requirement Description
73
+ - Interaction Flow
74
+ - Boundary Conditions table
75
+ - Exception Scenarios
76
+
77
+ ### 3.4 Section 4: Non-functional Requirements
78
+ - Module-specific performance, security, compatibility requirements
79
+ - Reference Master PRD for system-wide NFRs
80
+
81
+ ### 3.5 Section 5: Acceptance Criteria
82
+ - 5.1 Must Have: Module-specific acceptance items
83
+ - 5.2 Should Have: Module-specific nice-to-have items
84
+
85
+ ### 3.6 Section 6: Boundary Description
86
+ - 6.1 In Scope: What this module covers
87
+ - 6.2 Out of Scope: What this module explicitly does NOT cover
88
+
89
+ ### 3.7 Section 7: Assumptions & Dependencies
90
+ - Dependencies on other modules (reference Master PRD dependency matrix)
91
+ - External system dependencies
92
+ - Prerequisites
93
+
94
+ > ⚠️ **FORBIDDEN: `create_file` to rewrite the entire document. MUST use `search_replace` per section.**
95
+
96
+ ## Step 4: Verify Output
97
+
98
+ 1. Read the generated file to verify:
99
+ - File exists and is non-empty
100
+ - File size > 3KB (not a placeholder)
101
+ - Section 3.4 Feature Breakdown is populated
102
+ - Title contains module name
103
+
104
+ 2. Report result:
105
+
106
+ ```
107
+ IF verification passes:
108
+ → Output: "✅ Sub-PRD generated: {output_path}"
109
+ IF verification fails:
110
+ → Output: "❌ Sub-PRD verification failed: {reason}"
111
+ → Attempt to fix the specific issue
112
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "speccrew",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "Spec-Driven Development toolkit for AI-powered IDEs",
5
5
  "author": "charlesmu99",
6
6
  "repository": {