• Tech Dev NotesTech Dev Notes
Apps
  • App lookup
  • App compare
Market movement
  • App charts
  • App rankings
Visual proof
  • App screens
  • App listing screenshots
  • App icons
Build intelligence
  • App tech stacks
  • Tool releases
  • Developers
More
  • X feature flags
  • Grokipedia
  • Blog
  • Follow on X
Skip to content
All content/ filesChangelog

cursor-docs/latest/content · Jun 26, 20:20 UTC

pages/cli/using.txt

TXT·5.1 KB·64 lines

content/

  • pages

    • api.txt
    • approval-agents.txt
    • bugbot.txt
    • cloud-agent.txt
    • customize-cursor.txt
    • enterprise.txt
    • evals.txt
    • extension-api.txt
    • hooks.txt
    • mcp.txt
    • models-and-pricing.txt
    • plugins.txt
    • rules.txt
  • pages/account

    • regions.txt
    • update-access.txt
  • pages/account/enterprise

    • billing-groups.txt
    • cyber-safeguards.txt
    • service-accounts.txt
  • pages/account/organizations

    • organization-admin-api.txt
  • pages/account/pricing

    • request-based-legacy.txt
  • pages/account/teams

    • admin-api.txt
    • ai-code-tracking-api.txt
    • analytics-api.txt
    • analytics.txt
    • dashboard.txt
    • members.txt
    • pricing.txt
    • scim.txt
    • setup.txt
    • sso.txt
  • pages/agent

    • agent-review.txt
    • agents-window.txt
    • debug-mode.txt
    • design-mode.txt
    • overview.txt
    • plan-mode.txt
    • prompting.txt
    • security.txt
  • pages/agent/security

    • run-modes.txt
  • pages/agent/tools

    • browser.txt
    • canvas.txt
    • search.txt
    • terminal.txt
  • pages/cli

    • acp.txt
    • changelog.txt
    • github-actions.txt
    • headless.txt
    • installation.txt
    • mcp.txt
    • overview.txt
    • shell-mode.txt
    • using.txt
  • pages/cli/reference

    • authentication.txt
    • configuration.txt
    • output-format.txt
    • parameters.txt
    • permissions.txt
    • slash-commands.txt
    • terminal-setup.txt
  • pages/cloud-agent

    • automations.txt
    • best-practices.txt
    • capabilities.txt
    • choose-runtime.txt
    • my-machines.txt
    • private-workers.txt
    • security-network.txt
    • self-hosted-cloud-run.txt
    • self-hosted-k8s.txt
    • self-hosted-pool.txt
    • settings.txt
    • setup.txt
  • pages/cloud-agent/api

    • endpoints.txt
    • webhooks.txt
  • pages/configuration

    • worktrees.txt
  • pages/configuration/migrations

    • vscode.txt
  • pages/cursor-review

    • merge-queue.txt
    • overview.txt
    • pr-inbox.txt
    • pr-page.txt
  • pages/cursor-review/cli

    • authentication.txt
    • parameters.txt
    • stacking.txt
  • pages/customizing

    • aws-bedrock.txt
  • pages/enterprise

    • baa.txt
    • compliance-and-monitoring.txt
    • deployment-patterns.txt
    • endpoint-security.txt
    • identity-and-access-management.txt
    • llm-safety-and-controls.txt
    • model-and-integration-management.txt
    • network-configuration.txt
    • organization-groups.txt
    • organizations.txt
    • pooled-usage.txt
    • privacy-and-data-governance.txt
    • private-connectivity.txt
    • security-hardening.txt
  • pages/get-started

    • quickstart.txt
  • pages/integrations

    • azure-devops.txt
    • bitbucket.txt
    • cursor-blame.txt
    • github.txt
    • gitlab.txt
    • jetbrains.txt
    • jira.txt
    • linear.txt
    • microsoft-teams.txt
    • notion.txt
    • slack.txt
    • xcode.txt
  • pages/mcp

    • install-links.txt
  • pages/models

    • claude-4-5-haiku.txt
    • claude-4-5-sonnet.txt
    • claude-4-6-sonnet.txt
    • claude-4-sonnet-1m.txt
    • claude-4-sonnet.txt
    • claude-fable-5.txt
    • claude-opus-4-5.txt
    • claude-opus-4-6-fast.txt
    • claude-opus-4-6.txt
    • claude-opus-4-7-fast.txt
    • claude-opus-4-7.txt
    • claude-opus-4-8.txt
    • cursor-composer-1-5.txt
    • cursor-composer-1.txt
    • cursor-composer-2-5.txt
    • cursor-composer-2.txt
    • gemini-2-5-flash.txt
    • gemini-3-1-pro.txt
    • gemini-3-5-flash.txt
    • gemini-3-flash.txt
    • gemini-3-pro-image-preview.txt
    • gemini-3-pro.txt
    • glm-5-2.txt
    • gpt-5-1-codex-max.txt
    • gpt-5-1-codex-mini.txt
    • gpt-5-1-codex.txt
    • gpt-5-2-codex.txt
    • gpt-5-2.txt
    • gpt-5-3-codex.txt
    • gpt-5-4-mini.txt
    • gpt-5-4-nano.txt
    • gpt-5-4.txt
    • gpt-5-5.txt
    • gpt-5-codex.txt
    • gpt-5-fast.txt
    • gpt-5-mini.txt
    • gpt-5.txt
    • grok-4-20.txt
    • grok-4-3.txt
    • grok-build-0-1.txt
    • kimi-k2-5.txt
  • pages/reference

    • deeplinks.txt
    • ignore-file.txt
    • keyboard-shortcuts.txt
    • permissions.txt
    • plugins.txt
    • sandbox.txt
    • third-party-hooks.txt
  • pages/sdk

    • python.txt
route: /docs/cli/using
title: Using Agent in CLI
description: Use Agent from the command line with prompting strategies, MCP support, and rule integration. Navigate conversations, review changes, and manage command approval.

Using Agent in CLI
Modes
The CLI supports the same modes as the editor. Switch modes using slash commands or the --mode flag.
Plan mode
Use Plan mode to design your approach before coding. The agent asks clarifying questions to refine your plan.
Press Shift+Tab to rotate to Plan mode
Use /plan to switch to Plan mode
Start with --plan or --mode=plan flag
Ask mode
Use Ask mode to explore code without making changes. The agent searches your codebase and provides answers without editing files.
Use /ask to switch to Ask mode
Start with --mode=ask flag
Prompting
Stating intent clearly is recommended for the best results. For example, you can use the prompt "do not write any code" to ensure that the agent won't edit any files. This is generally helpful when planning tasks before implementing them.
Agent has tools for file operations, searching, running shell commands, and web access.
MCP
Agent supports MCP (Model Context Protocol) for extended functionality and integrations. The CLI will automatically detect and respect your mcp.json configuration file, enabling the same MCP servers and tools that you've configured for the editor.
ACP
Agent also supports ACP (Agent Client Protocol) for custom client integrations. Use agent acp to run Cursor CLI as an ACP server over stdio with JSON-RPC messaging.
Rules
The CLI agent supports the same rules system as the editor. You can create rules in the .cursor/rules directory to provide context and guidance to the agent. These rules will be automatically loaded and applied based on their configuration, allowing you to customize the agent's behavior for different parts of your project or specific file types.
The CLI also reads AGENTS.md and CLAUDE.md at the project root (if
present) and applies them as rules alongside .cursor/rules.
Working with Agent
Navigation
Previous messages can be accessed using arrow up (ArrowUpArrow Up) where you can cycle through them.
Input shortcuts
Shift+Tab — Rotate between modes (Agent, Plan, Ask)
Shift+Enter — Insert a newline instead of submitting, making it easier to write multi-line prompts.
Ctrl+D — Exit the CLI. Follows standard shell behavior, requiring a double-press to exit.
Ctrl+J or +Enter — Universal alternatives for inserting newlines that work in all terminals.
Shift+Enter works in iTerm2, Ghostty, Kitty, Warp, and Zed. For tmux users, use Ctrl+J instead. See Terminal setup for configuration options and troubleshooting.
Review
Review changes with Ctrl+R. Press i to add follow-up instructions. Use ArrowUpArrow Up/ArrowDownArrow Down to scroll, and ArrowLeftArrow Left/ArrowRightArrow Right to switch files.
Selecting context
Select files and folders to include in context with @. Free up space in the context window by running /summarize. /compress remains an alias.
Cloud Agent handoff
Push your conversation to a Cloud Agent and let it keep running while you're away. Prepend & to any message to send it to the cloud. Pick it back up on web or mobile at cursor.com/agents.
# Send a task to Cloud Agent mid-conversation
& refactor the auth module and add comprehensive tests
CLI worktrees
Pass -w or --worktree [name] to run the agent in a new Git worktree instead of editing your current checkout directly. Cursor creates these checkouts under ~/.cursor/worktrees/<reponame>/<name>, alongside worktrees created from the editor. If you omit name, Cursor generates one.
Cursor cleans up CLI worktrees with the same retention rules it uses for editor worktrees. For cleanup settings and limits, see How are old worktrees cleaned up?.
Combine --workspace <path> when you need an explicit repository root. Otherwise the CLI uses the current working directory. --worktree only changes where the agent makes file edits inside that project.
# Create a temporary worktree from the current repository with a generated name
agent --worktree "upgrade the test runner and fix any broken snapshots"
# Create a named worktree from another repository
agent --workspace ~/src/my-app --worktree auth-fix "fix the flaky auth test and open a PR"
History
Continue from an existing thread with --resume [thread id] to load prior context.
To resume the most recent conversation, use agent resume, --continue, or the /resume slash command.
You can also run agent ls to open previous chats and resume one.
Command approval
Before running terminal commands, CLI will ask you to approve (y) or reject (n) execution.
Non-interactive mode
Use -p or --print to run Agent in non-interactive mode. This will print the response to the console.
With non-interactive mode, you can invoke Agent in a non-interactive way. This allows you to integrate it in scripts, CI pipelines, etc.
You can combine this with --output-format to control how the output is formatted. For example, use --output-format json for structured output that's easier to parse in scripts, or --output-format text for plain text output of the agent's final response.
Cursor has full write access in non-interactive mode.
Previouspages/cli/shell-mode.txtNextpages/cloud-agent.txt

© 2026 Tech Dev Notes

RSSAboutAPIPrivacyTermsSitemap@techdevnotes