Agents.md best practices AGENTS.md has become the de facto open standard for guiding AI coding assistants, with adoption surpassing 20,000 repositories and formalization in August 2025 through collaboration between OpenAI, Google, Cursor, Factory, and Sourcegraph. The plain-Markdown, schema-free file acts as a "README for machines," giving agents exact environment setup, build and test commands, and code conventions, and it is now natively supported by GitHub Copilot, OpenAI Codex, Cursor, Google's Jules and Gemini, and others. OpenAI's main repository reportedly uses 88 AGENTS.md files across subcomponents, with the nearest file in the directory tree taking precedence. AGENTS.md has emerged as the de facto open standard for guiding AI coding assistants, now adopted by over 20,000 repositories and formalized in August 2025 through collaboration between OpenAI, Google, Cursor, Factory, and Sourcegraph. This file acts as a "README for machines"—providing structured, technical context that helps AI assistants write better code from the start. For Python + AWS + Terraform projects, a well-crafted AGENTS.md dramatically reduces friction, ensuring generated code follows your conventions, uses the right tools, and adheres to security requirements. AGENTS.md is a dedicated Markdown file that complements, not replaces, README.md . While README targets human developers with project overviews and quick-start guides, AGENTS.md contains detailed technical instructions specifically for AI coding agents. Think of it as onboarding documentation for an AI team member: exact commands to run, code patterns to follow, testing strategies, deployment workflows, and project-specific gotchas. The standard provides immediate benefits. AI assistants understand project requirements without a discovery phase, generated code adheres to team standards from the start, and code review cycles shrink. Most importantly, it works across the entire ecosystem—OpenAI Codex, GitHub Copilot, Cursor, Claude Code, Aider, and more—eliminating the need for multiple tool-specific configuration files. Key adoption milestone : GitHub Copilot added native AGENTS.md support in August 2025, joining OpenAI Codex, Cursor, Google's Jules and Gemini, Factory, Amp, Windsurf, Zed, and RooCode in supporting the standard. Android Studio's Gemini integration includes a context drawer specifically for managing AGENTS.md files. The standard intentionally remains simple and schema-free —just plain Markdown with no required structure. This flexibility drove adoption, but effective implementations follow consistent patterns. Use AGENTS.md plural as the primary filename. Place it at the repository root alongside README.md. For monorepos or complex projects, place additional AGENTS.md files in subdirectories—the nearest file in the directory tree takes precedence, creating a hierarchical configuration system. OpenAI's main repository uses this pattern with 88 AGENTS.md files across subcomponents. For backward compatibility with legacy tools, create symlinks: ln -s AGENTS.md CLAUDE.md ln -s AGENTS.md .github/copilot-instructions.md ln -s AGENTS.md .cursorrules Research across successful implementations reveals these core sections: Development environment setup comes first . List exact commands for dependency installation, environment configuration, package manager usage, and tool version requirements. Be concrete: Environment Setup - Python 3.12+ - Install UV: curl -LsSf https://astral.sh/uv/install.sh | sh - Create environment: uv venv && source .venv/bin/activate - Install dependencies: uv sync - Configure AWS: aws configure requires credentials Build and test commands second . Provide file-scoped commands preferentially—agents should be able to check single files without running full builds. This dramatically improves iteration speed: Commands File-scoped preferred - fast feedback uv run pytest tests/test handlers.py uv run ruff check src/handlers.py uv run mypy src/handlers.py Full suite only when explicitly requested uv run pytest --cov=src terraform fmt -recursive Code style and conventions third . Be explicit about formatting, naming patterns, architectural decisions, library preferences, and version-specific requirements: Code Style - Python: Follow PEP 8, use type hints mypy strict mode - Formatting: Ruff line length 88 - FastAPI: Async patterns for all I/O, Mangum for Lambda integration - PynamoDB: Always define table name and region in Meta class - Terraform: snake case naming, tag all resources environment, project, managed by - Never use @ts-ignore or hardcode credentials Testing instructions and requirements . Document test frameworks, locations, coverage expectations, and how to run different test types: Testing - Framework: pytest with moto for AWS service mocking - Unit tests: uv run pytest tests/unit/ - Integration: uv run pytest tests/integration/ requires Docker - Coverage requirement: 80%+ for new code - Mocking pattern: Use @mock dynamodb decorator for DynamoDB tests Project structure and key files . Help agents navigate your codebase without exploring repeatedly: Project Structure - src/handlers/ - Lambda function handlers thin, delegate to services - src/models/ - PynamoDB models DynamoDB and Pydantic models API validation - src/services/ - Business logic keep handlers thin - infrastructure/ - Terraform configs modules pattern, workspaces for environments - Key file: src/api/client.ts - Use this typed client, not raw fetch calls Safety and permission boundaries . Define what agents can do autonomously versus what requires approval: Permissions Allowed without prompting - Read files, list directories - Single file linting, type checking, formatting - Unit tests on specific files Require approval first - Package installations uv add , npm install - Git operations git push , git commit - File deletion - Running full build or E2E test suites - Terraform apply/destroy operations Pull request and commit guidelines . Ensure generated code follows team workflows: PR Requirements - Title format: component Brief description - Always run uv run pytest && uv run ruff check . before committing - Keep diffs small and focused - Tests required for new features - All CI checks must pass Keep AGENTS.md under 150 lines when possible. Agents load files into context windows, and excessive length wastes tokens while burying important information. For large projects, use nested AGENTS.md files in subdirectories or leverage file imports where supported: Root AGENTS.md You are an experienced Python developer. @./docs/python-guidelines.md Testing @./docs/testing-patterns.md Android Studio's Gemini and some other tools support this @./path/to/file.md syntax for modular documentation. Understanding how different tools consume AGENTS.md helps you write more effective instructions. OpenAI Codex automatically searches for AGENTS.md files whose scope includes modified files, prioritizing deeper nested instructions in a cascading configuration pattern. Contents are included in the system prompt, and Codex's /init command can generate an initial AGENTS.md by analyzing project structure. GitHub Copilot processes AGENTS.md server-side as of August 2025. It automatically detects and appends contents to system prompts for Copilot Chat, Coding Agent, and Code Review features. Path-specific instructions use YAML frontmatter with glob patterns: --- applyTo: "src/handlers/ / .py" --- Lambda handler instructions here Cursor IDE supports both simple AGENTS.md automatic detection at project root and an advanced .cursor/rules/ system with .mdc files that include metadata for conditional loading: --- description: "DynamoDB model standards" globs: "src/models/ / .py" alwaysApply: false --- PynamoDB patterns and conventions Cursor offers four rule types: Always always included , Auto Attached included when matching files are referenced , Agent Requested AI decides based on description , and Manual only when explicitly mentioned . Claude Code primarily uses CLAUDE.md but reads AGENTS.md via symlinks. Its /init command generates customized project instructions including code hooks for pre/post-edit validation. Claude Code supports hierarchical files where the most nested takes precedence, and integrates with a Skills system—organized folders with SKILL.md files for specialized capabilities. Other tools : Aider requires configuration via .aider.conf.yml read: AGENTS.md , Gemini CLI via .gemini/settings.json {"contextFileName": "AGENTS.md"} , and most modern tools either support AGENTS.md natively or through simple configuration. Different tools have varying token limits: OpenAI Codex offers 128k-192k tokens, Claude Opus 4 provides 200k, GitHub Copilot varies by model GPT-4o ~128k, Claude available , and Gemini reaches 1 million tokens 2 million for Pro . Tools employ several context prioritization strategies. Proximity-based approaches favor closer or nested files. Relevance-based systems let the AI decide what's important from file descriptions. Explicit @-mentions force inclusion. Automatic trimming removes older context as limits approach. Hierarchical merging combines parent and child rules. Most tools combine multiple search approaches. Text-based search grep, ripgrep provides fast exact matches. Semantic search with vector embeddings finds conceptually related code. AST-based search parses code structure for accurate, language-aware results. Effective AGENTS.md files account for these by providing clear, searchable keywords and explicit file paths. The most effective AGENTS.md files lead with commands rather than explanations. Setup commands first, testing second, deployment third, debugging last. From OpenAI's sample: Dev environment tips - Use pnpm dlx turbo run where