freeharness 0.4.1 → 0.4.2

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 (194) hide show
  1. package/README.md +8 -7
  2. package/canonical/HARVEST.yaml +25 -14
  3. package/canonical/PROVENANCE.yaml +1 -1
  4. package/canonical/agents/README.md +77 -36
  5. package/canonical/agents/agentic-architect.md +2 -1
  6. package/canonical/agents/database-reviewer.md +6 -8
  7. package/canonical/agents/explorer-ai-engineer-analyst.md +2 -6
  8. package/canonical/agents/implementer.md +30 -0
  9. package/canonical/agents/pr-reviewer.md +9 -11
  10. package/canonical/agents/python-reviewer.md +7 -9
  11. package/canonical/agents/report-formatter.md +7 -3
  12. package/canonical/agents/security-reviewer.md +7 -8
  13. package/canonical/agents/test-writer.md +5 -2
  14. package/canonical/hooks/cost-prices.json +11 -9
  15. package/canonical/hooks/freeharness-config-guard.mjs +8072 -87
  16. package/canonical/hooks/freeharness-context-monitor.mjs +88 -54
  17. package/canonical/hooks/freeharness-converge.mjs +78 -23
  18. package/canonical/hooks/freeharness-cost-tracker.mjs +1129 -218
  19. package/canonical/hooks/freeharness-memory-guard.mjs +20 -23
  20. package/canonical/hooks/freeharness-precompact.mjs +217 -87
  21. package/canonical/hooks/freeharness-quota-tap.mjs +173 -0
  22. package/canonical/hooks/freeharness-reload-context.mjs +197 -0
  23. package/canonical/hooks/freeharness-repeat-tool.mjs +1 -1
  24. package/canonical/hooks/freeharness-sdd-context.mjs +970 -0
  25. package/canonical/hooks/freeharness-session-start +297 -59
  26. package/canonical/hooks/hooks.claude-code.json +1 -1
  27. package/canonical/hooks/hooks.config-guard.claude-code.json +3 -2
  28. package/canonical/hooks/hooks.context-monitor.claude-code.json +1 -1
  29. package/canonical/hooks/hooks.converge.claude-code.json +1 -1
  30. package/canonical/hooks/hooks.memory-guard.claude-code.json +3 -2
  31. package/canonical/hooks/hooks.reload-context.claude-code.json +15 -0
  32. package/canonical/openspec/schema.spec-driven.yaml +29 -8
  33. package/canonical/openspec/templates/follow-ups.md +3 -2
  34. package/canonical/openspec/templates/proposal.md +1 -1
  35. package/canonical/openspec/templates/tasks.md +8 -0
  36. package/canonical/rules/CLAUDE.md +5 -4
  37. package/canonical/rules/routing.md +10 -9
  38. package/canonical/skills/agent-evaluation/SKILL.md +17 -6
  39. package/canonical/skills/agent-evaluation/evals/cases.yaml +38 -23
  40. package/canonical/skills/agentic-architecture/SKILL.md +4 -0
  41. package/canonical/skills/agentic-architecture/evals/cases.yaml +27 -0
  42. package/canonical/skills/code-review/SKILL.md +9 -2
  43. package/canonical/skills/code-review/evals/cases.yaml +1118 -27
  44. package/canonical/skills/git-workflow/SKILL.md +2 -0
  45. package/canonical/skills/local-code/SKILL.md +2 -2
  46. package/canonical/skills/local-code/evals/cases.yaml +1 -1
  47. package/canonical/skills/report-formatting/SKILL.md +10 -2
  48. package/canonical/skills/report-formatting/reference/ARCHITECTURE.md +3 -3
  49. package/canonical/skills/report-formatting/reference/HELPERS.md +10 -5
  50. package/canonical/skills/report-formatting/reference/RELEASE.md +1 -2
  51. package/canonical/skills/report-formatting/reference/TEMPLATES.md +3 -2
  52. package/canonical/skills/report-formatting/reference/authoring.md +25 -37
  53. package/canonical/skills/report-formatting/scripts/build-architecture.js +1 -1
  54. package/canonical/skills/report-formatting/scripts/build-md-claro.js +5 -8
  55. package/canonical/skills/report-formatting/scripts/check-env.js +0 -4
  56. package/canonical/skills/report-formatting/scripts/docmodel.js +3 -11
  57. package/canonical/skills/report-formatting/scripts/example-build.js +8 -10
  58. package/canonical/skills/report-formatting/scripts/example_build_ArchitectureReview_docx.js +8 -10
  59. package/canonical/skills/report-formatting/scripts/example_build_ExecutiveReport_docx.js +8 -10
  60. package/canonical/skills/report-formatting/scripts/theme-claro.js +39 -10
  61. package/canonical/skills/subagent-driven-development/SKILL.md +35 -28
  62. package/canonical/skills/subagent-driven-development/evals/cases.yaml +3496 -19
  63. package/canonical/skills/subagent-driven-development/reference/brief.md +185 -35
  64. package/canonical/skills/subagent-driven-development/reference/handoff.md +82 -2
  65. package/canonical/skills/subagent-driven-development/reference/loop.md +57 -0
  66. package/canonical/skills/subagent-driven-development/reference/trees.md +40 -0
  67. package/canonical/skills/subagent-driven-development/reference/workspace.md +31 -0
  68. package/canonical/skills/subagent-driven-development/scripts/validate-handoff.mjs +4771 -326
  69. package/dist/adapters/harness/claude-code.d.ts +19 -3
  70. package/dist/adapters/harness/claude-code.js +204 -39
  71. package/dist/adapters/harness/opencode.js +16 -2
  72. package/dist/adapters/harness/plugin.js +28 -17
  73. package/dist/adapters/memory/doctor.d.ts +174 -29
  74. package/dist/adapters/memory/doctor.js +758 -134
  75. package/dist/adapters/memory/migrate.d.ts +95 -0
  76. package/dist/adapters/memory/migrate.js +497 -0
  77. package/dist/adapters/memory/paths.d.ts +22 -0
  78. package/dist/adapters/memory/paths.js +85 -0
  79. package/dist/adapters/memory/vendored.d.ts +56 -29
  80. package/dist/adapters/memory/vendored.js +191 -154
  81. package/dist/adapters/sync/diff.js +4 -1
  82. package/dist/cli/cleanup-prompt.d.ts +35 -0
  83. package/dist/cli/cleanup-prompt.js +68 -0
  84. package/dist/cli/cleanup.d.ts +22 -24
  85. package/dist/cli/cleanup.js +182 -68
  86. package/dist/cli/cost-quota.d.ts +158 -0
  87. package/dist/cli/cost-quota.js +645 -0
  88. package/dist/cli/cost.d.ts +408 -46
  89. package/dist/cli/cost.js +1731 -57
  90. package/dist/cli/doctor.d.ts +52 -13
  91. package/dist/cli/doctor.js +193 -44
  92. package/dist/cli/hard-cleanup.d.ts +93 -0
  93. package/dist/cli/hard-cleanup.js +552 -0
  94. package/dist/cli/install-facts.d.ts +28 -0
  95. package/dist/cli/install-facts.js +66 -0
  96. package/dist/cli/json-key-edit.d.ts +18 -0
  97. package/dist/cli/json-key-edit.js +118 -0
  98. package/dist/cli/memory-import.d.ts +74 -0
  99. package/dist/cli/memory-import.js +469 -0
  100. package/dist/cli/plugin-validate.d.ts +12 -0
  101. package/dist/cli/plugin-validate.js +43 -0
  102. package/dist/cli/uninstall.d.ts +1 -1
  103. package/dist/cli/uninstall.js +2 -2
  104. package/dist/cli/upstream-launchers.d.ts +49 -0
  105. package/dist/cli/upstream-launchers.js +287 -0
  106. package/dist/index.js +247 -70
  107. package/dist/infra/fsutil.d.ts +31 -3
  108. package/dist/infra/fsutil.js +69 -6
  109. package/dist/infra/manifest.d.ts +2 -1
  110. package/dist/infra/manifest.js +3 -2
  111. package/dist/infra/prices.d.ts +18 -0
  112. package/dist/infra/prices.js +64 -0
  113. package/node_modules/@freeharness/core/dist/tiers.d.ts +10 -1
  114. package/node_modules/@freeharness/core/dist/tiers.js +24 -2
  115. package/node_modules/@freeharness/core/package.json +1 -1
  116. package/node_modules/@freeharness/sdd/PROVENANCE.yaml +279 -2
  117. package/node_modules/@freeharness/sdd/dist/src/bin/openspec.js +34 -8
  118. package/node_modules/@freeharness/sdd/dist/src/shim/archive.d.ts +7 -6
  119. package/node_modules/@freeharness/sdd/dist/src/shim/archive.js +72 -64
  120. package/node_modules/@freeharness/sdd/dist/src/shim/follow-up.d.ts +48 -16
  121. package/node_modules/@freeharness/sdd/dist/src/shim/follow-up.js +168 -70
  122. package/node_modules/@freeharness/sdd/dist/src/shim/instructions.d.ts +36 -6
  123. package/node_modules/@freeharness/sdd/dist/src/shim/instructions.js +110 -49
  124. package/node_modules/@freeharness/sdd/dist/src/shim/list.d.ts +1 -1
  125. package/node_modules/@freeharness/sdd/dist/src/shim/list.js +57 -14
  126. package/node_modules/@freeharness/sdd/dist/src/shim/nested-change.d.ts +7 -0
  127. package/node_modules/@freeharness/sdd/dist/src/shim/nested-change.js +118 -0
  128. package/node_modules/@freeharness/sdd/dist/src/shim/new-change.js +3 -1
  129. package/node_modules/@freeharness/sdd/dist/src/shim/proposal-capabilities.d.ts +12 -0
  130. package/node_modules/@freeharness/sdd/dist/src/shim/proposal-capabilities.js +94 -0
  131. package/node_modules/@freeharness/sdd/dist/src/shim/shared.d.ts +17 -0
  132. package/node_modules/@freeharness/sdd/dist/src/shim/shared.js +182 -1
  133. package/node_modules/@freeharness/sdd/dist/src/shim/status.d.ts +2 -2
  134. package/node_modules/@freeharness/sdd/dist/src/shim/status.js +34 -5
  135. package/node_modules/@freeharness/sdd/dist/src/shim/validate.d.ts +9 -0
  136. package/node_modules/@freeharness/sdd/dist/src/shim/validate.js +49 -41
  137. package/node_modules/@freeharness/sdd/dist/src/shim/warnings.d.ts +21 -0
  138. package/node_modules/@freeharness/sdd/dist/src/shim/warnings.js +66 -0
  139. package/node_modules/@freeharness/sdd/dist/vendor/openspec/apply/line-endings.d.ts +4 -0
  140. package/node_modules/@freeharness/sdd/dist/vendor/openspec/apply/line-endings.js +17 -0
  141. package/node_modules/@freeharness/sdd/dist/vendor/openspec/apply/specs-apply.js +95 -22
  142. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/change-status-policy.d.ts +6 -0
  143. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/change-status-policy.js +14 -6
  144. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/index.d.ts +1 -1
  145. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/index.js +1 -1
  146. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/outputs.d.ts +3 -3
  147. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/outputs.js +24 -4
  148. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/task-progress.js +4 -7
  149. package/node_modules/@freeharness/sdd/dist/vendor/openspec/engine/types.js +13 -1
  150. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/apply-change.js +21 -6
  151. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/archive-change.js +80 -19
  152. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/explore.js +42 -22
  153. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/project-root.d.ts +32 -0
  154. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/project-root.js +39 -0
  155. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/propose.js +16 -9
  156. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/sync-specs.js +36 -1
  157. package/node_modules/@freeharness/sdd/dist/vendor/openspec/generation/templates/workflows/update-change.js +65 -30
  158. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/constants.d.ts +1 -1
  159. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/constants.js +1 -1
  160. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/change-parser.d.ts +8 -13
  161. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/change-parser.js +79 -102
  162. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/markdown-parser.js +4 -9
  163. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/requirement-blocks.d.ts +50 -10
  164. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/requirement-blocks.js +165 -37
  165. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/requirement-text.d.ts +24 -3
  166. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/requirement-text.js +55 -8
  167. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/parsers/spec-structure.js +4 -1
  168. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/purpose-placeholder.js +19 -9
  169. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/spec-discovery.d.ts +10 -0
  170. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/spec-discovery.js +115 -0
  171. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/task-lines.d.ts +3 -3
  172. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/task-lines.js +20 -20
  173. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/validator.d.ts +6 -0
  174. package/node_modules/@freeharness/sdd/dist/vendor/openspec/validation/validator.js +75 -14
  175. package/node_modules/@freeharness/sdd/package.json +1 -1
  176. package/node_modules/@freeharness/sdd/vendor/openspec/assets/schema.upstream.yaml +47 -7
  177. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-apply-change/SKILL.md +25 -7
  178. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-archive-change/SKILL.md +50 -11
  179. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-bulk-archive-change/SKILL.md +48 -10
  180. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-continue-change/SKILL.md +27 -7
  181. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-explore/SKILL.md +25 -12
  182. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-ff-change/SKILL.md +17 -5
  183. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-new-change/SKILL.md +12 -1
  184. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-onboard/SKILL.md +47 -33
  185. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-propose/SKILL.md +17 -5
  186. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-sync-specs/SKILL.md +29 -1
  187. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-update-change/SKILL.md +31 -13
  188. package/node_modules/@freeharness/sdd/vendor/openspec/assets/skills/openspec-verify-change/SKILL.md +75 -27
  189. package/package.json +6 -4
  190. package/provenance/canonical.PROVENANCE.yaml +1 -1
  191. package/provenance/memory.PROVENANCE.yaml +458 -6
  192. package/provenance/sdd.PROVENANCE.yaml +279 -2
  193. package/canonical/hooks/freeharness-auto-memory.mjs +0 -158
  194. package/canonical/hooks/hooks.auto-memory.claude-code.json +0 -16
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: openspec-onboard
3
- description: Guided onboarding for OpenSpec - walk through a complete workflow cycle with narration and real codebase work.
3
+ description: Guided onboarding for OpenSpec - walk through a complete workflow cycle with narration and real codebase work. Also use when the user says "openspec onboard" or "opsx onboard".
4
4
  allowed-tools: Bash(openspec:*)
5
5
  license: MIT
6
6
  compatibility: Requires openspec CLI.
@@ -13,6 +13,17 @@ Guide the user through their first complete OpenSpec workflow cycle. This is a t
13
13
 
14
14
  **Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `schemas`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
15
15
 
16
+ **Project check:** These steps expect a project that already uses OpenSpec. Before the first step that writes anything (`new change`, `archive`, `sync specs`, or authoring an artifact file), confirm the project has a root: run `openspec list --json` (with `--store <id>` when a store is selected, since the store is then the root) and read `root`. A root object means the project is set up. `"root": null` means it is not - there is no `openspec/` directory here, and a write such as `openspec new change` would create one as a side effect. The command also exits non-zero, which is that answer rather than a broken CLI, so read the JSON instead of retrying or working around it.
17
+
18
+ One `"root": null` is not about setup: when a `status` error message starts with `Declared in` or `Invalid store declaration in` and names this project's `openspec/config.yaml` (or `config.yml`), the project does use OpenSpec through a store it declares, which this machine cannot resolve (the store is not registered, or the `store:` line is malformed). Do not treat it as uninitialized and skip the branches below: stop before writing and show the user that error's `message` and `fix`.
19
+
20
+ Otherwise, with no root, what happens next depends on how this workflow was reached:
21
+
22
+ - **Auto-selected**: you chose this workflow yourself, without the user naming OpenSpec, naming this skill, or running its slash command. Stop using OpenSpec and answer the request normally, as you would with no OpenSpec installed. Do not ask them to set anything up and do not mention OpenSpec setup.
23
+ - **Explicit OpenSpec request**: the user named OpenSpec, named this skill, or ran its slash command. Stop before writing and ask how to proceed: set this project up (`openspec init`), target a store they already have (`--store <id>`), or continue without OpenSpec for this request. Wait for their answer.
24
+
25
+ In both branches, never create the root as a side effect: do not run `openspec init` until the user asks for it, do not hand-create `openspec/` files, and do not let a command create it.
26
+
16
27
  ---
17
28
 
18
29
  ## Preflight
@@ -220,6 +231,8 @@ Here's a draft proposal:
220
231
 
221
232
  ---
222
233
 
234
+ # Proposal
235
+
223
236
  ## Why
224
237
 
225
238
  [1-2 sentences explaining the problem/opportunity]
@@ -287,6 +300,8 @@ Here's the spec:
287
300
 
288
301
  ---
289
302
 
303
+ # Spec Delta
304
+
290
305
  ## ADDED Requirements
291
306
 
292
307
  ### Requirement: <Name>
@@ -326,6 +341,8 @@ Here's the design:
326
341
 
327
342
  ---
328
343
 
344
+ # Design
345
+
329
346
  ## Context
330
347
 
331
348
  [Brief context about the current state]
@@ -361,7 +378,7 @@ Save to the `resolvedOutputPath` from `openspec instructions design --change "<n
361
378
 
362
379
  Finally, we break the work into implementation tasks—checkboxes that drive the apply phase.
363
380
 
364
- These should be small, clear, and in logical order.
381
+ These should be small, clear, and in logical order. Each group carries the tests and documentation for its own work - the last group is only for integration checks.
365
382
  ```
366
383
 
367
384
  **DO:** Generate tasks based on specs and design:
@@ -371,6 +388,8 @@ Here are the implementation tasks:
371
388
 
372
389
  ---
373
390
 
391
+ # Tasks
392
+
374
393
  ## 1. [Category or file]
375
394
 
376
395
  - [ ] 1.1 [Specific task] — verify: [test, command, observable behavior, or delivered artifact]
@@ -382,12 +401,17 @@ Here are the implementation tasks:
382
401
 
383
402
  ---
384
403
 
385
- Each checkbox becomes a unit of work in the apply phase. Ready to implement?
404
+ Each checkbox becomes a unit of work in the apply phase. Does this task breakdown look right?
386
405
  ```
387
406
 
388
- **PAUSE** - Wait for user to confirm they're ready to implement.
407
+ **PAUSE** - Wait for user approval/feedback.
408
+
409
+ After approval, save to the `resolvedOutputPath` from `openspec instructions tasks --change "<name>" --json`.
389
410
 
390
- Save to the `resolvedOutputPath` from `openspec instructions tasks --change "<name>" --json`.
411
+ Then ask:
412
+ > "Tasks are saved. Ready to implement?"
413
+
414
+ **PAUSE** - Wait for user to confirm before implementation.
391
415
 
392
416
  ---
393
417
 
@@ -472,23 +496,18 @@ This same rhythm works for any size change—a small fix or a major feature.
472
496
 
473
497
  ## Command Reference
474
498
 
475
- **Core workflow:**
499
+ **The commands you have installed:**
476
500
 
477
- | Command | What it does |
478
- |-------------------|--------------------------------------------|
501
+ | Command | What it does |
502
+ |------------------|--------------------------------------------|
479
503
  | `/openspec-propose` | Create a change and generate all artifacts |
480
504
  | `/openspec-explore` | Think through problems before/during work |
481
505
  | `/openspec-apply-change` | Implement tasks from a change |
482
506
  | `/openspec-archive-change` | Archive a completed change |
483
-
484
- **Additional commands** (only if installed - availability depends on your profile):
485
-
486
- | Command | What it does |
487
- |--------------------|----------------------------------------------------------|
488
- | `/openspec-new-change` | Start a new change, step through artifacts one at a time |
489
- | `/openspec-continue-change` | Continue working on an existing change |
490
- | `/openspec-ff-change` | Fast-forward: create all artifacts at once |
491
- | `/openspec-verify-change` | Verify implementation matches artifacts |
507
+ | `/openspec-new-change` | Start a new change, one artifact at a time |
508
+ | `/openspec-continue-change` | Continue working on an existing change |
509
+ | `/openspec-ff-change` | Fast-forward: create all artifacts at once |
510
+ | `/openspec-verify-change` | Verify implementation matches artifacts |
492
511
 
493
512
  ---
494
513
 
@@ -508,8 +527,8 @@ If the user says they need to stop, want to pause, or seem disengaged:
508
527
  ```
509
528
  No problem! Your change is saved at the `changeRoot` reported by `openspec status --change "<name>" --json`.
510
529
 
511
- To pick up where we left off later:
512
- - `/openspec-continue-change <name>` - Resume artifact creation (if installed; otherwise `openspec status --change "<name>" --json` shows the next artifact)
530
+ To pick up where we left off later, `openspec status --change "<name>" --json` shows exactly where the change stands.
531
+ - `/openspec-continue-change <name>` - Resume artifact creation
513
532
  - `/openspec-apply-change <name>` - Jump to implementation (if tasks exist)
514
533
 
515
534
  The work won't be lost. Come back whenever you're ready.
@@ -524,23 +543,18 @@ If the user says they just want to see the commands or skip the tutorial:
524
543
  ```
525
544
  ## OpenSpec Quick Reference
526
545
 
527
- **Core workflow:**
546
+ **The commands you have installed:**
528
547
 
529
548
  | Command | What it does |
530
549
  |--------------------------|--------------------------------------------|
531
- | `/openspec-propose <name>` | Create a change and generate all artifacts |
532
- | `/openspec-explore` | Think through problems (no code changes) |
533
- | `/openspec-apply-change <name>` | Implement tasks |
534
- | `/openspec-archive-change <name>` | Archive when done |
535
-
536
- **Additional commands** (only if installed - availability depends on your profile):
537
-
538
- | Command | What it does |
539
- |---------------------------|-------------------------------------|
540
- | `/openspec-new-change <name>` | Start a new change, step by step |
541
- | `/openspec-continue-change <name>` | Continue an existing change |
542
- | `/openspec-ff-change <name>` | Fast-forward: all artifacts at once |
543
- | `/openspec-verify-change <name>` | Verify implementation |
550
+ | `/openspec-propose <name>` | Create a change and generate all artifacts |
551
+ | `/openspec-explore` | Think through problems (no code changes) |
552
+ | `/openspec-apply-change <name>` | Implement tasks |
553
+ | `/openspec-archive-change <name>` | Archive when done |
554
+ | `/openspec-new-change <name>` | Start a new change, step by step |
555
+ | `/openspec-continue-change <name>` | Continue an existing change |
556
+ | `/openspec-ff-change <name>` | Fast-forward: all artifacts at once |
557
+ | `/openspec-verify-change <name>` | Verify implementation |
544
558
 
545
559
  Try `/openspec-propose` to start your first change.
546
560
  ```
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: openspec-propose
3
- description: Propose a new change with all artifacts generated in one step. Use when the user wants to quickly describe what they want to build and get a complete proposal with design, specs, and tasks ready for implementation.
3
+ description: Propose a new OpenSpec change with all artifacts generated in one step. Use when the user wants to quickly describe what they want to build and get a complete proposal with design, specs, and tasks ready for implementation. Also use when the user says "openspec propose" or "opsx propose".
4
4
  allowed-tools: Bash(openspec:*)
5
5
  license: MIT
6
6
  compatibility: Requires openspec CLI.
@@ -27,6 +27,17 @@ When the user is ready to implement, they must start the apply workflow explicit
27
27
 
28
28
  **Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `schemas`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
29
29
 
30
+ **Project check:** These steps expect a project that already uses OpenSpec. Before the first step that writes anything (`new change`, `archive`, `sync specs`, or authoring an artifact file), confirm the project has a root: run `openspec list --json` (with `--store <id>` when a store is selected, since the store is then the root) and read `root`. A root object means the project is set up. `"root": null` means it is not - there is no `openspec/` directory here, and a write such as `openspec new change` would create one as a side effect. The command also exits non-zero, which is that answer rather than a broken CLI, so read the JSON instead of retrying or working around it.
31
+
32
+ One `"root": null` is not about setup: when a `status` error message starts with `Declared in` or `Invalid store declaration in` and names this project's `openspec/config.yaml` (or `config.yml`), the project does use OpenSpec through a store it declares, which this machine cannot resolve (the store is not registered, or the `store:` line is malformed). Do not treat it as uninitialized and skip the branches below: stop before writing and show the user that error's `message` and `fix`.
33
+
34
+ Otherwise, with no root, what happens next depends on how this workflow was reached:
35
+
36
+ - **Auto-selected**: you chose this workflow yourself, without the user naming OpenSpec, naming this skill, or running its slash command. Stop using OpenSpec and answer the request normally, as you would with no OpenSpec installed. Do not ask them to set anything up and do not mention OpenSpec setup.
37
+ - **Explicit OpenSpec request**: the user named OpenSpec, named this skill, or ran its slash command. Stop before writing and ask how to proceed: set this project up (`openspec init`), target a store they already have (`--store <id>`), or continue without OpenSpec for this request. Wait for their answer.
38
+
39
+ In both branches, never create the root as a side effect: do not run `openspec init` until the user asks for it, do not hand-create `openspec/` files, and do not let a command create it.
40
+
30
41
  **Input**: The user's request should include a change name (kebab-case) OR a description of what they want to build.
31
42
 
32
43
  **Steps**
@@ -44,7 +55,7 @@ When the user is ready to implement, they must start the apply workflow explicit
44
55
 
45
56
  2. **Load project context**
46
57
 
47
- Run `openspec context --json` from the current working directory (or `openspec context --json --store "<store-id>"` when a registered store was explicitly selected). Use the returned `root.path` as the authoritative OpenSpec root. If context reports `no_openspec_root`, stop without creating or changing any files. Offer `openspec init` and wait for the user to request initialization. Do not initialize automatically or run `openspec new change`. After initialization, rerun this context check before continuing. For any other context failure, stop and report the error; do not fall back to the current directory or run later OpenSpec commands without the selected store.
58
+ Run `openspec context --json` from the current working directory (or `openspec context --json --store "<store-id>"` when a registered store was explicitly selected). Use the returned `root.path` as the authoritative OpenSpec root. If context reports `no_openspec_root`, stop without creating or changing any files and follow the **Project check** above for how this workflow was reached. Offer `openspec init` only for an explicit OpenSpec request, and wait for the user to request initialization. Do not initialize automatically or run `openspec new change`. After initialization, rerun this context check before continuing. For any other context failure, stop and report the error; do not fall back to the current directory or run later OpenSpec commands without the selected store.
48
59
 
49
60
  Only when context returns a resolved `root.path`, read `<root.path>/openspec/config.yaml`. Use `config.yml` only when `config.yaml` does not exist. If neither file exists, continue without project context. Do not fall back to `config.yml` if `config.yaml` is unreadable or invalid.
50
61
 
@@ -110,8 +121,9 @@ When the user is ready to implement, they must start the apply workflow explicit
110
121
  - Identify the target project from the request and project context; the planning home may be separate from the code. If the target is unclear, ask. For greenfield or non-code changes, inspect the available structure and relevant documents. If source is unavailable, state the limitation and ask when it materially affects the plan.
111
122
  - Ground scope, approach, and tasks in what you find. Distinguish observed behavior from assumptions and proposed additions; surface conflicts with existing specs instead of silently deciding which is correct.
112
123
  - Do this discovery now, rather than leaving generic "explore the codebase" or "make a plan" tasks for implementation. Keep any necessary follow-up investigation specific to an unresolved question.
113
- - If the `instruction` field delegates creation to a specific skill or command, invoke it to produce the artifact instead of writing the file yourself, then verify the artifact file exists at `resolvedOutputPath`
114
- - Otherwise create the artifact file using `template` as the structure and write it to `resolvedOutputPath`. If `resolvedOutputPath` is a glob, follow `instruction` to choose the concrete file path
124
+ - Choose the output path before creating anything. If `resolvedOutputPath` is a glob, follow `instruction` to choose a concrete path inside `changeRoot` that matches the glob, and verify it remains inside `changeRoot` after resolving symlinks, both in its parent directories and in the file itself if it already exists; if it does not, stop and tell the user. Otherwise the output path is `resolvedOutputPath`
125
+ - If the `instruction` field delegates creation to a specific skill or command, invoke it only if it can write the artifact to that output path; otherwise stop and tell the user. Then verify the artifact file exists at that output path
126
+ - Otherwise create the artifact file using `template` as the structure and write it to that output path
115
127
  - Apply `context` and `rules` as constraints - but do NOT copy them into the file
116
128
  - Show brief progress: "Created <artifact-id>"
117
129
 
@@ -145,7 +157,7 @@ After completing all artifacts, summarize:
145
157
  **Artifact Creation Guidelines**
146
158
 
147
159
  - Follow the `instruction` field from `openspec instructions` for each artifact type - it is the authoritative guidance, even for familiar artifact names
148
- - If the `instruction` field directs you to use a specific skill or command to create the artifact, invoke it instead of writing the artifact directly
160
+ - If the `instruction` field directs you to use a specific skill or command to create the artifact, invoke it instead of writing the artifact directly - but only once you have chosen and checked the output path, and only if it can write there
149
161
  - The schema defines what each artifact should contain - follow it
150
162
  - Read dependency artifacts for context before creating new ones
151
163
  - Use `template` as the structure for your output file - fill in its sections
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: openspec-sync-specs
3
- description: Sync delta specs from a change to main specs. Use when the user wants to update main specs with changes from a delta spec, without archiving the change.
3
+ description: Sync delta specs from an OpenSpec change to main specs. Use when the user wants to update main specs with changes from a delta spec, without archiving the change. Also use when the user says "openspec sync" or "opsx sync".
4
4
  allowed-tools: Bash(openspec:*)
5
5
  license: MIT
6
6
  compatibility: Requires openspec CLI.
@@ -15,6 +15,17 @@ This is an **agent-driven** operation - you will read delta specs and directly e
15
15
 
16
16
  **Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `schemas`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
17
17
 
18
+ **Project check:** These steps expect a project that already uses OpenSpec. Before the first step that writes anything (`new change`, `archive`, `sync specs`, or authoring an artifact file), confirm the project has a root: run `openspec list --json` (with `--store <id>` when a store is selected, since the store is then the root) and read `root`. A root object means the project is set up. `"root": null` means it is not - there is no `openspec/` directory here, and a write such as `openspec new change` would create one as a side effect. The command also exits non-zero, which is that answer rather than a broken CLI, so read the JSON instead of retrying or working around it.
19
+
20
+ One `"root": null` is not about setup: when a `status` error message starts with `Declared in` or `Invalid store declaration in` and names this project's `openspec/config.yaml` (or `config.yml`), the project does use OpenSpec through a store it declares, which this machine cannot resolve (the store is not registered, or the `store:` line is malformed). Do not treat it as uninitialized and skip the branches below: stop before writing and show the user that error's `message` and `fix`.
21
+
22
+ Otherwise, with no root, what happens next depends on how this workflow was reached:
23
+
24
+ - **Auto-selected**: you chose this workflow yourself, without the user naming OpenSpec, naming this skill, or running its slash command. Stop using OpenSpec and answer the request normally, as you would with no OpenSpec installed. Do not ask them to set anything up and do not mention OpenSpec setup.
25
+ - **Explicit OpenSpec request**: the user named OpenSpec, named this skill, or ran its slash command. Stop before writing and ask how to proceed: set this project up (`openspec init`), target a store they already have (`--store <id>`), or continue without OpenSpec for this request. Wait for their answer.
26
+
27
+ In both branches, never create the root as a side effect: do not run `openspec init` until the user asks for it, do not hand-create `openspec/` files, and do not let a command create it.
28
+
18
29
  `<capability-path>` is the spec directory relative to `specs/` (for example, `user-auth` or `identity/user-auth`). Preserve the full path from each delta spec when resolving its main spec.
19
30
 
20
31
  **Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
@@ -95,6 +106,13 @@ This is an **agent-driven** operation - you will read delta specs and directly e
95
106
 
96
107
  b. **Read the main spec** at `<planningHome.root>/openspec/specs/<capability-path>/spec.md` (may not exist yet)
97
108
 
109
+ **If it does not exist yet** (a new capability), match what `openspec archive` does:
110
+ only ADDED requirements may be applied - step d creates the spec from them.
111
+ MODIFIED and RENAMED have no requirement to act on, so stop the sync for that
112
+ capability and report that its main spec does not exist and only ADDED is allowed
113
+ for a new spec; never invent the missing requirement. REMOVED has nothing to
114
+ remove - skip it and warn.
115
+
98
116
  c. **Apply changes intelligently**:
99
117
 
100
118
  **ADDED Requirements:**
@@ -142,6 +160,14 @@ This is an **agent-driven** operation - you will read delta specs and directly e
142
160
  (this is what `openspec archive` does; it warns and moves on)
143
161
 
144
162
  d. **Create new main spec** if capability doesn't exist yet:
163
+ - Only when the delta has ADDED requirements to put in it and no MODIFIED or
164
+ RENAMED requirements blocked this capability in step b. Otherwise create nothing
165
+ and leave the specs directory untouched. For a REMOVED-only delta, if the change's
166
+ `.openspec.yaml` declares `retire_capabilities: true`, report it as already retired
167
+ and continue without recreating the spec. Without that marker, report the sync as blocked:
168
+ `openspec archive` rejects it with `Spec must have at least one requirement`.
169
+ An empty delta has no operations to sync; report it as blocked too.
170
+ Never write an empty `## Requirements` section.
145
171
  - Create `<planningHome.root>/openspec/specs/<capability-path>/spec.md`
146
172
  - Add Purpose section: copy the delta's `## Purpose` body verbatim when it has one
147
173
  (this is what `openspec archive` does); only write a brief TBD placeholder when it does not
@@ -166,6 +192,8 @@ This is an **agent-driven** operation - you will read delta specs and directly e
166
192
  **Delta Spec Format Reference**
167
193
 
168
194
  ```markdown
195
+ # Spec Delta
196
+
169
197
  ## Purpose
170
198
 
171
199
  Only on a delta that introduces a brand-new capability. Seeds the new main spec.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: openspec-update-change
3
- description: Update an OpenSpec change by revising its existing planning artifacts and keeping them coherent with one another. Use when the user wants to revise a change's plan, fold new decisions into it, or reconcile its artifacts after an edit. Never edits code.
3
+ description: Update an OpenSpec change by revising its existing planning artifacts and keeping them coherent with one another. Use when the user wants to revise a change's plan, fold new decisions into it, or reconcile its artifacts after an edit. Also use when the user says "openspec update change" or "opsx update". If the user means the openspec update CLI command, which refreshes generated files, run that command instead. Never edits code.
4
4
  allowed-tools: Bash(openspec:*)
5
5
  license: MIT
6
6
  compatibility: Requires openspec CLI.
@@ -13,9 +13,20 @@ Revise a change's existing planning artifacts and keep them coherent. Never edit
13
13
 
14
14
  **Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `schemas`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
15
15
 
16
+ **Project check:** These steps expect a project that already uses OpenSpec. Before the first step that writes anything (`new change`, `archive`, `sync specs`, or authoring an artifact file), confirm the project has a root: run `openspec list --json` (with `--store <id>` when a store is selected, since the store is then the root) and read `root`. A root object means the project is set up. `"root": null` means it is not - there is no `openspec/` directory here, and a write such as `openspec new change` would create one as a side effect. The command also exits non-zero, which is that answer rather than a broken CLI, so read the JSON instead of retrying or working around it.
17
+
18
+ One `"root": null` is not about setup: when a `status` error message starts with `Declared in` or `Invalid store declaration in` and names this project's `openspec/config.yaml` (or `config.yml`), the project does use OpenSpec through a store it declares, which this machine cannot resolve (the store is not registered, or the `store:` line is malformed). Do not treat it as uninitialized and skip the branches below: stop before writing and show the user that error's `message` and `fix`.
19
+
20
+ Otherwise, with no root, what happens next depends on how this workflow was reached:
21
+
22
+ - **Auto-selected**: you chose this workflow yourself, without the user naming OpenSpec, naming this skill, or running its slash command. Stop using OpenSpec and answer the request normally, as you would with no OpenSpec installed. Do not ask them to set anything up and do not mention OpenSpec setup.
23
+ - **Explicit OpenSpec request**: the user named OpenSpec, named this skill, or ran its slash command. Stop before writing and ask how to proceed: set this project up (`openspec init`), target a store they already have (`--store <id>`), or continue without OpenSpec for this request. Wait for their answer.
24
+
25
+ In both branches, never create the root as a side effect: do not run `openspec init` until the user asks for it, do not hand-create `openspec/` files, and do not let a command create it.
26
+
16
27
  **Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
17
28
 
18
- `/openspec-continue-change` is an optional workflow and may not be installed. Before suggesting it anywhere below, verify that it is available. If it is unavailable, `openspec status --change "<name>" --json` shows the next artifact and `openspec instructions "<artifact-id>" --change "<name>" --json` explains how to create it.
29
+ This workflow revises artifacts that already exist; `/openspec-continue-change` is what creates the ones that do not.
19
30
 
20
31
  **Steps**
21
32
 
@@ -28,7 +39,6 @@ Revise a change's existing planning artifacts and keep them coherent. Never edit
28
39
 
29
40
  When prompting, present the top 3-4 most recently modified changes as options, showing:
30
41
  - Change name
31
- - Schema (from `schema` field if present, otherwise "spec-driven")
32
42
  - Status (e.g., "0/5 tasks", "complete", "no tasks")
33
43
  - How recently it was modified (from `lastModified` field)
34
44
 
@@ -48,7 +58,7 @@ Revise a change's existing planning artifacts and keep them coherent. Never edit
48
58
 
49
59
  The artifact ids and paths come from the active schema - do NOT assume them, and do NOT branch on hardcoded artifact names. Custom schemas must work unchanged.
50
60
 
51
- The files to edit are `artifactPaths.<id>.existingOutputPaths` - the concrete files that exist on disk, already glob-expanded for glob artifacts (e.g. `specs/**/*.md`). Do NOT write to `resolvedOutputPath`: for a glob artifact it is still the glob pattern, not a real file.
61
+ The files to edit are `artifactPaths.<id>.existingOutputPaths` - the concrete files that exist on disk, already glob-expanded for glob artifacts (e.g. `specs/**/*.md`), plus any confirmed concrete path allowed under a partly populated glob artifact (step 4). Do NOT write to `resolvedOutputPath`: for a glob artifact it is still the glob pattern, not a real file.
52
62
 
53
63
  3. **Understand the request**
54
64
  - If the user asked for a specific revision ("the design now uses X"), that is the starting edit.
@@ -56,13 +66,20 @@ Revise a change's existing planning artifacts and keep them coherent. Never edit
56
66
 
57
67
  4. **Read and reconcile**
58
68
  - Read the artifact(s) the request touches and the change's other existing artifacts.
59
- - Apply the requested edit. Then check every other existing artifact against it - in ANY direction: an edit to a later artifact may require revising an earlier one, not only the other way around. Build order is a useful reading order, not a constraint on which artifacts may be revised.
69
+ - Draft the requested edit in the conversation, not in files. Work out exactly what it changes; step 5 owns every write. Then check every other existing artifact against the drafted edit - in ANY direction: an edit to a later artifact may require revising an earlier one, not only the other way around. Build order is a useful reading order, not a constraint on which artifacts may be revised.
60
70
  - Note everything that is now inconsistent, missing, or contradictory.
61
- - Revise only files that already exist (`existingOutputPaths`). Do NOT create artifacts that don't exist yet, and do NOT invent new files under a glob artifact - note them and point the user to `/openspec-continue-change` to create them.
62
- - If the change is already coherent, say so and make no edits.
71
+ - Propose revisions to files that already exist (`existingOutputPaths`). If an artifact has no existing output files and status `ready` or `blocked`, note it and point the user to `/openspec-continue-change` to create them. Leave `skipped` artifacts untouched; do not treat them as missing or defer them to the continue workflow.
72
+ - A glob artifact (e.g. `specs/**/*.md`) is marked `done` after at least one file matches, and the continue workflow only handles `ready` artifacts. When reconciliation identifies a missing file for a glob artifact whose `existingOutputPaths` is non-empty:
73
+ 1. Run `openspec instructions "<artifact-id>" --change "<name>" --json` and use its `instruction` and `template`. Treat `context` and `rules` as constraints; do not copy them into the file. If instructions report `skipped: true`, do not create the file. Read current dependency files from disk; if a required non-skipped dependency is missing, stop and ask the user to restore it first.
74
+ 2. Choose a concrete path inside `changeRoot` that matches `artifactPaths.<id>.outputPath` and does not already exist. Verify it remains inside `changeRoot` after resolving any symlinked parent directories. The glob `resolvedOutputPath` is not a valid target.
75
+ 3. Include the new file in step 5's proposed revisions and create it only after the user confirms.
76
+ 4. After confirmation, immediately before creation, refresh status and instructions. Verify the artifact is still in scope, not skipped, and partially populated; repeat the concrete-path checks above.
77
+ 5. Use a create operation that fails if the target already exists. If `instruction` delegates creation to another skill or command, invoke it only if it can honor the confirmed path and these guardrails; otherwise stop. If any check fails or the confirmed draft is no longer valid, stop and reconcile with the user rather than replacing existing content or choosing a different path.
78
+ - If the change is already coherent, say so and propose no revisions.
63
79
 
64
80
  5. **Confirm and apply, one artifact at a time**
65
- - Show each proposed revision and why. Write only after the user confirms.
81
+ - This step performs every artifact write in this workflow; no earlier step edits an artifact.
82
+ - Show each proposed revision and why - including the requested edit drafted in step 4. Write only after the user confirms.
66
83
  - If the user rejects a revision, do not write it - leave that artifact unchanged.
67
84
  - When a substantial rewrite is needed, get that artifact's rules and template first:
68
85
  ```bash
@@ -70,7 +87,7 @@ Revise a change's existing planning artifacts and keep them coherent. Never edit
70
87
  ```
71
88
 
72
89
  6. **Point to the next step (guidance only - NEVER act on it)**
73
- - Artifacts still missing -> suggest `/openspec-continue-change` to create them.
90
+ - Artifacts with empty `existingOutputPaths` and status `ready` or `blocked` -> suggest `/openspec-continue-change` to create them.
74
91
  - Change already implemented (tasks checked off / already applied) -> the code may no longer match the revised plan; suggest `/openspec-apply-change` to carry the delta into code.
75
92
  - Everything done and implemented -> suggest `/openspec-archive-change`.
76
93
 
@@ -78,13 +95,14 @@ Revise a change's existing planning artifacts and keep them coherent. Never edit
78
95
 
79
96
  After each invocation, show:
80
97
  - Which artifacts were revised (and which proposed revisions were rejected)
81
- - Anything deferred to `/openspec-continue-change` (not-yet-created artifacts or files)
98
+ - Any file created under a glob artifact that was already partially populated
99
+ - Anything deferred to `/openspec-continue-change` (artifacts with no files yet and status `ready` or `blocked`, never `skipped` artifacts)
82
100
  - Where the change stands and the recommended next command
83
101
 
84
102
  **Guardrails**
85
103
  - Planning artifacts only - NEVER edit implementation code. If the revised plan implies code changes, stop and point to `/openspec-apply-change`.
86
104
  - Use the artifact ids and paths reported by `openspec status`; never branch on hardcoded artifact names.
87
- - Edit only the concrete files in `existingOutputPaths`; never write to a glob `resolvedOutputPath`.
88
- - Do not advance the build frontier: no new artifacts, no new files under glob artifacts - that is `/openspec-continue-change`'s job.
105
+ - Edit only the concrete files in `existingOutputPaths`, plus any confirmed concrete path allowed under a partly populated glob artifact (step 4); never write to a glob `resolvedOutputPath`.
106
+ - Do not advance the build frontier: if an artifact has empty `existingOutputPaths` and status `ready` or `blocked`, that is `/openspec-continue-change`'s job. Leave `skipped` artifacts untouched. The only new-file scope is a confirmed concrete path under a glob artifact whose `existingOutputPaths` is non-empty.
89
107
  - Confirm every edit with the user before writing.
90
- - If the request changes the change's *intent* rather than refining it, first verify whether the optional `/openspec-new-change` workflow is available. If it is, recommend starting fresh with `/openspec-new-change` (the "Update vs. Start Fresh" heuristic). If it is unavailable, ask for a distinct unused change name and recommend `openspec new change "<new-change-name>"` instead.
108
+ - If the request changes the change's *intent* rather than refining it, recommend starting fresh with `/openspec-new-change` (the "Update vs. Start Fresh" heuristic).
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: openspec-verify-change
3
- description: Verify implementation matches change artifacts. Use when the user wants to validate that implementation is complete, correct, and coherent before archiving.
3
+ description: Verify implementation matches OpenSpec change artifacts. Use when the user wants to validate that implementation is complete, correct, and coherent before archiving. Also use when the user says "openspec verify" or "opsx verify".
4
4
  allowed-tools: Bash(openspec:*)
5
5
  license: MIT
6
6
  compatibility: Requires openspec CLI.
@@ -13,6 +13,17 @@ Verify that an implementation matches the change artifacts (specs, tasks, design
13
13
 
14
14
  **Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `schemas`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
15
15
 
16
+ **Project check:** These steps expect a project that already uses OpenSpec. Before the first step that writes anything (`new change`, `archive`, `sync specs`, or authoring an artifact file), confirm the project has a root: run `openspec list --json` (with `--store <id>` when a store is selected, since the store is then the root) and read `root`. A root object means the project is set up. `"root": null` means it is not - there is no `openspec/` directory here, and a write such as `openspec new change` would create one as a side effect. The command also exits non-zero, which is that answer rather than a broken CLI, so read the JSON instead of retrying or working around it.
17
+
18
+ One `"root": null` is not about setup: when a `status` error message starts with `Declared in` or `Invalid store declaration in` and names this project's `openspec/config.yaml` (or `config.yml`), the project does use OpenSpec through a store it declares, which this machine cannot resolve (the store is not registered, or the `store:` line is malformed). Do not treat it as uninitialized and skip the branches below: stop before writing and show the user that error's `message` and `fix`.
19
+
20
+ Otherwise, with no root, what happens next depends on how this workflow was reached:
21
+
22
+ - **Auto-selected**: you chose this workflow yourself, without the user naming OpenSpec, naming this skill, or running its slash command. Stop using OpenSpec and answer the request normally, as you would with no OpenSpec installed. Do not ask them to set anything up and do not mention OpenSpec setup.
23
+ - **Explicit OpenSpec request**: the user named OpenSpec, named this skill, or ran its slash command. Stop before writing and ask how to proceed: set this project up (`openspec init`), target a store they already have (`--store <id>`), or continue without OpenSpec for this request. Wait for their answer.
24
+
25
+ In both branches, never create the root as a side effect: do not run `openspec init` until the user asks for it, do not hand-create `openspec/` files, and do not let a command create it.
26
+
16
27
  **Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
17
28
 
18
29
  **Steps**
@@ -24,7 +35,7 @@ Verify that an implementation matches the change artifacts (specs, tasks, design
24
35
  - Auto-select if only one active change exists
25
36
  - If ambiguous, run `openspec list --json` to get available changes and ask the user to select one
26
37
 
27
- When prompting, show changes that have implementation tasks (tasks artifact exists).
38
+ When prompting, show all active changes returned by the list, including changes with `status: "no-tasks"`.
28
39
  Include the schema used for each change if available.
29
40
  Mark changes with incomplete tasks as "(In Progress)".
30
41
 
@@ -45,7 +56,9 @@ Verify that an implementation matches the change artifacts (specs, tasks, design
45
56
  openspec instructions apply --change "<name>" --json
46
57
  ```
47
58
 
48
- This returns the change directory and `contextFiles` (artifact ID -> array of concrete file paths). Read all available artifacts from `contextFiles`.
59
+ This returns the change directory, `contextFiles` (artifact ID -> array of concrete file paths), `taskTrackingConfigured`, and top-level `tasks` and `progress` aggregated from every concrete file matched by the schema's `apply.tracks` configuration that could be read. Read all available artifacts from `contextFiles`.
60
+
61
+ Treat apply `state` and `instruction` as context, not a verification verdict. Do not implement tasks or archive the change during verification.
49
62
 
50
63
  4. **Initialize verification report structure**
51
64
 
@@ -56,30 +69,62 @@ Verify that an implementation matches the change artifacts (specs, tasks, design
56
69
 
57
70
  Each dimension can have CRITICAL, WARNING, or SUGGESTION issues.
58
71
 
72
+ Verification is advisory. Respect intentional omissions such as `skip_specs: true`, optional design documents, and schemas without task tracking. Do not require or invent optional or intentionally omitted artifacts to obtain a clean report. `Not verified` describes a limit of this report, not a new archive prerequisite. Archive retains its own checks and user-confirmation behavior.
73
+
74
+ Mark checks the schema does not define, or artifacts the status reports as intentionally skipped, as **Not applicable**. The correctness checks of a change whose readable delta specs contain REMOVED or RENAMED requirements but no ADDED or MODIFIED requirements are also **Not applicable** (see step 6). Exclude them from skipped-check counts and the archive-readiness assessment. Reserve **Not verified** for applicable checks whose evidence is missing or unusable.
75
+
76
+ If only task evidence is available for applicable checks, verify task completion only and mark the remaining applicable checks, including **Code Pattern Consistency**, as not verified with the reason "Only task evidence available".
77
+
78
+ If artifacts cannot be read or contain no usable requirements, scenarios, or design decisions, mark the affected checks as not verified with the specific reason. Continue checks supported by the remaining evidence, but a partially checked input set is not a fully verified check. Missing requirements affect Spec Coverage and Requirement Implementation Mapping; missing scenarios affect Scenario Coverage; missing design decisions affect Design Adherence.
79
+
59
80
  5. **Verify Completeness**
60
81
 
61
82
  **Task Completion**:
62
- - If `contextFiles.tasks` exists, read every file path in it
63
- - Parse checkboxes: `- [ ]` (incomplete) vs `- [x]` (complete)
64
- - Count complete vs total tasks
65
- - If incomplete tasks exist:
66
- - Add CRITICAL issue for each incomplete task
83
+ - If `taskTrackingConfigured` is false, report **Task Completion** as not applicable. Do not treat empty `tasks` as missing evidence.
84
+ - Otherwise, use the top-level `tasks` and `progress` fields. They already aggregate every readable concrete file matched by `apply.tracks`, regardless of the tracked artifact's ID; do not infer tracking from a `contextFiles` key.
85
+ - If `unavailableTrackingFiles` is nonempty, mark **Task Completion** as not verified and include every unavailable path and reason. Continue using any readable task evidence, but do not infer completion from the partial `tasks` and `progress` fields.
86
+ - If `taskTrackingConfigured` is true and `tasks` is empty, mark **Task Completion** as not verified and record the reason from apply `state` and `instruction`. Nonzero totals alone do not establish evaluable task descriptions.
87
+ - Report complete vs total tasks from `progress`.
88
+ - If `progress.remaining` is greater than 0:
89
+ - Add CRITICAL issue for each listed incomplete task. If the remaining count exceeds the listed incomplete tasks, also report the incomplete checkboxes without descriptions and recommend adding descriptions and completing them. Do not infer completion from the listed tasks alone.
67
90
  - Recommendation: "Complete task: <description>" or "Mark as done if already implemented"
68
91
 
69
92
  **Spec Coverage**:
70
- - If delta specs exist in `contextFiles.specs`:
71
- - Extract all requirements (marked with "### Requirement:")
72
- - For each requirement:
93
+ - If status marks the spec artifact skipped by `skip_specs: true`, or the schema defines no spec artifact (no artifact whose `artifactPaths.<id>.outputPath` is under `specs/`), report the spec-dependent checks as not applicable.
94
+ - Otherwise, `contextFiles` is keyed by artifact id, and artifact ids come from the active schema, so do not assume an id such as `specs`. The spec artifacts are those whose `artifactPaths.<id>.outputPath` is under `specs/`; read their files from `contextFiles.<id>`. If those spec files are absent or empty, mark **Spec Coverage**, **Requirement Implementation Mapping**, and **Scenario Coverage** as not verified; do not treat any of them as clean.
95
+ - If delta specs exist in those spec files:
96
+ - Extract all requirements (marked with "### Requirement:", or listed as `FROM:`/`TO:` pairs under `## RENAMED Requirements`) and note the delta section each one sits under: `## ADDED`, `## MODIFIED`, `## REMOVED`, or `## RENAMED Requirements`. The section decides what the check looks for.
97
+ - For each ADDED or MODIFIED requirement (for MODIFIED, check the text in the delta, not the old wording):
73
98
  - Search codebase for keywords related to the requirement
74
99
  - Assess if implementation likely exists
75
- - If requirements appear unimplemented:
100
+ - If ADDED or MODIFIED requirements appear unimplemented:
76
101
  - Add CRITICAL issue: "Requirement not found: <requirement name>"
77
102
  - Recommendation: "Implement requirement X: <description>"
103
+ - For each REMOVED requirement, the change asks for the behavior to be gone, so invert the check:
104
+ - A REMOVED block carries only the requirement name and any `**Reason**`/`**Migration**` notes, so the delta does not describe the behavior itself. Before searching, read the baseline requirement in the main spec at `<planningHome.root>/openspec/specs/<capability-path>/spec.md`, using the same capability path as the delta spec. Match it by exact normalized name, the rule OpenSpec uses when it applies REMOVED blocks: the heading text after `Requirement:`, trimmed, with a closing `#` run dropped only when a space or tab precedes it (so `C#` keeps its `#`), compared case-sensitively. A similarly worded heading is not a match; a rename belongs under RENAMED. Its body and scenarios are the evidence for the behavior that must be gone; never search from the requirement name alone.
105
+ - If that file holds no requirement with that exact normalized name - for example because an earlier sync already applied the removal, or a similarly named ADDED requirement replaced it - recover the baseline from the same file's history, in the planning repository rather than the current directory: `git -C "<planningHome.root>" log -p -- openspec/specs/<capability-path>/spec.md`, or `git -C "<planningHome.root>" show <commit>^:./openspec/specs/<capability-path>/spec.md` once you have identified the commit that applied the removal. Empty output means the pathspec matched nothing, not that there is no baseline: `git log` reports an unmatched path as success, so re-check the path before drawing any conclusion from silence.
106
+ - A baseline that adds nothing to its own title - no body beyond a restatement of the name, no scenarios - is unusable evidence, the same as a missing one. If no usable baseline is available in either place, mark **Spec Coverage** as not verified for that entry with the reason and stop there: do not search, and never count an unsearched removal as passing.
107
+ - Search codebase for that behavior. Matches in `openspec/` artifacts or docs, or in code that serves only the Migration note or an ADDED requirement, are not evidence by themselves. Report any code path that still delivers the removed behavior, including one shared with an ADDED requirement.
108
+ - Finding no implementation is the expected result, but only once the baseline behavior was the thing you searched for. Never report a REMOVED requirement as "Requirement not found" or recommend implementing it.
109
+ - If the behavior is still present:
110
+ - Add CRITICAL issue: "Removed requirement still implemented: <requirement name>"
111
+ - Recommendation: "Remove the remaining implementation at <file>:<lines>, following the requirement's Migration note if it has one"
112
+ - For each RENAMED entry (`FROM:`/`TO:`), the name changes but the behavior stays, so check the TO requirement for that unchanged behavior:
113
+ - Do not report the FROM name as missing, and do not require code symbols, identifiers, or file names to be renamed.
114
+ - If the TO name also appears under MODIFIED, its behavior is checked there against the MODIFIED text; skip it here.
115
+ - Otherwise, read the baseline requirement in the main spec at `<planningHome.root>/openspec/specs/<capability-path>/spec.md`, using the same capability path as the delta spec: the requirement under the FROM name, or under the TO name only when the FROM name is absent because the main spec is already synced. Its body and scenarios are the evidence for the behavior the TO requirement keeps.
116
+ - Search codebase for that behavior and assess if it is still implemented.
117
+ - If it appears unimplemented:
118
+ - Add CRITICAL issue: "Renamed requirement not found: <TO name>"
119
+ - Recommendation: "Restore the behavior of <TO name> (renamed from <FROM name>); a rename must not change behavior"
120
+ - If the baseline requirement cannot be found or read, mark **Spec Coverage** as not verified for that entry with the reason. Never count an unchecked rename as passing.
78
121
 
79
122
  6. **Verify Correctness**
80
123
 
124
+ If the delta specs are readable and contain at least one REMOVED or RENAMED requirement but no ADDED or MODIFIED requirements (the change only removes or renames requirements), report **Requirement Implementation Mapping** and **Scenario Coverage** as **Not applicable**. The REMOVED and RENAMED checks under Spec Coverage are the evidence for such a change (each REMOVED and RENAMED entry with a usable baseline is checked there against its baseline behavior, and an entry already marked not verified there stays not verified), so do not mark these two checks as not verified. A delta spec with no parseable requirements at all is unusable evidence, not a removal-only change: mark these checks as not verified.
125
+
81
126
  **Requirement Implementation Mapping**:
82
- - For each requirement from delta specs:
127
+ - For each ADDED or MODIFIED requirement from delta specs (REMOVED entries, and RENAMED entries without a MODIFIED block, were settled under Spec Coverage):
83
128
  - Search codebase for implementation evidence
84
129
  - If found, note file paths and line ranges
85
130
  - Assess if implementation matches requirement intent
@@ -88,26 +133,29 @@ Verify that an implementation matches the change artifacts (specs, tasks, design
88
133
  - Recommendation: "Review <file>:<lines> against requirement X"
89
134
 
90
135
  **Scenario Coverage**:
91
- - For each scenario in delta specs (marked with "#### Scenario:"):
136
+ - For each scenario under an ADDED or MODIFIED requirement in delta specs (marked with "#### Scenario:"):
92
137
  - Check if conditions are handled in code
93
138
  - Check if tests exist covering the scenario
94
139
  - If scenario appears uncovered:
95
140
  - Add WARNING: "Scenario not covered: <scenario name>"
96
141
  - Recommendation: "Add test or implementation for scenario: <description>"
142
+ - Skip scenarios under a REMOVED requirement; that behavior is meant to be gone.
97
143
 
98
144
  7. **Verify Coherence**
99
145
 
100
146
  **Design Adherence**:
101
- - If `contextFiles.design` exists:
147
+ - If the schema defines no design artifact (no artifact with id `design`, and none whose `artifactPaths.<id>.outputPath` is or ends in `design.md`), report **Design Adherence** as not applicable.
148
+ - If the design artifact's `contextFiles.<id>` file exists:
102
149
  - Extract key decisions (look for sections like "Decision:", "Approach:", "Architecture:")
103
150
  - Verify implementation follows those decisions
104
151
  - If contradiction detected:
105
152
  - Add WARNING: "Design decision not followed: <decision>"
106
153
  - Recommendation: "Update implementation or revise design.md to match reality"
107
- - If no design.md: Skip design adherence check, note "No design.md to verify against"
154
+ - Otherwise, if the design artifact's `contextFiles.<id>` file is absent or empty: mark **Design Adherence** as not verified. With other supporting artifacts, **Code Pattern Consistency** still runs; the task-only case remains limited to task completion.
108
155
 
109
156
  **Code Pattern Consistency**:
110
- - Review new code for consistency with project patterns
157
+ - If implementation changes cannot be identified, mark **Code Pattern Consistency** as not verified and explain the missing evidence.
158
+ - Otherwise, review new code for consistency with project patterns
111
159
  - Check file naming, directory structure, coding style
112
160
  - If significant deviations found:
113
161
  - Add SUGGESTION: "Code pattern deviation: <details>"
@@ -127,11 +175,15 @@ Verify that an implementation matches the change artifacts (specs, tasks, design
127
175
  | Coherence | Followed/Issues |
128
176
  ```
129
177
 
178
+ In each Status cell, report the results of checks that ran and `Not verified (<reason>)` for every skipped check. If all checks in a dimension were skipped, start the cell with `Not verified`. Never score a skipped check as passing. Treat every not verified or partially verified check as skipped in the final assessment. Count only ADDED and MODIFIED requirements in N, and report REMOVED and RENAMED requirements separately (for example, "1 removal confirmed, 1 rename verified", or "1 removal not verified (baseline unavailable)"). For a change that only removes or renames requirements, the Correctness cell reads `Not applicable (no ADDED or MODIFIED requirements)`.
179
+
130
180
  **Issues by Priority**:
131
181
 
132
182
  1. **CRITICAL** (Must fix before archive):
133
183
  - Incomplete tasks
134
184
  - Missing requirement implementations
185
+ - Removed requirements still implemented
186
+ - Renamed requirements whose behavior is no longer implemented
135
187
  - Each with specific, actionable recommendation
136
188
 
137
189
  2. **WARNING** (Should fix):
@@ -145,9 +197,12 @@ Verify that an implementation matches the change artifacts (specs, tasks, design
145
197
  - Each with specific recommendation
146
198
 
147
199
  **Final Assessment**:
148
- - If CRITICAL issues: "X critical issue(s) found. Fix before archiving."
149
- - If only warnings: "No critical issues. Y warning(s) to consider. Ready for archive (with noted improvements)."
150
- - If all clear: "All checks passed. Ready for archive."
200
+ - If CRITICAL issues: "X critical issue(s) found. Fix before archiving." If any check was skipped, also name every skipped check and its reason.
201
+ - If no CRITICAL issues, one or more warnings, and no checks were skipped: "No critical issues. Y warning(s) to consider. Ready for archive (with noted improvements)."
202
+ - If only suggestions and no checks were skipped: "No critical issues or warnings. Z suggestion(s) to consider. Ready for archive (with noted improvements)."
203
+ - If no issues and no checks were skipped: "All checks passed. Ready for archive."
204
+ - If any check was skipped and there are no CRITICAL issues: do not claim readiness. Say "No critical issues found in the checks that ran. <check(s)> not verified: <reason>." Include the warning count when nonzero.
205
+ - Include the suggestion count when nonzero in every final assessment.
151
206
 
152
207
  **Verification Heuristics**
153
208
 
@@ -157,13 +212,6 @@ Verify that an implementation matches the change artifacts (specs, tasks, design
157
212
  - **False Positives**: When uncertain, prefer SUGGESTION over WARNING, WARNING over CRITICAL
158
213
  - **Actionability**: Every issue must have a specific recommendation with file/line references where applicable
159
214
 
160
- **Graceful Degradation**
161
-
162
- - If only tasks.md exists: verify task completion only, skip spec/design checks
163
- - If tasks + specs exist: verify completeness and correctness, skip design
164
- - If full artifacts: verify all three dimensions
165
- - Always note which checks were skipped and why
166
-
167
215
  **Output Format**
168
216
 
169
217
  Use clear markdown with: