copilot-delegate
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCopilot Delegate
Copilot 委托工作流程
You are the orchestrator. Delegate a bounded coding task to a separate implementer — the
GitHub Copilot 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.
你作为协调者,将一个边界清晰的编码任务委托给独立的实现工具——GitHub Copilot CLI,之后审核其产出内容并自行完成提交。你撰写任务简报并负责最终判断;实现工具会在干净的工作目录中独立会话进行修改;你负责验证并提交代码。
该流程仅需要Shell命令和文件访问权限,因此任何类似的协调工具都可以驱动它。
When NOT to use this
请勿使用此流程的场景
- The task is small enough to do inline; delegation overhead is not worth it.
- The CLI is not installed or authenticated.
copilot - You need a hard sandbox. Copilot exposes sandbox controls, but they are upstream-experimental
(MXC-based, controlled via the command and settings, disabled by default) — this relay does not configure them.
/sandboxonly disables edit tools (--read-only); shell commands still run. If project files must not change at all, dispatch against a clean or isolated worktree.--mode plan
- 任务足够简单可直接完成;委托带来的额外开销得不偿失。
- 未安装或未认证CLI。
copilot - 需要严格的沙箱环境。Copilot提供沙箱控制功能,但属于上游实验性特性(基于MXC,通过命令和设置控制,默认禁用)——本中继工具不会配置这些特性。
/sandbox仅会禁用编辑工具(--read-only模式);Shell命令仍可运行。如果项目文件绝对不能被修改,请在干净或隔离的工作目录中执行任务。--mode plan
Prerequisites (check once)
前置条件(只需检查一次)
- Install (
copilot; the CLI requires Node 22+, the relay itself runs on Node 18+ — the relay probesnpm install -g @github/copilot).copilot version - Authenticate: run (interactive web/device flow), or set
copilot login/COPILOT_GITHUB_TOKEN/GH_TOKENin the environment.GITHUB_TOKEN - Confirm succeeds.
copilot version - Work in, or point at, the target git repository.
--cd
- 安装(执行
copilot;CLI需要Node 22+版本,中继工具本身可在Node 18+版本运行——中继工具会检测npm install -g @github/copilot)。copilot version - 认证:执行(交互式网页/设备验证流程),或在环境变量中设置
copilot login/COPILOT_GITHUB_TOKEN/GH_TOKEN。GITHUB_TOKEN - 确认命令可成功执行。
copilot version - 在目标git仓库中工作,或通过参数指定目标仓库路径。
--cd
Choose the model (optional)
选择模型(可选)
Copilot picks a default model (). To choose another, pass .
The relay accepts letters, digits, and only (the value reaches a shell on Windows).
auto--model <name>. _ : / -Copilot会选择默认模型()。如需选择其他模型,传递参数。
中继工具仅接受字母、数字以及字符(该参数值会传递给Windows系统的Shell)。
auto--model <name>. _ : / -Choose the effort (optional)
选择推理强度(可选)
Copilot supports a reasoning effort dial: with values
, , , , or . The relay rejects any other value
before dispatch.
--effort <level>lowmediumhighxhighmaxCopilot支持推理强度调节:使用参数,可选值为、、、或。中继工具在执行前会拒绝其他任何值。
--effort <level>lowmediumhighxhighmaxThe 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. 撰写任务简报
Copilot 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 . See references/writing-the-brief.md.
--briefCopilot只能看到你发送的文本内容,无法读取你的对话记录:任务简报必须独立包含目标、当前状态、需要修改的内容、需要保留的内容、项目的实际校验规则,以及报告要求。每份简报对应单个任务。将简报写入文件并通过中继工具的参数传递。详见references/writing-the-brief.md。
--brief2. Dispatch
2. 任务分发
Use the bundled relay. It runs with ,
captures the JSONL event stream, and writes .
copilot -p--output-format json --no-color --stream offresult.jsonbash
node "<skill-dir>/scripts/relay.mjs" --brief brief.txt --cd /path/to/repo使用内置的中继工具。它会运行并附带参数,捕获JSONL事件流并写入文件。
copilot -p--output-format json --no-color --stream offresult.jsonbash
node "<skill-dir>/scripts/relay.mjs" --brief brief.txt --cd /path/to/repochoose a model: add --model <name>
选择模型: 添加 --model <name>
set reasoning effort: add --effort <level>
设置推理强度: 添加 --effort <level>
read-only planning pass: add --read-only (forces --mode plan)
只读规划模式: 添加 --read-only (强制使用--mode plan模式)
full tool autonomy: add --allow-all-tools
完全工具自主权: 添加 --allow-all-tools
hard time limit (watchdog): add --timeout 2h (the 30m default suits brief runs)
强制时间限制(监控): 添加 --timeout 2h (默认30分钟适合短任务)
resume a session: add --session <id> or --resume-last
恢复会话: 添加 --session <id> 或 --resume-last
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 copilot finishes. Run it with the orchestrator's background-command
facility, or background it in the shell and poll for . A pre-run usage error exits 2
and writes no result; a missing exits 127 and writes .
result.jsoncopilotstatus: "copilot_unavailable"Completion means the process exited and exists — trust process state and the
working tree, not the progress display. Copilot's final assistant message is the
field of .
result.jsonfinalMessageresult.json中继工具会阻塞直到copilot完成任务。可通过协调工具的后台命令功能运行它,或在Shell中后台运行并轮询文件。预运行时的使用错误会以退出码2结束且不会写入结果;若未安装则以退出码127结束并写入。
result.jsoncopilotstatus: "copilot_unavailable"任务完成意味着进程已退出且文件存在——请以进程状态和工作目录为准,而非进度显示。Copilot的最终助手消息会存储在的字段中。
result.jsonresult.jsonfinalMessage4. 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 are the
record; run and 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.jsongit statusgit diff如果工作成果符合要求,提交代码。中继工具绝不会自动提交——代码差异和是记录;提交前请先运行和确认具体修改内容。如果团队采用PR流程,请提交代码并推送分支,交由人工审核。如果代码差异有误或不完整,请在新的运行中重新分发修正后的任务简报并再次审核。
result.jsongit statusgit diffAutonomy and permissions
自主权与权限
Without , copilot auto-denies tool calls in headless mode: the process exits 0
but the relay detects the denial events and reports with the CLI's own error
message and a hint to pass . This is the honest default — the orchestrator sees
the failure rather than a silent no-op.
--allow-all-toolsstatus: "failed"--allow-all-tools--allow-all-tools--read-only--mode plan--allow-all-toolsCopilot also exposes sandbox controls, but they are upstream-experimental (MXC-based, controlled
via the command and settings, disabled by default). This relay does not configure them.
/sandbox如果未添加参数,copilot在无头模式下会自动拒绝工具调用:进程会以退出码0结束,但中继工具会检测到拒绝事件并报告,同时附带CLI自身的错误消息和添加参数的提示。这是默认的安全设置——协调工具会看到失败信息而非静默无操作。
--allow-all-toolsstatus: "failed"--allow-all-tools--allow-all-tools--read-only--mode plan--allow-all-toolsCopilot还提供沙箱控制功能,但属于上游实验性特性(基于MXC,通过命令和设置控制,默认禁用)。本中继工具不会配置这些特性。
/sandboxAuthorization model
授权模型
Delegation is something the human opts into. Once briefed, copilot 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.
委托操作是由人工主动选择的。任务简报确认后,copilot作为你批准使用的工具开展工作。边界原则是:不要接受自我报告的结论;请验证磁盘上的所有内容。对于任何涉及凭证、生产数据或不可逆操作的任务,请先询问人工而非将其写入任务简报。
References
参考文档
- references/writing-the-brief.md — structure, scope, gates, brief delivery.
- references/dispatch-and-poll.md — flags, artifacts,
, and failure recovery.
result.json - 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 — 顺序任务队列、约束传递、进度跟踪以及最终一致性检查。