Command reference ยท Cursor CLI
agent [prompt...]
Starts the Cursor CLI in default agent mode, optionally with a prompt passed directly as an argument.
Running agent with no subcommand starts an interactive session in agent mode โ the default mode with full tool access (read, write, shell commands, web). An optional prompt argument is sent as the first message right away, e.g. agent "refactor the auth module to use JWT tokens". Without an argument it opens an empty chat window. For non-interactive runs (scripts, CI), the -p/--print flag additionally makes it print only the final response.
โ WHEN TO USE IT?
Start directly with a concrete task instead of typing it in afterwards
agent "fix the failing tests in src/auth"
Start an interactive session for exploratory work with no fixed task yet
agent โ then clarify goals and questions step by step in the chat
โ WHEN NOT TO?
The run needs to happen unattended in a script or CI job
Default agent mode interactively asks for approval before running commands, which blocks unattended runs.
Better: Combine -p with --force, e.g. agent -p --force "<prompt>" (see the collective Global Options entry)
Only reading/analysis is wanted, no file changes
Default mode has full write and shell access.
Better: Set --mode ask at startup, or use /ask after starting
SOURCES
- Cursor Docs โ CLI Reference: Parameters โ cursor.com
- Cursor Docs โ CLI Overview โ cursor.com