Skip to content

docs(ai): trim the rules of the devops ai agents template #5430

Open

Description

@dan-petty

Problem or Motivation

#5421 moved task detail out of AGENTS.md and lowered CONST_AGENTS_MD_MAX_CHARS from 6,500 to 4,500. The template of devops ai agents (src/devops_cli/templates/AGENTS.md.j2) did not change. Its rules still hold the detail that AGENTS.md moved out: Closes #<issue>, the Conventional Commit title, the OpenSpec archive, devops ci fail-to-pass, devops pr monitor and devops pr ready, Copilot and superseded issues. So a target repository still pays for that text in each session.

The same constant caps the model answer of devops ai agents for every target repository (src/devops_cli/commands/ai.py falls back to the template above it). The budget test in tests/invariants/test_agents_md.py measures only a scaffold with no pre-push hooks (3,837 characters). A scaffold with eight pre-push hooks and a pyproject.toml rendered 4,181 characters, and the template renders 4,206 characters for devops-cli. The template has no size check at run time.

Proposed Solution & Architectural Design

  • Trim the rule text of the template the same way as AGENTS.md: keep the rules that every task needs and the routing table.
  • Add a size test that renders the template for a project with many pre-push hooks and a long description, and holds it to CONST_AGENTS_MD_MAX_CHARS.

Target Subsystem

devops ai agents (src/devops_cli/templates/AGENTS.md.j2, src/devops_cli/ai/instruction_generator.py).

Existing Tool Considered

No tool. This is a template change with the existing invariant tests.

Acceptance Criteria

  • The template renders at most 3,800 characters for devops-cli.
  • A test renders the template with eight pre-push hooks and a 300-character description, and the result fits CONST_AGENTS_MD_MAX_CHARS.
  • The rule-title parity test of tests/invariants/test_agents_md.py passes.

Dependencies

#5421 (merged first).

Alternatives check of 2026-11-17: not-applicable.
Class: docs, no search.
Tool: none found.

Proposed design

Problem statement

The devops ai agents template still carries task detail that AGENTS.md moved out. Each target repository pays for that text in each session. The template has no size test for many pre-push hooks and a long description. This issue trims the template rules and adds a worst-case size test.

Acceptance criteria

Requirement: Template rule titles and routes

The rendered AGENTS.md template SHALL keep the 12 rule titles and the routing table.

Scenario: Render a project with routes

  • WHEN A test renders src/devops_cli/templates/AGENTS.md.j2 with a project that has toolchains and routing entries
  • THEN The rendered text contains each of the 12 rule titles and each routing entry.

Requirement: Task detail is removed

The rendered AGENTS.md template MUST NOT contain the task detail that AGENTS.md moved out.

Scenario: Render the template and search for the removed phrases

  • WHEN A test renders the template and searches the result for Closes #<issue>, Conventional Commit, devops openspec archive, devops ci fail-to-pass, devops pr monitor, devops pr ready, Copilot and superseded
  • THEN The rendered text contains none of those phrases.

Requirement: Worst-case template size

The rendered AGENTS.md template MUST fit CONST_AGENTS_MD_MAX_CHARS for a project with many pre-push hooks and a long description.

Scenario: Render with eight hooks and a 300-character description

  • WHEN A test renders the template with eight pre-push hook commands and a 300-character description
  • THEN The rendered text has at most CONST_AGENTS_MD_MAX_CHARS characters.

Requirement: Devops-cli template size

The rendered AGENTS.md template SHALL have at most 3,800 characters for the devops-cli project.

Scenario: Render with devops-cli metadata

  • WHEN A test renders the template with the toolchains, check commands and routes of devops-cli
  • THEN The rendered text has at most 3,800 characters.

Requirement: Rule-title parity

The AGENTS.md template MUST pass the rule-title parity test in tests/invariants/test_agents_md.py.

Scenario: Run the parity test

  • WHEN A developer runs the rule-title parity test in tests/invariants/test_agents_md.py
  • THEN The test passes and reports no mismatch between the template rule titles and AGENTS.md.

Existing Tool Considered

The alternatives check in the issue body gives verdict not-applicable for this docs-class change and names no tool. No open tool covers the need. The change edits src/devops_cli/templates/AGENTS.md.j2 and adds an invariant test. It builds no new code, so there is no build cost to state.

Key questions

  • Which template text should change to meet the size target?: Remove the task detail that AGENTS.md moved out: the literal Closes #<issue>, the Conventional Commit title, the OpenSpec archive command, devops ci fail-to-pass, devops pr monitor, devops pr ready, the Copilot review sentence and the superseded-issue sentence. Keep the 12 rule titles and the routing table. (best practice) [sources: AGENTS.md, src/devops_cli/templates/AGENTS.md.j2, tests/invariants/test_agents_md.py]
    • Rejected: Keep the current rule text. It renders 4,206 characters for devops-cli, above the 3,800-character target.
    • Chosen: Trim the detail and keep the rule titles. It matches the trim of AGENTS.md and keeps the parity test valid.
    • Rejected: Rewrite the template from scratch. It risks dropping routing entries and breaking the parity test.
  • How should the size test build the worst-case project?: Render the template with eight pre-push hook commands and a 300-character description, and assert the output is at most CONST_AGENTS_MD_MAX_CHARS. (best practice) [sources: src/devops_cli/templates/AGENTS.md.j2, src/devops_cli/config/constants.py:209, tests/invariants/test_agents_md.py]
    • Rejected: Use the existing scaffold with no hooks. It renders 3,837 characters and does not cover many hooks or a long description.
    • Chosen: Add a worst-case render with eight hooks and a 300-character description. It covers the fields that grow the template and holds the output to the cap.
    • Rejected: Use a live scaffold of a real repository. It is not offline and not deterministic.
  • Should the template also meet the 3,800-character target for devops-cli?: Yes. Add a render of the devops-cli metadata and assert at most 3,800 characters. (best practice) [sources: src/devops_cli/templates/AGENTS.md.j2, src/devops_cli/config/constants.py:209]
    • Rejected: Hold only the 4,500-character cap. The issue sets a 3,800-character target for devops-cli to leave headroom.
    • Chosen: Hold devops-cli to 3,800 and the worst case to 4,500. It meets both acceptance criteria and leaves room for project-specific text.
    • Rejected: Hold every project to 3,800. It is stricter than the issue and can reject a valid project with many hooks.
  • Does the change add a rule title to the template?: No. Keep the 12 rule titles that the template already has. The parity test checks that each template title matches AGENTS.md. [sources: tests/invariants/test_agents_md.py, AGENTS.md, src/devops_cli/templates/AGENTS.md.j2]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#5421

Activity

  1. added
    source/agent
    type/docs
    scope/ai
    status/new
    value/medium
    effort/low
    on Nov 13, 2026
  2. dan-petty commented on Nov 13, 2026

    @dan-petty
    OwnerAuthor
  3. added
    priority/p2-medium
    on Nov 13, 2026
  4. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

    Alternatives check: not-applicable

    Class: docs. The check makes no search and no model call for an item of this class.

    Tool: none found

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

  5. added
    status/ready
    and removed
    status/new
    on Nov 17, 2026
  6. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 0581ec5 (see proposed design in issue body).

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/lowpriority/p2-mediumscope/aisource/agentstatus/readytype/docsvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions