kimi-delegate
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseKimi Delegate
Kimi 任务委托
You are the orchestrator. Hand a bounded coding task to a separate implementer - the Kimi Code
CLI - then review what it produced and land it yourself. You write the brief and own the judgment;
Kimi does the typing in its own session; you verify and commit.
The loop needs only a shell command and file access, so any comparable orchestrator can drive it.
你作为协调者,将一个明确范围的编码任务交给独立的实现工具——Kimi Code CLI——之后审核其产出内容并自行完成提交。由你撰写任务简报并负责判断;Kimi在独立会话中完成代码编写;你进行验证并提交。
此流程仅需要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.
kimi - You need a CLI-enforced read-only implementer. Headless Kimi has no read-only mode.
- 任务规模小到足以直接完成;委托的开销得不偿失。
- 未安装或未认证CLI。
kimi - 你需要一个CLI强制的只读实现工具。无头模式的Kimi没有只读模式。
Prerequisites (check once)
前提条件(仅需检查一次)
- Install Kimi Code with on macOS/Linux, or use the native installer from the official Kimi Code documentation.
brew install kimi-code - Authenticate with (device-code flow, no TUI), or use
kimi loginin the TUI./login - Confirm succeeds.
kimi --version - Work in, or point at, the target git repository.
--cd
- 在macOS/Linux上使用安装Kimi Code,或从Kimi Code官方文档下载原生安装包。
brew install kimi-code - 使用进行认证(设备码流程,无TUI),或在TUI中使用
kimi login。/login - 确认命令执行成功。
kimi --version - 在目标git仓库中工作,或使用参数指定目标git仓库路径。
--cd
Choose the model alias
选择模型别名
Kimi uses from its when is omitted. To choose another model
alias, pass . Model aliases are user-defined config keys; use
one the human has configured rather than inventing one.
default_modelconfig.toml--model--model <alias from your kimi config>当省略参数时,Kimi会使用其中的。要选择其他模型别名,请传递。模型别名是用户自定义的配置键;请使用人类已配置的别名,而非自行创建。
--modelconfig.tomldefault_model--model <你的kimi配置中的别名>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 the brief
1. 撰写任务简报
Kimi sees only the text you send plus what it can inspect in the workspace - no chat history or shared
context. Include the goal, current state, what to change, what to leave untouched, the project's
actual gates, and a report contract. Tell Kimi not to commit. Keep one task per brief. See
references/writing-the-brief.md.
Kimi只能看到你发送的文本以及它可以在工作区中检查的内容——无聊天历史或共享上下文。请包含目标、当前状态、需要修改的内容、需要保留不变的内容、项目的实际准入标准,以及报告约定。告知Kimi不要提交。每个简报对应一个任务。详见references/writing-the-brief.md。
2. Dispatch
2. 分发任务
Use the bundled helper. It wraps Kimi's headless prompt mode, captures the structured event stream,
and writes . ( is the installed folder containing this .)
result.json<skill-dir>SKILL.mdbash
node "<skill-dir>/scripts/relay.mjs" --brief brief.txt --cd /path/to/repo使用内置的辅助工具。它封装了Kimi的无头提示模式,捕获结构化事件流,并写入。(是包含此的安装文件夹。)
result.json<skill-dir>SKILL.mdbash
node "<skill-dir>/scripts/relay.mjs" --brief brief.txt --cd /path/to/repochoose a configured model alias: add --model <alias from your kimi config>
选择已配置的模型别名: 添加 --model <你的kimi配置中的别名>
resume the most recent session: add --resume-last (delta brief only)
恢复最近的会话: 添加 --resume-last (仅需增量简报)
resume a specific session: add --session <id> (delta brief only)
恢复特定会话: 添加 --session <id>(仅需增量简报)
hard time limit (watchdog): add --timeout 2h (the 30m default suits short runs; implementation briefs routinely need 1-2h)
硬时间限制(监控机制): 添加 --timeout 2h (默认30分钟适合短任务;实现类简报通常需要1-2小时)
see all options: node .../relay.mjs --help
查看所有选项: node .../relay.mjs --help
The child process's cwd pins the workspace. Use repeatable `--add-dir` flags only for extra workspace
directories. 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).
子进程的当前工作目录固定为工作区。仅当需要额外工作区目录时,使用可重复的`--add-dir`参数。默认情况下,中继工具会将产物写入系统临时目录,且绝不会提交。详见[references/dispatch-and-poll.md](references/dispatch-and-poll.md)。3. Wait for completion
3. 等待完成
The helper blocks until Kimi 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.jsonkimistatus: "kimi_unavailable"Trust process state and the working tree over a progress display. Completion means the process exited
and exists. Kimi's full report is the field in (also printed
in full on stdout between the report markers).
result.jsonfinalMessageresult.json辅助工具会阻塞直到Kimi完成任务。可以使用协调工具的后台命令功能运行它,或在shell中将其置于后台并轮询。预运行时的使用错误会以状态码2退出且不写入结果;若缺少则以状态码127退出并写入。
result.jsonkimistatus: "kimi_unavailable"优先信任进程状态和工作树而非进度显示。完成意味着进程已退出且已存在。Kimi的完整报告位于的字段中(也会在报告标记之间完整打印到标准输出)。
result.jsonresult.jsonfinalMessage4. Review - do not trust the self-report
4. 审核——不要信任自我报告
Treat Kimi's final message and gate claims as claims:
- Re-run the project's gates yourself.
- Read the diff against the brief, starting with .
touchedFiles - Run relevant guard skills if installed.
- Round-trip migrations and grep for dangling references after removals or renames.
See references/review-and-land.md.
将Kimi的最终消息和准入标准声明视为待验证的主张:
- 自行重新运行项目的准入标准检查。
- 根据任务简报阅读代码差异,从开始。
touchedFiles - 若已安装相关防护工具,则运行它们。
- 在删除或重命名后,往返迁移并 grep 查找悬空引用。
详见references/review-and-land.md。
5. Land it
5. 完成提交
The implementer edits the working tree; the orchestrator commits. Commit only after the gates pass
and the diff holds. If rework is needed, send a delta brief with or ,
then review again.
--resume-last--session <id>实现工具会编辑工作树;由协调者提交。仅当准入标准检查通过且代码差异符合要求时再提交。若需要返工,请使用或发送增量简报,之后再次审核。
--resume-last--session <id>Autonomy and permissions
自主性与权限
In headless mode, Kimi always runs in auto permission mode and never asks for approval. Kimi
rejects combined with , , or , so the relay passes none of them and
offers no or option. There is no CLI-enforced read-only mode: inspect
and the diff after every run. That diff, not a flag, is the guarantee of what changed.
-p--prompt--yolo--auto--plan--read-only--full-accesstouchedFiles在无头模式下,Kimi始终运行在自动权限模式,绝不会请求批准。Kimi拒绝将与、或结合使用,因此中继工具不会传递这些参数,也不提供或选项。不存在CLI强制的只读模式:每次运行后检查和代码差异。该差异而非某个标志,才是变更内容的保障。
-p--prompt--yolo--auto--plan--read-only--full-accesstouchedFilesAuthorization model
授权模型
Delegation is something the human opts into. Once they have ("run this queue", "proceed"), committing
verified, gate-passing work is the agreed contract. Two limits remain: surface, don't absorb
(report Kimi's design decisions, defensible-but-unasked turns, and non-blocking nitpicks) and stop
for scope changes (if correct completion needs going beyond the brief, ask instead of expanding the
mandate). See references/review-and-land.md.
委托是人类主动选择的操作。一旦他们选择(如“运行此队列”、“继续”),提交经过验证且符合准入标准的工作就是约定的契约。仍有两个限制:披露而非隐瞒(报告Kimi的设计决策、合理但未被要求的变更,以及不影响功能的小问题)和范围变更时停止(若正确完成任务需要超出简报范围,应先询问而非扩大任务权限)。详见references/review-and-land.md。
References
参考资料
- references/writing-the-brief.md - structure, report contract, real gates, argv delivery, and delta briefs.
- references/dispatch-and-poll.md - flags, artifacts,
, polling, and failure recovery.
result.json - references/review-and-land.md - review checklist, commit boundary, and rework through Kimi sessions.
- 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 - 审核清单、提交边界,以及通过Kimi会话进行返工。
- references/multi-task-queues.md - 顺序队列、约束传递、进度跟踪和最终一致性检查。