Agents Standard

The AGENTS.md hierarchical configuration standard for AI agents.

Specification

One file convention. Five-tier loading. All agents.

The standard unifies project instructions by separating what/why (Project PRD) from how (Behavioral Rules):

Project PRD โ€” llms.txt at repository root
The globalized Project Requirements Document (PRD) detailing active goals, architecture, tech stack, and scope. Loaded second.

Global Base โ€” ~/.agents/AGENTS.md
User-level safety rules, identity, formatting preferences, and safety policies. Loaded first.

Project Base โ€” .agents/AGENTS.md at repository root
Team-shared static conventions, committed project standards, and styling guidelines. Loaded third.

Project Active โ€” AGENTS.md at repository root
Task-specific active instructions and session rules. Highly visible, commonly modified, symlinked by agents. Loaded fourth.

Folder โ€” AGENTS.md in any subdirectory (optional)
Component-specific rules. Directory-scoped overrides (e.g. src/AGENTS.md, tests/AGENTS.md). Loaded last.

Loading Model: Scoped Concatenation

Each tier's file is concatenated into the agent's context โ€” not replaced. The project root acts as a ceiling โ€” agents never traverse above it. Your security practices in ~/.agents/AGENTS.md always apply; the project PRD in llms.txt sets functional scope; project base conventions build on top; active task instructions direct the session; and folder-specific rules apply locally. Never read files from parent directories outside the project.

~/.agents/AGENTS.md โ€” Loaded first, always. Canonical global standard location for user safety and preferences.

{project_root}/llms.txt โ€” Loaded second. Defines active requirements, goals, APIs, and roadmap (functional PRD).

{project_root}/.agents/AGENTS.md โ€” Loaded third. Committed project standards, tech choices, and architecture rules.

{project_root}/AGENTS.md โ€” Loaded fourth. Project active task rules. Task-specific instructions modified frequently.

{cwd}/AGENTS.md โ€” Loaded last (optional). Folder/component-specific rules (e.g. src/AGENTS.md, tests/AGENTS.md).

Project Root Detection & Ceiling

Agents detect the project root from the shell's initial $PWD at launch time โ€” the directory the terminal was opened in. Optionally, $AGENTS_ROOT can be set to override this. Agents must never traverse above this ceiling. If a user cd .. past the project root, only ~/.agents/AGENTS.md applies โ€” no parent directory AGENTS.md files are picked up. This prevents accidentally reading unrelated rules (e.g. a github repo management AGENTS.md one level up).

Resolution Order

  1. Load ~/.agents/AGENTS.md (global base โ€” always loaded first, user-specific rules)
  2. Detect project root from inherited shell $PWD or $AGENTS_ROOT
  3. Load {project_root}/llms.txt (project PRD, functional roadmap)
  4. Load {project_root}/.agents/AGENTS.md (project base rules, committed)
  5. Load {project_root}/AGENTS.md (project active rules, symlinked)
  6. Load {cwd}/AGENTS.md if cwd is within project boundary (component rules, optional)
  7. Concatenate in order: global โ†’ project base โ†’ project active โ†’ folder
  8. Never traverse above the detected project root

Singular Rules File Fallback

If an agent only supports a single rules file, it should read the project root AGENTS.md (or the symlinked file like CLAUDE.md) to get the active task context. This is the canonical touchpoint for active task instructions. Alternatively, it can read the global ~/.agents/AGENTS.md. Tools that only read one file are first-class citizens.

Dual-Layer MCP Configuration

MCP servers follow a two-layer model โ€” global shared, agent-specific extended:

~/.agents/mcp-settings.json โ€” Global MCP servers available across all agents and IDEs. Shared foundation. Configure once, every agent gains access. Browsers, search, filesystem, memory, databases โ€” set them here.

Agent-specific MCP config โ€” Each agent can also read its own MCP config (~/.claude.json, .cursor/mcp.json, ~/.gemini/settings.json, etc.) for finer customization. Agent-specific configs extend โ€” not replace โ€” the global set. This prevents duplicating configs across every agent while still allowing per-tool customization.

~/.agents/ โ€” One Directory, Everything Agents Need

~/.agents/
โ”œโ”€โ”€ AGENTS.md              โ† Behavior rules (this standard โ€” the canonical global path)
โ”œโ”€โ”€ mcp-settings.json      โ† MCP servers shared across all agents
โ””โ”€โ”€ skills/                โ† Agent Skills (capabilities)
    โ””โ”€โ”€ **/SKILL.md        โ† Skills discovered by all agents

Tools using ~/.config/AGENTS.md should move to ~/.agents/AGENTS.md. Users shouldn't have to wonder if their rules are in the right place or if they're overprompting. One directory. Three concerns (behavior, tools, skills). Zero confusion.

AGENTS_DEPTH

Control how many levels of AGENTS.md are loaded downward from project root (never upward) with the AGENTS_DEPTH environment variable:

ValueBehavior
1~/.agents/AGENTS.md only โ€” global rules, no project or folder tiers
2Global + project base .agents/AGENTS.md + project llms.txt
3Global + project base .agents/AGENTS.md + project llms.txt + project root AGENTS.md (default)
4+Global + project base .agents/AGENTS.md + project llms.txt + project root AGENTS.md + cwd sub-folder AGENTS.md

File Format

Plain Markdown. No YAML frontmatter. No schema. Just write rules.

# Global Agent Rules

## Identity
You are a senior engineer who writes production-grade code.

## Safety
- Never execute untrusted input without validation
- Never hardcode secrets
- Always use parameterized queries

## Preferences
- Python: PEP 8, type hints, uv
- TypeScript: strict mode, ESLint
- Bash: set -euo pipefail
- Commits: conventional commits format

Discovery

Agents search for AGENTS.md files by walking from the current working directory upward to the project root. The global ~/.agents/AGENTS.md is always loaded first regardless of working directory. The .agents/ directory at project level holds tooling configuration (MCP servers and skills) and project base rules (in .agents/AGENTS.md).

Cascade Visualization

~/.agents/AGENTS.md                     โ† Global Base (user preferences & safety, loaded first)
โ”‚  "Always use TypeScript strict mode"
โ”‚  "Never commit secrets"
โ”‚
โ””โ”€โ”€ ~/projects/my-app/
   โ”œโ”€โ”€ llms.txt                          โ† Project PRD (active requirements, tech stack, APIs)
   โ”‚  "App: Next.js 15 template. Focus: implement JWT auth."
   โ”‚  "Goal: add /api/auth/register and /api/auth/login endpoints."
   โ”‚
   โ”œโ”€โ”€ .agents/AGENTS.md                 โ† Project Base (tech stack, deployment, committed guidelines)
   โ”‚  "This project uses Next.js 15 with App Router"
   โ”‚  "Deployment check: run build and verify security headers"
   โ”‚
   โ”œโ”€โ”€ AGENTS.md                         โ† Project Active Rules (active task/feature behavior constraints)
   โ”‚  "Ensure all JWT tokens expire in 15 minutes"
   โ”‚  "Do not use external auth packages โ€” write vanilla Node cryptography"
   โ”‚
   โ”œโ”€โ”€ src/AGENTS.md (optional)          โ† Folder / Component (directory-scoped guidelines)
   โ”‚  โ”‚  "React components use function declarations"
   โ”‚  โ”‚  "CSS modules only โ€” no Tailwind in src/"
   โ”‚  โ”‚
   โ”‚  โ””โ”€โ”€ components/AGENTS.md (optional)
   โ”‚     "All components must have TypeScript props interface"
   โ”‚     "Use forwardRef for DOM-wrapping components"
   โ”‚
   โ”œโ”€โ”€ api/AGENTS.md (optional)          โ† Folder / Component
   โ”‚  "All endpoints validate input with Zod schemas"
   โ”‚  "Return typed responses, never any"
   โ”‚
   โ”œโ”€โ”€ tests/AGENTS.md (optional)         โ† Folder / Component
   โ”‚  "Test files mirror src/ structure"
   โ”‚  "Use describe/it blocks, not test()"
   โ”‚
   โ””โ”€โ”€ .agents/                          โ† Tooling (MCP + Skills)
      โ”œโ”€โ”€ mcp-settings.json              โ† project MCP servers
      โ””โ”€โ”€ skills/**/SKILL.md             โ† project skills

Agent Config Map

Every major agent tool has its own config file. The AGENTS.md standard can symlink into each one so you maintain rules in one place. Each path is verified against the agent's official documentation.

AgentConfig FileProject PathGlobal PathDocs
PiAGENTS.mdAGENTS.md~/.agents/AGENTS.md nativedocs
Claude CodeCLAUDE.mdCLAUDE.md~/.claude/CLAUDE.mddocs
AgyGEMINI.mdGEMINI.md~/.gemini/GEMINI.mddocs
OpenAI CodexAGENTS.mdAGENTS.md~/.codex/instructions.mddocs
Cursor.cursorrules.cursorrules~/.cursor/rules/docs
GitHub Copilotcopilot-instructions.md.github/copilot-instructions.mdSettings UIdocs
Windsurf.windsurfrules.windsurfrules~/.codeium/windsurf/docs
Cline.clinerules.clinerules~/.cline/cline_rulesdocs
Roo Code.roorules.roorules~/.roo/rules/docs
Kirokiro.md.kiro/kiro.md~/.kiro/kiro.mddocs
Kilo CodeAGENTS.mdAGENTS.mdโ€” nativedocs
Aider.aider.conf.yml.aider.conf.yml~/.aider.conf.ymldocs
Continueconfig.json.continue/config.json~/.continue/config.jsondocs
Augment.augment-guidelines.augment-guidelines~/.augment/guidelinesdocs
Goosegoosehints.goosehints~/.config/goose/goosehintsdocs
Junie.junie/guidelines.md.junie/guidelines.md~/.junie/guidelines.mddocs
Trae.trae/rules/.trae/rules/~/.trae/rules/docs
Devininstructions.md.devin/instructions.mdSettings UIdocs
Warpwarp.mdWARP.mdโ€”docs
CodeWhaleAGENTS.mdAGENTS.md~/.agents/AGENTS.md nativedocs
Hermes AgentAGENTS.mdAGENTS.md~/.hermes/SOUL.mddocs
Agent Zero (a0)AGENTS.mdAGENTS.mdโ€”docs
CrushAGENTS.mdCRUSH.md~/.config/crush/crush.mddocs
OpenCodeAGENTS.mdAGENTS.mdโ€” nativedocs
Deep Agents (dcode)AGENTS.md.deepagents/AGENTS.md~/.deepagents/AGENTS.md nativedocs
Qwen CodeQWEN.mdQWEN.mdโ€”docs
Mistral CodestralCODESTRAL.mdCODESTRAL.mdโ€”docs
ZedAGENTS.mdAGENTS.md~/.config/zed/AGENTS.md nativedocs
MiniCCAGENTS.mdAGENTS.md~/.minicc/AGENTS.mddocs
fcc-claudeAGENTS.mdAGENTS.md~/.fcc/.envdocs

MCP Config Map

Each agent also has its own location for MCP server configurations. Here's where every agent stores its MCP settings, verified against official documentation.

AgentGlobal MCP ConfigProject MCP ConfigFormat
Claude Code~/.claude.json.mcp.jsonJSON
Agy / Gemini CLI~/.gemini/settings.json.gemini/settings.jsonJSON
OpenAI Codex~/.codex/config.tomlโ€”TOML
Cursor~/.cursor/mcp.json.cursor/mcp.jsonJSON
Windsurf~/.codeium/windsurf/mcp_config.jsonโ€”JSON
GitHub CopilotSettings UI.github/copilot-mcp.jsonJSON
ClineVS Code globalStorageโ€”JSON
Roo CodeExtension settings.roo/mcp.jsonJSON
Kiro~/.kiro/settings/mcp.json.kiro/settings/mcp.jsonJSON
Kilo CodeExtension settingskilo.jsoncJSONC
Goose~/.config/goose/config.yamlโ€”YAML
Junie~/.junie/mcp.json.junie/mcp/mcp.jsonJSON
Trae~/Library/Application Support/Trae/User/mcp.jsonโ€”JSON
Crush~/.config/crush/crush.jsoncrush.jsonJSON
OpenCode~/.config/opencode/opencode.jsonopencode.jsonJSONC
Deep Agents (dcode)~/.deepagents/.mcp.jsonโ€”JSON
Qwen Code~/.qwen/settings.json.qwen/settings.jsonJSON
Continue~/.continue/config.yaml.continue/mcpServers/YAML
MiniCC~/.minicc/mcp.json.minicc/mcp.jsonJSON
WarpWarp Drive UI.warp/mcp.jsonJSON
Hermes Agent~/.hermes/config.yamlโ€”YAML

The Problem This Standard Solves

Every agent stores MCP configs in a different file, different format, different path. JSON, YAML, TOML, JSONC. Global-only, project-only, both. This standard proposes ~/.agents/mcp-settings.json as a universal MCP config that agents can read โ€” and ~/.agents/skills/**/SKILL.md as a universal skills directory โ€” so users configure once and all agents follow.

LLM Providers

Every agent needs a model. Here are all the LLM API providers, their endpoints, auth patterns, free tiers, and referral links. Plug these into any agent's config.

ProviderKey ModelsAPI Base URLAuth Env VarFree Tier
AnthropicClaude Opus 4.7, Sonnet 4.6, Haiku 4.5https://api.anthropic.com/v1ANTHROPIC_API_KEYโ€”
OpenAIGPT-5.4, GPT-5.3, o4-minihttps://api.openai.com/v1OPENAI_API_KEYโ€”
Google GeminiGemini 2.5 Pro, 2.5 Flashhttps://generativelanguage.googleapis.com/v1betaGEMINI_API_KEYFlash free
DeepSeekDeepSeek-V4, V3, Coder-V2https://api.deepseek.com/v1DEEPSEEK_API_KEYโ€”
OpenRouter250+ models from all providershttps://openrouter.ai/api/v1OPENROUTER_API_KEYFree models
z.ai / ZhipuAIGLM-5.1, GLM-4.7https://api.z.ai/api/coding/paas/v4ZAI_API_KEYโ€”
Wafer AIGLM-5.1, various modelshttps://api.wafer.ai/v1WAFER_API_KEYโ€”
Mistral AIMistral Large 3, Codestralhttps://api.mistral.ai/v1MISTRAL_API_KEYFree (rated)
GroqLlama 4, Mixtral, Gemma 3https://api.groq.com/openai/v1GROQ_API_KEYFree 30r/m
xAI / GrokGrok-4, Grok-3https://api.x.ai/v1XAI_API_KEYโ€”
Together AILlama 4, DeepSeek, Qwenhttps://api.together.xyz/v1TOGETHER_API_KEY$1 credit
Fireworks AILlama 4, Qwen, DeepSeekhttps://api.fireworks.ai/inference/v1FIREWORKS_API_KEY100r/d
OllamaLlama 4, Qwen 3, Gemma 3http://localhost:11434/v1โ€”Free
LM StudioAny GGUF from Hugging Facehttp://localhost:1234/v1โ€”Free

Referral Links

Sign up through these links to support the Agents Standard project:

z.ai / ZhipuAI โ€” GLM-5.1, GLM-4.7 models. Use code B50UECNB9T at z.ai/subscribe

OpenCode AI โ€” API access to open-weight coding models. Use code APBJCPVXC1 at opencode.ai/go

Wafer AI โ€” Use referral code 8b2ul8o0 when signing up at wafer.ai

Using Providers With Any Agent

Most coding agents support OpenAI-compatible endpoints. Point any agent at a provider by setting the base URL and API key:

# Example: Point Claude Code at OpenRouter
export ANTHROPIC_BASE_URL="https://openrouter.ai/api/v1"
export ANTHROPIC_API_KEY="sk-or-..."

# Example: Point Codex at z.ai
export OPENAI_BASE_URL="https://api.z.ai/api/coding/paas/v4"
export OPENAI_API_KEY="zai-..."

Full structured data: providers.json โ€” machine-readable provider endpoints, auth patterns, and referral codes.

Create ~/.agents/AGENTS.md as your global rules file, then symlink it to every agent's config location:

#!/usr/bin/env bash
set -euo pipefail

# Create global AGENTS.md if it doesn't exist
mkdir -p ~/.agents
touch ~/.agents/AGENTS.md

# Symlink to every agent's global config
# (ln -sf overwrites existing symlinks, safe to re-run)

# Pi โ€” native support, already reads ~/.agents/AGENTS.md
# (no symlink needed)

# Claude Code
mkdir -p ~/.claude
ln -sf ~/.agents/AGENTS.md ~/.claude/CLAUDE.md

# Agy / Gemini CLI
mkdir -p ~/.gemini
ln -sf ~/.agents/AGENTS.md ~/.gemini/GEMINI.md

# OpenAI Codex
mkdir -p ~/.codex
ln -sf ~/.agents/AGENTS.md ~/.codex/instructions.md

# Cursor
mkdir -p ~/.cursor/rules
ln -sf ~/.agents/AGENTS.md ~/.cursor/rules/agents-standard

# Windsurf
mkdir -p ~/.codeium/windsurf
ln -sf ~/.agents/AGENTS.md ~/.codeium/windsurf/rules

# Cline
mkdir -p ~/.cline
ln -sf ~/.agents/AGENTS.md ~/.cline/cline_rules

# Roo Code
mkdir -p ~/.roo/rules
ln -sf ~/.agents/AGENTS.md ~/.roo/rules/agents-standard

# Kiro
mkdir -p ~/.kiro
ln -sf ~/.agents/AGENTS.md ~/.kiro/kiro.md

# Goose
mkdir -p ~/.config/goose
ln -sf ~/.agents/AGENTS.md ~/.config/goose/goosehints

# Junie
mkdir -p ~/.junie
ln -sf ~/.agents/AGENTS.md ~/.junie/guidelines.md

# Augment
mkdir -p ~/.augment
ln -sf ~/.agents/AGENTS.md ~/.augment/guidelines

# Trae
mkdir -p ~/.trae/rules
ln -sf ~/.agents/AGENTS.md ~/.trae/rules/agents-standard

# Crush
mkdir -p ~/.config/crush
ln -sf ~/.agents/AGENTS.md ~/.config/crush/crush.md

# Hermes Agent
mkdir -p ~/.hermes
ln -sf ~/.agents/AGENTS.md ~/.hermes/SOUL.md

# MiniCC
mkdir -p ~/.minicc
ln -sf ~/.agents/AGENTS.md ~/.minicc/AGENTS.md

# Deep Agents (dcode)
mkdir -p ~/.deepagents
ln -sf ~/.agents/AGENTS.md ~/.deepagents/AGENTS.md

echo "Done. Edit ~/.agents/AGENTS.md โ€” all symlinked agents follow your rules."
echo "See https://agentsstandard.com for project-level setup."

Project-level setup

Create llms.txt at your repo root for the Project PRD (functional requirements, scope, tech stack), .agents/AGENTS.md for static project base rules (framework choice, deployment checklists, static guidelines), and create AGENTS.md at your repo root for active task instructions (symlinked to agent-specific configs):

# In your project root:
# 1. Write your Project PRD
cat > llms.txt <<'EOF'
# Project PRD: JWT Authentication
- Stack: Next.js 15, TypeScript, PostgreSQL
- Features: User registration and login with JWT tokens
- APIs: /api/auth/register and /api/auth/login
EOF

# 2. Write your static project rules
mkdir -p .agents
cat > .agents/AGENTS.md <<'EOF'
# Project Base Rules
- Tech stack: Next.js 15 (App Router)
- Linting: ESLint strict mode
- Deployment check: run npm run build and check bundle sizes
EOF

# 3. Write your active session rules
cat > AGENTS.md <<'EOF'
# Active Session
- Focus on JWT cryptography implementation in Node.js
- Do not use external auth packages โ€” write vanilla crypto
- Refer to llms.txt for API schema requirements
EOF

# Symlink agent-specific files to the root AGENTS.md
ln -sf AGENTS.md CLAUDE.md
ln -sf AGENTS.md .cursorrules
ln -sf AGENTS.md .windsurfrules
ln -sf AGENTS.md .clinerules
ln -sf AGENTS.md .roorules
ln -sf AGENTS.md GEMINI.md
ln -sf AGENTS.md CODESTRAL.md
ln -sf AGENTS.md QWEN.md
ln -sf AGENTS.md CRUSH.md

# GitHub Copilot uses a different path
mkdir -p .github
ln -sf ../AGENTS.md .github/copilot-instructions.md

# Use .agents/ for tooling configuration and project base rules
mkdir -p .agents/skills
# .agents/AGENTS.md          โ€” project base rules
# .agents/mcp-settings.json  โ€” project MCP servers
# .agents/skills/**/SKILL.md โ€” project agent skills

Adopt the Standard

For agent tool developers:

  1. Search for ~/.agents/AGENTS.md at startup โ€” load as global user rules (loaded first)
  2. Load llms.txt at repo root โ€” project-wide PRD context (loaded second)
  3. Load .agents/AGENTS.md at repo root โ€” project base rules (loaded third)
  4. Load AGENTS.md at repo root โ€” project active / session rules (loaded fourth)
  5. Walk from cwd upward collecting AGENTS.md files within the project boundary โ€” folder-scoped rules (optional, loaded last)
  6. Merge rules: global as base, most specific scope wins conflicts

That's it. Four steps. No dependencies. No schema. No build step. Just markdown files in directories.

Why this works: It follows conventions every developer already knows โ€” .editorconfig, .eslintrc, .gitignore, pyproject.toml. Directory-scoped, cascading, plain text. No new concepts to learn.

Beyond Rules: A Complete Agent Configuration Directory

The ~/.agents/ directory can serve as a single source of truth for all agent configuration โ€” not just behavior rules:

~/.agents/
โ”œโ”€โ”€ AGENTS.md              โ† Behavior rules (global base, loaded first)
โ”œโ”€โ”€ mcp-settings.json      โ† MCP server configs (all agents read from here)
โ””โ”€โ”€ skills/                โ† Agent Skills (reusable capabilities)
    โ””โ”€โ”€ **/SKILL.md        โ† Skills discovered by all agents

{project}/.agents/             โ† Tooling & project base rules
โ”œโ”€โ”€ AGENTS.md              โ† Project base rules (tech stack, deployment)
โ”œโ”€โ”€ mcp-settings.json      โ† Project-specific MCP servers
โ””โ”€โ”€ skills/**/SKILL.md     โ† Project-specific agent skills

AGENTS.md = how the agent should behave (this standard)
mcp-settings.json = what tools the agent can use (MCP servers)
skills/**/SKILL.md = what the agent can do (Agent Skills)

Relationship to Agent Skills

The Agent Skills standard defines how agents discover and load capabilities (SKILL.md files). The AGENTS.md standard defines how agents discover and load behavior rules. They complement each other:

Contribute

Agent tool updated its config location? New agent on the market? Agent now supports ~/.agents/AGENTS.md natively?

Open an issue to:

Spec repo: nbiish/agents-standard (public)

Site repo: nbiish/agentsstandard-dot-com (public โ€” issues welcome)