promptgarten ๐ŸŒฑ
๐ŸŒ ES

Command reference ยท Cursor CLI

Global Options (Flags)

Collects the most important global flags of the Cursor CLI that can be combined with any command.

Global options can be combined with any command (agent, agent mcp list, agent sandbox run, ...). The most important ones: -p, --print: non-interactive mode, prints the response to the console (for scripts/CI); has full access to write and shell --output-format <format>: text (default), json, or stream-json โ€” only works together with --print --model <model>: sets the model to use --mode <mode>: plan or ask (default is full agent mode when this flag is omitted); --plan is shorthand for --mode=plan -f, --force (alias --yolo): auto-allows commands unless explicitly denied โ€” skips approval prompts --sandbox <mode>: enabled or disabled --approve-mcps: automatically approves all configured MCP servers --trust: trusts the workspace without prompting (headless/print mode only) --add-dir <path>: adds an extra directory for a multi-root session at startup (changelog-only) --auto-review: enables auto-review execution mode, a classifier decides approvals instead of a fixed allowlist (changelog-only) --image: attaches an image to the session (changelog-only) -w, --worktree [name]: runs the agent in a new Git worktree instead of editing the current checkout directly --resume [chatId] / --continue: resumes an existing or the most recently used chat session --workspace <path>: sets the project directory to use -h, --help: shows help for the given command

โœ… WHEN TO USE IT?

Use -p in scripts and CI pipelines

agent -p "find and fix performance issues" --model "gpt-5" --output-format json

Combine flags deliberately instead of picking an unnecessarily broad mode

agent -p --mode ask "summarize the auth module" โ€” read-only, structured output for a script

โ›” WHEN NOT TO?

Set --force/--yolo by default on every run without reviewing the changes

This also auto-approves risky commands without anyone seeing them beforehand.

Better: Review changes deliberately after the run (Ctrl+R or /changes), or additionally set --sandbox enabled to at least isolate execution

Set --mode ask but then expect file changes afterwards

In ask mode the agent makes no file changes; a script expecting write access afterwards will find nothing happened.

Better: Use default agent mode (no --mode flag) for runs that need file changes, or --plan to plan ahead first

SOURCES