Course contents

How AI coding agents load rules, skills and AGENTS.md

beginner4 min readUpdated
  • Cursor
  • GitHub Copilot
  • Claude Code
  • Windsurf / Devin
  • Cline
  • Codex
  • Antigravity CLI
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.

  1. 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.
  2. A matching file comes into play. Scoped rules attach when the agent reads or edits a file that matches their pattern.
  3. 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.
  4. You ask for it. You mention a rule (@rule-name in Cursor) or invoke a skill (/skill-name, or $skill-name in 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.

ToolAlways-on filesScoped rulesProject skills
CursorAGENTS.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 CodeCLAUDE.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/
ClineAGENTS.md, .clinerules/*.md or .cline/rules/*.md without frontmatterSame folders, with paths frontmatter.cline/skills/, .clinerules/skills/, .claude/skills/, .agents/skills/
CodexAGENTS.md (or AGENTS.override.md) from repo root down to the working directoryNested AGENTS.md files act as directory scope.agents/skills/ from the working directory up to the repo root
Antigravity CLIAGENTS.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:

CLAUDE.md
@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.md files when the agent works on files in that directory.
  • Copilot uses the nearest AGENTS.md in 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.

ToolHow to check
CursorOpen 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 CodeRun /context to see context usage, /memory to see and edit CLAUDE.md files, and /skills to list skills.
Devin DesktopThe Customize page in the Agents window lists loaded rules and skills.
ClineThe Rules panel lists detected rules; when a conditional rule activates you'll see "Conditional rules applied".
CodexAsk "List the instruction sources you loaded." Run /status for context usage and /skills to browse skills.
Antigravity CLIRun /context for a token breakdown and tracked files, /rules for rules, and /skills for skills.

Common mistakes

  • Plain .md files in .cursor/rules/. Cursor only treats .mdc files there as project rules; a plain .md file 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.md is 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.md and .agents/skills/ are the most widely shared.
  • Claude Code needs a CLAUDE.md import or a setting to read AGENTS.md alongside CLAUDE.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.