Guide

Rules and instruction files in every AI coding agent: .cursor/rules, CLAUDE.md, AGENTS.md, GEMINI.md, Copilot instructions and more (2026)

Which rules or instructions file does each AI coding agent read, and does AGENTS.md work everywhere?

Cursor reads .mdc files in .cursor/rules plus AGENTS.md. Claude Code reads CLAUDE.md and falls back to AGENTS.md when there is no CLAUDE.md. Codex, Amp, Kiro and Junie read AGENTS.md natively. Gemini CLI reads GEMINI.md and can be pointed at AGENTS.md with context.fileName. GitHub Copilot reads .github/copilot-instructions.md, .github/instructions/*.instructions.md and AGENTS.md. Cline reads .clinerules/ and also detects .cursorrules, .windsurfrules and AGENTS.md. One AGENTS.md at the repo root covers most agents.

Also in: 简体中文 · 日本語 · 한국어 · Español · Português (Brasil)

Coding agent settings change often

Get one email a week when a setting, flag or permission rule changes, checked against the vendor docs.

Quick answer: the file each agent reads

  • Cursor: project rules are .mdc files in .cursor/rules (a plain .md file there is ignored). User Rules live in Customize, then Rules. Team Rules come from the dashboard on Team and Enterprise plans. AGENTS.md works in the root and in subfolders.
  • Claude Code: ./CLAUDE.md or ./.claude/CLAUDE.md for the team, ~/.claude/CLAUDE.md for you, ./CLAUDE.local.md for private project notes. Run /init to generate one.
  • OpenAI Codex: AGENTS.md in ~/.codex for global habits, then one AGENTS.md (or AGENTS.override.md) per directory from the repo root down to where you work.
  • Gemini CLI: ~/.gemini/GEMINI.md globally and GEMINI.md in your project. /memory show prints what is loaded.
  • GitHub Copilot: .github/copilot-instructions.md for the whole repo, .github/instructions/NAME.instructions.md with an applyTo glob for some files, and AGENTS.md anywhere in the repo.
  • Cline: markdown files in .clinerules/ or .cline/rules/ in the project, and ~/Documents/Cline/Rules for global rules.
  • Kiro: markdown steering files in .kiro/steering/ (workspace) or ~/.kiro/steering/ (global), plus AGENTS.md.
  • Junie: .junie/AGENTS.md, then a root AGENTS.md, then the legacy .junie/guidelines.md. Global guidelines go in ~/.junie/AGENTS.md.
  • Amp: AGENTS.md in the working directory and its parents, plus ~/.config/amp/AGENTS.md.
  • goose: AGENTS.md and .goosehints, globally in ~/.config/goose/.goosehints or per project.
  • Zed: ~/.config/zed/AGENTS.md for you, then the first project file it finds from a list that starts with .rules, .cursorrules and .windsurfrules and includes AGENTS.md and CLAUDE.md.
  • Aider: no special file. Write CONVENTIONS.md and load it with aider --read CONVENTIONS.md or read: in .aider.conf.yml.

Does AGENTS.md work everywhere?

Almost. These agents read AGENTS.md with no extra setup: Cursor, Codex, GitHub Copilot, Cline, Kiro, Junie, Amp, goose and Zed. Claude Code reads AGENTS.md only when the repo has no CLAUDE.md. If you keep both, add @AGENTS.md inside CLAUDE.md so Claude Code imports it. Gemini CLI needs context.fileName in settings.json.

CLAUDE.md that reuses AGENTS.md

@AGENTS.md

## Claude Code only
- Use plan mode for changes that touch more than three files.

Gemini CLI: .gemini/settings.json

{
  "context": {
    "fileName": ["AGENTS.md", "GEMINI.md"]
  }
}

What about .cursorrules?

Cursor's current rules documentation describes .cursor/rules .mdc files, User Rules, Team Rules and AGENTS.md. It does not document a root .cursorrules file. Other tools still read that file name: Cline detects .cursorrules automatically, and Zed checks .cursorrules second in its list of project instruction files. For new projects, put shared instructions in AGENTS.md and Cursor-specific scoping in .cursor/rules.

Scoping a rule to some files

  • Cursor: globs in the .mdc frontmatter, with alwaysApply: false.
  • Claude Code: a paths field in a markdown file under .claude/rules/.
  • GitHub Copilot: applyTo in the frontmatter of an .instructions.md file.
  • Cline: a paths list in YAML frontmatter.
  • Kiro: inclusion: fileMatch with a fileMatchPattern.
  • Amp: globs in the front matter of a file you @-mention from AGENTS.md.
  • Codex: put an AGENTS.md or AGENTS.override.md in the subfolder that needs different rules.

.cursor/rules/components.mdc

---
globs: src/components/**/*.tsx
alwaysApply: false
---

- Use named exports, not default exports

.github/instructions/python.instructions.md

---
applyTo: "**/*.py"
---

Use type hints on every public function.

Full rules guide for each agent

Get coding agent settings changes by email

When a setting, flag or permission rule in this guide changes, it goes in the weekly AgentAtlas update, checked against the vendor docs. One email a week.

Sources

Other guides

How to allow Cursor to run all commands: Run Everything, allowlist and sandboxHow to allow Claude Code to run all commands: permission modes, allow rules and skip permissionsClaude Code permissions: allow, ask and deny rules, rule syntax and allowed toolsCodex CLI: approval and sandbox modesGemini CLI: YOLO mode, auto_edit and allowing specific shell commandsCursor Privacy Mode: telemetry, training and data retentionClaude Code telemetry and data retention: what is sent and how to turn it offGemini CLI: turn off usage statistics and telemetryCLAUDE.md: where it goes, how it loads, and how it works with AGENTS.mdClaude Code hooks: format on save, block risky edits, get notifiedClaude Code subagents: create one, limit its tools, and call itAdd MCP servers to Cursor with mcp.json: Keep files out of Cursor with .cursorignore: Configure Codex with config.toml: Configure Gemini CLI with settings.json: Add MCP servers to Claude Code (claude mcp add, .mcp.json, scopes): Claude Code custom slash commands and skills (SKILL.md): GitHub Copilot custom instructions: Adding MCP servers to GitHub Copilot: Claude Code settings.json: file locations, precedence, and key settingsClaude Code plugins and marketplaces: install, create, and shareGemini CLI extensions and custom commands: Configuring OpenCode with opencode.json: Cline Rules: workspace, global, and conditional rulesKiro steering files: .kiro/steering, inclusion modes, and AGENTS.mdZed agent: instruction files, MCP servers, tool permissions, and ACP agentsCursor CLI: install, headless mode, permissions and CIAider: CONVENTIONS.md, .aider.conf.yml and API keysJunie guidelines, MCP and the Action Allowlist: Amp AGENTS.md, settings.json and MCP: Configure Goose extensions, hints, recipes and permissions: Customize OpenHands with skills, AGENTS.md, setup.sh and MCP: Configure Factory Droid CLI: AGENTS.md, settings.json, autonomy, custom droids and MCPConfigure Qwen Code: settings.json, providers, QWEN.md, MCP and approval modesCursor hooks: hooks.json, beforeShellExecution, afterFileEdit and exit codesCursor sandbox: sandbox.json, network allowlist and run modesCursor settings: settings.json, Cursor Settings and the ~/.cursor config filesCursor browser agent: @browser, browser automation and approval modesCursor subagents: .cursor/agents, frontmatter, built-in Explore and BrowserCursor telemetry and OpenTelemetry export (Privacy Mode, OTLP, Analytics API): Cursor rules setup: project, user and Team Rules, .mdc frontmatter, globs and AGENTS.mdClaude Code headless mode: claude -p, --output-format json, --bare and CI flagsClaude Code statusline: custom status bar in settings.json with context %, cost and git branchClaude Code /model: switch models, aliasesClaude Code /cost and /usage: check token spend, usage limits and reduce costsClaude Code VS Code extension: install, shortcuts, settings and /ideCodex AGENTS.md: global, project and override instruction files explainedCodex MCP servers: codex mcp add and [mcp_servers] in config.tomlCodex sandbox modes: read-only, workspace-write, danger-full-access and network accesscodex exec: run Codex non-interactively in scripts and CI with JSON outputCodex skills: create SKILL.md, skill folder locations and $skill invocationGEMINI.md in Gemini CLI: context file locations, imports and /memoryGemini CLI MCP servers: gemini mcp add and mcpServers in settings.jsonGemini CLI custom slash commands: TOML files, {{args}}, !{shell} and @{file}Gemini CLI headless mode: gemini -p, JSON output and exit codes for scripts and CIGemini CLI sandbox: enable Docker, Podman, macOS Seatbelt or gVisorcopilot-setup-steps.yml: set up the GitHub Copilot cloudGitHub Copilot CLI permissions: --allow-tool, --deny-tool, --allow-all-tools and trusted directoriesGitHub Copilot custom agents: .github/agents/*.agent.md profiles, tools and frontmatterGitHub Copilot code review settings: automatic PR reviews, rulesets, effort level and approvalsOpenCode MCP Server Setup: Local and Remote Servers in opencode.jsonOpenCode Permissions: Allow, Ask or Deny Bash, Edit and WebfetchOpenCode Custom Agents and Subagents: Markdown Files, Modes and @ MentionsCline MCP Setup: cline_mcp_settings.json for Local and Remote ServersCline Auto Approve and YOLO Mode: Run Commands and Edits Without PromptsCline Skills: SKILL.md Location, Format and Slash Command UseAmp MCP Setup: amp mcp add, amp.mcpServers and Workspace ApprovalAmp AGENTS.md: File Locations, @ Mentions and Glob-Scoped GuidanceAmp Skills: SKILL.md Folders, amp skill add and Search OrderKiro MCP Setup: .kiro/settings/mcp.json, autoApprove and OAuthKiro Hooks: .kiro/hooks JSON, PreToolUse, PostFileSave and StopKiro Permissions: permissions.yaml Allow, Ask and Deny RulesFactory Droid MCP Setup: droid mcp add, mcp.json Locations and /mcpFactory Droid Hooks: hooks.json, PreToolUse Matchers and Exit CodesFactory Droid Custom Droids (Subagents): .factory/droids Markdown FilesJunie MCP Setup: .junie/mcp/mcp.json for CLI and /mcp CommandJunie Brave Mode and Action Allowlist: Auto-Approve Commands in Junie CLIJunie Custom Slash Commands: .junie/commands Markdown Files and Argumentsgoose .goosehints and AGENTS.md: Global and Project Instructionsgoose Permission Modes: GOOSE_MODE auto, approve, smart_approve and chatgoose Recipes: recipe.yaml Format, Parameters and goose run --recipeZed Agent Tool Permissions: Auto-Approve Terminal Commands with tool_permissionsUse Claude, Codex and Gemini CLI in Zed: External Agents and agent_serversZed with Ollama, LM Studio and llama.cpp: Local Model Setup and Context LengthMCP 2026-07-28 Migration Guide: Stateless Protocol, No Sessions, server/discover, MRTR, and SDK v2 UpgradeSubagents and Custom Agents Compared: Claude Code vs Codex vs Cursor vs Gemini CLI vs GitHub CopilotAllow all commands in any AI coding agent: Cursor, Claude Code, Codex, Gemini CLI, Copilot CLI and 7 moreAdd an MCP server to any AI coding agent: Claude Code, Cursor, Codex, Gemini CLI, VS Code and 8 moreSettings file locations for every AI coding agent: Claude Code, Cursor, Codex, Gemini CLI, OpenCode, Qwen Code, Amp and Factory DroidGemini CLI hooks: settings.json, BeforeTool, AfterTool, exit codes and /hooksGitHub Copilot hooks: .github/hooks/*.json for Copilot CLI and the cloud agentHooks in every AI coding agent: Claude Code, Cursor, Gemini CLI, GitHub Copilot, Kiro and Factory DroidAgent Skills (SKILL.md) in every AI coding agent: Claude Code, Codex, Cline, Amp and OpenHandsHow to deploy a remote MCP server (Streamable HTTP): Cloudflare Workers, Vercel, Railway and moreHeadless mode in every AI coding agent: claude -p, codex exec, gemini -p, Cursor agent -p and copilot -p for scripts and CIClaude Code sandbox: /sandbox, sandbox.enabled, allowedDomains, excludedCommands and strict modeSandbox modes in every AI coding agent: Claude Code, Cursor, Codex and Gemini CLI compared

Reviewed Oct 18, 2026. Settings change often; the linked vendor docs are the source of truth.