@ydtb/specsmd 0.1.22

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 (143) hide show
  1. package/README.md +322 -0
  2. package/bin/cli.js +21 -0
  3. package/flows/aidlc/README.md +372 -0
  4. package/flows/aidlc/agents/construction-agent.md +80 -0
  5. package/flows/aidlc/agents/inception-agent.md +97 -0
  6. package/flows/aidlc/agents/master-agent.md +61 -0
  7. package/flows/aidlc/agents/operations-agent.md +89 -0
  8. package/flows/aidlc/commands/construction-agent.md +67 -0
  9. package/flows/aidlc/commands/inception-agent.md +59 -0
  10. package/flows/aidlc/commands/master-agent.md +51 -0
  11. package/flows/aidlc/commands/operations-agent.md +81 -0
  12. package/flows/aidlc/context-config.yaml +67 -0
  13. package/flows/aidlc/memory-bank.yaml +105 -0
  14. package/flows/aidlc/quick-start.md +322 -0
  15. package/flows/aidlc/scripts/artifact-validator.cjs +594 -0
  16. package/flows/aidlc/scripts/bolt-complete.cjs +606 -0
  17. package/flows/aidlc/scripts/status-integrity.cjs +598 -0
  18. package/flows/aidlc/skills/construction/bolt-list.md +163 -0
  19. package/flows/aidlc/skills/construction/bolt-replan.md +345 -0
  20. package/flows/aidlc/skills/construction/bolt-start.md +442 -0
  21. package/flows/aidlc/skills/construction/bolt-status.md +185 -0
  22. package/flows/aidlc/skills/construction/navigator.md +196 -0
  23. package/flows/aidlc/skills/construction/prototype-apply.md +311 -0
  24. package/flows/aidlc/skills/inception/bolt-plan.md +372 -0
  25. package/flows/aidlc/skills/inception/context.md +171 -0
  26. package/flows/aidlc/skills/inception/intent-create.md +211 -0
  27. package/flows/aidlc/skills/inception/intent-list.md +124 -0
  28. package/flows/aidlc/skills/inception/navigator.md +207 -0
  29. package/flows/aidlc/skills/inception/requirements.md +227 -0
  30. package/flows/aidlc/skills/inception/review.md +248 -0
  31. package/flows/aidlc/skills/inception/story-create.md +304 -0
  32. package/flows/aidlc/skills/inception/units.md +278 -0
  33. package/flows/aidlc/skills/inception/vibe-to-spec.md +410 -0
  34. package/flows/aidlc/skills/master/analyze-context.md +239 -0
  35. package/flows/aidlc/skills/master/answer-question.md +141 -0
  36. package/flows/aidlc/skills/master/explain-flow.md +158 -0
  37. package/flows/aidlc/skills/master/project-init.md +281 -0
  38. package/flows/aidlc/skills/master/route-request.md +126 -0
  39. package/flows/aidlc/skills/operations/build.md +237 -0
  40. package/flows/aidlc/skills/operations/deploy.md +259 -0
  41. package/flows/aidlc/skills/operations/monitor.md +265 -0
  42. package/flows/aidlc/skills/operations/navigator.md +209 -0
  43. package/flows/aidlc/skills/operations/verify.md +224 -0
  44. package/flows/aidlc/templates/construction/bolt-template.md +226 -0
  45. package/flows/aidlc/templates/construction/bolt-types/ddd-construction-bolt/adr-template.md +49 -0
  46. package/flows/aidlc/templates/construction/bolt-types/ddd-construction-bolt/ddd-01-domain-model-template.md +55 -0
  47. package/flows/aidlc/templates/construction/bolt-types/ddd-construction-bolt/ddd-02-technical-design-template.md +67 -0
  48. package/flows/aidlc/templates/construction/bolt-types/ddd-construction-bolt/ddd-03-test-report-template.md +62 -0
  49. package/flows/aidlc/templates/construction/bolt-types/ddd-construction-bolt.md +590 -0
  50. package/flows/aidlc/templates/construction/bolt-types/simple-construction-bolt.md +347 -0
  51. package/flows/aidlc/templates/construction/bolt-types/spike-bolt.md +240 -0
  52. package/flows/aidlc/templates/construction/construction-log-template.md +129 -0
  53. package/flows/aidlc/templates/construction/standards/coding-standards.md +29 -0
  54. package/flows/aidlc/templates/construction/standards/system-architecture.md +22 -0
  55. package/flows/aidlc/templates/construction/standards/tech-stack.md +19 -0
  56. package/flows/aidlc/templates/inception/inception-log-template.md +134 -0
  57. package/flows/aidlc/templates/inception/project/README.md +55 -0
  58. package/flows/aidlc/templates/inception/requirements-template.md +144 -0
  59. package/flows/aidlc/templates/inception/stories-template.md +38 -0
  60. package/flows/aidlc/templates/inception/story-template.md +147 -0
  61. package/flows/aidlc/templates/inception/system-context-template.md +29 -0
  62. package/flows/aidlc/templates/inception/unit-brief-template.md +177 -0
  63. package/flows/aidlc/templates/inception/units-template.md +52 -0
  64. package/flows/aidlc/templates/standards/catalog.yaml +345 -0
  65. package/flows/aidlc/templates/standards/coding-standards.guide.md +553 -0
  66. package/flows/aidlc/templates/standards/data-stack.guide.md +162 -0
  67. package/flows/aidlc/templates/standards/decision-index-template.md +32 -0
  68. package/flows/aidlc/templates/standards/tech-stack.guide.md +280 -0
  69. package/flows/fire/README.md +19 -0
  70. package/flows/fire/agents/builder/agent.md +254 -0
  71. package/flows/fire/agents/builder/skills/code-review/SKILL.md +257 -0
  72. package/flows/fire/agents/builder/skills/code-review/references/auto-fix-rules.md +218 -0
  73. package/flows/fire/agents/builder/skills/code-review/references/review-categories.md +154 -0
  74. package/flows/fire/agents/builder/skills/code-review/templates/review-report.md.hbs +120 -0
  75. package/flows/fire/agents/builder/skills/commit-changes/SKILL.md +232 -0
  76. package/flows/fire/agents/builder/skills/commit-changes/scripts/commit-changes.cjs +447 -0
  77. package/flows/fire/agents/builder/skills/run-execute/SKILL.md +700 -0
  78. package/flows/fire/agents/builder/skills/run-execute/scripts/complete-run.cjs +748 -0
  79. package/flows/fire/agents/builder/skills/run-execute/scripts/init-run.cjs +457 -0
  80. package/flows/fire/agents/builder/skills/run-execute/scripts/update-phase.cjs +239 -0
  81. package/flows/fire/agents/builder/skills/run-execute/templates/plan.md.hbs +61 -0
  82. package/flows/fire/agents/builder/skills/run-execute/templates/test-report.md.hbs +81 -0
  83. package/flows/fire/agents/builder/skills/run-plan/SKILL.md +366 -0
  84. package/flows/fire/agents/builder/skills/run-status/SKILL.md +96 -0
  85. package/flows/fire/agents/builder/skills/walkthrough-generate/SKILL.md +181 -0
  86. package/flows/fire/agents/builder/skills/walkthrough-generate/templates/walkthrough.md.hbs +108 -0
  87. package/flows/fire/agents/orchestrator/agent.md +144 -0
  88. package/flows/fire/agents/orchestrator/skills/project-init/SKILL.md +226 -0
  89. package/flows/fire/agents/orchestrator/skills/project-init/templates/coding-standards.md.hbs +149 -0
  90. package/flows/fire/agents/orchestrator/skills/project-init/templates/constitution.md.hbs +43 -0
  91. package/flows/fire/agents/orchestrator/skills/project-init/templates/system-architecture.md.hbs +101 -0
  92. package/flows/fire/agents/orchestrator/skills/project-init/templates/tech-stack.md.hbs +136 -0
  93. package/flows/fire/agents/orchestrator/skills/project-init/templates/testing-standards.md.hbs +94 -0
  94. package/flows/fire/agents/orchestrator/skills/route/SKILL.md +146 -0
  95. package/flows/fire/agents/orchestrator/skills/status/SKILL.md +696 -0
  96. package/flows/fire/agents/planner/agent.md +143 -0
  97. package/flows/fire/agents/planner/skills/design-doc-generate/SKILL.md +156 -0
  98. package/flows/fire/agents/planner/skills/design-doc-generate/templates/design.md.hbs +124 -0
  99. package/flows/fire/agents/planner/skills/intent-capture/SKILL.md +125 -0
  100. package/flows/fire/agents/planner/skills/intent-capture/templates/brief.md.hbs +40 -0
  101. package/flows/fire/agents/planner/skills/work-item-decompose/SKILL.md +166 -0
  102. package/flows/fire/agents/planner/skills/work-item-decompose/templates/work-item.md.hbs +40 -0
  103. package/flows/fire/commands/fire-builder.md +56 -0
  104. package/flows/fire/commands/fire-planner.md +48 -0
  105. package/flows/fire/commands/fire.md +46 -0
  106. package/flows/fire/memory-bank.yaml +240 -0
  107. package/flows/fire/quick-start.md +146 -0
  108. package/flows/simple/README.md +190 -0
  109. package/flows/simple/agents/agent.md +404 -0
  110. package/flows/simple/commands/agent.md +60 -0
  111. package/flows/simple/context-config.yaml +34 -0
  112. package/flows/simple/memory-bank.yaml +66 -0
  113. package/flows/simple/quick-start.md +231 -0
  114. package/flows/simple/skills/design.md +96 -0
  115. package/flows/simple/skills/execute.md +190 -0
  116. package/flows/simple/skills/requirements.md +94 -0
  117. package/flows/simple/skills/tasks.md +136 -0
  118. package/flows/simple/templates/design-template.md +138 -0
  119. package/flows/simple/templates/requirements-template.md +85 -0
  120. package/flows/simple/templates/tasks-template.md +104 -0
  121. package/lib/InstallerFactory.js +36 -0
  122. package/lib/analytics/env-detector.js +92 -0
  123. package/lib/analytics/index.js +22 -0
  124. package/lib/analytics/machine-id.js +33 -0
  125. package/lib/analytics/tracker.js +232 -0
  126. package/lib/cli-utils.js +342 -0
  127. package/lib/constants.js +44 -0
  128. package/lib/installer.js +406 -0
  129. package/lib/installers/AntigravityInstaller.js +22 -0
  130. package/lib/installers/ClaudeInstaller.js +85 -0
  131. package/lib/installers/ClineInstaller.js +21 -0
  132. package/lib/installers/CodexInstaller.js +21 -0
  133. package/lib/installers/CopilotInstaller.js +113 -0
  134. package/lib/installers/CursorInstaller.js +63 -0
  135. package/lib/installers/GeminiInstaller.js +75 -0
  136. package/lib/installers/KiroInstaller.js +77 -0
  137. package/lib/installers/OpenCodeInstaller.js +30 -0
  138. package/lib/installers/RooInstaller.js +22 -0
  139. package/lib/installers/ToolInstaller.js +76 -0
  140. package/lib/installers/WindsurfInstaller.js +22 -0
  141. package/lib/markdown-validator.ts +175 -0
  142. package/lib/yaml-validator.ts +99 -0
  143. package/package.json +69 -0
@@ -0,0 +1,696 @@
1
+ ---
2
+ name: status
3
+ description: Display current FIRE project status and validate integrity of intents, work items, and runs.
4
+ version: 2.0.0
5
+ ---
6
+
7
+ <objective>
8
+ Display current FIRE project status and validate integrity across state.yaml and file system.
9
+ Detect inconsistencies and offer interactive resolution.
10
+ </objective>
11
+
12
+ <triggers>
13
+ - User runs `/specsmd-fire status`
14
+ - User asks "what's the status?"
15
+ - User asks to "check" or "validate" the project state
16
+ </triggers>
17
+
18
+ <degrees_of_freedom>
19
+ **LOW** — Report facts accurately. Never auto-fix without user confirmation.
20
+ </degrees_of_freedom>
21
+
22
+ <llm critical="true">
23
+ <mandate>NEVER auto-fix inconsistencies — ALWAYS ask user first</mandate>
24
+ <mandate>ALWAYS scan file system — state.yaml may be incomplete</mandate>
25
+ <mandate>Report ALL findings before offering fixes</mandate>
26
+ <mandate>state.yaml is source of truth for status — frontmatter may be stale</mandate>
27
+ </llm>
28
+
29
+ <flow>
30
+ <step n="1" title="Read State">
31
+ <action>Read .specs-fire/state.yaml</action>
32
+ <check if="state.yaml not found">
33
+ <output>No FIRE project found. Run `/specsmd-fire` to initialize.</output>
34
+ <exit/>
35
+ </check>
36
+ </step>
37
+
38
+ <step n="2" title="Display Status">
39
+ <output>
40
+ # FIRE Status
41
+
42
+ **Project**: {project.name}
43
+ **Workspace**: {workspace.type} / {workspace.structure}
44
+ **Autonomy**: {workspace.autonomy_bias}
45
+ **Version**: {project.fire_version}
46
+
47
+ ## Intents
48
+
49
+ {for each intent}
50
+ ### {intent.title} [{intent.status}]
51
+
52
+ | Work Item | Status | Complexity | Mode |
53
+ |-----------|--------|------------|------|
54
+ {for each work_item}
55
+ | {title} | {status} | {complexity} | {mode} |
56
+ {/for}
57
+
58
+ {/for}
59
+
60
+ ## Active Runs
61
+
62
+ {if runs.active is array and has items}
63
+ {for each active_run in runs.active}
64
+ - **Run**: {active_run.id} | **Scope**: {active_run.scope}
65
+ - **Current Item**: {active_run.current_item}
66
+ - **Started**: {active_run.started}
67
+ {/for}
68
+ {else if active_run exists (legacy singular)}
69
+ - **Run**: {active_run.id}
70
+ - **Work Item**: {active_run.work_item}
71
+ - **Started**: {active_run.started}
72
+ {else}
73
+ No active run.
74
+ {/if}
75
+
76
+ ## Quick Stats
77
+
78
+ - Intents: {total_intents} ({completed_intents} completed)
79
+ - Work Items: {total_work_items} ({completed_work_items} completed)
80
+ - Runs: {total_runs} completed
81
+ </output>
82
+ </step>
83
+
84
+ <!-- ═══════════════════════════════════════════════════════════════════════════ -->
85
+ <!-- INTEGRITY VALIDATION (NEW) -->
86
+ <!-- ═══════════════════════════════════════════════════════════════════════════ -->
87
+
88
+ <step n="3" title="Scan File System">
89
+ <critical>
90
+ File system may have artifacts not tracked in state.yaml.
91
+ state.yaml may reference artifacts that no longer exist on disk.
92
+ </critical>
93
+
94
+ <substep n="3a" title="Scan Intents">
95
+ <action>Glob: .specs-fire/intents/*/brief.md</action>
96
+ <action>Extract intent IDs from directory names</action>
97
+ <action>Store as: intents_on_disk[]</action>
98
+ </substep>
99
+
100
+ <substep n="3b" title="Scan Work Items">
101
+ <action>Glob: .specs-fire/intents/*/work-items/*.md</action>
102
+ <action>Exclude design docs (*-design.md)</action>
103
+ <action>Extract work item IDs and parent intents</action>
104
+ <action>Store as: work_items_on_disk[]</action>
105
+ </substep>
106
+
107
+ <substep n="3c" title="Scan Runs">
108
+ <action>Glob: .specs-fire/runs/run-*/run.md</action>
109
+ <action>Extract run IDs from directory names</action>
110
+ <action>For each run, check which artifacts exist:</action>
111
+ <substep>plan.md, test-report.md, review-report.md, walkthrough.md</substep>
112
+ <action>Store as: runs_on_disk[] with artifact_flags</action>
113
+ </substep>
114
+ </step>
115
+
116
+ <step n="4" title="Compare File System vs State">
117
+ <substep n="4a" title="Find Orphaned Artifacts (on disk but not in state)">
118
+ <action>Compare intents_on_disk with state.intents</action>
119
+ <action>Compare work_items_on_disk with state work_items</action>
120
+ <action>Compare runs_on_disk with state.runs.completed + state.runs.active</action>
121
+
122
+ <check if="intent on disk but not in state">
123
+ <add_issue type="orphaned_intent" severity="warning">
124
+ Intent '{id}' exists on disk but not tracked in state.yaml
125
+ </add_issue>
126
+ </check>
127
+
128
+ <check if="work item on disk but not in state">
129
+ <add_issue type="orphaned_work_item" severity="warning">
130
+ Work item '{id}' exists on disk but not tracked in state.yaml
131
+ </add_issue>
132
+ </check>
133
+
134
+ <check if="run folder on disk but not in state">
135
+ <add_issue type="orphaned_run" severity="warning">
136
+ Run '{id}' exists on disk but not tracked in state.yaml
137
+ </add_issue>
138
+ </check>
139
+ </substep>
140
+
141
+ <substep n="4b" title="Find Missing Files (in state but not on disk)">
142
+ <check if="intent in state but no brief.md on disk">
143
+ <add_issue type="missing_intent_file" severity="error">
144
+ Intent '{id}' tracked but brief.md not found on disk
145
+ </add_issue>
146
+ </check>
147
+
148
+ <check if="work item in state but no .md file on disk">
149
+ <add_issue type="missing_work_item_file" severity="error">
150
+ Work item '{id}' tracked but file not found on disk
151
+ </add_issue>
152
+ </check>
153
+
154
+ <check if="completed run in state but no folder on disk">
155
+ <add_issue type="missing_run_folder" severity="error">
156
+ Run '{id}' marked complete but folder not found on disk
157
+ </add_issue>
158
+ </check>
159
+ </substep>
160
+ </step>
161
+
162
+ <step n="5" title="Validate Status Cascade">
163
+ <critical>
164
+ Status must cascade correctly:
165
+ - Run completes work item → work item should be "completed"
166
+ - All work items completed → intent should be "completed"
167
+ - Any work item in_progress → intent should be "in_progress"
168
+ </critical>
169
+
170
+ <substep n="5a" title="Work Item Status Check">
171
+ <action>For each work item in state:</action>
172
+
173
+ <check if="work item in runs.completed but status != completed">
174
+ <add_issue type="status_mismatch" severity="error">
175
+ Work item '{id}' was completed in run '{run_id}' but status is '{current_status}'
176
+ Expected: completed
177
+ </add_issue>
178
+ </check>
179
+
180
+ <check if="work item in runs.active as current_item but status != in_progress">
181
+ <add_issue type="status_mismatch" severity="warning">
182
+ Work item '{id}' is currently executing in run '{run_id}' but status is '{current_status}'
183
+ Expected: in_progress
184
+ </add_issue>
185
+ </check>
186
+
187
+ <check if="work item status is completed but not found in any completed run">
188
+ <add_issue type="status_unverifiable" severity="warning" needs_code_check="true">
189
+ Work item '{id}' marked as completed but no completed run found
190
+ May have been done outside FIRE or run data is missing
191
+ </add_issue>
192
+ </check>
193
+ </substep>
194
+
195
+ <substep n="5b" title="Intent Status Check">
196
+ <action>For each intent in state:</action>
197
+
198
+ <derive_expected_status>
199
+ IF any work_item.status == "in_progress":
200
+ expected = "in_progress"
201
+ ELSE IF all work_items.status == "completed":
202
+ expected = "completed"
203
+ ELSE IF all work_items.status == "pending":
204
+ expected = "pending"
205
+ ELSE: # mixed pending/completed
206
+ expected = "in_progress"
207
+ </derive_expected_status>
208
+
209
+ <check if="intent.status != expected_status">
210
+ <add_issue type="intent_status_mismatch" severity="error">
211
+ Intent '{title}' has status '{current}' but should be '{expected}'
212
+ Based on work item statuses: {breakdown}
213
+ </add_issue>
214
+ </check>
215
+ </substep>
216
+ </step>
217
+
218
+ <step n="6" title="Validate Run Artifact Completeness">
219
+ <substep n="6a" title="Check Completed Runs">
220
+ <action>For each run in runs.completed (or runs_on_disk marked complete):</action>
221
+
222
+ <required_artifacts>
223
+ - run.md (mandatory)
224
+ - plan.md (mandatory for all modes)
225
+ - test-report.md (mandatory after tests)
226
+ - walkthrough.md (mandatory after completion)
227
+ </required_artifacts>
228
+
229
+ <optional_artifacts>
230
+ - review-report.md (created by code-review skill)
231
+ </optional_artifacts>
232
+
233
+ <check if="completed run missing required artifact">
234
+ <add_issue type="incomplete_run_artifacts" severity="warning">
235
+ Run '{id}' is marked complete but missing: {missing_artifacts}
236
+ </add_issue>
237
+ </check>
238
+ </substep>
239
+
240
+ <substep n="6b" title="Check Active Runs">
241
+ <action>For each run in runs.active:</action>
242
+
243
+ <check if="active run folder does not exist">
244
+ <add_issue type="active_run_missing" severity="error">
245
+ Active run '{id}' has no folder on disk
246
+ Run may have been deleted or never initialized properly
247
+ </add_issue>
248
+ </check>
249
+
250
+ <check if="active run has no run.md">
251
+ <add_issue type="active_run_corrupted" severity="error">
252
+ Active run '{id}' folder exists but run.md is missing
253
+ Run initialization may have failed
254
+ </add_issue>
255
+ </check>
256
+ </substep>
257
+ </step>
258
+
259
+ <step n="7" title="Detect Stale Runs">
260
+ <action>For each run in runs.active[]:</action>
261
+ <action>Calculate age: now - run.started</action>
262
+
263
+ <check if="active run started more than 24 hours ago">
264
+ <add_issue type="stale_run" severity="info" needs_user_decision="true">
265
+ Active run '{id}' was started {age} ago
266
+ Current item: {current_item}
267
+ Artifacts present: {artifact_list}
268
+ May be abandoned or work was done outside FIRE
269
+ </add_issue>
270
+ </check>
271
+
272
+ <check if="active run has plan.md but no test-report.md and age > 1 hour">
273
+ <add_issue type="interrupted_run" severity="warning" needs_user_decision="true">
274
+ Run '{id}' appears interrupted mid-execution
275
+ Has: plan.md
276
+ Missing: test-report.md, walkthrough.md
277
+ Execution may have been stopped before completion
278
+ </add_issue>
279
+ </check>
280
+ </step>
281
+
282
+ <step n="8" title="Check Frontmatter Sync">
283
+ <note>state.yaml is source of truth. Frontmatter may drift.</note>
284
+
285
+ <action>For each work item with status in state.yaml:</action>
286
+ <action>Read work item file, parse frontmatter</action>
287
+
288
+ <check if="frontmatter.status != state.yaml.status">
289
+ <add_issue type="frontmatter_drift" severity="info">
290
+ Work item '{id}' frontmatter says '{frontmatter_status}' but state.yaml says '{state_status}'
291
+ state.yaml is authoritative
292
+ </add_issue>
293
+ </check>
294
+ </step>
295
+
296
+ <step n="9" title="Report Findings">
297
+ <check if="no issues found">
298
+ <output>
299
+ ## ✅ Integrity Check Passed
300
+
301
+ All artifacts are consistent:
302
+ - {intent_count} intents tracked and verified
303
+ - {work_item_count} work items with correct status
304
+ - {run_count} runs with complete artifacts
305
+ - No orphaned or missing files detected
306
+ </output>
307
+ <exit/>
308
+ </check>
309
+
310
+ <check if="issues found">
311
+ <output>
312
+ ## ⚠️ Integrity Issues Detected
313
+
314
+ Found {issue_count} issue(s) requiring attention:
315
+
316
+ | # | Type | Location | Issue | Suggested Fix |
317
+ |---|------|----------|-------|---------------|
318
+ {for each issue, numbered}
319
+ | {n} | {severity_icon} | {location} | {description} | {fix_suggestion} |
320
+ {/for}
321
+
322
+ **Severity**: 🔴 Error | 🟡 Warning | 🔵 Info
323
+
324
+ ---
325
+
326
+ ### Actions
327
+
328
+ **[1] fix-all** — Apply all recommended fixes automatically
329
+ **[2] review** — Go through each issue one by one
330
+ **[3] skip** — Continue without fixing
331
+ {if any issue has needs_code_check}
332
+ **[4] check-code** — Verify by inspecting the codebase
333
+ {/if}
334
+
335
+ Choose an action [1/2/3{if check-code available}/4{/if}]:
336
+ </output>
337
+ </check>
338
+ </step>
339
+
340
+ <step n="10" title="Process User Choice">
341
+ <check if="response == 1 (fix-all)">
342
+ <goto step="11"/>
343
+ </check>
344
+
345
+ <check if="response == 2 (review)">
346
+ <goto step="12"/>
347
+ </check>
348
+
349
+ <check if="response == 3 (skip)">
350
+ <output>Skipping integrity fixes. Issues may cause unexpected behavior.</output>
351
+ <exit/>
352
+ </check>
353
+
354
+ <check if="response == 4 (check-code)">
355
+ <goto step="13"/>
356
+ </check>
357
+ </step>
358
+
359
+ <step n="11" title="Apply All Fixes">
360
+ <action>For each issue with a fix:</action>
361
+
362
+ <fix_actions>
363
+ <fix for="orphaned_intent">
364
+ Read brief.md frontmatter, add intent to state.yaml with status: pending
365
+ </fix>
366
+
367
+ <fix for="orphaned_work_item">
368
+ Read work item frontmatter, add to parent intent in state.yaml
369
+ </fix>
370
+
371
+ <fix for="orphaned_run">
372
+ Parse run.md, determine if complete or incomplete
373
+ If complete: add to runs.completed
374
+ If incomplete: offer to add to runs.active or delete
375
+ </fix>
376
+
377
+ <fix for="missing_intent_file">
378
+ Remove intent from state.yaml (data loss warning)
379
+ Or: Create placeholder brief.md from state data
380
+ </fix>
381
+
382
+ <fix for="status_mismatch">
383
+ Update state.yaml status to expected value
384
+ </fix>
385
+
386
+ <fix for="intent_status_mismatch">
387
+ Update intent status in state.yaml
388
+ </fix>
389
+
390
+ <fix for="frontmatter_drift">
391
+ Update work item frontmatter to match state.yaml
392
+ </fix>
393
+
394
+ <fix for="incomplete_run_artifacts">
395
+ Mark run as incomplete in state, or generate missing artifacts
396
+ </fix>
397
+
398
+ <fix for="stale_run">
399
+ User must decide: resume, abandon, or check code
400
+ </fix>
401
+ </fix_actions>
402
+
403
+ <output>
404
+ ## Fixes Applied
405
+
406
+ {for each fix applied}
407
+ ✓ {description}
408
+ {/for}
409
+
410
+ {if any fixes skipped}
411
+ ⏭️ Skipped (requires user decision):
412
+ {for each skipped}
413
+ - {description}
414
+ {/for}
415
+ {/if}
416
+ </output>
417
+
418
+ <goto step="14"/>
419
+ </step>
420
+
421
+ <step n="12" title="Interactive Review">
422
+ <action>For each issue:</action>
423
+
424
+ <output>
425
+ ## Issue {n} of {total}
426
+
427
+ **Type**: {type}
428
+ **Severity**: {severity}
429
+ **Location**: {location}
430
+
431
+ ### Details
432
+ {full_description}
433
+
434
+ ### Suggested Fix
435
+ {fix_suggestion}
436
+
437
+ ---
438
+
439
+ **[y]** Apply fix
440
+ **[n]** Skip this issue
441
+ **[c]** Check codebase for this item
442
+ **[q]** Quit review (remaining issues skipped)
443
+
444
+ Choice [y/n/c/q]:
445
+ </output>
446
+
447
+ <check if="response == y">
448
+ <action>Apply fix for this issue</action>
449
+ <output>✓ Fixed: {description}</output>
450
+ </check>
451
+
452
+ <check if="response == c">
453
+ <action>Invoke code check for this specific item</action>
454
+ <goto_substep>code-check for {item}</goto_substep>
455
+ </check>
456
+
457
+ <check if="response == q">
458
+ <output>Review ended. {remaining} issues skipped.</output>
459
+ <goto step="14"/>
460
+ </check>
461
+
462
+ <action>Continue to next issue</action>
463
+ </step>
464
+
465
+ <step n="13" title="Code Verification">
466
+ <critical>
467
+ This is a BEST EFFORT verification. AI will look for evidence
468
+ but may not catch everything. User should confirm findings.
469
+ </critical>
470
+
471
+ <ask>
472
+ I'll check the codebase for evidence that work items were completed.
473
+ This involves reading work item acceptance criteria and looking for
474
+ matching implementations.
475
+
476
+ Which items should I check?
477
+
478
+ {for each item with needs_code_check}
479
+ **[{n}]** {work_item_title}
480
+ {/for}
481
+ **[a]** All items
482
+ **[b]** Back to actions
483
+
484
+ Choice:
485
+ </ask>
486
+
487
+ <substep n="13a" title="Verify Single Work Item">
488
+ <action>Read work item file: .specs-fire/intents/{intent}/work-items/{id}.md</action>
489
+ <action>Extract acceptance criteria</action>
490
+ <action>Extract expected files/endpoints/components mentioned</action>
491
+
492
+ <verification_checks>
493
+ <check title="File Existence">
494
+ Look for files mentioned in the work item description
495
+ Example: "Create src/auth/login.ts" → check if file exists
496
+ </check>
497
+
498
+ <check title="Test Existence">
499
+ Look for test files for the component
500
+ Pattern: {filename}.test.ts, {filename}.spec.ts, __tests__/{filename}.ts
501
+ </check>
502
+
503
+ <check title="Implementation Markers">
504
+ If file exists, do a quick scan for expected functions/classes
505
+ Example: Work item mentions "login endpoint" → look for login handler
506
+ </check>
507
+ </verification_checks>
508
+
509
+ <output>
510
+ ## Code Verification: {work_item_title}
511
+
512
+ ### Expected (from acceptance criteria)
513
+ {list acceptance criteria}
514
+
515
+ ### Found in Codebase
516
+ {for each check}
517
+ {check_result_icon} {check_description}
518
+ {/for}
519
+
520
+ ### Assessment
521
+ {if all checks pass}
522
+ ✅ **Likely Complete** — Implementation evidence found
523
+ Recommend: Mark as completed in state.yaml
524
+ {else if some checks pass}
525
+ 🟡 **Partially Complete** — Some evidence found
526
+ Missing: {missing_items}
527
+ Recommend: Review manually or continue implementation
528
+ {else}
529
+ ❌ **Not Found** — No implementation evidence
530
+ Recommend: Keep as pending, implementation needed
531
+ {/if}
532
+
533
+ ---
534
+
535
+ Apply this assessment? [y/n]:
536
+ </output>
537
+
538
+ <check if="response == y">
539
+ <action>Update state.yaml based on assessment</action>
540
+ </check>
541
+ </substep>
542
+ </step>
543
+
544
+ <step n="14" title="Log Maintenance">
545
+ <check if="any fixes were applied">
546
+ <action>Append to .specs-fire/maintenance-log.md (create if needed):</action>
547
+
548
+ <log_entry>
549
+ ## {ISO-8601-timestamp} - Integrity Check
550
+
551
+ **Triggered by**: status skill validation
552
+
553
+ | Issue | Fix Applied | Details |
554
+ |-------|-------------|---------|
555
+ {for each fix}
556
+ | {type} | {fix_description} | {location} |
557
+ {/for}
558
+
559
+ ---
560
+ </log_entry>
561
+
562
+ <output>
563
+ Changes logged to: .specs-fire/maintenance-log.md
564
+ </output>
565
+ </check>
566
+ </step>
567
+
568
+ <step n="15" title="Final Summary">
569
+ <output>
570
+ ## Status Check Complete
571
+
572
+ {if fixes applied}
573
+ **Fixes Applied**: {fix_count}
574
+ **Issues Remaining**: {remaining_count}
575
+ {/if}
576
+
577
+ {if all clean}
578
+ ✅ Project state is consistent and ready for work.
579
+ {else}
580
+ ⚠️ Some issues remain unresolved. Run `/specsmd-fire status` again to review.
581
+ {/if}
582
+
583
+ ---
584
+
585
+ **Next**: {suggest next action based on current state}
586
+ </output>
587
+ </step>
588
+ </flow>
589
+
590
+ <!-- ═══════════════════════════════════════════════════════════════════════════ -->
591
+ <!-- ISSUE TYPE REFERENCE -->
592
+ <!-- ═══════════════════════════════════════════════════════════════════════════ -->
593
+
594
+ <issue_types>
595
+
596
+ | Type | Severity | Auto-fixable | Description |
597
+ |------|----------|--------------|-------------|
598
+ | orphaned_intent | warning | yes | Intent on disk but not in state.yaml |
599
+ | orphaned_work_item | warning | yes | Work item on disk but not in state.yaml |
600
+ | orphaned_run | warning | partial | Run folder on disk but not tracked |
601
+ | missing_intent_file | error | partial | Intent in state but file missing |
602
+ | missing_work_item_file | error | partial | Work item in state but file missing |
603
+ | missing_run_folder | error | no | Completed run in state but folder missing |
604
+ | status_mismatch | error | yes | Work item status doesn't match run history |
605
+ | status_unverifiable | warning | no | Status can't be verified from run data |
606
+ | intent_status_mismatch | error | yes | Intent status inconsistent with work items |
607
+ | incomplete_run_artifacts | warning | partial | Run missing required artifacts |
608
+ | active_run_missing | error | no | Active run folder doesn't exist |
609
+ | active_run_corrupted | error | no | Active run folder missing run.md |
610
+ | stale_run | info | no | Active run is old, may be abandoned |
611
+ | interrupted_run | warning | no | Run appears stopped mid-execution |
612
+ | frontmatter_drift | info | yes | Frontmatter status differs from state |
613
+
614
+ </issue_types>
615
+
616
+ <!-- ═══════════════════════════════════════════════════════════════════════════ -->
617
+ <!-- EXAMPLE OUTPUT -->
618
+ <!-- ═══════════════════════════════════════════════════════════════════════════ -->
619
+
620
+ <example_output>
621
+
622
+ ```
623
+ # FIRE Status
624
+
625
+ **Project**: my-saas-app
626
+ **Workspace**: brownfield / monolith
627
+ **Autonomy**: balanced
628
+ **Version**: 0.1.8
629
+
630
+ ## Intents
631
+
632
+ ### User Authentication [in_progress]
633
+
634
+ | Work Item | Status | Complexity | Mode |
635
+ |-----------|--------|------------|------|
636
+ | login-endpoint | completed | medium | confirm |
637
+ | session-management | in_progress | medium | confirm |
638
+ | password-reset | pending | high | validate |
639
+
640
+ ## Active Runs
641
+
642
+ - **Run**: run-002 | **Scope**: single
643
+ - **Current Item**: session-management
644
+ - **Started**: 2026-01-19T10:30:00Z
645
+
646
+ ## Quick Stats
647
+
648
+ - Intents: 1 (0 completed)
649
+ - Work Items: 3 (1 completed)
650
+ - Runs: 1 completed
651
+
652
+ ---
653
+
654
+ ## ⚠️ Integrity Issues Detected
655
+
656
+ Found 3 issue(s) requiring attention:
657
+
658
+ | # | Type | Location | Issue | Suggested Fix |
659
+ |---|------|----------|-------|---------------|
660
+ | 1 | 🟡 | run-002 | Run started 3 days ago, may be stale | Resume or abandon |
661
+ | 2 | 🔵 | login-endpoint | Frontmatter says 'pending' but state says 'completed' | Sync frontmatter |
662
+ | 3 | 🟡 | analytics-dashboard.md | Work item on disk but not tracked | Add to state.yaml |
663
+
664
+ **Severity**: 🔴 Error | 🟡 Warning | 🔵 Info
665
+
666
+ ---
667
+
668
+ ### Actions
669
+
670
+ **[1] fix-all** — Apply all recommended fixes automatically
671
+ **[2] review** — Go through each issue one by one
672
+ **[3] skip** — Continue without fixing
673
+ **[4] check-code** — Verify by inspecting the codebase
674
+
675
+ Choose an action [1/2/3/4]:
676
+ ```
677
+
678
+ </example_output>
679
+
680
+ <success_criteria>
681
+ <criterion>State file read successfully</criterion>
682
+ <criterion>All intents and work items displayed</criterion>
683
+ <criterion>Active run status shown</criterion>
684
+ <criterion>Quick stats accurate</criterion>
685
+ <criterion>File system scanned for all artifacts</criterion>
686
+ <criterion>Orphaned artifacts detected (disk → state)</criterion>
687
+ <criterion>Missing files detected (state → disk)</criterion>
688
+ <criterion>Status cascade validated (work items → intents)</criterion>
689
+ <criterion>Run artifact completeness checked</criterion>
690
+ <criterion>Stale/interrupted runs detected</criterion>
691
+ <criterion>Frontmatter sync checked</criterion>
692
+ <criterion>Issues reported in clear table format</criterion>
693
+ <criterion>User given choice: fix-all, review, skip, check-code</criterion>
694
+ <criterion>Fixes logged to maintenance-log.md</criterion>
695
+ <criterion>Code verification available for ambiguous cases</criterion>
696
+ </success_criteria>