Skip to content

docs(agents): route task rules out of AGENTS.md #5421

Closed

Description

@dan-petty

Problem or Motivation

Every agent session loads AGENTS.md in full (CLAUDE.md, GEMINI.md and the Copilot instructions point to it), and the roadmap jobs read it too (#4650, #2594). It is at 6,501 bytes, against the cap of 6,500 characters (CONST_AGENTS_MD_MAX_CHARS, tests/invariants/test_agents_md.py). So each session pays for text that most tasks do not need, and a new rule (for example the bottom-line-first rule of #5419) cannot go in. The owner asked on 2026-11-13 to refactor AGENTS.md so that it routes task-specific content to the documents that own it, for token efficiency.

Proposed Solution & Architectural Design

  • Classify each sentence of AGENTS.md: a rule that every task needs, a rule for some tasks only, a detail or example, or a duplicate of text that another document already owns.
  • Keep in AGENTS.md only the rules that every task needs and the routing table. Keep the safety rules inline: never commit or push to main, never --no-verify, only a person merges and changes secrets and settings, never lower a security or quality threshold, keep private data out, use devops gh and devops pr.
  • Move each task-specific rule and detail to the one document that owns that task (CONTRIBUTING.md, docs/TESTING.md, SECURITY.md, docs/ROADMAP_WORKFLOW.md, the style file and others), and keep each rule in one place only.
  • Keep every routed document within two links of AGENTS.md (the existing invariant).
  • Keep devops ai agents in step: its template and the rule-title parity test must match the new AGENTS.md.
  • Lower CONST_AGENTS_MD_MAX_CHARS to the new size plus a small margin, so the file cannot grow back unnoticed. This tightens the limit and lowers no quality threshold.

Target Subsystem

Agent instructions (AGENTS.md, CLAUDE.md, GEMINI.md, .github/copilot-instructions.md, devops ai agents, tests/invariants/test_agents_md.py).

Existing Tool Considered

No tool. This is a document change with the existing invariant tests. Cost: about 300,000 tokens, 3 hours elapsed. Saving: the bytes removed from AGENTS.md, in every agent session and roadmap job.

Acceptance Criteria

  • AGENTS.md is at least 35 percent smaller, and CONST_AGENTS_MD_MAX_CHARS is the new size plus at most 10 percent.
  • Every rule that left AGENTS.md has one home, and the PR body has a table: rule, new home.
  • The safety rules listed above stay in AGENTS.md.
  • tests/invariants/test_agents_md.py (character budget, two links, rule-title parity) passes, and devops ai agents writes a file within the new cap.

Dependencies

#5419 changes the style file that rule 9 links to. Merge it first, or rebase on it.

Activity

  1. added
    source/agent
    type/docs
    scope/agents
    status/new
    value/medium
    effort/medium
    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. removed
    status/new
    on Nov 13, 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/agentssource/agenttype/docsvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions