Download

How to test an AGENTS.md change before it reaches your team

AutoRouter9 min read

Key facts

To test an AGENTS.md change before your team gets it, run the same set of past tasks with the old file and with the new one, several times each, keeping the model, the agent and its settings the same, then compare pass rate, tokens and cost per task and look for tasks that newly fail. AutoRouter, the Mac app for all your coding agents, builds a free company benchmark from your team's merged pull requests that you can rerun every time your AI setup changes, an instruction file included. The steps below do the same thing by hand, for AGENTS.md and for CLAUDE.md, Claude Code's equivalent. AutoRouter wrote this post.

Why test an AGENTS.md change at all?

Test it because a change to an instruction file can make your agents worse and more expensive without anyone noticing. In a study published in February 2026, Gloaguen et al. ran several coding agents and models on real issues with and without context files such as AGENTS.md. Context files did not generally improve task success and raised inference cost by over 20% on average, whether a model or a developer wrote them. Agents followed the instructions well; the repository overviews that many files open with did not help. The authors conclude that any attempt to improve performance with these files "should be rigorously evaluated before deployment."

That doesn't mean AGENTS.md is useless. The same study found the files useful for specifying non-standard coding practices: rules an agent can't work out from the code, like which package manager or test command a repository uses. It means you can't tell from reading a diff whether a new paragraph helps, and every developer on the team pays for the extra tokens on every request.

Where do coding agents read AGENTS.md and CLAUDE.md?

Each agent reads its instruction files from your home folder down to the folder you work in, and the rules differ enough that an edit can reach one agent and not another. As of November 25, 2026:

AgentFiles it readsWhereWatch for
CodexAGENTS.override.md, else AGENTS.md~/.codex (or CODEX_HOME), then each folder from the repository root down to the working folderOne file per folder; stops adding files at project_doc_max_bytes, 32 KiB by default
Claude CodeCLAUDE.md, .claude/CLAUDE.md, CLAUDE.local.md; AGENTS.md only when none of those exist~/.claude/CLAUDE.md, then every folder above the working folder at launch; subfolders when Claude works in themWith a CLAUDE.md present, it skips AGENTS.md unless the CLAUDE.md imports it
CursorAGENTS.md, beside .cursor/rulesProject root and subfoldersNested files combine with their parents; the more specific one wins a conflict

Two things follow for a test. First, make sure the file you edited is the one being read: in Claude Code, run /context all and check the list under Memory files, or /memory, which lists an AGENTS.md it read. Second, keep personal files out of both sides of the comparison. A ~/.codex/AGENTS.md, a ~/.claude/CLAUDE.md, a CLAUDE.local.md or Claude Code's auto memory loads alongside the team's file and can hide or fake an effect.

Which tasks should you test an AGENTS.md change on?

Test it on past tasks your team already shipped, with tests that check the result. Take recent merged pull requests that changed both source and tests, start each task from the code as it was before the change, write the goal without the fix, and hold back the tests to grade with afterward. How do you build an AI coding benchmark for your company? walks through making these tasks; the same set then serves every instruction, model and agent change you want to try. How Ramp, Cursor and Uber build AI coding benchmarks shows how larger teams source and refresh theirs.

Include tasks the change should help and tasks it shouldn't touch. A new rule about database migrations should help migration tasks, and the other tasks show whether the extra text costs tokens or distracts the agent everywhere else. Where a task has no tests, grade it with a rubric written before you see any output; grading coding agents: tests, rubrics or an LLM judge covers when each grader fits.

How do you run an AGENTS.md A/B test?

These steps run on a Mac or a CI runner with git and the agents you already use. Commands are examples; change paths, models and the test command to fit your repository.

1. Save both versions of the file. Keep the current file and the proposed one side by side:

mkdir -p arms
git show main:AGENTS.md > arms/old.md
git show my-agents-change:AGENTS.md > arms/new.md

2. Keep personal instructions out. For Codex, point CODEX_HOME at a clean folder that holds only your sign-in, so no global AGENTS.md loads. For Claude Code, run on a machine or account without a ~/.claude/CLAUDE.md, delete any CLAUDE.local.md from the task folders and turn auto memory off with /memory.

export CODEX_HOME="$(mktemp -d)"
cp ~/.codex/auth.json "$CODEX_HOME/"

3. Run every task with each file, three or more times. Use a fresh copy of the task for every run, the same model and effort, and the same agent version. For Claude Code in a repository that has a CLAUDE.md, copy the file to CLAUDE.md instead.

for t in tasks/*/; do for arm in old new; do for run in 1 2 3; do
  w="$(mktemp -d)"; cp -R "$t/repo/." "$w"; cp "arms/$arm.md" "$w/AGENTS.md"
  (cd "$w" && codex exec --json --skip-git-repo-check -s workspace-write "$(cat "$t/prompt.md")") \
    > "$t/$arm-$run.jsonl"
  (cd "$w" && patch -p1 < "$t/tests.patch" && <your test command>) \
    && echo "$t $arm $run pass" || echo "$t $arm $run fail"
done; done; done >> results.txt

For Claude Code, the run line is claude -p "$(cat "$t/prompt.md")" --model opus --output-format json --permission-mode acceptEdits. Its JSON output includes the run's cost and token counts; Codex's JSON events include token usage, which you can price with the provider's list prices.

4. Compare the two files. For each one, work out the pass rate across all runs, the median tokens and cost per task, and the tasks that passed in every run with the old file but failed in any run with the new one. Those newly failing tasks are the regressions to read before anything else.

5. Ship only what holds up. Merge the change when it helps the tasks it was written for, costs no more elsewhere and leaves no regression you can't explain. Otherwise cut it back and run again; deleting a paragraph is a change worth testing too.

How much run-to-run variance should you expect?

Expect enough variance that a few points of pass rate on a few dozen tasks can be noise. Coding agents don't give the same result twice on the same task, so one run per file measures luck as much as the file. Anthropic's statistical approach to model evaluations (November 19, 2024) recommends resampling each question several times and averaging, and comparing results question by question as paired differences, since the same questions tend to be easy or hard for both sides. It also found that when questions come in related groups, such as several tasks from one pull request, the honest error bars can be more than three times as wide as the naive ones.

The cheapest way to see your own noise is to run the old file against itself first. The gap between two runs of the same file is your noise floor; a difference between old and new that isn't clearly bigger than it is no difference. Treat every number in this table as an example for a made-up team, not a measurement:

Example for a made-up team (40 tasks, 3 runs each)Pass rateTokens per taskCost per taskTasks newly failing
Old file, run A60%182,000$1.42None (baseline)
Old file, run B65%179,000$1.40Noise check
New file67%151,000$1.182

In this example the new file's 2-point gain in pass rate sits inside a 5-point gap between two runs of the old file, so the file doesn't make the agent more capable. Its cost per task fell about 16% against a gap of about 1% between the old runs, which is likely real. The two newly failing tasks decide it: read them, and ship the change only if they fail for reasons unrelated to the new text.

How does AutoRouter's free benchmark test instruction changes?

AutoRouter builds a free benchmark for engineering teams from real work they have shipped, then tunes a custom router, skills and team-wide system prompts against it to save them money. It starts with a diagnostic of the team's agent traces: where agents burn tokens repeating mistakes, what the best engineers do that others could learn, and where the team pays for more intelligence than it needs. The benchmark's tasks come from the team's merged pull requests and agent traces, each starting from the repository as it was before the change and graded against the team's tests or a rubric written with the team.

The team keeps the benchmark and can rerun it every time a new model comes out or its AI setup changes, which is the test above run on its own work. Targets for savings, speed and performance are agreed before tuning, and a paid pilot follows only if they are met. Which repositories, pull requests and transcripts may be read, and where the benchmark runs, are agreed at kickoff. What is an LLM router? explains how the routing side works.

To test your next AGENTS.md change on your team's own merged work instead of building the harness yourself, apply for AutoRouter's free company benchmark.

Questions

Does Claude Code read AGENTS.md?

Yes, from version 2.1.277, but by default only when there is no CLAUDE.md, .claude/CLAUDE.md or CLAUDE.local.md in the working folder or above it. To share one file, have CLAUDE.md import it with @AGENTS.md, or change the Project instructions setting to read both. Check what loaded with /memory.

How many tasks do I need to test an AGENTS.md change?

No fixed number works for every team; it depends on how big a difference you need to detect. A few dozen tasks with three runs each will show a large effect and miss a small one, and running the old file against itself tells you which gaps your set can resolve. Add tasks before you add runs once the noise floor stays wide.

Should AGENTS.md include a repository overview?

Test it before you keep one. Gloaguen et al. found repository overviews didn't help agents finish tasks, while instructions about non-standard practices were followed. Short rules the agent couldn't infer from the code, such as the test command or a forbidden pattern, are the safer bet.

Can I test a CLAUDE.md change the same way?

Yes. Copy each version to CLAUDE.md in the task folder, run Claude Code with -p and --output-format json for the cost and tokens, and compare the same numbers. AutoRouter's free company benchmark runs on the team's own merged work, so either file can be tested the same way.

Sources