AGENTS.md vs Copilot Instructions vs Cursor Rules vs CLAUDE.md: Which AI Context File to Use, and When (2026)

AGENTS.md vs Copilot Instructions vs Cursor Rules vs CLAUDE.md: Which AI Context File to Use, and When (2026)

TL;DR

  • AGENTS.md is the portable format for project instructions. Most major coding agents read it; Gemini CLI needs a setting.
  • Copilot also has its own instructions, rules for matching paths, custom agents and skills. .github/copilot-instructions.md reaches the most Copilot surfaces.
  • Within an AGENTS.md hierarchy, the nearest applicable file specialises its parents. Your explicit chat instructions take priority for the task.
  • Context files change agent behaviour. The research does not show that they reliably improve correctness, speed or cost.

Keep one lean source of verified project rules: AGENTS.md when several tools share the repo, or copilot-instructions.md for a Copilot team. Treat it as an operating guide, not a performance switch.

In a hurry? Jump to the quick comparison, then come back for precedence, the research and the decision guide.

If you use an AI coding agent every day, whether that’s GitHub Copilot, Cursor, Claude Code, Codex or Gemini CLI, you’ve felt this particular flavour of tedium: you keep typing the same rules into every prompt.

“Use Vitest, not Jest. Don’t touch /legacy. Named exports only. Return { data, error } from every endpoint.”

The agent obeys for one session, you close your editor, and tomorrow you type it all again. That isn’t a prompting problem. It’s a missing context layer: the middle tier between what you ask in the moment (the prompt) and the whole system you build around the model (the harness).

That layer has a name now. Several names, actually, and that’s exactly the problem: AGENTS.md, copilot-instructions.md, .cursorrules, CLAUDE.md, GEMINI.md, Skills, custom agents. They overlap, they compete, and they keep moving. In 2026 alone, Claude Code started reading AGENTS.md, Windsurf became Devin Desktop, and Copilot’s coding agent became the cloud agent. Almost nobody explains how they fit together or which one you should actually use.

This post untangles all of it: what each file is, how they interact, what the research says about whether they even work, and, most importantly, which file to reach for, and when.

TL;DR diagram: which file should you use?

Here’s the whole decision on one page. The rest of the post explains every box in it.

Decision tree for choosing an AI context file. With one tool: GitHub Copilot uses .github/copilot-instructions.md, Claude Code uses CLAUDE.md, Gemini CLI uses GEMINI.md, and Codex, Cursor, Devin, Jules or Zed use AGENTS.md. With several tools: one lean AGENTS.md as the shared source of truth, then bridges for Gemini CLI, Copilot Chat outside VS Code and instructions just for Claude. Nested files, rules for matching paths and SKILL.md files come only when you need them.

For example, Copilot in VS Code and Claude Code can share one AGENTS.md when there’s no CLAUDE.md. A Copilot team can start with .github/copilot-instructions.md. Cursor users alongside Copilot Chat in Visual Studio need both. A deploy or release procedure belongs in a SKILL.md, whichever instructions the repo uses.

Read more