speccrew 0.7.36 → 0.7.38

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 (25) hide show
  1. package/.speccrew/agents/speccrew-product-manager.md +20 -0
  2. package/.speccrew/agents/speccrew-system-deployer.md +20 -0
  3. package/.speccrew/agents/speccrew-system-designer.md +12 -0
  4. package/.speccrew/agents/speccrew-system-developer.md +11 -0
  5. package/.speccrew/agents/speccrew-team-leader.md +16 -0
  6. package/.speccrew/agents/speccrew-test-manager.md +20 -0
  7. package/.speccrew/skills/speccrew-dev-backend/SKILL.md +58 -0
  8. package/.speccrew/skills/speccrew-dev-backend/workflow.agentflow.xml +2 -0
  9. package/.speccrew/skills/speccrew-dev-desktop-electron/SKILL.md +29 -0
  10. package/.speccrew/skills/speccrew-dev-desktop-electron/workflow.agentflow.xml +2 -0
  11. package/.speccrew/skills/speccrew-dev-desktop-tauri/SKILL.md +29 -0
  12. package/.speccrew/skills/speccrew-dev-desktop-tauri/workflow.agentflow.xml +2 -0
  13. package/.speccrew/skills/speccrew-dev-frontend/SKILL.md +29 -0
  14. package/.speccrew/skills/speccrew-dev-frontend/workflow.agentflow.xml +2 -0
  15. package/.speccrew/skills/speccrew-dev-mobile/SKILL.md +29 -0
  16. package/.speccrew/skills/speccrew-dev-mobile/workflow.agentflow.xml +2 -0
  17. package/.speccrew/skills/speccrew-fd-api-contract/SKILL.md +7 -63
  18. package/.speccrew/skills/speccrew-fd-api-contract/workflow.agentflow.xml +2 -39
  19. package/.speccrew/skills/speccrew-sd-backend/SKILL.md +17 -0
  20. package/.speccrew/skills/speccrew-sd-desktop/SKILL.md +17 -0
  21. package/.speccrew/skills/speccrew-sd-framework-evaluate/SKILL.md +17 -0
  22. package/.speccrew/skills/speccrew-system-designer-orchestration/workflow.agentflow.xml +9 -0
  23. package/.speccrew/skills/speccrew-system-developer-orchestration/workflow.agentflow.xml +7 -0
  24. package/package.json +1 -1
  25. package/workspace-template/scripts/update-progress.js +16 -7
@@ -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
 
@@ -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}/03.api-contract/{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}/03.api-contract/[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
 
@@ -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
@@ -150,50 +150,13 @@ ${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}/03.api-contract/${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}/03.api-contract/${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">
@@ -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.36",
3
+ "version": "0.7.38",
4
4
  "description": "Spec-Driven Development toolkit for AI-powered IDEs",
5
5
  "author": "charlesmu99",
6
6
  "repository": {
@@ -137,7 +137,7 @@ function outputError(error) {
137
137
  */
138
138
  function acquireLock(filePath) {
139
139
  const lockPath = `${filePath}.lock`;
140
- const maxRetries = 30;
140
+ const maxRetries = 50;
141
141
  let retryCount = 0;
142
142
 
143
143
  while (retryCount < maxRetries) {
@@ -152,7 +152,7 @@ function acquireLock(filePath) {
152
152
  try {
153
153
  const lockStat = fs.statSync(lockPath);
154
154
  const ageSeconds = (Date.now() - lockStat.mtimeMs) / 1000;
155
- if (ageSeconds > 60) {
155
+ if (ageSeconds > 120) {
156
156
  console.error(`Warning: Stale lock file detected (age: ${Math.round(ageSeconds)}s), removing: ${lockPath}`);
157
157
  fs.unlinkSync(lockPath);
158
158
  // Do not consume retry count, continue to next loop attempt to acquire lock
@@ -166,9 +166,10 @@ function acquireLock(filePath) {
166
166
  if (retryCount >= maxRetries) {
167
167
  throw new Error(`Failed to acquire file lock for '${filePath}' after ${maxRetries} attempts`);
168
168
  }
169
- // Wait 1 second before retry
169
+ // Retry with jitter to avoid thundering herd
170
+ const delay = 200 + Math.floor(Math.random() * 300);
170
171
  const start = Date.now();
171
- while (Date.now() - start < 1000) {
172
+ while (Date.now() - start < delay) {
172
173
  // Busy wait
173
174
  }
174
175
  }
@@ -209,7 +210,13 @@ function readJsonFile(filePath) {
209
210
  if (!fs.existsSync(filePath)) {
210
211
  throw new Error(`File not found: ${filePath}`);
211
212
  }
212
- const content = fs.readFileSync(filePath, 'utf8');
213
+ let content = fs.readFileSync(filePath, 'utf8');
214
+
215
+ // Remove UTF-8 BOM if present
216
+ if (content.charCodeAt(0) === 0xFEFF) {
217
+ content = content.slice(1);
218
+ }
219
+
213
220
  try {
214
221
  return JSON.parse(content);
215
222
  } catch (e) {
@@ -569,7 +576,7 @@ function cmdRead(args) {
569
576
 
570
577
  // 5. --status mode: filter tasks by status
571
578
  if (args.status) {
572
- const validStatuses = ['pending', 'in_progress', 'partial', 'completed', 'failed'];
579
+ const validStatuses = ['pending', 'in_progress', 'partial', 'completed', 'failed', 'confirmed'];
573
580
  if (!validStatuses.includes(args.status)) {
574
581
  outputError(`Invalid status filter: ${args.status}. Must be one of: ${validStatuses.join(', ')}`);
575
582
  }
@@ -597,7 +604,7 @@ function cmdUpdateTask(args) {
597
604
  outputError('Usage: update-task --file <path> --task-id <id> --status <status> [options]');
598
605
  }
599
606
 
600
- const validStatuses = ['pending', 'in_progress', 'partial', 'completed', 'failed'];
607
+ const validStatuses = ['pending', 'in_progress', 'partial', 'completed', 'failed', 'confirmed'];
601
608
  if (!validStatuses.includes(args.status)) {
602
609
  outputError(`Invalid status: ${args.status}. Must be one of: ${validStatuses.join(', ')}`);
603
610
  }
@@ -638,6 +645,8 @@ function cmdUpdateTask(args) {
638
645
  if (args.output) {
639
646
  task.output = args.output;
640
647
  }
648
+ } else if (args.status === 'confirmed') {
649
+ task.confirmed_at = now;
641
650
  } else if (args.status === 'failed') {
642
651
  task.completed_at = now;
643
652
  if (args.error) {