Repository navigation
Description
Split from #4830.
The owner asked for persona selection from evidence with a measure that shows the selection improves the result (#4780). Issue #4830 builds the selector, the record and the counter, but it cannot measure improvement. Why deferred: the measure needs a chat measure and a fixed corpus to compare the selected lens with the generic prompt. Neither exists now, and the owner decision of 2026-11-11 keeps the devops ai chat default at architect until a chat measure exists. Acceptance criteria: - A command or score compares chat calls with the selected lens against the generic prompt on a fixed corpus. - The score records the lens, the rule id, the prompt_digest and the result of each call. - The score states whether the selection improves the result, against a stated threshold. - The default changes to auto only after the score shows improvement, as a separate owner decision.
Proposed design
Problem statement
The owner asked for persona selection from evidence (#4780). Issue #4830 builds the persona selector, its record and its counter, but nothing measures whether the selected lens improves an answer. This change adds devops ai chat-eval. It runs a fixed corpus with the selected lens and with the generic prompt, scores each call from expected facts, and writes the score to the run store. The default persona of devops ai chat stays architect.
Acceptance criteria
Requirement: Fixed corpus manifest
The measure SHALL read its fixed corpus and its threshold from one JSON manifest, and MUST refuse an item that lacks a required field.
Scenario: An item without expected facts
- WHEN a test loads a manifest whose item holds no expected facts
- THEN the loader raises an error that names the item and the missing field.
Requirement: Chat eval command
The ai command group SHALL provide a chat-eval command that runs each corpus item with the selected persona lens and with the generic prompt.
Scenario: Two prompt arms on the fixed corpus
- WHEN a test runs
devops ai chat-eval --corpus <fixture>with the model client and the lens selector stubbed - THEN the command exits 0 and writes one run record with one row for each corpus item and each prompt arm.
Requirement: Score row fields
Each score row SHALL record the prompt arm, the persona lens, the selector rule id, the chat prompt_digest and the pass or fail result of its call.
Scenario: Row facts
- WHEN a test reads the run record of the fixture run
- THEN each row holds the prompt arm, the persona lens, the selector rule id, the chat
prompt_digestand the pass or fail result of its call.
Requirement: Chat prompt digest
chat_prompt_digest SHALL hash the chat task prompt and the selected persona's role, and MUST NOT depend on review_prompt_digest.
Scenario: A persona edit moves the chat digest
- WHEN a test calls
chat_prompt_digestwith temporary task and persona directories, edits the architectrole.mdthere, and then editsreview_group_analysis.md - THEN the digest changes after the persona edit and does not change after the review prompt edit.
Requirement: Deterministic scoring
The score MUST mark each call pass or fail from the corpus item's expected facts and MUST NOT call a model judge.
Scenario: No model judge
- WHEN a test runs the measure on the fixed corpus with the model client stubbed and counts its calls
- THEN the stub receives one call for each corpus item and prompt arm, and every score row holds a pass or fail result.
Requirement: Improvement above the threshold
The score MUST state that the selection improves the result when the selected lens's pass rate exceeds the generic pass rate by more than the corpus threshold.
Scenario: Selected lens above the threshold
- WHEN a test runs the measure on a fixture whose selected-lens pass rate exceeds the generic pass rate by more than the threshold
- THEN the score states that the selection improves the result and gives the threshold.
Requirement: No improvement at the threshold
The score MUST state that the selection does not improve the result when the pass-rate difference is the corpus threshold or less.
Scenario: Selected lens at the threshold
- WHEN a test runs the measure on a fixture whose pass-rate difference equals the threshold
- THEN the score states that the selection does not improve the result.
Requirement: Default persona unchanged
The devops ai chat command MUST keep architect as its default persona in this change.
Scenario: Default persona
- WHEN a test reads the default of the persona option of
devops ai chat - THEN the default persona is
architect.
Existing Tool Considered
No alternatives check has run for this item. Inspect (https://github.com/UKGovernmentBEIS/inspect_ai) is the open, maintained eval framework of the UK AI Security Institute. It gives the fixed-corpus run, the two prompt variants, the per-item scorers and the eval log. It lacks the persona selector of #4830, the selector rule id, the chat prompt_digest, the corpus threshold policy and the devops ai chat client.
The proposal adds a solver and a scorer that call the project chat client and the selector. It adds the corpus, its threshold and the digest. Building the eval loop instead costs about 200k tokens and 3 days, and about 50k tokens a year to keep.
Key questions
- Which open, maintained tool covers a fixed-corpus measure of two prompt variants against a threshold?: Inspect AI covers the fixed-corpus run, the two prompt variants, the per-item scorers and the eval log. The proposal writes one solver that calls the chat client and the selector, one deterministic scorer, the corpus with its threshold, the lens adapter and the chat
prompt_digest. The project builds no eval loop and no generic scorer. (best practice) [sources: AGENTS.md]- Chosen: Inspect AI. Open and maintained by the UK AI Security Institute. It gives the eval loop, the prompt variants, the per-item scorers and the eval log. Rule 3 of AGENTS.md puts an open tool first.
- Rejected: Build the eval loop in the repository. It repeats the corpus runner, the scorers and the eval record that Inspect keeps.
- Rejected: Reuse the benchmark runner of the
aigroup. It scores answers with a rubric and a peer-grader model. It has no chat client, no lens selector and no pass-rate threshold.
- How does the measure score each chat call, and where does the threshold live?: Each corpus item carries the facts that its answer must hold. A deterministic checker marks each call pass or fail, and the score is the pass rate for each arm. The threshold is a field of the corpus manifest. The score states that the selection improves the result when the selected lens's pass rate exceeds the generic pass rate by more than the threshold. No model judge runs. (best practice) [sources: src/devops_cli/ai/review/defects.py:1354, src/devops_cli/roadmap/stage/stage_eval_score.py, docs/adr/0005-review-findings-come-from-tools-not-models.md]
- Chosen: Deterministic per-item check. It is reproducible offline and needs no judge model. The review corpus score and the stage score already count a fixed corpus from checked facts.
- Rejected: Model judge with a rubric. It is not reproducible and adds model cost and variance. ADR 0005 records ten runs of one input with 28 to 57 findings each.
- Rejected: Embedding similarity to a reference answer. It needs a model and a fixed embedder, and its score is hard to threshold.
- How does the chat score record the
prompt_digestand the lens?: The score is a run-storeRunRecord.setupholds the model, the sampling and the selector configuration.subjectholds the corpus digest.resultsholds one row for each call with the prompt arm, the lens, the selector rule id, the chatprompt_digestand the result.chat_prompt_digesthashes the chat task prompt and the selected persona's role. It does not reusereview_prompt_digest, which reads no persona file. (best practice) [sources: src/devops_cli/ai/run_store.py:80, src/devops_cli/ai/personas/init.py:69, openspec/specs/ai-review-profile/spec.md]- Chosen: Run-store record. Its
resultsholds one row for each call with the lens, the rule id, the digest and the result. Thedevops ai runscommands already read it. - Rejected: Review corpus score record.
CorpusScorecounts the injected review defects that a review found. Itsreview_prompt_digestreads no persona file, so it cannot record a chat lens. - Rejected: A new score format. It repeats the setup, subject and results of the run store and keeps two formats.
- Chosen: Run-store record. Its
- Which prompt is the generic prompt that the selected lens is compared with?: The generic arm is the chat task prompt with no persona role. The selected-lens arm adds the selected persona's role, as
chat_promptcomposes it. Both arms use the same model and sampling. (best practice) [sources: src/devops_cli/ai/personas/init.py:69, src/devops_cli/ai/tasks/chat.md]- Chosen: Chat task prompt without a persona. It isolates the lens: the only difference between the two arms is the persona role.
- Rejected: The default architect persona. It compares two lenses, not a lens with the generic prompt. The issue asks for the generic prompt.
- Rejected: The full system prompt with the context file. The context file is per-call input. It defines no generic baseline.
- Does the measure become a separate
devops ai chat-evalcommand or a mode ofdevops ai chat?: A separatedevops ai chat-evalcommand. The project gives each measure its own command and run record. A measure mode on the interactive chat command would mix a batch corpus run with a session and make the run record ambiguous. (best practice) [sources: src/devops_cli/commands/ai.py, src/devops_cli/ai/run_store.py:80]- Chosen: Separate
devops ai chat-evalcommand. The project gives each measure its own command and run record. A batch corpus run does not mix with an interactive session. - Rejected: Measure mode on
devops ai chat. It mixes a chat session with a batch corpus run and makes the run record ambiguous. - Rejected: Extend the review corpus score. It counts the injected review defects that a review found. It has no chat client, no lens selector and no pass-rate threshold.
- Chosen: Separate
- Does the
devops ai chatdefault persona change toautoin this change?: No. The owner decision of 2026-11-11 keeps the default atarchitectuntil a chat measure exists. The issue makes the switch a separate owner decision after the score shows improvement. This change supplies the measure and keeps the default. (best practice) [sources: src/devops_cli/commands/ai.py, src/devops_cli/ai/personas/init.py]- Chosen: Keep
architectin this change. The owner decision keeps the default until the measure shows improvement. The measure lands first, and the owner decides the switch after. - Rejected: Change the default to
autoin this change. It changes a product default before the evidence exists, against the owner decision.
- Chosen: Keep
- What form does the fixed corpus take, and where does the threshold live?: A JSON manifest in the package. Each item holds its prompt, its expected facts and its pass rule, and the manifest holds the threshold. A loader reads it into a frozen model and refuses an item that lacks a field. The command takes
--corpusfor a test fixture. (best practice) [sources: src/devops_cli/ai/tasks/chat.md, src/devops_cli/ai/personas/init.py]- Chosen: Packaged JSON manifest. It ships with the command and needs no new dependency. The project already ships data files inside the package, as the persona and task prompts show.
- Rejected: YAML manifest. It adds a parser dependency or a new loader for no gain over JSON.
- Rejected: Inline Python list. It mixes data with code and is harder to review and change.
- Where do the fixed-corpus items and their expected facts come from?: From the project documents that already hold checked facts, such as
CONTEXT.mdand the command reference. Each item names one question, the facts that a correct answer must hold, and the persona lens that the selector picks for it. The first corpus holds about 20 items. A person adds items in later changes. (best practice) [sources: CONTEXT.md, docs/CLI_REFERENCE.md, src/devops_cli/ai/tasks/chat.md]- Chosen: Items from the repository documents. The documents hold checked facts, so each item has a ground truth that a checker reads offline.
- Rejected: Items from a public benchmark dataset. It needs a network download and a licence review, and its facts are not the facts of this project.
- Rejected: Model-generated questions. They have no ground truth, so the checker cannot mark a call pass or fail.
Fit
Fits in one pull request.
Suspected block
None.
Activity
devops-cli-service commentedon Nov 15, 2026
Both items come from the persona selection request, but 4830 builds the selector and this item measures whether the selection improves the result.[-]feat(ai): measure the persona lens selection against the generic prompt[/-][+]feat(ai): Measure persona lens choice against generic prompt[/+]devops-cli-service commentedon Nov 15, 2026
The job shortened the title of this item. The summary had 61 characters, and the limit is 60. The type and the scope stay.
feat(ai): measure the persona lens selection against the generic promptfeat(ai): Measure persona lens choice against generic promptdevops-cli-service commentedon Nov 18, 2026
Owner question: Does the
devops ai chatdefault lens change toautoin this change? (a person decides)Options
Recommendation: Decide the question: only a person can answer it.
Evidence
devops-cli-service commentedon Nov 21, 2026
Owner question: See the first point of Open questions in the section Proposed design of the body.
Options
Recommendation: Decide the question: only a person can answer it.
Evidence
devops-cli-service commentedon Nov 22, 2026
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.
devops-cli-service commentedon Nov 25, 2026
Next step: the alternatives check records a verdict. See the section Proposed design of the body.