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. |
| Lovable | Project Knowledge (settings) | Project settings → Knowledge, up to 10,000 characters. Workspace Knowledge 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. |
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.
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 twice. 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.
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)