Cursor Agent Rules Guide: Repository Context Without Prompt Drift

Answer in brief

Create maintainable Cursor Agent Rules for repository conventions, safe edits, scoped context, and repeatable multi-file work. This page also records the current cursor model and feature references, workflow steps, failure conditions, and verification checks.

Key facts at a glance

Product / model Current model or version reference Role Evidence
Cursor Grok 4.5 grok-4.5 Cursor flagship model Official source
Cursor Composer composer fast, cost-efficient interactive coding Official source
OpenAI GPT-5.6 Sol gpt-5.6-sol complex multi-step tasks in Cursor Official source
Anthropic Claude Opus 5 claude-opus-5 complex multi-step tasks in Cursor Official source

Verification checklist

  • Recheck the model name and model ID in the official model catalog.
  • Validate input, permissions, and output shape with deterministic fixtures.
  • Record the date, source URL, and regression result when a model changes.
  • Do not treat refusals, uncertain answers, or incomplete tool calls as success.

FAQ

What is cursor best suited for?

Cursor Agent Rules Guide: Repository Context Without Prompt Drift explains the main cursor workflow and its verification criteria. cursor users should confirm the task goal and current model or feature status against official documentation.

What is the current cursor model or version reference?

This page uses Grok 4.5 as a verified reference. Model IDs and availability must be rechecked against the official source because plan, region, and API surface can change.

What should a cursor user configure first?

A cursor user should confirm the account, permissions, input data, model selection, and retry policy before execution. Keep credentials and sensitive user data separate from task logs.

How should a cursor result be verified?

Compare the cursor result with the original requirements, official documentation, and deterministic tests. Verify every citation, model ID, version, and date against its linked source.

What failures are common in cursor workflows?

Common cursor failures include stale model names, broad prompts, missing permissions, and automation without verification. Narrow the input scope and define explicit success and stop conditions.

Sources and freshness

Cursor Agent Rules as a repository contract

Rules should be a small context contract, not a second repository handbook. When a rule applies, its content is added to Agent’s context, so every always-on sentence competes with task detail. Store decisions Agent must repeat, then point to canonical files and commands. Cursor’s documentation describes version-controlled project rules in .cursor/rules as .mdc; a plain .md file there is ignored. AGENTS.md is the simpler Markdown alternative, and nested files can narrow guidance for a directory. Cursor Rules documentation

Set up a small rule system

  1. Inventory the repository. Read the root README, contribution notes, build files, formatter and linter configuration, and one representative implementation. Record the real test and build commands.
  2. Choose one home per instruction. Put shared repository behavior in .cursor/rules/*.mdc or a root AGENTS.md. Use nested AGENTS.md for a clear subtree. Keep personal preferences in User Rules.
  3. Create one focused rule. Use Cursor’s Rules UI or /create-rule, inspect the generated file, name one purpose, and add explicit stop conditions. Commit it so contract changes are reviewable.
  4. Split by decision. Separate API validation, migrations, and UI conventions instead of writing one “complete engineering standards” rule.

Scope and precedence

Choose the narrowest useful mode:

  • Always Apply: use alwaysApply: true only for repository-wide invariants, such as “never edit generated output.”
  • Auto-attached: use globs for file-path rules such as src/**/*.tsx or db/migrations/**/*.sql.
  • Agent Requested: use a strong description without globs for a kind of task rather than a path.
  • Manual: leave automatic selectors off and apply risky or occasional procedures with @rule-name.

Cursor documents Team → Project → User precedence when applicable rules conflict; nested AGENTS.md instructions become more specific in child directories. Do not rely on precedence to repair contradictions. Put repository invariants in project rules, local conventions near their code, and personal preferences in User Rules. If a team rule exists, make project exceptions explicit.

Write rules that stay small

A durable rule states when it applies, what decision Agent should make, what it may touch, what it must not change, and how to verify the result. Use imperative bullets and references such as src/example.ts, not pasted style guides. Aim for roughly 10–40 lines; split large rules and treat 500 lines as a ceiling, not a target. Put enforceable requirements in linters, tests, CI, or review.

A drift-resistant workflow

Start with a clean baseline:

git status --short
git diff --name-only
git diff --check
npm run lint
npm test

Use the repository’s actual commands; this is a shape, not a universal stack. In the first Agent message, state the goal, allowed files, out-of-scope files, validation, and a stop condition. Ask for a short plan and repository inspection before edits. Attach only relevant context and request one logical change at a time. If the request changes, start a new task or rewrite the scope instead of piling corrections onto a stale conversation.

After editing, inspect the diff before accepting it. Check changed paths, generated files, lockfiles, formatting churn, renamed APIs, and unrelated refactors. Run the narrowest relevant test, linter, type checker, or build. A passing generic command is not proof that changed behavior is covered.

Failure modes and verification

  • Rule never fires: check the .mdc extension, metadata, matching globs, and useful description. Open Rules in Customize and manually @rule-name it as a diagnostic.
  • Rule fires everywhere: alwaysApply or a broad glob such as src/** is too wide. Narrow the path or move optional guidance to Agent Requested or Manual.
  • Agent edits too broadly: define an allowlist and say “do not reformat or upgrade dependencies.” Verify with git diff --name-only.
  • Rules contradict code: choose one canonical source, remove duplicated prose, and add a check that exposes divergence.
  • Prompt guidance is treated as security: keep secrets, permissions, and release gates in normal repository and CI controls.

Practical checklist

  • Is every always-on sentence a true repository invariant?
  • Does each rule have one job and one clear scope?
  • Are allowed files and validation commands explicit?
  • Did the final diff stay inside the boundary?
  • Did relevant checks pass after the last edit?

Evidence refresh

The model and feature records below are rechecked against the linked official sources. If availability changes, update this table and the verification date together.

Product / model Current ID or version Use / caution Evidence
Cursor Grok 4.5 grok-4.5 Cursor flagship model Official source
Cursor Composer composer fast, cost-efficient interactive coding Official source
OpenAI GPT-5.6 Sol gpt-5.6-sol complex multi-step tasks in Cursor Official source
Anthropic Claude Opus 5 claude-opus-5 complex multi-step tasks in Cursor Official source

Sources

Evidence and freshness

Last verified:

Primary sources

Verified model records

Explore More Tools