speccrew 0.7.35 → 0.7.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/.speccrew/agents/speccrew-feature-designer.md +4 -4
  2. package/.speccrew/agents/speccrew-product-manager.md +20 -0
  3. package/.speccrew/agents/speccrew-system-deployer.md +20 -0
  4. package/.speccrew/agents/speccrew-system-designer.md +12 -0
  5. package/.speccrew/agents/speccrew-system-developer.md +11 -0
  6. package/.speccrew/agents/speccrew-team-leader.md +16 -0
  7. package/.speccrew/agents/speccrew-test-manager.md +20 -0
  8. package/.speccrew/skills/speccrew-dev-backend/SKILL.md +58 -0
  9. package/.speccrew/skills/speccrew-dev-backend/workflow.agentflow.xml +2 -0
  10. package/.speccrew/skills/speccrew-dev-desktop-electron/SKILL.md +29 -0
  11. package/.speccrew/skills/speccrew-dev-desktop-electron/workflow.agentflow.xml +2 -0
  12. package/.speccrew/skills/speccrew-dev-desktop-tauri/SKILL.md +29 -0
  13. package/.speccrew/skills/speccrew-dev-desktop-tauri/workflow.agentflow.xml +2 -0
  14. package/.speccrew/skills/speccrew-dev-frontend/SKILL.md +29 -0
  15. package/.speccrew/skills/speccrew-dev-frontend/workflow.agentflow.xml +2 -0
  16. package/.speccrew/skills/speccrew-dev-mobile/SKILL.md +29 -0
  17. package/.speccrew/skills/speccrew-dev-mobile/workflow.agentflow.xml +2 -0
  18. package/.speccrew/skills/speccrew-fd-api-contract/SKILL.md +11 -67
  19. package/.speccrew/skills/speccrew-fd-api-contract/workflow.agentflow.xml +15 -52
  20. package/.speccrew/skills/speccrew-feature-designer-orchestration/workflow.agentflow.xml +2 -2
  21. package/.speccrew/skills/speccrew-sd-backend/SKILL.md +17 -0
  22. package/.speccrew/skills/speccrew-sd-desktop/SKILL.md +17 -0
  23. package/.speccrew/skills/speccrew-sd-framework-evaluate/SKILL.md +17 -0
  24. package/.speccrew/skills/speccrew-system-designer-orchestration/workflow.agentflow.xml +9 -0
  25. package/.speccrew/skills/speccrew-system-developer-orchestration/workflow.agentflow.xml +7 -0
  26. package/package.json +1 -1
  27. package/workspace-template/scripts/update-progress.js +208 -1
@@ -742,7 +742,7 @@ Invoke API Contract skill directly:
742
742
  - `feature_spec_path`: Path to the Feature Spec document
743
743
  - `feature_id`: Feature ID (e.g., `F-CRM-01`)
744
744
  - `feature_type`: `Page+API` or `API-only`
745
- - `output_path`: `{iterations_dir}/{iteration}/02.feature-design/{feature_id}-{feature-name-slug}-api-contract.md`
745
+ - `output_path`: `{iterations_dir}/{iteration}/03.api-contract/{feature_id}-{feature-name-slug}-api-contract.md`
746
746
 
747
747
  **Note**: Both `Page+API` and `API-only` Features require API Contract documents.
748
748
 
@@ -800,7 +800,7 @@ Phase 3 deletes `.tasks-temp.json` after init. Phase 4 MUST regenerate it before
800
800
  - `feature_id`: Feature ID (e.g., `F-CRM-01`)
801
801
  - `feature_name`: Feature name — **MUST be the exact value from .checkpoints.json, used verbatim for output filename**
802
802
  - `feature_type`: `Page+API` or `API-only`
803
- - `output_path`: `{iterations_dir}/{iteration}/02.feature-design/{feature_id}-{feature-name-slug}-api-contract.md`
803
+ - `output_path`: `{iterations_dir}/{iteration}/03.api-contract/{feature_id}-{feature-name-slug}-api-contract.md`
804
804
 
805
805
  3. **Wait for batch completion**, update progress per worker:
806
806
  ```bash
@@ -864,7 +864,7 @@ After user confirms Joint Confirmation:
864
864
  node {update_progress_script} update-workflow \
865
865
  --file {iterations_dir}/{iteration}/WORKFLOW-PROGRESS.json \
866
866
  --stage 02_feature_design --status confirmed \
867
- --output "02.feature-design/F-CRM-01-customer-list-feature-spec.md,02.feature-design/F-CRM-01-customer-list-api-contract.md,..."
867
+ --output "02.feature-design/F-CRM-01-customer-list-feature-spec.md,03.api-contract/F-CRM-01-customer-list-api-contract.md,..."
868
868
  ```
869
869
 
870
870
  2. **Confirm Transition**:
@@ -876,7 +876,7 @@ After user confirms Joint Confirmation:
876
876
  | Deliverable | Path | Notes |
877
877
  |-------------|------|-------|
878
878
  | Feature Spec | `{iterations_dir}/{iteration}/02.feature-design/{feature-id}-{feature-name}-feature-spec.md` | One document per Feature |
879
- | API Contract | `{iterations_dir}/{iteration}/02.feature-design/{feature-id}-{feature-name}-api-contract.md` | One document per Feature |
879
+ | API Contract | `{iterations_dir}/{iteration}/03.api-contract/{feature-id}-{feature-name}-api-contract.md` | One document per Feature |
880
880
 
881
881
  ## Naming Convention
882
882
 
@@ -175,6 +175,12 @@ Phase 0 done. Moving to Phase 1...
175
175
  - Iteration directory naming: `{number}-{type}-{name}` (e.g., `001-feature-litemes`)
176
176
  - DO NOT manually create WORKFLOW-PROGRESS.json — MUST use `update-progress.js` script
177
177
 
178
+ **Progress Sync Recovery**: If WORKFLOW-PROGRESS.json or DISPATCH-PROGRESS.json exists but appears stale or inconsistent with actual file state, run:
179
+ ```
180
+ node "speccrew-workspace/scripts/update-progress.js" sync --phase {current_phase}
181
+ ```
182
+ This rebuilds progress from actual file system state, preventing phantom task tracking.
183
+
178
184
  ---
179
185
 
180
186
  ## Phase 1: Knowledge Base Availability Check
@@ -645,6 +651,7 @@ This agent MAY directly create/modify ONLY:
645
651
  3. ❌ DO NOT create DISPATCH-PROGRESS.json manually (use init script)
646
652
  4. ❌ DO NOT create any Sub-PRD content as fallback if worker fails
647
653
  5. ❌ DO NOT dispatch Sub-PRDs sequentially — use parallel batch (5/batch)
654
+ 6. ❌ DO NOT create temporary helper scripts (bash/powershell/node) for one-off operations — use existing workspace scripts or direct tool calls
648
655
 
649
656
  ## MANDATORY: Worker Dispatch Prompt Format (Harness Principle 22)
650
657
 
@@ -697,6 +704,19 @@ This agent MUST execute tasks continuously without unnecessary interruptions.
697
704
  3. Unrecoverable errors that prevent further progress
698
705
  4. Security-sensitive operations (e.g., deleting existing files)
699
706
 
707
+ ### FORBIDDEN ON SCRIPT FAILURE
708
+ - When a script execution fails, MUST STOP immediately
709
+ - NEVER provide A/B/C recovery options to the user
710
+ - NEVER ask "should I try alternative approach?"
711
+ - The ONLY permitted action: report the exact error and STOP
712
+
713
+ ### OUTPUT EFFICIENCY
714
+ - Worker MUST write design/code content directly to files using tools
715
+ - NEVER display file content in conversation messages
716
+ - NEVER echo back what was written to a file
717
+ - Response after file write: only confirm filename + status (e.g., "Created PRD.md ✓")
718
+ - This reduces token waste and prevents context window overflow
719
+
700
720
  ---
701
721
 
702
722
  # Deliverables
@@ -56,6 +56,7 @@ Your core task is: execute build, database migration, service startup, and smoke
56
56
  | Phase 3 | HARD STOP | User must confirm deployment results before proceeding to testing |
57
57
  | ALL | ABORT ON FAILURE | If any skill invocation fails → STOP and report. Do NOT attempt manual recovery |
58
58
  | ALL | SCRIPT ENFORCEMENT | All .checkpoints.json and WORKFLOW-PROGRESS.json updates via update-progress.js |
59
+ | ALL | ANTI-SCRIPT | Orchestrator/Worker MUST NOT create temporary helper scripts; all operations use existing workspace scripts or direct tool calls |
59
60
 
60
61
  ## MANDATORY SKILL ENFORCEMENT
61
62
 
@@ -105,6 +106,13 @@ This agent MUST execute tasks continuously without unnecessary interruptions.
105
106
  3. Unrecoverable errors that prevent further progress
106
107
  4. Skill invocation failure — report and wait for user decision
107
108
 
109
+ ### OUTPUT EFFICIENCY
110
+ - Worker MUST write design/code content directly to files using tools
111
+ - NEVER display file content in conversation messages
112
+ - NEVER echo back what was written to a file
113
+ - Response after file write: only confirm filename + status (e.g., "Created deployment-report.md ✓")
114
+ - This reduces token waste and prevents context window overflow
115
+
108
116
  ## ABORT CONDITIONS
109
117
 
110
118
  > **If ANY of the following conditions occur, the System Deployer Agent MUST immediately STOP the workflow and report to user.**
@@ -119,6 +127,12 @@ This agent MUST execute tasks continuously without unnecessary interruptions.
119
127
  8. **Script Execution Failure**: `node ... update-progress.js` fails → STOP. Do NOT manually create/edit JSON files.
120
128
  9. **Techs Knowledge Missing**: Required deployment configuration not found in techs knowledge → STOP. Report missing configuration.
121
129
 
130
+ ### FORBIDDEN ON SCRIPT FAILURE
131
+ - When a script execution fails, Worker MUST STOP immediately
132
+ - NEVER provide A/B/C recovery options to the user
133
+ - NEVER ask "should I try alternative approach?"
134
+ - The ONLY permitted action: report the exact error and STOP
135
+
122
136
  ## TIMESTAMP INTEGRITY
123
137
 
124
138
  > **All timestamps in progress files (.checkpoints.json, WORKFLOW-PROGRESS.json) are generated exclusively by `update-progress.js` script.**
@@ -186,6 +200,12 @@ If WORKFLOW-PROGRESS.json does not exist:
186
200
  - Do not block execution due to missing progress files
187
201
  - Log informational message: "Progress tracking not available (WORKFLOW-PROGRESS.json not found). Running in compatibility mode."
188
202
 
203
+ **Progress Sync Recovery**: If DISPATCH-PROGRESS.json exists but appears stale or inconsistent with actual file state, run:
204
+ ```
205
+ node "speccrew-workspace/scripts/update-progress.js" sync --phase {current_phase}
206
+ ```
207
+ This rebuilds progress from actual file system state, preventing phantom task tracking.
208
+
189
209
  ## Phase 0.5: IDE Directory Detection
190
210
 
191
211
  Before dispatching skills, detect the IDE directory for skill path resolution:
@@ -129,6 +129,7 @@ This agent MUST execute tasks continuously without unnecessary interruptions.
129
129
  | Phase 6 | HARD STOP | User must confirm all designs before finalizing |
130
130
  | ALL | ABORT ON FAILURE | If any skill invocation fails → STOP and report. Do NOT generate content manually as fallback |
131
131
  | ALL | SCRIPT ENFORCEMENT | All .checkpoints.json and WORKFLOW-PROGRESS.json updates via update-progress.js script. Manual JSON creation FORBIDDEN |
132
+ | ALL | ANTI-SCRIPT | Agent MUST NOT create custom scripts (.sh, .ps1, .js). Use only update-progress.js provided. Temporary PowerShell/Bash commands for JSON manipulation are FORBIDDEN |
132
133
 
133
134
  ## ABORT CONDITIONS
134
135
 
@@ -136,6 +137,12 @@ This agent MUST execute tasks continuously without unnecessary interruptions.
136
137
 
137
138
  1. **Skill Invocation Failure**: Framework evaluation skill or any platform design skill call returns error → STOP. Do NOT generate content manually.
138
139
  2. **Script Execution Failure**: `node ... update-progress.js` fails → STOP. Do NOT manually create/edit JSON files.
140
+
141
+ **FORBIDDEN ON SCRIPT FAILURE**:
142
+ - DO NOT provide A/B/C alternative options
143
+ - DO NOT suggest "skip to next phase"
144
+ - DO NOT run ad-hoc PowerShell/Bash commands as workaround
145
+ - ONLY correct response: "STOP: update-progress.js failed with [error]. Task: [id]. Command: [cmd]."
139
146
  3. **Missing Intermediate Artifacts**: Feature Spec not found, API Contract missing, or framework-evaluation.md not generated → STOP.
140
147
  4. **User Rejection**: User rejects framework evaluation, DESIGN-OVERVIEW, or Joint Confirmation → STOP, ask for specific revision requirements.
141
148
  5. **Worker Batch Failure**: If >50% workers in a batch fail → STOP entire batch, report to user with failure details.
@@ -656,6 +663,11 @@ Before dispatching, create or update dispatch tracking:
656
663
 
657
664
  2. **Check existing progress** (from Step 0.3) — skip `completed` tasks
658
665
  3. **Update status** to `in_progress` for tasks being dispatched:
666
+ 4. **If progress file appears out-of-sync** (many tasks show "pending" but output files already exist):
667
+ ```bash
668
+ node {update_progress_script} sync --file {iterations_dir}/{current}/03.system-design/DISPATCH-PROGRESS.json --dir {iterations_dir}/{current}/03.system-design --suffix "-design.md"
669
+ ```
670
+ This recovers progress from actual files on disk.
659
671
  ```bash
660
672
  node {update_progress_script} update-task --file {iterations_dir}/{current}/03.system-design/DISPATCH-PROGRESS.json --task-id {task_id} --status in_progress
661
673
  ```
@@ -65,6 +65,7 @@ Your core task is: based on the System Design (HOW to build), execute and coordi
65
65
  | Phase 5 | INTEGRATION-CHECK | Cross-platform API & data consistency MUST be verified before delivery |
66
66
  | ALL | ABORT ON FAILURE | If any worker fails → STOP and report. Do NOT generate code manually as fallback |
67
67
  | ALL | SCRIPT ENFORCEMENT | All progress file updates via update-progress.js script. Manual JSON creation FORBIDDEN |
68
+ | ALL | ANTI-SCRIPT | Agent and Workers MUST NOT create custom automation scripts (.sh, .ps1, .js). Use only update-progress.js provided. Temporary PowerShell/Bash commands for JSON manipulation are FORBIDDEN |
68
69
 
69
70
  ## MANDATORY WORKER ENFORCEMENT
70
71
 
@@ -158,6 +159,11 @@ This agent MUST execute tasks continuously without unnecessary interruptions.
158
159
  3. **Worker Invocation Failure**: speccrew-task-worker call fails or returns error → STOP. Do NOT attempt to write code as fallback.
159
160
  4. **Review Worker Failure**: Platform-specific review skill (speccrew-dev-review-*) fails after maximum re-dispatch attempts (3) → STOP. Report review blocker.
160
161
  5. **Script Execution Failure**: `node ... update-progress.js` fails → STOP. Do NOT manually create/edit JSON files.
162
+ **FORBIDDEN ON SCRIPT FAILURE**:
163
+ - DO NOT provide A/B/C alternative options
164
+ - DO NOT suggest "skip to next phase"
165
+ - DO NOT run ad-hoc PowerShell/Bash commands as workaround
166
+ - ONLY correct response: "STOP: update-progress.js failed with [error]. Task: [id]. Command: [cmd]."
161
167
  6. **Batch Failure Threshold**: If >50% workers in a batch fail → STOP entire batch, report to user with failure details.
162
168
  7. **Code Quality Deadlock**: If review identifies unfixable issues after 3 re-dispatch attempts → STOP and report as technical debt.
163
169
  8. **Cross-platform Integration Failure**: Critical API/data inconsistencies detected in Phase 5 that block downstream testing → STOP and report integration risks.
@@ -244,6 +250,11 @@ Check for existing dispatch progress to support module-level retry:
244
250
  ```
245
251
 
246
252
  4. **If DISPATCH-PROGRESS.json does not exist**: Will create fresh dispatch progress
253
+ 5. **If progress file appears out-of-sync** (many tasks show "pending" but output files already exist):
254
+ ```bash
255
+ node {update_progress_script} sync --file {iterations_dir}/{current}/04.development/DISPATCH-PROGRESS.json --dir {iterations_dir}/{current}/04.development --suffix "-task.md"
256
+ ```
257
+ This recovers progress from actual files on disk. Use when progress tracking was interrupted.
247
258
 
248
259
  ### Phase 0.4: Backward Compatibility
249
260
 
@@ -233,6 +233,7 @@ Turn 3: Create Task(C) → wait for completion
233
233
  - Do NOT manually create JSON files when a Skill should generate them
234
234
  - Do NOT execute analysis work that should be dispatched to a Worker via Task tool
235
235
  - Do NOT stop between stages to ask the user for direction
236
+ - Do NOT create temporary helper scripts (bash/powershell/node scripts) for one-off operations — use existing workspace scripts or direct tool calls
236
237
 
237
238
  ## CONTINUOUS EXECUTION RULES
238
239
 
@@ -254,6 +255,21 @@ This agent MUST execute tasks continuously without unnecessary interruptions.
254
255
  3. Unrecoverable errors that prevent further progress
255
256
  4. Security-sensitive operations (e.g., deleting existing files)
256
257
 
258
+ ### FORBIDDEN ON SCRIPT FAILURE
259
+
260
+ - When a script execution fails, MUST STOP immediately
261
+ - NEVER provide A/B/C recovery options to the user
262
+ - NEVER ask "should I try alternative approach?"
263
+ - The ONLY permitted action: report the exact error and STOP
264
+
265
+ ### OUTPUT EFFICIENCY
266
+
267
+ - Worker MUST write design/code content directly to files using tools
268
+ - NEVER display file content in conversation messages
269
+ - NEVER echo back what was written to a file
270
+ - Response after file write: only confirm filename + status (e.g., "Created config.json ✓")
271
+ - This reduces token waste and prevents context window overflow
272
+
257
273
  ### Batch Execution Behavior
258
274
 
259
275
  - When multiple items need processing, process ALL of them sequentially without asking
@@ -68,6 +68,7 @@ Phase 6: Delivery Summary
68
68
  | Phase 6 | JOINT-CONFIRMATION | All test reports must be confirmed by user before delivery |
69
69
  | ALL | ABORT ON FAILURE | If any worker fails → STOP and report. Do NOT generate artifacts manually as fallback |
70
70
  | ALL | SCRIPT ENFORCEMENT | All progress file updates via update-progress.js script. Manual JSON creation FORBIDDEN |
71
+ | ALL | ANTI-SCRIPT | Orchestrator/Worker MUST NOT create temporary helper scripts; all operations use existing workspace scripts or direct tool calls |
71
72
 
72
73
  ## TIMESTAMP INTEGRITY
73
74
 
@@ -147,6 +148,12 @@ If ANY of these occur, workflow is INVALID:
147
148
  7. **Critical Bugs Found**: Unresolved critical/high-severity bugs block delivery → STOP before delivery phase.
148
149
  8. **Cross-platform Inconsistency**: Test results inconsistent across platforms indicating environment issues → STOP and diagnose.
149
150
 
151
+ ### FORBIDDEN ON SCRIPT FAILURE
152
+ - When a script execution fails, Worker MUST STOP immediately
153
+ - NEVER provide A/B/C recovery options to the user
154
+ - NEVER ask "should I try alternative approach?"
155
+ - The ONLY permitted action: report the exact error and STOP
156
+
150
157
  ---
151
158
 
152
159
  ## CONTINUOUS EXECUTION RULES
@@ -176,6 +183,13 @@ This agent MUST execute tasks continuously without unnecessary interruptions.
176
183
  - If context window is approaching limit, save progress to checkpoint and inform user how to resume
177
184
  - NEVER voluntarily stop mid-batch to ask if user wants to continue
178
185
 
186
+ ### OUTPUT EFFICIENCY
187
+ - Worker MUST write design/code content directly to files using tools
188
+ - NEVER display file content in conversation messages
189
+ - NEVER echo back what was written to a file
190
+ - Response after file write: only confirm filename + status (e.g., "Created src/auth.ts ✓")
191
+ - This reduces token waste and prevents context window overflow
192
+
179
193
  # Workflow
180
194
 
181
195
  ## Phase 0: Workflow Progress Management
@@ -244,6 +258,12 @@ Dispatch Resume Status:
244
258
  └── test_execution: {completed}/{total} completed, {failed} failed, {pending} pending
245
259
  ```
246
260
 
261
+ **Progress Sync Recovery**: If DISPATCH-PROGRESS.json exists but appears stale or inconsistent with actual file state, run:
262
+ ```
263
+ node "{workspace_path}/scripts/update-progress.js" sync --phase {current_phase}
264
+ ```
265
+ This rebuilds progress from actual file system state, preventing phantom task tracking.
266
+
247
267
  ### Step 0.4: Backward Compatibility
248
268
 
249
269
  If `WORKFLOW-PROGRESS.json` does not exist:
@@ -295,6 +295,64 @@ If the skill fails at any step:
295
295
  - `RUNTIME_ERROR`: Service startup failure, runtime exception
296
296
  - `BLOCKED`: Blocked by external dependency or unresolved design issue
297
297
 
298
+ ## OUTPUT EFFICIENCY RULES
299
+
300
+ When executing this skill:
301
+
302
+ 1. **Direct-to-File Output**: All implementation code, task records, and helper scripts MUST be written directly to output files
303
+ 2. **Minimal Conversation Output**: Only output:
304
+ - Block execution announcements (1 line each): `"[Block XX] Implementing..."`
305
+ - Error messages requiring attention
306
+ - Task Completion Report (final summary)
307
+ 3. **FORBIDDEN in conversation**:
308
+ - ❌ Full source code blocks or file contents
309
+ - ❌ Complete implementation listings
310
+ - ❌ Large configuration file dumps
311
+ - ❌ Architecture diagrams displayed in chat
312
+ - ❌ API endpoint listings longer than 3 lines
313
+ 4. **Rationale**: Workers run in batch mode (up to 6 concurrent). Displaying code content in conversation wastes context window and provides no value since content goes to files anyway.
314
+
315
+ ## ABORT CONDITIONS
316
+
317
+ When script execution or build/compile fails:
318
+
319
+ 1. **STOP immediately** — Report: Task ID, error message, failed command
320
+ 2. **FORBIDDEN responses on failure**:
321
+ - ❌ DO NOT provide A/B/C alternative options
322
+ - ❌ DO NOT suggest "skip this step and continue"
323
+ - ❌ DO NOT run ad-hoc PowerShell/Bash commands as workaround
324
+ - ❌ DO NOT create temporary scripts to work around the issue
325
+ 3. **ONLY correct response**: Report the failure in Task Completion Report with status FAILED and error details
326
+
327
+ ## OUTPUT EFFICIENCY RULES
328
+
329
+ When executing this skill:
330
+
331
+ 1. **Direct-to-File Output**: All implementation code, task records, and helper scripts MUST be written directly to output files
332
+ 2. **Minimal Conversation Output**: Only output:
333
+ - Block execution announcements (1 line each): `"[Block XX] Implementing..."`
334
+ - Error messages requiring attention
335
+ - Task Completion Report (final summary)
336
+ 3. **FORBIDDEN in conversation**:
337
+ - ❌ Full source code blocks or file contents
338
+ - ❌ Complete implementation listings
339
+ - ❌ Large configuration file dumps
340
+ - ❌ Architecture diagrams displayed in chat
341
+ - ❌ API endpoint listings longer than 3 lines
342
+ 4. **Rationale**: Workers run in batch mode (up to 6 concurrent). Displaying code content in conversation wastes context window and provides no value since content goes to files anyway.
343
+
344
+ ## ABORT CONDITIONS
345
+
346
+ When script execution or build/compile fails:
347
+
348
+ 1. **STOP immediately** — Report: Task ID, error message, failed command
349
+ 2. **FORBIDDEN responses on failure**:
350
+ - ❌ DO NOT provide A/B/C alternative options
351
+ - ❌ DO NOT suggest "skip this step and continue"
352
+ - ❌ DO NOT run ad-hoc PowerShell/Bash commands as workaround
353
+ - ❌ DO NOT create temporary scripts to work around the issue
354
+ 3. **ONLY correct response**: Report the failure in Task Completion Report with status FAILED and error details
355
+
298
356
  # Key Rules
299
357
 
300
358
  | Rule | Description |
@@ -81,6 +81,7 @@
81
81
  <block type="task" id="B10" action="create-file" desc="Copy template to Task Record path">
82
82
  <field name="path">speccrew-workspace/iterations/{number}-{type}-{name}/04.development/${platform_id}/[module]-task.md</field>
83
83
  <field name="content">${task_template} with top-level placeholders replaced</field>
84
+ <field name="encoding">utf8</field>
84
85
  <field name="output" var="task_record_path"/>
85
86
  </block>
86
87
 
@@ -195,6 +196,7 @@
195
196
  <block type="task" id="B21" action="create-file" desc="Write technical debt document">
196
197
  <field name="path">speccrew-workspace/iterations/{number}-{type}-{name}/tech-debt/[module]-tech-debt.md</field>
197
198
  <field name="content">${tech_debt} using unified template</field>
199
+ <field name="encoding">utf8</field>
198
200
  <field name="output" var="tech_debt_path"/>
199
201
  </block>
200
202
  </branch>
@@ -321,6 +321,35 @@ If the skill fails at any step:
321
321
 
322
322
  ---
323
323
 
324
+ ## OUTPUT EFFICIENCY RULES
325
+
326
+ When executing this skill:
327
+
328
+ 1. **Direct-to-File Output**: All implementation code, task records, and helper scripts MUST be written directly to output files
329
+ 2. **Minimal Conversation Output**: Only output:
330
+ - Block execution announcements (1 line each): `"[Block XX] Implementing..."`
331
+ - Error messages requiring attention
332
+ - Task Completion Report (final summary)
333
+ 3. **FORBIDDEN in conversation**:
334
+ - ❌ Full source code blocks or file contents
335
+ - ❌ Complete implementation listings
336
+ - ❌ Large configuration file dumps
337
+ - ❌ Architecture diagrams displayed in chat
338
+ - ❌ API endpoint listings longer than 3 lines
339
+ 4. **Rationale**: Workers run in batch mode (up to 6 concurrent). Displaying code content in conversation wastes context window and provides no value since content goes to files anyway.
340
+
341
+ ## ABORT CONDITIONS
342
+
343
+ When script execution or build/compile fails:
344
+
345
+ 1. **STOP immediately** — Report: Task ID, error message, failed command
346
+ 2. **FORBIDDEN responses on failure**:
347
+ - ❌ DO NOT provide A/B/C alternative options
348
+ - ❌ DO NOT suggest "skip this step and continue"
349
+ - ❌ DO NOT run ad-hoc PowerShell/Bash commands as workaround
350
+ - ❌ DO NOT create temporary scripts to work around the issue
351
+ 3. **ONLY correct response**: Report the failure in Task Completion Report with status FAILED and error details
352
+
324
353
  # Key Rules
325
354
 
326
355
  | Rule | Description |
@@ -91,6 +91,7 @@
91
91
  <block type="task" id="B9" action="create-file" desc="Copy template to Task Record path">
92
92
  <field name="path">speccrew-workspace/iterations/{number}-{type}-{name}/04.development/${platform_id}/[feature-name]-task.md</field>
93
93
  <field name="content">${task_template} with top-level placeholders replaced</field>
94
+ <field name="encoding">utf8</field>
94
95
  <field name="output" var="task_record_path"/>
95
96
  </block>
96
97
 
@@ -211,6 +212,7 @@
211
212
  <block type="task" id="B22" action="create-file" desc="Write technical debt document">
212
213
  <field name="path">speccrew-workspace/iterations/{number}-{type}-{name}/tech-debt/[feature-name]-tech-debt.md</field>
213
214
  <field name="content">${tech_debt} with categories: Security, Performance, Refactoring, Dependencies</field>
215
+ <field name="encoding">utf8</field>
214
216
  <field name="output" var="tech_debt_path"/>
215
217
  </block>
216
218
  </branch>
@@ -314,6 +314,35 @@ If the skill fails at any step:
314
314
 
315
315
  ---
316
316
 
317
+ ## OUTPUT EFFICIENCY RULES
318
+
319
+ When executing this skill:
320
+
321
+ 1. **Direct-to-File Output**: All implementation code, task records, and helper scripts MUST be written directly to output files
322
+ 2. **Minimal Conversation Output**: Only output:
323
+ - Block execution announcements (1 line each): `"[Block XX] Implementing..."`
324
+ - Error messages requiring attention
325
+ - Task Completion Report (final summary)
326
+ 3. **FORBIDDEN in conversation**:
327
+ - ❌ Full source code blocks or file contents
328
+ - ❌ Complete implementation listings
329
+ - ❌ Large configuration file dumps
330
+ - ❌ Architecture diagrams displayed in chat
331
+ - ❌ API endpoint listings longer than 3 lines
332
+ 4. **Rationale**: Workers run in batch mode (up to 6 concurrent). Displaying code content in conversation wastes context window and provides no value since content goes to files anyway.
333
+
334
+ ## ABORT CONDITIONS
335
+
336
+ When script execution or build/compile fails:
337
+
338
+ 1. **STOP immediately** — Report: Task ID, error message, failed command
339
+ 2. **FORBIDDEN responses on failure**:
340
+ - ❌ DO NOT provide A/B/C alternative options
341
+ - ❌ DO NOT suggest "skip this step and continue"
342
+ - ❌ DO NOT run ad-hoc PowerShell/Bash commands as workaround
343
+ - ❌ DO NOT create temporary scripts to work around the issue
344
+ 3. **ONLY correct response**: Report the failure in Task Completion Report with status FAILED and error details
345
+
317
346
  # Key Rules
318
347
 
319
348
  | Rule | Description |
@@ -89,6 +89,7 @@
89
89
  <block type="task" id="B9" action="create-file" desc="Copy template to Task Record path">
90
90
  <field name="path">speccrew-workspace/iterations/{number}-{type}-{name}/04.development/${platform_id}/[feature-name]-task.md</field>
91
91
  <field name="content">${task_template} with top-level placeholders replaced</field>
92
+ <field name="encoding">utf8</field>
92
93
  <field name="output" var="task_record_path"/>
93
94
  </block>
94
95
 
@@ -198,6 +199,7 @@
198
199
  <block type="task" id="B21" action="create-file" desc="Write technical debt document">
199
200
  <field name="path">speccrew-workspace/iterations/{number}-{type}-{name}/tech-debt/[feature-name]-tech-debt.md</field>
200
201
  <field name="content">${tech_debt} with categories: Security, Performance, Refactoring, Dependencies</field>
202
+ <field name="encoding">utf8</field>
201
203
  <field name="output" var="tech_debt_path"/>
202
204
  </block>
203
205
  </branch>
@@ -269,6 +269,35 @@ If the skill fails at any step:
269
269
  - `RUNTIME_ERROR`: Runtime exception in browser/dev server
270
270
  - `BLOCKED`: Blocked by external dependency or unresolved design issue
271
271
 
272
+ ## OUTPUT EFFICIENCY RULES
273
+
274
+ When executing this skill:
275
+
276
+ 1. **Direct-to-File Output**: All implementation code, task records, and helper scripts MUST be written directly to output files
277
+ 2. **Minimal Conversation Output**: Only output:
278
+ - Block execution announcements (1 line each): `"[Block XX] Implementing..."`
279
+ - Error messages requiring attention
280
+ - Task Completion Report (final summary)
281
+ 3. **FORBIDDEN in conversation**:
282
+ - ❌ Full source code blocks or file contents
283
+ - ❌ Complete implementation listings
284
+ - ❌ Large configuration file dumps
285
+ - ❌ Architecture diagrams displayed in chat
286
+ - ❌ API endpoint listings longer than 3 lines
287
+ 4. **Rationale**: Workers run in batch mode (up to 6 concurrent). Displaying code content in conversation wastes context window and provides no value since content goes to files anyway.
288
+
289
+ ## ABORT CONDITIONS
290
+
291
+ When script execution or build/compile fails:
292
+
293
+ 1. **STOP immediately** — Report: Task ID, error message, failed command
294
+ 2. **FORBIDDEN responses on failure**:
295
+ - ❌ DO NOT provide A/B/C alternative options
296
+ - ❌ DO NOT suggest "skip this step and continue"
297
+ - ❌ DO NOT run ad-hoc PowerShell/Bash commands as workaround
298
+ - ❌ DO NOT create temporary scripts to work around the issue
299
+ 3. **ONLY correct response**: Report the failure in Task Completion Report with status FAILED and error details
300
+
272
301
  # Key Rules
273
302
 
274
303
  | Rule | Description |
@@ -104,6 +104,7 @@
104
104
  <block type="task" id="B12" action="create-file" desc="Copy template to Task Record path">
105
105
  <field name="path">speccrew-workspace/iterations/{number}-{type}-{name}/04.development/${platform_id}/{feature-name}-tasks.md</field>
106
106
  <field name="content">${task_template} with top-level placeholders replaced</field>
107
+ <field name="encoding">utf8</field>
107
108
  <field name="output" var="task_record_path"/>
108
109
  </block>
109
110
 
@@ -221,6 +222,7 @@
221
222
  <block type="task" id="B24" action="create-file" desc="Write tech debt document">
222
223
  <field name="path">speccrew-workspace/iterations/{number}-{type}-{name}/tech-debt/{debt-id}.md</field>
223
224
  <field name="content">${tech_debt}</field>
225
+ <field name="encoding">utf8</field>
224
226
  <field name="output" var="tech_debt_path"/>
225
227
  </block>
226
228
  </branch>
@@ -252,6 +252,35 @@ If the skill fails at any step:
252
252
  - `RUNTIME_ERROR`: App crash on simulator/emulator, runtime exception
253
253
  - `BLOCKED`: Blocked by external dependency, native module issue, or unresolved design issue
254
254
 
255
+ ## OUTPUT EFFICIENCY RULES
256
+
257
+ When executing this skill:
258
+
259
+ 1. **Direct-to-File Output**: All implementation code, task records, and helper scripts MUST be written directly to output files
260
+ 2. **Minimal Conversation Output**: Only output:
261
+ - Block execution announcements (1 line each): `"[Block XX] Implementing..."`
262
+ - Error messages requiring attention
263
+ - Task Completion Report (final summary)
264
+ 3. **FORBIDDEN in conversation**:
265
+ - ❌ Full source code blocks or file contents
266
+ - ❌ Complete implementation listings
267
+ - ❌ Large configuration file dumps
268
+ - ❌ Architecture diagrams displayed in chat
269
+ - ❌ API endpoint listings longer than 3 lines
270
+ 4. **Rationale**: Workers run in batch mode (up to 6 concurrent). Displaying code content in conversation wastes context window and provides no value since content goes to files anyway.
271
+
272
+ ## ABORT CONDITIONS
273
+
274
+ When script execution or build/compile fails:
275
+
276
+ 1. **STOP immediately** — Report: Task ID, error message, failed command
277
+ 2. **FORBIDDEN responses on failure**:
278
+ - ❌ DO NOT provide A/B/C alternative options
279
+ - ❌ DO NOT suggest "skip this step and continue"
280
+ - ❌ DO NOT run ad-hoc PowerShell/Bash commands as workaround
281
+ - ❌ DO NOT create temporary scripts to work around the issue
282
+ 3. **ONLY correct response**: Report the failure in Task Completion Report with status FAILED and error details
283
+
255
284
  # Key Rules
256
285
 
257
286
  | Rule | Description |
@@ -92,6 +92,7 @@
92
92
  <block type="task" id="B9" action="create-file" desc="Copy template to Task Record path">
93
93
  <field name="path">speccrew-workspace/iterations/{iteration}/04.development/${platform_id}/{module}-task.md</field>
94
94
  <field name="content">${task_template} with top-level placeholders replaced</field>
95
+ <field name="encoding">utf8</field>
95
96
  <field name="output" var="task_record_path"/>
96
97
  </block>
97
98
 
@@ -199,6 +200,7 @@
199
200
  <block type="task" id="B22" action="create-file" desc="Write technical debt document">
200
201
  <field name="path">speccrew-workspace/iterations/{iteration}/tech-debt/{feature-name}-tech-debt.md</field>
201
202
  <field name="content">${tech_debt} with categories: Platform-specific workarounds, Offline sync, Error handling, Accessibility, Test coverage</field>
203
+ <field name="encoding">utf8</field>
202
204
  <field name="output" var="tech_debt_path"/>
203
205
  </block>
204
206
  </branch>
@@ -31,7 +31,8 @@ tools: Read, Write, Glob, Grep
31
31
  - Feature Spec document (`feature_spec_path`) does not exist or is empty → STOP
32
32
  - API Contract template file does not exist → STOP
33
33
  - `node ... update-progress.js` script execution fails → **HARD STOP**: Do NOT manually create or edit JSON progress files. Report the script error and wait for user resolution.
34
- - User rejects Joint Confirmation → STOP, ask user for specific revision requirements
34
+
35
+ > **NOTE**: This skill does NOT include user confirmation. Confirmation is handled at the orchestrator/dispatcher level after all features are processed. This enables continuous batch execution.
35
36
 
36
37
  ## Step 1: Read Input
37
38
 
@@ -80,9 +81,9 @@ Complete definition for each API:
80
81
  1. **Read the template file**: `templates/API-CONTRACT-TEMPLATE.md`
81
82
  2. **Replace top-level placeholders** (feature name, date, feature_id if provided, etc.)
82
83
  3. **Create the document** using `create_file`:
83
- - **新格式(当提供了 feature_id 时)**:`speccrew-workspace/iterations/{number}-{type}-{name}/02.feature-design/{feature-id}-{feature-name}-api-contract.md`
84
+ - **新格式(当提供了 feature_id 时)**:`speccrew-workspace/iterations/{number}-{type}-{name}/03.api-contract/{feature-id}-{feature-name}-api-contract.md`
84
85
  - 示例:`F-CRM-01-customer-list-api-contract.md`
85
- - **旧格式(向后兼容,未提供 feature_id 时)**:`speccrew-workspace/iterations/{number}-{type}-{name}/02.feature-design/[feature-name]-api-contract.md`
86
+ - **旧格式(向后兼容,未提供 feature_id 时)**:`speccrew-workspace/iterations/{number}-{type}-{name}/03.api-contract/[feature-name]-api-contract.md`
86
87
  - Content: Template with top-level placeholders replaced
87
88
  4. **Verify**: Document has complete section structure ready for filling
88
89
 
@@ -105,68 +106,11 @@ Fill each section with API contract details from Step 2 and Step 3.
105
106
 
106
107
  For each API, locate its section anchor in the template and use `search_replace` to fill request parameters, response structure, success example, and error codes.
107
108
 
108
- ## Step 5: Joint Confirmation
109
-
110
- After both documents (Feature Spec + API Contract) are ready, request user confirmation:
111
-
112
- **Conditional Confirmation Logic:**
113
- ```
114
- IF feature_id is provided THEN
115
- → Execute Feature-granular confirmation (情况 A)
116
- ELSE
117
- → Execute Module-level confirmation (情况 B)
118
- ```
119
-
120
- **情况 A:提供了 feature_id(Feature 粒度确认)**
121
- ```
122
- Feature 设计阶段交付物已准备就绪:
123
-
124
- 📋 Feature 信息:
125
- - Feature ID: {feature_id}
126
- - Feature 名称: {feature_name}
127
-
128
- 📄 文档清单:
129
- - Feature Spec: speccrew-workspace/iterations/{number}-{type}-{name}/02.feature-design/{feature-id}-{feature-name}-feature-spec.md
130
- - API Contract: speccrew-workspace/iterations/{number}-{type}-{name}/02.feature-design/{feature-id}-{feature-name}-api-contract.md
131
-
132
- 请确认以下关键点:
133
- 1. 当前 Feature 的技术方案是否可行?
134
- 2. API 定义是否满足前端需求?
135
- 3. 数据模型设计是否合理?
136
-
137
- ⚠️ 确认后,API Contract 将成为前后端协作的唯一基准。
138
- 在设计/开发阶段只读引用,不允许修改。
139
- 如需变更,必须返回此阶段重新确认。
140
-
141
- ✅ 当前仅确认单个 Feature 的交付物。
142
- 全局阶段状态(02_feature_design)将在所有 Feature 完成后由 Feature Designer Agent 统一更新。
143
- ```
144
-
145
- **情况 B:未提供 feature_id(向后兼容,模块级确认)**
146
- ```
147
- Feature design phase deliverables are ready:
148
- - Feature Spec: speccrew-workspace/iterations/{number}-{type}-{name}/02.feature-design/[feature-name]-feature-spec.md
149
- - API Contract: speccrew-workspace/iterations/{number}-{type}-{name}/02.feature-design/[feature-name]-api-contract.md
150
-
151
- Please confirm the following key points:
152
- 1. Is the overall technical solution feasible?
153
- 2. Does the API definition meet frontend requirements?
154
- 3. Is the data model reasonable?
155
-
156
- ⚠️ After confirmation, the API contract will be the sole baseline for frontend-backend collaboration.
157
- Read-only reference in design/development phase, no modifications allowed.
158
- If changes are needed, must return to this phase for re-confirmation.
159
-
160
- After confirmation, you can start frontend and backend Designer Agents separately.
161
- ```
162
-
163
- ## Step 6: Update Progress Files
164
-
165
- After user confirms Joint Confirmation:
109
+ ## Step 5: Update Progress Files
166
110
 
167
111
  > **SCRIPT ENFORCEMENT RULE**: All `.checkpoints.json` and `WORKFLOW-PROGRESS.json` updates MUST be performed via `node speccrew-workspace/scripts/update-progress.js` commands. Manually creating or editing these JSON files is FORBIDDEN. If the script fails, STOP and report the error — do NOT attempt manual JSON construction.
168
112
 
169
- ### 6a: Update Checkpoints File
113
+ ### 5a: Update Checkpoints File
170
114
 
171
115
  Update the `.checkpoints.json` file to record confirmation status.
172
116
 
@@ -229,7 +173,7 @@ Write/Update `.checkpoints.json`:
229
173
  - Preserve existing checkpoint statuses when updating
230
174
  - Log: "✅ Checkpoint (api_contract_joint) passed and recorded"
231
175
 
232
- ### 6b: Update Workflow Progress
176
+ ### 5b: Update Workflow Progress
233
177
 
234
178
  Update `WORKFLOW-PROGRESS.json` to reflect current feature/module status.
235
179
 
@@ -249,7 +193,7 @@ Update `WORKFLOW-PROGRESS.json` to reflect current feature/module status.
249
193
  "confirmed_at": "{current_timestamp}",
250
194
  "outputs": [
251
195
  "02.feature-design/{feature-id}-{feature-name}-feature-spec.md",
252
- "02.feature-design/{feature-id}-{feature-name}-api-contract.md"
196
+ "03.api-contract/${feature_id}-${feature_name}-api-contract.md"
253
197
  ]
254
198
  }
255
199
  }
@@ -274,7 +218,7 @@ Update `WORKFLOW-PROGRESS.json` to reflect current feature/module status.
274
218
  "confirmed_at": "{current_timestamp}",
275
219
  "outputs": [
276
220
  "02.feature-design/[feature-name]-feature-spec.md",
277
- "02.feature-design/[feature-name]-api-contract.md"
221
+ "03.api-contract/${feature_name}-api-contract.md"
278
222
  ]
279
223
  }
280
224
  }
@@ -292,7 +236,7 @@ Update `WORKFLOW-PROGRESS.json` to reflect current feature/module status.
292
236
  > Feature 粒度的 API Contract 完成后,全局阶段状态(`02_feature_design.status` 和 `current_stage`)**不由本 Skill 更新**。
293
237
  > 全局状态由 **Feature Designer Agent** 统一管理,当检测到所有 Feature 都完成时,统一更新为 `confirmed` 并推进到下一阶段。
294
238
 
295
- ### 6.3 Backward Compatibility
239
+ ### 5.3 Backward Compatibility
296
240
 
297
241
  If `WORKFLOW-PROGRESS.json` does not exist:
298
242
  - Log: "⚠️ No workflow progress file found. Skipping workflow update."
@@ -307,4 +251,4 @@ If `WORKFLOW-PROGRESS.json` does not exist:
307
251
  - [ ] URL naming conforms to backend architecture specifications
308
252
  - [ ] Error code list is complete
309
253
  - [ ] File has been written to correct path (with proper naming convention based on feature_id)
310
- - [ ] Summary of both documents has been shown to user and confirmation requested (including Feature ID if applicable)
254
+ - [ ] API Contract document has been generated at the correct path
@@ -81,21 +81,21 @@
81
81
  - {Feature ID} → ${feature_id}
82
82
  - {Date} → current date
83
83
  </field>
84
- <field name="output_path">${iteration_path}/02.feature-design/${feature_id}-${feature_name}-api-contract.md</field>
85
- <field name="fallback_path">${iteration_path}/02.feature-design/${feature_name}-api-contract.md</field>
84
+ <field name="output_path">${iteration_path}/03.api-contract/${feature_id}-${feature_name}-api-contract.md</field>
85
+ <field name="fallback_path">${iteration_path}/03.api-contract/${feature_name}-api-contract.md</field>
86
86
  <field name="output" var="document_created"/>
87
87
  </block>
88
88
 
89
89
  <!-- Checkpoint: Verify document created -->
90
90
  <block type="checkpoint" id="CP1" name="document-created" desc="Verify API contract document created">
91
- <field name="file" value="${iteration_path}/02.feature-design/${feature_id}-${feature_name}-api-contract.md"/>
92
- <field name="verify" value="file_exists(${iteration_path}/02.feature-design/${feature_id}-${feature_name}-api-contract.md)"/>
91
+ <field name="file" value="${iteration_path}/03.api-contract/${feature_id}-${feature_name}-api-contract.md"/>
92
+ <field name="verify" value="file_exists(${iteration_path}/03.api-contract/${feature_id}-${feature_name}-api-contract.md)"/>
93
93
  </block>
94
94
 
95
95
  <!-- Step 4b: Fill API List Overview Section -->
96
96
  <block type="task" id="B5" action="edit-file" desc="Fill API List Overview section">
97
- <field name="path">${iteration_path}/02.feature-design/${feature_id}-${feature_name}-api-contract.md</field>
98
- <field name="fallback_path">${iteration_path}/02.feature-design/${feature_name}-api-contract.md</field>
97
+ <field name="path">${iteration_path}/03.api-contract/${feature_id}-${feature_name}-api-contract.md</field>
98
+ <field name="fallback_path">${iteration_path}/03.api-contract/${feature_name}-api-contract.md</field>
99
99
  <field name="operation">search_replace</field>
100
100
  <field name="search">## API List Overview
101
101
 
@@ -123,8 +123,8 @@ ${api_list.table}</field>
123
123
  </block>
124
124
 
125
125
  <block type="task" id="B7" action="edit-file" desc="Fill API contract section">
126
- <field name="path">${iteration_path}/02.feature-design/${feature_id}-${feature_name}-api-contract.md</field>
127
- <field name="fallback_path">${iteration_path}/02.feature-design/${feature_name}-api-contract.md</field>
126
+ <field name="path">${iteration_path}/03.api-contract/${feature_id}-${feature_name}-api-contract.md</field>
127
+ <field name="fallback_path">${iteration_path}/03.api-contract/${feature_name}-api-contract.md</field>
128
128
  <field name="operation">search_replace</field>
129
129
  <field name="search">### ${api.name}
130
130
 
@@ -137,8 +137,8 @@ ${api_contract_details.content}</field>
137
137
 
138
138
  <!-- Step 6: Fill Error Code Summary -->
139
139
  <block type="task" id="B8" action="edit-file" desc="Fill Error Code Summary section">
140
- <field name="path">${iteration_path}/02.feature-design/${feature_id}-${feature_name}-api-contract.md</field>
141
- <field name="fallback_path">${iteration_path}/02.feature-design/${feature_name}-api-contract.md</field>
140
+ <field name="path">${iteration_path}/03.api-contract/${feature_id}-${feature_name}-api-contract.md</field>
141
+ <field name="fallback_path">${iteration_path}/03.api-contract/${feature_name}-api-contract.md</field>
142
142
  <field name="operation">search_replace</field>
143
143
  <field name="search">## Error Code Summary
144
144
 
@@ -150,59 +150,22 @@ ${api_contract_details.content}</field>
150
150
  ${api_list.error_codes}</field>
151
151
  </block>
152
152
 
153
- <!-- Step 7: Joint Confirmation -->
154
- <block type="gateway" id="G3" mode="exclusive" desc="Select confirmation mode">
155
- <branch test="${feature_id} != null" name="Feature-granular confirmation">
156
- <block type="event" id="E1" action="confirm" title="Feature Design Confirmation" type="yesno" desc="Request user confirmation for feature">
157
- <field name="preview">Feature design phase deliverables ready:
158
-
159
- Feature ID: ${feature_id}
160
- Feature Name: ${feature_name}
161
-
162
- Documents:
163
- - Feature Spec: ${iteration_path}/02.feature-design/${feature_id}-${feature_name}-feature-spec.md
164
- - API Contract: ${iteration_path}/02.feature-design/${feature_id}-${feature_name}-api-contract.md
165
-
166
- Please confirm:
167
- 1. Is the technical solution feasible?
168
- 2. Does the API definition meet frontend requirements?
169
- 3. Is the data model reasonable?
170
-
171
- After confirmation, API Contract becomes the sole baseline for frontend-backend collaboration.</field>
172
- </block>
173
- </branch>
174
- <branch default="true" name="Module-level confirmation">
175
- <block type="event" id="E2" action="confirm" title="Feature Design Confirmation" type="yesno" desc="Request user confirmation">
176
- <field name="preview">Feature design phase deliverables ready:
177
- - Feature Spec: ${iteration_path}/02.feature-design/${feature_name}-feature-spec.md
178
- - API Contract: ${iteration_path}/02.feature-design/${feature_name}-api-contract.md
179
-
180
- Please confirm:
181
- 1. Is the overall technical solution feasible?
182
- 2. Does the API definition meet frontend requirements?
183
- 3. Is the data model reasonable?
184
-
185
- After confirmation, API Contract becomes the sole baseline for frontend-backend collaboration.</field>
186
- </block>
187
- </branch>
188
- </block>
189
-
190
- <!-- Step 8a: Update Checkpoints File -->
153
+ <!-- Step 7a: Update Checkpoints File -->
191
154
  <block type="task" id="B9" action="run-script" desc="Update checkpoints via script">
192
155
  <field name="command">node "${workspace_path}/scripts/update-progress.js" write-checkpoint --file "${iteration_path}/02.feature-design/.checkpoints.json" --stage 02_feature_design --checkpoint api_contract_joint --passed true</field>
193
156
  <field name="output" var="checkpoint_result"/>
194
157
  </block>
195
158
 
196
- <!-- Step 8b: Update Workflow Progress -->
159
+ <!-- Step 7b: Update Workflow Progress -->
197
160
  <block type="gateway" id="G4" mode="exclusive" desc="Update progress based on mode">
198
161
  <branch test="${feature_id} != null" name="Feature mode">
199
162
  <block type="task" id="B10" action="run-script" desc="Update workflow progress for feature">
200
- <field name="command">node "${workspace_path}/scripts/update-progress.js" update-task --file "${iteration_path}/WORKFLOW-PROGRESS.json" --task-id "${feature_id}" --status confirmed --outputs '["02.feature-design/${feature_id}-${feature_name}-feature-spec.md","02.feature-design/${feature_id}-${feature_name}-api-contract.md"]'</field>
163
+ <field name="command">node "${workspace_path}/scripts/update-progress.js" update-task --file "${iteration_path}/WORKFLOW-PROGRESS.json" --task-id "${feature_id}" --status confirmed --outputs '["02.feature-design/${feature_id}-${feature_name}-feature-spec.md","03.api-contract/${feature_id}-${feature_name}-api-contract.md"]'</field>
201
164
  </block>
202
165
  </branch>
203
166
  <branch default="true" name="Module mode">
204
167
  <block type="task" id="B11" action="run-script" desc="Update workflow progress for module">
205
- <field name="command">node "${workspace_path}/scripts/update-progress.js" update-stage --file "${iteration_path}/WORKFLOW-PROGRESS.json" --stage 02_feature_design --status confirmed --outputs '["02.feature-design/${feature_name}-feature-spec.md","02.feature-design/${feature_name}-api-contract.md"]'</field>
168
+ <field name="command">node "${workspace_path}/scripts/update-progress.js" update-stage --file "${iteration_path}/WORKFLOW-PROGRESS.json" --stage 02_feature_design --status confirmed --outputs '["02.feature-design/${feature_name}-feature-spec.md","03.api-contract/${feature_name}-api-contract.md"]'</field>
206
169
  </block>
207
170
  </branch>
208
171
  </block>
@@ -213,7 +176,7 @@ After confirmation, API Contract becomes the sole baseline for frontend-backend
213
176
  Output Results
214
177
  ============================================================ -->
215
178
  <block type="output" id="O1" desc="Workflow output results">
216
- <field name="api_contract_path" value="${iteration_path}/02.feature-design/${feature_id}-${feature_name}-api-contract.md" type="string" desc="Path to generated API contract"/>
179
+ <field name="api_contract_path" value="${iteration_path}/03.api-contract/${feature_id}-${feature_name}-api-contract.md" type="string" desc="Path to generated API contract"/>
217
180
  <field name="feature_spec_path" value="${iteration_path}/02.feature-design/${feature_id}-${feature_name}-feature-spec.md" type="string" desc="Path to Feature Spec"/>
218
181
  <field name="api_count" from="${api_list.count}" type="number" desc="Number of APIs documented"/>
219
182
  <field name="confirmation_status" value="confirmed" type="string" desc="User confirmation status"/>
@@ -341,7 +341,7 @@
341
341
  feature_id: ${feature_list.modules[0].features[0].feature_id}
342
342
  feature_name: ${feature_list.modules[0].features[0].feature_name}
343
343
  feature_type: ${feature_list.modules[0].features[0].feature_type}
344
- output_path: ${iteration_path}/02.feature-design/${feature_id}-${feature_name}-api-contract.md
344
+ output_path: ${iteration_path}/03.api-contract/${feature_id}-${feature_name}-api-contract.md
345
345
  </field>
346
346
  <field name="output" var="api_contract_result"/>
347
347
  </block>
@@ -382,7 +382,7 @@
382
382
  feature_id: ${item.feature_id}
383
383
  feature_name: ${item.feature_name}
384
384
  feature_type: ${item.feature_type}
385
- output_path: ${iteration_path}/02.feature-design/${item.feature_id}-${item.feature_name}-api-contract.md
385
+ output_path: ${iteration_path}/03.api-contract/${item.feature_id}-${item.feature_name}-api-contract.md
386
386
  </field>
387
387
  </block>
388
388
 
@@ -262,6 +262,23 @@ After completing all steps, output a structured completion report for the System
262
262
  - `VALIDATION_ERROR`: Input validation failed (e.g., invalid Feature Spec format)
263
263
  - `BLOCKED`: Blocked by external dependency or prerequisite not met
264
264
 
265
+ ## OUTPUT EFFICIENCY RULES
266
+
267
+ When executing this skill:
268
+
269
+ 1. **Direct-to-File Output**: All design content (architecture diagrams, API mappings, component specifications, data models) MUST be written directly to the output file
270
+ 2. **Minimal Conversation Output**: Only output:
271
+ - Block execution announcements (1 line each): `"[Block XX] Designing..."`
272
+ - Error messages requiring attention
273
+ - Task Completion Report (final summary)
274
+ 3. **FORBIDDEN in conversation**:
275
+ - ❌ Full document sections or drafts
276
+ - ❌ Mermaid diagrams displayed in chat
277
+ - ❌ API endpoint listings
278
+ - ❌ Data model tables
279
+ - ❌ Architecture descriptions longer than 2 lines
280
+ 4. **Rationale**: Workers run in batch mode. Displaying design content in conversation wastes context window and provides no value since content goes to file anyway.
281
+
265
282
  # Key Rules
266
283
 
267
284
  | Rule | Description |
@@ -252,6 +252,23 @@ After completing all steps, output a structured completion report for the System
252
252
  - `VALIDATION_ERROR`: Input validation failed (e.g., invalid Feature Spec format)
253
253
  - `BLOCKED`: Blocked by external dependency or prerequisite not met
254
254
 
255
+ ## OUTPUT EFFICIENCY RULES
256
+
257
+ When executing this skill:
258
+
259
+ 1. **Direct-to-File Output**: All design content (architecture diagrams, API mappings, component specifications, data models) MUST be written directly to the output file
260
+ 2. **Minimal Conversation Output**: Only output:
261
+ - Block execution announcements (1 line each): `"[Block XX] Designing..."`
262
+ - Error messages requiring attention
263
+ - Task Completion Report (final summary)
264
+ 3. **FORBIDDEN in conversation**:
265
+ - ❌ Full document sections or drafts
266
+ - ❌ Mermaid diagrams displayed in chat
267
+ - ❌ API endpoint listings
268
+ - ❌ Data model tables
269
+ - ❌ Architecture descriptions longer than 2 lines
270
+ 4. **Rationale**: Workers run in batch mode. Displaying design content in conversation wastes context window and provides no value since content goes to file anyway.
271
+
255
272
  # Key Rules
256
273
 
257
274
  | Rule | Description |
@@ -221,6 +221,23 @@ Failed At: Step {N}
221
221
  --- END REPORT ---
222
222
  ```
223
223
 
224
+ ## OUTPUT EFFICIENCY RULES
225
+
226
+ When executing this skill:
227
+
228
+ 1. **Direct-to-File Output**: All design content (architecture diagrams, API mappings, component specifications, data models) MUST be written directly to the output file
229
+ 2. **Minimal Conversation Output**: Only output:
230
+ - Block execution announcements (1 line each): `"[Block XX] Designing..."`
231
+ - Error messages requiring attention
232
+ - Task Completion Report (final summary)
233
+ 3. **FORBIDDEN in conversation**:
234
+ - ❌ Full document sections or drafts
235
+ - ❌ Mermaid diagrams displayed in chat
236
+ - ❌ API endpoint listings
237
+ - ❌ Data model tables
238
+ - ❌ Architecture descriptions longer than 2 lines
239
+ 4. **Rationale**: Workers run in batch mode. Displaying design content in conversation wastes context window and provides no value since content goes to file anyway.
240
+
224
241
  # Key Rules
225
242
 
226
243
  | Rule | Description |
@@ -46,6 +46,15 @@
46
46
  <field name="command">node ${update_progress_script} read --file ${iterations_dir}/${current_iteration}/03.system-design/DISPATCH-PROGRESS.json --summary</field>
47
47
  <field name="output" var="dispatch_progress"/>
48
48
  </block>
49
+
50
+ <!-- Step 0.4: Sync Recovery — Fix out-of-sync dispatch progress -->
51
+ <!-- When dispatch progress shows many "pending" tasks but output files already exist on disk,
52
+ use sync subcommand to recover progress from actual files instead of re-dispatching. -->
53
+ <block type="rule" id="P0-R1" level="mandatory" desc="Sync recovery rule for out-of-sync dispatch progress">
54
+ <field name="text">If DISPATCH-PROGRESS.json shows many tasks as "pending" but corresponding output files already exist on disk, use sync subcommand to recover progress</field>
55
+ <field name="text">DO NOT re-dispatch tasks that already have output files — sync first to update progress from disk</field>
56
+ <field name="text">Sync command: node ${update_progress_script} sync --file ${iterations_dir}/${current_iteration}/03.system-design/DISPATCH-PROGRESS.json --dir ${iterations_dir}/${current_iteration}/03.system-design --suffix "-design.md"</field>
57
+ </block>
49
58
  </sequence>
50
59
 
51
60
  <!-- ========== Phase 0.5: IDE Directory Detection ========== -->
@@ -46,6 +46,13 @@
46
46
  <field name="command">node ${update_progress_script} read --file ${iterations_dir}/${current_iteration}/04.development/DISPATCH-PROGRESS.json --summary</field>
47
47
  <field name="output" var="dispatch_progress"/>
48
48
  </block>
49
+
50
+ <!-- Progress Sync Recovery -->
51
+ <block type="rule" id="P0-R-SYNC" level="mandatory" desc="Progress sync recovery when file state is out-of-sync">
52
+ <rule>When DISPATCH-PROGRESS.json shows many tasks as "pending" but output files already exist in 04.development/ directories, use sync command to recover: node ${update_progress_script} sync --file ${dispatch_progress_file} --dir ${iteration_path}/04.development --suffix "-task.md"</rule>
53
+ <rule>DO NOT re-dispatch tasks that already have output files on disk</rule>
54
+ <rule>DO NOT use ad-hoc PowerShell/Bash commands to manually update progress JSON</rule>
55
+ </block>
49
56
  </sequence>
50
57
 
51
58
  <!-- ========== Phase 0.5: IDE Directory Detection ========== -->
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "speccrew",
3
- "version": "0.7.35",
3
+ "version": "0.7.37",
4
4
  "description": "Spec-Driven Development toolkit for AI-powered IDEs",
5
5
  "author": "charlesmu99",
6
6
  "repository": {
@@ -65,6 +65,14 @@
65
65
  * --features-dir <dir> Directory containing features-*.json files (required)
66
66
  * --force Overwrite existing file
67
67
  *
68
+ * 8. sync - Sync task status with actual output files
69
+ * node update-progress.js sync --file <path> --dir <dir> --suffix <suffix> [--strict]
70
+ * Options:
71
+ * --file <path> Progress file path (required)
72
+ * --dir <path> Output directory absolute path (required)
73
+ * --suffix <suffix> File suffix to match, e.g., -api-contract.md (required)
74
+ * --strict Also mark completed tasks as pending if file is missing
75
+ *
68
76
  * Output Format:
69
77
  * Success: {"success": true, "message": "...", "data": {...}}
70
78
  * Failure: {"success": false, "error": "..."} (output to stderr, exit code 1)
@@ -254,7 +262,10 @@ function parseArgs() {
254
262
  featuresDir: null,
255
263
  platforms: null,
256
264
  force: false,
257
- metadata: null
265
+ metadata: null,
266
+ dir: null,
267
+ suffix: null,
268
+ strict: false
258
269
  };
259
270
 
260
271
  // First argument is the command
@@ -363,6 +374,18 @@ function parseArgs() {
363
374
  case '-Metadata':
364
375
  result.metadata = args[++i];
365
376
  break;
377
+ case '--dir':
378
+ case '-Dir':
379
+ result.dir = args[++i];
380
+ break;
381
+ case '--suffix':
382
+ case '-Suffix':
383
+ result.suffix = args[++i];
384
+ break;
385
+ case '--strict':
386
+ case '-Strict':
387
+ result.strict = true;
388
+ break;
366
389
  }
367
390
  }
368
391
 
@@ -1039,6 +1062,186 @@ function cmdInitKnowledgeTasks(args) {
1039
1062
  }
1040
1063
  }
1041
1064
 
1065
+ /**
1066
+ * Command: sync - Sync task status with actual output files
1067
+ * Scans directory for files matching suffix, extracts task IDs from filenames,
1068
+ * and updates task status accordingly.
1069
+ */
1070
+ function cmdSync(args) {
1071
+ if (!args.file) { outputError('--file is required'); process.exit(1); }
1072
+ if (!args.dir) { outputError('--dir is required'); process.exit(1); }
1073
+ if (!args.suffix) { outputError('--suffix is required'); process.exit(1); }
1074
+
1075
+ const filePath = path.resolve(args.file);
1076
+ const dirPath = path.resolve(args.dir);
1077
+
1078
+ let lockPath = null;
1079
+
1080
+ try {
1081
+ lockPath = acquireLock(filePath);
1082
+
1083
+ const data = readJsonFile(filePath);
1084
+ if (!data || !data.tasks) { outputError('Invalid progress file'); process.exit(1); }
1085
+
1086
+ // Check if directory exists
1087
+ if (!fs.existsSync(dirPath)) {
1088
+ outputError(`Directory not found: ${dirPath}`);
1089
+ }
1090
+
1091
+ // Scan directory for matching files
1092
+ const files = fs.readdirSync(dirPath).filter(f => f.endsWith(args.suffix));
1093
+
1094
+ // Extract task IDs from filenames
1095
+ // Format: {task-id}-{feature-name}{suffix}
1096
+ // task-id pattern: F-Mxx-xx (starts with F-, contains module and feature number)
1097
+ const fileTaskIds = new Set();
1098
+ const fileMap = {};
1099
+ for (const file of files) {
1100
+ // Extract task ID: match F-M followed by digits, dash, digits
1101
+ const match = file.match(/^(F-M\d+-\d+)/);
1102
+ if (match) {
1103
+ fileTaskIds.add(match[1]);
1104
+ fileMap[match[1]] = file;
1105
+ }
1106
+ }
1107
+
1108
+ let synced = 0;
1109
+ let alreadyCorrect = 0;
1110
+ let missing = 0;
1111
+ const now = getTimestamp();
1112
+
1113
+ for (const task of data.tasks) {
1114
+ const taskId = task.id;
1115
+ if (fileTaskIds.has(taskId)) {
1116
+ if (task.status !== 'completed') {
1117
+ task.status = 'completed';
1118
+ task.output = fileMap[taskId];
1119
+ task.completed_at = now;
1120
+ task.updated_at = now;
1121
+ synced++;
1122
+ } else {
1123
+ alreadyCorrect++;
1124
+ }
1125
+ } else {
1126
+ if (task.status === 'completed' && args.strict) {
1127
+ task.status = 'pending';
1128
+ delete task.output;
1129
+ delete task.completed_at;
1130
+ task.updated_at = now;
1131
+ missing++;
1132
+ }
1133
+ }
1134
+ }
1135
+
1136
+ // Recalculate counts
1137
+ data.counts = calculateCounts(data.tasks);
1138
+ data.updated_at = now;
1139
+
1140
+ // Atomic write
1141
+ atomicWriteJson(filePath, data);
1142
+
1143
+ outputSuccess('Sync completed', {
1144
+ scanned_files: files.length,
1145
+ synced: synced,
1146
+ already_correct: alreadyCorrect,
1147
+ missing_files: missing,
1148
+ counts: data.counts
1149
+ });
1150
+ } finally {
1151
+ if (lockPath) releaseLock(lockPath);
1152
+ }
1153
+ }
1154
+
1155
+ /**
1156
+ * Command: sync - Sync task status with actual output files
1157
+ * Scans directory for files matching suffix, extracts task IDs from filenames,
1158
+ * and updates task status accordingly.
1159
+ */
1160
+ function cmdSync(args) {
1161
+ if (!args.file) { outputError('--file is required'); process.exit(1); }
1162
+ if (!args.dir) { outputError('--dir is required'); process.exit(1); }
1163
+ if (!args.suffix) { outputError('--suffix is required'); process.exit(1); }
1164
+
1165
+ const filePath = path.resolve(args.file);
1166
+ const dirPath = path.resolve(args.dir);
1167
+
1168
+ let lockPath = null;
1169
+
1170
+ try {
1171
+ lockPath = acquireLock(filePath);
1172
+
1173
+ const data = readJsonFile(filePath);
1174
+ if (!data || !data.tasks) { outputError('Invalid progress file'); process.exit(1); }
1175
+
1176
+ // Check if directory exists
1177
+ if (!fs.existsSync(dirPath)) {
1178
+ outputError(`Directory not found: ${dirPath}`);
1179
+ }
1180
+
1181
+ // Scan directory for matching files
1182
+ const files = fs.readdirSync(dirPath).filter(f => f.endsWith(args.suffix));
1183
+
1184
+ // Extract task IDs from filenames
1185
+ // Format: {task-id}-{feature-name}{suffix}
1186
+ // task-id pattern: F-Mxx-xx (starts with F-, contains module and feature number)
1187
+ const fileTaskIds = new Set();
1188
+ const fileMap = {};
1189
+ for (const file of files) {
1190
+ // Extract task ID: match F-M followed by digits, dash, digits
1191
+ const match = file.match(/^(F-M\d+-\d+)/);
1192
+ if (match) {
1193
+ fileTaskIds.add(match[1]);
1194
+ fileMap[match[1]] = file;
1195
+ }
1196
+ }
1197
+
1198
+ let synced = 0;
1199
+ let alreadyCorrect = 0;
1200
+ let missing = 0;
1201
+ const now = getTimestamp();
1202
+
1203
+ for (const task of data.tasks) {
1204
+ const taskId = task.id;
1205
+ if (fileTaskIds.has(taskId)) {
1206
+ if (task.status !== 'completed') {
1207
+ task.status = 'completed';
1208
+ task.output = fileMap[taskId];
1209
+ task.completed_at = now;
1210
+ task.updated_at = now;
1211
+ synced++;
1212
+ } else {
1213
+ alreadyCorrect++;
1214
+ }
1215
+ } else {
1216
+ if (task.status === 'completed' && args.strict) {
1217
+ task.status = 'pending';
1218
+ delete task.output;
1219
+ delete task.completed_at;
1220
+ task.updated_at = now;
1221
+ missing++;
1222
+ }
1223
+ }
1224
+ }
1225
+
1226
+ // Recalculate counts
1227
+ data.counts = calculateCounts(data.tasks);
1228
+ data.updated_at = now;
1229
+
1230
+ // Atomic write
1231
+ atomicWriteJson(filePath, data);
1232
+
1233
+ outputSuccess('Sync completed', {
1234
+ scanned_files: files.length,
1235
+ synced: synced,
1236
+ already_correct: alreadyCorrect,
1237
+ missing_files: missing,
1238
+ counts: data.counts
1239
+ });
1240
+ } finally {
1241
+ if (lockPath) releaseLock(lockPath);
1242
+ }
1243
+ }
1244
+
1042
1245
  /**
1043
1246
  * Command: init-tasks - Scan feature-design directory to generate task list
1044
1247
  */
@@ -1207,6 +1410,7 @@ function main() {
1207
1410
  console.error(' update-workflow Update a workflow stage status');
1208
1411
  console.error(' init-tasks Generate tasks from feature-spec files');
1209
1412
  console.error(' init-knowledge-tasks Generate knowledge initialization tasks from matcher results');
1413
+ console.error(' sync Sync task status with actual output files');
1210
1414
  console.error('');
1211
1415
  console.error('Run "node update-progress.js <command> --help" for more information.');
1212
1416
  process.exit(1);
@@ -1239,6 +1443,9 @@ function main() {
1239
1443
  case 'init-knowledge-tasks':
1240
1444
  cmdInitKnowledgeTasks(args);
1241
1445
  break;
1446
+ case 'sync':
1447
+ cmdSync(args);
1448
+ break;
1242
1449
  default:
1243
1450
  outputError(`Unknown command: ${args.command}`);
1244
1451
  }