| name | openspec-apply-change |
| description | Implement tasks from an OpenSpec change. Use when the user wants to start implementing, continue implementation, or work through tasks. |
| license | MIT |
| compatibility | Requires openspec CLI. |
| metadata | {"author":"openspec","version":"1.0","generatedBy":"1.2.0"} |
Implement tasks from an OpenSpec change.
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.
Question-asking discipline (read first)
Apply phase has a single consolidated preflight round at the start, then near-silence during the implementation loop. The user round-trip budget for apply is one batched question round upfront, not one micro-question per task.
- Preflight (step 5b below) — bundle every genuine remaining blocker into one
AskUserQuestion call. Scope: empty highly-desirable .dev.env fields needed by tasks in this session's plan, plus design.md → ## Open Questions items whose dependent task is in this session's plan. Nothing else.
- Implementation loop (step 6 below) — no mid-loop questions except: a new fact surfaces from the live state that conflicts with a locked artifact decision (metadata missing, platform-version mismatch with
CompatibilityMode, БСП subsystem absent, typical-form structure blocks the planned approach); or the user explicitly re-opens a decision. Routine ambiguity in a task ("what name for this private helper?", "function or procedure?", "what level of logging?") is never a legitimate mid-loop pause — it is a propose-phase defect that the propose-phase clarification gate should have caught. Make a reasonable, codebase-consistent choice and record it via remember or memory.md Captured-during-work.
- The full rule lives in
content/rules/sdd-integrations.md → Apply-phase clarification discipline. Load it on any non-trivial apply session.
Steps
-
Select the change
If a name is provided, use it. Otherwise:
- Infer from conversation context if the user mentioned a change
- Auto-select if only one active change exists
- If ambiguous, run
openspec list --json to get available changes and use the AskUserQuestion tool to let the user select
Always announce: "Using change: " and how to override (e.g., /opsx-apply <other>).
-
Check status to understand the schema
openspec status --change "<name>" --json
Parse the JSON to understand:
schemaName: The workflow being used (e.g., "spec-driven")
- Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)
-
Get apply instructions
openspec instructions apply --change "<name>" --json
This returns:
- Context file paths (varies by schema - could be proposal/specs/design/tasks or spec/tests/implementation/docs)
- Progress (total, complete, remaining)
- Task list with status
- Dynamic instruction based on current state
Handle states:
- If
state: "blocked" (missing artifacts): show message, suggest using openspec-continue-change
- If
state: "all_done": congratulate, suggest archive
- Otherwise: proceed to implementation
-
Read context files
Read the files listed in contextFiles from the apply instructions output.
The files depend on the schema being used:
- spec-driven: proposal, specs, design, tasks
- Other schemas: follow the contextFiles from CLI output
-
Show current progress and emit the opening message (preflight round)
a. Display:
- Schema being used
- Progress: "N/M tasks complete"
- Remaining tasks overview
- Dynamic instruction from CLI
b. Emit the apply-phase opening message following the template in content/rules/sdd-integrations.md → Apply-phase opening template:
Output During Implementation
## Implementing: <change-name> (schema: <schema-name>)
Working on task 3/7: <task description>
[...implementation happening...]
Implementation complete; closing verification pending
Working on task 4/7: <task description>
[...implementation happening...]
Implementation complete; closing verification pending
Output On Completion
## Implementation Complete
**Change:** <change-name>
**Schema:** <schema-name>
**Progress:** 7/7 tasks complete ✓
**Verification:** Stage 4a and all applicable closing gates passed
### Completed This Session
- [x] Task 1
- [x] Task 2
...
All tasks complete! Ready to archive this change.
Output On Pause (Issue Encountered)
## Implementation Paused
**Change:** <change-name>
**Schema:** <schema-name>
**Progress:** 4/7 tasks complete
### Issue Encountered
<description of the issue>
**Options:**
1. <option 1>
2. <option 2>
3. Other approach
What would you like to do?
Guardrails
- Keep going through tasks until done or blocked
- Always read context files before starting (from the apply instructions output)
- Bundle every legitimate question into the single preflight round at step 5b — no mid-loop questions except for the narrow critical exceptions in step 6. "If task is ambiguous, pause and ask" is not the apply rule for this project — the rule is in
content/rules/sdd-integrations.md → Apply-phase clarification discipline. Routine ambiguity is a propose-phase defect; make a reasonable, codebase-consistent choice and record it via remember or memory.md Captured-during-work.
- If a live-state fact conflicts with a locked artifact decision, raise a
CONFUSION block and pause; this is the only routine mid-loop pause.
- Keep code changes minimal and scoped to each task
- Load
subagent-pipeline.md and verification-checklist.md before the first edit
- Update task checkboxes only after step 7 passes; implementation alone is not completion
- Pause on hard errors / blockers (failing validator with a substantive defect, missing metadata, deadlock), never on routine style warnings or naming choices
- Use contextFiles from CLI output, don't assume specific file names
Fluid Workflow Integration
This skill supports the "actions on a change" model:
- Can be invoked anytime: Before all artifacts are done (if tasks exist), after partial implementation, interleaved with other actions
- Allows artifact updates: If implementation reveals design issues, suggest updating artifacts - not phase-locked, work fluidly