返回顶部
c

cursor-agentCursor代理

Use Cursor Agent for coding tasks via two paths: (1) Local CLI — run Cursor Agent directly from terminal for fast, general-purpose coding in any project; (2) VS Code Node — control a remote Cursor/VS Code IDE through OpenClaw Node protocol for targeted project work with full IDE intelligence. Prefer CLI for speed; use Node when you need IDE features (diagnostics, references, debugging).

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 3.0.2
安全检测
已通过
588
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

cursor-agent

Cursor Agent 技能

两种通过 OpenClaw 使用 Cursor Agent 的方式,适用于不同场景。

相关资源

路径选择

场景路径原因
快速编码任务、修复 Bug、重构CLI快速,无需配置,随处可用
生成代码、审查 PR、编写测试
CLI | 非交互式 -p 模式完美适用 | | 使用真实诊断信息修复类型错误 | Node | diagnostics.get 显示实际的 TS/代码检查错误 | | 先导航定义/引用 | Node | lang.definition、lang.references | | 运行项目测试并迭代 | Node | test.run + test.results 循环 | | 使用断点调试 | Node | 完整的调试协议 | | 对特定项目进行针对性更改 | Node | IDE 工作区上下文精确 |

默认:CLI。 仅在需要 IDE 智能功能时使用 Node。



路径 1:CLI(本地 Cursor Agent)

前提条件

bash

安装


curl https://cursor.com/install -fsS | bash

登录

agent login

验证

agent --version

模式

模式标志使用场景
Agent(默认)完整编码 — 读取、写入、运行命令
Plan
--plan 或 --mode=plan | 先设计方案,然后选择本地或云端执行 | | Ask | --mode=ask | 只读代码库探索,不进行编辑 |

交互模式

bash

启动交互会话


agent

使用提示启动

agent 将认证模块重构为使用 JWT 令牌

以计划模式启动

agent --plan 为 API 设计缓存层

以询问模式启动

agent --mode=ask 解释认证中间件的工作原理

非交互模式(自动化)

bash

一次性任务(打印结果后退出)


agent -p 查找并修复 src/ 中所有未使用的导入

使用特定模型

agent -p 审查此代码是否存在安全问题 --model gpt-5.2

JSON 格式输出以便解析

agent -p 列出所有 TODO 注释 --output-format json

流式 JSON(实时)

agent -p 运行测试并报告 --output-format stream-json --stream-partial-output

强制模式(自动应用更改,无需确认)

agent -p 修复所有代码检查错误 --force

云端 Agent 交接

将工作推送到 Cursor 云端,以便在您离开时继续运行:

bash

直接在云端启动


agent -c 重构认证模块并添加全面测试

对话中:添加 & 前缀发送到云端

& 重构认证模块并添加全面测试

cursor.com/agents 继续。

会话管理

bash
agent ls # 列出之前的对话
agent resume # 恢复最近的会话
agent --continue # 继续之前的会话
agent --resume=id # 恢复特定对话

斜杠命令(交互模式)

命令操作
/plan切换到计划模式 / 查看当前计划
/ask
切换到询问模式 | | /models | 切换 AI 模型 | | /compress | 总结对话,释放上下文 | | /rules | 创建/编辑规则 | | /commands | 创建/编辑自定义命令 | | /mcp enable | 启用 MCP 服务器 | | /mcp disable | 禁用 MCP 服务器 | | /sandbox | 配置沙箱模式 | | /max-mode [on\|off] | 切换最大模式 | | /resume | 恢复之前的对话 |

键盘快捷键

快捷键操作
Shift+Tab循环切换模式(Agent → Plan → Ask)
Shift+Enter
插入换行(多行提示) | | Ctrl+R | 审查更改(i 查看说明,方向键导航) | | Ctrl+D | 退出(双击确保安全) | | ArrowUp | 循环浏览上一条消息 |

上下文和规则

CLI 自动加载:

  • - .cursor/rules 目录
  • 项目根目录下的 AGENTS.md
  • 项目根目录下的 CLAUDE.md
  • mcp.json 中的 MCP 服务器

在交互模式下使用 @filename 或 @directory/ 包含上下文。

⚠️ 从 OpenClaw 使用 CLI(需要 PTY)

Cursor CLI 是交互式 TUI — 需要真实终端。使用 pty:true:

bash

✅ 正确 — 使用 PTY


exec pty:true command:agent -p 你的任务 workdir:/path/to/project

✅ 后台运行较长时间的任务

exec pty:true background:true command:agent -p 构建 REST API workdir:/path/to/project

❌ 错误 — 会挂起

exec command:agent -p 你的任务

对于长时间任务,使用后台 + 轮询:

bash

启动


exec pty:true background:true workdir:~/project command:agent -p 为认证模块添加全面测试 --force

检查进度

process action:log sessionId:XXX

检查是否完成

process action:poll sessionId:XXX

沙箱控制

bash

启用沙箱启动


agent --sandbox enabled

禁用沙箱启动

agent --sandbox disabled

交互式配置

/sandbox

沙箱支持精细的网络访问控制 — 定义 Agent 可以访问的域名。



路径 2:VS Code / Cursor Node

通过 OpenClaw Node 协议远程控制 Cursor/VS Code IDE。IDE 必须安装并连接 openclaw-node-vscode 扩展。

前提条件

  • - 已安装扩展:VS Code Marketplace
  • 在 nodes status 中可见 Node
  • 扩展状态栏显示 🟢

调用模式

nodes invoke --node <名称> --invokeCommand <命令> --invokeParamsJson {key:val}

超时指南

操作invokeTimeoutMs说明
文件/编辑器/语言15000快速 IDE 操作
Git
30000 | 可能涉及磁盘 I/O | | 测试 | 60000 | 取决于测试套件 | | Agent 计划/询问 | 180000 | AI 思考时间 | | Agent 运行 | 300000 | 完整编码任务 |

命令参考

类别前缀关键命令
文件vscode.file.read、write、edit、delete
目录
vscode.dir. | list | | 语言 | vscode.lang.* | definition、references、hover、symbols、rename、codeActions、format | | 编辑器 | vscode.editor.* | context、openFiles、selections | | 诊断 | vscode.diagnostics.* | get(错误/警告) | | Git | vscode.git.* | status、diff、log、blame、stage、unstage、commit、stash | | 测试 | vscode.test.* | list、run、results | | 调试 | vscode.debug.* | launch、stop、breakpoint、evaluate、stackTrace、variables、status | | Agent | vscode.agent.* | status、run、setup | | 工作区 | vscode.workspace.* | info |

快速示例

bash

读取文件

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 cursor-ide-agent-1776299105 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 cursor-ide-agent-1776299105 技能

通过命令行安装

skillhub install cursor-ide-agent-1776299105

下载

⬇ 下载 cursor-agent v3.0.2(免费)

文件大小: 5.74 KB | 发布时间: 2026-4-16 16:30

v3.0.2 最新 2026-4-16 16:30
Fix ClawHub URLs to correct /{owner}/{slug} format

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部