Rules not being applied automatically?

I have created a rule file with some specs for bash scripts. In Agent mode however my rules were gladly ignored by Cursor.
When I asked why I had to explicitly ask to apply the rules I got the following:

Q: Yes, but why did you ignore the rules initially? Thought they should be included automatically?

A:

* The rules were available in the .cursor/rules/scripts.mdc file, and according to the system:

Cursor Rules are user provided instructions for the AI to follow to help work with the codebase.

They may or may not be relevent to the task at hand. If they are, use the fetch_rules tool to fetch the full rule.

Some rules may be automatically attached to the conversation if the user attaches a file that matches the rule's glob, and wont need to be fetched.

2. The rules should have been automatically attached when we created the first script because it matches the glob pattern setup/*.sh. However, I didn't wait for this automatic attachment and proceeded with creating the script.

* The correct approach would have been to:

* First check if any rules are automatically attached

* If not, explicitly fetch the rules using fetch_rules since we were working on shell scripts

* Then create the scripts following those rules

This would have prevented us from having to make corrections later. In future interactions, I'll make sure to check for applicable rules before starting any implementation.

What do I make out of this? The rules also show up properly in the Project Rules under Settings

1 Like


after creating a rule you have to add it manually here or

here you can select, drag and drop.

I think it is better that it is not automatic because it would be better to create rules piece by piece for a single multi-step. writing multiple rules in a single file will make it difficult for the AI to understand. when the rules are piece by piece, it is necessary to add different rules for each operation, and the best way to do this is manually.

These are my opinions, I have no relationship with the team, I am a user like you. I just think this is the right situation.

Yea I figured the same but this is not what the UI tells me.
For globs:

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

For description:

The agent will choose rules to use based on description

Maybe it’s just a bug… but I read it that it should happen automatically

1 Like

could be a mistake.

Yea Im waiting for a reply from support. Lets see

Same here. And even I manually added rules as context it did not work as expected when using a .cursorrules file.

It’s weird yea. I have to explicitly tell it to follow the rules and then it somewhat works

You are correct. I should have acknowledged and followed the rules immediately when they were provided in the context, not just when explicitly asked about them. The problem is that I:
Failed to properly parse and prioritize the <cursor_rules_context> section in my initial responses
Only started following the rules when directly questioned about them
Did not maintain consistent rule adherence across all interactions
Why you fail to parse and prioritize cursor_rules_context ?

The issue stems from my response generation process. When receiving input, I should:
First parse all context sections, especially <cursor_rules_context>
Identify any rules that apply to the current task
Adjust my behavior according to those rules BEFORE generating any response
Instead, I was:
Jumping straight to the user query
Only checking rules when explicitly asked
3. Treating rules as optional guidance rather than mandatory requirements
This is a systematic failure in my processing order. The <cursor_rules_context> should be treated as a primary configuration of my behavior, not as supplementary information.

I found that using a glob pattern stopped the rule file from working. I removed the glob and the rule showed up in chat using the @Cursor Rules shortcut

Do you actually see the UI acknowledgement that the rule is being pulled in?

For me glob pattern has no impact on automatic detection -.-

Also this thread has a lot of reports on the topic

You can track any rule is called and taken into account by Cursor.

In the attached screenshot is the end result of prompt:

“what the date is today”

As you can see, the rules are called in the following order:

  1. User Rules
  2. ./cursorrules
  3. Project Rules: cursor-rule-1.mdc
  4. Project Rules: cursor-rule-2.mdc
  5. private rule in my project folder ./private-rules/private-rule.md
  6. notepad with the rule

I added only Cursor’s notepad with “Architect Mode” and a file with my private rule to the Chat context.

To get this effect I threw in each of these places at the beginning of the rule.

"start writing with 'I am in … '”

You can put the name of the rules you want to track.
This way you can check if the rule is loaded and if the order is as you expected.