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:
Using change: <name>.
## Locked from artifacts (proceeding without re-asking)
- <decision>: <one-line value> — `<file>:<section>`
- ...
## Plan for this session
- <ordered list of task ids that will be executed in this run>
## Genuine blockers (preflight — single consolidated round)
- <empty .dev.env field needed by a task in this session's plan> — required by tasks <ids>
- <design.md Open Question whose dependent task is in this session's plan> — CONFUSION block (quote question + list options with consequences + the agent's recommendation + "→ Which one to pick?")
- ...
c. Preflight scope filter — for each candidate question, include in ## Genuine blockers only if it passes all of:
- Not answered in
proposal.md / design.md / delta specs/ / tasks.md (those decisions are locked — quote them in ## Locked from artifacts instead).
- Not an advisory field (
PREFIX, COMPANY, DEVELOPER) or a defaulted field (INFOBASE_KIND, EXTENSION_NAME, EXPORT_PATH, NEW_OBJECTS_IN, IBCMD_CONFIG).
- In scope of the current session's plan — required by a task that this apply run will actually reach.
d. If ## Genuine blockers is empty after the filter — omit the block entirely and proceed straight to step 6. An empty block is not a question.
e. If ## Genuine blockers is non-empty — submit the consolidated AskUserQuestion round (one call, all questions in it). On the user's response, apply the answers to the artifacts: write resolved Open Questions into design.md → ## Architecture decisions and strike them from ## Open Questions; persist .dev.env values. Then enter the implementation loop. The preflight round is the only apply-time question surface — no further AskUserQuestion calls during step 6 except for the narrow critical exceptions below.
Run the 1C pipeline and implement tasks (loop until done or blocked)
Before the first edit, load content/rules/subagent-pipeline.md and
content/rules/verification-gates.md, then classify the current session plan using
AGENTS.md → Triage. Quick-fix / docs-fix / spec-authoring work follows its dedicated
route. Full-cycle work runs either the standard path (direct execution by the parent per
AGENTS.md → Development Procedure) or the pipeline when delegation is chosen per
content/rules/subagents.md (the default under ORCHESTRATION=economy). Either way the
approved OpenSpec artifacts are the approved plan — do not ask for duplicate approval —
and the spec-compliance review (pipeline Stage 4a) plus the closing verification gate
(verification-gates.md) still run.
For each pending task:
- Show which task is being worked on
- Make the code changes required
- Keep changes minimal and focused
- Run the task-local checks named in
tasks.md and retain fresh validator evidence
- Record the task as implemented, but leave
- [ ] unchanged until step 7 passes
- Continue to next task
Mid-loop pause is reserved for true live-state surprises only. Pause if and only if:
- New fact from live state conflicts with a locked artifact decision — metadata object missing from this configuration, platform-version mismatch with
CompatibilityMode, БСП subsystem absent, typical-form structure blocks the planned approach, an attribute / tabular-section actual type contradicts what design.md assumed. Raise a CONFUSION block per AGENTS.md → 1. with the new fact, the locked artifact it contradicts, and the resolution options. This is the only routine reason to pause mid-loop.
- User-explicit re-open — the user asks to revisit a previously locked decision.
- Error or hard blocker — a tool / build / validator returns a result that genuinely blocks progress (not a style warning, not a routine BSL defect — fix those and continue).
- User interrupts — obvious.
Forbidden mid-loop pauses (each is an apply-phase defect of the same severity as skipping syntaxcheck):
- "Task is unclear" — propose-phase defect. Make a reasonable, codebase-consistent choice and record it via
remember (project memory) or memory.md Captured-during-work. Do not interrupt the user.
- "What name for this private helper?" / "function or procedure?" / "what logging level?" / "should I add a comment here?" — same.
- "Should I pause now to re-confirm decision X from
design.md?" — never. Confirmation is not a question.
- "Should I pause for an empty
.dev.env field that the user already declined in preflight?" — never. The dependent block is marked deferred-to-user in tasks.md; proceed with everything else.
Run spec-compliance and closing verification
Before marking any implemented task complete:
- Run Stage 4a from
content/rules/subagent-pipeline.md against the implemented task set.
- Run Stage 4b only when the user explicitly requested a code review.
- Run Stage 5 via
content/rules/verification-gates.md, including every applicable hard
and soft gate.
- Reuse fresh validator evidence produced after the latest edit. Run only missing or stale
gates; never repeat a validator against unchanged content.
- If a gate finds a defect, fix it and rerun only the affected stale gate within its budget.
If verification is blocked, keep the affected tasks unchecked and report the blocker.
- Only after Stage 4a and the closing gate pass, update each verified task:
- [ ] → - [x].
On completion or pause, show status
Display:
- Tasks completed this session
- Overall progress: "N/M tasks complete"
- If all done: suggest archive
- If paused: explain why and wait for guidance
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-gates.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
1---2name: openspec-apply-change-23description: Implement tasks from an OpenSpec change. Use when the user wants to start implementing, continue implementation, or work through tasks.4license: MIT5---67Implement tasks from an OpenSpec change.89**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.1011## Question-asking discipline (read first)1213Apply 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.1415- **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.16- **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.17- **The full rule lives in `content/rules/sdd-integrations.md → Apply-phase clarification discipline`. Load it on any non-trivial apply session.**1819**Steps**20211. **Select the change**2223 If a name is provided, use it. Otherwise:24 - Infer from conversation context if the user mentioned a change25 - Auto-select if only one active change exists26 - If ambiguous, run `openspec list --json` to get available changes and use the **AskUserQuestion tool** to let the user select2728 Always announce: "Using change: <name>" and how to override (e.g., `/opsx-apply <other>`).29302. **Check status to understand the schema**31 ```bash32 openspec status --change "<name>" --json33 ```34 Parse the JSON to understand:35 - `schemaName`: The workflow being used (e.g., "spec-driven")36 - Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)37383. **Get apply instructions**3940 ```bash41 openspec instructions apply --change "<name>" --json42 ```4344 This returns:45 - Context file paths (varies by schema - could be proposal/specs/design/tasks or spec/tests/implementation/docs)46 - Progress (total, complete, remaining)47 - Task list with status48 - Dynamic instruction based on current state4950 **Handle states:**51 - If `state: "blocked"` (missing artifacts): show message, suggest using openspec-continue-change52 - If `state: "all_done"`: congratulate, suggest archive53 - Otherwise: proceed to implementation54554. **Read context files**5657 Read the files listed in `contextFiles` from the apply instructions output.58 The files depend on the schema being used:59 - **spec-driven**: proposal, specs, design, tasks60 - Other schemas: follow the contextFiles from CLI output61625. **Show current progress and emit the opening message (preflight round)**6364 a. Display:65 - Schema being used66 - Progress: "N/M tasks complete"67 - Remaining tasks overview68 - Dynamic instruction from CLI6970 b. **Emit the apply-phase opening message** following the template in `content/rules/sdd-integrations.md → Apply-phase opening template`:7172 ```text73 Using change: <name>.7475 ## Locked from artifacts (proceeding without re-asking)76 - <decision>: <one-line value> — `<file>:<section>`77 - ...7879 ## Plan for this session80 - <ordered list of task ids that will be executed in this run>8182 ## Genuine blockers (preflight — single consolidated round)83 - <empty .dev.env field needed by a task in this session's plan> — required by tasks <ids>84 - <design.md Open Question whose dependent task is in this session's plan> — CONFUSION block (quote question + list options with consequences + the agent's recommendation + "→ Which one to pick?")85 - ...86 ```8788 c. **Preflight scope filter** — for each candidate question, include in `## Genuine blockers` only if it passes **all** of:89 - **Not** answered in `proposal.md` / `design.md` / delta `specs/` / `tasks.md` (those decisions are locked — quote them in `## Locked from artifacts` instead).90 - **Not** an advisory field (`PREFIX`, `COMPANY`, `DEVELOPER`) or a defaulted field (`INFOBASE_KIND`, `EXTENSION_NAME`, `EXPORT_PATH`, `NEW_OBJECTS_IN`, `IBCMD_CONFIG`).91 - **In scope of the current session's plan** — required by a task that this apply run will actually reach.9293 d. **If `## Genuine blockers` is empty** after the filter — omit the block entirely and proceed straight to step 6. An empty block is not a question.9495 e. **If `## Genuine blockers` is non-empty** — submit the consolidated `AskUserQuestion` round (one call, all questions in it). On the user's response, apply the answers to the artifacts: write resolved Open Questions into `design.md → ## Architecture decisions` and strike them from `## Open Questions`; persist `.dev.env` values. Then enter the implementation loop. **The preflight round is the only apply-time question surface** — no further `AskUserQuestion` calls during step 6 except for the narrow critical exceptions below.96976. **Run the 1C pipeline and implement tasks (loop until done or blocked)**9899 Before the first edit, load `content/rules/subagent-pipeline.md` and100 `content/rules/verification-gates.md`, then classify the current session plan using101 `AGENTS.md → Triage`. Quick-fix / docs-fix / spec-authoring work follows its dedicated102 route. Full-cycle work runs either the standard path (direct execution by the parent per103 `AGENTS.md → Development Procedure`) or the pipeline when delegation is chosen per104 `content/rules/subagents.md` (the default under `ORCHESTRATION=economy`). Either way the105 approved OpenSpec artifacts are the approved plan — do not ask for duplicate approval —106 and the spec-compliance review (pipeline Stage 4a) plus the closing verification gate107 (`verification-gates.md`) still run.108109 For each pending task:110 - Show which task is being worked on111 - Make the code changes required112 - Keep changes minimal and focused113 - Run the task-local checks named in `tasks.md` and retain fresh validator evidence114 - Record the task as implemented, but leave `- [ ]` unchanged until step 7 passes115 - Continue to next task116117 **Mid-loop pause is reserved for true live-state surprises only.** Pause if **and only if**:118 - **New fact from live state conflicts with a locked artifact decision** — metadata object missing from this configuration, platform-version mismatch with `CompatibilityMode`, БСП subsystem absent, typical-form structure blocks the planned approach, an attribute / tabular-section actual type contradicts what `design.md` assumed. Raise a `CONFUSION` block per `AGENTS.md → 1.` with the new fact, the locked artifact it contradicts, and the resolution options. This is the only routine reason to pause mid-loop.119 - **User-explicit re-open** — the user asks to revisit a previously locked decision.120 - **Error or hard blocker** — a tool / build / validator returns a result that genuinely blocks progress (not a style warning, not a routine BSL defect — fix those and continue).121 - **User interrupts** — obvious.122123 **Forbidden mid-loop pauses** (each is an apply-phase defect of the same severity as skipping `syntaxcheck`):124 - "Task is unclear" — propose-phase defect. Make a reasonable, codebase-consistent choice and record it via `remember` (project memory) or `memory.md` Captured-during-work. Do not interrupt the user.125 - "What name for this private helper?" / "function or procedure?" / "what logging level?" / "should I add a comment here?" — same.126 - "Should I pause now to re-confirm decision X from `design.md`?" — never. Confirmation is not a question.127 - "Should I pause for an empty `.dev.env` field that the user already declined in preflight?" — never. The dependent block is marked `deferred-to-user` in `tasks.md`; proceed with everything else.1281297. **Run spec-compliance and closing verification**130131 Before marking any implemented task complete:132 - Run Stage 4a from `content/rules/subagent-pipeline.md` against the implemented task set.133 - Run Stage 4b only when the user explicitly requested a code review.134 - Run Stage 5 via `content/rules/verification-gates.md`, including every applicable hard135 and soft gate.136 - Reuse fresh validator evidence produced after the latest edit. Run only missing or stale137 gates; never repeat a validator against unchanged content.138 - If a gate finds a defect, fix it and rerun only the affected stale gate within its budget.139 If verification is blocked, keep the affected tasks unchecked and report the blocker.140 - Only after Stage 4a and the closing gate pass, update each verified task:141 `- [ ]` → `- [x]`.1421438. **On completion or pause, show status**144145 Display:146 - Tasks completed this session147 - Overall progress: "N/M tasks complete"148 - If all done: suggest archive149 - If paused: explain why and wait for guidance150151**Output During Implementation**152153```154## Implementing: <change-name> (schema: <schema-name>)155156Working on task 3/7: <task description>157[...implementation happening...]158Implementation complete; closing verification pending159160Working on task 4/7: <task description>161[...implementation happening...]162Implementation complete; closing verification pending163```164165**Output On Completion**166167```168## Implementation Complete169170**Change:** <change-name>171**Schema:** <schema-name>172**Progress:** 7/7 tasks complete ✓173**Verification:** Stage 4a and all applicable closing gates passed174175### Completed This Session176- [x] Task 1177- [x] Task 2178...179180All tasks complete! Ready to archive this change.181```182183**Output On Pause (Issue Encountered)**184185```186## Implementation Paused187188**Change:** <change-name>189**Schema:** <schema-name>190**Progress:** 4/7 tasks complete191192### Issue Encountered193<description of the issue>194195**Options:**1961. <option 1>1972. <option 2>1983. Other approach199200What would you like to do?201```202203**Guardrails**204- Keep going through tasks until done or blocked205- Always read context files before starting (from the apply instructions output)206- **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.207- 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.208- Keep code changes minimal and scoped to each task209- Load `subagent-pipeline.md` and `verification-gates.md` before the first edit210- Update task checkboxes only after step 7 passes; implementation alone is not completion211- Pause on hard errors / blockers (failing validator with a substantive defect, missing metadata, deadlock), never on routine style warnings or naming choices212- Use contextFiles from CLI output, don't assume specific file names213214**Fluid Workflow Integration**215216This skill supports the "actions on a change" model:217218- **Can be invoked anytime**: Before all artifacts are done (if tasks exist), after partial implementation, interleaved with other actions219- **Allows artifact updates**: If implementation reveals design issues, suggest updating artifacts - not phase-locked, work fluidly