cursor-agent
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCursor Agent
Cursor Agent
Delegate a task to Cursor's headless CLI agent (). Use this to get a second opinion from a non-Claude model on code reviews, plan critiques, text/copy review, or general Q&A.
cursor-agent将任务委托给Cursor的无头CLI Agent()。可用于在代码审查、规划评估、文本/文案审核或通用问答场景中,获取来自非Claude模型的第二意见。
cursor-agentInputs
输入参数
- : The task to hand to cursor-agent. Usually a review or question prompt. If the user adds a model hint (e.g. "with Opus", "using GPT", "pomocí Sonnetu"), extract it and pass via
$task.--model
- : 要交给cursor-agent的任务。通常是审查或问题提示。如果用户添加了模型提示(例如“with Opus”、“using GPT”、“pomocí Sonnetu”),请提取该提示并通过
$task参数传递。--model
Goal
目标
Run cursor-agent headless, surface its output to the user, and add a brief Claude TL;DR so the user doesn't have to re-read a wall of text.
以无头模式运行cursor-agent,向用户展示其输出,并添加一段简短的Claude TL;DR(摘要),避免用户需要重新阅读大段文本。
Steps
步骤
1. Parse the task
1. 解析任务
Extract from and the surrounding conversation:
$task- Model hint — look for phrasing like:
- "Opus" / "claude" →
--model claude-opus-4-7-medium - "Sonnet" →
--model claude-4.6-sonnet-medium - "GPT" / "GPT-5" / "Codex" →
--model gpt-5.3-codex - "Gemini" →
--model gemini-3.1-pro - "Auto" →
--model auto - Nothing mentioned → omit (cursor uses its default:
--model)composer-2-fast
- "Opus" / "claude" →
- Mode hint:
- "plan" / "plan mode" / "navrhni" →
--mode plan - "write" / "edit" / "implement" / "headless" → omit (cursor can write)
--mode - Otherwise → (read-only, default)
--mode ask
- "plan" / "plan mode" / "navrhni" →
- Is this a review? If the task mentions "review", "check", "verify", "second opinion", or references a branch/PR/diff, enrich the prompt (step 2).
Success criteria: Flags decided, prompt ready.
从及上下文对话中提取:
$task- 模型提示 — 查找以下表述:
- "Opus" / "claude" →
--model claude-opus-4-7-medium - "Sonnet" →
--model claude-4.6-sonnet-medium - "GPT" / "GPT-5" / "Codex" →
--model gpt-5.3-codex - "Gemini" →
--model gemini-3.1-pro - "Auto" →
--model auto - 未提及任何模型 → 省略参数(Cursor将使用默认模型:
--model)composer-2-fast
- "Opus" / "claude" →
- 模式提示:
- "plan" / "plan mode" / "navrhni" →
--mode plan - "write" / "edit" / "implement" / "headless" → 省略参数(Cursor支持写入操作)
--mode - 其他情况 → (只读模式,默认值)
--mode ask
- "plan" / "plan mode" / "navrhni" →
- 是否为审查任务? 如果任务中提到“review”、“check”、“verify”、“second opinion”,或引用了分支/PR/差异,请丰富提示内容(步骤2)。
成功标准:确定好参数,准备好提示语。
2. Enrich the prompt (reviews only)
2. 丰富提示内容(仅审查任务)
If the task is a code review:
- Identify the diff scope. Try in order: explicit reference in the task (PR number, branch name), current branch vs (
main), or uncommitted changes (git diff origin/main...HEAD).git diff HEAD - Prepend a short instruction to the prompt so cursor-agent knows what to look at:
"Review the branchagainst main. Use
<name>to see the actual changes. Focus on real issues (correctness, edge cases, security); skip nitpicks. Report under ~400 words withgit diff origin/main...HEADreferences."file:line
For non-review tasks (ask/plan/text/UI), pass the task as-is.
Success criteria: Final prompt string ready for the CLI.
如果是代码审查任务:
- 确定差异范围。按以下顺序尝试:任务中明确引用的内容(PR编号、分支名称)、当前分支与分支的差异(
main),或未提交的更改(git diff origin/main...HEAD)。git diff HEAD - 在提示语前添加简短说明,让cursor-agent知道需要关注的内容:
"审查分支与main分支的差异。使用
<name>查看实际更改。重点关注真实问题(正确性、边缘情况、安全性);忽略琐碎细节。以不超过400字的篇幅报告,并附上git diff origin/main...HEAD引用。"file:line
对于非审查任务(问答/规划/文本/UI),直接传递原始任务即可。
成功标准:准备好用于CLI的最终提示字符串。
3. Run cursor-agent
3. 运行cursor-agent
Invoke headless via Bash:
bash
cursor-agent -p --output-format text [--mode <mode>] [--model <model>] "<prompt>"- Always use (print/headless).
-p - Always use unless the task needs structured output.
--output-format text - Workspace defaults to pwd — don't pass unless the user explicitly asked for a different dir.
--workspace - For runs with only non-write modes (or
--mode ask), no extra permission flags are needed. For headless write mode, do not silently add--mode planor--force; ask the user first.--yolo - Pipe to if you suspect a very long response and want to cap context use. By default, take the full output.
tail -n 200
Success criteria: cursor-agent returns (exit 0) with a response. If it errors (auth, model not available), surface the error to the user instead of hiding it.
通过Bash调用无头模式:
bash
cursor-agent -p --output-format text [--mode <mode>] [--model <model>] "<prompt>"- 始终使用参数(打印/无头模式)。
-p - 始终使用,除非任务需要结构化输出。
--output-format text - 工作区默认为当前目录(pwd)——除非用户明确指定其他目录,否则不要传递参数。
--workspace - 对于仅使用非写入模式的运行(或
--mode ask),无需额外权限参数。对于无头写入模式,不要静默添加--mode plan或--force参数;需先询问用户。--yolo - 如果预计响应会很长,可通过管道传递给以限制上下文使用。默认情况下,保留完整输出。
tail -n 200
成功标准:cursor-agent返回(退出码0)并给出响应。如果出现错误(授权问题、模型不可用),请向用户显示错误信息,不要隐藏。
4. Return the output
4. 返回输出
Present to the user in this order:
- Cursor's verbatim response — quote it directly so the user hears the other model's voice, including file:line references.
- Your short TL;DR — 3–6 bullets at most, separated by a horizontal rule. Highlight what's real vs. noise, and suggest concrete next actions. Do not silently filter cursor's findings; if you disagree with one, call it out explicitly.
Keep the summary tight — the goal is to save the user from re-reading, not to replace cursor's output.
Success criteria: User sees both cursor's raw output and a Claude-curated action list.
按以下顺序向用户展示内容:
- Cursor的原始响应 — 直接引用,让用户听到其他模型的输出,包括引用。
file:line - 简短的TL;DR摘要 — 最多3-6个项目符号,用水平线分隔。突出真实问题与无关内容,并建议具体的后续操作。不要静默过滤Cursor的发现;如果您不同意其中某点,请明确指出。
保持摘要简洁——目的是节省用户重新阅读的时间,而非替代Cursor的输出。
成功标准:用户同时看到Cursor的原始输出和Claude整理的操作列表。
Notes
注意事项
- shows every available model ID. If the user asks for something exotic (e.g. "thinking tier", "max tier"), check the list first.
cursor-agent --list-models - reads/writes inside the current workspace like any CLI tool — it is not sandboxed by default. Treat its output the same way you'd treat a teammate's PR comment: trust but verify.
cursor-agent - This skill is for one-shot delegation. For a longer back-and-forth, the user can run interactively themselves (no
cursor-agent).-p
- 命令会显示所有可用的模型ID。如果用户要求使用特殊模型(例如“thinking tier”、“max tier”),请先查看该列表。
cursor-agent --list-models - 像其他CLI工具一样在当前工作区内读写——默认情况下未沙箱化。对待其输出应如同对待队友的PR评论:信任但需验证。
cursor-agent - 此技能适用于一次性任务委托。如需更长时间的交互,用户可自行以交互式方式运行(不使用
cursor-agent参数)。-p