Course contents
How AI coding agents load rules, skills and AGENTS.md
On this page
The four moments context loads
Every tool loads instructions at one of four moments. Knowing which moment applies to a file explains most "why didn't it follow my rule?" questions.
- Session start. Always-on files are read when the session begins:
AGENTS.md,CLAUDE.md,GEMINI.md,.github/copilot-instructions.md, always-apply rules. Skill descriptions are also listed here. - A matching file comes into play. Scoped rules attach when the agent reads or edits a file that matches their pattern.
- The agent decides it's relevant. Description-based rules (Cursor "Apply Intelligently", Devin and Antigravity
model_decision) and skills load when the agent judges the task matches. - You ask for it. You mention a rule (
@rule-namein Cursor) or invoke a skill (/skill-name, or$skill-namein Codex).
The map: where each tool looks
Project-level locations only; personal (home directory) locations are covered in each tool's setup lesson. Verified against official docs in November 2026.
| Tool | Always-on files | Scoped rules | Project skills |
|---|---|---|---|
| Cursor | AGENTS.md (root and nested), .cursor/rules/*.mdc with alwaysApply: true | .cursor/rules/*.mdc with globs or description | .cursor/skills/, .agents/skills/ (also reads .claude/skills/, .codex/skills/) |
| GitHub Copilot | .github/copilot-instructions.md, AGENTS.md (nearest wins), or a root CLAUDE.md / GEMINI.md | .github/instructions/*.instructions.md with applyTo | .github/skills/, .claude/skills/, .agents/skills/ |
| Claude Code | CLAUDE.md or .claude/CLAUDE.md, .claude/rules/*.md without paths; AGENTS.md when no CLAUDE.md exists | .claude/rules/*.md with paths | .claude/skills/ (doesn't read .agents/) |
| Devin Desktop (formerly Windsurf) | AGENTS.md, .devin/global_rules.md, .devin/rules/*.md with trigger: always_on | .devin/rules/*.md with trigger: glob or model_decision | .devin/skills/, .agents/skills/, legacy .windsurf/skills/ |
| Cline | AGENTS.md, .clinerules/*.md or .cline/rules/*.md without frontmatter | Same folders, with paths frontmatter | .cline/skills/, .clinerules/skills/, .claude/skills/, .agents/skills/ |
| Codex | AGENTS.md (or AGENTS.override.md) from repo root down to the working directory | Nested AGENTS.md files act as directory scope | .agents/skills/ from the working directory up to the repo root |
| Antigravity CLI | AGENTS.md, GEMINI.md, .agents/rules/*.md with trigger: always_on, from the start folder up to the repo root | .agents/rules/*.md with trigger: glob or model_decision | .agents/skills/ |
Sources: Cursor rules, Cursor skills, GitHub Copilot instructions, Copilot skills, Claude Code memory, Claude Code skills, Devin customizations, Cline rules, Cline config, Codex AGENTS.md, Codex skills, Antigravity rules.
Three things that surprise people
Claude Code reads AGENTS.md, but only sometimes
Since v2.1.277, Claude Code can read AGENTS.md directly, but by default only when there's no CLAUDE.md, .claude/CLAUDE.md or CLAUDE.local.md in the working directory or above it. If you have both, the common fix is a CLAUDE.md that imports the shared file:
@AGENTS.md
## Claude Code only
- Use plan mode for changes that touch more than five files.
You can also change the Project instructions setting in /config to claude-md-and-agents-md to load both (Claude Code memory docs).
Nested AGENTS.md works differently per tool
- Codex walks from the repo root down to the directory you started in and concatenates one file per directory. Files closer to you come later, so they win on conflicts.
- Cursor applies nested
AGENTS.mdfiles when the agent works on files in that directory. - Copilot uses the nearest
AGENTS.mdin the directory tree. - Antigravity CLI reads from the start folder up to the repo root, and doesn't load files from subfolders below where you started, even when the agent edits files there (Antigravity customization discovery).
We cover the monorepo implications in Monorepos.
The same skill can show up twice
Several tools read more than one skills folder. Cursor reads .cursor/skills/, .agents/skills/ and .claude/skills/. Copilot reads .github/skills/, .claude/skills/ and .agents/skills/. If the same skill name lives in two of those, the agent may see two near-identical entries. The multi-tool repos lesson shows layouts that avoid this.
How to check what actually loaded
Don't guess. Every tool has a way to show you.
| Tool | How to check |
|---|---|
| Cursor | Open Customize in the sidebar to see rules and skills and their status. |
| GitHub Copilot (VS Code) | Run Chat: Open Customizations and check the Instructions tab; the response's References list shows which instruction files were used. |
| Claude Code | Run /context to see context usage, /memory to see and edit CLAUDE.md files, and /skills to list skills. |
| Devin Desktop | The Customize page in the Agents window lists loaded rules and skills. |
| Cline | The Rules panel lists detected rules; when a conditional rule activates you'll see "Conditional rules applied". |
| Codex | Ask "List the instruction sources you loaded." Run /status for context usage and /skills to browse skills. |
| Antigravity CLI | Run /context for a token breakdown and tracked files, /rules for rules, and /skills for skills. |
Common mistakes
- Plain
.mdfiles in.cursor/rules/. Cursor only treats.mdcfiles there as project rules; a plain.mdfile is ignored (Cursor docs). - Expecting Claude Code to read
.agents/skills/. It doesn't. Claude skills live in.claude/skills/. - Rules nested too deep in Antigravity. Antigravity scans
.agents/rules/and.agents/skills/one level deep, so.agents/rules/frontend/react.mdis skipped unless registered in.agents/rules.json. - Testing in the same chat you edited in. Start fresh.
Recap
- Context loads at session start, when matching files appear, when the agent judges relevance, or when you ask.
- Each tool has its own folders, but
AGENTS.mdand.agents/skills/are the most widely shared. - Claude Code needs a
CLAUDE.mdimport or a setting to readAGENTS.mdalongsideCLAUDE.md. - Always verify with the tool's own view of loaded context, in a fresh session.
Next step
Set up your tool. Start with the one you use most: Cursor, GitHub Copilot, Claude Code, Windsurf / Devin, Cline, Codex or Antigravity CLI.