Prevent Code Changes Without Approval?

I’m new to cursor, so this has probably been covered before, but searches haven’t turned up anything useful.

Do we have a way to prevent the agent from making changes that aren’t approved?

I love the power of this tool, but it quite often starts going berserk, making changes all over the place, in areas completely unrelated to the current request, breaking things as it goes.

Google says there’s a YOLO mode in the settings that can be disabled, but I don’t see that option anywhere.

I’ve set rules that explicitly state that it must submit it’s suggestions for review, and not make any changes without approval, yet it seems that I still have to remind it every 2-3 messages.

It’s getting tedious having to write Do not make any changes, just provide your suggestions" with every request.

1 Like
  • Don’t use claude 4
  • Use Ask or manual mode
  • Switch off auto-run in Chat in Settings

in the chat switch from agent to manual or possibly create your own mode and edit it as needed

I’ve been having the same issue. I might write a routine on the side and get it the way I want, then add it to the project and tell cursor to use it for X. Then Cursor takes over and solves the problem a different way. So I asked Cursor how I could protect the code I introduce, and it added the following to my code (will see if it works):
/*

  • PROTECTED FILE - Do not modify without explicit permission
  • This PageTable implementation correctly parses tables in images
  • Any changes must be approved by the user
    */

I have to report back that Cursor does not seem to honor this request - continues to change without asking

@okkine, might be a late response, but if you’re still struggling, here’s my comprehensive solution.

Quick Settings Access

First, access your Chat settings through:

  • Settings Icon → Chat, or
  • Ctrl+Shift+J (Windows) or Cmd+Shift+J (Mac) to open settings quickly

About YOLO/Auto-Run Mode

You mentioned Google says there’s a YOLO mode - Google is giving you outdated results there. They’ve renamed it to “Auto-Run Mode” and you can find it in Settings → Chat → Auto-Run → Auto-Run Mode.

Here’s the thing though - Auto-Run mode only controls whether the agent asks for permission before running terminal commands like npm install or git commit. It doesn’t actually control code editing permissions.

If I understood you correctly, your issue is about code editing control, not command execution, so this won’t help with your problem of unwanted code changes.

Here are my suggestions:

1. Use Ask Mode Instead of Agent Mode

  • Ask Mode: Read-only, perfect for getting suggestions without any changes
  • Agent Mode: Full autonomy (what’s causing your problem)
  • Switch to Ask mode when you want suggestions without automatic changes

2. Custom Modes - The Best Solution

The best approach is to use Custom Modes (BETA):

  1. Enable Custom Modes: Go to Settings → Chat → Custom Modes (BETA)
  2. Create your own custom agents: You can basically build your own versions of the agent that only do what you want them to do
  3. Fine-tune Permissions: You can control exactly what tools each mode can access (Search, Edit, Terminal, etc.)

Example Custom Mode Setup:

  • Name: “Review-Only Assistant”
  • Tools: Enable Search, Disable Edit and Terminal
  • Instructions: “You must always ask for explicit approval before making any code changes. Provide detailed explanations and suggestions, but never modify files without permission.”

3. Manual Mode: Only edits explicitly selected files

  • You need to open the file you want to work on, then use chat
  • It can only modify the file you’re currently looking at
  • It can’t access any other files unless you use @ and attach the file to it manually

Additional Control Methods

Cursor Rules (.cursorrules file)

Add rules that modify the AI’s behavior without needing to prompt it repeatedly. Create a .cursorrules file in your project root or go to Settings → Rules & Memories and add rules like:

 - Always ask for approval before making any file changes
 - Provide explanations for all suggestions
 - Never modify files without explicit permission

Make sure to set this to apply for always.

Rules in Settings

Go to Settings → Rules & Memories → User Rules and add rules that apply to all interactions.

Memory Feature

You can tell the agent to save in memory specific preferences like “save in memory that I always want to review changes before you apply them.”

Hope this helps!

1 Like

Cursor still changed my code without my permission in Ask mode. It seems that Ask Mode is not truly read-only?

Here’s my cursor version info in case it helps.

Version: 1.3.8 (Universal)

VSCode Version: 1.99.3