How do you build AGENTS.md for AI coding in 2026?

Jeffrey Liu··5 min read·2 sources·AI
How do you build AGENTS.md for AI coding in 2026?

Key Takeaways

  1. 1AGENTS.md, standardized by the Linux Foundation in Dec 2025, provides crucial project-specific guidance like build commands and conventions, directly addressing AI coding agents' lack of inherent context.
  2. 2Prioritize human-curated AGENTS.md files: ETH Zurich research shows they offer a 4% performance boost, whereas LLM-generated versions decrease success rates and inflate inference costs by 20-23%.
  3. 3Maximize impact by detailing only non-inferable project specifics in AGENTS.md, such as custom commands, exact stack versions, and unique architectural patterns, avoiding redundant codebase overviews.
  4. 4Expect a ~20% inference cost increase with AGENTS.md, but human-curated files justify this with performance gains; for large projects, modularize files exceeding 150-200 lines to optimize token budgets.

AGENTS.md is a Markdown file providing AI coding agents with project-specific operational guidance like build commands and conventions, established in December 2025 under the Linux Foundation's Agentic AI Foundation to standardize context for autonomous AI, according to Augment Code.

Key Points:

    • AGENTS.md offers persistent, project-specific context for AI coding agents to overcome their inherent lack of detailed project knowledge.

    • ETH Zurich research shows human-curated files modestly improve agent performance by roughly 4%, while LLM-generated ones reduce success rates and increase costs.

    • The file should focus on non-inferable details, such as custom build commands and unique tooling, to avoid redundancy with existing documentation.

AI coding agents, whether Claude Code or GitHub Copilot, start each session without specific project conventions. They know general programming languages but not unique team practices.

This lack of context led to a proliferation of tool-specific files until AGENTS.md emerged, offering a single, predictable location for critical instructions, similar to a README for agents.

Why Do AI Agents Need Specific Context Files?

Agents lack project-specific details such as custom commands, coding conventions, or testing rules, requiring context files to perform accurately. While they understand general languages like Python or TypeScript, they cannot infer unique team practices or forbidden zones independently, according to Augment Code.

Before AGENTS.md, development teams managed a disparate collection of files like CLAUDE.md and copilot-instructions.md. These files often contained similar content, leading to maintenance challenges and consistency drift.

OpenAI initially pioneered the AGENTS.md format for its Codex model. In December 2025, it was donated to the Linux Foundation's Agentic AI Foundation to foster standardization.

File

Primary Audience

Purpose

README.md

Human developers

Project overview, installation, usage

CONTRIBUTING.md

Human contributors

How to submit PRs, code style for humans

AGENTS.md

AI coding agents

Build commands, test runners, conventions, constraints

How Effective Are Different Context File Approaches?

ETH Zurich research in 2026 found that LLM-generated context files reduce AI agent task success rates by 0.5% to 2% and increase inference costs by 20% to 23%. In contrast, human-curated files yield a marginal 4 percentage point performance gain, making manual curation essential, according to Augment Code.

The study emphasized that LLM-generated files often duplicate existing documentation, adding cost without improving performance. Human-written files are effective when they focus on details agents cannot infer from the codebase.

Context File Type

Cost Increase

Task Success Change

LLM-generated (auto-init)

+20 to 23%

−0.5% (SWE-bench Lite) to −2% (AGENTbench)

Developer-written (human-curated)

Up to 19% (shorter files, lower cost than LLM-generated)

Marginal improvement (AGENTbench)

No context file

Baseline

Baseline

What Should an AGENTS.md File Include?

Effective AGENTS.md files prioritize minimal requirements, custom commands, and specific tooling choices that agents cannot infer, avoiding codebase overviews or architecture summaries. Core sections include stack definitions with exact versions, executable commands, coding conventions, testing rules, and "don't touch" zones, as recommended by OpenAI and GitHub analysis.

Key content includes specifying exact stack versions (e.g., Node 22.x, pnpm), full executable commands (`npm install`, `npm run typecheck`), and concise coding conventions. Documenting counterintuitive patterns like a custom `ApiResult` instead of exceptions proves highly valuable.

Testing rules (e.g., unit tests for new functionality, mocking dependencies) and clear boundaries (e.g., "Never commit secrets") also guide agent behavior effectively. The file should focus on non-standard tooling where agents lack inherent knowledge.

What About Modularity and Multi-Tool Support?

While AGENTS.md aims for a cross-tool standard, tool-specific variants like CLAUDE.md or .cursorrules persist. For multi-tool teams, symlinking AGENTS.md to tool-specific files (e.g., CLAUDE.md is a symlink to AGENTS.md) prevents content divergence.

Modular organization becomes necessary for larger projects, typically when a root AGENTS.md exceeds 150-200 lines. Files can be placed at any directory level, with more deeply nested files taking precedence in case of conflicting instructions, per the Codex spec.

Condition

Approach

Single root file under 150-200 lines

Monolithic root file sufficient

Rules exceed 150-200 lines

Split: root for org standards, subdirectory files for specifics

Multiple AI tools in use

Canonical AGENTS.md + tool-specific symlinks

What Is the Cost of Using AGENTS.md?

Implementing AGENTS.md files incurs an inference overhead of roughly 20% regardless of whether they are auto-generated or human-written, primarily due to increased token processing. For a task with 50K input tokens and 5K output tokens, this can translate to a monthly overhead of ~$45 for 1,000 tasks, according to Augment Code.

The overhead applies because the agent processes the context file as part of its input. Prompt caching can mitigate this, as cache reads are significantly cheaper than standard input pricing. Human-curated files are worth the cost due to performance gains.

Metric

Value

Inference cost increase (LLM-generated context files)

20 to 23%

Inference cost increase (developer-provided context files)

Up to 19%

Reasoning token increase (GPT-series, LLM-generated files)

+14% to +22%

Reasoning token increase (GPT-series, human-written files)

+2% to +20%

How Does AGENTS.md Address Agent Limitations?

AI coding agents, while proficient in general programming tasks, are inherently limited by their lack of project-specific contextual understanding, leading to errors and inefficiencies. AGENTS.md aims to bridge this gap by providing explicit instructions that define unique project rules, build systems, and architectural constraints, thereby enhancing an agent's ability to operate within a specific codebase effectively.

Failure patterns include auto-generated files reducing success rates and increasing costs, and context file bloat leading to poor performance. Developers must respond to observed agent failures with new rules, rather than speculative generation, and maintain short, focused files to avoid issues like silent rule dropout in long sessions.

Manual AGENTS.md files face a maintenance challenge as codebases evolve, leading to staleness. Solutions like Augment Code's Context Engine and Intent's living specs aim to automate context management, with agents updating the spec as they work, addressing the drift problem.

Dimension

Manual AGENTS.md

Intent's Context Engine

Maintenance

Developer writes and updates manually

Agents update the living spec as they work

Scope

Single Markdown file at repo root

Real-time semantic index across hundreds of thousands of files

Staleness risk

Requires manual remediation after refactors

Real-time indexing

🛠️ How do you build AGENTS.md for AI coding in 2026?

A guide to creating and managing AGENTS.md files, which provide project-specific operational guidance to AI coding agents, covering best practices for content, structure, and maintenance to enhance agent performance and efficiency.

  1. 1

    Manually Curate AGENTS.md

    Prioritize human curation for your AGENTS.md files, as automated generation is costly and has been shown to reduce AI agent performance.

  2. 2

    Document Unique Project Details

    Focus on including only information that AI agents cannot infer from the codebase, such as custom build commands, specific tooling choices, and unique architectural patterns, to maximize the file's signal-to-noise ratio.

  3. 3

    Modularize for Large Projects

    For larger projects, consider splitting AGENTS.md into subdirectories once the root file exceeds 150-200 lines to manage token budgets and maintain clarity. Remember that more deeply nested files take precedence in case of conflicting instructions.

  4. 4

    Plan for Ongoing Maintenance

    Recognize that AGENTS.md files require ongoing maintenance as codebases evolve. Be prepared to update them regularly or explore automated context management solutions to prevent staleness and ensure accuracy.

  5. 5

    Implement Security Guardrails

    Even with AGENTS.md in place, implement additional security guardrails, such as execution containers, to mitigate potential risks associated with AI agent operations and address security vulnerabilities.

What This Means For You

1

Manually Curate AGENTS.md for Performance

Prioritize writing AGENTS.md files by hand, focusing on non-inferable custom commands and unique project rules. Avoid LLM-generated versions, which decrease agent success rates and increase costs.

2

Optimize AGENTS.md for Cost and Efficiency

Direct your teams to create concise, human-curated AGENTS.md files that target specific agent knowledge gaps. Plan for modularity in large projects to manage token costs and ensure long-term maintainability.

3

Standardize AGENTS.md Integration and Evolution

Fully support the AGENTS.md standard within your AI coding agents to ensure broad compatibility and context. Invest in research or integration of automated context management solutions to overcome manual file maintenance challenges.

4

Implement Agent Security Measures Proactively

Collaborate with development teams to implement execution containers or similar sandboxing for AI coding agents. Regularly audit agent interactions to mitigate risks highlighted by critical vulnerabilities in AI tools.

FAQ

AGENTS.md is a Markdown file designed to provide AI coding agents with project-specific operational guidance, such as build commands and conventions. Established in December 2025 under the Linux Foundation's Agentic AI Foundation, its primary purpose is to standardize context for autonomous AI, helping agents overcome their inherent lack of detailed project knowledge.

Human-curated AGENTS.md files are more effective because research from ETH Zurich shows they can modestly improve AI agent performance by roughly 4%. In contrast, LLM-generated context files reduce success rates by 0.5% to 2% and increase inference costs by 20% to 23%, often duplicating existing documentation without adding value.

An effective AGENTS.md file should prioritize non-inferable details that AI agents cannot deduce, such as custom build commands, unique tooling, exact stack versions, executable commands, coding conventions, testing rules, and 'don't touch' zones. It should avoid general codebase overviews or architecture summaries to maintain focus and efficiency.

Implementing AGENTS.md files incurs an inference overhead of approximately 20% due to increased token processing, regardless of whether they are auto-generated or human-written. For example, a task with 50K input tokens and 5K output tokens could lead to a monthly overhead of about $45 for 1,000 tasks, though prompt caching can help mitigate this cost.

AGENTS.md addresses AI coding agents' limitations by providing explicit, project-specific instructions that define unique rules, build systems, and architectural constraints. This helps agents overcome their lack of contextual understanding and perform accurately within a specific codebase, preventing errors and inefficiencies that arise from inferring unique team practices.

Related Articles

More insights on trending topics and technology

Newsletter

We read 100+ sources so you don't have to.

One email. Delivered weekly. The AI and tech stories actually worth your time.