Skip to content

feat(roadmap): stage reads the planning rules from openspec #4657

Open

Description

@dan-petty

Problem or Motivation

  • roadmap_stage_change.md (21,108 characters) restates about 8 of the 14 rules of openspec/config.yaml ("at least 50 characters", "offline", "a shim or a legacy mode", skip_specs and others). The stage never reads that file.
  • tests/roadmap/stage/test_roadmap_stage_prompt_rules.py holds 54 tests with 52 in prompt checks that keep the text in step.
  • openspec instructions <artifact> --json (pinned 1.14.3) returns the context (935 characters) and the rules (4, 4, 1 and 5 for proposal, specs, design and tasks).
  • src/devops_cli/openspec/gate.py:91-106 already runs this probe.
  • With owner decision 3 (2026-11-11), all 6 other repositories get their own openspec/config.yaml. The stage must read the rules of each repository, not the rules of devops-cli.

Proposed Solution & Architectural Design

  • The stage request gets a "Rules of this repository" section, built from the context and the rules of openspec instructions proposal|specs|design|tasks --json at the staged commit.
  • The stage prompt keeps the reply schema and the generic plan rules. Remove the restated config rules from it.
  • Remove the prompt-rule tests that check the restated text together with the text.

Target Subsystem

SDLC, Git & PR Governance (src/devops_cli/roadmap/stage/).

Existing Tool Considered

The OpenSpec CLI gives the rules of a repository with openspec instructions --json. No other tool is necessary. Cost: about 60 lines, about 200,000 tokens and 3 hours to build.

Acceptance Criteria

  • uv run devops roadmap eval stage --replay gives a score that is not lower (both numbers in the pull request).
  • A test: the stage request for a scratch repository with its own config.yaml holds the context line of that repository and none of devops-cli.
  • The character count of roadmap_stage_change.md goes down.
  • A search for each of the 5 shared phrases finds it in openspec/config.yaml and not in the prompt.

Dependencies

#4629 and #4633.

Source: #4627

Alternatives check of 2026-11-26: in-use.
The repository already uses this tool.
Tool: Fission-AI/OpenSpec (https://github.com/Fission-AI/OpenSpec), MIT, last activity 2026-11-25, maintained.
Reason: Searches found no better alternative, and OpenSpec already supplies each repository's context and per-artifact planning rules through its instructions command, so only the stage-request wiring and prompt cleanup remain.

Covers:

  • Returns repository context and rules for proposal, specs, design and tasks
  • Reads each repository's own openspec/config.yaml
  • Same probe already run in src/devops_cli/openspec/gate.py
  • Merges defaults so the stage need not parse config itself

Lacks:

  • No "Rules of this repository" section in the stage request
  • Does not remove the restated rules from the stage prompt
  • Does not delete the prompt-rule config checks
  • Pinned 1.14.3 output shape must be checked against newer releases

Proposed design

Problem statement

The stage prompt restates about 8 of the 14 planning rules of openspec/config.yaml. The stage job never reads that file. With owner decision 3, each of the 6 other repositories gets its own openspec/config.yaml, so the stage must read the rules of each repository. The change wires the existing OpenSpec instructions probe into the stage request and removes the restated rules and their prompt-rule checks. The item waits on #6521, #4629 and #4633.

Acceptance criteria

Requirement: Stage request carries staged repository rules

The stage job SHALL add a Rules of this repository section from the staged commit's openspec instructions proposal|specs|design|tasks --json context and rules.

Scenario: Scratch repository config

  • WHEN A test builds the stage request for a scratch repository whose openspec/config.yaml holds a context line of its own.
  • THEN The request holds that context line and holds no context line of devops-cli.

Requirement: Probe reads the staged commit

The stage job MUST run the OpenSpec instructions probe on the staged commit through the same probe that src/devops_cli/openspec/gate.py runs.

Scenario: Working tree differs from staged commit

  • WHEN A test sets a working-tree context line and a different staged-commit context line, then builds the stage request.
  • THEN The request holds the staged-commit context line and holds no working-tree context line.

Requirement: Prompt keeps reply schema and generic plan rules

The stage prompt SHALL keep the reply schema and each plan rule that no openspec/config.yaml rule holds.

Scenario: Prompt-rule module

  • WHEN A person runs uv run devops ci test tests/roadmap/stage/test_roadmap_stage_prompt_rules.py.
  • THEN The run passes, and the module still asserts the reply keys of StageProposal and the PENDING_PERSON value.

Requirement: Prompt restates no config rule

The stage prompt src/devops_cli/ai/tasks/roadmap_stage_change.md SHALL hold no phrase that the base commit's tests/roadmap/stage/test_roadmap_stage_prompt_rules.py pairs with openspec/config.yaml.

Scenario: Search each shared phrase

  • WHEN A check runs ! git grep -n '<phrase>' src/devops_cli/ai/tasks/roadmap_stage_change.md for each phrase in the _CONFIG pairs at the base commit.
  • THEN Each command exits 0.

Requirement: Prompt-rule test drops config checks

The prompt-rule test module SHALL read no openspec/config.yaml and SHALL pass.

Scenario: Module runs and search finds no config read

  • WHEN A check runs uv run devops ci test tests/roadmap/stage/test_roadmap_stage_prompt_rules.py and ! git grep -n '_CONFIG' tests/roadmap/stage/test_roadmap_stage_prompt_rules.py.
  • THEN Both commands exit 0.

Requirement: Prompt character count falls

The character count of src/devops_cli/ai/tasks/roadmap_stage_change.md MUST be below 21108.

Scenario: Character count of the prompt

  • WHEN A test counts the characters of the prompt.
  • THEN The count is below 21108.

Requirement: Eval replay score does not fall

The stage eval replay score SHALL not be lower than the score of the base commit.

Scenario: Replay of the stage eval

  • WHEN A person runs uv run devops roadmap eval stage --replay on the change.
  • THEN The score is at least the score of the base commit, and the pull request body gives both scores.

Requirement: OpenSpec JSON shape is checked

The stage job SHALL parse the openspec instructions --json output shape of the pinned 1.14.3 release and a newer release fixture.

Scenario: Pinned and newer fixtures

  • WHEN A test parses a 1.14.3 fixture and a newer release fixture through the stage adapter.
  • THEN The adapter returns the context and the rules of each artifact for both fixtures.

Existing Tool Considered

OpenSpec (Fission-AI/OpenSpec) is in use. The alternatives check in the issue body gives the Covers and Lacks lists. The proposal uses the same probe that src/devops_cli/openspec/gate.py already runs, adds a test for a scratch repository, and adds a fixture test for the pinned 1.14.3 --json shape. The item builds no new tool.

Key questions

  • How does the stage request get the planning rules of the staged repository?: Run the existing OpenSpec probe openspec instructions proposal|specs|design|tasks --json at the staged commit through src/devops_cli/openspec/gate.py, and build the Rules of this repository section from its context and rules. (best practice) [sources: src/devops_cli/openspec/gate.py:91-106, openspec/config.yaml, src/devops_cli/roadmap/stage/stage_change.py]
    • Chosen: OpenSpec CLI probe. The tool merges the context and the rules of the repository, and src/devops_cli/openspec/gate.py already runs the probe.
    • Rejected: Parse openspec/config.yaml in the stage job. It copies the merge and default logic of the tool, and it drifts when the tool changes its schema.
    • Rejected: Keep the restated rules in the prompt. It gives devops-cli's rules to the 6 other repositories, which get their own config.
  • Which artifacts' rules does the section carry?: The four artifacts that openspec/config.yaml holds rules for: proposal, specs, design and tasks, with the context of the repository. [sources: openspec/config.yaml]
  • Does the change keep the prompt-rule checks whose document is not openspec/config.yaml?: Yes. Remove only the checks that pair a phrase with openspec/config.yaml, and keep the checks for the reply schema and the other documents. (best practice) [sources: tests/roadmap/stage/test_roadmap_stage_prompt_rules.py, openspec/config.yaml]
    • Chosen: Remove only the config pairs. The issue names the restated config rules, and the prompt keeps the phrases of the other documents.
    • Rejected: Remove the whole module. It also holds the reply-schema and plan-form checks that no config rule covers.
    • Rejected: Keep the config pairs and read the config in the test. The prompt no longer holds the text, so an in prompt check cannot pass.
  • Where does the stage request put the rules section?: Before the reply schema and after the problem statement, so the planner reads the rules of the repository before the format of its reply. (best practice) [sources: src/devops_cli/ai/tasks/roadmap_stage_change.md]
    • Chosen: Before the reply schema. The planner reads the rules of the repository before the format of its reply.
    • Rejected: After the reply schema. The format then sits between the rules and the reply, and the model weighs the format first.
    • Rejected: At the end of the request. A rule at the end sits far from the reply, and the order of the prompt gains nothing.
  • How does the change check the pinned openspec instructions --json output shape?: Add a test with a fixture of the 1.14.3 --json output and a fixture of a newer release, and parse both through the same adapter that the stage request uses. (best practice) [sources: src/devops_cli/openspec/gate.py:91-106, openspec/config.yaml]
    • Chosen: Pinned and newer fixture tests. The issue pins 1.14.3, and fixtures prove both shapes without a network or a live CLI.
    • Rejected: Trust the installed CLI. A newer CLI can change the shape, and the test then fails late.
    • Rejected: Parse openspec/config.yaml directly. It copies the merge and default logic of the tool.
  • Which prompt-rule checks pair a phrase with openspec/config.yaml?: The checks that use the module-level _CONFIG value, which reads openspec/config.yaml at line 53. [sources: tests/roadmap/stage/test_roadmap_stage_prompt_rules.py:53]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#6521, #4629, #4633

Activity

  1. added
    source/agent
    on Nov 11, 2026
  2. added
    type/feature
    scope/roadmap
    status/new
    value/medium
    effort/low
    on Nov 11, 2026
  3. dan-petty commented on Nov 11, 2026

    @dan-petty
    OwnerAuthor

    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/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. It removes rule duplication across repositories but does not block a release or fix a defect.
    • Value: Medium. It stops the stage prompt from drifting out of sync with per-repository openspec rules.
    • Effort: Low. The body estimates about 60 lines and 3 hours of work.
    • Related: test(roadmap): check the planner prompt against the project rules #3202, which asks for a different change. Both work on roadmap_stage_change.md and its prompt-rule tests, but #3202 added tests to keep restated text in sync while the candidate removes the restated text and reads rules from openspec.
  4. added
    priority/p2-medium
    on Nov 11, 2026
  5. devops-cli-service commented on Nov 14, 2026

    @devops-cli-service
    Contributor

    Alternatives check: in-use

    Reason: The searches found no competing tool, and the issue's own "Existing Tool Considered" points at the OpenSpec CLI, whose openspec instructions <artifact> --json already returns a repository's context and its per-artifact rules (proposal, specs, design, tasks) from openspec/config.yaml, which is exactly the need. The project already runs that probe in src/devops_cli/openspec/gate.py and adopted OpenSpec in ADR 0010, so the tool is in use and nothing else is required.

    The repository already uses this tool.

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

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

    Covers:

    • openspec instructions proposal|specs|design|tasks --json returns the context and the rules of the repository the command runs in
    • Because it reads the config of the checked-out repository, it covers each of the 6 other repositories that get their own openspec/config.yaml, not only devops-cli
    • It runs as a CLI probe at a commit, as src/devops_cli/openspec/gate.py:91-106 already does
    • It is the single source of the planning rules, so the restated rules can be dropped from roadmap_stage_change.md without losing them

    Lacks:

    • It only supplies the rules; the "Rules of this repository" section in the stage request, the removal of the restated rules and the deletion of the prompt-rule tests are still the work of the issue
    • The acceptance checks (roadmap eval stage --replay score, lower character count, the scratch-repository test) are outside the tool
    • The issue pins 1.14.3 while the repository's latest release is v2.0.0, so the exact instructions --json output shape must be checked against the pinned version

    Tools considered:

    Searches run:

    • OpenSpec spec-driven development CLI config.yaml, results: 5
    • openspec CLI instructions --json artifact rules, results: 5
    • "openspec" npm package spec-driven development, results: 5
    • Fission-AI OpenSpec github repository, results: 5
    • openspec instructions proposal specs design tasks json context rules, results: 5
    • openspec cli reference commands instructions, results: 5
    • OpenSpec, results: 5
    • spec-driven development tool openspec change proposal, results: 5

    Sources:

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

  6. devops-cli-service commented on Nov 14, 2026

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at 0410772 while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.

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

    @devops-cli-service
    Contributor

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

  9. dan-petty commented on Nov 20, 2026

    @dan-petty
    OwnerAuthor

    Frozen on 2026-11-20. The stage, implement and fix-checks jobs grade under 60%, so the owner rule asks for a re-architecture before more fixes inside the current design (tracker #6519). This item is incremental work on those jobs, so its Dependencies section now names #6521 first. Stage and implement leave this item while #6521 is open. When the experiments of #6519 decide, a person closes #6521 (this item can then continue) or closes this item as not planned.

  10. added
    status/new
    and removed
    status/ready
    on Nov 26, 2026
  11. devops-cli-service commented on Nov 26, 2026

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.

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/lowpriority/p2-mediumscope/roadmapsource/agentstatus/newtype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions