Skip to content

feat(openspec): scaffold the change folder of an issue to project form #3203

Closed

Description

@dan-petty

Problem or Motivation

Every pull request starts with a change folder, and the plans of the last days broke the project form in the same few ways. openspec new change makes the folder (ADR 0010), but its files are the generic OpenSpec skeleton. The project rules are in openspec/config.yaml, AGENTS.md and CONTRIBUTING.md, and each author, human, agent or the stage job, has to remember them: the folder name <issue>-<slug>, a ## Feasibility section with real evidence, ## Existing Tool Considered with a cost in tokens and time, task groups with a kind and a failing test first, the .openspec.yaml key skip_specs, the ADDED or MODIFIED choice against the base spec, and the allowed Workflow follow-up bullets. In a review of 23 plan pull requests the same defects came back: placeholder text, a wrong folder name in the proposal (#3176, #3179), a spec delta where MODIFIED was needed (#3163, #3170, #3174, #3184), and a missing cost. The branch name has the same slug as the folder, and agents typed both by hand.

Proposed Solution & Architectural Design

  • Add devops openspec new <issue> (a new subcommand next to the existing devops openspec archive and check). From the issue it takes the number, the title, the type and the scope. It makes openspec/changes/<issue>-<slug>/ with the four files, written in the project form:
    • .openspec.yaml with the schema and skip_specs set from the paths the author names (--paths), or left for the author when none is given;
    • proposal.md with ## Why (cites #<issue>), ## What Changes, ## Capabilities, ## Impact, ## Feasibility and ## Existing Tool Considered, each with a one-line instruction in a comment and no placeholder word that a gate would accept;
    • design.md with Decisions and Rejected alternatives;
    • tasks.md with one group of each kind and the verification forms of openspec/config.yaml;
    • specs/<capability>/spec.md for each capability named with --capability, with ## ADDED Requirements or ## MODIFIED Requirements chosen by looking at the base spec: a name that exists gets MODIFIED, with the existing text copied in.
  • The slug and the branch name come from one function that the devops repos worktrees add command shares, so folder and branch agree.
  • It prints the next steps: the branch name, the checks to run, and the archive command.
  • It never overwrites a folder. The output is the same for the same input (no date or random value), except the created date of .openspec.yaml, which the existing tool already writes.
  • The skeleton has text a human has to replace. devops openspec check (and the stage content gate from feat(roadmap): refuse a plan with placeholder or cut text #3200) refuses a file that still holds the skeleton text, so an unfilled scaffold cannot merge.
  • A small skill (.claude/skills, .agents/skills) calls this command, so an interactive agent uses it and does not write the files by hand. The command holds the rules; the skill only points to it.

Open questions for the refine step: whether to extend openspec new change through a project schema (OpenSpec 1.14 supports schemas) in place of a wrapper, which would keep one tool; and how the created date and the slug rule should be tested for determinism.

Target Subsystem

src/devops_cli/commands/openspec.py (or the file that holds devops openspec), src/devops_cli/openspec/, src/devops_cli/git/branch_form.py (the slug), tests/.

Existing Tool Considered

openspec new change makes the generic folder, and Copier or Cookiecutter can fill templates. None reads the base specs to choose MODIFIED, derives the slug the branch rule uses, or knows the gates of this project. A project OpenSpec schema may cover the file layout, and the refine step should compare it with a wrapper. Cost to build: about 100k tokens and 5 hours. To keep: one set of templates and their tests, changed when openspec/config.yaml changes. The cost of not building it is a review round for each plan with a form defect.

Related: #3200 (content gate), #3201 (plan-check), #3198 (pull request title and body), #1844 (closed: scaffold OpenSpec and gate its folders).

Alternatives check of 2026-11-05: partly.
Tool: Fission-AI/OpenSpec (https://github.com/Fission-AI/OpenSpec), MIT, last activity 2026-11-04, maintained.

Proposed design

Problem statement

Every pull request starts with an OpenSpec change folder, and each author writes it by hand. The same defects return in review: skeleton text, a wrong folder name, a wrong ADDED or MODIFIED choice and a missing cost. One command must write the folder in the project form. The gate must refuse an unfilled scaffold.

Acceptance criteria

Requirement: The command creates the change folder

devops openspec new SHALL create a change folder named for the issue and the slug, with .openspec.yaml, proposal.md, design.md and tasks.md.

Scenario: A new issue gets the four files

  • WHEN The author runs devops openspec new 3203 --title 'feat(openspec): scaffold the change folder' in a checkout with no folder for issue 3203.
  • THEN The command creates openspec/changes/3203-scaffold-the-change-folder/ with the four files and exits 0.

Requirement: The command reads the issue title

When --title is absent, devops openspec new ISSUE SHALL read the issue title from GitHub and use it for the slug and the branch.

Scenario: The title comes from the issue

  • WHEN A fake GitHub client returns issue 3203 with the title feat(openspec): scaffold the change folder, and the author runs devops openspec new 3203 with no --title.
  • THEN The command creates openspec/changes/3203-scaffold-the-change-folder/ and prints feat/3203-scaffold-the-change-folder.

Requirement: The proposal holds the project sections

The scaffolded proposal.md SHALL hold ## Why, ## What Changes, ## Capabilities, ## Impact, ## Feasibility and ## Existing Tool Considered, and ## Why SHALL cite the issue number.

Scenario: The proposal cites the issue and holds the six sections

  • WHEN The command creates the folder for issue 3203.
  • THEN proposal.md holds the six headings in this order, and ## Why holds #3203.

Requirement: The design file holds decisions and rejected alternatives

The scaffolded design.md SHALL hold a ## Decisions section and a ## Rejected alternatives section.

Scenario: The design file holds both sections

  • WHEN The command creates the folder for issue 3203.
  • THEN design.md holds ## Decisions and ## Rejected alternatives, each with one instruction line that ends with &lt;!-- devops-openspec-new: replace -->.

Requirement: The tasks file holds a behavior group and a documents group

The scaffolded tasks.md SHALL hold a behavior group whose first task is a failing test with a uv run devops ci test command, and a documents group whose task names uv run devops ci docs.

Scenario: The tasks file holds both groups

  • WHEN The command creates the folder for issue 3203.
  • THEN tasks.md holds ## 1. Behavior with the test task before the implementation task, and ## 2. Documents with uv run devops ci docs.

Requirement: The folder and the branch share one slug

The folder slug and the branch name MUST come from the same slug_from_title and branch_name functions.

Scenario: Folder and branch agree

  • WHEN The command derives the slug from the title feat(openspec): scaffold the change folder for issue 3203.
  • THEN The folder is 3203-scaffold-the-change-folder and the printed branch is feat/3203-scaffold-the-change-folder.

Requirement: The worktree command shares the slug function

devops repos worktrees add SHALL accept --title and derive the type and the slug with slug_from_title, and MUST refuse a --type or --slug that differs from the derived value.

Scenario: The worktree command plans the same branch

  • WHEN The author runs devops repos worktrees add 3203 --title 'feat(openspec): scaffold the change folder' --dry-run.
  • THEN The command plans the branch feat/3203-scaffold-the-change-folder and no other branch.

Requirement: An existing folder stops the command

The command MUST NOT write into an existing change folder.

Scenario: An existing folder stops the command

  • WHEN The folder openspec/changes/3203-scaffold-the-change-folder/ already exists.
  • THEN The command exits 1, names the folder and changes no file.

Requirement: Two runs write the same bytes

Two runs on the same issue MUST write the same bytes, except the created value of .openspec.yaml.

Scenario: Two runs write equal files

  • WHEN The test runs the command twice on issue 3203 in two clean checkouts.
  • THEN The four files are equal after the test masks the created line of .openspec.yaml.

Requirement: The gate refuses the scaffold marker

Each scaffolded line that the author must replace SHALL end with the marker &lt;!-- devops-openspec-new: replace -->, and devops openspec check SHALL fail a change file that still holds the marker.

Scenario: An unfilled scaffold fails the check

  • WHEN The test runs uv run devops openspec check on a change folder that still holds the marker.
  • THEN The command reports a finding that names the file and exits 1.

Requirement: The delta chooses ADDED or MODIFIED from the base spec

The command SHALL write ## MODIFIED Requirements with the existing text when the base spec holds the named requirement, and ## ADDED Requirements otherwise.

Scenario: An existing requirement gets MODIFIED

  • WHEN openspec/specs/roadmap-refine/spec.md holds the requirement Only the limit stops a refine round, and the author names --capability roadmap-refine:Only the limit stops a refine round.
  • THEN The delta holds ## MODIFIED Requirements and copies the existing requirement text.

Requirement: A new capability gets a Purpose

A delta that creates a capability SHALL start with a ## Purpose section of at least 50 characters.

Scenario: A new capability gets Purpose and ADDED

  • WHEN No openspec/specs/openspec-scaffold/spec.md exists for the named capability openspec-scaffold.
  • THEN The delta starts with ## Purpose of at least 50 characters and holds ## ADDED Requirements.

Requirement: skip_specs follows the named paths

The command SHALL write skip_specs: true only when every --paths value is non-observable and no --capability is named, skip_specs: false when a path is observable or a capability is named, and no key when both options are absent.

Scenario: Test and document paths set skip_specs

  • WHEN The author runs the command with --paths tests/test_openspec_new.py --paths docs/openspec.md.
  • THEN .openspec.yaml holds skip_specs: true.

Requirement: A dry run makes no request

devops openspec new --dry-run MUST make no external request and SHALL print the folder and the branch it would make.

Scenario: The dry run writes nothing

  • WHEN The author runs devops openspec new 3203 --title 'feat(openspec): scaffold the change folder' --dry-run.
  • THEN The command prints the folder and the branch, writes no file and makes no request.

Requirement: The command prints the next steps

The command SHALL print the branch name, the checks to run and the archive command.

Scenario: The output names the next steps

  • WHEN The command creates the folder for issue 3203.
  • THEN The output holds feat/3203-scaffold-the-change-folder, uv run devops ci and uv run devops openspec archive 3203-scaffold-the-change-folder.

Requirement: The skill points to the command

A skill in .claude/skills and .agents/skills SHALL tell an interactive agent to run devops openspec new and MUST NOT tell it to run openspec new change.

Scenario: Both skill files name the command

  • WHEN A test reads .claude/skills/devops-openspec-new/SKILL.md and .agents/skills/devops-openspec-new/SKILL.md.
  • THEN Each file holds devops openspec new and no line that tells the agent to run openspec new change.

Requirement: The skill passes the OpenSpec gate

devops openspec check SHALL pass on a tree that holds the project skill.

Scenario: The gate passes with the skill

  • WHEN The test runs uv run devops openspec check on the tree that holds both skill files.
  • THEN The check exits 0.

Existing Tool Considered

OpenSpec (Fission-AI/OpenSpec, MIT, maintained) covers the change folder, .openspec.yaml, project-local custom schemas and templates, instruction comments and validation. It lacks a folder slug from the issue title, a shared slug function with the branch rule, branch creation and output, a read of the issue from GitHub, the ADDED or MODIFIED choice from the base spec with copied text, skip_specs from paths, a marker gate, next-step output and a project skill. Use OpenSpec for the folder and build a thin wrapper for the missing parts. Written cost to build the whole scaffold instead: about 100k tokens to build, keep and fix it until it matches the tool, and 5 hours of elapsed time.

Key questions

  • What command form does the scaffold use?: Add devops openspec new ISSUE next to check and archive. It takes --title, --paths, --capability CAPABILITY:REQUIREMENT and --dry-run. (best practice) [sources: src/devops_cli/commands/openspec.py, CONTRIBUTING.md, docs/adr/0010-openspec-is-the-spec-and-change-proposal-layer.md]
    • Chosen: A new devops openspec new subcommand. It sits beside the existing check and archive commands and uses the same isolated tool.
    • Rejected: Extend openspec new change with a project schema. ADR 0010 rejects a forked schema because it is experimental and drifts with each release.
    • Rejected: A separate shell script. It would duplicate the command tree, the settings and the error handling of the CLI.
  • Should the change extend openspec new change through a project schema in place of a wrapper?: No. Use a thin wrapper on the pinned tool. ADR 0010 rejects a forked schema because it is experimental and drifts. The wrapper runs openspec new change for .openspec.yaml and writes the project files. (best practice) [sources: docs/adr/0010-openspec-is-the-spec-and-change-proposal-layer.md, openspec/config.yaml, src/devops_cli/commands/openspec.py]
    • Chosen: Wrapper on the pinned tool. It reuses openspec new change and keeps the project rules in code that a test can check.
    • Rejected: Project schema only. The schema writes no marker, no base-spec lookup and no next-step output.
    • Rejected: Copier or Cookiecutter template. The template reads no base spec, derives no slug and knows no project gate.
  • How does the command derive the slug and the branch name?: Add slug_from_title(title) to src/devops_cli/git/branch_form.py. It removes the Conventional Commit prefix, lowercases, folds to ASCII, joins words with one hyphen and checks CONST_BRANCH_SLUG_PATTERN. branch_name(issue, type_, slug) makes the branch. devops repos worktrees add gains --title and calls the same functions. (best practice) [sources: src/devops_cli/git/branch_form.py, src/devops_cli/git/worktree_add.py, CONTRIBUTING.md, CONTEXT.md]
    • Chosen: One slug function from the title. The folder and the branch get the same slug, and the author types the title one time.
    • Rejected: A --slug typed by the author. The author types the slug twice, and the folder and the branch can disagree.
    • Rejected: A random or date suffix. The output would not be the same for the same input.
  • How does the command choose ADDED or MODIFIED for a capability?: The author names each capability and requirement as --capability CAPABILITY:REQUIREMENT. The command reads openspec/specs/CAPABILITY/spec.md. A requirement that the spec holds gets ## MODIFIED Requirements with the existing text copied. Another requirement gets ## ADDED Requirements. A capability with no spec gets a ## Purpose of at least 50 characters and ## ADDED Requirements. (best practice) [sources: openspec/config.yaml, docs/adr/0010-openspec-is-the-spec-and-change-proposal-layer.md, openspec/specs/roadmap-refine/spec.md]
    • Chosen: Read the base spec and choose. The config allows MODIFIED only for a requirement that exists in openspec/specs/.
    • Rejected: Always write ADDED. A duplicate ADDED makes archive refuse the change and write no file.
    • Rejected: Ask the author to choose. The author repeats a choice that the base spec settles, and the review defect returns.
  • How does the command keep the output deterministic with the created date?: The command creates .openspec.yaml with openspec new change through isolated_openspec(), so the pinned tool writes created. It writes the other three files from module-level constants and no timestamp. The test runs the command twice and compares the bytes after it masks the created line. (best practice) [sources: src/devops_cli/commands/openspec.py, docs/adr/0010-openspec-is-the-spec-and-change-proposal-layer.md]
    • Chosen: Let the pinned tool write .openspec.yaml. The schema stays valid and the tool owns the only date.
    • Rejected: Write .openspec.yaml by hand. A wrong key fails openspec validate --strict, and the command takes over a format that the tool owns.
    • Rejected: Write no date. The tool writes created already, and the issue keeps it.
  • How does the gate refuse an unfilled scaffold?: One constant holds the marker &lt;!-- devops-openspec-new: replace -->. Every scaffolded line that needs author input ends with it. check_openspec fails a file under openspec/changes/ that still holds the marker. (best practice) [sources: src/devops_cli/openspec/gate.py, docs/adr/0010-openspec-is-the-spec-and-change-proposal-layer.md]
    • Chosen: One shared marker string. The scaffold and the gate read one constant, and a test can assert both.
    • Rejected: A list of words to refuse. A real text can hold such a word, and a closed list cannot cover every skeleton line.
    • Rejected: No gate. An unfilled scaffold would merge, and the review defect returns.
  • How does skip_specs follow the --paths values?: One module-level table holds the non-observable prefixes: tests/, docs/, openspec/ and .github/workflows/. When every path starts with one of them and no capability is named, the command writes skip_specs: true. Otherwise it writes false. With no --paths and no --capability, it writes no skip_specs key. (best practice) [sources: openspec/config.yaml, docs/adr/0010-openspec-is-the-spec-and-change-proposal-layer.md]
    • Chosen: A closed table of non-observable prefixes. The config names tests, CI workflows and documentation as non-observable, so the command can decide from the paths.
    • Rejected: Always false. A test or document change would carry a spec delta that it does not need.
    • Rejected: A --skip-specs flag. The issue asks the command to set the key from the paths, and a flag repeats the decision.
  • Does the command read the issue in a dry run?: No. The normal run reads the issue title with the paced GitHub client. --dry-run makes no request and requires --title, as devops repos worktrees add --dry-run requires the branch parts. (best practice) [sources: CONTRIBUTING.md, src/devops_cli/git/worktree_add.py]
    • Chosen: Read the issue in the normal run and take --title in a dry run. The normal run needs no extra input, and the dry run keeps the no-external-request rule.
    • Rejected: Always take --title. The author types the title that GitHub holds, and the type and the scope can disagree with the issue.
    • Rejected: Read the issue in the dry run. A dry run would make a request and could fail offline.
  • Does the change carry a spec delta?: Yes. A new devops command, its options and its messages are observable. The change sets no skip_specs and holds a spec delta. (best practice) [sources: openspec/config.yaml, docs/adr/0010-openspec-is-the-spec-and-change-proposal-layer.md]
    • Chosen: Carry a spec delta. The config names a devops command, option or message as observable.
    • Rejected: Set skip_specs: true. The change adds a command that a consumer observes.
  • Does a project skill in .claude/skills and .agents/skills pass devops openspec check?: Yes. The gate regenerates the OpenSpec skills and compares the generated files. It fails a generated glob that matches no file. It does not compare an extra skill. The test runs devops openspec check on the tree that holds the skill. (best practice) [sources: src/devops_cli/openspec/gate.py, docs/adr/0010-openspec-is-the-spec-and-change-proposal-layer.md]
    • Chosen: Add the skill to both skill directories. The gate compares the generated files only, and the issue asks for the skill there.
    • Rejected: Add the skill to AGENTS.md only. The interactive agent reads the skill directory, and the issue asks for a skill.
    • Rejected: Add no skill. An agent would write the folder by hand, and the review defect returns.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/feature
    scope/openspec
    status/new
    value/medium
    effort/medium
    on Nov 2, 2026
  2. devops-cli-service commented on Nov 2, 2026

    @devops-cli-service
    Contributor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/feature. The feat prefix of the title gives the type.
    • Scope: scope/openspec. The (openspec) scope of the title gives the scope.
    • Priority: P2-Medium. It reduces repeated review defects but does not block delivery or expose a security risk.
    • Value: Medium. It removes a recurring source of review rework across 23 plan pull requests.
    • Effort: Medium. A new subcommand with templates, slug logic, spec-delta detection, and skill wiring; the body estimates about 5 hours.
    • Related: feat(roadmap): add a plan-check command for a plan pull request #3201, which asks for a different change. Both work on the openspec tooling, but the candidate creates the change folder in project form while #3201 validates an existing plan pull request against the same rules.
  3. added
    priority/p2-medium
    status/ready
    and removed
    status/new
    on Nov 2, 2026
  4. devops-cli-service commented on Nov 2, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at bc0434e (see proposed design in issue body).

  5. devops-cli-service commented on Nov 2, 2026

    @devops-cli-service
    Contributor

    The stage job returned the item to New. The premise of the issue does not hold at the staging commit, so the job planned no change and opened no pull request.

    Evidence:

    placeholder

  6. added
    status/new
    and removed
    status/ready
    on Nov 2, 2026
  7. devops-cli-service commented on Nov 5, 2026

    @devops-cli-service
    Contributor

    Alternatives check: partly

    Tool: Fission-AI/OpenSpec (https://github.com/Fission-AI/OpenSpec)

    • License: MIT
    • Last activity: 2026-11-04
    • Maintained: yes

    Covers:

    • Creates openspec/changes// with .openspec.yaml, proposal.md, design.md, tasks.md and a specs//spec.md per capability.
    • Project-local custom schemas (openspec/schemas//schema.yaml plus templates/proposal.md, spec.md, design.md, tasks.md) let the project own the file bodies and section order, selected from openspec/config.yaml, so project-only sections such as ## Feasibility and ## Existing Tool Considered can be part of the scaffold instead of the generic skeleton.
    • Scaffolded templates can carry one-line instruction comments for the author, which is the form the issue asks for.
    • .openspec.yaml carries the schema and the skip_specs key, and openspec validate rejects a zero-delta change that does not set skip_specs: true.
    • openspec schema validate and openspec validate check a schema and a change folder, so a malformed scaffold is caught by the tool.

    Lacks:

    • The change name is an argument (openspec new change ); the tool does not derive the folder slug from the issue title, and shares no slug function with the project's branch rule.
    • It creates no branch and prints no branch name; auto-creating a feature branch for a new proposal is an open request, not a feature.
    • It does not read the issue (number, title, type, scope) from GitHub, so the issue number and title never reach the folder name.
    • It does not read openspec/specs//spec.md to choose ## MODIFIED Requirements with the copied existing text versus ## ADDED Requirements; the author makes that choice.
    • It does not derive skip_specs from --paths (or any non-observable path list); the value is written by hand or fixed by the schema.
    • It has no project gate that fails a change file still holding a scaffold marker, and no next-step output with the branch, the checks and the archive command.
    • It ships no project skill file pointing an interactive agent at the scaffold command.

    Searches run:

    • OpenSpec new change project schema custom templates
    • spec-driven development tool scaffold change proposal folder from issue
    • openspec new change skip_specs .openspec.yaml created
    • generate openspec change folder from GitHub issue CLI slug branch
    • openspec custom schema templates proposal design tasks marker validate

    Sources:

    Checked on 2026-11-05. A person decides what this means for the item. The check changes no label and closes no issue.

  8. added
    status/ready
    and removed
    status/new
    on Nov 5, 2026
  9. devops-cli-service commented on Nov 5, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at d254410 (see proposed design in issue body).

  10. added 2 commits that reference this issue on Nov 8, 2026
    2e5fd7e
    8d5c1dc
  11. added
    status/in-review
    and removed
    status/ready
    on Nov 8, 2026
  12. removed
    status/in-review
    on Nov 8, 2026
  13. devops-cli-service commented on Nov 8, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-08 22:36 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumscope/openspectype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions