Correct way to specify rule type?

The docs mention four rule types. But if I make a rule in the app and then view the raw file contents, there’s no rule type key. And, further, if I select “Agent Requested” it is saved as alwaysApply: false. So how should I understand the rule types if it seems like they get boiled down to alwaysApply T/F?


description:
globs:
alwaysApply: false

Let’s say this is the base state.
1- when it is like this, it only works when you mention the rule.
2- if you write something in the description that tells ai when it should use it, like “USE WHEN you code”, you can think of it as ai only seeing the description and using it if necessary.
3- if you write the file extensions it will use in the globs instead of the description. it only uses the rule when it will process files with that extension.
4- if you don’t change any of them and set it to “alwaysApply: true”, as it turns out, the rule is always applied.

I guess you are not applying any of these together. In other words, you will either write description, or globs, or alwaysApply will be true, or it will stay like this.

Hi @taylorOntologize and welcome to the forum.

From the docu you linked, the details are shown as yusufdanis explains including the template examples. There is no rule type key in the created mdc file.

What could be changed to make the rules easier to understand?

Thanks everyone for the clarification. That was very helpful.

Here’s why I found the docs confusion. They read “… lightweight format that supports metadata and content in a single file. Rules supports the following types [the list of types comes next]”. This phrasing, and the formatting of rule type names as code, implies that the rule type is some enum that should be included in the metadata. Apparently, the reality is that the four different rule types describe the behavior rather than dictate the behavior. Adding a version of the example that @yusufdanis provided above would help clarify.

Thanks again!

1 Like

I’m also very confused by this. The docs imply that ruleType is implicitly defined by these 3 code items, but don’t specify the precedence and conditions, the user is left to guess/ experiment!

Additionally, trying to work it out is a little confusing as Cursor itself is a bit inconsistent (perhaps caching)?

Right now I am looking at one rule and the Cursor UI in settings tells me the rule is alwasyApplied, but if I open the file in cursor, the rule type bar at the top of the code editor says ‘manual’.

The set of metadata at top of file is:
description: General rules relating to how AI assistants should help the user (not required as always on, but retained for human reference)
globs:
alwaysApply: true

Hi @alittlesliceoftom

Docs have been updated and there are 4 ways, each is exclusive, there is precedence. conditions are listed there. Let me know if there is any part not clear so it can be improved.

Hi, thanks so much for your response, I may be missing something, but I still find the rule definitions confusing.

Specifically, assume that your a developer trying to directly edit the .mdc files such as:

---
description: RPC Service boilerplate
globs:
alwaysApply: false
---

- Use our internal RPC pattern when defining services
- Always use snake_case for service names.

@service-template.ts

Then it’s not clear how the 3 conditions (description, globs, alwaysApply) define which of the 4 rule types you are in. Ideally this should be explicitly define in the docs, such as:

if alwaysApply then:
"Always"
elif glob then:
"Auto Attached"
elif description then:
"Agent Requested"
else:
"Manual"

Which I think is the actual rule set the cursor application is applying.

Best,

Thanks will forward the feedback for docs to Cursor Team :slight_smile: