Skip to content

feat(roadmap): the implement shell and prompt use the preset #4645

Done

Description

@dan-petty

Problem or Motivation

  • src/devops_cli/roadmap/implement/implement_shell_policy.py:119-215 allows uv, ruff and mypy, and lists LOCAL_COMMANDS that are all uv run devops, in every repository.
  • The refusals point to uv run pytest.
  • The dotfiles runner log of 2026-11-01 shows uv run bash tests/test_tmux_conf.sh ... program uv, ok. So the agent used uv to get around the refusal of other programs.
  • roadmap_implement_step.md:45 names "ruff, the ast-grep rules of src and tests, and the OpenSpec gate" for every target, but the job runs the hooks of the target.

Proposed Solution & Architectural Design

  • The shell policy keeps the base set (git and the read tools) and the refusal logic in code.
  • The preset adds its programs, local commands and refusal texts. devops-cli: the current tables. neutral: devops and openspec from the image, and no uv, ruff or mypy.
  • A preset only selects from RUNNER_TOOLS. A test fails when a preset names a program that NOT_IN_RUNNER lists.
  • The implement prompt renders the 3 tables and a hooks sentence through feat(ai): the prompt loader renders Jinja with project values #4633. The hooks sentence lists the hook ids of the trusted .pre-commit-config.yaml, or says that there are none.
  • The pull request has a security section, because the allowlist is a security surface (SECURITY.md item 6).

Target Subsystem

SDLC, Git & PR Governance (src/devops_cli/roadmap/implement/implement_shell_policy.py).

Existing Tool Considered

The shell policy and the bubblewrap sandbox stay. No tool gives an allowlist from a toolchain, so the preset data feeds the existing policy. Cost: about 80 lines, 20 prompt tests move, about 300,000 tokens and 4 hours to build, about 5,000 tokens a month to keep.

Acceptance Criteria

  • A test: the devops-cli preset gives the same allowed and refused decisions as today for each case in the current 22 shell-policy test files.
  • A test: with the neutral preset, uv run bash x.sh is refused and git grep foo is allowed.
  • A test: every program of every preset is in RUNNER_TOOLS and not in NOT_IN_RUNNER.
  • A test: the rendered prompt for a repository with no hooks does not contain "ruff" or "ast-grep".
  • The pull request has a security section.

Dependencies

#4633 and #4635.

Source: #4627

Alternatives check of 2026-11-26: partly.
Tool: nickderobertis/allowlister (https://github.com/nickderobertis/allowlister), MIT, last activity 2026-11-13, maintained.
Reason: Searches found allowlister, a Rust CLI that decides allow, deny, ask or defer for one shell command from one per-project config, with argv matching and read-only and repo-write profiles. It covers only the allowlist half, with no toolchain preset, refusal texts or prompt rendering.

Covers:

  • Per-project config with argv, glob and regex rules
  • Allow, deny, ask and defer verdicts
  • Recommended read-only and repo-write profiles

Lacks:

  • No toolchain preset sourced from RUNNER_TOOLS
  • No refusal texts naming the command to run instead
  • No rendering of preset tables or trusted hook ids
  • Enforces through agent harness hooks, not the runner sandbox

Proposed design

Problem statement

The prompt work can proceed now. The shell tables cannot: #6527 deleted implement_shell_policy.py, and #6521 decides whether the allowlist returns. The implement prompt does not name the trusted pre-commit hook ids that the job runs. The agent cannot see which hooks will run before the push.

Acceptance criteria

Requirement: The prompt lists the trusted hook ids

The implement prompt SHALL list the ids of the hooks of the trusted .pre-commit-config.yaml at the base commit in one sentence.

Scenario: The prompt names the ruff hook of the trusted config

  • WHEN the prompt renders for a repository whose trusted .pre-commit-config.yaml holds the ruff-check hook
  • THEN the rendered prompt holds ruff-check

Requirement: A repository with no hooks says so

The implement prompt MUST say that there are no hooks when the trusted .pre-commit-config.yaml at the base commit holds no hook.

Scenario: The prompt of a repository with no hooks names no tool

  • WHEN the prompt renders for a repository whose trusted .pre-commit-config.yaml holds no hooks
  • THEN the rendered prompt holds no ruff and no ast-grep and says that there are no hooks

Requirement: A hook the image cannot run is left out

The hooks sentence SHALL name only the hooks that the job runs, so it MUST leave out each hook of HOOK_PROGRAMS whose program the image lacks.

Scenario: A hook whose program is missing is left out

  • WHEN the trusted config holds a hook of HOOK_PROGRAMS whose program is not on PATH
  • THEN the rendered prompt does not name that hook id

Requirement: The hook ids come from the base commit

The hook ids MUST come from the trusted .pre-commit-config.yaml at the base commit, not from the .pre-commit-config.yaml of the checkout.

Scenario: A checkout edit cannot change the sentence

  • WHEN the checkout's .pre-commit-config.yaml lists a hook that the base commit does not hold
  • THEN the rendered prompt names only the hooks of the base commit

Existing Tool Considered

The alternatives check of 2026-11-26 in the issue body gives the verdict partly for nickderobertis/allowlister (MIT, last activity 2026-11-13, maintained). The block's Covers: and Lacks: lists state what the tool covers and lacks. It does not render a hooks sentence, so this plan builds that sentence in implement_step.py and implement_hooks.py: about 40 lines and four prompt tests, about 80,000 tokens and 1.5 hours to build, about 20,000 tokens and 2 hours to fix, and about 1,000 tokens a month to keep.

Key questions

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Moved to new items

#7685

Activity

  1. added
    source/agent
    on Nov 11, 2026
  2. added
    type/feature
    scope/roadmap
    status/new
    value/medium
    effort/medium
    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 parameterises existing behaviour and has no user-facing breakage, so it is not urgent but is planned work.
    • Value: Medium. It lets the same runner serve different toolchains without code changes, which is useful but not critical.
    • Effort: Medium. The body estimates about 80 lines of code and 20 prompt tests to move, which is moderate work.
    • Related: feat(runner): the runner image carries every development tool, and the shell policy is one table #3072, which asks for a different change. Both shape the implement shell policy table, but #3072 unifies it into one table in the runner image while this candidate parameterises that table by preset.
  4. added
    priority/p2-medium
    on Nov 11, 2026
  5. devops-cli-service commented on Nov 13, 2026

    @devops-cli-service
    Contributor

    Alternatives check: partly

    Reason: The searches found allowlister, a Rust CLI that keeps one per-project allowlist and decides allow/deny/ask/defer for the shell commands an agent proposes, which overlaps the allow/refuse decision the issue wants to parameterise. It does not derive programs from a toolchain preset, emit refusal texts, or render the preset tables and hooks sentence into the implement prompt, so most of the issue's work is still needed.

    Tool: nickderobertis/allowlister (https://github.com/nickderobertis/allowlister)

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

    Covers:

    • One config file per project (auto-merged with a user config) that decides allow, deny, ask or defer for each shell command an agent proposes
    • Role-aware, argv/whole-command matching rather than string prefixes, so a composed command such as uv run bash x.sh is judged as a whole
    • Recommended profiles such as read-only and repo-write that give a base set of read tools and git

    Lacks:

    • No preset or toolchain concept: the program list is hand-written in the config, not selected from a set like RUNNER_TOOLS, and nothing checks a preset against NOT_IN_RUNNER
    • No refusal texts to return to the agent when a command is refused
    • No rendering of allowed programs, local commands, refusal texts or the trusted pre-commit hook ids into the implement prompt
    • Enforces through a harness hook or config of other agents (Claude Code, Cursor, Copilot CLI, Codex, ...) rather than inside the project's own sandboxed runner, so the existing shell policy and its 22 test files would not stay as the issue requires

    Tools considered:

    Searches run:

    • shell command allowlist policy for AI coding agent per toolchain, results: 5
    • open source tool generates command allowlist from toolchain configuration, results: 5
    • render pre-commit hook ids into agent prompt instructions tool, 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. 2 remaining items

  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 and Watched files in the section Proposed design of the body.

  12. added
    status/ready
    and removed
    status/new
    on Nov 29, 2026
  13. devops-cli-service commented on Nov 29, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See Moved to new items in the section Proposed design of the body.

  14. added
    status/in-progress
    and removed
    status/ready
    on Nov 29, 2026
  15. added
    status/in-review
    and removed
    status/in-progress
    on Nov 29, 2026
  16. removed
    status/in-review
    on Nov 29, 2026
  17. devops-cli-service commented on Nov 29, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-29 16:50 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/roadmapsource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions