Skip to content

Conversation

@TabishB
Copy link
Contributor

@TabishB TabishB commented Jan 6, 2026

Summary

  • Adds openspec schemas CLI command with --json option for agents to list available workflow schemas
  • Updates openspec-new-change skill to prompt users for schema selection (spec-driven, tdd, etc.)
  • Makes all skill templates schema-agnostic by reading artifact lists dynamically from openspec status --json
  • Updates slash commands (/opsx:new, /opsx:continue, /opsx:apply) to work with any schema

Changes

CLI

  • New openspec schemas command lists schemas with descriptions and artifact sequences
  • New listSchemasWithInfo() helper function for programmatic access

Skill Templates

  • openspec-new-change: Now prompts for schema selection before creating a change
  • openspec-continue-change: Reads schema from status output, provides schema-specific guidance
  • openspec-apply-change: Uses dynamic context files based on schema

Slash Commands

  • All /opsx:* commands updated to support schema selection and dynamic artifact handling

Test plan

  • Run openspec schemas and verify it lists spec-driven and tdd schemas
  • Run openspec schemas --json and verify JSON output includes name, description, artifacts
  • Run openspec artifact-experimental-setup and verify updated skills are generated
  • Verify skill templates include schema selection step

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • New Features
    • Added workflow schema selection during change creation—users can now choose between different schema types (e.g., spec-driven, TDD) for their workflow.
    • New schemas command displays available workflow schemas with descriptions and metadata.
    • System now provides schema-aware guidance throughout the change workflow with contextual artifact sequences.

✏️ Tip: You can customize this high-level summary in your review settings.

- Add `openspec schemas` CLI command with `--json` option for agents
- Add `listSchemasWithInfo()` helper to get schema metadata (name, description, artifacts)
- Update `openspec-new-change` skill to prompt for schema selection
- Update `openspec-continue-change` skill to read schema dynamically from status
- Update `openspec-apply-change` skill to use schema-specific context files
- Update all slash commands (/opsx:new, /opsx:continue, /opsx:apply) to be schema-agnostic
- Add documentation for when to use each schema (spec-driven vs tdd)

Agents can now create changes with different workflow schemas and the skills
dynamically adapt based on the selected schema's artifact sequence.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 6, 2026

📝 Walkthrough

Walkthrough

This PR introduces schema-aware workflow selection and discovery. It adds a new Schemas CLI command that lists available schemas with metadata, implements schema information retrieval via listSchemasWithInfo() function and SchemaInfo type, and updates workflow templates to prompt for schema selection and propagate schema context throughout the artifact creation process.

Changes

Cohort / File(s) Summary
Task completion tracking
openspec/changes/add-agent-schema-selection/tasks.md
Checklist items marked as completed for prerequisites, schema discovery, skill updates, and documentation.
Schema metadata implementation
src/core/artifact-graph/resolver.ts
Added SchemaInfo interface (name, description, artifacts, source) and listSchemasWithInfo() function that aggregates schema metadata from user and package sources, reads schema.yaml files, and returns sorted results.
Public API exports
src/core/artifact-graph/index.ts
Exported new listSchemasWithInfo function and SchemaInfo type to extend artifact-graph public API.
CLI schemas command
src/commands/artifact-workflow.ts
Added new schemas CLI subcommand with SchemasOptions interface and schemasCommand() function to list available schemas with descriptions and artifacts in human-readable or JSON format.
Schema-aware workflow templates
src/core/templates/skill-templates.ts
Introduced schema selection step across OpenSpec templates; updated artifact handling, status guidance, and instructions to be schema-aware; embedded schema name in output messages; added context to emphasize reading schema-specific files rather than assuming fixed filenames.

Sequence Diagram

sequenceDiagram
    participant User as User/CLI
    participant CLI as artifact-workflow.ts
    participant Resolver as artifact-graph/resolver
    participant Templates as skill-templates.ts
    
    User->>CLI: Run schemas command
    CLI->>Resolver: listSchemasWithInfo()
    Resolver->>Resolver: Read user override schemas
    Resolver->>Resolver: Read package schemas (schema.yaml)
    Resolver-->>CLI: Return SchemaInfo[]
    CLI-->>User: Display schemas (name, description, artifacts)
    
    User->>Templates: Create new change workflow
    Templates->>User: Prompt for schema selection
    User-->>Templates: Choose schema (e.g., spec-driven)
    Templates->>Templates: Retrieve schema-specific artifact sequence
    Templates->>Templates: Set schema context in status/instructions
    Templates-->>User: Show workflow with selected schema
    Templates->>Templates: Guide artifact creation per schema sequence
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Poem

🐰 A schema for every dream, now they ask which path to gleam,
Discovery made swift and bright, with metadata shining light,
From fixed workflows worn so thin, to schema-driven discipline,
Templates dance with purpose true—choosing paths that speak to you! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and specifically describes the main change: adding schema selection to the artifact workflow system.
Docstring Coverage ✅ Passed Docstring coverage is 90.91% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings

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 and usage tips.

@vibe-kanban-cloud
Copy link

Review Complete

Your review story is ready!

View Story

Comment !reviewfast on this PR to re-generate the story.

@TabishB
Copy link
Contributor Author

TabishB commented Jan 6, 2026

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 6, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/core/artifact-graph/resolver.ts (1)

174-226: Implementation correctly handles schema precedence and error cases.

The function properly:

  1. Processes user schemas first to establish precedence
  2. Uses seenNames Set to prevent duplicates
  3. Silently skips invalid schemas (appropriate for discovery APIs)
  4. Returns consistently sorted results

The implementation shares iteration logic with listSchemas(). Consider extracting a shared helper if this pattern grows, but this is optional given the current scope.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1786684 and 6eb0be8.

📒 Files selected for processing (5)
  • openspec/changes/add-agent-schema-selection/tasks.md
  • src/commands/artifact-workflow.ts
  • src/core/artifact-graph/index.ts
  • src/core/artifact-graph/resolver.ts
  • src/core/templates/skill-templates.ts
🧰 Additional context used
📓 Path-based instructions (2)
openspec/changes/**/*.md

📄 CodeRabbit inference engine (openspec/AGENTS.md)

Scaffold proposal using proposal.md, tasks.md, optional design.md, and delta specs under openspec/changes/<id>/

Files:

  • openspec/changes/add-agent-schema-selection/tasks.md
openspec/changes/*/tasks.md

📄 CodeRabbit inference engine (openspec/AGENTS.md)

Ensure tasks.md contains implementation checklist with numbered sections and checkbox items

Files:

  • openspec/changes/add-agent-schema-selection/tasks.md
🧠 Learnings (12)
📓 Common learnings
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:02.839Z
Learning: Use `@/openspec/AGENTS.md` to learn how to create and apply change proposals, spec format and conventions, and project structure and guidelines
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:02.839Z
Learning: Always open `@/openspec/AGENTS.md` when the request mentions planning or proposals (words like proposal, spec, change, plan), introduces new capabilities, breaking changes, architecture shifts, or performance/security work, or sounds ambiguous and needs the authoritative spec before coding
📚 Learning: 2025-11-25T01:08:19.004Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:19.004Z
Learning: Applies to openspec/changes/*/tasks.md : Ensure `tasks.md` contains implementation checklist with numbered sections and checkbox items

Applied to files:

  • openspec/changes/add-agent-schema-selection/tasks.md
  • src/core/templates/skill-templates.ts
📚 Learning: 2025-11-25T01:08:02.839Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:02.839Z
Learning: Use `@/openspec/AGENTS.md` to learn how to create and apply change proposals, spec format and conventions, and project structure and guidelines

Applied to files:

  • openspec/changes/add-agent-schema-selection/tasks.md
  • src/core/templates/skill-templates.ts
📚 Learning: 2025-11-25T01:08:19.004Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:19.004Z
Learning: Applies to openspec/changes/**/*.md : Scaffold proposal using `proposal.md`, `tasks.md`, optional `design.md`, and delta specs under `openspec/changes/<id>/`

Applied to files:

  • openspec/changes/add-agent-schema-selection/tasks.md
  • src/core/templates/skill-templates.ts
📚 Learning: 2025-11-25T01:08:19.004Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:19.004Z
Learning: Applies to openspec/changes/**/specs/**/spec.md : Include at least one `#### Scenario:` per requirement in spec delta files

Applied to files:

  • openspec/changes/add-agent-schema-selection/tasks.md
📚 Learning: 2025-11-25T01:08:19.004Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:19.004Z
Learning: Applies to openspec/changes/*/proposal.md : Ensure `proposal.md` includes sections: Why (1-2 sentences), What Changes (bullet list with breaking change markers), and Impact (affected specs and code)

Applied to files:

  • openspec/changes/add-agent-schema-selection/tasks.md
  • src/core/templates/skill-templates.ts
📚 Learning: 2025-11-25T01:08:02.839Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:02.839Z
Learning: Always open `@/openspec/AGENTS.md` when the request mentions planning or proposals (words like proposal, spec, change, plan), introduces new capabilities, breaking changes, architecture shifts, or performance/security work, or sounds ambiguous and needs the authoritative spec before coding

Applied to files:

  • openspec/changes/add-agent-schema-selection/tasks.md
  • src/core/templates/skill-templates.ts
📚 Learning: 2025-11-25T01:08:19.004Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:19.004Z
Learning: Applies to openspec/changes/**/specs/**/spec.md : Use `## ADDED Requirements` for new orthogonal capabilities that can stand alone; use `## MODIFIED Requirements` for behavior changes of existing requirements

Applied to files:

  • openspec/changes/add-agent-schema-selection/tasks.md
📚 Learning: 2025-11-25T01:08:19.004Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:19.004Z
Learning: Run `openspec validate [change-id] --strict` before requesting approval

Applied to files:

  • src/core/templates/skill-templates.ts
📚 Learning: 2025-11-25T01:08:19.004Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:19.004Z
Learning: Check `openspec/project.md` for project conventions before creating specs

Applied to files:

  • src/core/templates/skill-templates.ts
📚 Learning: 2025-11-25T01:08:19.004Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:19.004Z
Learning: Use `openspec archive <change-id> --skip-specs --yes` for tooling-only changes

Applied to files:

  • src/core/templates/skill-templates.ts
📚 Learning: 2025-11-25T01:08:19.004Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:19.004Z
Learning: Search existing work using `openspec spec list --long`, `openspec list` for enumerating changes; use `rg` only for full-text search

Applied to files:

  • src/core/templates/skill-templates.ts
🧬 Code graph analysis (2)
src/core/artifact-graph/resolver.ts (2)
src/core/artifact-graph/index.ts (5)
  • SchemaInfo (29-29)
  • listSchemasWithInfo (24-24)
  • getUserSchemasDir (27-27)
  • parseSchema (12-12)
  • getPackageSchemasDir (26-26)
src/core/artifact-graph/schema.ts (1)
  • parseSchema (23-45)
src/commands/artifact-workflow.ts (2)
src/core/artifact-graph/index.ts (1)
  • listSchemasWithInfo (24-24)
src/core/artifact-graph/resolver.ts (1)
  • listSchemasWithInfo (174-226)
🔇 Additional comments (12)
openspec/changes/add-agent-schema-selection/tasks.md (1)

1-32: Well-structured task checklist.

The file correctly follows the required format with numbered sections and checkbox items. All implementation tasks for schema selection are marked complete, aligning with the PR's code changes. Based on coding guidelines, this file meets the tasks.md requirements.

src/core/templates/skill-templates.ts (6)

40-87: Schema selection workflow is well-integrated.

The template correctly introduces schema selection as a discrete step, uses openspec schemas --json for discovery, defaults to spec-driven, and propagates the selection to openspec new change --schema. The guardrail at line 87 ensures the schema choice is preserved.


123-201: Schema-aware continue workflow is comprehensive.

The template correctly parses schemaName from status JSON, documents multiple schema patterns (spec-driven, tdd), and includes a sensible fallback for custom schemas. The new guardrails (lines 200-201) properly avoid hardcoded artifact assumptions.


229-352: Apply workflow properly handles schema-specific context.

The template correctly reads schema from status JSON, uses dynamic contextFiles from apply instructions, and consistently displays the schema in all output states. The guardrails at lines 346 and 352 appropriately avoid hardcoded file assumptions.


399-445: Slash command template is consistent with skill template.

The /opsx:new command template correctly mirrors the skill template's schema selection workflow, with appropriate slash command-specific messaging (e.g., referencing /opsx:continue).


470-560: Continue slash command properly mirrors skill template.

Schema-aware updates are consistent with getContinueChangeSkillTemplate. The artifact patterns and guardrails align correctly.


583-719: Apply slash command is consistent with skill template.

All schema-aware updates mirror the corresponding getApplyChangeSkillTemplate function correctly.

src/core/artifact-graph/index.ts (1)

21-30: Clean API surface expansion.

The new exports listSchemasWithInfo and type SchemaInfo follow the existing export pattern and correctly expose the new schema metadata functionality from resolver.ts.

src/commands/artifact-workflow.ts (3)

17-29: Imports correctly added.

The new imports listSchemasWithInfo and type SchemaInfo are properly imported from the artifact-graph module.


833-851: Schema listing command is well-implemented.

The command correctly uses listSchemasWithInfo() to fetch schema metadata and provides both JSON and human-readable output formats. The formatting clearly shows schema name, source (user override vs package), description, and artifact sequence.

Note: The function is marked async but doesn't use await. This is harmless and consistent with other command handlers in this file that may need async operations in the future.


917-930: Command registration follows established patterns.

The schemas subcommand is properly registered with the [Experimental] tag, --json option, and error handling consistent with other commands in this file.

src/core/artifact-graph/resolver.ts (1)

159-168: Well-designed interface.

SchemaInfo provides a clean API surface with appropriate typing. The source union type provides type safety for distinguishing user overrides from package built-ins.

@TabishB TabishB merged commit ed924ff into main Jan 6, 2026
7 checks passed
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.

2 participants