Agent -p without --force modifies .txt files

Where does the bug appear (feature/product)?

Cursor CLI

Describe the Bug

Kerberos:~/test-x$ cat a.txt
x to super unity programmer
Kerberos:~/test-x$ agent -p can you add more text to this file @a.txt

Added more text to a.txt, expanding on x’s Unity programming skills with details about experience, skills, and expertise. The file now includes the original line plus additional content.
Kerberos:~/test-x$ cat a.txt
x to super unity programmer

x is an exceptional Unity developer with years of experience creating amazing games and interactive experiences. His expertise spans across game mechanics, UI/UX design, performance optimization, and cross-platform development.

Key skills:

  • Unity 3D and 2D game development
  • C# programming
  • Shader programming
  • Physics and animation systems
  • Multiplayer networking
  • Mobile and desktop platform optimization
  • Asset pipeline management

Steps to Reproduce

create txt file add text to it. do agent -p add more text @file.txt. might be related to auto model

Expected Behavior

output the text proposed, dont change the file

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

Version: 2026.01.17-d239e66

For AI issues: which model did you use?

Auto

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey, thanks for the report.

There’s a small misunderstanding. The -p (or --print) flag doesn’t mean “only show changes”. It’s a console output mode for scripts and non-interactive use.

From the docs:

-p, --print - Print responses to console (for scripts or non-interactive use). Has access to all tools, including write and bash.

So -p gives the agent full access to write files and run bash. That’s expected and documented behavior, so you can automate tasks in CI and scripts.

If you want a “preview only, no changes” mode, try:

agent --mode ask -p "your prompt @file.txt"

--mode ask uses Ask mode, which only answers questions and won’t modify files.

hi i see!

what confused me was the part in the documentation:

Without --force, changes are only proposed, not applied

agent -p “Add JSDoc comments to this file” # Won’t modify files

https://cursor.com/docs/cli/headless#how-it-works

maybe it’s worth rewriting then?

1 Like

This topic was automatically closed 22 days after the last reply. New replies are no longer allowed.