Rules
rules/ holds the conventions an agent must follow without being asked: commit format, error handling, the money type, the test style. Each tool loads rules on its own terms (Cursor .mdc files, Claude Code rules, AGENTS.md sections); a rule spec is written once and lands in each.
- Always on, or only where it matters. A rule can apply to every session, to one directory, or to files that match a pattern, so a payments convention stays out of frontend work.
- Close to the code. A rule under
rules/services/payments/applies insideservices/payments/, and supported tools load it only there. - Checked like code.
sync --checkfails when a tool's copy drifts from the spec, andagnostic-ai explain --file <path>lists which rules apply to a file.
Keep a rule short and stated as an instruction. Put a multi-step procedure in a skill instead, so it loads only when needed.
Write one
agnostic-ai new rule conventional-commits creates rules/conventional-commits.md with globs: "**/*" and alwaysApply: true.
---
name: conventional-commits
description: Always use Conventional Commits format.
globs: "**/*"
alwaysApply: true
---
Use `feat:`, `fix:`, `docs:`, etc. Subject under 72 chars.
A rule for one file type, loaded when the agent works on matching files:
---
name: react-components
description: Conventions for React components.
globs: "src/**/*.{ts,tsx}"
---
Write function components. Keep one exported component per file.
A rule for one directory. agnostic-ai new rule payments-context --scope services/payments creates it, or place the file at rules/services/payments/payments-context.md:
---
name: payments-context
scope: services/payments
---
Use integer minor units for monetary values.
Claude Code gets a conditional rule. Codex and Cursor share services/payments/AGENTS.md. Gemini gets services/payments/GEMINI.md. See directory-specific instructions for every target and the selector limits.
Fields
| Field | Required | Default | Description |
|---|---|---|---|
name | no | filename | Rule identifier. |
description | no | empty | Short summary. |
scope | no | project-wide | Project-relative directory and its descendants. Source-layout scope wins. A scope inside node_modules is refused. See scoped context. |
globs | no | target-dependent; new rule seeds **/* | Project-relative patterns, as a comma-separated string ("*.go,*.mod") or a list. A comma inside a brace set does not separate patterns, so "src/**/*.{ts,tsx}" is one pattern. With scope, the selector must stay inside the directory. new rule --scope omits it. |
paths | no | unset | File patterns, as a string or list. Scoped rules accept it with or instead of globs; see selector limits. |
alwaysApply | no | target-dependent; new rule seeds true | Requests unconditional activation. With scope, only inside the directory. new rule --scope omits it. |
Tools differ on what a rule with neither globs nor alwaysApply does; each target page says how it activates. Set alwaysApply: true when a rule must load everywhere.