Skip to content

fix(templates): make the schema instruction field authoritative for artifact creation#1405

Merged
clay-good merged 3 commits into
mainfrom
fix/instruction-field-authority
Jul 22, 2026
Merged

fix(templates): make the schema instruction field authoritative for artifact creation#1405
clay-good merged 3 commits into
mainfrom
fix/instruction-field-authority

Conversation

@clay-good

@clay-good clay-good commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Status: LGTM — full suite green locally (104 files / 1,995 tests; the 17 known environment-only zsh-installer failures are addressed by #1400 and don't affect CI), hashes independently re-verified, zero generate:skills drift, and five adversarial review passes applied across the three commits. Alfred's requested change (a focused behavioral test, not just hash baselines) is addressed in the third commit.

What was wrong: The openspec-continue-change skill and /opsx:continue command embedded hard-coded one-line "common artifact patterns" for proposal.md, specs/, design.md, and tasks.md, with the schema's instruction field relegated to "other schemas." Since most custom schemas reuse those familiar artifact names, agents followed the hard-coded shortcuts and ignored the custom instruction — so a schema could not delegate artifact creation to its own skill (e.g. Flokay's "You MUST use the flokay:design skill" was treated as prose). The propose and ff workflows shared the same artifact-creation loop with no cue that a skill reference means invoke that skill.

How it was fixed: Template text only — no CLI or schema behavior changes.

  • continue-change (skill + command): hard-coded spec-driven pattern block removed, replaced with "the instruction field is the authoritative guidance, even for familiar artifact names" plus a skill-delegation directive.
  • propose, continue, and ff (skill + command variants): the delegation conditional is stated at the artifact-creation step itself — "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" — not just in the trailing guidelines, so an agent executing steps in order sees it before writing anything. The sentence is identical across all six variants, and in continue it follows the dependency-read bullet (an adversarial pass caught the earlier ordering telling agents to skip dependency reads that the guardrails require).
  • Focused regression test (per review): skill-templates-parity.test.ts now asserts, for all six variants, that the instruction field is the authoritative guidance, that delegated creation is invoked and verified at the creation step and restated in the guidelines, and that Common artifact patterns is absent — so openspec-continue-change hard-coded artifact patterns override schema instruction field #777's behavior is pinned independently of the hash baselines.
  • Regenerated skills/openspec-{continue-change,ff-change,propose}/SKILL.md, updated the golden hashes, added a patch changeset.

Why removing the pattern block is safe: every removed one-liner is already covered — in far more detail — by the spec-driven schema's own instruction fields in schemas/spec-driven/schema.yaml (verified line by line; the one item not in the schema, "ask the user if unclear," survives as an existing guardrail in both templates). The delegation directive is conditional, and the default schema never references a skill, so the default workflow is untouched.

Proof:

  • The new openspec-continue-change hard-coded artifact patterns override schema instruction field #777 test fails against the pre-fix templates (verified by restoring the three workflow files from main: 3 tests fail, including the new one) and passes with them.
  • npm run build && npm run generate:skills produces zero drift against the committed skills/ files; npx vitest run — 1,995 passing across 104 files including all parity suites.
  • All golden hashes independently recomputed from dist/ and matched; hash churn is exactly the 3 touched workflow files (6 function hashes + 3 generated-skill hashes), nothing else moved.
  • Two further adversarial review passes (template consistency/cross-surface coverage, test-quality/stale-reference sweep) confirmed: every deployed rendering derives from the six covered template functions; no stale reference to the removed text anywhere in src/test/docs/openspec/skills; no other test asserted the old wording; vocabulary sweep unaffected.

Notes:

Fixes #777

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Custom schema instruction guidance is now authoritative for artifact creation, replacing any default “common artifact patterns” behavior.
    • Proposal, continuation, and fast-forward workflows now follow delegated skill/command instructions for artifact generation and verify the expected artifact is created before proceeding.
  • Tests

    • Updated template parity baselines and added assertions to ensure generated guidance respects the schema’s instruction and no longer includes the old “common artifact patterns” shortcut.

@clay-good
clay-good requested a review from TabishB as a code owner July 21, 2026 13:11
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Updated propose, continue, and fast-forward workflows to treat schema instruction fields as authoritative, invoke delegated skills or commands, and verify generated artifacts. Removed hard-coded artifact patterns and refreshed generated guidance, parity hashes, and patch release metadata.

Changes

Schema Instruction Authority

Layer / File(s) Summary
Workflow template instruction handling
src/core/templates/workflows/*.ts
Propose, continue, and fast-forward templates now follow delegated artifact instructions, verify resolvedOutputPath, and remove hard-coded artifact patterns.
Generated guidance and parity validation
skills/openspec-*/SKILL.md, test/core/templates/skill-templates-parity.test.ts, .changeset/instruction-field-authority.md
Checked-in skill guidance, parity hashes, content hashes, parity assertions, and patch release metadata reflect the instruction-authority behavior.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant OpenSpecInstructions
  participant Workflow
  participant DelegatedSkillOrCommand
  participant ArtifactFile
  OpenSpecInstructions->>Workflow: provide artifact instruction
  Workflow->>DelegatedSkillOrCommand: invoke delegated creator
  DelegatedSkillOrCommand->>ArtifactFile: create artifact at resolvedOutputPath
  Workflow->>ArtifactFile: verify resolved output exists
Loading

Possibly related PRs

Suggested reviewers: tabishb

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: making schema instructions authoritative for artifact creation.
Linked Issues check ✅ Passed The PR removes hard-coded artifact patterns and adds explicit skill delegation in continue and ff, matching #777's requirements.
Out of Scope Changes check ✅ Passed The added propose templates and parity-test updates are directly supporting the same instruction-authority change, with no unrelated scope evident.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/instruction-field-authority

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@alfred-openspec alfred-openspec left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The template change looks right and isolated verification passes, but the PR only updates self-maintained hash baselines. Please add a focused assertion across the skill and command variants that the instruction field is authoritative, delegated creation is invoked, and the old Common artifact patterns shortcut is absent, so #777's behavior is pinned rather than accepting any regenerated prompt.

@clay-good

Copy link
Copy Markdown
Collaborator Author

@alfred-openspec addressed in 310d257: added a focused test (makes the schema instruction field authoritative for artifact creation (#777)) that asserts across all six variants (propose/continue/ff × skill/command) that the instruction field is the authoritative guidance, delegated creation is invoked and verified at the creation step and restated in the guidelines, and the old Common artifact patterns shortcut is absent. Verified it fails against the pre-fix templates. The same commit also fixes a bullet-ordering contradiction in continue (delegation now follows the dependency-read bullet, matching propose/ff) surfaced by an adversarial pass.

@alfred-openspec alfred-openspec left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Re-review at 310d257: the new six-variant assertion now pins instruction authority, delegation at the creation step, output verification, and removal of the hard-coded artifact shortcut. Clean regeneration, focused tests, build, and the full exact-head CI matrix all pass.

clay-good and others added 3 commits July 22, 2026 10:13
…rtifact creation

The continue-change skill and command embedded hard-coded spec-driven
artifact patterns that agents followed instead of the schema's
instruction field whenever a custom schema reused familiar artifact
names, so schemas could not delegate artifact creation to their own
skills. Drop the hard-coded patterns, state that the instruction field
is authoritative, and tell both continue and ff workflows to invoke a
skill when the instruction delegates to one.

Fixes #777

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ep and in propose

Adversarial review findings: the propose workflow shared the same
creation loop and pre-fix wording as ff, and the numbered creation
steps still commanded a direct write before the agent ever reached the
delegation guideline. Add the delegation conditional at the point of
creation in propose, continue, and ff (skill and command variants),
add the authoritative-instruction bullets to propose, and verify the
artifact exists after a delegated skill runs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…r in tests

Address alfred's review: the hash baselines alone accepted any regenerated
prompt, so add a focused parity assertion covering all six variants
(propose/continue/ff x skill/command) that the instruction field is the
authoritative guidance, delegated creation is invoked and verified at the
creation step and restated in the guidelines, and the old "Common artifact
patterns" shortcut stays gone. The test fails against the pre-fix templates.

Also fix an ordering contradiction the adversarial review surfaced: the
continue-change delegation bullet preceded the dependency-read bullet and
said "instead of following the bullets below", telling agents to skip
dependency reads that the guardrails require. It now mirrors propose/ff:
read dependencies first, then delegate "instead of writing the file
yourself" - making the sentence identical across all six variants.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@alfred-openspec alfred-openspec left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The rebase preserves dependency-first delegation and output verification across all six propose, continue, and fast-forward variants, including the focused behavior assertion. Exact-head build, clean skill regeneration, 11 parity tests, and the full cross-platform CI/CodeQL matrix pass.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

🤖 Prompt for all review comments with 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.

Inline comments:
In `@skills/openspec-continue-change/SKILL.md`:
- Around line 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.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f4fde62e-60ba-44b0-8870-f72759c6b2d4

📥 Commits

Reviewing files that changed from the base of the PR and between 310d257 and 78759e1.

📒 Files selected for processing (8)
  • .changeset/instruction-field-authority.md
  • skills/openspec-continue-change/SKILL.md
  • skills/openspec-ff-change/SKILL.md
  • skills/openspec-propose/SKILL.md
  • src/core/templates/workflows/continue-change.ts
  • src/core/templates/workflows/ff-change.ts
  • src/core/templates/workflows/propose.ts
  • test/core/templates/skill-templates-parity.test.ts
🚧 Files skipped from review as they are similar to previous changes (5)
  • .changeset/instruction-field-authority.md
  • src/core/templates/workflows/continue-change.ts
  • src/core/templates/workflows/propose.ts
  • src/core/templates/workflows/ff-change.ts
  • test/core/templates/skill-templates-parity.test.ts

Comment on lines +71 to +72
- 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

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.

@clay-good
clay-good added this pull request to the merge queue Jul 22, 2026
Merged via the queue into main with commit 5dfef4b Jul 22, 2026
14 checks passed
@clay-good
clay-good deleted the fix/instruction-field-authority branch July 22, 2026 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

openspec-continue-change hard-coded artifact patterns override schema instruction field

2 participants