1---2name: openspec-verify-change3description: Verify implementation matches change artifacts. Use when the user wants to validate that implementation is complete, correct, and coherent before archiving.4license: MIT5compatibility: Requires openspec CLI.6metadata:7 author: openspec8 version: "1.0"9 generatedBy: "1.4.1"10---1112Verify that an implementation matches the change artifacts (specs, tasks, design).1314**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.1516**Steps**17181. **If no change name provided, prompt for selection**1920 Run `openspec list --json` to get available changes. Use the **AskUserQuestion tool** to let the user select.2122 Show changes that have implementation tasks (tasks artifact exists).23 Include the schema used for each change if available.24 Mark changes with incomplete tasks as "(In Progress)".2526 **IMPORTANT**: Do NOT guess or auto-select a change. Always let the user choose.27282. **Check status to understand the schema**29 ```bash30 openspec status --change "<name>" --json31 ```32 Parse the JSON to understand:33 - `schemaName`: The workflow being used (e.g., "spec-driven")34 - `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`: path and scope context35 - Which artifacts exist for this change3637 If status reports `actionContext.mode: "workspace-planning"`, explain that full workspace implementation verification is not supported in this slice and STOP. Do not infer repo-local implementation ownership or edit linked repos.38393. **Get planning context and load artifacts**4041 ```bash42 openspec instructions apply --change "<name>" --json43 ```4445 This returns the change directory and `contextFiles` (artifact ID -> array of concrete file paths). Read all available artifacts from `contextFiles`.46474. **Initialize verification report structure**4849 Create a report structure with three dimensions:50 - **Completeness**: Track tasks and spec coverage51 - **Correctness**: Track requirement implementation and scenario coverage52 - **Coherence**: Track design adherence and pattern consistency5354 Each dimension can have CRITICAL, WARNING, or SUGGESTION issues.55565. **Verify Completeness**5758 **Task Completion**:59 - If `contextFiles.tasks` exists, read every file path in it60 - Parse checkboxes: `- [ ]` (incomplete) vs `- [x]` (complete)61 - Count complete vs total tasks62 - If incomplete tasks exist:63 - Add CRITICAL issue for each incomplete task64 - Recommendation: "Complete task: <description>" or "Mark as done if already implemented"6566 **Spec Coverage**:67 - If delta specs exist in `contextFiles.specs`:68 - Extract all requirements (marked with "### Requirement:")69 - For each requirement:70 - Search codebase for keywords related to the requirement71 - Assess if implementation likely exists72 - If requirements appear unimplemented:73 - Add CRITICAL issue: "Requirement not found: <requirement name>"74 - Recommendation: "Implement requirement X: <description>"75766. **Verify Correctness**7778 **Requirement Implementation Mapping**:79 - For each requirement from delta specs:80 - Search codebase for implementation evidence81 - If found, note file paths and line ranges82 - Assess if implementation matches requirement intent83 - If divergence detected:84 - Add WARNING: "Implementation may diverge from spec: <details>"85 - Recommendation: "Review <file>:<lines> against requirement X"8687 **Scenario Coverage**:88 - For each scenario in delta specs (marked with "#### Scenario:"):89 - Check if conditions are handled in code90 - Check if tests exist covering the scenario91 - If scenario appears uncovered:92 - Add WARNING: "Scenario not covered: <scenario name>"93 - Recommendation: "Add test or implementation for scenario: <description>"94957. **Verify Coherence**9697 **Design Adherence**:98 - If `contextFiles.design` exists:99 - Extract key decisions (look for sections like "Decision:", "Approach:", "Architecture:")100 - Verify implementation follows those decisions101 - If contradiction detected:102 - Add WARNING: "Design decision not followed: <decision>"103 - Recommendation: "Update implementation or revise design.md to match reality"104 - If no design.md: Skip design adherence check, note "No design.md to verify against"105106 **Code Pattern Consistency**:107 - Review new code for consistency with project patterns108 - Check file naming, directory structure, coding style109 - If significant deviations found:110 - Add SUGGESTION: "Code pattern deviation: <details>"111 - Recommendation: "Consider following project pattern: <example>"1121138. **Generate Verification Report**114115 **Summary Scorecard**:116 ```117 ## Verification Report: <change-name>118119 ### Summary120 | Dimension | Status |121 |--------------|------------------|122 | Completeness | X/Y tasks, N reqs|123 | Correctness | M/N reqs covered |124 | Coherence | Followed/Issues |125 ```126127 **Issues by Priority**:128129 1. **CRITICAL** (Must fix before archive):130 - Incomplete tasks131 - Missing requirement implementations132 - Each with specific, actionable recommendation133134 2. **WARNING** (Should fix):135 - Spec/design divergences136 - Missing scenario coverage137 - Each with specific recommendation138139 3. **SUGGESTION** (Nice to fix):140 - Pattern inconsistencies141 - Minor improvements142 - Each with specific recommendation143144 **Final Assessment**:145 - If CRITICAL issues: "X critical issue(s) found. Fix before archiving."146 - If only warnings: "No critical issues. Y warning(s) to consider. Ready for archive (with noted improvements)."147 - If all clear: "All checks passed. Ready for archive."148149**Verification Heuristics**150151- **Completeness**: Focus on objective checklist items (checkboxes, requirements list)152- **Correctness**: Use keyword search, file path analysis, reasonable inference - don't require perfect certainty153- **Coherence**: Look for glaring inconsistencies, don't nitpick style154- **False Positives**: When uncertain, prefer SUGGESTION over WARNING, WARNING over CRITICAL155- **Actionability**: Every issue must have a specific recommendation with file/line references where applicable156157**Graceful Degradation**158159- If only tasks.md exists: verify task completion only, skip spec/design checks160- If tasks + specs exist: verify completeness and correctness, skip design161- If full artifacts: verify all three dimensions162- Always note which checks were skipped and why163164**Output Format**165166Use clear markdown with:167- Table for summary scorecard168- Grouped lists for issues (CRITICAL/WARNING/SUGGESTION)169- Code references in format: `file.ts:123`170- Specific, actionable recommendations171- No vague suggestions like "consider reviewing"