Skip to content

feat(roadmap): Let the implement step read the RAG index #5190

Not planned

Description

@devops-cli-service

Split from #3148.

The implement agent cannot query the RAG index of the project documents, so it finds a document by path or text only. The shell of the step holds no key, and a RAG query needs a scoped credential: the shell table leaves devops ai rag-query out and names #3563, which holds the scoped credential for it. This issue waits on #3563, so the rest of #3148 proceeds without it. Acceptance criteria: the implement step offers a read-only RAG query that takes no write path and reaches only the project's RAG service. The tool comes from the existing devops ai rag-query command and adds no second index implementation. The command is in LOCAL_COMMANDS only after a scoped credential exists, and a test asserts that the step holds no key. A change to the tool set states the devops roadmap eval implement score with and without it on the same fixtures.

Dependencies

Proposed design

Problem statement

The implement step cannot query the RAG index of the project documents: its shell holds no service key, and the runner pod holds no Qdrant key. The existing devops ai rag query command can query the index, but it calls ensure_knowledge_base_ready, which can rebuild the collection and so attempts a write. The step's shell is now the stock Coder shell with no LOCAL_COMMANDS table, so the change adds a --read-only mode to the one command and names uv run devops ai rag query --read-only in the step prompt as the one remote read. It waits on #3563 for the scoped credential and adds no second index and no service key.

Acceptance criteria

Requirement: The query command offers a read-only mode

The query command of the rag group MUST accept --read-only and MUST call ensure_knowledge_base_ready only when the option is absent.

Scenario: Read-only mode skips the knowledge-base sync

  • WHEN A test runs devops ai rag query --read-only "database" against a fake Qdrant client and a fake embedder whose knowledge-base digest differs from the installed one.
  • THEN The fake records no upsert and no delete, and the command prints the matches of the query.

Requirement: The step prompt names the read-only RAG query

The rendered instructions of the implement step SHALL name uv run devops ai rag query --read-only as the one remote read that the step broker serves and SHALL keep the rule that the shell holds no service key.

Scenario: The rendered step instructions name the read-only query

  • WHEN A test in tests/roadmap/implement/test_roadmap_implement_prompt.py calls step_instructions() and searches the rendered text for the read-only RAG query.
  • THEN The text holds uv run devops ai rag query --read-only and the sentence that the shell holds no service key.

Requirement: The implement step adds no second RAG client

Each module under src/devops_cli/roadmap/implement/ MUST NOT import devops_cli.ai.rag and MUST NOT import qdrant_client.

Scenario: The implement package imports no RAG client

  • WHEN A test parses each module under src/devops_cli/roadmap/implement/ and lists its imports.
  • THEN The list holds no import of devops_cli.ai.rag and no import of qdrant_client.

Requirement: The implement shell holds no service key

shell_environment MUST hold no DEVOPS_CLI_QDRANT_API_KEY and no DEVOPS_CLI_AI_API_KEY, and the change SHALL add no service key to it.

Scenario: The shell environment holds no service key

  • WHEN A test calls shell_environment(tmp_path / "home", tmp_path / "source") while DEVOPS_CLI_QDRANT_API_KEY and DEVOPS_CLI_AI_API_KEY are set in the process environment.
  • THEN The returned mapping holds neither key and no DEVOPS_CLI_*_API_KEY.

Requirement: The tool-set change states the implement eval score

The change MUST state the devops roadmap eval implement score of the base commit and of the branch, measured with the same model and the same fixtures.

Scenario: The base and the branch use the same model and fixtures

  • WHEN The author runs uv run devops roadmap eval implement --model <group> -F <fixture> on the base commit and again on the branch.
  • THEN Both reports name the same model and the same fixtures and print the totals of properties passed.

Existing Tool Considered

No alternatives check has run on this issue. The open, maintained qdrant-client (1.20.0, pyproject.toml:28) backs the project's own devops ai rag query command (src/devops_cli/commands/rag.py:288), which covers the index query and keeps one index implementation. That command lacks a read-only mode: it calls ensure_knowledge_base_ready (src/devops_cli/commands/rag.py:364, src/devops_cli/ai/rag/kb_sync.py:183), which can rebuild the knowledge-base collection. It also lacks the scoped credential of #3563 that lets it run from the step's shell, whose environment holds no service key (src/devops_cli/roadmap/implement/implement_shell.py:28). The change adds --read-only to the existing command and names it in the step prompt; it adds no second index and builds no RAG client of its own. The added code is small: one option, one guard, one prompt sentence and their tests, about 30 lines, about 5k tokens to build and 1 hour, and it needs no new dependency.

Key questions

  • Which existing command queries the RAG index?: The query command of the rag group, devops ai rag query (alias devops ai rag search), queries the index. It is built on qdrant-client. The body writes the group and the command of devops ai rag-query as one word. [sources: src/devops_cli/commands/rag.py:288, pyproject.toml:28]
  • Does devops ai rag query change the index?: Yes. The command calls ensure_knowledge_base_ready before the search (src/devops_cli/commands/rag.py:364 and :376). That function syncs the knowledge-base collection and can rebuild it (src/devops_cli/ai/rag/kb_sync.py:183), so the query takes a write path. [sources: src/devops_cli/commands/rag.py:364, src/devops_cli/commands/rag.py:376, src/devops_cli/ai/rag/kb_sync.py:183]
  • How does the read-only query take no write path?: Add a --read-only option to devops ai rag query. The option skips ensure_knowledge_base_ready, so the command goes from the retriever to SemanticRetriever.search and sends no upsert and no delete. (best practice) [sources: src/devops_cli/commands/rag.py:364, src/devops_cli/ai/rag/kb_sync.py:183, docs/adr/0018-a-sandboxed-read-only-run-tool-for-the-planner.md]
    • Chosen: Add --read-only to the existing command. It makes the read-only contract explicit and keeps the one index implementation.
    • Rejected: Rely on a read-only Qdrant key alone. The runner pod holds no Qdrant key (k8s/README.md:287), and the command would still attempt the rebuild and spend the embedding work first.
    • Rejected: Build a second query client in the step. It copies the index path and needs the same credential in the shell.
  • How should the implement step reach the RAG index?: Run the existing command as uv run devops ai rag query --read-only through the step's stock shell, and name it in the step prompt as the one remote read. The LOCAL_COMMANDS table and its access classes are gone: the step moved to the stock Coder shell (refactor(roadmap): run implement on stock Coder with a real shell #6527), which passes no allowed command and no denied command, so there is no row to add. (best practice) [sources: src/devops_cli/roadmap/implement/implement_shell.py:59, src/devops_cli/roadmap/implement/implement_shell.py:67, src/devops_cli/ai/tasks/roadmap_implement_step.md:47, src/devops_cli/commands/rag.py:288, openspec/changes/archive/2026-11-24-6527-run-implement-on-stock-coder-with/tasks.md:10]
    • Chosen: Run the existing command from the stock shell and name it in the prompt. It reuses the one RAG query and its index, and the shell no longer has a command table.
    • Rejected: Add a LOCAL_COMMANDS row. The table and its module were removed with the stock shell (refactor(roadmap): run implement on stock Coder with a real shell #6527), so no row exists to add.
    • Rejected: Build an in-process RAG client in the step. It duplicates the index code and needs a key in the shell.
  • Which access class does the RAG query row take?: None. The LOCAL_COMMANDS table and the ShellAccess class no longer exist: the step's shell is the stock Shell with allowed_commands=[] and denied_commands=[], so the step classifies no command, and the prompt names the one remote read instead. [sources: src/devops_cli/roadmap/implement/implement_shell.py:59, src/devops_cli/roadmap/implement/implement_shell.py:67, src/devops_cli/ai/tasks/roadmap_implement_step.md:47, openspec/changes/archive/2026-11-24-6527-run-implement-on-stock-coder-with/tasks.md:10]
  • Which credential may the implement step use for the RAG query?: The scoped credential of feat(roadmap): allow scoped review and RAG calls from the implement shell #3563 only. shell_environment holds no service key, the runner pod holds no Qdrant key, and the step broker mints only a per-step token for the model and embedding endpoints and adds the AI key upstream. The change adds no Qdrant or AI key to the shell. (best practice) [sources: src/devops_cli/roadmap/implement/implement_shell.py:28, src/devops_cli/roadmap/implement/implement_broker.py:53, docs/CLUSTER.md:92, k8s/README.md:287, openspec/specs/qdrant-read-only-key/spec.md:22]
    • Chosen: The scoped credential of feat(roadmap): allow scoped review and RAG calls from the implement shell #3563. It is the named credential for the query, and the shell holds no service key.
    • Rejected: The runner's Qdrant key in shell_environment. The runner pod holds no Qdrant key, and a key in the shell gives every command the key.
    • Rejected: No credential. Qdrant needs its key on every read request (k8s/README.md:287), so the query is refused.
  • When may the step run the read-only RAG query?: Only after feat(roadmap): allow scoped review and RAG calls from the implement shell #3563 supplies the scoped credential. Until then the prompt keeps its rule that the shell runs no command that calls a remote service, and this issue waits on feat(roadmap): allow scoped review and RAG calls from the implement shell #3563. (best practice) [sources: src/devops_cli/ai/tasks/roadmap_implement_step.md:47, src/devops_cli/roadmap/implement/implement_shell.py:28, k8s/README.md:287]
  • How should the change show the effect on the tool set?: Run devops roadmap eval implement on the base commit and on the branch with the same model and the same fixtures, and state both totals of properties passed. (best practice) [sources: docs/ROADMAP_WORKFLOW.md:453, docs/commands/roadmap.md:470]
    • Chosen: Run the eval on the base and on the branch. The project asks for this comparison for a change to the implement prompt or tool set, and one model and one fixture set keep the scoring path the same.
    • Rejected: Add an eval flag that turns the RAG query off. It adds an option for a one-off measurement.
    • Rejected: Run no eval. It hides the effect of the change and breaks the project's merge rule.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#3563, #6521

Activity

  1. added
    source/agent
    type/feature
    scope/roadmap
    status/new
    value/medium
    effort/medium
    on Nov 12, 2026
  2. devops-cli-service commented on Nov 12, 2026

    @devops-cli-service
    ContributorAuthor
  3. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    ContributorAuthor

    Waiting for the alternatives check to run. The next refine round looks at the item again after the check records a verdict.

  4. dan-petty commented on Nov 20, 2026

    @dan-petty
    Owner

    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.

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

    @devops-cli-service
    ContributorAuthor

    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.

  6. dan-petty commented on Nov 30, 2026

    @dan-petty
    Owner

    Premise check after the release of the hold #6521 (2026-11-30): it waits on #3563 (scoped Qdrant credential), which closed as not planned on 2026-11-06; the implement shell is a stock Shell with no Qdrant key. Closed as not planned (AGENTS.md rule 2); a person may reopen it, or file a new item from fresh evidence.

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