Skip to content

feat(roadmap): a generated card gives the check command forms of the runner #5467

Not planned

Description

@dan-petty

Update 2026-11-26 (infra move): implement_shell_policy.py and LOCAL_COMMANDS no longer exist.

Implement runs a stock harness shell since #7031, so it can run a command with --help. The parts of this item that read the shell policy are out of date. Refine it again for the need that stays, such as the stage planner lookups.


Problem or Motivation

The stage planner and the implement agent look up the argument forms of the check commands in most runs:

  • Stage: in the comment sample of 54 items, 17 of the 21 items outside the scopes ci and roadmap looked up a check command form: 81 calls of read_file on src/devops_cli/commands/ci.py (about 23.7k tokens for a whole read), tests/commands/test_ci.py or .github/workflows/ci.yml, or search_code for ci test or ci docs. The prompt names the commands but not their argument forms.
  • Implement: since the run_command prompt of 2026-11-12, 8 of 10 runner runs made 34 calls of devops ci --help, ci docs, ci --only, ci --check, ci constructs or ci run (n = 10, from 2026-11-12 04:00Z to 2026-11-13 16:00Z). The fix(roadmap): a claim release leaves the item In Progress #5118 run tried 4 forms to run one check.
  • LOCAL_COMMANDS (src/devops_cli/roadmap/implement/implement_shell_policy.py) names only uv run devops ci test <file>. The job runs the rows of CONST_ROADMAP_IMPLEMENT_SCOPED_ROWS (constructs, docs, openspec) in check mode, and these are the forms that the agents tried.
  • The help of devops ci is long and wraps, and it does not list the row names.

Proposed Solution & Architectural Design

  1. Implement rows: feat(ci): each check row is a devops ci command #5451 (step 4) adds the uv run devops ci <row> rows to LOCAL_COMMANDS. This item adds no implement row. It adds the test of step 3 for the rows of feat(ci): each check row is a devops ci command #5451.
  2. Stage card: the program makes one short block from the Typer command tree and the check registry of src/devops_cli/commands/ci.py. It holds only the forms that resolve_devops_argv accepts and that run in the runner image (NOT_IN_RUNNER filters the rest). The block is program text, so it goes in the stable system part, at most about 400 tokens. A target repository with no devops ci gets no devops ci lines.
  3. A test resolves each line of the stage card and each devops ci row of LOCAL_COMMANDS with resolve_devops_argv. The test fails when a line and the tree differ.

Target Subsystem

SDLC, Git & PR Governance: src/devops_cli/roadmap/implement/implement_shell_policy.py, src/devops_cli/roadmap/stage/, src/devops_cli/core/command_resolver.py, src/devops_cli/roadmap/runner_tools.py.

Existing Tool Considered

The Typer command tree is the source, and resolve_devops_argv already checks command forms against it. The Typer help text exists, but it does not list the row names and it is too long for a start context. No new tool. Cost to build: about 0.6M tokens and 2 hours (estimate), about 50 lines and 4 tests.

Acceptance Criteria

  • Test first: each line of the stage card and each devops ci row of LOCAL_COMMANDS resolves with resolve_devops_argv. A command of NOT_IN_RUNNER is not in the stage card.
  • A test: the stage card has at most 400 o200k tokens.
  • Measure: from the stage comments, the lookups above in items outside the scopes ci and roadmap (baseline 17 of 21 items, 81 calls), and the stage_problem_command_reference gate returns. From the runner logs, the non-test devops ci forms for each run (baseline 34 calls in 8 of 10 runs). Use devops roadmap eval stage and devops roadmap eval implement as a screen only, with paired call counts as the primary measure.
  • Live proof after release: the same counts on real Service stage runs and runner runs for 7 days.

Dependencies

Standards Compliance

  • I confirm this proposal aligns with AGENTS.md engineering principles (cyclomatic complexity <= 10, nesting <= 4 blocks, zero bare exceptions, tests that cover the changed lines).

Alternatives check of 2026-11-29: partly.
Tool: sphinx-click (https://pypi.org/project/sphinx-click), MIT License, last activity 2025-12-04, maintained.
Reason: Searches found only sphinx-click, a maintained Sphinx extension that renders a Click/Typer command tree as documentation; it covers deriving command forms from the tree, but yields doc pages, not a bounded stage prompt card, so it covers a part.

Covers:

  • Renders usage and option forms from a Click/Typer command tree
  • Walks nested commands and their options with no hand-written list
  • Follows the tree, so documented forms track command changes

Lacks:

  • Produces Sphinx doctree and HTML, not a prompt block
  • No token bound and no check-registry row names
  • No NOT_IN_RUNNER filter and no plan-key versioning
  • No per-line validation with resolve_devops_argv

Proposed design

Problem statement

The stage planner spends many tool calls to learn the argument forms of devops ci check commands: in a sample of stage comments, 17 of the 21 items outside the ci and roadmap scopes read src/devops_cli/commands/ci.py, its tests or .github/workflows/ci.yml (81 calls). The implement agent no longer needs a card: since #7031 it runs a stock harness shell and can run a command with --help. This change generates a short card of the accepted check forms from the check registry of src/devops_cli/commands/ci.py, checked against the Typer command tree, filters the rows whose programs the runner image lacks, holds no devops ci line for a repository whose project profile is neutral, appends the card to the stable system text of the plan request, bounds it to 400 tokens and puts it in the plan key. The item waits on the hold issue #6521, and the after-release measurement is #6241.

Acceptance criteria

Requirement: Stage command card

The stage plan system prompt SHALL hold a generated command card built from the check registry of src/devops_cli/commands/ci.py and checked against the Typer command tree.

Scenario: Card lists the accepted check forms

  • WHEN The test builds the card for a target repository whose project profile is the devops-cli preset
  • THEN The card holds uv run devops ci <row> for each name of CHECK_ROW_NAMES that starts no program of NOT_IN_RUNNER, the uv run devops ci --check --only <rows> form and the uv run devops ci test <file> form.

Requirement: Runner image filter

The command card MUST omit every check row whose commands name a program that NOT_IN_RUNNER lists.

Scenario: A row with a missing program is absent

  • WHEN The test builds the card from a registry that holds a row whose command starts docker, a program of NOT_IN_RUNNER
  • THEN The card holds no line for that row.

Requirement: Repository without devops ci

The command card MUST hold no devops ci line when the project profile of the target repository has no devops-cli preset.

Scenario: A neutral repository gets no devops ci lines

  • WHEN The test builds the card for a target repository whose profile is the neutral preset, and for one whose staged commit holds no .devops/roadmap.toml
  • THEN The card holds no line that starts with uv run devops ci.

Requirement: Stable system part

The generated command card MUST be part of the system text that the stage planner sends with every plan request.

Scenario: Card is in the system text

  • WHEN The test plans one item with a fake stage client that records the system text and the JSON prompt
  • THEN The card appears in the recorded system text and not in the recorded JSON prompt.

Requirement: Card token bound

The generated command card MUST hold at most 400 tokens counted by count_tokens with its gpt-4o encoding.

Scenario: Card stays under the bound

  • WHEN The test generates the card from the current check registry and command tree
  • THEN count_tokens(card) is at most 400.

Requirement: Stage card lines resolve

Each line of the stage command card MUST resolve with resolve_devops_argv.

Scenario: Every card line resolves

  • WHEN The test strips uv run devops from each card line, converts each <...> word with _argv_token and calls resolve_devops_argv
  • THEN resolve_devops_argv returns None for every line.

Requirement: Card through the prompt file

The card MUST be rendered from the Markdown task file src/devops_cli/ai/tasks/roadmap_stage_commands.md through load_task_prompt, and its prompt text MUST sit in that file and not in Python.

Scenario: The prompt file holds the card placeholder

  • WHEN The test renders load_task_prompt("roadmap_stage_commands.md", command_card="MARK")
  • THEN The rendered text holds MARK and the raw file holds {{ command_card }}.

Requirement: Card in the plan key

A change of the command card MUST give a new plan key for the same item and model.

Scenario: A changed card gives a new key

  • WHEN The test computes PlanFiles.key of the same item with two different card blocks
  • THEN The two plan keys differ.

Requirement: Pending a person after the merge

The pull request of this change MUST state the stage eval score before and after, as the rule for a change to the stage prompt asks.

Scenario: The eval scores reach the pull request body

  • WHEN After the plan lands, a person runs uv run devops roadmap eval stage --limit <n> on the base and on the branch with the same model
  • THEN The body holds a Base eval score: line and a Head eval score: line, each with a number, and the draft pull request is marked ready.

Existing Tool Considered

sphinx-click (https://pypi.org/project/sphinx-click, MIT, last activity 2025-12-04) is the open, maintained tool that renders a Click/Typer command tree, and the Lacks: list of its block in the issue body holds what it lacks here. The change builds project code instead: the issue gives the written build cost of about 0.6M tokens and 2 hours (estimate), about 50 lines and 4 tests. The cost to keep and fix it is the repair of the card and its resolution test when a row, an option or a program of the registry changes, because that test fails then.

Key questions

  • What does the freeze reply of 2026-11-20 decide for this item?: The hold issue chore(roadmap): hold incremental stage and implement work #6521 holds the item back: stage and implement leave it while chore(roadmap): hold incremental stage and implement work #6521 is open, and a person closes chore(roadmap): hold incremental stage and implement work #6521 after the experiments of refactor(roadmap): re-architect stage and implement on Coder #6519 or closes this item as not planned. The note of #6519 in the hold line names the tracker and adds no blocker. [sources: docs/roadmap/refine.md:24, docs/roadmap/refine.md:32, openspec/specs/roadmap-refine/waits/spec.md:229]
  • How does the stage card get the check command forms?: Generate the rows from CHECK_ROW_NAMES and get_check_specs() of src/devops_cli/commands/ci.py, and check each generated line with resolve_devops_argv. Keep no hand-written list and copy no Typer help text. Import get_check_specs inside the builder, because ci.py is a heavy module and the startup-imports row budgets the import graph. (best practice) [sources: src/devops_cli/commands/ci.py:130, src/devops_cli/commands/ci.py:871, src/devops_cli/core/command_resolver.py:85, openspec/changes/archive/2026-11-25-4596-replay-a-changed-gate-module-that/design.md:13]
    • Chosen: Generated from the check registry. The registry holds the row names and their commands, and the resolver checks a form against the Typer tree.
    • Rejected: Hand-written list. It goes stale when a row or an option changes.
    • Rejected: Typer help text. The help now names every row, but it is long, wraps, and is not a bounded block of the accepted forms.
  • Which forms does the card leave out?: Leave out every form that resolve_devops_argv rejects, and every check row whose commands name a program in NOT_IN_RUNNER. The generator builds each line from the registry and the test resolves it, so a rejected form never enters the card. (best practice) [sources: src/devops_cli/core/command_resolver.py:85, src/devops_cli/roadmap/runner_tools.py:234]
    • Chosen: Resolution and the NOT_IN_RUNNER filter. The resolver rejects a form the tree does not accept, and the runner table rejects a row the image cannot run.
    • Rejected: Copy the help text. The help is long and wraps, and it is not a bounded block of the accepted forms.
    • Rejected: A hand-written list of skipped forms. It goes stale when a row, an option or a program changes.
  • Does any check row today name a program that NOT_IN_RUNNER holds?: No. The 28 rows start uv, ruff, mypy, actionlint, devops, deptry, ast-grep, pre-commit, pytest and python, and all of them are in RUNNER_TOOLS. The audit row runs uv audit, and npm is in the runner image. The filter is a guard for a future row, and its test builds a row with docker. [sources: src/devops_cli/commands/ci.py:871, src/devops_cli/commands/ci.py:919, src/devops_cli/roadmap/runner_tools.py:234, tests/roadmap/test_roadmap_runner_tools.py:140, docs/CLUSTER.md:78]
  • How does the generator decide that a check row runs in the runner image?: Compute each row's programs as the runner-parity test does: the first word of each command, and the tool after uv run, skipping nice. A row with a program in NOT_IN_RUNNER is out. (best practice) [sources: tests/roadmap/test_roadmap_runner_tools.py:59, tests/roadmap/test_roadmap_runner_tools.py:73, src/devops_cli/roadmap/runner_tools.py:234]
    • Chosen: Row programs against NOT_IN_RUNNER. The runner-parity test already applies this rule to every devops ci row, so the card and the image test agree.
    • Rejected: Parse the prose of the NOT_IN_RUNNER reasons. The reasons are prose for a person, not data.
    • Rejected: A hand-written list of skipped rows. It goes stale when a row is added, renamed or removed.
  • How does the card omit devops ci lines for a target repository that has no devops ci?: Read the profile at the staged commit with resolve_profile(self._source, self._sha), and emit devops ci lines only for the devops-cli preset. A commit with no .devops/roadmap.toml gets the neutral preset. A file that is not valid leaves the card with no devops ci lines and logs the reason, so the card never stops a plan. (best practice) [sources: docs/ROADMAP_WORKFLOW.md:425, src/devops_cli/roadmap/project_profile.py:90, src/devops_cli/roadmap/project_profile.py:98, src/devops_cli/roadmap/toolchains.py:60]
    • Chosen: Project profile. The project records the toolchain of a target repository in .devops/roadmap.toml, and a file that is absent gives the neutral preset.
    • Rejected: Test command resolution. resolve_devops_argv resolves the installed CLI, which the runner image gives every repository, so it never rejects devops ci for a target repository.
    • Rejected: Detect a file. A second rule for the same fact duplicates the profile that the project already reads.
  • How does the test check the stage card?: One test strips uv run devops from each card line, converts each <...> word with _argv_token, and calls resolve_devops_argv. It fails on a finding. (best practice) [sources: src/devops_cli/core/command_resolver.py:85, src/devops_cli/roadmap/stage/stage_commands.py:78, src/devops_cli/roadmap/stage/stage_commands.py:142]
    • Chosen: Resolution test. The resolver is the existing validator for a command form, and it runs offline.
    • Rejected: Snapshot test. A snapshot records the current text and does not check that the command tree accepts it.
    • Rejected: Manual check. A manual check does not fail CI when a form changes.
  • Where does the stage card go?: Append the rendered block to the system text that _ask passes to chat_structured, for the plan task only. The block is load_task_prompt("roadmap_stage_commands.md", command_card=card): the card's prompt text sits in that Markdown task file, as the Zero Inline Prompts Policy asks, and the generated rows are its context. The block never goes in the JSON prompt or a tool result. (best practice) [sources: docs/SDLC.md:132, src/devops_cli/roadmap/stage/stage_toolbox.py:162, src/devops_cli/roadmap/implement/implement_step.py:194, src/devops_cli/roadmap/stage/stage.py:2547]
    • Chosen: Markdown task file appended to the system text. The stage job already composes its system text from Markdown task files, and the card is a separate bounded block.
    • Rejected: Placeholder in roadmap_stage_change.md. It edits the long plan prompt and renders it with StrictUndefined, and the card is a block of its own.
    • Rejected: An inline Python string. The Zero Inline Prompts Policy forbids prompt text in Python.
    • Rejected: User turn or tool result. The user turn changes with the item, and a tool result is not stable and costs a call.
  • What token bound does the card use?: Use at most 400 tokens counted with count_tokens, which counts with the gpt-4o encoding (o200k_base). The first stage request counts about 34,000 tokens against the 192,000 limit and leaves at least 8,192 tokens for the tool answers, so 400 tokens is about 1.2% of the request and about 5% of that reserve. (best practice) [sources: src/devops_cli/ai/context_budget.py:90, src/devops_cli/config/defaults.py:454, docs/roadmap/stage.md:98, docs/roadmap/stage.md:107]
    • Chosen: 400 tokens of count_tokens. It keeps the stable system text small against the documented first request and its tool reserve, and the test counts it offline.
    • Rejected: No bound. The card grows with each row and crowds the stage prompt.
    • Rejected: Character bound. A character count does not match the model token budget that the stage window uses.
  • How does a change of the card reach the plan key?: Carry the rendered block on PlanFiles and pass it as prompt_version(self.toolset, context={"command_card": block}) in PlanFiles.key. prompt_version hashes the prompt texts and the context values, so a changed card gives a new plan key and a kept plan of an older card is not reused. (best practice) [sources: src/devops_cli/roadmap/stage/stage.py:1375, src/devops_cli/roadmap/stage/stage.py:1387, src/devops_cli/roadmap/stage/stage_plan_record.py:186, src/devops_cli/roadmap/stage/stage_plan_record.py:197]
    • Chosen: Card as a context value. prompt_version already takes a context mapping and hashes it, so no new key format is needed.
    • Rejected: Leave the card out of the version. A plan kept under the old card would be reused after a row or an option changes.
    • Rejected: Hash the card in a new file. The existing context parameter does the same with no new state.
  • Does the help of devops ci list the row names?: Yes. Since feat(ci): each check row is a devops ci command #5451 the --only and --skip help interpolates CHECK_ROW_NAMES, so devops ci --help names every row. The help still wraps and is not a bounded block of the accepted forms, so it is not the source of the card. [sources: src/devops_cli/commands/ci.py:1729, src/devops_cli/commands/ci.py:1737, tests/commands/test_ci_row_commands.py:199]
  • Does the card change the stage prompt, and what does the stage eval rule ask?: The card changes what the planner reads, so the pull request states the stage eval score before and after: uv run devops roadmap eval stage --limit <n> runs on the base and on the branch with the same model. The step shell holds no model key, so a person runs it and writes the Base eval score: and Head eval score: lines in the body. [sources: docs/ROADMAP_WORKFLOW.md:350, docs/ROADMAP_WORKFLOW.md:427]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#6521

Moved to new items

#6241

Activity

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

    @dan-petty
    OwnerAuthor
  3. added
    priority/p2-medium
    on Nov 13, 2026
  4. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

    Alternatives check: none

    Reason: The searches for a tool that turns a Typer/Click command tree into a short, prompt-ready command reference surfaced only documentation and completion generators: sphinx-click renders full Click command docs and shtab emits shell completion scripts, and neither applies the resolve_devops_argv / NOT_IN_RUNNER filters, the ~400-token cap or the line-by-line resolution test. The issue's own conclusion holds: the Typer command tree plus resolve_devops_argv is the source and the validator, so the card is project code rather than an existing tool; ADR 0025 already rejected cogapp for generated blocks, and its build-time file substitution does not fit a card assembled per run from the tree.

    Tool: none found

    Lacks:

    • No existing tool emits a short (<=400 token) block of command forms restricted to what resolve_devops_argv accepts and what runs in the runner image
    • No existing tool omits the devops ci lines for a target repository that has no devops ci
    • No existing tool resolves each generated line back against the command tree in a test

    Tools considered:

    Searches run:

    • shtab generate shell completion scripts from argparse click commands, results: 5
    • generate compact command reference from Typer CLI command tree for LLM prompt, results: 5
    • sphinx-click mkdocs-click generate CLI documentation from Click Typer command tree, results: 5
    • sphinx-click pypi click command line documentation generator, results: 5
    • shtab python package shell tab completion argparse, results: 5
    • typer-cli generate docs from Typer app deprecated, results: 5
    • click-man man page generator python package, results: 5
    • tool generates CLI cheat sheet JSON schema of commands for AI agent prompt, results: 5

    Sources:

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

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

    @devops-cli-service
    Contributor

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

    Moved to new items: #6241.

  7. 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.

  8. devops-cli-service commented on Nov 23, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: none, no tool. A person decides what the new result means for the item.

    Searches (8)

    Tools considered:

    Searches run:

    • generate documentation from Typer Click command tree, results: 5
    • click command tree to markdown reference compact, results: 5
    • sphinx-click Typer CLI documentation generator, results: 5
    • click-man generate man pages Click Typer, results: 5
    • "sphinx-click" pypi, results: 5
    • sphinx-click readthedocs click directive show-nested documentation, results: 5
    • python library render click typer commands as short reference text for LLM prompt, results: 5
    • sphinx-click github repository Click command documentation extension, results: 5

    Sources:

  9. added
    status/new
    and removed
    status/ready
    on Nov 27, 2026
  10. devops-cli-service commented on Nov 27, 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.

  11. dan-petty commented on Nov 30, 2026

    @dan-petty
    OwnerAuthor

    Triage under #6519 (owner instruction of 2026-11-30), before the hold #6521 closes. This item adds or extends a gate, refusal, screen, cap, limit, retry, result line, shell allowlist, tool catalog or plan-shape rule of the stage, implement or fix-checks job. #6519 found that 263 of about 900 issues in four weeks added such rules and none replaced the engine. Stage now runs on stock Coder (grade 60 on 30 graded attempts), where the agent reads the repository, runs the checks in its loop and has a real shell; implement follows (#6527). The code paths that this item names have also moved. If the failure class still shows in graded attempts, file a new item from that evidence. Closed as not planned; a person may reopen it.

  12. removed
    status/new
    on Nov 30, 2026
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/roadmapsource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions