Next-Gen App & Browser Testing Cloud
Trusted by 2 Mn+ QAs & Devs to accelerate their release cycles

Installing Cursor CLI on every platform, the three modes, the full command reference, a real CI example, and how to verify what it actually did.

Mythili Raju
Author

Salman Khan
Reviewer
Published on: August 27, 2026
Run agent -p "fix the login bug" --force in a terminal with no display attached, and the only feedback you get back is text: a summary of what changed, and an exit code. Nothing in that output ever rendered a page.
That is Cursor CLI working exactly as designed. Cursor built its reputation as an editor-first tool, and the CLI is the terminal half of the same product: same account, same models, none of the diff view.
This covers installation, the three modes, the complete current command reference, a real CI example, and what to do about the part the CLI cannot see for itself.
TL;DR
Cursor CLI is Cursor's agent running as a terminal program: one install command, the same account and model access as the editor, and three modes (Agent, Plan, Ask) usable interactively or headlessly for scripts and CI. It has no GUI of its own, so anything it reports about a rendered page has to be checked somewhere else.
Cursor's own CLI documentation defines it in one sentence: it "lets you interact with AI agents directly from your terminal to write, review, and modify code."
The relationship to the editor matters more than the definition. Cursor built its identity as an editor-first tool, and the CLI is not a separate product bolted on afterward; it shares the same account, the same model access, and the same underlying agent as the IDE. What it does not share is the diff view, the inline suggestions, or any of the visual surface that makes the editor an editor.
One command per platform, both downloading and adding the binary to your PATH.
# macOS, Linux, or WSL
curl https://cursor.com/install -fsS | bash
# Windows PowerShell
irm 'https://cursor.com/install?win32=true' | iexInteractive use signs in through the CLI's own login flow against your existing Cursor account. Headless and CI use skip that flow entirely and authenticate with an API key instead:
| Context | Auth method |
|---|---|
| Interactive, local terminal | The CLI's own sign-in flow, same Cursor account as the editor |
| Headless, CI, or scripted | CURSOR_API_KEY environment variable, typically set from a repository secret |
Every session runs in one of three modes, and the mode decides how much the agent is allowed to touch.
| Mode | Trigger | What it does |
|---|---|---|
| Agent (default) | No flag needed | Reads, writes, and modifies files to complete the task |
| Plan | /plan, --plan, or --mode=plan | Proposes an approach without editing anything, for review before committing to it |
| Ask | /ask or --mode=ask | Read-only question answering, no file changes possible |
Plan mode is the one worth defaulting to on anything you have not scoped tightly. It costs one extra round trip to review the proposal, and that round trip is cheaper than an Agent-mode run that touched the wrong files.
The flags that actually get used, gathered from Cursor's separate overview and headless documentation pages into one table.
| Flag or command | What it does |
|---|---|
| -p "prompt" | Triggers non-interactive mode: runs once, prints a result, exits |
| --force | Auto-approves file modifications instead of pausing for confirmation |
| --output-format text | Clean, final-answer-only output, the default for a human reading the terminal |
| --output-format json | A single structured JSON object, built for a script to parse |
| --output-format stream-json | One JSON object per message, for message-level progress tracking |
| --stream-partial-output | Streams incremental deltas within stream-json mode |
| --model <name> | Selects the model for that session (Cursor's own docs use gpt-5 as the example) |
| --mode=plan / --mode=ask | Sets Plan or Ask mode from the command line instead of the in-session slash command |
| & (prefix on a message) | Hands the request to a Cloud Agent instead of running it locally |
| /sandbox | Sandbox controls for the local run, inside an interactive session |
| -w / --worktree | Runs the session in an isolated Git worktree instead of the current checkout |
A complete headless invocation combines several of these in one line:
agent -p --force --output-format json \
"Add input validation to the login form in auth.ts" \
--model gpt-5Note: TestMu AI's Kane CLI takes the same plain-English objective and runs it against a real Chrome browser instead of source code. Try TestMu AI free!
Cursor's GitHub Actions documentation gives the working shape: install the CLI, export the API key from a repository secret, then call the agent in a run step.
- name: Install Cursor CLI
run: |
curl https://cursor.com/install -fsS | bash
echo "$HOME/.cursor/bin" >> $GITHUB_PATH
- name: Run Cursor Agent
env:
CURSOR_API_KEY: ${{ secrets.CURSOR_API_KEY }}
run: |
agent -p "Your prompt here" --model gpt-5That example stops at running the agent. It does not gate the pipeline on whether the change actually worked, because the CLI has no way to check that from inside a terminal. The verification section below covers the step this workflow is missing.
The same pattern generalizes past GitHub Actions: any CI system that can export an environment variable and run a shell command can call agent -p the same way.
Several coding agents now ship a terminal mode. What differs is which product came first.
| Dimension | Cursor CLI | Claude Code |
|---|---|---|
| Where it started | Terminal counterpart added to an editor-first product | Terminal-first from launch |
| Delegation to smaller units | Cloud Agent handoff via the & prefix | Named subagents with their own frontmatter, context window, and tool scope |
| Lifecycle hooks | Not part of the CLI's documented surface | PreToolUse, PostToolUse, Stop, and more, each with defined exit-code semantics |
| Headless output | text, json, or stream-json via --output-format | Newline-delimited JSON in agent mode |
| Model choice | --model per session | Per-subagent model field, including cheaper models for narrow tasks |
Neither difference makes one strictly better; they reflect different starting points. A team already living in the Cursor editor gets a terminal mode with zero account switching. A team that wants fine-grained control over delegated work gets more surface in Claude Code's subagent system. Our breakdown of OpenCode vs Claude Code covers a third point on the same map for teams weighing an open-source terminal agent instead, and our Windsurf vs Cursor comparison covers the editor-level choice one level up from the terminal.
For code-level claims, usually yes. A -p run that says it added a function, or that a test command exited 0, is reporting something it can actually check: the file on disk, the process exit code.
Delegating a bounded research task and trusting a compressed answer back is a real pattern, and it is worth showing rather than describing. Writing this article required confirming that today's sibling piece on testing AI coding tools did not already cover Cursor CLI specifically, so we spawned a subagent to read it and report back. It returned exactly this:
2) "Cursor CLI" mentioned? No. The term "Cursor CLI" never appears. All
references are to the Cursor editor/IDE and its rules system (.mdc files,
.cursor/rules, chat sessions) - not the terminal/headless cursor.com/cli
product.
3) Covers Cursor CLI installation/flags/modes/CI? No. Zero mention of
Cursor CLI installation, CLI flags, Agent/Plan/Ask modes, or CI/CD usage
of the terminal product. This is entirely open territory for your new
article.That subagent read a 650-line file and returned seven lines. The compression is trustworthy precisely because the claim it is making, whether a specific string appears in a specific file, is a claim its own tools (Read, Grep) can actually verify.
A UI claim is a different kind of claim. When agent -p "fix the login bug" --force reports success, it is reporting that the diff compiles and, at best, that a test command exited 0. Nothing in that toolchain opened a browser, so nothing confirms the login form actually renders or the fixed field actually accepts input. Kane CLI from TestMu AI is built for that specific gap: a plain-English objective, a real Chrome browser, and a standard exit code (0 passed, 1 failed, 2 environment error, 3 timeout) that a CI step can check the same way it checks any other command's exit status.
npm install -g @testmuai/kane-cli
kane-cli login --username "$LT_USERNAME" --access-key "$LT_ACCESS_KEY"
kane-cli run --agent --headless \
"sign in with the test account, open the dashboard, assert the page
shows the account name" \
--url https://www.testmuai.com/selenium-playground/Dropped into the same CI job right after the Cursor CLI step, that command is the piece the official GitHub Actions example above stops short of. The Kane CLI introduction documentation covers authentication and the full command reference.
Three limits worth planning around before wiring it into a workflow.
None of these rule out headless use. They rule out treating a text summary as proof of anything the summary cannot actually see.
Four steps cover a working setup end to end.
The terminal half of Cursor is genuinely useful for exactly what it is built for: running the same agent somewhere the editor cannot go. Start with the Kane CLI documentation to close the one gap it was never built to cover.
Author
Mythili is a Community Contributor at TestMu AI with 3+ years of experience in software testing and marketing. She holds certifications in Automation Testing, KaneAI, Selenium, Appium, Playwright, and Cypress. At TestMu AI, she leads go-to-market (GTM) strategies, collaborates on feature launches, and creates SEO optimized content that bridges technical depth with business relevance. A graduate of St. Joseph’s University, Bangalore, Mythili has authored 35+ blogs and learning hubs on AI-driven test automation and quality engineering. Her work focuses on making complex QA topics accessible while aligning content strategy with product and business goals.
Reviewer
Salman is a Test Automation Evangelist and Community Contributor at TestMu AI, with over 6 years of hands-on experience in software testing and automation. He has completed his Master of Technology in Computer Science and Engineering, demonstrating strong technical expertise in software development, testing, AI agents and LLMs. He is certified in KaneAI, Automation Testing, Selenium, Cypress, Playwright, and Appium, with deep experience in CI/CD pipelines, cross-browser testing, AI in testing, and mobile automation. Salman works closely with engineering teams to convert complex testing concepts into actionable, developer-first content. Salman has authored 120+ technical tutorials, guides, and documentation on test automation, web development, and related domains, making him a strong voice in the QA and testing community.
Did you find this page helpful?
More Related Blogs
TestMu AI forEnterprise
Get access to solutions built on Enterprise
grade security, privacy, & compliance