Home › Rules › Formats explained
AGENTS.md, CLAUDE.md and Cursor rules: formats explained
A rules file is a plain-text note your AI coding tool reads before every task: how to run the project, what to never do, how to report back. The idea is the same everywhere. The file name and location depend on the tool.
Which file does my tool read?
| Tool | Project rules file | Notes |
|---|---|---|
| OpenAI Codex | AGENTS.md | Reads ~/.codex/AGENTS.md (global), then every AGENTS.md from the repo root down to your current folder. Files closer to your folder win. Also supports AGENTS.override.md. Combined size limit 32 KiB by default. |
| Claude Code | CLAUDE.md or .claude/CLAUDE.md | Also ~/.claude/CLAUDE.md (personal, all projects) and CLAUDE.local.md (personal, this project, keep it out of git). Reads AGENTS.md when there's no CLAUDE.md (v2.1.277+). Can import files with @path. Path-scoped rules go in .claude/rules/*.md. |
| Cursor | .cursor/rules/*.mdc or AGENTS.md | Project Rules need the .mdc extension and frontmatter (description, globs, alwaysApply). Plain .md files in that folder are ignored. Nested AGENTS.md files in subfolders are supported. |
| GitHub Copilot | .github/copilot-instructions.md or AGENTS.md | Path-specific rules go in .github/instructions/*.instructions.md. Support for AGENTS.md varies by surface (VS Code, CLI and GitHub's cloud agent support it); check the docs for your editor. Examples: copilot-instructions.md examples. |
| Lovable | Project Knowledge (settings) | Project settings → Instructions, up to 10,000 characters. Workspace settings → Instructions applies to every project. Its docs say it also reads a root-level AGENTS.md or CLAUDE.md in a connected Git repo. |
| Bolt | Project Knowledge (settings) | Project settings → Knowledge. Account and team knowledge also exist. |
| Replit Agent | replit.md (project root) | Agent creates it automatically and may update it as it learns. Workspace custom instructions apply to every project. Template. |
| Base44 | Custom Instructions (AI chat → More options) | One rule per line. Applies to the app's main version, not branches. Template. |
Using Windsurf (now Devin Desktop), Gemini CLI or Antigravity? See Windsurf rules examples, GEMINI.md examples and Google Antigravity rules.
AGENTS.md
An open, tool-neutral format: a plain Markdown file in your project root. No required fields or frontmatter; use any headings you like. Popular sections are a project overview, build and test commands, code style, testing, and security notes. For bigger projects you can put extra AGENTS.md files in subfolders; the closest one to the file being edited wins, and your chat prompt overrides everything. It's now stewarded by the Agentic AI Foundation under the Linux Foundation.
Use it when: you use more than one tool, or you're not sure yet. It's the default in our library.
CLAUDE.md
Claude Code's memory file, loaded at the start of every session. Anthropic recommends keeping each file under about 200 lines, and writing rules concrete enough to check ("Run npm test before committing", not "test your changes"). Claude treats it as context, not enforced config: for something that must never happen, its docs point to hooks and permission settings instead.
Handy extras: /init generates a starting CLAUDE.md from your code, /memory shows which files loaded, and @AGENTS.md on its own line imports your shared file.
@AGENTS.md
## Claude Code
- Use plan mode before any change that touches more than 3 files.
Free rules starter pack for Cursor, Claude Code, Codex and Antigravity
One shared AGENTS.md that works across Cursor, Claude Code, Codex, Copilot and Antigravity, plus database and test rules in each tool's format. Unzip it into your project and fill in two sections. I'll email you the link.
Free. No spam. Unsubscribe anytime. See our privacy note.
Matching kit: Vibe Coder Skills Pack ($9)
The free rules set the boundaries. The Skills Pack adds 6 ready-to-copy skills for when a project goes wrong: stop-the-loop, fix-one-bug, leak-check, ship-check, explain-project and builder-handoff, for Claude Code, Cursor and Codex, with paste-in steps for Lovable, Bolt, Replit and Base44.
See the Vibe Coder Skills Pack ($9) →
Instant download. 7-day refund, no questions asked.
Cursor rules (.cursor/rules/*.mdc)
Each rule is a .mdc file with YAML frontmatter that decides when it's included:
| Frontmatter | Cursor calls it | When it's used |
|---|---|---|
alwaysApply: true | Always Apply | Every Agent chat |
alwaysApply: false + globs | Apply to Specific Files | When a matching file is in context |
alwaysApply: false + description (no globs) | Apply Intelligently | When Agent decides it's relevant from the description |
alwaysApply: false, no description or globs | Apply Manually | Only when you @-mention it |
---
globs: src/**/*.ts, src/**/*.tsx
alwaysApply: false
---
- Use named exports, not default exports.
- Keep components under 200 lines.
Cursor's advice: keep rules under 500 lines, split big ones up, and only add a rule when you see Agent make the same mistake repeatedly. Rules don't affect Cursor Tab autocomplete.
Lovable and Bolt Project Knowledge
Browser builders don't read your local files, so rules go into a settings text box that's sent with every message. Keep it short and specific; Lovable's own docs note that very long conversations can still drift from the instructions.
The one rule that matters in every format
Short, concrete, and specific beats long and vague. Every tool's docs say some version of this. Start with our library or the generator, then add a rule only when the AI repeats a mistake. Want ready-to-copy AGENTS.md files? See AGENTS.md examples.
Best value
All 6 kits for $29 — or $20.30 with code WELCOME30 (through Nov 30)
All six kits in one download: Tiny Game Builder Kit, Inbox Triage Agent, Codebase Fixer Agent, MVP Spec-to-Build Pack, Discord Bot Builder and the Vibe Coder Skills Pack. The five build kits are one markdown file each (agent brief, setup steps, worked example); the Skills Pack adds a zip of 6 SKILL.md skill folders.
Get all 6 kits for $29 → See what's in each kit
$29 instead of $48 for the six kits bought separately; WELCOME30 takes 30% off that at checkout ($20.30). Instant download from Gumroad. 7-day refund, no questions asked.
Sources
- Cursor docs: Rules
- Claude Code docs: How Claude remembers your project (CLAUDE.md, AGENTS.md, .claude/rules)
- AGENTS.md: the open format
- OpenAI Codex docs: Custom instructions with AGENTS.md
- GitHub docs: Adding repository custom instructions for GitHub Copilot
- VS Code docs: Use custom instructions
- Lovable docs: Define workspace and project knowledge
- Bolt docs: Project settings (Knowledge)
- Replit docs: replit.md
- Base44 docs: Using the AI chat (Custom Instructions)