CodePanel

Cursor rules for an agent-to-agent review loop

Cursor rules for AI code review: which .mdc rule type to use, scoping a rule with globs like a .codepanel/rules.md section, and when to use AGENTS.md.

Updated

Cursor rules are Markdown files in .cursor/rules/ with a .mdc extension, each with frontmatter saying when Cursor's agent includes it. For a review loop, keep the loop itself in AGENTS.md, which Cursor and every other agent read, and use rules for conventions that apply to some paths only, scoped the same way as the sections of .codepanel/rules.md.

The four kinds of rule

The frontmatter has three fields, description, globs and alwaysApply, and their combination decides when a rule is included (Cursor's docs):

Type in Cursor Frontmatter Included
Always Apply alwaysApply: true In every Agent conversation
Apply to Specific Files globs set, alwaysApply: false When a matching file is in context
Apply Intelligently description set, no globs When the agent judges the description relevant
Apply Manually Neither When you @-mention the rule

Details that decide whether a rule is read at all:

  • The extension must be .mdc. A plain .md file in .cursor/rules/ is ignored; plain Markdown belongs in AGENTS.md.
  • Rules apply to Agent conversations, not to Tab completion or Inline Edit.
  • An @file reference in a rule is not inlined. The agent reads that file with its tools when it decides to, so a rule can point at .codepanel/rules.md without copying it.
  • Cursor suggests keeping a rule under 500 lines.
  • A .cursorrules file at the root is legacy and due to be deprecated. Cursor's help page says to move it into a rule set to Always Apply, which matches how it behaved.

Where the review loop goes

In AGENTS.md. Cursor reads it, and so do Codex, Copilot in VS Code and Claude Code, directly or through an import, so one copy serves any agent that works in the repository. Cursor also applies a CLAUDE.md to every conversation, whatever a rule's alwaysApply says, so a repository that keeps its instructions in CLAUDE.md reaches Cursor too.

The codepanel-setup skill writes the loop into AGENTS.md (or CLAUDE.md) and drafts .codepanel/rules.md from them, in one pull request (Cursor setup). If the repository only ever sees Cursor and you keep the loop in a rule, make it Always Apply: a loop that loads only when a file matches is missing when Cursor reads a review with no file open.

One scope for the agent and the reviewers

.codepanel/rules.md scopes a section with a glob as its heading. Reviewers see the section only on pull requests that change a matching file (Scoped rules). CodePanel's own file opens with one:

.codepanel/rules.md
## src/**/*.{tsx,css}

Design standards (docs/design.md). Check these; report nothing about taste.

A Cursor rule of the Apply to Specific Files kind gives the writing agent the same scope, so Cursor meets the convention when it opens a component, before a reviewer has to flag it. The pattern is written differently in each place:

Where Field The same scope
.codepanel/rules.md A level-two heading ## src/**/*.{tsx,css}
.cursor/rules/*.mdc globs, patterns separated by commas src/**/*.tsx,src/**/*.css
.claude/rules/*.md paths, a YAML list "src/**/*.{tsx,css}"

The body of the Cursor rule names the section to read rather than copying its lines. Copies drift, and when they do, the agent follows one version while the reviewers enforce the other. The section came in with PR 162, which also pointed CLAUDE.md's UI instructions at the same standards in docs/design.md, so the agent writing a component and the reviewers checking it work from one source.

Agents that read Cursor rules

Read next