Repository navigation
Description
Problem or Motivation
collect_context (src/devops_cli/roadmap/refine/refine.py:966-973) puts the first 5 files of docs/adr in name order into the context of every stage, fix-plan and refine item:
- The five files are ADR 0001-0005, about 4.8k o200k tokens. With
CONTEXT.md(5.4k) they use about 10.3k of the 20,480 cap of the stage context (51%). - They come before the item content, and the cap cuts from the end. In the stage comment sample, 47 of 54 items are at the cap, and 131 of 323 cited files survive it.
- ADR 0002 and ADR 0003 are superseded, but they are in every context. The ADRs that replace them are not.
- devops-cli has 25 ADRs, and 21 are in force. A one-line index (number and title) of the 21 is about 418 tokens.
- The planner reads files of
docs/adrwith a tool in 5 of 54 items. - feat(roadmap): planners and implement read the target AGENTS.md #4650 says that the selection of ADRs by relevance is a different item. No issue covers it.
Proposed Solution & Architectural Design
- Replace the five full ADR files with a one-line index of the ADRs in force:
ADR NNNN: <title>, sorted by number, under one heading, at the same place incontext. - Build the index from the files of the staged commit with
adr_ofandAdr.in_forceofsrc/devops_cli/roadmap/adr.py. Do not parse the status again. - The planner reads a full ADR with
read_filewhen it needs one. The index heading says so in one line. - The trace gate never counts an index entry as a read of the ADR file.
The change frees about 4.4k of the cap for item content. The input of each request does not change at the cap: the freed room fills with cited code.
Target Subsystem
SDLC, Git & PR Governance: src/devops_cli/roadmap/refine/refine.py (collect_context), src/devops_cli/roadmap/adr.py.
Existing Tool Considered
The ADR front matter and adr.py already give the status and the title, and the alternatives check uses them (#5049). No tool is necessary. Cost to build: about 0.4M tokens and 1 hour, about 25 lines and 3 tests.
Acceptance Criteria
- Test first: for a checkout with a superseded ADR and two ADRs in force, the context holds one index line for each ADR in force, no line for the superseded ADR, and no full ADR text.
- A test: a stage claim to have read an ADR that only the index names is refused.
- Measure: rebuild
collect_contextfor the 54 item bodies of the sample, before and after. Give the kept cited files (baseline 131 of 323).devops roadmap eval stage --replaykeeps every known-bad plan refused. - Live proof after release: on real Service stage runs for 7 days, no context holds a superseded ADR, and the
docs/adrreads for each item stay near the baseline (5 of 54 items).
Dependencies
- Issue feat(roadmap): planners and implement read the target AGENTS.md #4650 changes the same function (it adds the target
AGENTS.md). Do not stack the pull requests: the second one rebases onmainafter the first merges.
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-23: none.
Tool: none found.
Reason: Searches found only ADR documentation generators — adr-viewer, log4brains and adr-tools — which build browsable sites or an unfiltered table of contents. None filters by in-force status or emits a one-line index for the plan context from the staged commit.
Lacks:
- No one-line index of ADRs in force, sorted by number
- No filter on status, superseded-by or amended-by front matter
- No reuse of the repository's adr.py at the staged commit
- No trace-gate check that the planner read the ADR file
- Renders HTML sites or unfiltered tables, not prompt text
Proposed design
Problem statement
collect_context puts the full text of ADR 0001-0005 in every stage, fix-plan and refine context. ADR 0002 and ADR 0003 are superseded, and the five files use about 4.8k tokens before the item content. The cap then cuts cited code. The change replaces those files with one line for each ADR in force at the staged commit. The planner reads a full ADR with read_file, and the trace gate refuses a claim that only the index supports.
Acceptance criteria
Requirement: ADR index replaces full ADR files
collect_context SHALL replace the first five full ADR files with one line ADR NNNN: <title> for each ADR in force at the staged commit.
Scenario: Superseded ADR is left out
- WHEN The test calls
collect_contextat a staged commit whosedocs/adrholds one superseded ADR and two ADRs in force. - THEN The context holds two index entry lines of the form
ADR NNNN: <title>in ascending order, no line for the superseded ADR, and no ADR body text.
Requirement: Amended ADR stays in the index
The index MUST include an ADR whose front matter holds amended-by and no superseded-by.
Scenario: Amended ADR is in force
- WHEN The test calls
collect_contextat a staged commit whosedocs/adrholds an ADR withstatus: accepted, anamended-bylist and nosuperseded-by. - THEN The context holds one index entry line of the form
ADR NNNN: <title>for that ADR, and the line holds the title of its front matter.
Requirement: Index heading names read_file
The context ADR index MUST start with one heading line that names read_file and the docs/adr path.
Scenario: Planner sees the read instruction
- WHEN The test calls
collect_contextat a staged commit with at least one ADR in force. - THEN The line before the index entries holds
read_fileanddocs/adr, and the context holds no second heading for the index.
Requirement: No index without an ADR in force
collect_context MUST emit no ADR line and MUST NOT raise when the staged commit holds no ADR in force.
Scenario: Every ADR is superseded
- WHEN The test calls
collect_contextat a staged commit whosedocs/adrholds only superseded ADRs. - THEN The context holds no
ADR NNNN:line and no index heading, and the call returns the rest of the context.
Requirement: Trace gate refuses an index-only ADR claim
The stage trace gate MUST refuse a claim to have read an ADR path when the trace holds no read_file span for that path.
Scenario: No file read span for the ADR
- WHEN The test gives the gate a trace that claims
docs/adr/0001-github-is-the-roadmap-source.mdand holds noread_filespan for that path. - THEN The gate returns a refusal that names
docs/adr/0001-github-is-the-roadmap-source.md.
Requirement: Replay keeps known-bad plans refused
The change MUST keep every known-bad stage plan refused in devops roadmap eval stage --replay.
Scenario: Replay of known-bad plans
- WHEN The test runs
uv run devops roadmap eval stage --replay. - THEN The command reports every known-bad plan refused.
Existing Tool Considered
The alternatives check of 2026-11-23 in the issue body records verdict none and names no tool. It found only ADR documentation generators, and the block lists what they lack. No open, maintained tool covers the need. The change builds its own code: about 25 lines in src/devops_cli/roadmap/refine/refine.py and 3 tests, at about 0.4M tokens and 1 hour.
Key questions
- Which source supplies the ADR status and title for the index?:
collect_contextcallsadr_ofandAdr.in_forceat the staged commit. It emits oneADR NNNN: <title>line for each ADR in force, sorted by ADR number, and parses no status itself. (best practice) [sources: src/devops_cli/roadmap/adr.py:189, src/devops_cli/roadmap/adr.py, src/devops_cli/roadmap/refine/refine.py:1057, tests/roadmap/test_roadmap_adr.py, tests/roadmap/refine/test_roadmap_refine_context.py]- Chosen: Reuse
adr_ofandAdr.in_force. The front-matter reader already holds the status and the title, so one source of truth supplies both. - Rejected: Parse the status in
collect_context. A second parser duplicatesadr.pyand can drift from the front matter. - Rejected: Keep the first five ADR files. It includes superseded ADRs and spends the context cap on full text.
- Chosen: Reuse
- Where does the index go in the context, and what does its heading say?: The index replaces the five ADR files at the same place in
context. One heading line says that the list holds the ADRs in force. The same line says that the planner callsread_fileon adocs/adrpath for the full text. (best practice) [sources: src/devops_cli/roadmap/refine/refine.py:1057, CONTEXT.md]- Chosen: One heading line before the index. The planner sees the instruction once and the index stays small.
- Rejected: The index with no heading. The planner then has no instruction to read a full ADR.
- Rejected: One heading line for each ADR entry. It repeats the instruction and spends the tokens that the change frees.
- What does
collect_contextemit when no ADR is in force?: It emits no heading and noADR NNNN:line. It returns the rest of the context with no error. (best practice) [sources: src/devops_cli/roadmap/refine/refine.py:1057]- Chosen: Emit no index and no heading. An empty list with a heading spends a line and tells the planner nothing.
- Rejected: Emit the heading with no entry. The heading sends the planner to
docs/adrfor an ADR that is not there.
- How does the trace gate treat an index line?: The gate requires a
read_filespan for the ADR path. An index line alone is not a read of the ADR file, and the gate refuses the claim. (best practice) [sources: src/devops_cli/roadmap/stage/stage_probe.py, tests/roadmap/stage/test_roadmap_stage_trace_subject.py]- Chosen: Require a
read_filespan for the ADR path. It checks the tool call that the planner must make for a full ADR. - Rejected: Count an index line as a read. It lets a claim pass with no file read.
- Rejected: Drop the ADR read check. It removes a gate that catches a false claim.
- Chosen: Require a
- Is feat(roadmap): planners and implement read the target AGENTS.md #4650 a dependency of this item or only a merge order?: It is a dependency. Issue feat(roadmap): planners and implement read the target AGENTS.md #4650 edits
collect_context, so this pull request rebases onmainafter feat(roadmap): planners and implement read the target AGENTS.md #4650 merges and stacks no second pull request. (best practice) [sources: src/devops_cli/roadmap/refine/refine.py:1057, CONTEXT.md]- Chosen: Deliver after feat(roadmap): planners and implement read the target AGENTS.md #4650 merges and rebase on
main. The two changes edit the same function, and one rebase onmainresolves the one conflict. - Rejected: Stack the pull requests. A stacked pull request merges a change that its base branch does not hold yet.
- Rejected: Make both changes in one pull request. One pull request delivers one item.
- Chosen: Deliver after feat(roadmap): planners and implement read the target AGENTS.md #4650 merges and rebase on
- Which of the five ADRs in the current plan context are in force at the checked commit?: ADR 0002 and ADR 0003 hold
status: superseded, so they are not in force. ADR 0001, ADR 0004 and ADR 0005 holdstatus: accepted; ADR 0001 has onlyamended-byand stays in force. The index reads every file at the staged commit and includes each ADR thatAdr.in_forceaccepts. [sources: docs/adr/0001-github-is-the-roadmap-source.md, docs/adr/0002-roadmap-jobs-act-as-a-machine-account.md, docs/adr/0003-polling-is-how-the-roadmap-sees-changes.md, docs/adr/0004-ci-is-the-authoritative-gate.md, docs/adr/0005-review-findings-come-from-tools-not-models.md, src/devops_cli/roadmap/adr.py]
Fit
Fits in one pull request.
Suspected block
None.
Activity
dan-petty commentedon Nov 13, 2026
Both items modify collect_context in refine.py; #4650 adds AGENTS.md to the context, while this item replaces the five ADR files with an index of ADRs in force.devops-cli-service commentedon Nov 17, 2026
Alternatives check: none
Reason: The searches found only general ADR documentation generators — adr-viewer and log4brains — which build a browsable HTML site or knowledge base from ADR files. Neither produces the compact one-line index of the ADRs in force that
collect_contextneeds, filters out superseded ADRs, nor connects an index entry to the trace gate, so the small change to the existingadr.pyfront-matter reader is not covered by a tool.Tool: none found
Lacks:
Adr.in_forceand building from the staged commit viaadr_ofTools considered:
Searches run:
Sources:
Checked on 2026-11-17. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 18, 2026
Refine cannot set this item to Ready at 9be129e 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.
The next refine round also looks at the item again when a commit on the default branch changes one of these files:
src/devops_cli/roadmap/refine/refine.py.devops-cli-service commentedon Nov 20, 2026
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.
devops-cli-service commentedon Nov 24, 2026
Next step: the stage job writes the plan of the item. See Moved to new items in the section Proposed design of the body.
fix(roadmap): list in-force ADR index in plan context (#5465)
test: use non-superseded ADR numbers in plan context fixtures (#5465)
devops-cli-service commentedon Nov 25, 2026
Released in v0.218.1: https://github.com/dan-petty/devops-cli/releases/tag/v0.218.1
devops-cli-service commentedon Nov 25, 2026
Live since 2026-11-25 07:43 UTC