Create a complete OpenSpec change proposal — from requirement to validated artifacts — in a single workflow.
If no argument is provided, the workflow will extract requirements from conversation context or ask.
-
Determine the requirement source
a. Argument provided (e.g., "add dark mode") → use it as the requirement description, skip to deriving the change name below.
b. Plan file available (Claude Code only):
- Check if the conversation context mentions a plan file path (plan mode system messages include the path like
~/.claude/plans/<name>.md)
- If found, check if the file exists at
~/.claude/plans/
- If a plan file is found, use the AskUserQuestion tool to ask:
- Option 1: Use the plan file
- Option 2: Use conversation context
- If conversation context has no relevant discussion, mention this when presenting the choice
- If the user picks the plan file → read it and extract:
plan_title (H1 heading) → use as requirement description
plan_context (Context section) → use as proposal Why/Motivation content
plan_stages (numbered implementation stages) → use for artifact creation
plan_files (all file paths mentioned) → use for Impact section
- If the user picks conversation context → fall through to (c)
c. Conversation context → attempt to extract requirements from conversation history
- If context is insufficient, use the AskUserQuestion tool to ask what they want to build
From the resolved description, derive a kebab-case change name (e.g., "add dark mode" → add-dark-mode).
IMPORTANT: Do NOT proceed without understanding what the user wants to build.
-
Classify the change type
Based on the requirement, classify the change into one of three types:
| Type | When to use |
|---|
| Feature | New functionality, new capabilities |
| Bug Fix | Fixing existing behavior, resolving errors |
| Refactor | Architecture improvements, performance optimization, UI adjustments |
This determines the proposal template format in step 5.
-
Scan existing specs for relevance
Before creating the change, check if any existing specs overlap:
- Use the Glob tool to list all files matching
openspec/specs/*/spec.md
- Extract directory names as the spec identifier list
- Compare against the user's description to identify related specs (max 5 candidates)
- For each candidate (max 3), read the first 10 lines to retrieve the Purpose section
- If related specs are found, display them as an informational summary
IMPORTANT:
- If related specs are found, display them but do NOT stop or ask for confirmation — continue to the next step
- If no related specs are found, silently proceed without mentioning the scan
-
Create the change directory
spectra new change "<name>" --agent cursor
If a change with that name already exists, suggest continuing the existing change instead of creating a new one.
-
Write the proposal
Get instructions:
spectra instructions proposal --change "<name>" --json
Write the proposal file using the template from instructions, with the following format based on change type:
Feature
## Why
<!-- Why this functionality is needed -->
## What Changes
<!-- What will be different -->
## Capabilities
### New Capabilities
- `<capability-name>`: <brief description>
### Modified Capabilities
(none)
## Impact
- Affected specs: <new or modified capabilities>
- Affected code: <list of affected files>
Bug Fix
## Problem
<!-- Current broken behavior -->
## Root Cause
<!-- Why it happens -->
## Proposed Solution
<!-- How to fix -->
## Success Criteria
<!-- Expected behavior after fix, verifiable conditions -->
## Impact
- Affected code: <list of affected files>
Refactor / Enhancement
## Summary
<!-- One sentence description -->
## Motivation
<!-- Why this is needed -->
## Proposed Solution
<!-- How to do it -->
## Alternatives Considered (optional)
<!-- Other approaches considered and why not -->
## Impact
- Affected specs: <affected capabilities>
- Affected code: <list of affected files>
-
Get the artifact build order
spectra status --change "<name>" --json
Parse the JSON to get:
applyRequires: array of artifact IDs needed before implementation
artifacts: list of all artifacts with their status and dependencies
-
Create remaining artifacts in sequence
Loop through artifacts in dependency order (skip proposal since it's already done):
a. For each artifact that is ready (dependencies satisfied):
b. Continue until all applyRequires artifacts are complete
- After creating each artifact, re-run
spectra status --change "<name>" --json
- Check if every artifact ID in
applyRequires has status: "done"
- Stop when all
applyRequires artifacts are done
c. If an artifact requires user input (unclear context):
- Use AskUserQuestion tool to clarify
- Then continue with creation
-
Analyze-Fix Loop (max 2 iterations)
- Run
spectra analyze <change-name> --json
- Filter findings to Critical and Warning only (ignore Suggestion)
- If no Critical/Warning findings → show "Artifacts look consistent ✓" and proceed
- If Critical/Warning findings exist:
a. Show: "Found N issue(s), fixing... (attempt M/2)"
b. Fix each finding in the affected artifact
c. Re-run
spectra analyze <change-name> --json
d. Repeat up to 2 total iterations
- After 2 attempts, if findings remain:
- Show remaining findings as a summary
- Proceed normally (do NOT block)
-
Validation
spectra validate "<name>"
If validation fails, fix errors and re-validate.
-
Show final status and end workflow
Show summary:
- Change name and location
- List of artifacts created
- Validation result
Use AskUserQuestion tool to ask what to do next. This ensures the workflow stops even when auto-accept is enabled. Provide exactly these options:
- First option (will be auto-selected): "Park" — Execute
spectra park "<name>" to stash the change, then inform the user they can run /spectra:apply <change-name> when ready (which will auto-unpark).
- Second option: "Apply" — Invoke
/spectra:apply <change-name> to start implementation.
If AskUserQuestion tool is not available, execute spectra park "<name>" and inform the user to run /spectra:apply <change-name> when ready. Then STOP — do not continue.
After the user responds, if they chose "Park", execute spectra park "<name>" and the workflow is OVER. If they chose "Apply", invoke /spectra:apply <change-name> to begin implementation.