360 Secure SkillHub
360 安全技能中心

Cursor Tui

核心功能:后台启动Cursor Agent会话,忠实中转其输出(含权限提示),支持单/多行输入、特殊按键操作,管理会话启停。典型场景:用户需在指定目录运行Cursor Agent,进行代码提问、跟进提示等。输入为用户指令、权限响应;输出为Agent原始内容(助手备注需标记),结束可发/quit或Ctrl+D。首次运行需目录信任,未指定目录会先询问。

waldyrious
waldyrious
热度 85.20
最近更新 2026-05-11 17:28:04
分类:开发依赖:MCP 服务应用场景:代码生成 / 调试排错 / DevOps

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add cursor-tui
Metadata
name
cursor-tui
description
Spawn and relay Cursor Agent's CLI (`agent` binary) as an interactive passthrough. Use when the user wants to run Cursor Agent in a directory, ask it questions, or send follow-up prompts — acting as a transparent bridge between the user and the agent session.
metadata
{"openclaw":{"requires":{"bins":["cursor","cursor-agent"]}}}

Cursor CLI Passthrough

Spawn Cursor's agent in a PTY background session and relay its output and the user's inputs as a silent passthrough.

Spawning

{ "tool": "exec", "command": "agent", "pty": true, "background": true, "workdir": "<project-dir>", "yieldMs": 3000 }
  • Always set workdir to the project directory the user wants to work in (not the OpenClaw workspace).
  • If the user doesn't specify a directory, ask before spawning.
  • Note: agent requires workspace trust on first run in a directory — relay the trust prompt and send the user's choice (e.g. a, w, or q) via process send-keys.

Relaying output

After spawning or sending input, poll for output:

{ "tool": "process", "action": "poll", "sessionId": "<id>", "timeout": 15000 }
  • Strip ANSI escape codes mentally, but relay the content faithfully and verbatim.
  • Do not wrap output in code blocks or quote formatting.
  • Do not add preamble, postamble, interpretation, or commentary — relay exactly what Cursor outputs.
  • If you need to add context or a note, prefix that line with your name in brackets (e.g. [YourName]) so it's clearly distinguished from Cursor's output.
  • Permission prompts: When Cursor shows a "Run this command?" or any approval dialog, relay it verbatim to the user and wait for their response. Never approve or deny on the user's behalf.
  • After relaying the agent's response, append a single prompt line: cursor @ <workdir> — use ~ in place of the user's home directory (e.g. ~/repos/myproject not /home/username/repos/myproject).

Sending user input

For single-line prompts:

{ "tool": "process", "action": "submit", "sessionId": "<id>", "data": "<text>" }

For multi-line prompts:

{ "tool": "process", "action": "paste", "sessionId": "<id>", "text": "<text>" }

Then submit with Enter:

{ "tool": "process", "action": "send-keys", "sessionId": "<id>", "keys": ["Enter"] }

For other special keys (arrow keys, Escape, etc.):

{ "tool": "process", "action": "send-keys", "sessionId": "<id>", "keys": ["ArrowUp"] }

Use @filename or @directory/ in interactive prompts to add more context.

Ending the session

Send /quit or Ctrl+D (double-press):

{ "tool": "process", "action": "submit", "sessionId": "<id>", "data": "/quit" }

Notes

  • agent is Cursor's CLI binary. cursor-agent is a backward-compatible alias.
  • The binary must be on PATH. If not found, check TOOLS.md for custom binary paths.
  • One session at a time is typical; use process list to check for orphaned sessions.