tmux-agent-tools
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTmux Agent Tools
Tmux Agent Tools
Fast paths (read this first)
快速路径(请先阅读此部分)
Non-negotiable rules:
- Engine-only — never type raw at a worker. Drive every worker through
tmuxsubcommands (agent-tmux <cli>,send-wait,status,result,capture); read-only inventory isstop, not rawtmux-agent-sessions list. Rawtmux lsbypasses naming, redaction, result contracts, and cleanup. Before concluding the engine lacks a command, check the capability table below; plain shell is a last resort for genuine gaps — say why.tmux - A is not done until submission is verified. Bare
sendcan leave text unsent in the input box. Default tosend: it appends a fresh nonce and waits for it, confirming the prompt landed.send-wait - Every blocking wait takes a timeout — never hand-roll /polling loops. Multiple workers: one bounded
sleep. Mixed-engine fleets: trustwatch --any|--all|--count <n> --timeout <s> --json …or resolve withreason:result_updated.tmux-agent-sessions - Reusing a worker for a follow-up task? first, then
result init, thensend-wait— never reuse withoutresult wait-required, or the wait returns the stale prior result. Details:result init.references/multi-agent.md#persistent-teammates-worker-reuse
Fast answers:
- Bounded task with no follow-ups? Default to interactive (headed): the tmux pane is the debug surface —
start,capture, or attaching shows exactly what the CLI is doing, mid-run and post-mortem.status(start --headless/claude -p) is OPT-IN only: user explicitly asks for it, or the output is trivially verifiable and nobody will need to inspect the run. A headless failure leaves only an exit code and a stdout file — repeatedly observed to cost long blind-debugging sessions (user ruling 2026-08-03: headed by default).codex exec - Wrapper not on PATH? Run it from this bundle: .
<skill-dir>/scripts/agent-tmux codex … - Worker "failed" but the pane says PASS? Exit code is not the verdict — see ("Exit code is not the verdict") before re-dispatching or reporting failure.
references/core-workflow.md#5-read-the-agents-structured-result - Auto-delegate substantial work? Use the inline-vs-worker gate in the skill (absorbed there, no longer a separate subagent); details live in
using-tmux-agent-tools.references/core-workflow.md - Long-running external CLI worker (Codex or Claude Code)? Dispatch it with ONE call — the stepwise sequence (start → result init → send → confirm-processing → blocking supervise) IS the supervision, so no separate per-worker supervision proxy is spawned (proxy pattern retired 2026-08-08, replaced by
agent-tmux <cli> assign <name> <dir> <prompt-file>). Run the single blocking call where a long wait is appropriate (a background task, or one cheap sub-agent when the runtime caps foreground timeouts); the parent MUST NOT additionally pollassign/status/captureunlessprobereports a failed step or the user asks. If the harness reaps long background tasks (killing a tmux server spawned inside the task's process tree with them), useassignin a short foreground call instead — dispatch stays fully verified, then harvest with boundedassign --detachcalls.result wait-required --wait <s> - Writing the worker prompt? Shape it with the skill: GOAL / ACCEPTANCE / REPORT + common footer, plus its tmux addendum (no-cascade ban + literal result path).
delegation-templates - New or renamed CLI? Add a profile with , then prove it with
bin=…anddoctor --json; seestart --dry-run.references/profiles.md
不可违背的规则:
- 仅通过引擎操作——绝不要在工作者中直接输入命令。 所有工作者都必须通过
tmux子命令(agent-tmux <cli>、send-wait、status、result、capture)进行操作;只读清单使用stop,而非原生tmux-agent-sessions list。直接使用tmux ls会绕过命名、脱敏、结果约定和清理流程。在判定引擎缺少某条命令前,请先查看下方的功能表;只有在确实存在功能缺口时才使用纯shell命令——并说明原因。tmux - 只有在提交验证完成后,操作才算完成。 单纯的
send可能会导致文本留在输入框中未发送。默认使用send:它会附加一个新的随机数并等待确认,确保提示已成功送达。send-wait - 所有阻塞等待都必须设置超时——绝不要手动编写/轮询循环。 多工作者场景:使用一个带限制的
sleep命令。混合引擎集群:信任watch --any|--all|--count <n> --timeout <s> --json …或通过reason:result_updated解决。tmux-agent-sessions - 要为后续任务复用工作者? 先执行,然后是
result init,最后是send-wait——绝不要在未执行result wait-required的情况下复用,否则等待会返回过时的旧结果。详情:result init。references/multi-agent.md#persistent-teammates-worker-reuse
常见问题快速解答:
- 无后续操作的有限任务? 默认使用交互式(带界面):tmux面板作为调试界面——
start、capture或附加操作可查看CLI在运行中及运行后的具体状态。status(start --headless/claude -p)仅为可选操作:只有在用户明确要求,或输出可轻松验证且无需检查运行过程时才使用。无头模式失败后仅留下退出码和stdout文件——经验表明这会导致漫长的盲调试过程(用户规定2026-08-03:默认使用带界面模式)。codex exec - 包装器不在PATH中? 从当前包中运行:。
<skill-dir>/scripts/agent-tmux codex … - 工作者显示“失败”但面板显示PASS? 退出码并非最终结论——在重新调度或报告失败前,请查看(“退出码并非最终结论”)。
references/core-workflow.md#5-read-the-agents-structured-result - 自动委派大量工作? 使用skill中的内联vs工作者网关(已整合到该skill中,不再是独立子代理);详情见
using-tmux-agent-tools。references/core-workflow.md - 长时间运行的外部CLI工作者(Codex或Claude Code)? 通过一次调用进行调度——分步流程(启动→result初始化→发送→确认处理→阻塞监控)即为监控流程,因此无需生成单独的每个工作者监控代理(代理模式已于2026-08-08停用,替换为
agent-tmux <cli> assign <name> <dir> <prompt-file>)。在适合长时间等待的位置运行单个阻塞调用(后台任务,或在运行时限制前台超时的轻量子代理);除非assign报告步骤失败或用户要求,否则父进程不得额外轮询assign/status/capture。如果工具收割长后台任务(杀死与任务进程树一起生成的tmux服务器),则在短前台调用中使用probe——调度仍会完全验证,然后通过带限制的assign --detach调用获取结果。result wait-required --wait <s> - 编写工作者提示? 使用skill进行构建:目标/验收标准/报告 + 通用页脚,加上tmux补充说明(禁止级联 + 字面结果路径)。
delegation-templates - 新增或重命名CLI? 使用添加配置文件,然后通过
bin=…和doctor --json验证;见start --dry-run。references/profiles.md
Overview
概述
agent-tmux <cli> <command>claude-tmuxcodex-tmuxagy-tmuxagent-tmux <cli> <command>agent-tmux <cli> <command>claude-tmuxcodex-tmuxagy-tmuxagent-tmux <cli> <command>Required preflight and safe invocation
必要的预检查与安全调用
Before the first worker command:
- Resolve the wrapper bundle instead of assuming PATH. Probe, in order,
,
<repo-dir>/skills/tmux-agent-tools/scripts,~/.agents/skills/tmux-agent-tools/scripts, and~/.claude/skills/tmux-agent-tools/scripts; use bare wrapper names only when no bundle exists and PATH lookup succeeds.~/.codex/skills/tmux-agent-tools/scripts - Run the resolved and stop if preflight fails.
agent-tmux <cli> setup - Pass the raw task as a separately quoted argument or prompt-file content.
Never interpolate task text into ,
eval, or a constructed shell command.sh -c - Pass task-specific credentials only through . Never embed credential values in task text or a constructed shell command.
--secret KEY=URI
首次运行工作者命令前:
- 先定位包装器包,而非假设它在PATH中。按以下顺序查找:
、
<repo-dir>/skills/tmux-agent-tools/scripts、~/.agents/skills/tmux-agent-tools/scripts、~/.claude/skills/tmux-agent-tools/scripts;仅当不存在包且PATH查找成功时,才使用裸包装器名称。~/.codex/skills/tmux-agent-tools/scripts - 运行已定位的,如果预检查失败则停止操作。
agent-tmux <cli> setup - 将原始任务作为单独引用的参数或提示文件内容传递。
绝不要将任务文本插入、
eval或构造的shell命令中。sh -c - 仅通过传递任务特定凭据。绝不要将凭据值嵌入任务文本或构造的shell命令中。
--secret KEY=URI
When to use
使用场景
- Long-running Claude/Codex/agy/custom CLI work that needs later supervision.
- A worker must write structured for a parent agent or wrapper.
result.json - You need verified follow-up sends, liveness/status checks, bounded waits, or cleanup.
- Multiple workers need first/all/N completion via one wrapper call.
watch
- 需要后续监控的长时间运行的Claude/Codex/agy/自定义CLI工作。
- 工作者必须为父代理或包装器编写结构化。
result.json - 需要验证后续发送、存活状态检查、有限等待或清理操作。
- 多个工作者需要通过一个包装器调用实现首个/全部/N个完成。
watch
Command choice
命令选择
| Need | Use |
|---|---|
| Run Claude Code / Codex / agy as a worker | |
| Any other CLI (gemini, cursor, grok, custom) | |
| Any worker, including bounded one-shots | interactive |
| Trivially verifiable fire-and-collect, user opted in | |
| Local working directory | |
| Repo on another host, tmux stays local | |
| Pin a model for one run | |
| Continue an existing CLI session UUID | |
| Don't know which wrapper owns a session | |
| Two-party exchange / one-to-many work | |
| Read-only inventory or evidence polling | |
Start flags precede positionals: ; a misplaced flag exits 2.
start --exact --model <m> <name> <dir>Full capability table (every subcommand + when to use it): .
references/cheatsheets.md| 需求 | 使用命令 |
|---|---|
| 将Claude Code / Codex / agy作为工作者运行 | |
| 其他任意CLI(gemini、cursor、grok、自定义) | |
| 任意工作者,包括有限一次性任务 | 交互式 |
| 可轻松验证的即发即收任务,且用户已选择使用 | |
| 本地工作目录 | |
| 仓库在另一主机,tmux保留在本地 | |
| 为单次运行固定模型 | |
| 继续现有CLI会话UUID | |
| 不知道哪个包装器拥有会话 | 先运行 |
| 双向交互 / 一对多工作 | |
| 只读清单或证据轮询 | |
启动标志需位于位置参数之前:;标志位置错误会导致退出码为2。
start --exact --model <m> <name> <dir>完整功能表(所有子命令+使用场景):。
references/cheatsheets.mdWhen not to use
不适用场景
- A one-off shell command or a simple file read, search, test, or build — run it directly instead of spawning a worker.
- Externally visible, destructive, or privacy-sensitive work unless the user has already authorized it.
- 一次性shell命令或简单的文件读取、搜索、测试或构建——直接运行,无需生成工作者。
- 外部可见、破坏性或隐私敏感的工作,除非用户已明确授权。
The 6 commands you need most
最常用的6条命令
bash
undefinedbash
undefinedDispatch a prompt-file task: ONE command runs the whole verified sequence
调度提示文件任务:一条命令即可运行整个验证流程
(start -> result init -> send --from-file -> confirm the pane is processing
—
-> blocking supervise). Prefer this over hand-chaining the steps; it cannot
—
be misordered and it catches "task never reached the CLI" before waiting.
—
agent-tmux codex assign job ~/repo /abs/path/prompt.txt
#(启动→result初始化→send --from-file→确认面板正在处理
#→阻塞监控)。优先使用此命令而非手动链式执行步骤;它不会出现顺序错误,且会在等待前检测“任务未送达CLI”的情况。
agent-tmux codex assign job ~/repo /abs/path/prompt.txt
Bounded one-shot (headed by default; add --headless only when the user opted in):
有限一次性任务(默认带界面;仅当用户选择时添加--headless):
agent-tmux codex start --exact job ~/repo 'Task. Write final JSON to the wrapper-provided result path when done.'
agent-tmux codex result wait-required job --fields status,summary --wait 600 --json # returns at process exit
agent-tmux codex supervise --result-required --silent-while-unchanged --json job # one silent call until terminal event
agent-tmux codex stop job
agent-tmux codex start --exact job ~/repo '任务。完成后将最终JSON写入包装器提供的结果路径。'
agent-tmux codex result wait-required job --fields status,summary --wait 600 --json # 进程退出时返回结果
agent-tmux codex supervise --result-required --silent-while-unchanged --json job # 单次静默调用,直到终端事件发生
agent-tmux codex stop job
Interactive one-worker flow (only when follow-ups are needed): start -> send-wait -> supervise -> stop.
交互式单工作者流程(仅当需要后续操作时使用):启动→send-wait→监控→停止。
agent-tmux codex start --exact worker ~/repo 'Task. Write final JSON to the wrapper-provided result path when done.'
agent-tmux codex send-wait worker 'Follow-up instruction.' 180
agent-tmux codex status --json worker
agent-tmux codex result --json --wait 30 worker
agent-tmux codex stop worker
agent-tmux codex start --exact worker ~/repo '任务。完成后将最终JSON写入包装器提供的结果路径。'
agent-tmux codex send-wait worker '后续指令。' 180
agent-tmux codex status --json worker
agent-tmux codex result --json --wait 30 worker
agent-tmux codex stop worker
Multiple workers: block on first/all/N completion with one bounded call.
多工作者场景:通过一条带限制的调用阻塞等待首个/全部/N个完成。
agent-tmux codex watch --any --timeout 600 --json w1 w2 w3
Full walkthrough: `references/core-workflow.md`.agent-tmux codex watch --any --timeout 600 --json w1 w2 w3
完整演练:`references/core-workflow.md`。result.json completion contract
result.json完成约定
Agents write with , canonical (), , , and (optional /). Codex/generic prompt sends inject the literal result path once per session; the worker cannot rely on inside tool sandboxes. Branch in this order — never scrape the pane when a valid result exists: .
$TMUX_AGENT_DIR/<name>/result.jsonschema_version: 1statussuccess|failed|blocked|needs-inputsummaryartifactserrorsverdictdecision$TMUX_AGENT_RESULT.present -> .valid -> .bodybash
agent-tmux codex result --json --wait 30 worker
agent-tmux codex supervise --result-required --silent-while-unchanged --json workerIf , the agent never wrote the file — re-prompt with the literal path from . Full schema, worked example, fields, approval-gate exit codes, concurrency model: .
.present:falseresult --path <name>status --jsonreferences/contracts.md代理会将结果写入,包含、标准()、、和(可选/)。Codex/通用提示发送会在每个会话中注入字面结果路径;工作者在工具沙箱中无法依赖。按以下顺序判断——当存在有效结果时,绝不要抓取面板内容:。
$TMUX_AGENT_DIR/<name>/result.jsonschema_version: 1statussuccess|failed|blocked|needs-inputsummaryartifactserrorsverdictdecision$TMUX_AGENT_RESULT.present -> .valid -> .bodybash
agent-tmux codex result --json --wait 30 worker
agent-tmux codex supervise --result-required --silent-while-unchanged --json worker如果,说明代理从未写入该文件——使用获取的字面路径重新提示。完整 schema、示例、字段、审批网关退出码、并发模型:。
.present:falseresult --path <name>status --jsonreferences/contracts.mdSafety
安全注意事项
- Wrappers use permissive CLI flags by default (for Claude,
--dangerously-skip-permissionsfor Codex). Never use for destructive, privacy-sensitive, externally visible, payment, or irreversible work without explicit user authorization.--yolo - reports
status --jsonplusconfirmation_detected:truewhen a pane appears to wait for confirmation. It does not auto-accept; answer only after you trust it.blocked_reason - Before spawning more than one worker: ask the user for tool+model+effort per worker, set a worker upper bound, and forbid cascade spawning in every prompt. Details: .
references/multi-agent.md - Secret injection (, fail-closed) and audit log (
--secret KEY=URI):TMUX_AGENT_TOOLS_AUDIT_LOG.references/security.md
- 包装器默认使用宽松的CLI标志(Claude使用,Codex使用
--dangerously-skip-permissions)。除非获得用户明确授权,否则绝不要用于破坏性、隐私敏感、外部可见、涉及支付或不可逆的工作。--yolo - 当面板似乎在等待确认时,会报告
status --json及confirmation_detected:true。它不会自动接受;只有在你确认可信后再回复。blocked_reason - 在生成多个工作者前:向用户询问每个工作者的工具+模型+工作量,设置工作者上限,并在所有提示中禁止级联生成。详情:。
references/multi-agent.md - 秘密注入(,关闭失败)和审计日志(
--secret KEY=URI):TMUX_AGENT_TOOLS_AUDIT_LOG。references/security.md
References
参考文档
Load these only when you hit the relevant scenario — they are not needed for routine use:
- — full single-worker workflow, session naming, remote sessions, peer-review, approval gates, the inline-vs-worker gate.
references/core-workflow.md - — custom CLI profile keys, precedence, examples, detection overrides.
references/profiles.md - — full capability table, scenario commands, marker pitfalls, failure triage.
references/cheatsheets.md - — dialogue/fanout rules, bridge pattern, SSH participants, github-comment behavior.
references/multi-agent.md - —
references/contracts.md/status --jsonschemas, approval exit codes, concurrency, inventory/cleanup.result.json - — secret injection, audit log, environment overrides, pre-flight checks.
references/security.md - — failure modes and fixes for stuck/unsent/stale-marker scenarios.
references/troubleshooting.md - — copy-pasteable workflows (approval gate, fanout, DAG).
references/recipes.md
仅在遇到相关场景时加载这些文档——日常使用无需查看:
- ——完整单工作者流程、会话命名、远程会话、同行评审、审批网关、内联vs工作者网关。
references/core-workflow.md - ——自定义CLI配置文件键、优先级、示例、检测覆盖。
references/profiles.md - ——完整功能表、场景命令、标记陷阱、故障排查。
references/cheatsheets.md - ——对话/扇出规则、桥接模式、SSH参与者、github-comment行为。
references/multi-agent.md - ——
references/contracts.md/status --jsonschema、审批退出码、并发、清单/清理。result.json - ——秘密注入、审计日志、环境覆盖、预检查。
references/security.md - ——卡住/未发送/过时标记场景的故障模式与修复方案。
references/troubleshooting.md - ——可复制粘贴的工作流(审批网关、扇出、DAG)。
references/recipes.md
Bundled schemas
捆绑schema
schemas/result-status-summary.schema.jsonfanout-summary.schema.jsonresult.jsonThe subagent bundle (, , ) is retired — see CHANGELOG. The inline-vs-worker gate and the one-shot forwarding pattern they carried now live in the skill's decision tree; there is nothing to install into anymore.
agents/tmux-delegate.mdclaude-oneshot.mdcodex-oneshot.mdusing-tmux-agent-tools~/.claude/agents/schemas/result-status-summary.schema.jsonfanout-summary.schema.jsonresult.jsonagents/tmux-delegate.mdclaude-oneshot.mdcodex-oneshot.mdusing-tmux-agent-tools~/.claude/agents/