Installation
Install the Cursor CLI by running:
curl https://cursor.com/install -fsS | bash
Usage Modes
1. Interactive Mode
Start an interactive session with the Cursor Agent:
cursor-agent
This opens a conversational interface where you can describe your coding tasks, review proposed changes, and approve commands.
2. Non-Interactive Mode
For scripting or automation purposes, use the non-interactive mode:
cursor-agent -p "Your prompt here"
Replace "Your prompt here" with your specific instruction. This mode is suitable for integrating Cursor into scripts, CI pipelines, or other automated workflows.
3. Shell Mode
Cursor CLI includes a Shell Mode that allows you to execute shell commands directly:
cursor-agent shell
In this mode, you can run quick, non-interactive commands without leaving your conversation. Note that commands timeout after 30 seconds, and long-running processes or interactive prompts are not supported.
Managing Sessions
Resume a Previous Conversation
cursor-agent resume
List All Previous Chats
cursor-agent ls
These commands help maintain context across multiple interactions.
Security
Before executing terminal commands, the CLI will prompt you for approval. Ensure you review and approve commands to maintain security.
