← 返回 Skills 市场
rare

Cursor CLI Agent

作者 raressen · GitHub ↗ · v1.1.0
cross-platform ⚠ suspicious
448
总下载
0
收藏
0
当前安装
2
版本数
在 OpenClaw 中安装
/install cursor-cli-agent
功能描述
Delegate coding tasks to Cursor Agent CLI. Use when: (1) building/creating new features or apps, (2) reviewing PRs (spawn in temp dir), (3) refactoring large...
使用说明 (SKILL.md)

Cursor Agent Skill

Execute coding tasks using Cursor CLI (agent command). Supports multiple frontier models (GPT-5, Claude Opus/Sonnet, Gemini, Grok, etc.).

⚠️ PTY Mode Required!

Cursor Agent is an interactive terminal application that requires PTY to work correctly.

# ✅ Correct
bash pty:true command:"agent 'Your prompt'"

# ❌ Wrong - will hang without PTY
bash command:"agent 'Your prompt'"

Bash Tool Parameters

Parameter Type Description
command string Shell command to execute
pty boolean Required! Allocates pseudo-terminal for interactive CLIs
workdir string Working directory (agent only sees this folder's context)
background boolean Run in background, returns sessionId for monitoring
timeout number Timeout in seconds (kills process on expiry)
elevated boolean Run on host instead of sandbox (if allowed)

Quick Start

# Check status and login
agent status
agent login

# List available models
agent --list-models

# Quick task (interactive mode)
bash pty:true command:"agent 'Add error handling to the API calls'"

# Specify working directory
bash pty:true workdir:~/Projects/myproject command:"agent 'Build a snake game'"

The Pattern: workdir + background + pty

For longer tasks, use background mode:

# Start background task
bash pty:true workdir:~/project background:true command:"agent --yolo 'Refactor the auth module'"

# Returns sessionId, monitor with process tool
process action:list
process action:log sessionId:XXX
process action:poll sessionId:XXX

# Send input
process action:submit sessionId:XXX data:"yes"

# Terminate
process action:kill sessionId:XXX

Why workdir matters: Agent wakes up in a focused directory, doesn't wander off reading unrelated files (like your soul.md 😅).


Command Flags Reference

Flag Description
prompt Initial prompt for the agent
--yolo / --force Auto-approve all operations (dangerous but fast)
--model \x3Cmodel> Specify model (gpt-5, sonnet-4, opus-4, gemini, grok, etc.)
--workspace \x3Cpath> Working directory
-w, --worktree [name] Run in isolated git worktree
--print Non-interactive mode, output to console
--mode \x3Cmode> Execution mode: plan (read-only planning), ask (Q&A)
--plan Plan mode (read-only, no file modifications)
--cloud Cloud mode
--resume Resume previous session
--trust Trust workspace (headless mode only)

Execution Modes

Interactive Mode (default)

bash pty:true workdir:~/project command:"agent 'Build a dark mode toggle'"

Auto-Execute Mode (--yolo)

# Auto-approve all operations, fast execution
bash pty:true workdir:~/project command:"agent --yolo 'Refactor the auth module'"

Plan Mode (--plan)

# Read-only mode, generate plan without executing
bash pty:true workdir:~/project command:"agent --plan 'Analyze the codebase structure'"

Ask Mode (--mode ask)

# Q&A only, no file modifications
bash pty:true command:"agent --mode ask 'Explain how the auth flow works'"

Non-Interactive Mode (--print) ⭐ Unique Feature

Cursor's unique --print mode, ideal for scripting and CI/CD:

# Non-interactive execution, output to console
bash pty:true command:"agent --print 'Generate a summary of the codebase'"

# JSON output (ideal for parsing)
bash pty:true command:"agent --print --output-format json 'List all API endpoints'"

# Streaming JSON (real-time processing)
bash pty:true command:"agent --print --output-format stream-json 'Analyze the project'"

Use cases:

  • CI/CD integration
  • Automation scripts
  • Batch tasks
  • Scenarios requiring parsed results

Git Worktree Isolation

For parallel processing of multiple independent tasks:

# Run in isolated worktree
bash pty:true workdir:~/project command:"agent -w fix-issue-78 'Fix the login bug'"

# Specify base branch
bash pty:true workdir:~/project command:"agent -w feature-x --worktree-base develop 'Add feature X'"

Parallel Issue Fixing

Use git worktrees to fix multiple issues simultaneously:

# 1. Create worktrees for each issue
git worktree add -b fix/issue-78 /tmp/issue-78 main
git worktree add -b fix/issue-99 /tmp/issue-99 main

# 2. Launch agent in each worktree (background + PTY)
bash pty:true workdir:/tmp/issue-78 background:true command:"agent --yolo 'Fix issue #78: login bug. Commit and push.'"
bash pty:true workdir:/tmp/issue-99 background:true command:"agent --yolo 'Fix issue #99: API timeout. Commit and push.'"

# 3. Monitor progress
process action:list
process action:log sessionId:XXX

# 4. Create PRs
cd /tmp/issue-78 && git push -u origin fix/issue-78
gh pr create --repo user/repo --head fix/issue-78 --title "fix: ..." --body "..."

# 5. Cleanup
git worktree remove /tmp/issue-78
git worktree remove /tmp/issue-99

Batch PR Reviews

⚠️ NEVER review PRs in OpenClaw's own project directory!

# Clone to temp directory
REVIEW_DIR=$(mktemp -d)
git clone https://github.com/user/repo.git $REVIEW_DIR
cd $REVIEW_DIR && gh pr checkout 130

# Review in plan mode (read-only)
bash pty:true workdir:$REVIEW_DIR command:"agent --plan 'Review this PR for security issues and code quality'"

# Cleanup
trash $REVIEW_DIR

Batch Review Multiple PRs

# Fetch all PR refs
git fetch origin '+refs/pull/*/head:refs/remotes/origin/pr/*'

# Launch multiple agents in parallel
bash pty:true workdir:~/project background:true command:"agent --plan 'Review PR #86. git diff origin/main...origin/pr/86'"
bash pty:true workdir:~/project background:true command:"agent --plan 'Review PR #87. git diff origin/main...origin/pr/87'"

# Monitor
process action:list

# Post results to GitHub
gh pr comment 86 --body "\x3Creview content>"

Process Tool (Background Task Management)

Action Description
list List all running sessions
poll Check if session is still running
log Get session output (supports offset/limit)
write Send raw data to stdin
submit Send data + newline (simulate Enter)
send-keys Send key presses
paste Paste text
kill Terminate session

Model Selection

# List available models
agent --list-models

# Specify model
bash pty:true command:"agent --model opus-4 'Complex refactoring task'"
bash pty:true command:"agent --model gpt-5 'Build a CLI tool'"
bash pty:true command:"agent --model gemini 'Analyze this Python codebase'"

Auto-Notify on Completion

For long-running tasks, append a wake trigger to your prompt:

bash pty:true workdir:~/project background:true command:"agent --yolo 'Build a REST API for todos.

When completely finished, run: openclaw system event --text \"Done: Built todos REST API\" --mode now'"

This triggers immediate notification instead of waiting for heartbeat.


Authentication

# Check login status
agent status

# Login
agent login

# Logout
agent logout

# View account info
agent about

⚠️ Rules

  1. Always use pty:true - Will hang without PTY
  2. Use background for long tasks - Don't block main thread
  3. --yolo for building - Auto-approve changes
  4. --plan for reviewing - Read-only analysis
  5. --print for scripting - Non-interactive, parseable output
  6. Use -w worktree for isolation - Parallel task processing
  7. NEVER start in ~/.openclaw/ - It'll read your soul docs!
  8. Notify user on completion - Don't leave user guessing

Progress Updates

When spawning background agents:

  • Send 1 short message stating what's running
  • Only update when something changes:
    • Milestone completed
    • User input needed
    • Error or user action required
    • Task finished (explain what changed)

Learnings

  • PTY is essential: Without pty:true, interactive agents hang or output garbage.
  • --print is powerful: Cursor's unique non-interactive mode, ideal for CI/CD and scripted tasks.
  • --plan for safety: When unsure what the agent will do, use --plan first.
  • worktree for parallel: For multiple independent tasks, worktree isolation is the best choice.
  • submit vs write: submit sends data + Enter, write sends raw data only.
安全使用建议
This skill is coherent for delegating coding tasks to a Cursor `agent` CLI, but exercise caution before using it on real repos: (1) Verify the `agent` CLI binary you have is the expected Cursor tool from a trusted source. (2) Prefer running the skill in isolated temporary directories or git worktrees (as the SKILL.md recommends), not in important project directories. (3) Avoid using `--yolo`/`--trust` unless you understand and accept fully automated changes and autopushes. (4) Be aware the workflow will use your git/gh authentication (SSH keys or gh auth) to push branches/PRs — do not run it where those credentials grant access you don't want automated. If you need higher assurance, test on a throwaway repo first.
功能分析
Type: OpenClaw Skill Name: cursor-cli-agent Version: 1.1.0 The skill wraps the `cursor-agent` CLI, providing access to powerful `bash` and `process` tools. It exposes high-risk capabilities such as running commands with `elevated:true` (outside the sandbox) and using the `agent` CLI's `--yolo` flag (auto-approving all operations). While the `SKILL.md` documentation includes warnings against unsafe practices (e.g., 'NEVER start in ~/.openclaw/') and does not contain explicit instructions for malicious actions like data exfiltration or backdoor installation, the broad permissions and auto-execution capabilities present a significant risk if the `agent` CLI itself is compromised or given a malicious prompt. This makes the skill suspicious due to its potential for abuse, even without clear evidence of intentional malice from the skill's author.
能力评估
Purpose & Capability
Name/description match the instructions: the skill is an instruction-only wrapper for the Cursor `agent` CLI. The declared required binary (agent) is appropriate for the stated purpose.
Instruction Scope
SKILL.md stays focused on launching the Cursor `agent` CLI (workdir, PTY, background sessions, modes). It includes steps that run git/gh and push branches/PRs, and it instructs use of aggressive flags like `--yolo`/`--trust` which auto-approve operations; these are expected for an automation helper but are potentially dangerous if used on sensitive repositories. The doc warns to spawn reviews in temp dirs and not to operate in the ~/clawd workspace (good).
Install Mechanism
Instruction-only skill with no install spec and no archive downloads. Nothing is written to disk by the skill itself; install risk is low.
Credentials
The skill declares no required env vars and does not request secrets. However, the instructions assume availability of git/gh and network push access (SSH keys or gh auth) and will perform network operations (clone, push, create PRs) when used. This is consistent with its purpose but users must be aware that repository credentials or authenticated CLI state are required by the workflow.
Persistence & Privilege
always:false and no persistent installs. Autonomous invocation is allowed by platform default; nothing in the skill elevates privileges or attempts to persist beyond normal agent activity.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install cursor-cli-agent
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /cursor-cli-agent 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.1.0
**Changelog for cursor-cli-agent v1.1.0** - SKILL.md fully translated from Chinese to English for wider accessibility. - All command explanations, usage patterns, and example scripts updated to English. - Maintained current command options, flows, and best-practices guidance—no feature changes. - Documentation sections and formatting improved for clarity and consistency.
v1.0.0
Initial release of the cursor-agent skill, enabling advanced coding task delegation via Cursor Agent CLI. - Supports interactive and automated coding tasks (building features, PR reviews, refactoring, code exploration). - Requires explicit PTY mode for all agent commands to function correctly. - Provides detailed usage patterns for background jobs, workdir isolation, and process management. - Includes best practices for review, scripting, parallel tasks, model selection, and security. - Comprehensive command and parameter documentation, including process management and notification patterns.
元数据
Slug cursor-cli-agent
版本 1.1.0
许可证
累计安装 0
当前安装数 0
历史版本数 2
常见问题

Cursor CLI Agent 是什么?

Delegate coding tasks to Cursor Agent CLI. Use when: (1) building/creating new features or apps, (2) reviewing PRs (spawn in temp dir), (3) refactoring large... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 448 次。

如何安装 Cursor CLI Agent?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install cursor-cli-agent」即可一键安装,无需额外配置。

Cursor CLI Agent 是免费的吗?

是的,Cursor CLI Agent 完全免费(开源免费),可自由下载、安装和使用。

Cursor CLI Agent 支持哪些平台?

Cursor CLI Agent 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Cursor CLI Agent?

由 raressen(@rare)开发并维护,当前版本 v1.1.0。

💬 留言讨论