Skip to content

feat(roadmap): add a plan-check command for a plan pull request #3201

Closed

Description

@dan-petty

Problem or Motivation

The review of a plan pull request is manual. In one session, 23 plan pull requests were reviewed by hand, with the checklist rewritten in each prompt. The checklist drifted: one version told reviewers to flag the tuicr line in tasks.md, which openspec/config.yaml allows, and three review comments needed a correction. Most of the checks are mechanical: a path exists at the commit, a requirement name is new or exists, an operation is ADDED or MODIFIED, a new test sits in the mirror folder, a verify command has the right form, the title has at most 60 characters. The stage job runs most of these gates on its own reply, and a person or an agent cannot run them on a pull request that already exists.

Proposed Solution & Architectural Design

  • Add devops roadmap plan-check <pull-request>. It reads the change folder at the head of the pull request and runs the same gates as the stage job (check_proposal and validate_change) on it, without a model. It also runs the checks of the pull request itself: the title form, the body length, Plans #<issue> or Closes #<issue>, and the state of the Semantic PR title check.
  • It prints each problem with the file and the rule, in the same words as the messages of the stage job, and it exits 1 when it finds one.
  • It adds checks the gates do not run on a reply: a base spec that moved since the plan (a MODIFIED requirement whose text changed), and an issue that the plan depends on that is open.
  • --json prints the problems for an agent. --dry-run prints the requests.
  • A plan-review skill (or sub-agent definition) can then call this command and add only the judgement parts: the premise check against the code and the scope. The mechanical part has one source.

Open questions for the refine step: how to rebuild the StageProposal from a change folder on disk (the gates read the model's reply, not the files), and whether the command belongs in roadmap or in openspec.

Target Subsystem

src/devops_cli/commands/roadmap.py (or the new command files from the structure issues), src/devops_cli/roadmap/stage_validate.py, src/devops_cli/roadmap/stage_change.py.

Existing Tool Considered

openspec validate --strict checks the shape of a change, and the project already runs it in stage_validate.py. It does not check paths against the commit, the mirror folder or the pull request title. Cost to build: about 120k tokens and 6 hours. To keep: the gates are shared with the stage job, so it adds one reader and one command.

Related: #3013, #3015, #3017, #3019 (the gates), #3153.

Proposed design

Problem statement

Plan pull request reviews are manual. The checklist changes between prompts, so reviewers miss mechanical defects. The stage job runs the gates on a model reply, but no command runs them on a pull request that already exists. This change adds a plan-check command that runs the same gates and the pull request checks without a model.

Acceptance criteria

Requirement: Plan-check reads the pull request head

The devops roadmap plan-check command SHALL read the change folder from the head commit of the named pull request.

Scenario: The head commit supplies the change folder

  • WHEN the pull request head holds openspec/changes/3201-plan-check/ and the base does not
  • THEN the command reads proposal.md, tasks.md and the spec deltas from the head commit.

Requirement: Plan reader round-trips a change folder

The plan reader SHALL build a StageProposal from the files of a change folder that gives the same gate inputs as the proposal that render_change wrote.

Scenario: A rendered change reads back

  • WHEN render_change writes a valid proposal with groups, specs and criteria
  • THEN the reader gives a StageProposal whose groups, specs, criteria and skip_specs equal the original.

Requirement: Plan-check runs the stage gates without a model

The command MUST run check_proposal and validate_change on the change folder without a model client.

Scenario: The gates run with no model

  • WHEN the command checks a valid plan
  • THEN the test records calls to check_proposal and validate_change and no call to a model client.

Requirement: Plan-check reports a stage problem

The command SHALL print each problem with its file, its rule and the message that the stage job uses, and exit 1 when it finds one.

Scenario: A missing path gives the stage message

  • WHEN a group changes src/devops_cli/roadmap/missing.py that the head tree does not hold
  • THEN stdout holds the path and the missing-path message, and the exit code is 1.

Requirement: Plan-check checks the title

The command SHALL report a problem when the pull request title is not docs(openspec): plan # or when its summary is longer than SUMMARY_MAX_CHARS.

Scenario: A wrong title is reported

  • WHEN the pull request title is feat(roadmap): add plan-check
  • THEN the output names the title rule and the exit code is 1.

Requirement: Plan-check checks the body

The command SHALL report a problem when the pull request body is longer than BODY_MAX_CHARS, lacks Plans #, or holds Closes #.

Scenario: A missing plan reference is reported

  • WHEN the pull request body holds no Plans # line
  • THEN the output names the body rule and the exit code is 1.

Requirement: Plan-check reads the Semantic PR title check

The command MUST report the Semantic PR title check as a problem unless its conclusion is success.

Scenario: A failed Semantic PR title check is reported

  • WHEN the pull request has a Semantic PR title check with conclusion failure
  • THEN the output names the check and the exit code is 1.

Requirement: Plan-check reports a moved base spec

The command SHALL report each MODIFIED requirement whose text in the base spec at the plan commit differs from the text at the pull request base.

Scenario: A changed base requirement is reported

  • WHEN the base spec at the plan commit holds The job SHALL stage one item. and the pull request base holds The job SHALL stage two items. for the same requirement
  • THEN the output names the capability and the requirement, and the exit code is 1.

Requirement: Plan-check prints JSON

The --json option SHALL print the problems as a JSON array of objects with path, rule and message.

Scenario: JSON output parses

  • WHEN the command finds one problem and runs with --json
  • THEN stdout parses as a JSON array with one object that has path, rule and message.

Requirement: Plan-check dry run makes no request

The --dry-run option MUST print the GitHub requests and make none.

Scenario: Dry run lists requests

  • WHEN the command runs with --dry-run
  • THEN the output lists each request and the test records no GitHub API call.

Existing Tool Considered

No alternatives check has run. The issue names openspec validate --strict; it checks the shape of a change only. It lacks checks for a path at the commit, the mirror folder, the pull request title and body, the Semantic PR title check and a moved base spec. The issue gives the cost to build as about 120k tokens and 6 hours; to keep, one reader and one command share the stage gates.

Key questions

  • Where does the plan-check command belong?: It belongs in devops roadmap as plan-check. It reads a roadmap plan pull request and calls the roadmap stage gates. devops openspec stays the OpenSpec tool gate. (best practice) [sources: src/devops_cli/commands/roadmap.py, src/devops_cli/roadmap/stage_validate.py, openspec/config.yaml]
    • Chosen: roadmap command. It reads a roadmap plan pull request and shares the stage gates.
    • Rejected: openspec command. openspec checks the OpenSpec tree and does not read a pull request.
    • Rejected: separate pull request command. It would duplicate the roadmap store and the pull request form code.
  • How does the command build the stage input from the change folder?: It reads the change folder into a StageProposal with a new reader, then calls check_proposal and validate_change unchanged. Round-trip tests prove that render_change output reads back to the same gate inputs. (best practice) [sources: src/devops_cli/roadmap/stage_change.py, src/devops_cli/roadmap/stage_validate.py, docs/ROADMAP_WORKFLOW.md]
    • Chosen: Read into StageProposal. It reuses the existing gates and one reader; round-trip tests bound the file format.
    • Rejected: Change the gates to read raw files. It splits each gate into two paths and doubles the checks.
    • Rejected: Store plan.json at stage time. Existing plan pull requests have no plan.json, so the command cannot check them.
  • How does the command find the change folder?: It takes the one openspec/changes/-/ folder whose issue number is the issue in the pull request body. It reports a problem when zero or more than one folder match. (best practice) [sources: CONTEXT.md, src/devops_cli/roadmap/stage_change.py]
    • Chosen: Match the issue number. The change folder name carries the issue number.
    • Rejected: Take the first folder. A pull request can hold more than one change folder by mistake.
    • Rejected: Read the path from the body. The body format does not name the folder.
  • How does the command detect a base spec that moved since the plan?: It compares the base spec at the parent of the commit that added the change folder with the base spec at the pull request base, for each MODIFIED requirement. It reports a changed or missing text. (best practice) [sources: src/devops_cli/roadmap/stage_validate.py, src/devops_cli/roadmap/stage_change.py]
    • Chosen: Compare plan parent with pull request base. It measures movement since the plan was written.
    • Rejected: Compare pull request base with pull request head. The head holds the change delta, not the base spec.
    • Rejected: Run no check. The issue asks for this check.
  • Does a missing Semantic PR title check fail plan-check?: Yes. The Semantic PR title check is required on main, so a plan pull request with no successful check is not ready. (best practice) [sources: docs/adr/0004-ci-is-the-authoritative-gate.md]
    • Chosen: Report missing and failing. The check is required before merge.
    • Rejected: Report only failing. A missing check cannot pass the gate.
    • Rejected: Ignore the check. The issue asks for the check state.
  • Which issue reference does a plan pull request need in its body?: It needs Plans #. The command reports Closes # as a problem because a plan pull request closes no issue. (best practice) [sources: CONTEXT.md, src/devops_cli/roadmap/stage_change.py]
    • Chosen: Require Plans #. CONTEXT says a plan pull request closes no issue, and the stage body writes Plans.
    • Rejected: Accept Plans or Closes. Closes would close the issue when the plan merges.
    • Rejected: Require no reference. The plan must link its issue.
  • What title and body limits apply to a plan pull request?: The title is docs(openspec): plan # with a summary of at most SUMMARY_MAX_CHARS characters. The body is at most BODY_MAX_CHARS characters. [sources: src/devops_cli/roadmap/stage_change.py]
  • How does the command report problems to a person and to an agent?: It prints one line for each problem with the file, the rule and the message. It exits 1 when it finds one. --json prints objects with path, rule and message. (best practice) [sources: src/devops_cli/commands/roadmap.py, src/devops_cli/roadmap/stage_change.py]
    • Chosen: Human lines and JSON. A person reads the lines and an agent reads the JSON.
    • Rejected: JSON only. A person needs a readable line in the terminal.
    • Rejected: Human lines only. The issue asks for --json for an agent.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/feature
    scope/roadmap
    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/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. It removes manual review of mechanical checks but does not block a release or fix a defect.
    • Value: Medium. It saves reviewer time on 23+ plan pull requests per session by automating the mechanical checks.
    • Effort: Medium. It needs a new command, a disk-based change-folder reader, reuse of existing gates, new checks, and CLI flags; the body estimates about 6 hours.
    • Related: feat(roadmap): the stage job verifies its plan with a model after the gates #3153, which asks for a different change. Both use the same mechanical gates on a plan, but #3153 adds model-based verification inside the stage job while the candidate adds a CLI command that runs those gates on an already-opened plan pull request.
  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 24ef67a (see proposed design in issue body).

    Moved to new items: #3224.

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

    @devops-cli-service
    Contributor

    Staged: branch feat/3201-add-a-plan-check-command-for, draft pull request #3261. The pull request plans the item and closes no issue.

    The task groups, with the tokens of the inputs of each step, for a budget of 40000 tokens:

    1. Read a change folder into a StageProposal: 19970 tokens
    2. Run the stage gates and the pull request checks on a plan: 20072 tokens
    3. Wire the plan-check command and its options: 28816 tokens
    4. Document plan-check: 17805 tokens

    The plan run made 3 model request(s), and used 231264 input tokens and 18243 output tokens. The model made no tool call.

    A model review of the plan found these points. They stop no draft, and a person judges them:

    • criterion_dropped at plan (spec delta and groups 1-3): The issue asks for a check on an open issue that the plan depends on. No requirement, scenario or task in the plan covers it, and the plan does not say why it leaves the check out. Evidence: "a base spec that moved since the plan (a MODIFIED requirement whose text changed), and an issue that the plan depends on that is open."
  6. dan-petty commented on Nov 2, 2026

    @dan-petty
    OwnerAuthor

    Another case for the plan-check command, from the plan fix of #3194 (2026-11-02): the repository invariant tests/invariants/test_committed_addresses.py is not run on a staged plan. A plan that wrote the example address 10.1.2.3 was staged, and only CI caught it (Tests & Coverage red on the first push of the fix). The plan-check command should run the invariants that read text files (committed addresses, private hosts, secret patterns, ASD-STE100 style) over the change folder, so a plan with a private example fails at staging and not in CI.


    Generated by Claude Code

  7. added 3 commits that reference this issue on Nov 3, 2026
  8. added
    status/planned
    and removed
    status/ready
    on Nov 3, 2026
  9. added
    status/in-progress
    status/in-review
    and removed
    status/planned
    status/in-progress
    on Nov 4, 2026
  10. removed
    status/in-review
    on Nov 4, 2026
  11. devops-cli-service commented on Nov 4, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-04 04:48 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/roadmaptype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions