Product
Industries
Roles
Research
Resources

Research · Coding agents

AGENTS.md and CLAUDE.md for teams

AGENTS.md for teams: what each coding agent reads, what belongs in the file, its context budget, and how to share one set of rules across repositories.

Last quarter someone on your platform team counted the agent instruction files across 14 repositories and found 23. Some were AGENTS.md, some were CLAUDE.md, and two repositories kept a .cursor/rules folder. Twelve said to run tests with pnpm. One still said yarn, and the agents in that repository followed it.

AGENTS.md for teams works when each rule has one home and one owner, and each agent loads only the rules for the code it touches. Keep each file short, write down what the code cannot tell an agent, and share rules from one source.

#Where each coding agent reads its instructions

AGENTS.md is an open format for instructions to coding agents. Its site counts more than 60,000 open-source projects using it and lists Cursor among the agents that read it. The Agentic AI Foundation under the Linux Foundation now stewards the format.1 Claude Code has its own file, CLAUDE.md. By default it reads AGENTS.md only when no CLAUDE.md sits in the working directory or above it.2 So a repository with both files gives Codex one set of rules and Claude Code another, unless the CLAUDE.md imports the AGENTS.md.

AgentFiles it readsWhere the files can sit
Claude CodeCLAUDE.md, or AGENTS.md when no CLAUDE.md existsAn organization file pushed to each machine, your home folder, the repository, and path-scoped rules in .claude/rules/
CodexAGENTS.override.md, else AGENTS.md, at most one per folder~/.codex, then each folder from the repository root down to the working folder
CursorAGENTS.md, rule files in .cursor/rules/, and the older .cursorrulesThe repository, with globs that scope a rule to matching files
StellaAGENTS.md and CLAUDE.mdThe repository

Sources: the Claude Code and Codex documentation for those two rows, and for the other two the agents.md site and the harness file list in Oxagen's import guide.1234

Two details matter for a team. Codex joins its files from the root down, so a file in a package folder lands later in the prompt and wins over the root.3 Claude Code's @path imports load the imported file in full, up to four hops deep. An import tidies a long file but does not cut what it costs.2

#What research found in agent context files

Three studies looked at these files from different sides.

The largest read 2,303 context files from 1,925 repositories.5 Chatlatanagulchai and colleagues found the files change often, in small additions, and "evolve like configuration code." Test procedures appear in 75.9 percent of the files, implementation details in 70.8 percent, and architecture in 68.1 percent. Security appears in 14.8 percent and performance in 14.5 percent.

What 2,303 agent context files contain

Kind of instructionShare of files
Test procedures75.9%
Implementation details70.8%
Architecture68.1%
Security14.8%
Performance14.5%
Source: Chatlatanagulchai et al. (2025). CLAUDE.md, AGENTS.md, and copilot-instructions.md files from 1,925 repositories, sorted into 16 kinds of instruction.

The second study ran agents on 124 pull requests from 10 repositories, once with an AGENTS.md file and once without.6 With the file, median runtime was 28.64 percent lower and output tokens 16.58 percent lower. Task completion stayed about the same.

The third asked whether the files help agents succeed.7 Gloaguen and colleagues tested files written by models and files written by maintainers. Neither improved task success in general, and both raised inference cost by more than 20 percent on average. Agents did follow the instructions. The authors found the files useful for naming coding practices a project does differently from the norm. Repository overviews, which vendors often recommend, did not help.

A fourth study ran Claude Code and Codex 288 times on 17 tasks from 3 repositories. It found no measurable change in correctness either.8 The agents failed on design choices and exact wiring, not on missing facts a context file could supply. The sample is small, so treat it as one more data point.

Read together, the studies say an instruction file changes how an agent works more than whether it succeeds. It saves time when it names the exact commands and the local conventions. Every other line costs tokens on every run.

#CLAUDE.md best practices for teams

These practices follow from the studies above and from Anthropic's and OpenAI's own guidance. They hold for AGENTS.md as well.

  1. Write what the agent cannot learn from the code. The exact build and test commands, the folder no change may touch, and the convention your team breaks on purpose. Gloaguen's results point here.7
  2. Cut the repository tour. An agent reads the tree faster than it reads your description of it, and the overview did not help in testing.7
  3. Keep each file under 200 lines. Anthropic says longer files cost more context and get followed less.2 Move a rule that applies to one package into that package's own file, or into a path-scoped rule that loads only when the agent touches matching files.
  4. State each rule once. Point at the decision record for the reason behind it. Decision records for coding agents covers how to write those so agents find them.
  5. Say what wins when the file and the code disagree. In one study of 40 small Python projects, agents followed a stale instruction file over the code in 90.1 percent of their choices. One sentence in the user-level file, telling the agent to trust the code, raised the choices that followed the code from 4.2 to 91.4 percent.9
  6. Give the file an owner and review it like code. It changes the way configuration code does, so it needs a reviewer who knows what each line is for.5
  7. Add the security and performance rules you care about. Each topic appears in about one file in seven.5

#Agent instruction context budget

Every line in an instruction file loads into every session that reads it, whether the task needs it or not. That is the agent instruction context budget: the tokens a team spends on standing rules before the agent reads a line of the task.

Each agent limits the budget in its own way. Codex stops adding files once their combined size reaches 32 KiB by default.3 It adds them from the root down, so the files cut first are the ones nearest the working folder, which hold the most specific rules. Claude Code caps the text a hook adds to a session at 10,000 characters. Past that, it saves the text to a file and shows the model a 2,000-character preview.10

Size is not the only cost. Jaroslawicz and colleagues gave 20 models up to 500 instructions at once.11 The best reached 68 percent accuracy at 500, and models favored the instructions placed earlier in the prompt. The instructions asked for keywords in a business report, not for coding rules, so the result shows a trend and not a limit for your file. Put the rules that matter most near the top.

Where a team's instruction can live

  1. Path-scoped ruleA rule in .claude/rules/ with paths, or a Cursor rule with globs. Loads when the agent touches a matching file.
  2. Package fileAn AGENTS.md in a package folder. Loads for work inside that folder.
  3. Repository fileAGENTS.md or CLAUDE.md at the root. Loads in every session in the repository.
  4. Personal file~/.codex/AGENTS.md or ~/.claude/CLAUDE.md. Loads in every session one person starts.
  5. Organization fileClaude Code's managed CLAUDE.md, pushed to each machine. Loads in every Claude Code session there.

Sessions that load it

Each rung reaches more sessions than the one below it. A line on a higher rung costs tokens in all of them, so put a rule on the lowest rung that covers it.

#How to share AGENTS.md across repositories

A rule that holds in every repository, such as "open a pull request, never push to main," has to reach every agent in every repository. Teams try four ways, and each leaves a gap.

  • Copy the file into each repository. It works on day one. Then one copy changes and the rest do not, which is how the opening's yarn line survived.
  • Ship a managed file to each machine. Claude Code reads an organization CLAUDE.md from a fixed path, pushed with device management tools, and the setting that skips other instruction files cannot skip it.2 It reaches Claude Code only, and Anthropic says to enforce rules with managed settings and use the file for guidance.
  • Keep it in each person's home folder. ~/.codex/AGENTS.md loads in every session that person starts.3 It is one person's copy.
  • Import it from a shared path. Claude Code asks for approval the first time a project imports a file from outside its folder.2 It still reaches one harness, and the import loads in full.

Oxagen starts from the files you already have. When a workspace links a repository, the Import step reads its default branch. It lists every harness file it finds: CLAUDE.md, AGENTS.md, Cursor rules, the GitHub coding assistant's instructions, skills, commands, subagent files, settings, and MCP configs.4 Each statement in a root CLAUDE.md or AGENTS.md becomes one steering record scoped to that repository, and a file in a subfolder is scoped to that folder too. A steering record is one reviewed instruction, stored in the workspace's steering repository, that Oxagen delivers to the agents it wraps.

The Repositories tab of Workspace settings, with illustrative data. Three linked repositories list the harness files Oxagen found: acme/platform holds CLAUDE.md, AGENTS.md, and .cursor/rules, acme/billing-service holds AGENTS.md, and acme/mobile holds CLAUDE.md and AGENTS.md.

Linked repositories and the harness files in each

The import shows each statement before anything changes. A statement that repeats a published record starts unticked. A statement that contradicts one waits for a person to keep the record or replace it. Everything you pick goes into one steering pull request, or several for an import over 299 files. Nothing steers an agent until the pull request merges.

The pnpm rule can live in one record scoped to the workspace instead of in twelve files. Publish it once, and the import lists the same statement in other repositories as a repeat and leaves it unticked. Changing the rule is one pull request, and the next wrapped run in each linked repository gets the new version.

#How Oxagen delivers one set of rules

For each run it wraps, Oxagen builds the steering from the workspace's records and the records scoped to the repository the run works in. A repository's records reach only runs in that repository. The text goes to Claude Code, Codex, Cursor, or Stella through the hook that starts the session. Its size follows the harness: 10,000 characters for Claude Code and 16,384 for the other three.4 A workspace can set a smaller budget, never a larger one.

When the records do not all fit, Oxagen ranks them. must comes before should, then the repository's own records before workspace records, then records agents used in the last 60 days before records nobody opened. A record that does not fit is skipped, and the next one still gets its chance. The run's record names every record it cut and why, so "did the agent get the rule" has an answer.

The Context panel on a run's page, with illustrative data. Messages take 84,600 tokens of the run's 200,000 and tools take 14,200. The panel counts 6 steering records included and 2 left out.

Steering records counted in a run's context

Instruction files keep changing after the import. Oxagen runs a check on pull requests in a linked repository. It reads the instruction files the pull request changes and compares each statement the pull request adds with the active steering records. A statement that repeats a record or contradicts one becomes a finding on the pull request. The check warns by default and blocks the merge only when the workspace turns that on. The Repositories page lists the findings, and a contradiction can become a suggested new version of the record it contradicts, through its own steering pull request.

Records also come from what people correct in the middle of a run, which steering drafted from corrections describes. Why a reviewed record does better than a longer file is the subject of what an agent should be told before it starts. For how one developer runs several agents under these rules from one console, read Oxagen for developers. The import guide lists every file Oxagen reads and what each one becomes.

#References

  1. AGENTS.md (2026). AGENTS.md: a simple, open format for guiding coding agents. Project site, stewarded by the Agentic AI Foundation. The 60,000 count is the site's own. https://agents.md ↩ ↩2

  2. Anthropic (2026). How Claude remembers your project. Claude Code documentation. https://code.claude.com/docs/en/memory ↩ ↩2 ↩3 ↩4 ↩5 ↩6

  3. OpenAI (2026). Custom instructions with AGENTS.md. Codex documentation. https://developers.openai.com/codex/guides/agents-md ↩ ↩2 ↩3 ↩4

  4. Oxagen (2026). Import agent configuration. Oxagen documentation. https://docs.oxagen.sh/docs/connections/import-agent-configuration ↩ ↩2 ↩3

  5. Chatlatanagulchai, W., Li, H., Kashiwa, Y., Reid, B., Thonglek, K., Leelaprute, P., Rungsawang, A., Manaskasemsak, B., Adams, B., Hassan, A. E., & Iida, H. (2025). Agent READMEs: An Empirical Study of Context Files for Agentic Coding. arXiv. https://arxiv.org/abs/2511.12884 ↩ ↩2 ↩3

  6. Lulla, J. L., Mohsenimofidi, S., Galster, M., Zhang, J. M., Baltes, S., & Treude, C. (2026). On the Impact of AGENTS.md Files on the Efficiency of AI Coding Agents. arXiv. https://arxiv.org/abs/2601.20404 ↩

  7. Gloaguen, T., Mündler-Sasahara, N., Müller, M. N., Raychev, V., & Vechev, M. (2026). Evaluating AGENTS.md: Are Repository-Level Context Files Helpful for Coding Agents? arXiv. https://arxiv.org/abs/2602.11988 ↩ ↩2 ↩3

  8. Khatri, P. (2026). Do Context Files Help Coding Agents? A Two-Agent Ablation Study on Real Repositories. REALM 2026. https://arxiv.org/abs/2607.27250 ↩

  9. Xu, X., & Wu, W. (2026). Stale Instruction Files Override the Code in Coding Agents: A One-Sentence Fix. arXiv preprint. https://arxiv.org/abs/2610.30571 ↩

  10. Anthropic (2026). Hooks reference. Claude Code documentation. https://code.claude.com/docs/en/hooks ↩

  11. Jaroslawicz, D., Whiting, B., Shah, P., & Maamari, K. (2025). How Many Instructions Can LLMs Follow at Once? arXiv. https://arxiv.org/abs/2507.11538 ↩