Skip to content

feat(roadmap): Give the implement agent read-only code tools #3148

Closed

Description

@dan-petty

What happened

The Service runs on the claim that the repository's own tooling makes code work verified. But the tools the implement agent and the stage planner get are fewer than the tools of the devcontainer:

  • The stage job gives the planner the issue and a list of tracked file names, and no tool to read code (the toolbox of feat(roadmap): the stage job plans with a read-only investigation toolbox #3037 is planned and not built). Blind judges scored the first-reply plans of 7 models, 1 local and 6 hosted, between 1.4 and 2.2 of 5 on the 40-case golden set (tests/fixtures/roadmap_eval/stage). Their findings repeat: a path that does not exist at the base commit, a field that already exists, a command that was never run.
  • The implement agent has file read, search, write and edit tools, and a shell that runs a table of programs. git grep over src/devops_cli/roadmap/implement_*.py and stage*.py finds no use of the AST graph, the repository map, the RAG index of the knowledge base, ai_read, or devops review. The devops MCP server (ai_ast_graph, ai_repomap, ai_rag_query, ai_pack_context, review_path) exists and a person in the devcontainer has it; the Job has none of it.

What should happen

The Job gives its agents the same code-intelligence tools that a person has, read-only where the job should not write:

  1. Stage planner: the toolbox of feat(roadmap): the stage job plans with a read-only investigation toolbox #3037, built on the AST graph and the repository map.
  2. Implement agent: read-only tools for the AST graph (callers and callees of a symbol), the repository map, and the RAG index of the project documents, through the existing code and not through a second implementation. Prefer the existing MCP server tools over new tool code (AGENTS.md rule 3).
  3. A measure for each: devops roadmap eval stage and eval implement before and after, on the same fixtures.

Acceptance criteria

  • The implement step lists the tools it offers, and the PR comment of a Job shows which tool calls it made.
  • devops roadmap eval implement states its score with and without the tools on the same fixtures.
  • A tool that the agent has cannot write a file or reach the network.

Alternatives check of 2026-11-05: partly.
Tool: modelcontextprotocol/python-sdk (https://github.com/modelcontextprotocol/python-sdk), MIT, last activity 2026-11-03, maintained.

Proposed design

Problem statement

The implement step's agent reads and edits code with fewer code-intelligence reads than a person in the devcontainer, and nothing states which tools it has. The step already reads its own checkout with read_file, list_files, grep, run_command, uv run devops ai ast graph and uv run devops ai repomap, but the prompt lists those tools only in prose, the Job log has no test that a remote MCP tool call is recorded, and devops roadmap eval implement cannot score the step without its remote tools. The RAG index of the project documents stays out until a scoped credential exists (#3563).

Acceptance criteria

Requirement: Implement tool list

The implement step SHALL list the tools it offers in its prompt, taken from the one registry that tool_names(HOLDER_IMPLEMENT) returns.

Scenario: The prompt holds the registry names

  • WHEN a test builds the step prompt with the MCP switch off
  • THEN the prompt holds each name that tool_names(HOLDER_IMPLEMENT) gives and holds no tool name that the registry lacks

Requirement: Remote tool call in the Job log

The implement step SHALL write one line to the Job log for each remote MCP tool call, with the tool name and the outcome and no argument.

Scenario: A remote call is logged

  • WHEN the step runs against the in-process fake MCP server and the agent calls pr_describe once
  • THEN the standard error stream holds the line Tool call: pr_describe, ok. and holds neither the issue number nor any other argument

Requirement: Code intelligence through the existing commands

The implement step MUST reach the AST graph and the repository map through the existing devops ai ast graph and devops ai repomap commands and MUST add no second code-intelligence implementation.

Scenario: The read forms of the AST graph and the map

  • WHEN a test reads LOCAL_COMMANDS and the modules under src/devops_cli/roadmap/implement/
  • THEN the table holds ai repomap and the printed form ai ast graph with no --output, and no module of that folder imports devops_cli.ai.repomap or devops_cli.ai.ast.graph

Requirement: Implementation role holds no write or path tool

The implementation role MUST offer only tools that the exposure table marks read-only and MUST NOT offer a tool that takes a file path.

Scenario: A write tool and a path tool are dropped

  • WHEN a test calls tools_for_role("implementation", catalogue) with a catalogue that holds a write tool and a tool with a path parameter
  • THEN neither tool is in the returned list, and no returned name has an entry in PATH_CONFINEMENTS

Requirement: Eval implement measures both tool modes

devops roadmap eval implement SHALL accept --no-tools, which runs the same selected fixtures with the step's remote MCP tools off, and SHALL record the tool mode in its report.

Scenario: One fixture set in both modes

  • WHEN a test runs devops roadmap eval implement --dry-run and --dry-run --no-tools on one fixture
  • THEN both runs name the same fixture and base commit, and a run report holds the tool mode in a field beside the model

Existing Tool Considered

The alternatives check names modelcontextprotocol/python-sdk (MIT, last activity 2026-11-03, maintained). The project already reaches the devops MCP server through pydantic_ai.mcp.MCPToolset in RoadmapMcpToolset (src/devops_cli/roadmap/mcp.py:55), which the spec requires (openspec/specs/roadmap-mcp-client/spec.md:16); the SDK is its transport and gives list_tools() and call_tool(). It lacks a read-only guarantee: it is a client, so the server's role table (src/devops_cli/ai/mcp/roles.py:100) and path confinement (src/devops_cli/ai/mcp/path_confinement.py:23) enforce that. It holds no code-intelligence implementation of its own: the AST graph and the repository map come from the existing devops ai ast graph and devops ai repomap commands in the job's own checkout, because on the server a path is a path of the server (src/devops_cli/ai/mcp/roles.py:8). It has no devops roadmap eval implement tool-mode score, no list of the implement step's tools, and no record of the step's tool calls; the Job log and the eval are the project's own code.

Key questions

  • Which MCP client connects the implement agent to the existing devops MCP server?: The step already uses RoadmapMcpToolset, a pydantic_ai.mcp.MCPToolset over streamable HTTP, built by build_roadmap_mcp_toolset(ROLE_IMPLEMENTATION); the spec requires the pydantic-ai MCP client. No new client is needed. [sources: src/devops_cli/roadmap/mcp.py:55, src/devops_cli/roadmap/mcp.py:145, src/devops_cli/roadmap/implement/implement_step.py:1951, openspec/specs/roadmap-mcp-client/spec.md:16]
  • Which code-intelligence tools does the implement agent get, and from where?: The AST graph and the repository map come from the existing uv run devops ai ast graph (printed, no --output) and uv run devops ai repomap commands in the step's shell, beside the harness reads read_file, list_files and grep. They do not come from the MCP server: its role tables name only tools that need nothing from the files of the job, because on the server a path is the server's tree, and a stage tool reads the path of the job's checkout. The RAG index waits on feat(roadmap): allow scoped review and RAG calls from the implement shell #3563. (best practice) [sources: docs/ROADMAP_WORKFLOW.md:295, docs/ROADMAP_WORKFLOW.md:300, docs/ROADMAP_WORKFLOW.md:301, src/devops_cli/roadmap/implement/implement_shell_policy.py:164, src/devops_cli/ai/mcp/roles.py:8, openspec/changes/3244-add-toolsets-for-implement-and-review/proposal.md:45]
    • Chosen: The existing devops ai commands in the step's shell. They run on the job's checkout at HEAD, including the agent's uncommitted edits, they are the code the devcontainer uses, and the recorded rule keeps path tools off a network role.
    • Rejected: The MCP role's ai_ast_graph, ai_repomap and ai_rag_query. The server would read its own tree, not the job's checkout; the role tables deliberately name no path tool, and the RAG query needs a scoped credential (feat(roadmap): allow scoped review and RAG calls from the implement shell #3563).
    • Rejected: New in-process AST graph and repository map tools in the implement step. It is a second implementation of code the project already ships, which AGENTS.md rule 3 and the issue forbid.
  • How does the change keep an offered tool read-only?: The server's role table keeps only tools that the exposure table marks read-only and names no path tool, and path confinement refuses a value outside the work tree. In the job, the harness file tools resolve under the workspace. The shell is not the guarantee: the project states that the shell is no security boundary and that the runner is the sandbox, and LOCAL_COMMANDS is prompt text that the shell does not read. (best practice) [sources: src/devops_cli/ai/mcp/roles.py:100, src/devops_cli/ai/mcp/path_confinement.py:23, src/devops_cli/roadmap/implement/implement_step.py:663, openspec/specs/roadmap-implement-step/shell/spec.md:9, src/devops_cli/roadmap/implement/implement_shell_policy.py:10]
    • Chosen: Server role table and path confinement, plus the workspace root of the file tools. The server holds the tool metadata and the path rules, a caller cannot bypass them, and the step's file tools are confined to the checkout.
    • Rejected: Client-side filter of the tool list only. A caller can bypass the filter, and the MCP SDK gives no read-only guarantee.
    • Rejected: The access class of the shell's local-command table. The table is prompt text and the shell does not read it, so it cannot enforce a read.
    • Rejected: A runner network policy only. It stops a network call but not a file write.
  • Where does the Job record the tool calls that the implement agent makes?: In the Job log: ToolCallLog writes one line to the standard error stream for each tool call, with the tool name, the program of a shell command and the outcome, and it writes no argument, path or file content, because an argument can hold a secret. The step's outcome and its comment carry the counts, not the arguments, so the PR comment is not the record. [sources: src/devops_cli/roadmap/implement/implement_tool_log.py:4, src/devops_cli/roadmap/implement/implement_tool_log.py:8, openspec/specs/roadmap-implement-step/trace/spec.md:88, openspec/specs/roadmap-implement-step/trace/spec.md:9]
  • How does devops roadmap eval implement compare tool modes?: With a --no-tools option that mirrors --no-toolbox of devops roadmap eval stage: a person runs the same model on the same selected fixtures twice and states both scores, and the report records the tool mode so the two reports compare. The command has no such option today. (best practice) [sources: docs/ROADMAP_WORKFLOW.md:332, docs/ROADMAP_WORKFLOW.md:341, docs/CLI_REFERENCE.md:7155, docs/CLI_REFERENCE.md:7159, src/devops_cli/commands/roadmap_eval_implement.py:103, openspec/specs/roadmap-eval-implement/spec.md:4]
    • Chosen: A --no-tools option, two runs of one model on the same set. It mirrors the stage eval's --no-toolbox, keeps the fixture set and the scoring path the same, and leaves the model spend to the person who runs it.
    • Rejected: One invocation that runs both modes. It doubles the model spend with no person's choice and departs from the command the stage eval already uses.
    • Rejected: Two separate commands. A person can compare runs on different fixtures, and nothing states the mode.
    • Rejected: A single score with the tools on. It does not state the effect of the tools.
  • Does the stage planner still need a read-only code toolbox (feat(roadmap): the stage job plans with a read-only investigation toolbox #3037)?: No. The toolbox is built: StageTools holds the nine tools of base and the three of extended, including file_symbols, callers and repo_map, ToolboxClient runs them, and devops roadmap eval stage --no-toolbox compares the score with and without them. The proposal's deferred item for it is dropped, not refiled. [sources: src/devops_cli/roadmap/stage/stage_tools.py:1, src/devops_cli/roadmap/stage/stage_toolbox.py:1, src/devops_cli/roadmap/tools.py:79, docs/ROADMAP_WORKFLOW.md:332, docs/ROADMAP_WORKFLOW.md:337]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#3563

Activity

  1. added
    source/agent
    type/feature
    scope/roadmap
    status/new
    value/medium
    effort/medium
    on Nov 2, 2026
  2. dan-petty commented on Nov 2, 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 improves plan and implementation quality scored 1.4 to 2.2 of 5, but the tools already exist and the gap is wiring, not a broken feature.
    • Value: Medium. Blind-judged plans score below 2.2 of 5 without these tools, so adding them raises the quality of automated roadmap work.
    • Effort: Medium. The MCP server and code-intelligence backends exist; the work is exposing them to two agents and adding two eval commands on existing fixtures.
    • Related: feat(roadmap): the implement agent can use the project's development tools #3041, which asks for a different change. Both give the implement agent access to the AST graph, repomap, and RAG tools, but #3041 adds devops ci, review, and a full tool catalog with budgets, while the candidate adds the stage planner toolbox and eval score measures.
  3. added
    priority/p2-medium
    on Nov 2, 2026
  4. devops-cli-service commented on Nov 2, 2026

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at ac16675 until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.

    • The proposal has no problem statement, no acceptance criterion with its requirement, scenario, WHEN and THEN, or no answer to the existing-tool question. State the problem, the requirements with their scenarios, and the open tool that covers the need or the cost of building it.
  5. devops-cli-service commented on Nov 5, 2026

    @devops-cli-service
    Contributor

    Alternatives check: partly

    Tool: modelcontextprotocol/python-sdk (https://github.com/modelcontextprotocol/python-sdk)

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

    Covers:

    • An MCP client that connects to an already running MCP server and lists its tools, so the agents can reach the existing devops MCP server (ai_ast_graph, ai_repomap, ai_rag_query, ai_pack_context, review_path) instead of a second implementation.
    • Building the model's tool list from the server's list_tools() response and dispatching call_tool(), which is the wiring the implement agent and stage planner need.
    • Because the caller builds that list itself, it can pass only a chosen read-only subset of the server's tools to the agent.

    Lacks:

    • No read-only guarantee: the SDK is a transport/client and does not stop a tool from writing a file or reaching the network; that must be enforced by the server or by the project's tool allowlist.
    • No code-intelligence implementation of its own: the AST graph with callers/callees, the repository map and the RAG index must already exist on the devops server.
    • No devops roadmap eval implement score, no before/after measurement on the golden fixtures, and no stage-planner toolbox (the feat(roadmap): the stage job plans with a read-only investigation toolbox #3037 work).
    • No PR-comment record of which tool calls a Job made, and no tool-offering listing in the implement step.

    Searches run:

    • MCP server read-only code intelligence AST graph callers callees repository map
    • open source code graph RAG MCP server for AI coding agents
    • MCP Python SDK client list_tools call_tool connect existing MCP server
    • Serena MCP read-only tools find_referencing_symbols get_symbols_overview project index

    Sources:

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

  6. changed the title [-]feat(roadmap): the implement agent gets the read-only code-intelligence tools of devops[/-] [+]feat(roadmap): Give the implement agent read-only code tools[/+] on Nov 6, 2026
  7. dan-petty commented on Nov 6, 2026

    @dan-petty
    OwnerAuthor

    The job shortened the title of this item. The summary had 72 characters, and the limit is 60. The type and the scope stay.

    • Before: feat(roadmap): the implement agent gets the read-only code-intelligence tools of devops
    • After: feat(roadmap): Give the implement agent read-only code tools
    • Source of the summary: the background model
  8. added
    status/ready
    and removed
    status/new
    on Nov 12, 2026
  9. devops-cli-service commented on Nov 12, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 2c0fe36 (see proposed design in issue body).

    Moved to new items: #5190.

  10. 6 remaining items

  11. added a commit that references this issue on Nov 14, 2026
  12. added
    status/planned
    and removed
    status/ready
    on Nov 14, 2026
  13. added
    owner/agent
    status/in-progress
    and removed
    status/planned
    on Nov 19, 2026
  14. added
    status/in-review
    and removed
    status/in-progress
    on Nov 19, 2026
  15. removed
    status/in-review
    owner/agent
    on Nov 19, 2026
  16. devops-cli-service commented on Nov 19, 2026

    @devops-cli-service
    Contributor
  17. devops-cli-service commented on Nov 19, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-19 12:49 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