Skip to content

Proposal: support inline template content in schema artifact definitions #1323

Description

@stanleykao72

Motivation

Schema artifact definitions currently require template to be a filename resolved under schemas/<name>/templates/. For small schemas (a one-artifact "memo" workflow, quick project-local schemas), forcing a separate template file adds friction — the schema author has to maintain a second file for what is often a three-line skeleton.

Proposal

Let template accept either form, distinguished by shape:

artifacts:
  - id: memo
    template: memo.md          # existing: filename under templates/
  - id: memo
    template: |                # new: inline content, used verbatim
      ## Memo

      <!-- What changed, why, which files affected -->

Detection: a single-line, path-shaped string with an extension is treated as a file reference; anything multi-line or not path-shaped is inline content. Fully backward-compatible — every existing schema keeps resolving as before, and a missing referenced file still raises TemplateLoadError.

Implementation

A ready implementation (+50 lines including tests, no behavior change for existing schemas) is on this branch:

https://github.com/stanleykao72/OpenSpec/tree/feat/inline-template-content

Happy to open a PR if there's interest.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions