Skip to content

Course · Cursor · The CLI, headless & CI

The CLI, headless & CI

Every Cursor surface this course has used so far had you sitting in front of it: the Agent sidebar (Cursor’s chat panel) where you review each proposed diff, the mode picker (where you set how much the agent may do without asking) you switch before a consequential change. That is the right surface for deciding what to build - the editor-first framing is this course’s bet, not Cursor’s claim; the CLI docs present the terminal agent as a standalone tool in its own right. It is simply not the only surface. The CLI is Cursor’s terminal agent: “Cursor CLI lets you interact with AI agents directly from your terminal to write, review, and modify code” is how its own overview opens (CLI overview, as of September 2026). You invoke it as the agent command (cursor-agent is its legacy alias, CLI changelog), and a command that starts an agent can itself be started by a script, a cron entry, a CI runner, or an HTTP call.

That is this chapter’s subject: the same agent, with nobody watching. A one-shot check you can pipe into other commands, a CI step that reviews every push, a Cloud Agent spawned over the API into Cursor’s cloud or onto your own workers, and an AI reviewer that lands on every pull request. The course’s illustrative budgetcli scenario - a small self-hosted personal-finance API - is the stand-in throughout, because an unattended agent with write access to a finance API is exactly the situation that makes the chapter’s questions real.

The thread running through all of it is the one from Permissions, auto-run & the sandbox: the moment you take yourself out of the loop, the approval prompt you half-ignore in the editor is gone, and whatever containment you settled in advance is the only thing standing between an unattended agent and the live transaction data. That is a control decision - control being what guides execution and enforces boundaries - and it has a cost twin: an unattended run draws down your plan’s usage with nobody watching the meter, which is why every surface in this chapter pairs a least-privilege key with a disposable place to run.

  • Install & headless - the one-line installer, the agent command, then -p runs the agent as a command: output formats, --force, the key that authenticates a script, and the global-only config rule - Install, headless, auth, and the config constraint
  • Slash commands - the built-in set the terminal agent answers to interactively, and why it’s a different list from the editor’s / picker - The CLI’s own slash commands
  • CI - the same headless command on a runner, keyed by a secret and gated on an exit code so a bad import fails the workflow and can block merges through branch protection - Wiring it into CI
  • Cloud Agents and Bugbot - the agent off your hardware entirely: spawned over the API into isolated VMs or onto your own workers (Cloud Agents documentation, as of September 2026), and a reviewer that lands on every PR - Cloud Agents and Bugbot

The moves run outward from your keyboard, one step at a time. Track one thing as you go: at every step outward, the flags get less load-bearing and where the agent runs gets more. By the last page there is barely a command left to spell - the decisions have moved into where it executes, who can start it, and what it is allowed to touch. That trade is the whole chapter. Start with the binary. Next: install, headless, auth, and the config constraint.