Using the "project-rules" in 0.45.2

Hey everyone! :wave:

With the release of Cursor v0.45.2, the new “project-specific rules” feature has been a hot topic! For those who haven’t tried it yet, this update lets you define custom rules (with descriptions and glob patterns) tailored to specific projects. Check out the announcement post for details.

Questions for the community:

  1. How are you using project-specific rules so far?

    • Any standout use cases (e.g., linting, formatting, IDE behavior)?
    • Have you combined glob patterns with specific workflows?
  2. Glob patterns:

    • What globs have you found most useful (e.g., src/**/*.ts, tests/*.py)?
    • Any clever tricks for excluding files or targeting subdirectories?
  3. Project types:

    • Are you applying different rules for frontend vs. backend projects?
    • How do you handle monorepos or multi-folder workspaces?
  4. Challenges?

    • Did you run into unexpected behavior or limitations?
    • How did you troubleshoot?
  5. Tips for others?

    • Any config snippets, best practices, or “aha!” moments to share?

Let’s crowdsource ideas and examples! If you’ve built a cool rule setup, drop a code snippet or screenshot below. Excited to see how everyone’s leveraging this feature! :rocket:


Example starter (optional):

// .cursor/mason.mdc
Description Always stay updated on the `_mason` folder
Globs: _mason/*

# Main file
Use the @how-mason-works.md file to understand how mason_cli works
Use the @mason-folder-structure.md file to get an idea of structure and usage
check the @bricklink.md for repository and documentation

What is the relationship between this feature and the NOTEPADS feature? Is it a replacement or a complement? Is it just an attempt?

I briefly looked at this feature and haven’t used it yet, but I have a few questions and speculations.

  • Description is a description that helps view this rule and will not be passed to LLM
  • Globs are applied once files or files in the context are matched.
  • Therefore, this feature is an automatic process and does not require manual addition to the chat context.

I think what’s more important is to know how this feature actually works. I’m a bit scared of @files right now; the recent cursor and the understanding of @files are basically random. Sometimes it seems to understand, and other times it acts as if it hasn’t seen anything. It’s completely unpredictable.

3 Likes

This is distinct from the NotePads feature.

Project-specific rules allow you to more intelligently add relevant context to the chat and cursor windows.

For example, if you only want certain information to apply to specific file types (.py files) or directories.

Unlike Notepads, you don’t have to @ these manually. They are automatically added via the glob pattern or the agent recognising they are relevant from the rule description.

Unlike .cursorrules, which is auto-added to any chat/composer interaction, these project-specific rules will only be added to the context when they are relevant (via the glob pattern or agent thinking it is, based on your project description).

You should be able to target specific directories via a glob pattern.

e.g. 'path/to/directory/*'

I’ve been using extension-specific globs to isolate rules that are only relevant to certain file types (e.g. **.html or **.py).

As well as targeting certain directories (e.g. **/templates/*).

Loving it so far. Before, I was constantly umming and ahhing about what to put in my .cursorrules files, not wanting to fill it with unnecessary information, and hence having to make trade-offs about what to include.

For example, I didn’t want to add too much information regarding how I like my Python functions formatted, for fear of it bloating the context window when writing JavaScript.

Now, I just write a Python-specific rule that only target Python files.

It’s chef’s kiss fantastic.

Is it possible to create a comprehensive guide on how to add project rules? I’ve created the .cursor folder and a *.mdc file. I’ve added my desired rule to the file, for example, recording any changes in progress.md file and pointing it to that folder. However, nothing seems to be happening. Where am I going wrong?

5 Likes

I’ve realised that rules outside this .cursor/rules/ folder are not being recognised. Is this correct? And what’s the best way to organise these .mdc files? Seems like we can’t event have subfolders within .cursor/

3 Likes

I still dont know how it work …
how it aotu select what is useful ?

some keywork input to the composer ,then it would auto find the right information from project-rules?

“When you specify file patterns here (e.g. *.tsx), this rule will automatically be included in AI responses for files matching those patterns”

the desc means when composer decide to change some files, it would firstly to find out those files fixed the partern content rule ? and how can i konw it actually get the right rules?

can u show me an example ,pls ,thx

can i use the rules to control the function “Gernarate Commit Message” ?

1 Like

Hey, not yet, but we’ll add this feature soon.

I just tested it for a while and found that this rule is really easy to use. It is highly reusable and the experience is also very good.it made the whole project clearer and more controllable.

1 Like

Hot tip: Autosave doesn’t work on the mdc editor (IE: save on focus change). Note the globs are just a line in the file. Format is pretty trivial.

can we make folders in the project rules? so .cursor/rules/protocols/how-we-make-pew-pew.mdc, .cursor/rules/personas/michael-scott.mdc etc? will it still work the same or do they all have to be in the root

I’ve noticed the rules don’t seem to get applied on reruns or edits of a message in Composer. Could we get it to apply on those?

Separately, I had an idea to make rules even more powerful with something I call “Agent Flows” (or “Flow Rules”). I’ve outlined it in a separate post here: [Link to Agent Flows]. It’s a bit different from Project Rules and Cursor Rules, but could be a great complement!

1 Like

When choosing a file, can we have that fancy folder choosing.
Since I mostly follow Folder/index.tsx pattern
And choosing a specific file with current implementation is not effective

Is now:

.cursorrules only for → Rules for AI
Rules for AI only for → chat and Command - K seesions but not for a composer/agent ?

Are Project rules only for composer/agent ?

.cursorrules and Rules for AI function as they did before, as outlined here: Context / Rules for AI – Cursor

There is no change in their functionality.

Project Rules is in addition to these features. This will eventually replace .cursorrules and is essentially a more fine-grained way to implement cursor rules, so you can make rules specific to:

  1. A particular file type
  2. Directory
  3. Semantic description
  • Chat + composer windows use the glob patterns outlined inProject rules
  • The Description for the Project Rule is only used in Agent mode. Globs are used by normal + agent
  • Ctrl/⌘ K currently does not use Project Rules

I hope that helps :slight_smile:

2 Likes