Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/instruction-field-authority.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@fission-ai/openspec": patch
---

### Bug Fixes

- **Custom schema instructions are no longer overridden by hard-coded spec-driven patterns** — the `openspec-continue-change` skill/command embedded one-line "common artifact patterns" for proposal.md, specs, design.md, and tasks.md, so agents followed those shortcuts instead of the schema's `instruction` field whenever a custom schema reused familiar artifact names. The templates now state that the `instruction` field is the authoritative guidance, and the `propose`, `continue`, and `ff` workflows direct the agent — both in the artifact-creation step and in the guidelines — to invoke a skill when the instruction delegates artifact creation to one, verifying the artifact exists afterward (fixes #777).
16 changes: 4 additions & 12 deletions skills/openspec-continue-change/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ Continue working on a change by creating the next artifact.
- `dependencies`: Completed artifacts to read for context
- **Create the artifact file**:
- Read any completed dependency files for context - always re-read them from disk, even if you saw them earlier in the conversation (the user may have edited them)
- Use `template` as the structure - fill in its sections
- If the `instruction` field delegates creation to a specific skill or command, invoke it to produce the artifact instead of writing the file yourself, then verify the artifact file exists at `resolvedOutputPath`
- Otherwise use `template` as the structure - fill in its sections
Comment on lines +71 to +72

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Resolve glob outputs before verifying creation.

resolvedOutputPath may be a glob, not a concrete filename. A delegated artifact should first resolve the schema-selected concrete path, then verify that exact file exists; otherwise a literal existence check can fail for valid glob-based schemas.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@skills/openspec-continue-change/SKILL.md` around lines 71 - 72, Update the
delegated artifact flow in the instruction-field handling to resolve the
schema-selected concrete output path from resolvedOutputPath before checking
file existence. Verify that exact resolved file rather than testing the glob
pattern literally, while preserving the existing delegation and
artifact-generation behavior.

- Apply `context` and `rules` as constraints when writing - but do NOT copy them into the file
- Write to the `resolvedOutputPath` specified in instructions. If it is a glob pattern, choose the concrete file path using the schema instruction and the change's context
- Show what was created and what's now unlocked
Expand Down Expand Up @@ -96,18 +97,9 @@ After each invocation, show:

**Artifact Creation Guidelines**

The artifact types and their purpose depend on the schema. Use the `instruction` field from the instructions output to understand what to create.
The artifact types and their purpose depend on the schema. The `instruction` field from the instructions output is the authoritative guidance for each artifact - follow it even when the artifact has a familiar name (proposal.md, tasks.md, etc.), since custom schemas may define different content or a different process for the same file names.

Common artifact patterns:

**spec-driven schema** (proposal → specs → design → tasks):
- **proposal.md**: Ask user about the change if not clear. Fill in Why, What Changes, Capabilities, Impact.
- The Capabilities section is critical - each capability listed will need a spec file.
- **specs/<capability>/spec.md**: Create one spec per capability listed in the proposal's Capabilities section (use the capability name, not the change name).
- **design.md**: Document technical decisions, architecture, and implementation approach.
- **tasks.md**: Break down implementation into checkboxed tasks.

For other schemas, follow the `instruction` field from the CLI output.
If the `instruction` field directs you to use a specific skill or command to create the artifact, invoke it instead of writing the artifact directly.

**Guardrails**
- Create ONE artifact per invocation
Expand Down
6 changes: 4 additions & 2 deletions skills/openspec-ff-change/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ Fast-forward through artifact creation - generate everything needed to start imp
- `resolvedOutputPath`: Resolved path or pattern to write the artifact
- `dependencies`: Completed artifacts to read for context
- Read any completed dependency files for context - always re-read them from disk, even if you saw them earlier in the conversation (the user may have edited them)
- Create the artifact file using `template` as the structure and write it to `resolvedOutputPath`
- If the `instruction` field delegates creation to a specific skill or command, invoke it to produce the artifact instead of writing the file yourself, then verify the artifact file exists at `resolvedOutputPath`
- Otherwise create the artifact file using `template` as the structure and write it to `resolvedOutputPath`
- Apply `context` and `rules` as constraints - but do NOT copy them into the file
- Show brief progress: "✓ Created <artifact-id>"

Expand Down Expand Up @@ -88,7 +89,8 @@ After completing all artifacts, summarize:

**Artifact Creation Guidelines**

- Follow the `instruction` field from `openspec instructions` for each artifact type
- Follow the `instruction` field from `openspec instructions` for each artifact type - it is the authoritative guidance, even for familiar artifact names
- If the `instruction` field directs you to use a specific skill or command to create the artifact, invoke it instead of writing the artifact directly
- The schema defines what each artifact should contain - follow it
- Read dependency artifacts for context before creating new ones
- Use `template` as the structure for your output file - fill in its sections
Expand Down
6 changes: 4 additions & 2 deletions skills/openspec-propose/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ When ready to implement, run /openspec-apply-change
- `resolvedOutputPath`: Resolved path or pattern to write the artifact
- `dependencies`: Completed artifacts to read for context
- Read any completed dependency files for context - always re-read them from disk, even if you saw them earlier in the conversation (the user may have edited them)
- Create the artifact file using `template` as the structure and write it to `resolvedOutputPath`
- If the `instruction` field delegates creation to a specific skill or command, invoke it to produce the artifact instead of writing the file yourself, then verify the artifact file exists at `resolvedOutputPath`
- Otherwise create the artifact file using `template` as the structure and write it to `resolvedOutputPath`
- Apply `context` and `rules` as constraints - but do NOT copy them into the file
- Show brief progress: "Created <artifact-id>"

Expand Down Expand Up @@ -97,7 +98,8 @@ After completing all artifacts, summarize:

**Artifact Creation Guidelines**

- Follow the `instruction` field from `openspec instructions` for each artifact type
- Follow the `instruction` field from `openspec instructions` for each artifact type - it is the authoritative guidance, even for familiar artifact names
- If the `instruction` field directs you to use a specific skill or command to create the artifact, invoke it instead of writing the artifact directly
- The schema defines what each artifact should contain - follow it
- Read dependency artifacts for context before creating new ones
- Use `template` as the structure for your output file - fill in its sections
Expand Down
32 changes: 8 additions & 24 deletions src/core/templates/workflows/continue-change.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ ${STORE_SELECTION_GUIDANCE}
- \`dependencies\`: Completed artifacts to read for context
- **Create the artifact file**:
- Read any completed dependency files for context - always re-read them from disk, even if you saw them earlier in the conversation (the user may have edited them)
- Use \`template\` as the structure - fill in its sections
- If the \`instruction\` field delegates creation to a specific skill or command, invoke it to produce the artifact instead of writing the file yourself, then verify the artifact file exists at \`resolvedOutputPath\`
- Otherwise use \`template\` as the structure - fill in its sections
- Apply \`context\` and \`rules\` as constraints when writing - but do NOT copy them into the file
- Write to the \`resolvedOutputPath\` specified in instructions. If it is a glob pattern, choose the concrete file path using the schema instruction and the change's context
- Show what was created and what's now unlocked
Expand Down Expand Up @@ -98,18 +99,9 @@ After each invocation, show:

**Artifact Creation Guidelines**

The artifact types and their purpose depend on the schema. Use the \`instruction\` field from the instructions output to understand what to create.
The artifact types and their purpose depend on the schema. The \`instruction\` field from the instructions output is the authoritative guidance for each artifact - follow it even when the artifact has a familiar name (proposal.md, tasks.md, etc.), since custom schemas may define different content or a different process for the same file names.

Common artifact patterns:

**spec-driven schema** (proposal → specs → design → tasks):
- **proposal.md**: Ask user about the change if not clear. Fill in Why, What Changes, Capabilities, Impact.
- The Capabilities section is critical - each capability listed will need a spec file.
- **specs/<capability>/spec.md**: Create one spec per capability listed in the proposal's Capabilities section (use the capability name, not the change name).
- **design.md**: Document technical decisions, architecture, and implementation approach.
- **tasks.md**: Break down implementation into checkboxed tasks.

For other schemas, follow the \`instruction\` field from the CLI output.
If the \`instruction\` field directs you to use a specific skill or command to create the artifact, invoke it instead of writing the artifact directly.

**Guardrails**
- Create ONE artifact per invocation
Expand Down Expand Up @@ -192,7 +184,8 @@ ${STORE_SELECTION_GUIDANCE}
- \`dependencies\`: Completed artifacts to read for context
- **Create the artifact file**:
- Read any completed dependency files for context - always re-read them from disk, even if you saw them earlier in the conversation (the user may have edited them)
- Use \`template\` as the structure - fill in its sections
- If the \`instruction\` field delegates creation to a specific skill or command, invoke it to produce the artifact instead of writing the file yourself, then verify the artifact file exists at \`resolvedOutputPath\`
- Otherwise use \`template\` as the structure - fill in its sections
- Apply \`context\` and \`rules\` as constraints when writing - but do NOT copy them into the file
- Write to the \`resolvedOutputPath\` specified in instructions. If it is a glob pattern, choose the concrete file path using the schema instruction and the change's context
- Show what was created and what's now unlocked
Expand Down Expand Up @@ -220,18 +213,9 @@ After each invocation, show:

**Artifact Creation Guidelines**

The artifact types and their purpose depend on the schema. Use the \`instruction\` field from the instructions output to understand what to create.

Common artifact patterns:

**spec-driven schema** (proposal → specs → design → tasks):
- **proposal.md**: Ask user about the change if not clear. Fill in Why, What Changes, Capabilities, Impact.
- The Capabilities section is critical - each capability listed will need a spec file.
- **specs/<capability>/spec.md**: Create one spec per capability listed in the proposal's Capabilities section (use the capability name, not the change name).
- **design.md**: Document technical decisions, architecture, and implementation approach.
- **tasks.md**: Break down implementation into checkboxed tasks.
The artifact types and their purpose depend on the schema. The \`instruction\` field from the instructions output is the authoritative guidance for each artifact - follow it even when the artifact has a familiar name (proposal.md, tasks.md, etc.), since custom schemas may define different content or a different process for the same file names.

For other schemas, follow the \`instruction\` field from the CLI output.
If the \`instruction\` field directs you to use a specific skill or command to create the artifact, invoke it instead of writing the artifact directly.

**Guardrails**
- Create ONE artifact per invocation
Expand Down
12 changes: 8 additions & 4 deletions src/core/templates/workflows/ff-change.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ ${STORE_SELECTION_GUIDANCE}
- \`resolvedOutputPath\`: Resolved path or pattern to write the artifact
- \`dependencies\`: Completed artifacts to read for context
- Read any completed dependency files for context - always re-read them from disk, even if you saw them earlier in the conversation (the user may have edited them)
- Create the artifact file using \`template\` as the structure and write it to \`resolvedOutputPath\`
- If the \`instruction\` field delegates creation to a specific skill or command, invoke it to produce the artifact instead of writing the file yourself, then verify the artifact file exists at \`resolvedOutputPath\`
- Otherwise create the artifact file using \`template\` as the structure and write it to \`resolvedOutputPath\`
- Apply \`context\` and \`rules\` as constraints - but do NOT copy them into the file
- Show brief progress: "✓ Created <artifact-id>"

Expand Down Expand Up @@ -90,7 +91,8 @@ After completing all artifacts, summarize:

**Artifact Creation Guidelines**

- Follow the \`instruction\` field from \`openspec instructions\` for each artifact type
- Follow the \`instruction\` field from \`openspec instructions\` for each artifact type - it is the authoritative guidance, even for familiar artifact names
- If the \`instruction\` field directs you to use a specific skill or command to create the artifact, invoke it instead of writing the artifact directly
- The schema defines what each artifact should contain - follow it
- Read dependency artifacts for context before creating new ones
- Use \`template\` as the structure for your output file - fill in its sections
Expand Down Expand Up @@ -167,7 +169,8 @@ ${STORE_SELECTION_GUIDANCE}
- \`resolvedOutputPath\`: Resolved path or pattern to write the artifact
- \`dependencies\`: Completed artifacts to read for context
- Read any completed dependency files for context - always re-read them from disk, even if you saw them earlier in the conversation (the user may have edited them)
- Create the artifact file using \`template\` as the structure and write it to \`resolvedOutputPath\`
- If the \`instruction\` field delegates creation to a specific skill or command, invoke it to produce the artifact instead of writing the file yourself, then verify the artifact file exists at \`resolvedOutputPath\`
- Otherwise create the artifact file using \`template\` as the structure and write it to \`resolvedOutputPath\`
- Apply \`context\` and \`rules\` as constraints - but do NOT copy them into the file
- Show brief progress: "✓ Created <artifact-id>"

Expand Down Expand Up @@ -195,7 +198,8 @@ After completing all artifacts, summarize:

**Artifact Creation Guidelines**

- Follow the \`instruction\` field from \`openspec instructions\` for each artifact type
- Follow the \`instruction\` field from \`openspec instructions\` for each artifact type - it is the authoritative guidance, even for familiar artifact names
- If the \`instruction\` field directs you to use a specific skill or command to create the artifact, invoke it instead of writing the artifact directly
- The schema defines what each artifact should contain - follow it
- Read dependency artifacts for context before creating new ones
- Use \`template\` as the structure for your output file - fill in its sections
Expand Down
12 changes: 8 additions & 4 deletions src/core/templates/workflows/propose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ ${STORE_SELECTION_GUIDANCE}
- \`resolvedOutputPath\`: Resolved path or pattern to write the artifact
- \`dependencies\`: Completed artifacts to read for context
- Read any completed dependency files for context - always re-read them from disk, even if you saw them earlier in the conversation (the user may have edited them)
- Create the artifact file using \`template\` as the structure and write it to \`resolvedOutputPath\`
- If the \`instruction\` field delegates creation to a specific skill or command, invoke it to produce the artifact instead of writing the file yourself, then verify the artifact file exists at \`resolvedOutputPath\`
- Otherwise create the artifact file using \`template\` as the structure and write it to \`resolvedOutputPath\`
- Apply \`context\` and \`rules\` as constraints - but do NOT copy them into the file
- Show brief progress: "Created <artifact-id>"

Expand Down Expand Up @@ -99,7 +100,8 @@ After completing all artifacts, summarize:

**Artifact Creation Guidelines**

- Follow the \`instruction\` field from \`openspec instructions\` for each artifact type
- Follow the \`instruction\` field from \`openspec instructions\` for each artifact type - it is the authoritative guidance, even for familiar artifact names
- If the \`instruction\` field directs you to use a specific skill or command to create the artifact, invoke it instead of writing the artifact directly
- The schema defines what each artifact should contain - follow it
- Read dependency artifacts for context before creating new ones
- Use \`template\` as the structure for your output file - fill in its sections
Expand Down Expand Up @@ -185,7 +187,8 @@ ${STORE_SELECTION_GUIDANCE}
- \`resolvedOutputPath\`: Resolved path or pattern to write the artifact
- \`dependencies\`: Completed artifacts to read for context
- Read any completed dependency files for context - always re-read them from disk, even if you saw them earlier in the conversation (the user may have edited them)
- Create the artifact file using \`template\` as the structure and write it to \`resolvedOutputPath\`
- If the \`instruction\` field delegates creation to a specific skill or command, invoke it to produce the artifact instead of writing the file yourself, then verify the artifact file exists at \`resolvedOutputPath\`
- Otherwise create the artifact file using \`template\` as the structure and write it to \`resolvedOutputPath\`
- Apply \`context\` and \`rules\` as constraints - but do NOT copy them into the file
- Show brief progress: "Created <artifact-id>"

Expand Down Expand Up @@ -213,7 +216,8 @@ After completing all artifacts, summarize:

**Artifact Creation Guidelines**

- Follow the \`instruction\` field from \`openspec instructions\` for each artifact type
- Follow the \`instruction\` field from \`openspec instructions\` for each artifact type - it is the authoritative guidance, even for familiar artifact names
- If the \`instruction\` field directs you to use a specific skill or command to create the artifact, invoke it instead of writing the artifact directly
- The schema defines what each artifact should contain - follow it
- Read dependency artifacts for context before creating new ones
- Use \`template\` as the structure for your output file - fill in its sections
Expand Down
Loading
Loading