run-cursor-agent

Executes coding tasks headlessly through the Cursor CLI with sessions, models, and JSON output.

1|1|Updated Jul 6, 2026
One-click install
npx skills add https://github.com/gabesan21/project-of-projects --skill run-cursor-agent-gabesan21
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: run-cursor-agent
Source: https://github.com/gabesan21/project-of-projects/tree/main/.agents/skills/run-cursor-agent
Command: npx skills add https://github.com/gabesan21/project-of-projects --skill run-cursor-agent-gabesan21

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Delegating coding work to the Cursor CLI (cursor-agent) in headless mode requires knowing its exact flags, session model, and failure modes, which vary across versions and are easy to get wrong in automated pipelines. ## Core Features & Use Cases - Headless invocation: Run cursor-agent with -p --force for non-interactive execution, with --output-format json or stream-json for parseable results and completion detection. - Session and model management: Resume sessions by UUID, list available models, and pin explicit model IDs to avoid failures with default/auto on some plans. - Isolation and safety controls: Use timeouts, isolated git worktrees (-w/--worktree), and strict auth-abort rules when credentials errors appear. - Use Case: An orchestrator needs a bug fixed in src/login.ts without human interaction; it invokes cursor-agent in a dedicated worktree with a scoped prompt, a 900-second timeout, and JSON output to capture the modified files. ## Quick Start Ask the agent to run cursor-agent headlessly with a scoped prompt, a timeout, forced edit mode, and JSON output to implement a small coding change in a specific file.

Frequently Asked Questions about run-cursor-agent

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run cursor-agent headlessly from the command line?▼

Run cursor-agent with -p (print mode) followed by --force to allow edits, passing the prompt as a positional argument after the flags. Add --output-format json and wrap the call in a timeout, since the process can hang after finishing.

How do I resume a cursor-agent session?▼

Resume a session with cursor-agent --resume <uuid> or --continue for the previous one. The -n/--name flag is only a display label, so you must capture the session UUID at creation time to resume it later.

Why does cursor-agent hang without exiting after completing a task?▼

The CLI may not exit when done, so a timeout wrapper is mandatory for every invocation. To detect completion reliably, use --output-format stream-json and watch for the result event in the NDJSON stream.

Why is MCP not recognized when running cursor-agent in CI?▼

In headless or CI environments, MCP servers configured in .cursor/mcp.json are only loaded when you pass --trust --approve-mcps. Without those flags the tools appear as not configured.

What are the limitations of cursor-agent subagents and sandbox mode?▼

Subagents do not inherit the chosen model and fall back to composer-1.5 with no reliable fix. Also, .cursor/sandbox.json is ignored in headless mode due to a known bug, so sandboxing cannot be relied upon.