cline-delegate

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Cline Delegate

Cline 任务委托

You are the orchestrator. Delegate a bounded coding task to a separate implementer - the Cline coding agent CLI - then review what it produced and land it yourself. You write the brief and own the judgment; the implementer makes changes in its own session in a clean working tree; you verify and commit.
The loop needs only a shell command and file access, so any comparable orchestrator can drive it.
你是协调者。将一个边界明确的编码任务委托给独立的实现者——Cline编码代理CLI,然后审查其产出并自行完成提交。你编写任务简报并负责判断;实现者在独立会话的干净工作目录中进行修改;你负责验证并提交。
这个循环只需要shell命令和文件访问权限,因此任何类似的协调工具都可以驱动它。

When NOT to use this

何时不使用此方法

  • The task is small enough to do inline; delegation overhead is not worth it.
  • The
    cline
    CLI is not installed or authenticated.
  • You require the relay to configure a sandbox. Cline exposes sandbox controls, but this relay leaves them to the CLI environment; use
    --plan
    when the run must be read-only.
  • 任务足够小,可以直接完成;委托的开销得不偿失。
  • 未安装或未认证
    cline
    CLI。
  • 你需要中继配置沙箱。Cline提供沙箱控制,但此中继将其留给CLI环境;当运行必须为只读时,请使用
    --plan
    参数。

Prerequisites (check once)

前提条件(检查一次)

  1. Install
    cline
    (npm or bundled binary; the relay probes
    cline --version
    ).
  2. Authenticate: run
    cline auth
    (interactive sign-in), or configure
    ANTHROPIC_API_KEY
    / an OpenAI-compatible base URL.
  3. Confirm
    cline --version
    succeeds.
  4. Work in, or point
    --cd
    at, the target git repository.
  1. 安装
    cline
    (通过npm或捆绑二进制文件;中继会探测
    cline --version
    )。
  2. 认证:运行
    cline auth
    (交互式登录),或配置
    ANTHROPIC_API_KEY
    / 兼容OpenAI的基础URL。
  3. 确认
    cline --version
    执行成功。
  4. 在目标git仓库中工作,或通过
    --cd
    参数指向该仓库。

Choose the model (optional)

选择模型(可选)

Cline picks a default model. To choose another, pass the separate
--model <id>
or
--provider <name>
(e.g.
anthropic
,
openai-native
,
openrouter
). The relay accepts letters, digits, and
. _ : / -
only (the value reaches a shell on Windows).
Cline会选择默认模型。要选择其他模型,请传递独立的
--model <id>
--provider <name>
参数(例如
anthropic
openai-native
openrouter
)。中继仅接受字母、数字以及
. _ : / -
字符(该值会传递到Windows系统的shell中)。

The loop

操作循环

Run these five steps per task. Steps 1, 4, and 5 require judgment; 2 and 3 are mechanical.
每个任务执行以下五个步骤。步骤1、4和5需要判断;步骤2和3是机械操作。

1. Write a brief

1. 编写任务简报

Cline sees only the text you send. It cannot read your conversation: the brief must stand alone with the goal, current state, what to change, what to leave untouched, the project's real gates, and a report contract. Keep each brief to a single task. Write it to a file and pass it as the relay's
--brief
. See references/writing-the-brief.md.
Cline只能看到你发送的文本。它无法读取你的对话:任务简报必须独立包含目标、当前状态、需要修改的内容、需要保留的内容、项目的实际准入标准以及报告约定。每个简报仅对应一个任务。将简报写入文件,并作为中继的
--brief
参数传递。请参阅references/writing-the-brief.md

2. Dispatch

2. 分发任务

Use the bundled relay. It runs
cline --json -v
, streams the brief on stdin behind a fixed positional instruction, captures the JSON event stream, and writes
result.json
.
bash
node "<skill-dir>/scripts/relay.mjs" --brief brief.txt --cd /path/to/repo
使用捆绑的中继工具。它会运行
cline --json -v
,在固定的位置指令后通过标准输入流传输简报,捕获JSON事件流,并写入
result.json
文件。
bash
node "<skill-dir>/scripts/relay.mjs" --brief brief.txt --cd /path/to/repo

choose a model / provider: add --model <id> --provider <name>

选择模型/提供商: 添加 --model <id> --provider <name>

read-only planning pass: add --plan (forces --auto-approve false)

只读规划阶段: 添加 --plan (强制设置 --auto-approve false)

deny approval-required tools: add --auto-approve false

禁用需要审批的工具: 添加 --auto-approve false

hard time limit (watchdog): add --timeout 2h (the 30m default suits brief runs; most implementation briefs should be 1-2h)

硬超时限制(监控): 添加 --timeout 2h (默认30分钟适合简短运行;大多数实现类简报应设置为1-2小时)

see all options: node .../relay.mjs --help

查看所有选项: node .../relay.mjs --help


The child's cwd pins the workspace. The relay writes artifacts under the system temp dir by
default and never commits. See [references/dispatch-and-poll.md](references/dispatch-and-poll.md).

子进程的当前工作目录固定为工作区。中继默认将产物写入系统临时目录,且绝不会自动提交。请参阅[references/dispatch-and-poll.md](references/dispatch-and-poll.md)。

3. Wait for completion

3. 等待完成

The relay blocks until cline finishes. Run it with the orchestrator's background-command facility, or background it in the shell and poll for
result.json
. A pre-run usage error exits 2 and writes no result; a missing
cline
exits 127 and writes
status: "cline_unavailable"
.
Completion means the process exited and
result.json
exists - trust process state and the working tree, not the progress display. Cline's final message is the
finalMessage
field of
result.json
.
中继会阻塞直到cline完成运行。可以通过协调者的后台命令功能运行它,或者在shell中将其置于后台并轮询
result.json
文件是否存在。预运行时的使用错误会以状态码2退出,且不会写入结果;若
cline
未找到,则以状态码127退出,并写入
status: "cline_unavailable"
完成意味着进程已退出且
result.json
存在——请信任进程状态和工作目录,而非进度显示。Cline的最终消息位于
result.json
finalMessage
字段中。

4. Review - do not trust the self-report

4. 审查——不要信任自我报告

  • Re-run the project's gates yourself.
  • Read the diff against the brief, starting with
    touchedFiles
    .
  • Run relevant guard skills if installed.
See references/review-and-land.md.
  • 自行重新运行项目的准入检查。
  • 根据任务简报阅读差异,从
    touchedFiles
    开始。
  • 若已安装相关防护工具,请运行它们。
请参阅references/review-and-land.md

5. Land it

5. 完成提交

If the work is good, commit it. The relay never commits - the diff and
result.json
are the record; run
git status
and
git diff
first to confirm exactly what changed. If the group has a PR flow, make the commit and push a branch; let human review happen. If the diff is wrong or incomplete, re-dispatch a corrected brief in a fresh run and review again.
如果工作成果合格,提交代码。中继绝不会自动提交——差异文件和
result.json
是记录;请先运行
git status
git diff
来确认具体的变更内容。如果团队采用PR流程,请提交代码并推送分支;交由人工审查。如果差异不正确或不完整,请在新的运行中分发修正后的简报并再次审查。

Autonomy and permissions

自主性与权限

The relay explicitly passes Cline's
--auto-approve
, defaulting to
true
in act mode. Cline plan mode can request a switch to act mode, so
--plan
forces
--auto-approve false
; the relay rejects
--plan --auto-approve true
. That pair is the read-only gate. Cline also exposes sandbox through
--data-dir
/
CLINE_SANDBOX
, but the relay does not configure or override it. Plan-first for anything risky, then review the plan before a separate act-mode dispatch. Malformed or malicious briefs remain dangerous in act mode because commands run as the current user.
中继会显式传递Cline的
--auto-approve
参数,在操作模式下默认值为
true
。Cline的规划模式可以请求切换到操作模式,因此
--plan
参数会强制设置
--auto-approve false
;中继会拒绝
--plan --auto-approve true
的组合。这对参数是只读准入控制。Cline还通过
--data-dir
/
CLINE_SANDBOX
提供沙箱控制,但中继不会配置或覆盖它。对于任何有风险的操作,请先进行规划,然后在单独的操作模式分发前审查规划内容。在操作模式下,格式错误或恶意的简报仍然具有危险性,因为命令会以当前用户身份运行。

Authorization model

授权模型

Delegation is something the human opts into. Once briefed, cline works as a tool you approved use of. The boundary is: do not accept conclusions from the self-report; verify everything on disk. For anything touching credentials, production data, or irreversible operations, stop and ask the human first instead of encoding it in a brief.
委托是用户主动选择的操作。一旦收到简报,cline会作为你批准使用的工具工作。边界是:不要接受自我报告中的结论;请验证磁盘上的所有内容。对于任何涉及凭证、生产数据或不可逆操作的任务,请先停止并询问用户,而非将其编码到简报中。

References

参考资料

  • references/writing-the-brief.md - structure, scope, gates, brief delivery.
  • references/dispatch-and-poll.md - flags, artifacts,
    result.json
    , and failure recovery.
  • references/review-and-land.md - what to verify before calling the diff done, at the end of a run.
  • references/multi-task-queues.md - sequential queues, constraint carry-forward, progress tracking, and the final coherence pass.
  • references/writing-the-brief.md - 结构、范围、准入标准、简报交付。
  • references/dispatch-and-poll.md - 标志、产物、
    result.json
    以及故障恢复。
  • references/review-and-land.md - 在运行结束时,确认差异完成前需要验证的内容。
  • references/multi-task-queues.md - 顺序队列、约束传递、进度跟踪以及最终一致性检查。