Skip to content

refactor(roadmap): plan from a neutral prompt and openspec #8039

Backlog

Description

@dan-petty

Problem

The stage job treats each target repository as devops-cli. It never reads the facts of the target. Its prompts and form checks require each verify command to start with uv run devops, refuse uv run pytest, assume src/devops_cli/, and add uv run devops ci docs to documents tasks. The plans cannot be implemented in other repositories.

Evidence

Owner decisions (2026-12-01)

  • A job gives the agent a prompt that states the purpose and the wanted result, in a working directory with an up-to-date issue branch and pre-commit installed.
  • Plans are OpenSpec changes in each repository. Only the open command openspec validate checks them.
  • A repository with no Makefile, or without the standard make targets, gets a warning and the run continues.

Acceptance criteria

  • The stage prompt names no devops-cli command, path or module, and it reads correctly for a repository with a different layout.
  • The stage job checks the branch, the pre-commit setup, and openspec validate --strict. It runs no other plan-shape check.
  • A repository with no Makefile, or without the standard targets, gets a warning in the log. The job does not fail for that reason.
  • The change deletes the replaced plan gates, their settings, tests and specs.
  • The implement job can implement a plan that this job writes.
  • The prompt tells the agent to read the documents of the repository (such as AGENTS.md, README.md and CONTRIBUTING.md) and to run the setup commands that they name before it starts the work. A repository that names no setup command is not an error.

Order

Depends on: #8040. The implement job, the Plan Check job, plan drift and fix-plan reject a plan that only passes openspec validate, so this change also removes or replaces those readers. The production stage Job runs the legacy planner of stage.py, not the phased Coder path (#6814). The path, file mode and secret refusals of the publish step are security controls and stay.

Proposed design

Problem statement

The stage job plans every target repository as if it were devops-cli. Its prompt and form gates require devops-cli commands, paths and modules. Plans for other repositories fail or need manual repair. The change makes the stage job write an OpenSpec change from a neutral prompt. The stage job validates the plan only with openspec validate --strict.

Acceptance criteria

Requirement: Neutral stage prompt

The stage prompt SHALL name no devops-cli command, path or module and SHALL read correctly for a repository with a different layout.

Scenario: Prompt contract test

  • WHEN A contract test reads src/devops_cli/ai/tasks/roadmap_stage_change.md and src/devops_cli/ai/tasks/roadmap_stage_coder.md.
  • THEN The test finds no uv run devops, no src/devops_cli, and no devops_cli module name.

Requirement: Stage validation uses OpenSpec

The stage job SHALL check the issue branch, the pre-commit setup, and openspec validate --strict, and SHALL run no other plan-shape check.

Scenario: Stage validation command list

  • WHEN A test runs the stage validation step with a fake repository and a fake command runner.
  • THEN The test records a branch check, pre-commit --version, and openspec validate --strict, and no call to form_problems or is_valid_verify.

Requirement: Missing Makefile warns

The stage job SHALL log a warning when the repository has no Makefile or lacks the standard make targets, and SHALL NOT fail for that reason.

Scenario: Repository profile without make targets

  • WHEN A test gives the stage job a resolve_profile result with no Makefile or no standard target.
  • THEN The stage job logs a warning and returns a success result.

Requirement: Remove replaced plan gates

The change SHALL delete the replaced plan gates, their settings, tests and specs.

Scenario: Removed plan-gate symbols

  • WHEN A test imports the stage modules and searches the source tree for the replaced plan-gate names.
  • THEN The test finds no definition or call of form_problems, is_valid_verify or _manifest_verify_problems.

Requirement: Implement accepts a neutral plan

The implement job SHALL accept and implement a plan that the stage job writes with repository-native commands.

Scenario: Plan with repository-native verify commands

  • WHEN A test gives the implement job a staged OpenSpec change whose verify commands use the repository's own toolchain.
  • THEN The implement job validates the plan with openspec validate --strict and starts the first task group without a plan-shape error.

Requirement: Prompt reads repository setup

The stage prompt SHALL tell the agent to read the repository documents and run the setup commands that they name before the work starts, and SHALL treat a repository with no setup command as no error.

Scenario: Prompt setup contract

  • WHEN A contract test reads the stage prompt.
  • THEN The prompt names AGENTS.md, README.md and CONTRIBUTING.md, and states that no setup command is not an error.

Requirement: Stage workspace is ready

The stage job SHALL give the agent an up-to-date issue branch and an installed pre-commit before the prompt runs.

Scenario: Stage workspace setup

  • WHEN A test runs the stage workspace setup on a clean clone with a fake remote.
  • THEN The workspace is on the issue branch at the latest base commit and pre-commit --version exits 0.

Requirement: Stage writes an OpenSpec change

The stage job SHALL write the plan as an OpenSpec change in the target repository.

Scenario: OpenSpec change output

  • WHEN A test runs the stage job with a fake agent reply.
  • THEN The job writes the change under openspec/changes/ and runs openspec validate --strict.

Existing Tool Considered

No alternatives check has run. The OpenSpec CLI covers the plan format and the openspec validate --strict check. The pre-commit tool covers the hook setup. The change writes no new plan-shape checker. It deletes form_problems and its callers. The cost is the edit and its tests, not a new tool.

Key questions

  • What does the stage job give the agent?: The stage job gives the agent a prompt with the purpose and the wanted result. It prepares a working directory on an up-to-date issue branch and installs pre-commit before the prompt runs. (best practice) [sources: docs/ROADMAP_WORKFLOW.md, CONTRIBUTING.md]
    • Chosen: Prepare the workspace and give a purpose prompt. The owner decision requires an up-to-date branch, an installed pre-commit and a prompt that states the wanted result.
    • Rejected: Give the agent a list of devops-cli commands. A command list fails in a repository with another layout.
    • Rejected: Run the agent before the branch is current. The plan would start from an old commit and could conflict.
  • Which plan-shape checks remain?: Only the branch check, the pre-commit setup check and openspec validate --strict remain. The stage job deletes form_problems and the devops-specific prefix checks. (best practice) [sources: src/devops_cli/roadmap/stage/stage_form.py, src/devops_cli/ai/tasks/roadmap_stage_change.md]
    • Chosen: OpenSpec validation only. The owner decision makes openspec validate the only plan-shape check.
    • Rejected: Keep the stage form gates. The gates require uv run devops and src/devops_cli.
    • Rejected: Build a neutral plan linter. OpenSpec already validates the plan, and a new linter adds code to keep.
  • How does the prompt handle repository setup commands?: The prompt tells the agent to read AGENTS.md, README.md and CONTRIBUTING.md, and to run the setup commands that they name. If no document names a setup command, the stage job does not fail. (best practice) [sources: AGENTS.md, README.md, CONTRIBUTING.md]
    • Chosen: Read the repository documents. The repository documents are the source of its setup steps.
    • Rejected: Hardcode setup commands. Hardcoded commands fail in a repository with another layout.
    • Rejected: Skip setup. The owner decision requires setup before the work starts.
  • What are the standard make targets for the warning?: The stage job reads the standard targets for the repository type from the project profile. It warns when the Makefile is absent or when a standard target is absent. (best practice) [sources: src/devops_cli/roadmap/project_profile.py]
    • Chosen: Use the project profile target list. The profile holds the repository type and layout facts, and each value records its source.
    • Rejected: Hardcode test, lint and docs. Those targets are devops-cli-specific.
    • Rejected: Warn only on a missing Makefile. The owner decision also covers a Makefile without the standard targets.
  • Should the stage job call resolve_profile?: Yes. The stage job calls resolve_profile for the target repository, as the implement job does. It uses the profile for the Makefile warning and workspace facts, and the prompt stays neutral. (best practice) [sources: src/devops_cli/roadmap/project_profile.py, src/devops_cli/roadmap/implement/implement_phases.py, src/devops_cli/roadmap/implement/implement_run.py]
    • Chosen: Reuse resolve_profile. The implement job already reads target facts this way, and the stage job needs the same facts for the Makefile warning.
    • Rejected: Parse the Makefile in the stage job. This duplicates profile detection and hardcodes repository layout.
    • Rejected: Read no target facts. The stage job cannot warn about a missing Makefile or missing target.
  • Should the implement job keep its plan-shape readers?: No. The implement job, Plan Check, plan drift and fix-plan replace their plan-shape readers with openspec validate --strict. The path, file mode and secret refusals of the publish step stay. (best practice) [sources: docs/ROADMAP_WORKFLOW.md, src/devops_cli/roadmap/implement/implement_phases.py]
    • Chosen: Replace the readers with OpenSpec validation. The owner decision makes OpenSpec the plan format and its validation the only plan-shape check.
    • Rejected: Keep the readers. They reject a plan that only passes openspec validate and block other repositories.
    • Rejected: Add a new neutral linter. This adds a checker where OpenSpec already validates the plan.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#8040

Alternatives check of 2026-12-01: not-applicable.
Class: refactor, no model call.
Tool: none found.

Activity

  1. added
    type/refactor
    source/agent
    scope/roadmap
    status/new
    effort/high
    value/high
    priority/p2-medium
    owner/agent
    priority/p1-high
    and removed
    priority/p2-medium
    on Dec 1, 2026
  2. devops-cli-service commented on Dec 1, 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/highowner/agentpriority/p1-highscope/roadmapsource/agentstatus/newtype/refactorvalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions