mcode-delegate
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMiniMax Code Delegate
MiniMax Code Delegate
You are the orchestrator. This skill lets you hand a bounded coding task to a separate
implementer — the MiniMax Code CLI () — then review what it produced and land it yourself.
You write the brief and own the judgment; MiniMax Code does the typing in your working tree; you
verify and commit.
mcodeNothing here is specific to one orchestrating agent. The loop needs only the ability to run a shell
command and read a file, so it works the same whether you are Claude Code, OpenCode with a selected
model, or any comparable agent. (It is designed for and run on Claude Code; treat other orchestrators
as designed-for, not yet proven.)
你是 orchestrator(编排者)。此 skill 让你把一个边界明确的编码任务交给独立的
implementer(实现者)——MiniMax Code CLI()——然后审查其产出并自行落地。
你负责编写 brief(任务简报)并作出最终判断;MiniMax Code 负责在你的 working tree 中编写代码;你负责
验证并 commit。
mcode这里的流程并不限定于某一种 orchestrating agent。这个循环只需要运行 shell 命令和读取文件的能力,因此无论你使用
Claude Code、搭配了所选模型的 OpenCode,还是任何同类 agent,工作方式都相同。(它专为 Claude Code
设计并在 Claude Code 上运行;对于其他 orchestrator,应将其视为已为其设计,但尚未得到验证。)
When NOT to use this
何时不要使用
- The task is small enough to just do inline — delegation overhead is not worth it.
- is not installed or not signed in (run
mcode, ormcode login).mcode login --region global - You want to write the code yourself, or you only need a review of local changes (does that directly).
mcode exec review - You need writes outside the target tree to be impossible, not just unlikely. MiniMax Code has no
sandbox; use an OS-enforced one such as , or run this inside a container.
codex-delegate
- 任务小到可以直接内联完成——委派开销不值得。
- 未安装 或尚未登录(运行
mcode,或mcode login)。mcode login --region global - 你想自己编写代码,或者只需要审查本地更改(可直接完成)。
mcode exec review - 你需要确保绝不可能写入目标目录树之外,而不只是降低写入概率。MiniMax Code 没有
sandbox;请使用 OS 强制执行的隔离环境,例如 ,或在 container 中运行。
codex-delegate
Read this before the first dispatch: the autonomy model
首次派发前必读:自主性模型
mcode execsmartfulloffask- (the relay's default; TUI Auto): already approves file writes and deletions headlessly. A live probe asked for an
smartand got it with no prompt. Sormis not a guardrail: the brief and a clean working tree are the real scope.smart - (TUI Full access): skips normal confirmation entirely. The relay passes it only on an explicit
full.--permission full - : refused by the relay; MiniMax Code does not document what it disables.
off
--read-onlysmartreadOnlyViolationmcode execsmartfulloffask- **(relay 的默认值;TUI Auto):**已经会在 headless 模式下批准文件写入和删除。 一次实时探测执行了
smart,且未出现任何提示。 因此,rm并不是防护栏:真正的范围边界是 brief 和干净的 working tree。smart - **(TUI Full access):**完全跳过常规确认。relay 仅在显式指定
full时才会传入该选项。--permission full - **:**relay 会拒绝;MiniMax Code 并未说明它会禁用哪些能力。
off
--read-onlysmartreadOnlyViolationPrerequisites (check once)
前置条件(检查一次)
- succeeds and you are signed in (
mcode --version→mcodein the TUI). If not, install MiniMax Code and run/status.mcode login - Confirm is on PATH in the shell the relay runs from. The official installer puts it in
mcode, which only your shell profile adds to PATH; an orchestrator's non-login shell may not see it. Pass~/.minimax-code/binor set--mcode-path <file>whenMCODE_CLIcomes back empty. The relay records the version it ran incommand -v mcode.result.json - You are in (or will point at) the target git repository, and its tree is clean before you dispatch — a run with no sandbox is much easier to review against a clean baseline.
--cd
- 执行成功,并且你已登录(可在 TUI 中输入
mcode --version→mcode)。如果尚未登录, 请安装 MiniMax Code 并运行/status。mcode login - **确认 relay 运行所在的 shell 中,位于 PATH 上。**官方安装器将其放在
mcode,而只有 shell profile 才会把该目录加入 PATH;orchestrator 的非登录 shell 可能看不到它。当~/.minimax-code/bin返回空时,请传入command -v mcode或设置--mcode-path <file>。 relay 会将其运行的版本记录在MCODE_CLI中。result.json - 你位于目标 git repository 中(或将使用 指向它),并且在派发前工作树保持干净—— 在没有 sandbox 的情况下,以干净的基线审查要容易得多。
--cd
The loop
工作循环
Run these five steps per task. Steps 1, 4, and 5 are your judgment; 2 and 3 are mechanical.
每个任务执行以下五步。第 1、4、5 步由你判断;第 2、3 步是机械操作。
1. Write the brief
1. 编写 brief
MiniMax Code sees only the text you send — no repo memory, no chat history, no shared context
(beyond the repo's own , which it reads). Everything the task needs goes in the brief: the
goal, the current state, what to change, what to leave untouched, the project's actual gate
commands (discover them from the repo's AGENTS.md/CLAUDE.md/Makefile — do not assume), and a report
contract. Tell it that it will not commit (you will). Keep one task per brief. Full guidance and a
template: references/writing-the-brief.md.
AGENTS.mdMiniMax Code 只能看到你发送的文本——没有 repository memory、没有 chat history、没有 shared context(除了 repository 自身的 ,它会读取)。brief 必须包含任务所需的一切:目标、当前状态、需要修改的内容、需要保持不变的内容、项目实际使用的 gate 命令(从 repository 的 AGENTS.md/CLAUDE.md/Makefile 中发现——不要臆测),以及 report contract。告诉它不要 commit(由你 commit)。每份 brief 只处理一个任务。完整指南和模板:
references/writing-the-brief.md。
AGENTS.md2. Dispatch
2. 派发
Send the brief to MiniMax Code with the bundled helper. It wraps , captures the run, and
writes a structured — so your only job is "run a command, read a file." (
below is this skill's installed directory — the folder containing this , i.e. the directory
you loaded the skill from. Claude Code prints it as "Base directory for this skill" when the skill
loads; on other orchestrators use that same directory — if unsure where it landed, run
and substitute the directory above it.)
mcode execresult.json<skill-dir>SKILL.mdfind ~ -name relay.mjs -path '*mcode-delegate*'bash
node "<skill-dir>/scripts/relay.mjs" --brief brief.txt --cd /path/to/repo使用随附的 helper 将 brief 发送给 MiniMax Code。它会封装 、捕获运行过程,并写入结构化的 ——因此你只需“运行一个命令,读取一个文件”。(下文 指此 skill 的安装目录——即包含此 的文件夹,也就是你加载该 skill 时所在的目录。加载 skill 时,Claude Code 会将其显示为“Base directory for this skill”;在其他 orchestrator 上,也应使用同一个目录——如果不确定它落在哪里,请运行 ,并替换为其上级目录。)
mcode execresult.json<skill-dir>SKILL.mdfind ~ -name relay.mjs -path '*mcode-delegate*'bash
node "<skill-dir>/scripts/relay.mjs" --brief brief.txt --cd /path/to/reporead-only (review/diagnosis; advisory): add --read-only
read-only (review/diagnosis; advisory): add --read-only
continue the exact session: add --session <sessionId> (from result.json; send only the delta brief)
continue the exact session: add --session <sessionId> (from result.json; send only the delta brief)
model / effort for this run: add --model minimax/<model> --effort high
model / effort for this run: add --model minimax/<model> --effort high
hard time limit (watchdog): add --timeout 2h (default: off; implementation runs routinely need 1-2h)
hard time limit (watchdog): add --timeout 2h (default: off; implementation runs routinely need 1-2h)
see all options: node .../relay.mjs --help
see all options: node .../relay.mjs --help
The helper defaults to a write-capable (`--permission smart`) run, which intentionally edits the target
repository. Its temp directory keeps only relay artifacts out of that repository. The relay **never
commits** — see step 5. Mechanics, flags, and the `result.json` shape:
[references/dispatch-and-poll.md](references/dispatch-and-poll.md).
helper 默认运行具备写权限的(`--permission smart`)任务,并会有意编辑目标 repository。其 temp directory 仅将 relay artifacts 保留在 repository 之外。relay **绝不 commit**——参见第 5 步。机制、flags 及 `result.json` 结构:
[references/dispatch-and-poll.md](references/dispatch-and-poll.md)。3. Wait for completion
3. 等待完成
The helper blocks until MiniMax Code finishes, so back it with whatever your orchestrator offers and
resume when it returns:
- Claude Code: run the Bash call with ; you are notified on completion.
run_in_background: true - Plain shell / other agents: run it in the foreground for short tasks, or background it and poll
the result file — in bash/zsh, or your shell's equivalent. The run is done when
… &exists with aresult.json. (A pre-run usage error — bad args or an empty brief — instead exits with code 2 and a stderr message and writes no result file, so check the exit code too. A missingstatusbinary exits 127 but does write amcodewith statusresult.json.)mcode_unavailable
A run is finished when is written and the process has exited — read the working tree,
not a status line. The implementer's full report is the field in (also
printed in full on stdout between the report markers).
result.jsonfinalMessageresult.jsonhelper 会阻塞至 MiniMax Code 完成,因此可利用 orchestrator 提供的任何后台执行能力,并在返回后继续:
- **Claude Code:**使用 在后台运行 Bash 调用;完成后会收到通知。
run_in_background: true - **Plain shell / other agents:**短任务可在前台运行;也可在后台运行并轮询 result file——在 bash/zsh 中使用 ,或使用 shell 的等效方式。当
… &已生成且包含result.json时,运行即已完成。(如果是运行前的 usage error——参数错误或 brief 为空——则进程会以 code 2 退出并输出 stderr message,且不会写入 result file,因此也要检查 exit code。缺少statusbinary 时会以 127 退出,但确实会写入一个mcode为status的mcode_unavailable。)result.json
一次运行完成的判定条件是: 已写入且进程已退出——应读取 working tree,而不是 status line。implementer 的完整报告位于 的 字段中(也会在 stdout 上报告标记之间完整打印)。
result.jsonresult.jsonfinalMessage4. Review — do not trust the self-report
4. 审查——不要相信自我报告
result.json- Re-run the project's gates yourself (the test/lint/build commands from step 1). Never take "gates passed" on faith.
- Read the diff against the brief: did it do what was asked, nothing more (scope creep) and
nothing less? in the result is your starting point — and because there was no sandbox, check for edits and deletions outside the paths the brief named, not just inside them.
touchedFiles - Run the relevant guard skills on the diff if you have them installed (clean-code-guard,
test-guard, etc. from ) — this skill produces the work; those skills judge it.
guard-skills - For schema/migration changes, round-trip them; for removals, grep for dangling references.
Full checklist: references/review-and-land.md.
result.json- **重新运行项目自己的 gate。**使用第 1 步中的测试、lint 和 build 命令。绝不要仅凭“gate 已通过”就相信结果。
- 对照 brief 阅读 diff:确认它完成了要求的内容,既没有多做(scope creep),也没有少做。
中的
result.json是检查起点——由于没有 sandbox,除了 brief 指定的路径外, 还要检查其他路径中是否发生编辑和删除。touchedFiles - 如果已安装相关 guard skills,则对 diff 运行这些 skill(例如来自 的
guard-skills、clean-code-guard等)——此 skill 负责产出工作,而这些 skill 负责评判工作。test-guard - 对于 schema/migration 更改,对其执行 round-trip 验证;对于删除操作,使用 grep 查找悬空引用。
完整清单:
references/review-and-land.md。
5. Land it
5. 落地
The relay never commits, but nothing stops MiniMax Code from writing . The brief forbids
implementer commits, and the reviewer compares with the recorded pre-dispatch baseline before
landing anything. The orchestrator commits. Only after the gates pass and the diff holds:
.gitHEAD- Commit the verified work yourself, with a clear message.
- If it needs changes, send a delta brief with from the prior
--session <sessionId>, and review again.result.json
relay 从不 commit,但没有任何机制阻止 MiniMax Code 写入 。brief 禁止 implementer commit,而 reviewer 在落地任何内容前,会将 与派发前记录的 baseline 进行比较。**orchestrator 负责 commit。**只有 gate 全部通过且 diff 经核对无误后:
.gitHEAD- 由你 commit 已验证的工作,并使用清晰的 commit message。
- 如果还需要修改,使用上一次 中的
result.json发送 delta brief,然后再次审查。--session <sessionId>
Read-only second opinions
Read-only 第二意见
The relay doubles as a way to get an adversarial second opinion: dispatch with a brief
that lists the agreed points, then each contested point with both positions, and ask MiniMax Code to
defend or concede each — deliverable in its final message, touching no files. Because that read-only
state is only a prompt, read the verdict every time: means the Git-visible
detector saw no change (ignored or outside-repository paths are not covered); means it saw
one; means git could not tell. Dispatch second opinions on a clean tree you can afford to
restore.
--read-onlyreadOnlyViolation: falsetruenullrelay 还可以用作获取对抗性 second opinion:通过 派发一份 brief,其中先列出双方已达成一致的要点,再针对每个有争议的要点列出双方立场,并要求 MiniMax Code 为每个要点进行辩护或让步;交付物位于其 final message 中,且不触碰任何文件。由于 read-only 状态只是一段 prompt,因此每次都必须读取 verdict: 表示 Git 可见变更检测机制未发现变更(被忽略的路径或 repository 之外的路径不在覆盖范围内); 表示检测到变更; 表示 git 无法判断。请在可以放心恢复的干净 working tree 上派发 second opinion。
--read-onlyreadOnlyViolation: falsetruenullAuthorization model
授权模型
Delegation is something the human opts into. Once they have ("run this queue", "proceed"), committing
verified, gate-passing work is the agreed contract — that is the whole point. Two limits on that
mandate: surface, don't absorb (report MiniMax Code's design decisions, defensible-but-unasked
turns, and non-blocking nitpicks rather than silently keeping them) and stop for scope changes (if
correct completion needs going beyond the brief, ask — don't expand the mandate yourself). The full
treatment is in references/review-and-land.md.
委派需要由 human 主动选择。一旦 human 表示同意(“运行这个队列”“继续”),将已验证且通过 gate 的工作 commit 就构成双方约定的 contract——这正是整个流程的核心。该授权有两个限制:surface, don't absorb(报告 MiniMax Code 的设计决策、有道理但未被要求的改动,以及不阻塞的细节问题,而不是默默保留它们)和 stop for scope changes(如果正确完成任务需要超出 brief 的范围,应询问,而不是自行扩大授权)。完整说明见 references/review-and-land.md。
References
参考资料
- references/writing-the-brief.md — how to write a brief MiniMax Code can execute blind: structure, XML blocks, the report contract, embedding the real gate commands.
- references/dispatch-and-poll.md — flags, the
relay.mjscontract, backgrounding per orchestrator, and recovery when a run misbehaves.result.json - references/review-and-land.md — the review checklist, the commit boundary, and the exact-session rework cycle.
- references/multi-task-queues.md — running a sequential queue: carrying constraints forward, progress tracking, and the end-of-run coherence check.
- references/writing-the-brief.md——如何编写一份 MiniMax Code 可在不了解上下文的情况下执行的 brief:结构、XML blocks、report contract,以及嵌入真实的 gate 命令。
- references/dispatch-and-poll.md——flags、
relay.mjscontract、针对各 orchestrator 的后台运行方式,以及运行异常时的恢复方法。result.json - references/review-and-land.md——审查清单、commit 边界,以及基于原 session 的返工循环。
- references/multi-task-queues.md——运行顺序队列:延续约束、跟踪进度,以及运行结束时的整体一致性检查。