tmux
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesetmux Subagent Orchestration
tmux 子代理编排
Run Devin CLI subagents in parallel by giving each one its own tmux window. The
parent agent delegates a task, waits for a completion signal, reads the
subagent's output file, and closes the window.
通过为每个Devin CLI子代理分配独立的tmux窗口,实现并行运行。父代理委派任务,等待完成信号,读取子代理的输出文件,然后关闭窗口。
When to Use
使用场景
- Fan out independent research, refactors, or test runs across several agents.
- Keep a long-running Devin session alive in the background while continuing other work.
- Coordinate multiple agents that each own a distinct task/context.
- 将独立的研究、重构或测试任务分发到多个代理并行处理。
- 在后台保持长时间运行的Devin会话,同时进行其他工作。
- 协调各自拥有不同任务/上下文的多个代理。
Setup (do once per session)
会话初始化(每个会话执行一次)
Before any tmux operation, resolve two values and reuse them:
- - absolute path to the tmux binary.
TMUX=$(which tmux) - - current session name.
SESSION=$("$TMUX" display-message -p '#S')
If is unset in the environment, you are not inside a tmux session and
the helper scripts will refuse to run. Start tmux first ()
and relaunch Devin inside it.
TMUXtmux new -s work在执行任何tmux操作前,需确定并复用两个值:
- - tmux二进制文件的绝对路径。
TMUX=$(which tmux) - - 当前会话名称。
SESSION=$("$TMUX" display-message -p '#S')
如果环境中未设置,说明你不在tmux会话内,辅助脚本将无法运行。请先启动tmux(),然后在其中重新启动Devin。
TMUXtmux new -s workHelper Scripts
辅助脚本
Use these for all standard operations. Run them from this skill directory
(). All scripts print on success or an line on
failure, and exit non-zero on error.
skills/tmux/Doneerror:| Script | Usage | Description |
|---|---|---|
| | Create a new window and start a subagent. Default command: |
| | Send literal text to the window, wait 1s, press Enter |
| | Send |
所有标准操作均使用以下脚本。请从该技能目录()运行脚本。所有脚本在成功时输出,失败时输出行,且失败时返回非零退出码。
skills/tmux/Doneerror:| 脚本 | 使用方法 | 描述 |
|---|---|---|
| | 创建新窗口并启动子代理。默认命令: |
| | 向窗口发送文本,等待1秒后按下回车键 |
| | 发送 |
Subagent Workflow
子代理工作流
bash
undefinedbash
undefined1. Spawn (defaults to devin --permission-mode dangerous
)
devin --permission-mode dangerous1. 生成子代理(默认命令为devin --permission-mode dangerous
)
devin --permission-mode dangerous./scripts/spawn_subagent.sh agent-research-1
./scripts/spawn_subagent.sh agent-research-1
2. Send the task. Tell the subagent to write its output to a file
2. 发送任务。告知子代理将输出写入文件
and notify the parent when finished.
并在完成时通知父代理。
./scripts/send_command.sh agent-research-1
"Research X and write the result to /tmp/agent-research-1.md. When done, run: tmux display-message -d 5000 'agent-research-1: done'"
"Research X and write the result to /tmp/agent-research-1.md. When done, run: tmux display-message -d 5000 'agent-research-1: done'"
./scripts/send_command.sh agent-research-1
"研究X并将结果写入/tmp/agent-research-1.md。完成后运行:tmux display-message -d 5000 'agent-research-1: done'"
"研究X并将结果写入/tmp/agent-research-1.md。完成后运行:tmux display-message -d 5000 'agent-research-1: done'"
3. Wait for the notification (display-message or agentmail).
3. 等待通知(display-message或agentmail)。
DO NOT poll capture-pane in a loop.
禁止循环轮询capture-pane。
4. Read /tmp/agent-research-1.md
4. 读取/tmp/agent-research-1.md文件
5. Clean up
5. 清理资源
./scripts/exit_subagent.sh agent-research-1
undefined./scripts/exit_subagent.sh agent-research-1
undefinedMandatory Requirements
强制要求
- Use tmux windows, never panes.
- Window names MUST follow (e.g.
agent-{task}-{number}).agent-refactor-2 - Wait for subagent notifications via or agentmail. Do not poll
display-messagein a loop.capture-pane - Use to spawn,
spawn_subagent.shto send input, andsend_command.shto stop. Fall back to rawexit_subagent.shcommands only for debugging or edge cases.tmux - Each subagent task MUST write its result to a known file path (e.g.
). Do not scrape it from the pane.
/tmp/<window-name>.md
- 使用tmux 窗口,切勿使用窗格。
- 窗口名称必须遵循格式(例如
agent-{task}-{number})。agent-refactor-2 - 通过或agentmail等待子代理通知。严禁循环轮询
display-message。capture-pane - 使用生成子代理,
spawn_subagent.sh发送输入,send_command.sh停止子代理。仅在调试或边缘场景下使用原生exit_subagent.sh命令。tmux - 每个子代理任务必须将结果写入已知文件路径(例如)。请勿从窗格中抓取结果。
/tmp/<window-name>.md
Completion Signal
完成信号
When a subagent finishes, have it run:
bash
tmux display-message -d 5000 "<window-name>: <short message>"The parent agent receives the message in its tmux status line and can proceed.
子代理完成任务后,需运行以下命令:
bash
tmux display-message -d 5000 "<window-name>: <short message>"父代理会在tmux状态栏收到该消息,然后继续后续操作。
Common Subagent Commands
常用子代理命令
Commands to send into a Devin subagent window with :
send_command.sh| Command | Description |
|---|---|
| Exit the agent gracefully |
| Clear the agent's context window |
| Compact context, preserving handoff notes |
可使用发送到Devin子代理窗口的命令:
send_command.sh| 命令 | 描述 |
|---|---|
| 优雅退出代理 |
| 清空代理的上下文窗口 |
| 压缩上下文,保留交接备注 |
Raw tmux Reference (edge cases only)
原生tmux参考(仅用于边缘场景)
See for the raw command cheat sheet used
for debugging (listing windows, capturing pane output, sending Ctrl-C, etc.).
references/tmux-commands.mdtmux调试时使用的原生命令速查表请查看(包括列出窗口、捕获窗格输出、发送Ctrl-C等操作)。
tmuxreferences/tmux-commands.md