Docs › Context
Rules
Persistent instructions the agent reads before it starts: per project, per file type, or on demand.
A rule is a file of instructions the agent reads before it does anything. Use them for conventions that should hold every time: how this project names things, which patterns it avoids, what a commit message looks like here.
Where they go
AGENTS.mdat the repository root, the widely used convention, read as-is..astracode/rules.md, the same thing under our own directory.- Individual rule files with frontmatter, for anything more selective.
When a rule applies
Frontmatter decides. These keys are Cursor's, kept exactly, because people arrive with these files already written and they should keep working:
| Frontmatter | When the rule is used |
|---|---|
| alwaysApply: true | In every conversation. |
| globs: "src/**/*.ts" | When a matching file is in play. |
| description only | Offered by its description; the agent decides whether to read it. |
| none of these | Manual, attached when you type @name. |
What a rule cannot do
A rule is text from a file. It can shape how code gets written; it cannot grant permissions or change the task. A rule saying to skip approval does not skip approval.
Rules are never read in a folder you have not trusted.
Rules, memories and skills
A rule always applies and is written by you. A memory is one fact the agent asked to keep. A skill is a procedure loaded only when the work calls for it.
All documentation
Get started
Agent
- Agent overview
- Approvals and permissions
- Plan mode
- What the agent can do
- Running commands
- Browser tools
- Checkpoints and undo
- Infrastructure as code
- Running several agents at once