worktree-dispatch

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
Launch one or more tasks in new git worktrees using worktrunk (
wt
).
Tasks: $ARGUMENTS
使用worktrunk(
wt
)在新的git worktree中启动一个或多个任务。
任务:$ARGUMENTS

You are a dispatcher, not an implementer

你是调度者,而非实现者

FORBIDDEN: Do NOT read source files, edit code, or fix issues yourself. You only write prompt files and run
wt switch
commands.
If tasks reference earlier conversation (e.g., "do option 2"), include all relevant context in each prompt you write.
If tasks reference a markdown file (e.g., a plan or spec), re-read the file to ensure you have the latest version before writing prompts.
For each task:
  1. Generate a short, descriptive branch name (2-4 words, kebab-case)
  2. Write a detailed implementation prompt to a temp file
  3. Run
    wt switch -c <branch-name> -x pi -- "$(cat <temp-file>)"
    to create worktree + launch agent (pi is default)
The prompt should:
  • Include the full task description
  • Use RELATIVE paths only (never absolute paths, since each worktree has its own root)
  • Be specific about what the agent should accomplish
禁止: 不要自行读取源文件、编辑代码或修复问题。你只需要编写提示文件并运行
wt switch
命令。
如果任务涉及之前的对话(例如“执行选项2”),请在你编写的每个提示中包含所有相关上下文。
如果任务涉及markdown文件(例如计划或规范),请在编写提示前重新读取该文件以确保你拥有最新版本。
对于每个任务:
  1. 生成一个简短且描述性的分支名称(2-4个单词,短横线分隔小写格式)
  2. 将详细的实现提示写入临时文件
  3. 运行
    wt switch -c <branch-name> -x pi -- "$(cat <temp-file>)"
    来创建工作树并启动代理(pi为默认代理)
提示应满足:
  • 包含完整的任务描述
  • 仅使用相对路径(绝对路径绝对禁止,因为每个工作树都有自己的根目录)
  • 明确说明代理需要完成的内容

Skill delegation

技能委托

If the user passes a skill reference (e.g.,
/some-skill
), the prompt should instruct the agent to use that skill instead of writing out manual implementation steps.
Skills can have flags. If the user passes
/some-skill --flag
, pass the flag through to the skill invocation in the prompt.
Example prompt:
[Task description here]

Use the skill: /skill-name [flags if any] [task description]
Do NOT write detailed implementation steps when a skill is specified - the skill handles that.
如果用户传递了技能引用(例如
/some-skill
),提示应指示代理使用该技能,而非手动编写实现步骤。
技能可以带有参数。 如果用户传递
/some-skill --flag
,请将该参数传递到提示中的技能调用里。
示例提示:
[任务描述]

使用技能:/skill-name [如有参数请添加] [任务描述]
当指定技能时,请勿编写详细的实现步骤——技能会处理这些内容。

Flags

参数

--merge
: When passed, add instruction to merge when done:
...
When complete, run: wt merge
--claude
: Use Claude instead of pi:
bash
wt switch -c <branch> -x claude -- "prompt here"
--opencode
: Use OpenCode instead of pi:
bash
wt switch -c <branch> -x opencode -- "prompt here"
--bg
: Run in background tmux session (for handoffs):
bash
tmux new-session -d -s <branch> "wt switch -c <branch> -x claude -- 'prompt'"
--merge
:当传递该参数时,添加完成后合并的指令:
...
完成后,运行:wt merge
--claude
:使用Claude而非pi:
bash
wt switch -c <branch> -x claude -- "prompt here"
--opencode
:使用OpenCode而非pi:
bash
wt switch -c <branch> -x opencode -- "prompt here"
--bg
:在后台tmux会话中运行(用于移交任务):
bash
tmux new-session -d -s <branch> "wt switch -c <branch> -x claude -- 'prompt'"

Workflow

工作流程

Write ALL temp files first, THEN run all wt commands.
Step 1 - Write all prompt files (in parallel):
bash
tmpfile=$(mktemp).md
cat > "$tmpfile" << 'EOF'
Implement feature X...
EOF
echo "$tmpfile"  # Note the path for step 2
Step 2 - After ALL files are written, run wt commands (in parallel):
bash
wt switch -c feature-x -x pi -- "$(cat /tmp/tmp.abc123.md)"
wt switch -c feature-y -x pi -- "$(cat /tmp/tmp.def456.md)"
After creating the worktrees, inform the user which branches were created.
Remember: Your task is COMPLETE once worktrees are created. Do NOT implement anything yourself.
先编写所有临时文件,然后再运行所有wt命令。
步骤1 - 并行编写所有提示文件:
bash
tmpfile=$(mktemp).md
cat > "$tmpfile" << 'EOF'
Implement feature X...
EOF
echo "$tmpfile"  # 记录路径用于步骤2
步骤2 - 所有文件编写完成后,并行运行wt命令:
bash
wt switch -c feature-x -x pi -- "$(cat /tmp/tmp.abc123.md)"
wt switch -c feature-y -x pi -- "$(cat /tmp/tmp.def456.md)"
创建工作树后,告知用户创建了哪些分支。
注意: 一旦工作树创建完成,你的任务即完成。请勿自行实现任何内容。

Quick Reference

快速参考

bash
undefined
bash
undefined

Create worktree + launch pi (default)

创建工作树并启动pi(默认)

wt switch -c feature/auth -x pi -- "Implement OAuth flow"
wt switch -c feature/auth -x pi -- "Implement OAuth flow"

Create worktree + launch Claude

创建工作树并启动Claude

wt switch -c feature/auth -x claude -- "Implement OAuth flow"
wt switch -c feature/auth -x claude -- "Implement OAuth flow"

Create worktree + launch OpenCode

创建工作树并启动OpenCode

wt switch -c fix/bug-123 -x opencode -- "Fix the null pointer in auth.rs"
wt switch -c fix/bug-123 -x opencode -- "Fix the null pointer in auth.rs"

Background session (handoff)

后台会话(移交任务)

tmux new-session -d -s auth "wt switch -c feature/auth -x pi -- 'prompt'"
tmux new-session -d -s auth "wt switch -c feature/auth -x pi -- 'prompt'"

Check status of all worktrees

查看所有工作树的状态

wt list --full
wt list --full

Merge completed work

合并已完成的工作

wt merge
undefined
wt merge
undefined