mysi Find

Brief in AI engineering

Agent instruction files

Lists which instruction files each coding agent reads, from which folders, in what order and with what limits.

Most coding agents read AGENTS.md but differ on fallbacks and order. Claude Code reads AGENTS.md only when no CLAUDE.md exists. Zed uses only the first matching project file. Grok Build's Agents Window needs .mdc rules; its Terminal UI ignores them. Devin Local imports Windsurf rules.

Facts

Agent Fact
Claude Code @path imports resolve relative to the file that contains the import [1]
Claude Code @path imports nest at most 4 hops deep [1]
Claude Code .md files in .claude/rules/ are found recursively [1]
Claude Code A rule with paths frontmatter loads only when Claude works with matching files [1]
Claude Code Rules in ~/.claude/rules/ apply to every project on the machine [1]
Claude Code A CLAUDE.md larger than 4 MiB is skipped entirely [1]
Claude Code Reading AGENTS.md needs Claude Code v2.1.277 or later [1]
Claude Code Default setting claude-md-or-agents-md: AGENTS.md is read only when no CLAUDE.md, .claude/CLAUDE.md or CLAUDE.local.md exists in the working directory or above [1]
Claude Code ~/.claude/CLAUDE.md, the managed CLAUDE.md and .claude/rules/ files do not stop AGENTS.md from loading [1]
Claude Code Setting claude-md-and-agents-md reads both: each directory's CLAUDE.md first, then its AGENTS.md [1]
Claude Code Never read: AGENTS.local.md, AGENTS.override.md, anything under .agents/ [1]
GitHub Copilot excludeAgent: "code-review" in a path-specific .instructions.md file hides it from Copilot code review [2]
GitHub Copilot excludeAgent: "cloud-agent" hides that file from Copilot cloud agent [2]
Grok Agents Window Project rules in .cursor/rules must use the .mdc extension [3]
Grok Agents Window A plain .md file in .cursor/rules is ignored [3]
Grok Agents Window Precedence: Team Rules, then Project Rules, then User Rules; the earlier one wins a conflict [3]
Grok Agents Window A nested AGENTS.md applies to files in its folder and below [3]
Grok Terminal UI Load order: ~/.grok/ first, then each folder from the repo root down to the working directory [4]
Grok Terminal UI Deeper files win on conflicts [4]
Grok Terminal UI Names read in each folder: AGENTS.md, Agents.md, AGENT.md, CLAUDE.md, Claude.md, CLAUDE.local.md [4]
Grok Terminal UI Also reads every *.md file in .grok/rules/ [4]
Grok Terminal UI Reads plain *.md files directly in .claude/rules/ and .cursor/rules/; never reads .mdc files [4]
Grok Terminal UI Frontmatter such as globs or alwaysApply is stripped, so those rules load in every session [4]
Grok Terminal UI Files ignored by .gitignore are skipped [4]
Grok Terminal UI Files load in full, with no size cap [4]
Devin Local AGENTS.md, AGENTS.local.md and AGENT.md are always-on rules [5]
Devin Local Those files are read at the workspace root and in each folder down to the working folder [5]
Devin Local trigger frontmatter values in .devin/rules/*.md: always_on, glob, model_decision, manual [5]
Devin Local .devin/global_rules.md is a single always-on file [5]
Devin Local User-level files: ~/.devin/rules/*.md and ~/.devin/global_rules.md [5]
Devin Local Legacy .windsurf/rules/*.md, .windsurf/global_rules.md and .windsurfrules are imported by default [5]
Devin Local When both global_rules.md files exist, only .devin/global_rules.md loads [5]
Cline Workspace rules: .clinerules/ or .cline/rules/ at the project root [6]
Cline Global rules folder on macOS and Linux: ~/Documents/Cline/Rules [6]
Cline Cross-tool global file: ~/.agents/AGENTS.md [6]
Cline .cursorrules and .windsurfrules are detected automatically [6]
Zed Personal file: ~/.config/zed/AGENTS.md [7]
Zed Project file: only the first match in this order: .rules, .cursorrules, .windsurfrules, .clinerules, .github/copilot-instructions.md, AGENT.md, AGENTS.md, CLAUDE.md, GEMINI.md [7]
Zed Project instructions override the personal file on conflict [7]

Use it for

  • Choosing file names so one repository instructs several agents.
  • Predicting which file wins when CLAUDE.md, AGENTS.md and overrides coexist.
  • Diagnosing missing instructions (Claude Code size limit, .mdc rules unread by Grok's terminal).
  • Not for how well each agent follows its instructions.

Sources

Pairs with

Tested

Tested 4 Dec 2026: claude-haiku-5-5 stated 0 of its 39 facts without this page and 38 with it; claude-fable-5-2 stated 4 of its 39 facts without this page and 39 with it.

Changes

Cite as: mysi, Agent instruction files, mysi.dev/agent-instruction-files, version 1, changed 2026-12-04. Text and data CC BY 4.0.