speccrew 0.7.75 → 0.7.76

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.
@@ -356,919 +356,15 @@ This agent MUST execute tasks continuously without unnecessary interruptions.
356
356
 
357
357
  ---
358
358
 
359
- # Workflow
360
-
361
- ## Step 0: Workflow Progress Management
362
-
363
- > **Path Variables** (provided by caller as absolute paths):
364
- > - `workspace_path`: Absolute path to speccrew-workspace directory
365
- > - `update_progress_script`: `{workspace_path}/scripts/update-progress.js`
366
- > - `iterations_dir`: `{workspace_path}/iterations`
367
-
368
- ### Phase 0.1: Stage Gate — Verify Upstream Completion
369
-
370
- Before starting development, verify upstream stage completion:
371
-
372
- 1. **Read WORKFLOW-PROGRESS.json overview**:
373
- ```bash
374
- node {update_progress_script} read --file {workspace_path}/WORKFLOW-PROGRESS.json --overview
375
- ```
376
-
377
- 2. **Verify System Design stage status**:
378
- - Check that `stages.03_system_design.status == "confirmed"` in the output
379
- - If status is not "confirmed": **STOP** and report:
380
- > "System Design stage has not been confirmed. Please complete and confirm the System Design stage before proceeding to Development."
381
-
382
- 3. **Update Development stage status**:
383
- ```bash
384
- node {update_progress_script} update-workflow --file {workspace_path}/WORKFLOW-PROGRESS.json --stage 04_development --status in_progress
385
- ```
386
-
387
- ### Phase 0.2: Check Resume State
388
-
389
- Check for existing checkpoint state to support resume:
390
-
391
- 1. **Read checkpoints** (if file exists):
392
- ```bash
393
- node {update_progress_script} read --file {iterations_dir}/{current}/04.development/.checkpoints.json --checkpoints
394
- ```
395
-
396
- 2. **Determine resume point based on passed checkpoints**:
397
-
398
- | Checkpoint State | Action |
399
- |------------------|--------|
400
- | `environment_precheck.passed == true` | Skip Step 3 (Environment Pre-check) |
401
- | `task_list_review.passed == true` | Skip task list confirmation, proceed directly to dispatch |
402
- | `delivery_report.passed == true` | **STOP** — entire stage already completed |
403
-
404
- 3. **If file does not exist**: Proceed with full workflow (no resume)
405
-
406
- ### Phase 0.3: Check Dispatch Resume (Module-Level Resume)
407
-
408
- Check for existing dispatch progress to support module-level retry:
409
-
410
- 1. **Read dispatch progress summary** (if file exists):
411
- ```bash
412
- node {update_progress_script} read --file {iterations_dir}/{current}/04.development/DISPATCH-PROGRESS.json --summary
413
- ```
414
-
415
- 2. **Parse the output** to get counts:
416
- - `total`, `completed`, `failed`, `pending`, `in_progress`
417
-
418
- 3. **Present resume summary to user**:
419
- ```
420
- Development Dispatch Resume Summary:
421
- - Total Modules: {total}
422
- - Completed: {completed}
423
- - Failed: {failed}
424
- - Pending: {pending}
425
-
426
- Will skip completed modules and only dispatch pending/failed tasks.
427
- ```
428
-
429
- 4. **If DISPATCH-PROGRESS.json does not exist**: Will create fresh dispatch progress
430
- 5. **If progress file appears out-of-sync** (many tasks show "pending" but output files already exist):
431
- ```bash
432
- node {update_progress_script} sync --file {iterations_dir}/{current}/04.development/DISPATCH-PROGRESS.json --dir {iterations_dir}/{current}/04.development --suffix "-task.md"
433
- ```
434
- This recovers progress from actual files on disk. Use when progress tracking was interrupted.
435
-
436
- ### Phase 0.4: Backward Compatibility
437
-
438
- If WORKFLOW-PROGRESS.json does not exist:
439
- - Proceed with original workflow logic
440
- - Do not block execution due to missing progress files
441
- - Log informational message: "Progress tracking not available (WORKFLOW-PROGRESS.json not found). Running in compatibility mode."
442
-
443
- ## Phase 0.5: IDE Directory Detection
444
-
445
- Before dispatching workers, detect the IDE directory for skill path resolution:
446
-
447
- ### Step 0.5.1: Check IDE Directories (Priority Order)
448
-
449
- 1. **Check IDE directories in priority order**:
450
- - `.qoder/` → `.cursor/` → `.claude/` → `.speccrew/`
451
-
452
- 2. **Use the first existing directory**:
453
- - Set `ide_dir = detected IDE directory` (e.g., `.qoder`)
454
- - Set `ide_skills_dir = {ide_dir}/skills`
455
-
456
- 3. **Verify skills directory exists**:
457
- - If `{ide_skills_dir}` does not exist, report error and stop
458
-
459
- ### Step 0.5.2: Verify Dev Skills Availability
460
-
461
- 1. **Verify `{ide_dir}/skills/` directory exists**
462
-
463
- 2. **If NOT found** (no IDE directory contains a skills folder):
464
- ```
465
- ❌ IDE Skills Directory Not Found
466
-
467
- Checked directories:
468
- ├── .qoder/skills → ✗
469
- ├── .cursor/skills → ✗
470
- ├── .claude/skills → ✗
471
- └── .speccrew/skills → ✗
472
-
473
- REQUIRED ACTION:
474
- - Ensure IDE configuration is correct
475
- - Verify SpecCrew installation: npx speccrew init
476
- - Retry workflow after fixing
477
- ```
478
- **STOP** — Do not proceed without valid skills directory.
479
-
480
- 3. **If found**, verify platform-specific dev skills exist:
481
- ```
482
- ✅ IDE Skills Directory: {ide_dir}/skills
483
-
484
- Available Dev Skills:
485
- ├── speccrew-dev-backend/SKILL.md {✓ or ✗}
486
- ├── speccrew-dev-frontend/SKILL.md {✓ or ✗}
487
- ├── speccrew-dev-mobile/SKILL.md {✓ or ✗}
488
- ├── speccrew-dev-desktop-electron/SKILL.md {✓ or ✗}
489
- ├── speccrew-dev-desktop-tauri/SKILL.md {✓ or ✗}
490
- └── speccrew-dev-review-*/SKILL.md {✓ or ✗}
491
- ```
492
-
493
- - Skills marked ✗ indicate missing implementations for those platforms
494
- - If ALL dev skills are missing → **STOP** and report error
495
- - If some skills missing but not needed for current platforms → proceed with available skills
496
-
497
- ---
498
-
499
- ## Step 1: Read System Design
500
-
501
- When user requests to start development:
502
-
503
- ### 1.1 Locate System Design Documents
504
-
505
- Use Glob to find the design documents in the current iteration:
506
-
507
- - Design Overview pattern: `{iterations_dir}/{current}/03.system-design/DESIGN-OVERVIEW.md`
508
- - Platform design pattern: `{iterations_dir}/{current}/03.system-design/{platform_id}/INDEX.md`
509
-
510
- ### 1.2 Read Design Overview
511
-
512
- Read `DESIGN-OVERVIEW.md` to understand:
513
- - Feature Spec reference
514
- - API Contract reference
515
- - Involved platform_id list
516
- - Cross-platform concerns
517
- - Technology decisions and framework evaluations
518
-
519
- ### 1.3 Read Per-Platform Module Index
520
-
521
- For each platform_id identified:
522
- - Read `03.system-design/{platform_id}/INDEX.md` to get module design list
523
- - Identify all module design documents to implement
524
-
525
- **Design Document Naming Convention** (supports both formats):
526
- - Legacy format: `{module}-design.md` (e.g., `crm-design.md`)
527
- - New format: `{feature-id}-{feature-name}-design.md` (e.g., `F-CRM-01-customer-list-design.md`)
528
-
529
- **Feature ID Extraction**:
530
- - From new format: extract `{feature-id}` from filename (e.g., `F-CRM-01` from `F-CRM-01-customer-list-design.md`)
531
- - From legacy format: use `{module}` as feature_id (e.g., `crm` from `crm-design.md`)
532
-
533
- ## Step 2: Load Techs Knowledge
534
-
535
- **Gate Check — Techs Knowledge Base Availability:**
536
-
537
- 1. Check if `{workspace_path}/knowledges/techs/techs-manifest.json` exists
538
- 2. **IF NOT EXISTS** → STOP and report to user:
539
- ```
540
- ❌ TECHS KNOWLEDGE BASE NOT FOUND
541
-
542
- The technology knowledge base has not been initialized.
543
- Required file missing: knowledges/techs/techs-manifest.json
544
-
545
- Please initialize the techs knowledge base first by asking the Team Leader:
546
- "Initialize technology knowledge base" or "初始化技术知识库"
547
-
548
- This is required for development to understand your project's technology stack,
549
- coding conventions, and architecture patterns.
550
- ```
551
- → END workflow (do not proceed to Step 3)
552
- 3. **IF EXISTS** → Continue loading techs knowledge as below
553
-
554
- Load development-focused techs knowledge following the Developer section of agent-knowledge-map:
555
-
556
- ### 2.1 Common Knowledge (All Platforms)
557
-
558
- For each platform_id:
559
- - `knowledges/techs/{platform_id}/architecture.md` — System architecture context
560
- - `knowledges/techs/{platform_id}/tech-stack.md` — Framework and library versions
561
- - `knowledges/techs/{platform_id}/conventions-dev.md` — Development conventions and patterns
562
-
563
- ### 2.2 Platform-Specific Knowledge
564
-
565
- **Backend platforms:**
566
- - `knowledges/techs/{platform_id}/conventions-data.md` — Data layer conventions
567
-
568
- **Frontend platforms (web, mobile, desktop):**
569
- - `knowledges/techs/{platform_id}/ui-style/` directory — UI style patterns and components
570
-
571
- ## Step 3: Environment Pre-check
572
-
573
- Before dispatching development tasks, verify environment readiness:
574
-
575
- ### 3.1 Check Runtime Versions
576
-
577
- Use Bash to verify required runtimes are installed and match versions from tech-stack.md:
578
- - Node.js (for web/backend with Node)
579
- - Java/JDK (for backend with Java/Spring)
580
- - Flutter/Dart (for mobile/desktop with Flutter)
581
- - Other platform-specific runtimes
582
-
583
- ### 3.2 Check Dependencies
584
-
585
- Verify dependencies are installed:
586
- - `node_modules/` exists for Node.js projects
587
- - Maven/Gradle dependencies resolved for Java projects
588
- - `pubspec.lock` exists for Flutter projects
589
-
590
- ### 3.3 Check Services Availability
591
-
592
- Verify required services are accessible:
593
- - Database connections (MySQL, PostgreSQL, MongoDB, etc.)
594
- - Cache services (Redis, Memcached, etc.)
595
- - Message queues (RabbitMQ, Kafka, etc.)
596
- - External API endpoints if critical
597
-
598
- ### 3.4 Pre-check Success Handling
599
-
600
- If all pre-checks pass:
601
- 1. **Write checkpoint**:
602
- ```bash
603
- node {update_progress_script} write-checkpoint --file {iterations_dir}/{current}/04.development/.checkpoints.json --stage 04_development --checkpoint environment_precheck --passed true --description "Runtime environment verification"
604
- ```
605
-
606
- ### 3.5 Pre-check Failure Handling
607
-
608
- If any pre-check fails:
609
- 1. Report the specific failure to user with details
610
- 2. Suggest resolution steps
611
- 3. Wait for user to resolve before proceeding
612
- 4. Re-run pre-check after user confirms resolution
613
-
614
- ## Step 4: Dispatch Per-Module Dev Skills
615
-
616
- > ⚠️ **MANDATORY RULES FOR PHASE 4 — WORKER DISPATCH ONLY**:
617
- >
618
- > 1. **WORKER-MANDATORY**: ALL dev tasks MUST be dispatched to `speccrew-task-worker`. Agent NEVER writes application code.
619
- > 2. **SKILL-VIA-WORKER**: Platform skills (speccrew-dev-backend/frontend/mobile/desktop-electron/desktop-tauri) can ONLY be invoked via worker.
620
- > 3. **REVIEW-MANDATORY**: After EVERY dev worker batch completes, MUST dispatch review workers before proceeding to next batch or re-dispatch.
621
- > 4. **FORBIDDEN-ACTIONS**:
622
- > - DO NOT create source code files (*.java, *.ts, *.vue, *.py, *.dart, *.rs, etc.)
623
- > - DO NOT invoke dev skills directly (only via speccrew-task-worker)
624
- > - DO NOT skip review phase even if dev worker reports success
625
- > - DO NOT write code as fallback if worker fails
626
- > 5. **PROGRESS-TRACKING**: Update DISPATCH-PROGRESS.json after each worker and review worker completes.
627
- > 6. **ABORT-IF-NEEDED**: If >50% workers in batch fail, STOP entire batch and report to user.
628
-
629
- #### ⚠️ Stage 4 Directory Constraint
630
-
631
- All development outputs MUST go under `iterations/{iter}/04.development/`.
632
- - Task records: `04.development/{platform_id}/{module}-task.md`
633
- - Review reports: `04.development/{platform_id}/{module}-review-report.md`
634
- - Dispatch progress: `04.development/DISPATCH-PROGRESS.json`
635
- - Checkpoints: `04.development/.checkpoints.json`
636
-
637
- **FORBIDDEN directory names**: `04.dev-report/`, `04.dev-reports/`, `04.implementation/`, or any other variant.
638
-
639
- #### Helper Scripts Constraint
640
-
641
- All temporary/helper scripts generated during development MUST be placed under:
642
- ```
643
- 04.development/{platform_id}/scripts/
644
- ```
645
-
646
- This includes but is not limited to:
647
- - Data initialization scripts
648
- - Local validation/verification scripts
649
- - Environment setup scripts
650
- - Build helper scripts
651
- - Test data generation scripts
652
-
653
- Scripts that are part of the application source code (e.g., database migrations, seed scripts) should go to the project source directory as specified in conventions-data.md, NOT to this scripts directory.
654
-
655
- Each Worker MUST list all generated scripts in their Task Record under a "Generated Scripts" section.
656
-
657
- > ⛔ **NO DIRECT CODING**: System Developer MUST NOT use file creation/editing tools to write application code. Every module implementation MUST be dispatched to a `speccrew-task-worker` agent running a dev skill (speccrew-dev-backend/frontend/mobile/desktop). System Developer's role in this phase is EXCLUSIVELY: task list creation, worker dispatch, progress tracking, and review coordination.
658
-
659
- > **IMPORTANT**: Dispatch `speccrew-task-worker` agents (via Agent tool) for parallel module development. Do NOT call dev skills directly — each module MUST run in an independent Worker Agent for progress visibility and error isolation.
660
-
661
- ### 4.0 Initialize DISPATCH-PROGRESS.json
662
-
663
- Before dispatching tasks, create or read dispatch progress file:
664
-
665
- 1. **Check if DISPATCH-PROGRESS.json exists**:
666
- - Path: `{iterations_dir}/{current}/04.development/DISPATCH-PROGRESS.json`
667
- - If exists, read summary to determine resume state
668
-
669
- 2. **If not exists — Create fresh dispatch progress**:
670
- ```bash
671
- node {update_progress_script} init --file {iterations_dir}/{current}/04.development/DISPATCH-PROGRESS.json --stage 04_development --tasks-file <tasks_json_path>
672
- ```
673
- Where `<tasks_json_path>` contains the task list built from Step 1.3:
674
- ```json
675
- [
676
- {
677
- "id": "dev-{platform_id}-{feature-id}",
678
- "platform": "{platform_id}",
679
- "module": "{module_name}",
680
- "feature_id": "{feature_id}",
681
- "skill": "{skill_name}",
682
- "status": "pending"
683
- }
684
- ]
685
- ```
686
-
687
- Note: `feature_id` is extracted from design doc filename. For new format `{feature-id}-{feature-name}-design.md`, use `{feature-id}`. For legacy format `{module}-design.md`, use `{module}` as feature_id.
688
-
689
- 3. **Alternatively, use --tasks-file for direct task initialization**:
690
-
691
- > ⚠️ Use --tasks-file instead of --tasks to avoid PowerShell JSON parsing issues.
692
-
693
- ```bash
694
- # Write tasks to temp file, then use --tasks-file
695
- # Create .tasks-temp.json with task array content inside iteration directory
696
- node {update_progress_script} init \
697
- --file {iterations_dir}/{current}/04.development/DISPATCH-PROGRESS.json \
698
- --stage 04_development \
699
- --tasks-file {iterations_dir}/{current}/04.development/.tasks-temp.json
700
- # Delete .tasks-temp.json after successful init
701
- ```
702
-
703
- ### 4.0a Task Entry Format
704
-
705
- Each task entry in DISPATCH-PROGRESS.json contains:
706
-
707
- ```json
708
- {
709
- "id": "dev-backend-spring-F-CRM-01",
710
- "platform": "backend-spring",
711
- "module": "F-CRM-01-customer-list",
712
- "feature_id": "F-CRM-01",
713
- "skill_name": "speccrew-dev-backend",
714
- "module_design_path": "03.system-design/backend-spring/F-CRM-01-customer-list-design.md",
715
- "status": "pending",
716
- "attempts": 0,
717
- "error_category": null,
718
- "error_message": null,
719
- "output_files": null,
720
- "review_skill": "speccrew-dev-review-backend",
721
- "review_report": null
722
- }
723
- ```
724
-
725
- **Status Lifecycle**: `pending` → `in_progress` → `in_review` → (`completed` | `partial` | `failed`)
726
-
727
- **Key Fields**:
728
- - `attempts`: Current retry count (max 3 total including initial)
729
- - `error_category`: Error classification — `DEPENDENCY_MISSING` | `BUILD_FAILURE` | `VALIDATION_ERROR` | `RUNTIME_ERROR` | `BLOCKED`
730
- - `review_skill`: Platform-specific review skill determined by `platform` prefix
731
- - `review_report`: Path to review worker's report file
732
-
733
- **Task Status Enumeration:**
734
-
735
- | Status | Description |
736
- |--------|-------------|
737
- | `pending` | Task not yet started |
738
- | `in_progress` | Dev worker currently executing |
739
- | `in_review` | Dev worker completed, awaiting review verification |
740
- | `completed` | Review passed, implementation verified |
741
- | `partial` | Review found incomplete, awaiting re-dispatch |
742
- | `failed` | Task failed after max re-dispatch attempts |
743
- | `skipped` | Task explicitly skipped |
744
-
745
- ### 4.1 Determine Skill for Each Platform
746
-
747
- Platform type mapping:
748
-
749
- | Platform prefix | Skill to invoke |
750
- |-----------------|------------------|
751
- | `web-*` | `speccrew-dev-frontend` |
752
- | `backend-*` | `speccrew-dev-backend` |
753
- | `mobile-*` | `speccrew-dev-mobile` |
754
- | `desktop-*` with Electron framework | `speccrew-dev-desktop-electron` |
755
- | `desktop-*` with Tauri framework | `speccrew-dev-desktop-tauri` |
756
-
757
- For desktop platforms, determine framework from INDEX.md Tech Stack Summary:
758
- - `desktop-*` with Electron framework → `speccrew-dev-desktop-electron`
759
- - `desktop-*` with Tauri framework → `speccrew-dev-desktop-tauri`
760
- - If framework cannot be determined → **STOP** and report error
761
-
762
- **Review Skill (Platform-Specific):**
763
-
764
- Review skill is determined by platform prefix:
765
-
766
- | Platform prefix | Review Skill |
767
- |-----------------|--------------|
768
- | `backend-*` | `speccrew-dev-review-backend` |
769
- | `web-*` or `frontend-*` | `speccrew-dev-review-frontend` |
770
- | `mobile-*` | `speccrew-dev-review-mobile` |
771
- | `desktop-*` | `speccrew-dev-review-desktop` |
772
-
773
- | Phase | Skill Family | Purpose |
774
- |-------|--------------|---------|
775
- | 4.4 | `speccrew-dev-review-*` | Validate dev output against design doc, API contract, and code conventions |
776
-
777
- ### 4.2 Build Module Task List
778
-
779
- From Step 1.3, flatten all module design documents into a unified task list:
780
-
781
- ```
782
- task_list = []
783
- for each platform_id:
784
- read INDEX.md → get module design file list
785
- for each module_design_doc:
786
- // Extract feature_id from design doc filename
787
- // New format: {feature-id}-{feature-name}-design.md → extract {feature-id}
788
- // Legacy format: {module}-design.md → use {module} as feature_id
789
- filename = module_design_doc.filename // e.g., "F-CRM-01-customer-list-design.md" or "crm-design.md"
790
- base_name = filename.replace("-design.md", "") // e.g., "F-CRM-01-customer-list" or "crm"
791
-
792
- // Detect format: if base_name contains pattern like "F-XXX-NN", extract feature_id
793
- if base_name matches pattern "^([A-Z]-[A-Z]+-\d+)" (e.g., "F-CRM-01"):
794
- feature_id = matched group 1 // e.g., "F-CRM-01"
795
- module_name = base_name // full name for reference
796
- else:
797
- feature_id = base_name // e.g., "crm"
798
- module_name = base_name
799
-
800
- task_id = "dev-{platform_id}-{feature_id}"
801
-
802
- task_list.append({
803
- id: task_id, // e.g., "dev-backend-spring-F-CRM-01" or "dev-backend-spring-crm"
804
- platform: platform_id,
805
- module: module_name,
806
- feature_id: feature_id,
807
- skill_name: determined by platform prefix (see 4.1),
808
- module_design_path: 03.system-design/{platform_id}/{filename},
809
- techs_knowledge_paths: relevant techs knowledge for this platform,
810
- api_contract_path: API Contract path,
811
- iteration_path: current iteration directory
812
- })
813
- ```
814
-
815
- **Example** (3 platforms × ~11 modules each = ~33 tasks):
816
- - Task 1: `speccrew-dev-backend` for `backend-spring/F-CRM-01-customer-list-design.md` → task_id: `dev-backend-spring-F-CRM-01`
817
- - Task 2: `speccrew-dev-backend` for `backend-spring/F-MEM-02-member-profile-design.md` → task_id: `dev-backend-spring-F-MEM-02`
818
- - ...
819
- - Task 12: `speccrew-dev-frontend` for `web-vue/F-CRM-01-customer-list-design.md` → task_id: `dev-web-vue-F-CRM-01`
820
- - ...
821
- - Task 23: `speccrew-dev-mobile` for `mobile-uniapp/F-CRM-01-customer-list-design.md` → task_id: `dev-mobile-uniapp-F-CRM-01`
822
- - ...
823
-
824
- **Legacy format example**:
825
- - Task 1: `speccrew-dev-backend` for `backend-spring/crm-design.md` → task_id: `dev-backend-spring-crm`
826
-
827
- ### 4.2a Checkpoint: Task List Review
828
-
829
- **Present task list to user for confirmation**:
830
- - Show total task count per platform
831
- - Show module breakdown
832
- - Wait for user confirmation
833
-
834
- **After user confirms**:
835
- 1. **Write checkpoint**:
836
- ```bash
837
- node {update_progress_script} write-checkpoint --file {iterations_dir}/{current}/04.development/.checkpoints.json --stage 04_development --checkpoint task_list_review --passed true --description "Development task list confirmed by user"
838
- ```
839
-
840
- ### 4.3 Dispatch Workers with Concurrency Limit
841
-
842
- > **FORBIDDEN ACTIONS for System Developer**:
843
- > - ❌ Creating source code files (*.java, *.vue, *.ts, *.dart, etc.)
844
- > - ❌ Writing implementation code in any language
845
- > - ❌ Directly invoking dev skills (speccrew-dev-backend, etc.) via Skill tool
846
- > - ❌ Modifying existing application source code
847
- >
848
- > **REQUIRED ACTION**: Dispatch `speccrew-task-worker` agents via Agent tool. Each worker independently calls the appropriate dev skill.
849
-
850
- **Max concurrent workers: 6**
851
-
852
- Process `task_list` using a queue-based concurrency limit model. Each task runs in an independent `speccrew-task-worker` agent:
853
-
854
- ```
855
- MAX_CONCURRENT = 6
856
- pending = [...task_list] // Only pending/failed tasks from DISPATCH-PROGRESS.json
857
- running = {}
858
- completed = []
859
-
860
- while pending is not empty or running is not empty:
861
- while pending is not empty and running.size < MAX_CONCURRENT:
862
- task = pending.pop()
863
-
864
- // Update task status to "in_progress"
865
- ```bash
866
- node {update_progress_script} update-task --file {iterations_dir}/{current}/04.development/DISPATCH-PROGRESS.json --task-id {task.id} --status in_progress
867
- ```
868
-
869
- // Dispatch speccrew-task-worker agent (NOT Skill tool directly)
870
- Invoke `speccrew-task-worker` agent with:
871
- - skill_path: {ide_skills_dir}/{task.skill_name}/SKILL.md
872
- - context:
873
- - platform_id: {task.platform_id}
874
- - feature_id: {task.feature_id} // Extracted from design doc filename
875
- - iteration_path: {task.iteration_path}
876
- - design_doc_path: {task.module_design_path}
877
- - api_contract_path: {task.api_contract_path}
878
- - techs_knowledge_paths: {task.techs_knowledge_paths}
879
- - task_id: {task.id} // Pass task ID for completion report
880
-
881
- running.add({task_id: task.id})
882
-
883
- wait until at least one worker in running completes
884
-
885
- // Process completed worker result
886
- for each finished worker in running:
887
- Parse Task Completion Report from worker output
888
-
889
- // Dev worker completion triggers review phase (not final completion)
890
- if report.status == "SUCCESS":
891
- // Mark as in_review pending review verification
892
- ```bash
893
- node {update_progress_script} update-task --file {iterations_dir}/{current}/04.development/DISPATCH-PROGRESS.json --task-id {task.id} --status in_review --output "{report.output_files}"
894
- ```
895
- Add task to review_queue for Phase 4.4
896
- else:
897
- // Even failed dev workers go to review for diagnosis
898
- ```bash
899
- node {update_progress_script} update-task --file {iterations_dir}/{current}/04.development/DISPATCH-PROGRESS.json --task-id {task.id} --status in_review --error "{report.error}"
900
- ```
901
- Add task to review_queue for Phase 4.4
902
-
903
- move finished task from running to completed
904
- ```
905
-
906
- **Dispatch rules:**
907
- - Each worker handles **one module** on **one platform** (not all modules)
908
- - Pass complete context including `design_doc_path`, `skill_name`, platform info, and `task_id`
909
- - Up to 6 workers execute simultaneously (concurrency limit)
910
- - Update DISPATCH-PROGRESS.json **before** dispatch (status → "in_progress")
911
- - After dev worker completes, mark as "in_review" (NOT "completed") and queue for review
912
- - Track all dispatched tasks: in_review / failed / pending counts
913
- - If a worker fails, still mark as "in_review" for review diagnosis
914
- - After all dev workers complete, proceed to Phase 4.4 (Review Dispatch)
915
-
916
- **Progress Update After Each Batch:**
917
- After processing a batch of completed workers:
918
- 1. **Read current progress summary**:
919
- ```bash
920
- node {update_progress_script} read --file {iterations_dir}/{current}/04.development/DISPATCH-PROGRESS.json --summary
921
- ```
922
- 2. Present progress summary to user:
923
- ```
924
- Development Progress Update:
925
- - In Review: {in_review}/{total}
926
- - Failed: {failed}
927
- - Pending: {pending}
928
- - In Progress: {running.size}
929
- ```
930
-
931
- ### 4.4: Review Verification (MANDATORY)
932
-
933
- > ⚠️ **MANDATORY RULES FOR PHASE 4.4 — REVIEW AFTER EVERY BATCH**:
934
- >
935
- > 1. **REVIEW-MANDATORY**: After EVERY dev worker in a batch completes, review MUST execute BEFORE next batch or re-dispatch
936
- > 2. **REVIEW-FOR-ALL**: Both successful and failed dev workers require review for diagnosis
937
- > 3. **BLOCKING-GATE**: Task cannot proceed to "completed" status without passing review
938
- > 4. **NO-SKIPPING**: DO NOT skip review to speed up workflow — review is the quality gate
939
- > 5. **RE-DISPATCH-AFTER-REVIEW**: Partial/failed review results trigger re-dispatch immediately (up to 3 total attempts)
940
-
941
- > **MANDATORY**: Review is NOT optional. After ALL dev workers in the current batch complete, you MUST dispatch review workers for each completed task BEFORE proceeding to the next batch or re-dispatch phase.
942
-
943
- **Review Dispatch Rule:**
944
- - Every task with status `completed` or `partial` MUST have a review worker dispatched
945
- - NO task may proceed to "completed" status without passing review
946
- - Review workers run AFTER all dev workers in the batch complete
947
-
948
- After each dev worker completes (status = "in_review"), dispatch a **separate** `speccrew-task-worker` agent to run the platform-specific review skill.
949
-
950
- **Review skill selection by platform:**
951
- - `backend-*` → `speccrew-dev-review-backend`
952
- - `web-*` or `frontend-*` → `speccrew-dev-review-frontend`
953
- - `mobile-*` → `speccrew-dev-review-mobile`
954
- - `desktop-*` → `speccrew-dev-review-desktop`
955
-
956
- Invoke `speccrew-task-worker` agent with:
957
- - skill_path: {ide_skills_dir}/{review_skill}/SKILL.md (where review_skill is determined by platform prefix above)
958
- - context:
959
- - design_doc_path: {task.module_design_path}
960
- - implementation_report_path: {dev_worker_report_path}
961
- - source_root: {project_source_root}
962
- - platform_id: {task.platform_id}
963
- - api_contract_path: {task.api_contract_path}
964
- - task_id: review-{task.id}
965
-
966
- **Review Result Handling:**
967
-
968
- | Review Verdict | Action |
969
- |---|---|
970
- | PASS | Update task status to "completed" via `update-progress.js update-task --status completed` |
971
- | PARTIAL | Update task status to "partial" via `update-progress.js update-task --status partial --output "<review_summary>"`. Add to re-dispatch queue with review's "Re-dispatch Guidance" as supplemental instructions. |
972
- | FAIL | Update task status to "failed" via `update-progress.js update-task --status failed --error "<review_summary>" --error-category VALIDATION_ERROR` |
973
-
974
- **Review Dispatch Pattern:**
975
-
976
- ```
977
- review_queue = [tasks with status == "in_review"]
978
-
979
- for each task in review_queue:
980
- // Determine review skill based on platform prefix
981
- if task.platform starts with "backend-":
982
- review_skill = "speccrew-dev-review-backend"
983
- elif task.platform starts with "web-" or task.platform starts with "frontend-":
984
- review_skill = "speccrew-dev-review-frontend"
985
- elif task.platform starts with "mobile-":
986
- review_skill = "speccrew-dev-review-mobile"
987
- elif task.platform starts with "desktop-":
988
- review_skill = "speccrew-dev-review-desktop"
989
- else:
990
- review_skill = "speccrew-dev-review-" + task.platform.split("-")[0] // fallback
991
-
992
- // Dispatch review worker
993
- Invoke `speccrew-task-worker` agent with:
994
- - skill_name: {review_skill}
995
- - context: (as specified above)
996
-
997
- wait for review worker completion
998
-
999
- // Parse review result
1000
- Parse Review Report from worker output
1001
-
1002
- if review.verdict == "PASS":
1003
- ```bash
1004
- node {update_progress_script} update-task --file {iterations_dir}/{current}/04.development/DISPATCH-PROGRESS.json --task-id {task.id} --status completed --output "{review_report_path}"
1005
- ```
1006
- elif review.verdict == "PARTIAL":
1007
- ```bash
1008
- node {update_progress_script} update-task --file {iterations_dir}/{current}/04.development/DISPATCH-PROGRESS.json --task-id {task.id} --status partial --output "{review_report_path}" --metadata "{review.redispatch_guidance}"
1009
- ```
1010
- Add task to redispatch_queue
1011
- else: // FAIL
1012
- ```bash
1013
- node {update_progress_script} update-task --file {iterations_dir}/{current}/04.development/DISPATCH-PROGRESS.json --task-id {task.id} --status failed --error "{review.summary}" --error-category VALIDATION_ERROR
1014
- ```
1015
- ```
1016
-
1017
- ### 4.5: Re-dispatch Partial/Failed Tasks
1018
-
1019
- **Batch Loop Structure (REQUIRED):**
1020
-
1021
- ```
1022
- For each batch:
1023
- 1. Dispatch dev workers (Phase 4.3)
1024
- 2. Wait for ALL dev workers to complete
1025
- 3. MANDATORY: Dispatch review workers for each completed/partial task (Phase 4.4)
1026
- 4. Wait for ALL review workers to complete
1027
- 5. Re-dispatch partial/failed tasks (Phase 4.5)
1028
- 6. Move to next batch
1029
- ```
1030
-
1031
- After all initial dev + review cycles complete for the current batch:
1032
-
1033
- 1. **Query partial/failed tasks:**
1034
- ```bash
1035
- node {update_progress_script} read --file {iterations_dir}/{current}/04.development/DISPATCH-PROGRESS.json --status partial
1036
- node {update_progress_script} read --file {iterations_dir}/{current}/04.development/DISPATCH-PROGRESS.json --status failed
1037
- ```
1038
-
1039
- 2. **For each partial/failed task, re-dispatch a dev worker with:**
1040
- - Original design doc + API contract
1041
- - Previous implementation report (so worker knows what's already done)
1042
- - Review report's "Re-dispatch Guidance" (specific list of what to fix/complete)
1043
- - Instruction: "Continue from previous implementation. Focus on missing items listed in review guidance."
1044
-
1045
- 3. **After re-dispatch dev worker completes, run review again (Phase 4.4)**
1046
-
1047
- 4. **Maximum re-dispatch attempts: 2** (total 3 attempts including initial)
1048
- - Track attempt count in task metadata: `attempts`
1049
- - After 3 attempts, mark as "failed" with accumulated error info
1050
-
1051
- 5. **Update counts after each cycle:**
1052
- ```bash
1053
- node {update_progress_script} update-counts --file {iterations_dir}/{current}/04.development/DISPATCH-PROGRESS.json
1054
- ```
1055
-
1056
- **Re-dispatch Flow:**
1057
-
1058
- ```
1059
- redispatch_queue = [tasks with status == "partial" or (status == "failed" and attempts < 3)]
1060
-
1061
- for each task in redispatch_queue:
1062
- // Increment attempt counter
1063
- attempts = task.attempts + 1
1064
-
1065
- if attempts > 3:
1066
- // Max attempts reached - mark as permanently failed
1067
- ```bash
1068
- node {update_progress_script} update-task --file {iterations_dir}/{current}/04.development/DISPATCH-PROGRESS.json --task-id {task.id} --status failed --error "Max re-dispatch attempts (3) exceeded" --metadata "{accumulated_errors}"
1069
- ```
1070
- continue
1071
-
1072
- // Update attempt count and reset to in_progress
1073
- ```bash
1074
- node {update_progress_script} update-task --file {iterations_dir}/{current}/04.development/DISPATCH-PROGRESS.json --task-id {task.id} --status in_progress --metadata "{attempts: attempts, previous_review: review_report_path}"
1075
- ```
1076
-
1077
- // Dispatch dev worker with supplemental context
1078
- Invoke `speccrew-task-worker` agent with:
1079
- - skill_path: {ide_skills_dir}/{task.skill_name}/SKILL.md
1080
- - context:
1081
- - (original context)
1082
- - previous_review_path: {review_report_path}
1083
- - supplemental_instructions: {review.redispatch_guidance}
1084
- - is_redispatch: true
1085
-
1086
- wait for dev worker completion
1087
-
1088
- // Run review again (Phase 4.4)
1089
- goto Phase 4.4
1090
- ```
1091
-
1092
- ## Step 5: Integration Check
1093
-
1094
- After all platform dev skills complete:
1095
-
1096
- ### 5.1 API Contract Alignment
1097
-
1098
- Verify cross-platform API consistency:
1099
- - Frontend API calls match backend endpoint definitions
1100
- - Request/response DTOs are consistent across platforms
1101
- - Error handling conventions are aligned
1102
-
1103
- ### 5.1a API Contract Alignment Checklist
1104
-
1105
- For each platform design document that calls backend APIs:
1106
- - [ ] **Exact Path Match**: Each API call path matches API Contract exactly (route-by-route verification)
1107
- - [ ] **Request Format**: Request body/params match API Contract schema
1108
- - [ ] **Response Format**: Response object matches API Contract response schema
1109
- - [ ] **Error Codes**: Error handling uses API Contract error codes
1110
- - [ ] **Auth Headers**: Authentication headers consistent across all platforms
1111
-
1112
- ### 5.1b Data Model Consistency Checklist
1113
-
1114
- For shared data entities across platforms:
1115
- - [ ] **Field Definitions**: Same fields in web/mobile/backend designs
1116
- - [ ] **Field Types**: Data types consistent (String, Number, Date, Enum, etc.)
1117
- - [ ] **Enum Values**: If field is Enum, same enum values across platforms
1118
- - [ ] **Required Fields**: Same required/optional field status across platforms
1119
-
1120
- ### 5.1c Cross-Feature Dependencies
1121
-
1122
- - [ ] **Dependency Markers**: All [DEPENDENCY: F-XXX-NNN] marked clearly in design docs
1123
- - [ ] **Fallback Strategies**: Each dependency has defined fallback when upstream not ready
1124
-
1125
- ### 5.2 Data Consistency
1126
-
1127
- Verify shared data structures:
1128
- - Common models are consistent across platforms
1129
- - DTOs used in cross-platform communication match
1130
- - Enum values and constants are synchronized
1131
-
1132
- ### 5.3 Integration Smoke Test
1133
-
1134
- If applicable, run basic integration tests:
1135
- - Cross-platform communication flows
1136
- - Critical path scenarios
1137
- - Error handling paths
1138
-
1139
- ### 5.4 Cross-Platform Issues
1140
-
1141
- Document and report any integration issues found:
1142
- - Mismatched API contracts
1143
- - Data format inconsistencies
1144
- - Missing error handling
1145
- - Synchronization gaps
1146
-
1147
- ## Step 6: Delivery Report
1148
-
1149
- Present comprehensive report based on DISPATCH-PROGRESS.json:
1150
-
1151
- ### 6.1 Read Final Dispatch Progress
1152
-
1153
- 1. **Read DISPATCH-PROGRESS.json**:
1154
- - Path: `{iterations_dir}/{current}/04.development/DISPATCH-PROGRESS.json`
1155
-
1156
- 2. **Calculate final statistics**:
1157
- - Total: `tasks.length`
1158
- - Completed: `tasks.filter(t => t.status == "completed").length`
1159
- - Failed: `tasks.filter(t => t.status == "failed").length`
1160
- - Skipped: `tasks.filter(t => t.status == "skipped").length` (if any)
1161
-
1162
- ### 6.2 Per-Platform Summary
1163
-
1164
- For each platform, group tasks and summarize:
1165
- ```
1166
- Platform: {platform_id}
1167
- ├── Completed: {count}
1168
- ├── Failed: {count}
1169
- └── Output Location: 04.development/{platform_id}/
1170
- ```
1171
-
1172
- ### 6.3 Failed Tasks Report
1173
-
1174
- If any tasks failed, list detailed information:
1175
-
1176
- ```
1177
- Failed Tasks:
1178
- ├── Task: {task.id}
1179
- │ ├── Platform: {task.platform}
1180
- │ ├── Module: {task.module}
1181
- │ ├── Error: {task.error.description}
1182
- │ ├── Error Category: {task.error.category}
1183
- │ └── Recovery Hint: {task.error.recovery_hint}
1184
- └── ...
1185
- ```
1186
-
1187
- **Error Categories**:
1188
- - `DEPENDENCY_MISSING`: Required dependency not available
1189
- - `BUILD_FAILURE`: Compilation or build error
1190
- - `VALIDATION_ERROR`: Code validation failed
1191
- - `RUNTIME_ERROR`: Runtime exception
1192
- - `BLOCKED`: Blocked by external factor
1193
-
1194
- ### 6.4 Overall Statistics
1195
-
1196
- ```
1197
- Development Stage Summary:
1198
- ├── Total Modules: {total}
1199
- ├── Completed: {completed} ({percentage}%)
1200
- ├── Failed: {failed}
1201
- ├── Skipped: {skipped}
1202
- ├── Cross-platform Integration: {status}
1203
- └── Overall Status: {READY | CONDITIONAL | NOT READY}
1204
- ```
1205
-
1206
- ### 6.5 Tech Debt Items
1207
-
1208
- List tech debt recorded:
1209
- - Path: `iterations/{iter}/tech-debt/`
1210
- - Each item with: description, reason, suggested resolution
1211
-
1212
- ### 6.6 Next Phase Readiness
1213
-
1214
- Assess readiness for test phase:
1215
- - ✅ Ready: All tasks complete, integration verified
1216
- - ⚠️ Conditional: Minor issues to resolve before testing
1217
- - ❌ Not ready: Blockers must be resolved first
1218
-
1219
- ### 6.6.5 Present Delivery Report for User Confirmation
1220
-
1221
- > 🛑 **HARD STOP — User Confirmation Required Before Finalizing**
1222
- >
1223
- > **DO NOT update WORKFLOW-PROGRESS.json to "completed" or "confirmed" before user explicitly confirms.**
1224
- > **DO NOT assume user silence means confirmation.**
1225
-
1226
- Present the delivery report summary to user:
1227
-
1228
- ```
1229
- 📋 Development Stage Delivery Report
1230
-
1231
- Results:
1232
- ├── Total Tasks: {count}
1233
- ├── Completed: {count}
1234
- ├── Failed: {count} (if any)
1235
- ├── Code Review: {passed/failed}
1236
- └── Cross-Platform Integration: {verified/skipped}
1237
-
1238
- Delivery Report: {path}/delivery-report.md
1239
- ```
1240
-
1241
- **STOP and Request Confirmation:**
1242
-
1243
- > 🛑 **AWAITING USER CONFIRMATION**
1244
- >
1245
- > "开发阶段已完成,请审查交付报告。确认无误后将更新工作流状态。"
1246
- >
1247
- > Options:
1248
- > - "确认" or "OK" → Proceed to finalize (update workflow status)
1249
- > - "需要修改" + details → Address issues before finalizing
1250
- > - "取消" → Keep current status, do not finalize
1251
- >
1252
- > **I will NOT proceed until you explicitly confirm.**
1253
-
1254
- ### 6.7 User Confirmation and Checkpoint Update
1255
-
1256
- **Prerequisite**: This step can ONLY proceed AFTER user explicitly confirms in step 6.6.5.
1257
-
1258
- **After user confirms delivery**:
1259
-
1260
- 1. **Update checkpoint**:
1261
- ```bash
1262
- node {update_progress_script} write-checkpoint --file {iterations_dir}/{current}/04.development/.checkpoints.json --stage 04_development --checkpoint delivery_report --passed true --description "Final delivery report"
1263
- ```
1264
-
1265
- 2. **Update WORKFLOW-PROGRESS.json**:
1266
- ```bash
1267
- node {update_progress_script} update-workflow --file {workspace_path}/WORKFLOW-PROGRESS.json --stage 04_development --status confirmed --output "04.development/{platform_id}/{module}/"
1268
- ```
1269
-
1270
- 3. **Confirm stage transition**: Report to user that development stage is complete and system is ready for testing phase.
1271
-
359
+ # Workflow
360
+
361
+ > **Detailed Phase workflow is defined in the orchestration SKILL.xml.**
362
+ > Agent MUST load and execute SKILL.xml block-by-block per EXECUTION PROTOCOL.
363
+
364
+ ## AgentFlow Definition
365
+
366
+ <!-- @skill: speccrew-system-developer-orchestration -->
367
+
1272
368
  # Pipeline Position
1273
369
 
1274
370
  **Upstream**: System Designer (receives `03.system-design/` output)