Repository navigation
Description
Problem or Motivation
refine.collect_context(src/devops_cli/roadmap/refine/refine.py:881-903, which the stage uses atstage.py:1451) readsCONTEXT.mdand the first 5 files ofdocs/adrin name order. devops-cli has 22 ADRs, so the planner gets 0001-0005, and 0002 is superseded.- vibes has a 413-line
AGENTS.mdand noCONTEXT.md, so its planner gets none of its rules. stage_change.py:2780callsrules_sectionsonly to count tokens.step_rules.rules_sectionsreturns[]whenAGENTS.mdis missing (src/devops_cli/roadmap/step_rules.py:131-137). So in 5 of 6 repositories the implement step runs with no repository rules.
Proposed Solution & Architectural Design
collect_contextadds theAGENTS.mdof the target throughrules_sections, cut toCONST_ROADMAP_IMPLEMENT_FILE_MAX_TOKENS(8,000), as the implement step does.- When a target has no
AGENTS.md,rules_sectionsgives the kit rules rendered with the detected values (fix(ai): devops ai agents detects the project manifest #4641), under a heading that says that they are the generic rules. CONTEXT.mdstays an optional project file.- ADR selection by relevance is a different item and is not in this change.
- Owner decision 7 (2026-11-11): the vibes
AGENTS.md(44,535 characters, about 11,000 tokens) stays. The cut at 8,000 tokens applies to it.
Target Subsystem
SDLC, Git & PR Governance (src/devops_cli/roadmap/refine/refine.py and src/devops_cli/roadmap/step_rules.py).
Existing Tool Considered
AGENTS.md is the open standard file for agent rules, and the implement step already reads it. No tool is necessary. Cost: about 40 lines and 4 tests, about 150,000 tokens and 2 hours to build.
Acceptance Criteria
- A test: the refine context for a repository with
AGENTS.mdcontains its first rule line, and stays within the token cap for a 44,535-character file. - A test:
rules_sectionsfor a checkout with noAGENTS.mdreturns 1 section with the generic rules, and none of them says "Python" when the checkout has no Python manifest. - The stage eval replay score is not lower (both numbers in the pull request).
Dependencies
Source: #4627
Alternatives check of 2026-11-20: none.
Tool: none found.
Reason: Searches for AGENTS.md generators and for tools that assemble a repository's rules into a capped model context found nothing relevant; the need is this repository's own collect_context and rules_sections.
Lacks:
- No tool reads AGENTS.md at the item's commit
- No tool renders kit rules for a checkout without AGENTS.md
- No tool applies the implement file token cap
Proposed design
Problem statement
Refine and stage build the model context from CONTEXT.md and the first five files of docs/adr in name order; one of those five, ADR 0002, is superseded. A repository with no CONTEXT.md gives the planner none of its own rules, and the implement step's rules_sections returns no section when AGENTS.md is absent, so five of six repositories run with no repository rules. This change adds the target AGENTS.md at the item's commit to the refine context under the implement file cap, and gives the generic kit rules rendered with the detected values when the file is absent. ADR selection by relevance stays out of this change.
Acceptance criteria
Requirement: The refine context holds the target AGENTS.md
The refine context SHALL include the AGENTS.md of the target repository when the item's commit holds that file.
Scenario: A commit with an AGENTS.md
- WHEN
collect_contextbuilds the context for a commit whoseAGENTS.mdholds a known first rule line - THEN the context holds that rule line under the rules heading
Requirement: The AGENTS.md section comes from the item's commit
collect_context SHALL read the AGENTS.md at the item's sha, not from the working tree.
Scenario: The working tree differs from the commit
- WHEN the
AGENTS.mdatshaholds one rule line and the working-treeAGENTS.mdholds another - THEN the context holds the line from
shaand not the working-tree line
Requirement: Each rules section stays under the implement file cap
Each rules section SHALL hold at most CONST_ROADMAP_IMPLEMENT_FILE_MAX_TOKENS tokens.
Scenario: A 44,535-character AGENTS.md
- WHEN
collect_contextbuilds the context for a commit whoseAGENTS.mdholds 44,535 characters - THEN the
AGENTS.mdsection holds at mostCONST_ROADMAP_IMPLEMENT_FILE_MAX_TOKENStokens
Requirement: The context stays within the caller budget
collect_context SHALL keep the whole context within the max_tokens that its caller gives.
Scenario: A context with the AGENTS.md section
- WHEN
collect_contextbuilds a context with theAGENTS.mdsection and amax_tokensvalue - THEN the token count of the context is at most
max_tokens
Requirement: A checkout with no AGENTS.md gets the generic rules
rules_sections SHALL put one section of the generic kit rules first when the checkout has no AGENTS.md.
Scenario: A checkout with no AGENTS.md
- WHEN
rules_sectionsruns on a checkout with noAGENTS.mdand no routed document - THEN it returns one section whose heading states that the rules are generic
Requirement: The generic rules name no toolchain that the checkout lacks
The generic rules SHALL name only the toolchain that the checkout detects.
Scenario: A checkout with no Python manifest
- WHEN
rules_sectionsruns on a checkout with noAGENTS.mdand no Python manifest - THEN no line of the returned section says
Python
Requirement: The refine context gets the generic rules when the commit has none
collect_context SHALL add the generic rules section when the item's commit holds no AGENTS.md.
Scenario: A commit with no AGENTS.md
- WHEN
collect_contextbuilds the context for a commit with noAGENTS.mdwhile the working tree holds one - THEN the context holds one rules section whose heading states that the rules are generic
Requirement: CONTEXT.md stays optional
collect_context SHALL read CONTEXT.md only when the item's commit holds that file.
Scenario: A commit with no CONTEXT.md
- WHEN
collect_contextbuilds the context for a commit withAGENTS.mdand noCONTEXT.md - THEN the context holds the
AGENTS.mdsection and noCONTEXT.mdsection
Requirement: The stage replay score does not fall
The pull request SHALL state the stage eval replay score before and after the change, and the after score SHALL NOT be lower.
Scenario: Replay of the recorded stage runs
- WHEN the stage eval replay runs on the change
- THEN it reports a score not lower than the score before the change, and the pull request body states both scores
Existing Tool Considered
The alternatives check of 2026-11-13 ran seven searches and found no open, maintained tool or library: AGENTS.md is a convention file, and the need is this repository's own collect_context and rules_sections, which already share the implement step's section builder. No external tool renders the kit rules for a checkout with no AGENTS.md or reads the target file at the item's commit. Written cost to build, keep and fix that code instead: about 150,000 tokens and 2 hours of elapsed time, about 40 lines and 4 tests. The change deletes no internal code.
Key questions
- Which files does the refine context read today, and where does
collect_contextlive?:collect_contextis atsrc/devops_cli/roadmap/refine/refine.py:955. It readsCONTEXT.mdat the item'ssha(refine.py:965) and the first five files ofdocs/adrin name order (refine.py:970-973); those five are ADR 0001-0005, and ADR 0002 is superseded. The stage calls it atstage.py:2007and the refine round atrefine.py:2582. [sources: src/devops_cli/roadmap/refine/refine.py:955, src/devops_cli/roadmap/refine/refine.py:965, src/devops_cli/roadmap/refine/refine.py:973, src/devops_cli/roadmap/stage/stage.py:2007, src/devops_cli/roadmap/refine/refine.py:2582, docs/adr/0002-roadmap-jobs-act-as-a-machine-account.md:2] - What does
rules_sectionsreturn when the checkout has noAGENTS.md?: An empty list:step_rules.py:143-144returns[]before it builds any section, and the archived change 3097 records that a checkout with noAGENTS.mdgives nothing. [sources: src/devops_cli/roadmap/step_rules.py:143, openspec/changes/archive/2026-11-01-3097-step-gets-agents-md/tasks.md:7] - Is fix(ai): devops ai agents detects the project manifest #4641 delivered, so that the generic rules renderer exists?: Yes. The change folder
openspec/changes/archive/2026-11-11-4641-devops-ai-agents-detects-the-project/is archived and every task is checked. It deliversparse_project_metadata(instruction_generator.py:174) andgenerate_agents_md(instruction_generator.py:246), which renderssrc/devops_cli/templates/AGENTS.md.j2with the detected toolchains and writes no toolchain line for a checkout with no manifest. fix(ai): devops ai agents detects the project manifest #4641 is therefore done and does not block this item. [sources: openspec/changes/archive/2026-11-11-4641-devops-ai-agents-detects-the-project/tasks.md:7, src/devops_cli/ai/instruction_generator.py:174, src/devops_cli/ai/instruction_generator.py:246, src/devops_cli/templates/AGENTS.md.j2:4] - How does refine build the
AGENTS.mdsection, given thatrules_sectionstakes a task group and reads the working tree?: One section builder instep_rules.pytakes the rules text and the heading and returns the text cut toCONST_ROADMAP_IMPLEMENT_FILE_MAX_TOKENSunder that heading.rules_sectionssupplies the working-treeAGENTS.mdor the generic rules, andcollect_contextsupplies theAGENTS.mdat the item'sshaor the generic rules. Neither caller copies the cap or the heading. (best practice) [sources: openspec/changes/archive/2026-11-01-3097-step-gets-agents-md/design.md:5, openspec/changes/archive/2026-11-01-3097-step-gets-agents-md/design.md:43, src/devops_cli/roadmap/step_rules.py:137, src/devops_cli/config/constants.py:3524]- Chosen: One text-taking section builder in step_rules.py. The implement step and the stage measure already share
rules_sections, and change 3097 records that one function keeps the measure and the message equal. - Rejected: Pass a synthetic task group from refine. Refine has no task group, and a synthetic group couples the context to the shape of a group.
- Rejected: Copy the AGENTS.md read into refine.py. Two copies drift, and the planner's cap and heading would differ from the implement step's.
- Chosen: One text-taking section builder in step_rules.py. The implement step and the stage measure already share
- Which revision of the target
AGENTS.mddoescollect_contextread?: TheAGENTS.mdat the item'ssha, through_read_git_file, asCONTEXT.mdand the ADRs are read. The working tree can hold an edit from an earlier step, and the stage already reads the staged commit rather than the working tree for the same reason. A commit with noAGENTS.mdgets the generic rules, even when the working tree holds one. (best practice) [sources: src/devops_cli/roadmap/refine/refine.py:965, src/devops_cli/roadmap/refine/refine.py:731, src/devops_cli/roadmap/stage/stage.py:3105, openspec/changes/archive/2026-11-01-3097-step-gets-agents-md/design.md:43]- Chosen: At the item's sha.
CONTEXT.mdand the ADRs already come fromsha, and the stage reads the commit it plans on, so the whole context describes one revision. - Rejected: From the working tree. An earlier step can edit the checkout, so the planner would read rules that the item's commit does not hold.
- Rejected: Both revisions. Two copies of the same rules spend the budget twice and can conflict.
- Chosen: At the item's sha.
- Where does the
AGENTS.mdsection go in the refine context?: First, under its own heading, beforeCONTEXT.mdand the ADRs. (best practice) [sources: openspec/changes/archive/2026-11-01-3097-step-gets-agents-md/design.md:5]- Chosen: First, before CONTEXT.md and the ADRs. The implement step adds the rules before the item, and the cut of the token budget takes the end first, so the rules survive a small budget.
- Rejected: Last, after CONTEXT.md and the ADRs. The planner would read the rules after the project terms, and a small budget would cut them first.
- What token cap applies to the
AGENTS.mdsection?:CONST_ROADMAP_IMPLEMENT_FILE_MAX_TOKENS, which is 8,000 (constants.py:3524), the same cap the implement step uses. (best practice) [sources: src/devops_cli/config/constants.py:3524, openspec/changes/archive/2026-11-01-3097-step-gets-agents-md/design.md:43]- Chosen: The implement file cap, CONST_ROADMAP_IMPLEMENT_FILE_MAX_TOKENS. The implement step already cuts
AGENTS.mdwith this constant, and one cap keeps the planner and the step equal. - Rejected: No cap. The vibes file holds 44,535 characters, about 11,000 tokens, and it would fill the context.
- Rejected: A new refine-only cap. Two caps drift, and the planner and the implement step would read different text.
- Chosen: The implement file cap, CONST_ROADMAP_IMPLEMENT_FILE_MAX_TOKENS. The implement step already cuts
- Does the vibes
AGENTS.mdstay at 44,535 characters?: The file stays. Owner decision 7 of 2026-11-11 in feat(roadmap): track one project profile for all repositories #4627 says the kit does not replace an existingAGENTS.md, the vibes file stays, and the owner can make it shorter by hand (fetched 2026-11-14). So this change does not shorten the file, and the 8,000-token cut applies to it as the issue body records. (best practice) [sources: https://github.com/feat(roadmap): track one project profile for all repositories #4627]- Chosen: Keep the file and cut it at the cap. Owner decision 7 keeps the vibes file and leaves any shortening to the owner, so the cap is the only change.
- Rejected: Shorten the vibes AGENTS.md in this change. Owner decision 7 rejects the kit's replacement of an existing file and leaves the shortening to the owner's hand.
- Does the refine context get the generic rules when the item's commit has no
AGENTS.md?: Yes.collect_contextuses the same section builder, so a target with noAGENTS.mdgets one generic rules section under a heading that says it is generic, rendered bygenerate_agents_mdfrom the detected facts. Without it the planner in five of six repositories reads no repository rules. (best practice) [sources: src/devops_cli/roadmap/step_rules.py:143, src/devops_cli/ai/instruction_generator.py:246, openspec/changes/archive/2026-11-11-4641-devops-ai-agents-detects-the-project/proposal.md:9]- Chosen: Give the generic rules to both refine and the implement step. The issue finds that five of six repositories have no
AGENTS.md, and the planner needs the same rules that the implement step gets. - Rejected: Give the generic rules only to the implement step. The planner would still read no repository rules in five of six repositories, which is the problem the change solves.
- Rejected: Keep the empty list for both. The implement step and the planner would keep running with no rules, and fix(ai): devops ai agents detects the project manifest #4641 already gives the renderer.
- Chosen: Give the generic rules to both refine and the implement step. The issue finds that five of six repositories have no
- Does this change wire the generic kit rules into
rules_sections?: Yes.rules_sectionsreturns one generic section whenAGENTS.mdis absent, rendered bygenerate_agents_mdfromparse_project_metadata. fix(ai): devops ai agents detects the project manifest #4641 delivered that renderer, so this change adds the call and the generic heading and waits on no other item. (best practice) [sources: src/devops_cli/roadmap/step_rules.py:143, src/devops_cli/ai/instruction_generator.py:246, openspec/changes/archive/2026-11-11-4641-devops-ai-agents-detects-the-project/tasks.md:7]- Chosen: Wire the fallback here. The implement step runs with no rules in five of six repositories, and fix(ai): devops ai agents detects the project manifest #4641 already gives the rendered rules.
- Rejected: Keep the empty list and file a separate item. The fallback is one call in
rules_sections, and this change already adds the rules section.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 11, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
featprefix of the title gives the type.(roadmap)scope of the title gives the scope.The planner currently misses repository rules, but the implement step already covers them, so this is a gap not a break.The planner gains access to project-specific rules, improving plan quality for repositories that use AGENTS.md.The candidate estimates about 40 lines, 4 tests, and 2 hours of work.Both target the roadmap pipeline reading AGENTS.md, but #3097 changed the implement step while this candidate changes the refine/planner stage.devops-cli-service commentedon Nov 13, 2026
Alternatives check: none
Reason: The searches returned no open, maintained tool or library for this need:
AGENTS.mdis a convention file, not a tool, and the issue itself says no tool is necessary. The work is an internal change to this repository'scollect_contextandrules_sections, which already readAGENTS.mdin the implement step, so nothing external covers it.Tool: none found
Lacks:
Searches run:
Checked on 2026-11-13. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 14, 2026
Status set to Ready at 0410772 (see proposed design in issue body).
devops-cli-service commentedon Nov 24, 2026
Plan state: branch
feat/4650-planners-and-implement-read-the-target, draft pull request #6985. The pull request plans the item and closes no issue. The stage job and the step fix-plan edit this comment, and a comment of each run tells what the run did.The task groups, with the tokens of the inputs of each step, for a budget of 64000 tokens:
A model review of the plan found these points. They stop no draft, and a person judges them:
missing_pathat tasks (1): Group 1 makesrules_sectionsreturn a generic rules section for a checkout with noAGENTS.md, so the step message of such a checkout now starts with that section.tests/roadmap/implement/test_roadmap_implement_step.pycompares that message with a syrupy snapshot, and neither the test nortests/roadmap/implement/__snapshots__/test_roadmap_implement_step.ambris read or changed by the plan, so the snapshot fails. Evidence: "# Item Release v0.1.8 #1: Make the sample shout"otherat tasks (1): The plan names only_file_tokensas the case to update intests/roadmap/stage/test_roadmap_stage_measure.py, buttest_the_measure_counts_agents_md_and_the_routed_sections_that_the_step_readsmeasures the clone before and after writingAGENTS.md. Thebeforemeasure of a clone with noAGENTS.mdnow holds the generic section, so the difference the test asserts no longer holds and the group's own verify command fails. Evidence: "assert after.tokens - before.tokens == count_tokens(rules) + count_tokens(testing)"otherat tasks (3): Group 3 still tells the implementer to updatetests/roadmap/test_roadmap_limit_classes.py, while itschangeslist holds onlydocs/roadmap/refine.mdand the feasibility says no group reads, changes or documents that file. This change adds no roadmap limit constant, so the instruction is a leftover that contradicts the plan. Evidence: "Updatetests/roadmap/test_roadmap_limit_classes.py"otherat tasks (4): Group 4 changes onlydocs/roadmap/refine.md, and the change adds noCONST_ROADMAP_*limit, so the registry testtests/roadmap/test_roadmap_limit_classes.pyneeds no edit. The documentation line sends the implementer to a file the group does not change, which the implement step refuses to touch because the group does not name it. Evidence: "Updatetests/roadmap/test_roadmap_limit_classes.py"15 remaining items
devops-cli-service commentedon Nov 24, 2026
The draft pull request #7001 holds the final title and body. In mode
onofroadmap.fix_checks.mode, the watch row marks it ready when its checks pass, and a fix-checks Job repairs a failed check whose name gives the class test, lint or types. In each other case the watch row stops the item: another failed check, a cancelled check, a conflict, a fix-checks Job that ended with no repair, or another mode.Spend: 152 model requests, 11365646 input tokens, 59348 output tokens.
devops-cli-service commentedon Nov 24, 2026
The runner Job devops-cli-implement-devops-cli-4650-94368b ended: succeeded.
Image digest: sha256:91fca09448126aad14b4f12455822ca9e1dd6b19a727edc7e9a28a864037c0c6
The last lines of its log:
(no log: the Job has no pod)
Failure class:
ci_infra.Action taken: none.
Action left:
retry: run the item again.The Job left this item without a result. The item is Blocked. When a retry can fix the class of the stop, the Service starts a new Job in the next round. The limit is
roadmap.implement.continuations_per_item, and the comment of that round says so. If no continuation is left, fix the cause. Then commentimplement: retry. A new runner image also clears the stop. This holds only if a retry can fix the class of the stop. The limits ofroadmap.implement.digest_clears_per_classandroadmap.implement.digest_clears_per_itemmust also allow it.devops-cli-service commentedon Nov 24, 2026
Cleared the stop at job by the rule
continue: the runner Job devops-cli-implement-devops-cli-4650-94368b ended without a result. The classci_infraof the stop is one that a new attempt can fix. This is continuation 1 of 4 for this item. The item is Planned again. The Service takes it in the next round. The new Job takes the branch fromorigin, so it keeps the work that the run pushed there.feat(roadmap): planners and implement read the target AGENTS.md (#4650)
docs(openspec): archive the change (#4650)
devops-cli-service commentedon Nov 24, 2026
Released in v0.210.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.210.0
devops-cli-service commentedon Nov 24, 2026
Live since 2026-11-24 17:08 UTC