@fission-ai/openspec 0.19.0 → 0.21.0

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.
@@ -17,6 +17,8 @@ export function getExploreSkillTemplate() {
17
17
  description: 'Enter explore mode - a thinking partner for exploring ideas, investigating problems, and clarifying requirements. Use when the user wants to think through something before or during a change.',
18
18
  instructions: `Enter explore mode. Think deeply. Visualize freely. Follow the conversation wherever it goes.
19
19
 
20
+ **IMPORTANT: Explore mode is for thinking, not implementing.** You may read files, search code, and investigate the codebase, but you must NEVER write code or implement features. If the user asks you to implement something, remind them to exit explore mode first (e.g., start a change with \`/opsx:new\` or \`/opsx:ff\`). You MAY create OpenSpec artifacts (proposals, designs, specs) if the user asks—that's capturing thinking, not implementing.
21
+
20
22
  **This is a stance, not a workflow.** There are no fixed steps, no required sequence, no mandatory outputs. You're a thinking partner helping the user explore.
21
23
 
22
24
  ---
@@ -24,6 +26,7 @@ export function getExploreSkillTemplate() {
24
26
  ## The Stance
25
27
 
26
28
  - **Curious, not prescriptive** - Ask questions that emerge naturally, don't follow a script
29
+ - **Open threads, not interrogations** - Surface multiple interesting directions and let the user follow what resonates. Don't funnel them through a single path of questions.
27
30
  - **Visual** - Use ASCII diagrams liberally when they'd help clarify thinking
28
31
  - **Adaptive** - Follow interesting threads, pivot when new information emerges
29
32
  - **Patient** - Don't rush to conclusions, let the shape of the problem emerge
@@ -283,6 +286,7 @@ But this summary is optional. Sometimes the thinking IS the value.
283
286
 
284
287
  ## Guardrails
285
288
 
289
+ - **Don't implement** - Never write code or implement features. Creating OpenSpec artifacts is fine, writing application code is not.
286
290
  - **Don't fake understanding** - If something is unclear, dig deeper
287
291
  - **Don't rush** - Discovery is thinking time, not task time
288
292
  - **Don't force structure** - Let patterns emerge naturally
@@ -376,7 +380,7 @@ export function getContinueChangeSkillTemplate() {
376
380
  description: 'Continue working on an OpenSpec change by creating the next artifact. Use when the user wants to progress their change, create the next artifact, or continue their workflow.',
377
381
  instructions: `Continue working on a change by creating the next artifact.
378
382
 
379
- **Input**: Optionally specify a change name. If omitted, MUST prompt for available changes.
383
+ **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.
380
384
 
381
385
  **Steps**
382
386
 
@@ -489,19 +493,18 @@ export function getApplyChangeSkillTemplate() {
489
493
  description: 'Implement tasks from an OpenSpec change. Use when the user wants to start implementing, continue implementation, or work through tasks.',
490
494
  instructions: `Implement tasks from an OpenSpec change.
491
495
 
492
- **Input**: Optionally specify a change name. If omitted, MUST prompt for available changes.
496
+ **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.
493
497
 
494
498
  **Steps**
495
499
 
496
- 1. **If no change name provided, prompt for selection**
500
+ 1. **Select the change**
497
501
 
498
- Run \`openspec list --json\` to get available changes. Use the **AskUserQuestion tool** to let the user select.
502
+ If a name is provided, use it. Otherwise:
503
+ - Infer from conversation context if the user mentioned a change
504
+ - Auto-select if only one active change exists
505
+ - If ambiguous, run \`openspec list --json\` to get available changes and use the **AskUserQuestion tool** to let the user select
499
506
 
500
- Show changes that are implementation-ready (have tasks artifact).
501
- Include the schema used for each change if available.
502
- Mark changes with incomplete tasks as "(In Progress)".
503
-
504
- **IMPORTANT**: Do NOT guess or auto-select a change. Always let the user choose.
507
+ Always announce: "Using change: <name>" and how to override (e.g., \`/opsx:apply <other>\`).
505
508
 
506
509
  2. **Check status to understand the schema**
507
510
  \`\`\`bash
@@ -742,7 +745,7 @@ export function getSyncSpecsSkillTemplate() {
742
745
 
743
746
  This is an **agent-driven** operation - you will read delta specs and directly edit main specs to apply the changes. This allows intelligent merging (e.g., adding a scenario without copying the entire requirement).
744
747
 
745
- **Input**: Optionally specify a change name. If omitted, MUST prompt for available changes.
748
+ **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.
746
749
 
747
750
  **Steps**
748
751
 
@@ -879,6 +882,8 @@ export function getOpsxExploreCommandTemplate() {
879
882
  tags: ['workflow', 'explore', 'experimental', 'thinking'],
880
883
  content: `Enter explore mode. Think deeply. Visualize freely. Follow the conversation wherever it goes.
881
884
 
885
+ **IMPORTANT: Explore mode is for thinking, not implementing.** You may read files, search code, and investigate the codebase, but you must NEVER write code or implement features. If the user asks you to implement something, remind them to exit explore mode first (e.g., start a change with \`/opsx:new\` or \`/opsx:ff\`). You MAY create OpenSpec artifacts (proposals, designs, specs) if the user asks—that's capturing thinking, not implementing.
886
+
882
887
  **This is a stance, not a workflow.** There are no fixed steps, no required sequence, no mandatory outputs. You're a thinking partner helping the user explore.
883
888
 
884
889
  **Input**: The argument after \`/opsx:explore\` is whatever the user wants to think about. Could be:
@@ -893,6 +898,7 @@ export function getOpsxExploreCommandTemplate() {
893
898
  ## The Stance
894
899
 
895
900
  - **Curious, not prescriptive** - Ask questions that emerge naturally, don't follow a script
901
+ - **Open threads, not interrogations** - Surface multiple interesting directions and let the user follow what resonates. Don't funnel them through a single path of questions.
896
902
  - **Visual** - Use ASCII diagrams liberally when they'd help clarify thinking
897
903
  - **Adaptive** - Follow interesting threads, pivot when new information emerges
898
904
  - **Patient** - Don't rush to conclusions, let the shape of the problem emerge
@@ -1033,6 +1039,7 @@ When things crystallize, you might offer a summary - but it's optional. Sometime
1033
1039
 
1034
1040
  ## Guardrails
1035
1041
 
1042
+ - **Don't implement** - Never write code or implement features. Creating OpenSpec artifacts is fine, writing application code is not.
1036
1043
  - **Don't fake understanding** - If something is unclear, dig deeper
1037
1044
  - **Don't rush** - Discovery is thinking time, not task time
1038
1045
  - **Don't force structure** - Let patterns emerge naturally
@@ -1127,7 +1134,7 @@ export function getOpsxContinueCommandTemplate() {
1127
1134
  tags: ['workflow', 'artifacts', 'experimental'],
1128
1135
  content: `Continue working on a change by creating the next artifact.
1129
1136
 
1130
- **Input**: Optionally specify \`--change <name>\` after \`/opsx:continue\`. If omitted, MUST prompt for available changes.
1137
+ **Input**: Optionally specify a change name after \`/opsx:continue\` (e.g., \`/opsx:continue add-auth\`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
1131
1138
 
1132
1139
  **Steps**
1133
1140
 
@@ -1241,19 +1248,18 @@ export function getOpsxApplyCommandTemplate() {
1241
1248
  tags: ['workflow', 'artifacts', 'experimental'],
1242
1249
  content: `Implement tasks from an OpenSpec change.
1243
1250
 
1244
- **Input**: Optionally specify \`--change <name>\` after \`/opsx:apply\`. If omitted, MUST prompt for available changes.
1251
+ **Input**: Optionally specify a change name (e.g., \`/opsx:apply add-auth\`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
1245
1252
 
1246
1253
  **Steps**
1247
1254
 
1248
- 1. **If no change name provided, prompt for selection**
1249
-
1250
- Run \`openspec list --json\` to get available changes. Use the **AskUserQuestion tool** to let the user select.
1255
+ 1. **Select the change**
1251
1256
 
1252
- Show changes that are implementation-ready (have tasks artifact).
1253
- Include the schema used for each change if available.
1254
- Mark changes with incomplete tasks as "(In Progress)".
1257
+ If a name is provided, use it. Otherwise:
1258
+ - Infer from conversation context if the user mentioned a change
1259
+ - Auto-select if only one active change exists
1260
+ - If ambiguous, run \`openspec list --json\` to get available changes and use the **AskUserQuestion tool** to let the user select
1255
1261
 
1256
- **IMPORTANT**: Do NOT guess or auto-select a change. Always let the user choose.
1262
+ Always announce: "Using change: <name>" and how to override (e.g., \`/opsx:apply <other>\`).
1257
1263
 
1258
1264
  2. **Check status to understand the schema**
1259
1265
  \`\`\`bash
@@ -1493,7 +1499,7 @@ export function getArchiveChangeSkillTemplate() {
1493
1499
  description: 'Archive a completed change in the experimental workflow. Use when the user wants to finalize and archive a change after implementation is complete.',
1494
1500
  instructions: `Archive a completed change in the experimental workflow.
1495
1501
 
1496
- **Input**: Optionally specify a change name. If omitted, MUST prompt for available changes.
1502
+ **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.
1497
1503
 
1498
1504
  **Steps**
1499
1505
 
@@ -1532,38 +1538,20 @@ export function getArchiveChangeSkillTemplate() {
1532
1538
 
1533
1539
  **If no tasks file exists:** Proceed without task-related warning.
1534
1540
 
1535
- 4. **Check if delta specs need syncing**
1536
-
1537
- Check if \`specs/\` directory exists in the change with spec files.
1538
-
1539
- **If delta specs exist, perform a quick sync check:**
1540
-
1541
- a. **For each delta spec** at \`openspec/changes/<name>/specs/<capability>/spec.md\`:
1542
- - Extract requirement names (lines matching \`### Requirement: <name>\`)
1543
- - Note which sections exist (ADDED, MODIFIED, REMOVED)
1544
-
1545
- b. **Check corresponding main spec** at \`openspec/specs/<capability>/spec.md\`:
1546
- - If main spec doesn't exist → needs sync
1547
- - If main spec exists, check if ADDED requirement names appear in it
1548
- - If any ADDED requirements are missing from main spec → needs sync
1541
+ 4. **Assess delta spec sync state**
1549
1542
 
1550
- c. **Report findings:**
1543
+ Check for delta specs at \`openspec/changes/<name>/specs/\`. If none exist, proceed without sync prompt.
1551
1544
 
1552
- **If sync needed:**
1553
- \`\`\`
1554
- ⚠️ Delta specs may not be synced:
1555
- - specs/auth/spec.md Main spec missing requirement "Token Refresh"
1556
- - specs/api/spec.md → Main spec doesn't exist yet
1545
+ **If delta specs exist:**
1546
+ - Compare each delta spec with its corresponding main spec at \`openspec/specs/<capability>/spec.md\`
1547
+ - Determine what changes would be applied (adds, modifications, removals, renames)
1548
+ - Show a combined summary before prompting
1557
1549
 
1558
- Would you like to sync now before archiving?
1559
- \`\`\`
1560
- - Use **AskUserQuestion tool** with options: "Sync now", "Archive without syncing"
1561
- - If user chooses sync, execute /opsx:sync logic (use the openspec-sync-specs skill)
1550
+ **Prompt options:**
1551
+ - If changes needed: "Sync now (recommended)", "Archive without syncing"
1552
+ - If already synced: "Archive now", "Sync anyway", "Cancel"
1562
1553
 
1563
- **If already synced (all requirements found):**
1564
- - Proceed without prompting (specs appear to be in sync)
1565
-
1566
- **If no delta specs exist:** Proceed without sync-related checks.
1554
+ If user chooses sync, execute /opsx:sync logic (use the openspec-sync-specs skill). Proceed to archive regardless of choice.
1567
1555
 
1568
1556
  5. **Perform the archive**
1569
1557
 
@@ -1599,7 +1587,7 @@ export function getArchiveChangeSkillTemplate() {
1599
1587
  **Change:** <change-name>
1600
1588
  **Schema:** <schema-name>
1601
1589
  **Archived to:** openspec/changes/archive/YYYY-MM-DD-<name>/
1602
- **Specs:** ✓ Synced to main specs (or "No delta specs" or "⚠️ Not synced")
1590
+ **Specs:** ✓ Synced to main specs (or "No delta specs" or "Sync skipped")
1603
1591
 
1604
1592
  All artifacts complete. All tasks complete.
1605
1593
  \`\`\`
@@ -1611,7 +1599,7 @@ All artifacts complete. All tasks complete.
1611
1599
  - Preserve .openspec.yaml when moving to archive (it moves with the directory)
1612
1600
  - Show clear summary of what happened
1613
1601
  - If sync is requested, use openspec-sync-specs approach (agent-driven)
1614
- - Quick sync check: look for requirement names in delta specs, verify they exist in main specs`
1602
+ - If delta specs exist, always run the sync assessment and show the combined summary before prompting`
1615
1603
  };
1616
1604
  }
1617
1605
  /**
@@ -1627,7 +1615,7 @@ export function getOpsxSyncCommandTemplate() {
1627
1615
 
1628
1616
  This is an **agent-driven** operation - you will read delta specs and directly edit main specs to apply the changes. This allows intelligent merging (e.g., adding a scenario without copying the entire requirement).
1629
1617
 
1630
- **Input**: Optionally specify \`--change <name>\` after \`/opsx:sync\`. If omitted, MUST prompt for available changes.
1618
+ **Input**: Optionally specify a change name after \`/opsx:sync\` (e.g., \`/opsx:sync add-auth\`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
1631
1619
 
1632
1620
  **Steps**
1633
1621
 
@@ -1752,6 +1740,173 @@ Main specs are now updated. The change remains active - archive when implementat
1752
1740
  - The operation should be idempotent - running twice should give same result`
1753
1741
  };
1754
1742
  }
1743
+ /**
1744
+ * Template for openspec-verify-change skill
1745
+ * For verifying implementation matches change artifacts before archiving
1746
+ */
1747
+ export function getVerifyChangeSkillTemplate() {
1748
+ return {
1749
+ name: 'openspec-verify-change',
1750
+ description: 'Verify implementation matches change artifacts. Use when the user wants to validate that implementation is complete, correct, and coherent before archiving.',
1751
+ instructions: `Verify that an implementation matches the change artifacts (specs, tasks, design).
1752
+
1753
+ **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.
1754
+
1755
+ **Steps**
1756
+
1757
+ 1. **If no change name provided, prompt for selection**
1758
+
1759
+ Run \`openspec list --json\` to get available changes. Use the **AskUserQuestion tool** to let the user select.
1760
+
1761
+ Show changes that have implementation tasks (tasks artifact exists).
1762
+ Include the schema used for each change if available.
1763
+ Mark changes with incomplete tasks as "(In Progress)".
1764
+
1765
+ **IMPORTANT**: Do NOT guess or auto-select a change. Always let the user choose.
1766
+
1767
+ 2. **Check status to understand the schema**
1768
+ \`\`\`bash
1769
+ openspec status --change "<name>" --json
1770
+ \`\`\`
1771
+ Parse the JSON to understand:
1772
+ - \`schemaName\`: The workflow being used (e.g., "spec-driven", "tdd")
1773
+ - Which artifacts exist for this change
1774
+
1775
+ 3. **Get the change directory and load artifacts**
1776
+
1777
+ \`\`\`bash
1778
+ openspec instructions apply --change "<name>" --json
1779
+ \`\`\`
1780
+
1781
+ This returns the change directory and context files. Read all available artifacts from \`contextFiles\`.
1782
+
1783
+ 4. **Initialize verification report structure**
1784
+
1785
+ Create a report structure with three dimensions:
1786
+ - **Completeness**: Track tasks and spec coverage
1787
+ - **Correctness**: Track requirement implementation and scenario coverage
1788
+ - **Coherence**: Track design adherence and pattern consistency
1789
+
1790
+ Each dimension can have CRITICAL, WARNING, or SUGGESTION issues.
1791
+
1792
+ 5. **Verify Completeness**
1793
+
1794
+ **Task Completion**:
1795
+ - If tasks.md exists in contextFiles, read it
1796
+ - Parse checkboxes: \`- [ ]\` (incomplete) vs \`- [x]\` (complete)
1797
+ - Count complete vs total tasks
1798
+ - If incomplete tasks exist:
1799
+ - Add CRITICAL issue for each incomplete task
1800
+ - Recommendation: "Complete task: <description>" or "Mark as done if already implemented"
1801
+
1802
+ **Spec Coverage**:
1803
+ - If delta specs exist in \`openspec/changes/<name>/specs/\`:
1804
+ - Extract all requirements (marked with "### Requirement:")
1805
+ - For each requirement:
1806
+ - Search codebase for keywords related to the requirement
1807
+ - Assess if implementation likely exists
1808
+ - If requirements appear unimplemented:
1809
+ - Add CRITICAL issue: "Requirement not found: <requirement name>"
1810
+ - Recommendation: "Implement requirement X: <description>"
1811
+
1812
+ 6. **Verify Correctness**
1813
+
1814
+ **Requirement Implementation Mapping**:
1815
+ - For each requirement from delta specs:
1816
+ - Search codebase for implementation evidence
1817
+ - If found, note file paths and line ranges
1818
+ - Assess if implementation matches requirement intent
1819
+ - If divergence detected:
1820
+ - Add WARNING: "Implementation may diverge from spec: <details>"
1821
+ - Recommendation: "Review <file>:<lines> against requirement X"
1822
+
1823
+ **Scenario Coverage**:
1824
+ - For each scenario in delta specs (marked with "#### Scenario:"):
1825
+ - Check if conditions are handled in code
1826
+ - Check if tests exist covering the scenario
1827
+ - If scenario appears uncovered:
1828
+ - Add WARNING: "Scenario not covered: <scenario name>"
1829
+ - Recommendation: "Add test or implementation for scenario: <description>"
1830
+
1831
+ 7. **Verify Coherence**
1832
+
1833
+ **Design Adherence**:
1834
+ - If design.md exists in contextFiles:
1835
+ - Extract key decisions (look for sections like "Decision:", "Approach:", "Architecture:")
1836
+ - Verify implementation follows those decisions
1837
+ - If contradiction detected:
1838
+ - Add WARNING: "Design decision not followed: <decision>"
1839
+ - Recommendation: "Update implementation or revise design.md to match reality"
1840
+ - If no design.md: Skip design adherence check, note "No design.md to verify against"
1841
+
1842
+ **Code Pattern Consistency**:
1843
+ - Review new code for consistency with project patterns
1844
+ - Check file naming, directory structure, coding style
1845
+ - If significant deviations found:
1846
+ - Add SUGGESTION: "Code pattern deviation: <details>"
1847
+ - Recommendation: "Consider following project pattern: <example>"
1848
+
1849
+ 8. **Generate Verification Report**
1850
+
1851
+ **Summary Scorecard**:
1852
+ \`\`\`
1853
+ ## Verification Report: <change-name>
1854
+
1855
+ ### Summary
1856
+ | Dimension | Status |
1857
+ |--------------|------------------|
1858
+ | Completeness | X/Y tasks, N reqs|
1859
+ | Correctness | M/N reqs covered |
1860
+ | Coherence | Followed/Issues |
1861
+ \`\`\`
1862
+
1863
+ **Issues by Priority**:
1864
+
1865
+ 1. **CRITICAL** (Must fix before archive):
1866
+ - Incomplete tasks
1867
+ - Missing requirement implementations
1868
+ - Each with specific, actionable recommendation
1869
+
1870
+ 2. **WARNING** (Should fix):
1871
+ - Spec/design divergences
1872
+ - Missing scenario coverage
1873
+ - Each with specific recommendation
1874
+
1875
+ 3. **SUGGESTION** (Nice to fix):
1876
+ - Pattern inconsistencies
1877
+ - Minor improvements
1878
+ - Each with specific recommendation
1879
+
1880
+ **Final Assessment**:
1881
+ - If CRITICAL issues: "X critical issue(s) found. Fix before archiving."
1882
+ - If only warnings: "No critical issues. Y warning(s) to consider. Ready for archive (with noted improvements)."
1883
+ - If all clear: "All checks passed. Ready for archive."
1884
+
1885
+ **Verification Heuristics**
1886
+
1887
+ - **Completeness**: Focus on objective checklist items (checkboxes, requirements list)
1888
+ - **Correctness**: Use keyword search, file path analysis, reasonable inference - don't require perfect certainty
1889
+ - **Coherence**: Look for glaring inconsistencies, don't nitpick style
1890
+ - **False Positives**: When uncertain, prefer SUGGESTION over WARNING, WARNING over CRITICAL
1891
+ - **Actionability**: Every issue must have a specific recommendation with file/line references where applicable
1892
+
1893
+ **Graceful Degradation**
1894
+
1895
+ - If only tasks.md exists: verify task completion only, skip spec/design checks
1896
+ - If tasks + specs exist: verify completeness and correctness, skip design
1897
+ - If full artifacts: verify all three dimensions
1898
+ - Always note which checks were skipped and why
1899
+
1900
+ **Output Format**
1901
+
1902
+ Use clear markdown with:
1903
+ - Table for summary scorecard
1904
+ - Grouped lists for issues (CRITICAL/WARNING/SUGGESTION)
1905
+ - Code references in format: \`file.ts:123\`
1906
+ - Specific, actionable recommendations
1907
+ - No vague suggestions like "consider reviewing"`
1908
+ };
1909
+ }
1755
1910
  /**
1756
1911
  * Template for /opsx:archive slash command
1757
1912
  */
@@ -1763,7 +1918,7 @@ export function getOpsxArchiveCommandTemplate() {
1763
1918
  tags: ['workflow', 'archive', 'experimental'],
1764
1919
  content: `Archive a completed change in the experimental workflow.
1765
1920
 
1766
- **Input**: Optionally specify \`--change <name>\` after \`/opsx:archive\`. If omitted, MUST prompt for available changes.
1921
+ **Input**: Optionally specify a change name after \`/opsx:archive\` (e.g., \`/opsx:archive add-auth\`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
1767
1922
 
1768
1923
  **Steps**
1769
1924
 
@@ -1802,38 +1957,20 @@ export function getOpsxArchiveCommandTemplate() {
1802
1957
 
1803
1958
  **If no tasks file exists:** Proceed without task-related warning.
1804
1959
 
1805
- 4. **Check if delta specs need syncing**
1806
-
1807
- Check if \`specs/\` directory exists in the change with spec files.
1808
-
1809
- **If delta specs exist, perform a quick sync check:**
1810
-
1811
- a. **For each delta spec** at \`openspec/changes/<name>/specs/<capability>/spec.md\`:
1812
- - Extract requirement names (lines matching \`### Requirement: <name>\`)
1813
- - Note which sections exist (ADDED, MODIFIED, REMOVED)
1814
-
1815
- b. **Check corresponding main spec** at \`openspec/specs/<capability>/spec.md\`:
1816
- - If main spec doesn't exist → needs sync
1817
- - If main spec exists, check if ADDED requirement names appear in it
1818
- - If any ADDED requirements are missing from main spec → needs sync
1960
+ 4. **Assess delta spec sync state**
1819
1961
 
1820
- c. **Report findings:**
1962
+ Check for delta specs at \`openspec/changes/<name>/specs/\`. If none exist, proceed without sync prompt.
1821
1963
 
1822
- **If sync needed:**
1823
- \`\`\`
1824
- ⚠️ Delta specs may not be synced:
1825
- - specs/auth/spec.md Main spec missing requirement "Token Refresh"
1826
- - specs/api/spec.md → Main spec doesn't exist yet
1964
+ **If delta specs exist:**
1965
+ - Compare each delta spec with its corresponding main spec at \`openspec/specs/<capability>/spec.md\`
1966
+ - Determine what changes would be applied (adds, modifications, removals, renames)
1967
+ - Show a combined summary before prompting
1827
1968
 
1828
- Would you like to sync now before archiving?
1829
- \`\`\`
1830
- - Use **AskUserQuestion tool** with options: "Sync now", "Archive without syncing"
1831
- - If user chooses sync, execute \`/opsx:sync\` logic
1969
+ **Prompt options:**
1970
+ - If changes needed: "Sync now (recommended)", "Archive without syncing"
1971
+ - If already synced: "Archive now", "Sync anyway", "Cancel"
1832
1972
 
1833
- **If already synced (all requirements found):**
1834
- - Proceed without prompting (specs appear to be in sync)
1835
-
1836
- **If no delta specs exist:** Proceed without sync-related checks.
1973
+ If user chooses sync, execute \`/opsx:sync\` logic. Proceed to archive regardless of choice.
1837
1974
 
1838
1975
  5. **Perform the archive**
1839
1976
 
@@ -1858,7 +1995,7 @@ export function getOpsxArchiveCommandTemplate() {
1858
1995
  - Change name
1859
1996
  - Schema that was used
1860
1997
  - Archive location
1861
- - Spec sync status (synced / not synced / no delta specs)
1998
+ - Spec sync status (synced / sync skipped / no delta specs)
1862
1999
  - Note about any warnings (incomplete artifacts/tasks)
1863
2000
 
1864
2001
  **Output On Success**
@@ -1895,12 +2032,12 @@ All artifacts complete. All tasks complete.
1895
2032
  **Change:** <change-name>
1896
2033
  **Schema:** <schema-name>
1897
2034
  **Archived to:** openspec/changes/archive/YYYY-MM-DD-<name>/
1898
- **Specs:** ⚠️ Not synced
2035
+ **Specs:** Sync skipped (user chose to skip)
1899
2036
 
1900
2037
  **Warnings:**
1901
2038
  - Archived with 2 incomplete artifacts
1902
2039
  - Archived with 3 incomplete tasks
1903
- - Delta specs were not synced (user chose to skip)
2040
+ - Delta spec sync was skipped (user chose to skip)
1904
2041
 
1905
2042
  Review the archive if this was not intentional.
1906
2043
  \`\`\`
@@ -1926,9 +2063,285 @@ Target archive directory already exists.
1926
2063
  - Use artifact graph (openspec status --json) for completion checking
1927
2064
  - Don't block archive on warnings - just inform and confirm
1928
2065
  - Preserve .openspec.yaml when moving to archive (it moves with the directory)
1929
- - Quick sync check: look for requirement names in delta specs, verify they exist in main specs
1930
2066
  - Show clear summary of what happened
1931
- - If sync is requested, use /opsx:sync approach (agent-driven)`
2067
+ - If sync is requested, use /opsx:sync approach (agent-driven)
2068
+ - If delta specs exist, always run the sync assessment and show the combined summary before prompting`
2069
+ };
2070
+ }
2071
+ /**
2072
+ * Template for /opsx:verify slash command
2073
+ */
2074
+ export function getOpsxVerifyCommandTemplate() {
2075
+ return {
2076
+ name: 'OPSX: Verify',
2077
+ description: 'Verify implementation matches change artifacts before archiving',
2078
+ category: 'Workflow',
2079
+ tags: ['workflow', 'verify', 'experimental'],
2080
+ content: `Verify that an implementation matches the change artifacts (specs, tasks, design).
2081
+
2082
+ **Input**: Optionally specify a change name after \`/opsx:verify\` (e.g., \`/opsx:verify add-auth\`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
2083
+
2084
+ **Steps**
2085
+
2086
+ 1. **If no change name provided, prompt for selection**
2087
+
2088
+ Run \`openspec list --json\` to get available changes. Use the **AskUserQuestion tool** to let the user select.
2089
+
2090
+ Show changes that have implementation tasks (tasks artifact exists).
2091
+ Include the schema used for each change if available.
2092
+ Mark changes with incomplete tasks as "(In Progress)".
2093
+
2094
+ **IMPORTANT**: Do NOT guess or auto-select a change. Always let the user choose.
2095
+
2096
+ 2. **Check status to understand the schema**
2097
+ \`\`\`bash
2098
+ openspec status --change "<name>" --json
2099
+ \`\`\`
2100
+ Parse the JSON to understand:
2101
+ - \`schemaName\`: The workflow being used (e.g., "spec-driven", "tdd")
2102
+ - Which artifacts exist for this change
2103
+
2104
+ 3. **Get the change directory and load artifacts**
2105
+
2106
+ \`\`\`bash
2107
+ openspec instructions apply --change "<name>" --json
2108
+ \`\`\`
2109
+
2110
+ This returns the change directory and context files. Read all available artifacts from \`contextFiles\`.
2111
+
2112
+ 4. **Initialize verification report structure**
2113
+
2114
+ Create a report structure with three dimensions:
2115
+ - **Completeness**: Track tasks and spec coverage
2116
+ - **Correctness**: Track requirement implementation and scenario coverage
2117
+ - **Coherence**: Track design adherence and pattern consistency
2118
+
2119
+ Each dimension can have CRITICAL, WARNING, or SUGGESTION issues.
2120
+
2121
+ 5. **Verify Completeness**
2122
+
2123
+ **Task Completion**:
2124
+ - If tasks.md exists in contextFiles, read it
2125
+ - Parse checkboxes: \`- [ ]\` (incomplete) vs \`- [x]\` (complete)
2126
+ - Count complete vs total tasks
2127
+ - If incomplete tasks exist:
2128
+ - Add CRITICAL issue for each incomplete task
2129
+ - Recommendation: "Complete task: <description>" or "Mark as done if already implemented"
2130
+
2131
+ **Spec Coverage**:
2132
+ - If delta specs exist in \`openspec/changes/<name>/specs/\`:
2133
+ - Extract all requirements (marked with "### Requirement:")
2134
+ - For each requirement:
2135
+ - Search codebase for keywords related to the requirement
2136
+ - Assess if implementation likely exists
2137
+ - If requirements appear unimplemented:
2138
+ - Add CRITICAL issue: "Requirement not found: <requirement name>"
2139
+ - Recommendation: "Implement requirement X: <description>"
2140
+
2141
+ 6. **Verify Correctness**
2142
+
2143
+ **Requirement Implementation Mapping**:
2144
+ - For each requirement from delta specs:
2145
+ - Search codebase for implementation evidence
2146
+ - If found, note file paths and line ranges
2147
+ - Assess if implementation matches requirement intent
2148
+ - If divergence detected:
2149
+ - Add WARNING: "Implementation may diverge from spec: <details>"
2150
+ - Recommendation: "Review <file>:<lines> against requirement X"
2151
+
2152
+ **Scenario Coverage**:
2153
+ - For each scenario in delta specs (marked with "#### Scenario:"):
2154
+ - Check if conditions are handled in code
2155
+ - Check if tests exist covering the scenario
2156
+ - If scenario appears uncovered:
2157
+ - Add WARNING: "Scenario not covered: <scenario name>"
2158
+ - Recommendation: "Add test or implementation for scenario: <description>"
2159
+
2160
+ 7. **Verify Coherence**
2161
+
2162
+ **Design Adherence**:
2163
+ - If design.md exists in contextFiles:
2164
+ - Extract key decisions (look for sections like "Decision:", "Approach:", "Architecture:")
2165
+ - Verify implementation follows those decisions
2166
+ - If contradiction detected:
2167
+ - Add WARNING: "Design decision not followed: <decision>"
2168
+ - Recommendation: "Update implementation or revise design.md to match reality"
2169
+ - If no design.md: Skip design adherence check, note "No design.md to verify against"
2170
+
2171
+ **Code Pattern Consistency**:
2172
+ - Review new code for consistency with project patterns
2173
+ - Check file naming, directory structure, coding style
2174
+ - If significant deviations found:
2175
+ - Add SUGGESTION: "Code pattern deviation: <details>"
2176
+ - Recommendation: "Consider following project pattern: <example>"
2177
+
2178
+ 8. **Generate Verification Report**
2179
+
2180
+ **Summary Scorecard**:
2181
+ \`\`\`
2182
+ ## Verification Report: <change-name>
2183
+
2184
+ ### Summary
2185
+ | Dimension | Status |
2186
+ |--------------|------------------|
2187
+ | Completeness | X/Y tasks, N reqs|
2188
+ | Correctness | M/N reqs covered |
2189
+ | Coherence | Followed/Issues |
2190
+ \`\`\`
2191
+
2192
+ **Issues by Priority**:
2193
+
2194
+ 1. **CRITICAL** (Must fix before archive):
2195
+ - Incomplete tasks
2196
+ - Missing requirement implementations
2197
+ - Each with specific, actionable recommendation
2198
+
2199
+ 2. **WARNING** (Should fix):
2200
+ - Spec/design divergences
2201
+ - Missing scenario coverage
2202
+ - Each with specific recommendation
2203
+
2204
+ 3. **SUGGESTION** (Nice to fix):
2205
+ - Pattern inconsistencies
2206
+ - Minor improvements
2207
+ - Each with specific recommendation
2208
+
2209
+ **Final Assessment**:
2210
+ - If CRITICAL issues: "X critical issue(s) found. Fix before archiving."
2211
+ - If only warnings: "No critical issues. Y warning(s) to consider. Ready for archive (with noted improvements)."
2212
+ - If all clear: "All checks passed. Ready for archive."
2213
+
2214
+ **Verification Heuristics**
2215
+
2216
+ - **Completeness**: Focus on objective checklist items (checkboxes, requirements list)
2217
+ - **Correctness**: Use keyword search, file path analysis, reasonable inference - don't require perfect certainty
2218
+ - **Coherence**: Look for glaring inconsistencies, don't nitpick style
2219
+ - **False Positives**: When uncertain, prefer SUGGESTION over WARNING, WARNING over CRITICAL
2220
+ - **Actionability**: Every issue must have a specific recommendation with file/line references where applicable
2221
+
2222
+ **Graceful Degradation**
2223
+
2224
+ - If only tasks.md exists: verify task completion only, skip spec/design checks
2225
+ - If tasks + specs exist: verify completeness and correctness, skip design
2226
+ - If full artifacts: verify all three dimensions
2227
+ - Always note which checks were skipped and why
2228
+
2229
+ **Output Format**
2230
+
2231
+ Use clear markdown with:
2232
+ - Table for summary scorecard
2233
+ - Grouped lists for issues (CRITICAL/WARNING/SUGGESTION)
2234
+ - Code references in format: \`file.ts:123\`
2235
+ - Specific, actionable recommendations
2236
+ - No vague suggestions like "consider reviewing"`
2237
+ };
2238
+ }
2239
+ /**
2240
+ * Template for feedback skill
2241
+ * For collecting and submitting user feedback with context enrichment
2242
+ */
2243
+ export function getFeedbackSkillTemplate() {
2244
+ return {
2245
+ name: 'feedback',
2246
+ description: 'Collect and submit user feedback about OpenSpec with context enrichment and anonymization.',
2247
+ instructions: `Help the user submit feedback about OpenSpec.
2248
+
2249
+ **Goal**: Guide the user through collecting, enriching, and submitting feedback while ensuring privacy through anonymization.
2250
+
2251
+ **Process**
2252
+
2253
+ 1. **Gather context from the conversation**
2254
+ - Review recent conversation history for context
2255
+ - Identify what task was being performed
2256
+ - Note what worked well or poorly
2257
+ - Capture specific friction points or praise
2258
+
2259
+ 2. **Draft enriched feedback**
2260
+ - Create a clear, descriptive title (single sentence, no "Feedback:" prefix needed)
2261
+ - Write a body that includes:
2262
+ - What the user was trying to do
2263
+ - What happened (good or bad)
2264
+ - Relevant context from the conversation
2265
+ - Any specific suggestions or requests
2266
+
2267
+ 3. **Anonymize sensitive information**
2268
+ - Replace file paths with \`<path>\` or generic descriptions
2269
+ - Replace API keys, tokens, secrets with \`<redacted>\`
2270
+ - Replace company/organization names with \`<company>\`
2271
+ - Replace personal names with \`<user>\`
2272
+ - Replace specific URLs with \`<url>\` unless public/relevant
2273
+ - Keep technical details that help understand the issue
2274
+
2275
+ 4. **Present draft for approval**
2276
+ - Show the complete draft to the user
2277
+ - Display both title and body clearly
2278
+ - Ask for explicit approval before submitting
2279
+ - Allow the user to request modifications
2280
+
2281
+ 5. **Submit on confirmation**
2282
+ - Use the \`openspec feedback\` command to submit
2283
+ - Format: \`openspec feedback "title" --body "body content"\`
2284
+ - The command will automatically add metadata (version, platform, timestamp)
2285
+
2286
+ **Example Draft**
2287
+
2288
+ \`\`\`
2289
+ Title: Error handling in artifact workflow needs improvement
2290
+
2291
+ Body:
2292
+ I was working on creating a new change and encountered an issue with
2293
+ the artifact workflow. When I tried to continue after creating the
2294
+ proposal, the system didn't clearly indicate that I needed to complete
2295
+ the specs first.
2296
+
2297
+ Suggestion: Add clearer error messages that explain dependency chains
2298
+ in the artifact workflow. Something like "Cannot create design.md
2299
+ because specs are not complete (0/2 done)."
2300
+
2301
+ Context: Using the spec-driven schema with <path>/my-project
2302
+ \`\`\`
2303
+
2304
+ **Anonymization Examples**
2305
+
2306
+ Before:
2307
+ \`\`\`
2308
+ Working on /Users/john/mycompany/auth-service/src/oauth.ts
2309
+ Failed with API key: sk_live_abc123xyz
2310
+ Working at Acme Corp
2311
+ \`\`\`
2312
+
2313
+ After:
2314
+ \`\`\`
2315
+ Working on <path>/oauth.ts
2316
+ Failed with API key: <redacted>
2317
+ Working at <company>
2318
+ \`\`\`
2319
+
2320
+ **Guardrails**
2321
+
2322
+ - MUST show complete draft before submitting
2323
+ - MUST ask for explicit approval
2324
+ - MUST anonymize sensitive information
2325
+ - ALLOW user to modify draft before submitting
2326
+ - DO NOT submit without user confirmation
2327
+ - DO include relevant technical context
2328
+ - DO keep conversation-specific insights
2329
+
2330
+ **User Confirmation Required**
2331
+
2332
+ Always ask:
2333
+ \`\`\`
2334
+ Here's the feedback I've drafted:
2335
+
2336
+ Title: [title]
2337
+
2338
+ Body:
2339
+ [body]
2340
+
2341
+ Does this look good? I can modify it if you'd like, or submit it as-is.
2342
+ \`\`\`
2343
+
2344
+ Only proceed with submission after user confirms.`
1932
2345
  };
1933
2346
  }
1934
2347
  //# sourceMappingURL=skill-templates.js.map