Cursor CLI Headless
Execute coding tasks using the Cursor CLI in headless print mode. Use when delegating code writing, refactoring, analysis, or review tasks to a headless Curs... Skill: Cursor CLI Headless Owner: daxingplay Summary: Execute coding tasks using the Cursor CLI in headless print mode. Use when delegating code writing, refactoring, analysis, or review tasks to a headless Curs... Tags: latest:1.1.0 Version history: v1.1.0 | 2026-02-18T16:08:20.542Z | user - Added .DS_Store file to the repository. - Updated documentation to recommend using only the wrapper script (scripts/run-task.s
Rank
62
Safety
84
Downloads
1.1k
Updated
Oct 11, 2026
Version
1.1.0
Source
CLAWHUB
About
What it does, and when to use it.
Capability contract not published. No trust telemetry is available yet. 1.1K downloads reported by the source. Last updated 10/11/2026.
Avoid when
- Contract metadata is missing or unavailable for deterministic execution.
Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing
Public facts
Every fact links back to the source it came from.
- Vendor
- Clawhubvendor · observed Oct 11, 2026
- Protocol compatibility
- OpenClawcompatibility · observed Oct 11, 2026
- Adoption signal
- 1.1K downloadsadoption · observed Oct 11, 2026
- Latest release
- 1.1.0release · observed Feb 18, 2026
- Handshake status
- UNKNOWNsecurity
Install and run
Setup complexity: low.
clawhub skill install s17c8np6jtmbs0fq3753vs60s186vc9w:cursor-cli-headless- Setup complexity is LOW. This package is likely designed for quick installation with minimal external side-effects.
- Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.
Contract: missing
curl -s "https://www.xpersona.co/api/v1/agents/clawhub-daxingplay-cursor-cli-headless/snapshot"
Documentation
CLAWHUB
21,704 characters of source documentation, loaded on request.
Extracted files
3 files captured from the source.
SKILL.md
--- name: cursor-cli-headless description: Execute coding tasks using the Cursor CLI in headless print mode. Use when delegating code writing, refactoring, analysis, or review tasks to a headless Cursor agent process, running automated code changes, or batch-processing files with the agent CLI. --- # Cursor CLI Headless Execute coding tasks using the Cursor CLI in non-interactive (print) mode via the wrapper script for scripts, automation, and batch processing. ## Prerequisites - **Cursor CLI installed**: Run `agent --version`. If missing, install: `curl https://cursor.com/install -fsS | bash` (macOS/Linux/WSL) or see [Installation](https://cursor.com/docs/cli/installation). - **Authenticated**: Set `CURSOR_API_KEY` in the environment for scripts, or run `agent login` interactively once. Check if already logged in with `agent status` or `agent whoami`. ## Quick start Use `scripts/run-task.sh` with either an inline prompt or a prompt file: ```bash # Prompt from file (stream progress by default) ./scripts/run-task.sh -f prompt.txt # Inline prompt, run in a specific project directory ./scripts/run-task.sh -p "Add tests for auth module" -d /path/to/project ``` ## Wrapper script: run-task.sh `scripts/run-task.sh` runs the Cursor agent in headless mode. **Recommended:** keep file modifications and stream progress **on** (default). Use `--no-force` only with tmux for interactive mode (agent proposes changes for review). Use `--no-stream` for plain output. **Arguments:** - `-p "prompt"` — inline prompt (mutually exclusive with `-f`) - `-f prompt-file.txt` — read prompt from file (for long prompts) - `-d dir` — working directory (default: current directory) - `-o format` — `text`, `json`, or `stream-json` (with default streaming, format is stream-json) - `-m model` — model name - `--mode mode` — `agent`, `plan`, or `ask` - `--force` — allow file modifications (default) - `--no-force` — do not modify files; agent only proposes changes - `--stream` — stream-json with progress display (default; requires `jq` for progress) - `--no-stream` — plain output only; use with `-o text` or `-o json` **Output formats:** | Format | Use when | |--------|----------| | (default stream) | Live progress (model, tool calls, chars); NDJSON on stdout, progress on stderr | | `-o text --no-stream` | Only the final assistant message | | `-o json --no-stream` | Single JSON object with `result`, `duration_ms`, etc.; parse with `jq -r '.result'` | **Examples:** ```bash # Task from file, apply changes, stream progress (default) ./scripts/run-task.sh -f tasks/refactor-auth.txt # Inline prompt, specific project, JSON result only ./scripts/run-task.sh -p "Summarize README.md" -d /path/to/repo --no-stream -o json # Plain text output, no progress ./scripts/run-task.sh -f tasks/review.txt --no-stream -o text ``` ## Working directory The agent runs in the script’s working directory. Use `-d /path/to/project` so the agent sees that project as the root. ## Error handling
_meta.json
{
"ownerId": "kn79yres364wtdabck9g87vqx581dmyf",
"slug": "cursor-cli-headless",
"version": "1.1.0",
"publishedAt": 1771430900542
}reference.md
# Output Format Reference
Detailed schemas for Cursor CLI headless output. Use with `--output-format json` or `--output-format stream-json`.
## JSON format (single object on success)
Use `--output-format json`. One JSON object (one line) when the run completes successfully.
### Success response
```json
{
"type": "result",
"subtype": "success",
"is_error": false,
"duration_ms": 1234,
"duration_api_ms": 1234,
"result": "<full assistant text>",
"session_id": "<uuid>",
"request_id": "<optional request id>"
}
```
| Field | Description |
|-------|-------------|
| `type` | Always `"result"` |
| `subtype` | Always `"success"` for success |
| `is_error` | Always `false` for success |
| `duration_ms` | Total execution time (ms) |
| `duration_api_ms` | API time (ms); currently same as `duration_ms` |
| `result` | Full assistant response text (all text deltas concatenated) |
| `session_id` | Session identifier |
| `request_id` | Optional request id |
On failure: process exits non-zero, error on stderr, no JSON object emitted.
---
## Stream-JSON format (NDJSON)
Use `--output-format stream-json`. Each line is one JSON object (NDJSON). Optionally use `--stream-partial-output` for character-level text deltas.
### Event types
#### 1. System initialization (once per run)
```json
{
"type": "system",
"subtype": "init",
"apiKeySource": "env|flag|login",
"cwd": "/absolute/path",
"session_id": "<uuid>",
"model": "<model display name>",
"permissionMode": "default"
}
```
#### 2. User message
```json
{
"type": "user",
"message": {
"role": "user",
"content": [{ "type": "text", "text": "<prompt>" }]
},
"session_id": "<uuid>"
}
```
#### 3. Assistant message
One event per complete message segment (between tool calls). With `--stream-partial-output`, multiple events per segment with small text deltas; concatenate `message.content[].text` to get full text.
```json
{
"type": "assistant",
"message": {
"role": "assistant",
"content": [{ "type": "text", "text": "<message text>" }]
},
"session_id": "<uuid>"
}
```
#### 4. Tool call — started
```json
{
"type": "tool_call",
"subtype": "started",
"call_id": "<string id>",
"tool_call": { "<tool type>": { "args": { ... } } },
"session_id": "<uuid>"
}
```
#### 5. Tool call — completed
```json
{
"type": "tool_call",
"subtype": "completed",
"call_id": "<string id>",
"tool_call": {
"<tool type>": {
"args": { ... },
"result": { "success": { ... } }
}
},
"session_id": "<uuid>"
}
```
#### 6. Terminal result (end of stream on success)
```json
{
"type": "result",
"subtype": "success",
"duration_ms": 1234,
"duration_api_ms": 1234,
"is_error": false,
"result": "<full assistant text>",
"session_id": "<uuid>",
"request_id": "<optional request id>"
}
```
---
## Tool call types
### readToolCall
- **Started**: `tool_call.readToolCall.args` → `{ "path": "file.txt" }`
- **Completed**: `tool_call.readToolCall.reAionUi
Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!
activepieces
AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
cherry-studio
AI productivity studio with smart chat, autonomous agents, and 300+ assistants.
CopilotKit
The Frontend for Agents & Generative UI. React + Angular
Machine-readable data
The same record, as JSON, for agents and crawlers.
{
"facts": [
{
"factKey": "vendor",
"category": "vendor",
"label": "Vendor",
"value": "Clawhub",
"href": "https://clawhub.ai/daxingplay/skills/cursor-cli-headless",
"sourceUrl": "https://clawhub.ai/daxingplay/skills/cursor-cli-headless",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-11T11:54:36.158Z",
"isPublic": true
},
{
"factKey": "protocols",
"category": "compatibility",
"label": "Protocol compatibility",
"value": "OpenClaw",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-daxingplay-cursor-cli-headless/contract",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-daxingplay-cursor-cli-headless/contract",
"sourceType": "contract",
"confidence": "medium",
"observedAt": "2026-10-11T11:54:36.158Z",
"isPublic": true
},
{
"factKey": "traction",
"category": "adoption",
"label": "Adoption signal",
"value": "1.1K downloads",
"href": "https://clawhub.ai/daxingplay/cursor-cli-headless",
"sourceUrl": "https://clawhub.ai/daxingplay/cursor-cli-headless",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-11T11:54:36.158Z",
"isPublic": true
},
{
"factKey": "latest_release",
"category": "release",
"label": "Latest release",
"value": "1.1.0",
"href": "https://clawhub.ai/daxingplay/cursor-cli-headless",
"sourceUrl": "https://clawhub.ai/daxingplay/cursor-cli-headless",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-02-18T16:08:20.542Z",
"isPublic": true
},
{
"factKey": "handshake_status",
"category": "security",
"label": "Handshake status",
"value": "UNKNOWN",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-daxingplay-cursor-cli-headless/trust",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-daxingplay-cursor-cli-headless/trust",
"sourceType": "trust",
"confidence": "medium",
"observedAt": null,
"isPublic": true
}
],
"events": [
{
"eventType": "release",
"title": "Release 1.1.0",
"description": "- Added .DS_Store file to the repository. - Updated documentation to recommend using only the wrapper script (`scripts/run-task.sh`) for running headless tasks. - Simplified usage instructions, with a focus on streaming output and file modification as defaults. - Clarified options and argument usage for the wrapper script. - Improved instructions for selecting output formats and handling errors. - Added explicit directions for verifying authentication and agent status.",
"href": "https://clawhub.ai/daxingplay/cursor-cli-headless",
"sourceUrl": "https://clawhub.ai/daxingplay/cursor-cli-headless",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-02-18T16:08:20.542Z",
"isPublic": true
}
]
}Record generated Oct 11, 2026.
