Agent not editing rule files

Cursor 0.48.1, Pro subscription.

For some reason, I can’t get the Cursor agent to edit mdc rule files in .cursor/rules. The agent shows the diff as if the file was edited, but in reality, the file is not changed in the filesystem. This is pretty annoying as I end up having to apply the diff manually. See the screenshots below.

Could someone from Cursor chime in here? Is this a bug or am I doing something wrong?

The model still new and I’m sure the team are working on a solution for it since the agent mode was released yesterday as @T1000 mentioned in one of the threads.

Here’s what you can try:

  • Re-index everything.
  • Apply the edit manually if needed.
  • Switch from ask mode to agent mode and see if it picks it up then.

I don’t believe Cursor can edit the rule files directly. You’d need to edit them manually.

I use Projects on Claude for this. I keep an updated copy of my rules, User Rules (Rules for AI), and custom agent prompts. That way, Sonnet can see all of them at once. It makes it way easier to fix, add, or alter items, especially when they work together. If you give it enough to go on, it can also write the head information. It’s also nice to have it research what others do in a given situation, what works and what doesn’t, and then it can find that information for me and update the rules directly using artifacts. It’s a bit more work to copy/paste, but at least you know there is continuity between them all.

1 Like

I believe this is an intentional guardrail. If the AI could edit the rules it is supposed to follow, then that could end up in a huge mess.

1 Like

Yes its likely out of precaution as users had their rule files overwritten and complained.

I have seen others asking AI to add a lot of content in to the MDC files where it just caused confusion for AI when it used the file later.

1 Like

For those of us who would like the AI to be able to update the rules, there
is a fix for this, although it disables the VS Code built in (or Cursor specific?) handling of .mdc yaml settings and inline rule associations. This is suboptimal for sure.

With rules becoming a critical aspect of purposeful AI, this precaution is understandable. It is however painfully obvious how useful it is have the AI review the rules and make changes. Ultimately it’s the developer’s responsibilty to allow file changes to take place, so in my view this guardrail is draconian and forces reponsible developers down an undesireable path of unwanted IDE config.

The lowest common user denominator should be the responsible developer using version control. In other words, if your rules get messed up, that’s on you.

1 Like

Normally, I would agree, but I’ll have to side with Cursor on this one. With how easy it is for “developers” to start “programming”, you’re going to get a lot of people using it who need need to be told that the coffee is hot. People will complain regardless of how Cursor handles it. I think they will get fewer complaints not allowing it over allowing it.

Especially with how 3.7 loves to just do whatever it wants, ignoring most of your requests and laser-focusing on the incorrect way you explained something, you’ll get four different versions of the same functions and six different rule files that all do the same thing.

While I agree it’s annoying, there are easy paths to editing the rule files without leaving Cursor. Drop the rule file into the agent chat, simply ask it to make X changes, and return it in a code box. Copy/paste that new rule file, and you’re ready.

However, you will have a tough time if you aren’t using a diff checker for edited by AI files. Personally, I use IT Tools running locally and the text diff tool. I can’t count how many times I’ve modified a prompt and asked for a particular change, only to find it randomly changed something else, reworded this, dropped off that word there, and let’s not forget, that you’re absolutely right when you point it out… :slight_smile:

so you manage your Cursor rules within Claude projects separately from Cursor? In order to have a better holistic view?

I see your point and actually agree having thought about it. From a selfish point of view I’m longing for rules management with the least friction and ideally contained within Cursor.

1 Like

Correct.

There are a few other platforms that can be used as well for this, such as Poe.com with context management disabled. Open WebUI allows for context management to be set per chat. They also have a knowledge system, but it’s RAG-based. You can load files into a chat and enable Using Entire Document, which uses the full document and doesn’t vector it.

I don’t use many other chat platforms, but I’m confident they would all support this.

The idea is that if the LLM can see the complete picture, it can make sweeping changes or find inconsistencies or directions that might conflict.

Plus, if you use something such as Claude Projects and they are all added as files, editing them with Artifacts and then saving those to the project is much easier. Sadly, ChatGPT Projects doesn’t do this; it uses RAG, as far as I can tell. It “claims” it can see it all, but I’ve never had it be able to see everything as it says it can, which causes more issues than it solves. My favorite is that it says it has “Project Specific Memory” that is only active for that project, which is a bold lie, confirmed by it adding to global memory when it claims it’s adding to project memory; support also confirmed there is no such thing as project-specific memory.