In version 2.0, when configuring glob patterns in Cursor’s project rule MDC files, the matched MDC files are not automatically loaded as always_applied_workspace_rules during conversations. However, they do appear correctly in Cursor Settings. The same configuration method was working in the latest 1.x version released on October 28th.
Is this a bug or intentional behavior?
This feature is quite useful as it allows more flexible rule configuration based on different files/modules.
Steps to Reproduce
Create a project rule MDC file with glob pattern configuration:
Create .cursor/rules/demo.mdc with the following content:
Hey, thanks for the report. Let me clarify the expected behavior for glob-pattern rules.
Rules with alwaysApply: false and a glob are Auto Attached: they load when matching files are referenced in chat (via @ mention or added to context), not just when the file is opened in the editor.
From your steps, it looks like you opened test/1.py in the editor but might not have referenced it in chat. Please try:
Open test/1.py
Start a chat and @ mention the file or add test/1.py to the context
Check if demo.mdc now appears in always_applied_workspace_rules
Thx, I’ve confirmed that indeed, by @-mentioning a file, the corresponding MDC files that match this file via globs will be loaded.
It seems that the difference from version 1.x is that previously, the currently open file would always trigger this loading. Now it requires manual @-mentioning. This is a change. I think this is acceptable, because although the current workflow requires an extra @ operation, you can achieve the same purpose through the @ operation alone without opening the file at all.
However, there might be a derivative issue: If you don’t actively @ a file, but the agent proactively searches project files in the conversation and reads or modifies arbitrary files, will the corresponding MDC files be loaded based on glob matching? It seems like this doesn’t work now, but it did in version 1.x.
Thanks for confirming that @ mention behavior works.
About your follow-up on agent-initiated file search: that’s a good catch about the difference from 1.x. I’ll check with the team whether glob-matching rules should apply when the agent searches/reads files on its own, not only when you explicitly use an @ mention.
Could you share the Request ID from the dialog where the agent searched and read files but the matching glob rules didn’t load? That will help us verify the expected behavior.
In these requests, I constructed a minimal verification example that demonstrates that after reading a file, the rules matched with this file through glob patterns are loaded into the conversation. They are attached after the read results in the form of ‘Cursor Rules relevant to this file:’.
Furthermore, if the file is read again, the rules will not be loaded repeatedly.
This seems very reasonable and effective, and there don’t appear to be any issues.
An advanced question is whether these ‘Cursor Rules relevant to this file:’ will be cleaned up after summarization. For large projects and tasks, this is also a fairly critical point. I think perhaps the rules from previous turns of the conversation should be cleaned up to reduce potentially irrelevant context usage. And if a file from before the summarization is read again, perhaps the rule should be attached again. I hope you have considered and correctly implemented the relevant logic.
@deanrie I really think its a bug. Is there any way to have original (cursor 1) behaviour?
It was quite simple and smart to have rules which auto apply based on what files you currently working on. Example, backend rules when u open .php, frontend rules when you open .ts