Agent

Agent is Cursor’s assistant for complex coding work: it can run terminal commands and edit code on its own. Open it in the sidepane with Cmd+I on macOS or Ctrl+I on Windows / Linux. The source of truth is Agent Overview.


Three components

PieceContents
InstructionsSystem prompt + rules (project / user / team / AGENTS.md)
ToolsSearch the repo and the web, read/edit files, shell, browser, images, questions
ModelThe model you pick for this task (see Models)

Cursor tunes instructions and tools per model. Your job is to state the goal, check rules into Git, and review diffs. There is no documented cap on tool calls in a single task.


Tool catalog (official groups)

ToolWhat it does
Search files and foldersFind by name, directory layout, keywords / patterns
WebBuild queries and search the web
Fetch RulesLoad rules by type and description
Read filesRead source; images (.png / .jpg / .gif / .webp / .svg) go into context for vision-capable models
Edit filesPropose edits and apply them
Run shell commandsRun commands and watch output; uses the first terminal profile by default
BrowserScreenshots, page interaction, visual checks (see official Browser docs)
Image generationFrom text or a reference image; saved under assets/ by default and shown inline
Ask questionsClarify mid-task; it can keep reading / editing / running while it waits

Set the default terminal: Ctrl+Shift+P (macOS Cmd+Shift+P) → Terminal: Select Default Profile.

MCP tools show up under Available Tools and are used in Plan Mode too. See MCP.


Checkpoints

Agent snapshots the codebase before significant edits, capturing files it is about to change.

  • Click a checkpoint in the chat timeline to preview files, then Restore.
  • Or use Restore Checkpoint on a previous request, or the + control on hover.
  • Restore reverts files only; it does not delete messages.
  • Checkpoints are local and separate from Git. Use them to undo Agent exploration; use Git for durable history.
If this refactor looks worse than the last checkpoint, restore that
checkpoint. Keep the conversation. Then try a narrower approach:
only extract the parser, do not touch the CLI.

Checkpoints fit exploration, large refactors, and iterative tries. They are not a branching strategy.


Queue vs send immediately

While Agent is working you can talk in two ways:

ActionShortcutBehavior
QueueEnterWaits until the current task finishes; drag to reorder
Send nowCmd+Enter / Ctrl+EnterSkips the queue; appends to the latest user message and runs immediately

Use send-now to steer (“stop, do not touch the schema”). Use the queue for “write the changelog after tests.”

Docs also describe steer: a follow-up arrives at the next tool-call boundary instead of cutting work in half. Keys on the web / Agents Window may differ (some builds use Tab to queue). In the desktop sidepane, remember Enter to queue and Ctrl/Cmd+Enter to send now. In the CLI, Enter steers at a safe boundary; a second Enter interrupts the turn.


/goal for long-lived work

Agent treats each message as a new job. /goal attaches an objective that stays active until it is fully complete:

/goal fix all flaky tests and make CI green
  • In the CLI, Ctrl+C pauses the goal.
  • Pair with a Custom Mode (one playbook for the session) or the built-in /loop skill for recurring check-ins.
  • Officially, /goal is still rolling out; if you do not see it, try a new chat.

/goal fits work with a finish line (“tests green”, “lint clean on this package”), not vague “make the architecture better.”


How to write one task

Put scope, bans, and verification in the same message:

Add request IDs to HTTP error logs in the existing logger.

Constraints:
- Do not change public API shapes
- Do not add dependencies

Verify:
- Run the repo's unit tests
- Show one before/after log line

Then: read the diff → read which commands ran → Restore if needed.


Safety habits

  • Read the command line before approving shell; block destructive git and production credentials.
  • MCP and the terminal share Run Modes; keep auto-approve tight until you trust the workflow.
  • Checkpoints are not backups; git commit at real milestones.

Next

评论