Repository navigation
Description
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, usedevops ghanddevops 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 agentsin step: its template and the rule-title parity test must match the new AGENTS.md. - Lower
CONST_AGENTS_MD_MAX_CHARSto 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_CHARSis 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, anddevops ai agentswrites 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
dan-petty commentedon Nov 13, 2026
Both reduce AGENTS.md size for token efficiency, but #841 fit a context budget while the candidate routes rules to owning documents and tightens the cap.