← 返回 Skills 市场
kailian

cursor-agent-cli

作者 kailian · GitHub ↗ · v1.0.0
cross-platform ⚠ suspicious
409
总下载
0
收藏
2
当前安装
1
版本数
在 OpenClaw 中安装
/install cursor-agent-cli
功能描述
Cursor Agent CLI integration - AI-powered coding agent for terminal. Use when user mentions Cursor Agent, agent CLI, AI coding, code generation, refactoring,...
使用说明 (SKILL.md)

Cursor CLI Integration Skill

🤖 Cursor Agent - AI-powered coding assistant directly in your terminal.

What is Cursor CLI?

Cursor provides two CLI tools:

  1. cursor - Editor launcher (like code for VS Code)
  2. agent ⭐ - Interactive AI coding assistant with full tool access

Installation

# macOS, Linux, WSL
curl https://cursor.com/install -fsS | bash

# Windows PowerShell
irm 'https://cursor.com/install?win32=true' | iex

# Verify installation
agent --version

Quick Start

Interactive Mode

# Start interactive session
agent

# Start with initial prompt
agent "refactor the auth module to use JWT tokens"

# Resume latest session
agent resume

# Continue previous session
agent --continue

# List all sessions
agent ls

Non-Interactive Mode (Scripts/CI)

# Run with specific prompt
agent -p "find and fix performance issues" --model "gpt-5.2"

# Code review
agent -p "review these changes for security issues" --output-format text

# JSON output for parsing
agent -p "analyze this codebase structure" --output-format json

Modes

Mode Description Usage
Agent Full access - can modify code Default
Plan Read-only planning and analysis --plan or /plan
Ask Q&A without making changes --mode=ask or /ask

Switch modes mid-conversation

/plan        # Switch to plan mode
/ask         # Switch to ask mode
Shift+Tab    # Toggle plan mode

Cloud Agent (Background Execution)

Run tasks in the cloud while you're away:

# Start in cloud mode
agent -c "refactor the auth module and add comprehensive tests"

# Send to cloud mid-conversation
& refactor the auth module and add comprehensive tests

Track at: cursor.com/agents

Models

# List available models
agent --list-models

# Use specific model
agent --model "gpt-5.2"
agent --model "sonnet-4"
agent --model "sonnet-4-thinking"

Advanced Options

Force Mode (Auto-approve)

# Auto-approve all commands
agent --force "build the feature"
agent --yolo "build the feature"  # Alias

Sandbox Control

# Enable/disable sandbox
agent --sandbox enabled
agent --sandbox disabled

# Interactive sandbox menu
/sandbox

Workspace & Worktree

# Specify workspace
agent --workspace /path/to/project

# Start in isolated git worktree
agent -w feature-branch
agent --worktree feature-branch --worktree-base main

Custom Headers & API Key

# Set API key
export CURSOR_API_KEY="your-key"
agent --api-key "your-key"

# Add custom headers
agent -H "X-Custom-Header: value"

Output Formats

# Text output (default)
agent -p "analyze code" --output-format text

# JSON output
agent -p "list functions" --output-format json

# Streaming JSON
agent -p "generate code" --output-format stream-json --stream-partial-output

Authentication

# Login
agent login

# Check status
agent status
agent whoami

# Logout
agent logout

Session Management

# Create new empty chat
agent create-chat

# Resume specific chat
agent --resume="chat-id-here"

# Resume latest
agent resume
agent --continue

Cursor Rules Generation

# Interactive rule generation
agent generate-rule
agent rule

MCP (Model Context Protocol) Management

# Manage MCP servers
agent mcp

# Auto-approve MCP servers
agent --approve-mcps

Shell Integration

# Install shell integration
agent install-shell-integration

# Uninstall
agent uninstall-shell-integration

Use Cases

1. Code Refactoring

agent "refactor the authentication module to use modern patterns"

2. Bug Fixing

agent -p "find and fix the memory leak in server.js"

3. Feature Development

agent "implement user profile editing with validation"

4. Code Review

# Review uncommitted changes
git diff | agent -p "review these changes for security issues"

# Review specific file
agent "review api/auth.js for security vulnerabilities"

5. Documentation

agent "add comprehensive JSDoc comments to all functions"

6. Testing

agent "generate unit tests for the auth module with 90% coverage"

7. Performance Optimization

agent "analyze and optimize database queries in user-service.js"

8. Migration

agent "migrate from Express to Fastify maintaining all functionality"

CI/CD Integration

#!/bin/bash
# .github/workflows/code-review.yml

# Automated code review on PR
agent -p "review changed files for security and performance issues" \
  --output-format json \
  --trust \
  > review-report.json

Best Practices

✅ Do

  • Use --plan mode first for complex changes
  • Review proposed changes before approving
  • Use --workspace to specify project directory
  • Save important sessions (they auto-save)
  • Use --force only in trusted environments

❌ Don't

  • Use --yolo on production code without review
  • Share your API key
  • Run in untrusted workspaces with --trust
  • Ignore security warnings

OpenClaw Integration

Call agent from OpenClaw

// Interactive session
exec({ command: "agent 'refactor auth module'", pty: true })

// Non-interactive
exec({ command: "agent -p 'analyze code' --output-format json" })

Use in subagents

When spawning coding agents, you can use Cursor agent as an alternative:

sessions_spawn({
  runtime: "acp",
  agentId: "cursor",  // If configured
  task: "Refactor authentication module"
})

Troubleshooting

Check version

agent --version

Update to latest

agent update

View system info

agent about

Authentication issues

# Re-authenticate
agent logout
agent login

Workspace trust

If prompted about workspace trust in headless mode:

agent --trust -p "your prompt"

Configuration

Cursor agent reads from:

  • ~/.cursor/ - Configuration and cache
  • ~/.cursor/worktrees/ - Git worktrees
  • Environment variables: CURSOR_API_KEY, NO_OPEN_BROWSER

Keyboard Shortcuts (Interactive Mode)

Shortcut Action
Shift+Tab Toggle plan mode
/plan Switch to plan mode
/ask Switch to ask mode
/sandbox Open sandbox menu
/max-mode on Enable max mode
& \x3Cprompt> Send to Cloud Agent

Resources

Version

Current Version: 2026.02.27-e7d2ef6

Check for updates: agent update


Examples

Example 1: Interactive Refactoring

$ agent "refactor the user authentication system"

Agent will:

  1. Analyze current auth code
  2. Propose refactoring plan
  3. Show file changes
  4. Ask for approval
  5. Execute changes

Example 2: Automated Testing

$ agent -p "generate comprehensive tests for src/api/*.js" --force

Non-interactive, auto-approved test generation.

Example 3: Code Review in CI

# .github/workflows/review.yml
- name: AI Code Review
  run: |
    agent -p "review changes for security issues" \
      --output-format json \
      --trust \
      > review.json

Example 4: Cloud Background Task

$ agent -c "implement payment gateway integration with Stripe"
# Go do other work, check back later at cursor.com/agents

Pro Tip: Use agent ls frequently to review and resume past sessions. Context is preserved across sessions!

安全使用建议
This skill appears to be what it says: a wrapper/integration for the Cursor 'agent' CLI. Before installing or using it: 1) Verify you obtain the 'agent' binary from the official Cursor site (https://cursor.com) rather than an untrusted source. 2) Be cautious with examples that use --force / --yolo / --trust or run cloud mode — those can make automated changes or send work to Cursor's servers and may expose code. 3) Only set CURSOR_API_KEY or Authorization headers if you understand the permissions of that key and trust the service. 4) Review the helper scripts (scripts/cursor-agent.sh) locally — they only call the agent binary but check they are unchanged. 5) If you need a higher-assurance install, prefer obtaining the CLI through official releases or package managers documented by Cursor rather than piping arbitrary install scripts into a shell.
功能分析
Type: OpenClaw Skill Name: cursor-agent-cli Version: 1.0.0 The skill provides an interface for the Cursor Agent CLI, which features high-risk capabilities including full filesystem access and code modification. Key indicators include the promotion of auto-approval flags like `--force`, `--yolo`, and `--trust` in SKILL.md and EXAMPLES.md, which allow the AI to bypass security confirmations. Additionally, the installation instructions use an insecure `curl | bash` pattern. While these functions are consistent with the tool's stated purpose as an AI coding assistant, the potential for unreviewed, automated system changes via scripts/cursor-agent.sh warrants a suspicious classification.
能力评估
Purpose & Capability
The name/description match the declared requirements (the skill needs the 'agent' and 'cursor' CLI tools). The included helper scripts and examples only call the agent binary and refer to workspace/git operations appropriate for a coding assistant.
Instruction Scope
SKILL.md and the scripts direct the agent CLI to analyze and modify code, use cloud/background execution, and accept API keys/custom headers. These are in-scope for a coding agent, but several examples (--force / --yolo / --trust, cloud mode) can cause the agent to make automated changes or send tasks to Cursor's cloud — users should understand these behaviors before using them.
Install Mechanism
There is no install spec; SKILL.md recommends installing via curl https://cursor.com/install | bash, which is an expected vendor install URL (cursor.com). The recommendation to pipe a remote install script to a shell is common but carries the usual risk of running remote code—this is a vendor-provided URL, not an unknown shortener or IP.
Credentials
The manifest does not require env vars, but SKILL.md shows examples using CURSOR_API_KEY and custom headers. This is reasonable for a CLI that connects to a cloud service, but providing such keys grants the Cursor service access to your account and possibly to code/data sent to the cloud — only supply keys you trust and scope them appropriately.
Persistence & Privilege
always is false and the skill does not request to be forcibly installed or to modify other skills/configs. Helper scripts are local wrappers that invoke the agent binary; they don't change system-wide settings.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install cursor-agent-cli
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /cursor-agent-cli 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of Cursor Agent CLI integration for OpenClaw: - Adds comprehensive documentation for installing, configuring, and using the Cursor Agent CLI as an AI-powered terminal coding assistant. - Supports interactive and non-interactive modes, cloud agent execution, and multiple output formats. - Details available CLI options, modes (agent/plan/ask), API key usage, authentication, and advanced features like sandbox and worktree. - Provides OpenClaw-specific integration methods and scripting examples. - Includes best practices, troubleshooting, keyboard shortcuts, and links to official resources and community.
元数据
Slug cursor-agent-cli
版本 1.0.0
许可证
累计安装 2
当前安装数 2
历史版本数 1
常见问题

cursor-agent-cli 是什么?

Cursor Agent CLI integration - AI-powered coding agent for terminal. Use when user mentions Cursor Agent, agent CLI, AI coding, code generation, refactoring,... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 409 次。

如何安装 cursor-agent-cli?

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

cursor-agent-cli 是免费的吗?

是的,cursor-agent-cli 完全免费(开源免费),可自由下载、安装和使用。

cursor-agent-cli 支持哪些平台?

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

谁开发了 cursor-agent-cli?

由 kailian(@kailian)开发并维护,当前版本 v1.0.0。

💬 留言讨论