Home › Rules › Formats explained

AGENTS.md, CLAUDE.md and Cursor rules: formats explained

Checked against the official docs on Oct 19, 2026. Tools change these often. Sources at the bottom.

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?

ToolProject rules fileNotes
OpenAI CodexAGENTS.mdReads ~/.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 CodeCLAUDE.md or .claude/CLAUDE.mdAlso ~/.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.mdProject 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.mdPath-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.
LovableProject 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.
BoltProject Knowledge (settings)Project settings → Knowledge. Account and team knowledge also exist.
Replit Agentreplit.md (project root)Agent creates it automatically and may update it as it learns. Workspace custom instructions apply to every project. Template.
Base44Custom 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.

CLAUDE.md that shares AGENTS.md
@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:

FrontmatterCursor calls itWhen it's used
alwaysApply: trueAlways ApplyEvery Agent chat
alwaysApply: false + globsApply to Specific FilesWhen a matching file is in context
alwaysApply: false + description (no globs)Apply IntelligentlyWhen Agent decides it's relevant from the description
alwaysApply: false, no description or globsApply ManuallyOnly when you @-mention it
.cursor/rules/example.mdc
---
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

Get the free Starter Rules, emailed instantly

  • A copy-paste rules file to save as AGENTS.md or CLAUDE.md, or paste into Lovable, Bolt, v0 or Replit: small steps, ask before risky changes, no fake "it works", secrets kept out of code.
  • A kickoff prompt that makes your AI ask up to 3 questions and plan 5 to 8 small, testable steps before it writes any code.
  • The habit that saves projects: work, test, commit.

After that, an occasional email when we publish a new guide or rules file.

Free. No spam. Unsubscribe anytime. See our privacy note.