Illustrated Tutorial: Use Worktrunk to set up a "multi-agent parallel" workflow, so you can run ten Claude instances on one screen from now on.图文教程:用 Worktrunk 搭一套「多 Agent 并行」工作流,从此一个屏幕跑十个 Claude
Follow along: Download and install the wt command → Configure the worktree template → Launch three Agents simultaneously, each taking on a task → Use hooks to automatically install dependencies → Wrap up with a single command to clean up. The entire process is carried out via command line operations, making it suitable for developers who are already using Claude Code/Codex.
跟着做:下载安装 wt 命令 → 配置工作树模板 → 同时开三个 Agent 各领一个任务 → 用钩子自动装依赖 → 收工一条命令清理。全程命令行操作,适合已经在用 Claude Code / Codex 的开发者。

Step 1: Install the wt command第一步:安装 wt 命令
Download the official Worktrunk Windows build from this site (see the button above). After extracting it, add wt.exe to the PATH (it is recommended to create C:\tools\bin and add it to the environment variables).
macOS/Linux users can download the package for their platform from the Releases page of the repository, or install it with a single line of the curl installation script.
Open a new terminal and run wt --version to confirm that the command can be found. Then run wt list. If you see an empty (or existing) list of worktrees, the installation was successful.
从本站下载 Worktrunk Windows 官方构建(见上方按钮),解压后把 wt.exe 放进 PATH(推荐自建 C:\tools\bin 并加入环境变量)。
macOS / Linux 用户到仓库 Releases 页下载对应平台包,或执行 curl 安装脚本一行搞定。
开新终端运行 wt --version 确认能找到命令;再跑 wt list,看到空的(或现有的)工作树列表即安装成功。

Step 2: Understand the working tree model and choose the main repository第二步:理解工作树模型,选好主仓库
The path of the working tree managed by Worktrunk is determined by the template: By default, the<repo>.<branch name> directory. First, think about where you want to put your repository and whether there is space next to it.
cd into any git repository and run wt list – it will list the existing worktrees in this repository and the status of each tree (clean/uncommitted changes).
It is recommended to practise on a "test repository" first, and then move to the main project once you are familiar with it.
Worktrunk 管理的工作树路径由模板决定:默认在主仓库旁边生成 <repo>.<分支名> 目录。先想好你的仓库放哪、旁边是否有空间。
cd 进任意一个 git 仓库,执行 wt list——它会列出这个仓库已有的工作树和每个树的状态(干净 / 有未提交改动)。
建议先在一个「试验仓库」上练手,熟悉后再搬到主力项目。

Step 3: Open multiple agent sessions in parallel第三步:并行开出多个 Agent 会话
First terminal: wt switch -c feat-login -x claude – Complete "creating a worktree + switching directories + launching Claude" in one line. Tell it to "implement the login page".
Second terminal: wt switch -c fix-nav -x codex – The same action assigns another task to Codex. The two Agents are now in separate directories, and their files do not interfere with each other.
To see the big picture: Run wt list on any terminal, and the status of each tree is clear at a glance. To switch to a specific tree, simply use wt switch <branch name>, with no need to remember the path.
第一个终端:wt switch -c feat-login -x claude——一行完成「建工作树 + 切目录 + 启动 Claude」,对它说「实现登录页」。
第二个终端:wt switch -c fix-nav -x codex——同样的动作给 Codex 派另一个任务。两个 Agent 现在各自独立目录,文件互不干扰。
想看全局:随便哪个终端跑 wt list,每个树的状态一目了然;切换某棵树只需 wt switch <分支名>,不用记路径。

Step 4: Attach the hooks to allow the new tree to set up automatically第四步:配钩子,让新树自动就绪
Add a create hook (such as npm install) to the repository configuration, and then dependencies will be automatically installed as soon as each new working tree is created. The biggest pain point of parallelism – "having to run npm install for every tree" – is thus eliminated.
Add a pre-merge hook to run tests: Automatically validate before merging, so dirty code doesn't make it into the main branch.
For more hook timings and writing styles, see the Hooks section of the worktrunk.dev documentation. Simply copy the example and change the command.
在仓库配置里加一条 create 钩子(如 npm install),之后每棵新工作树一创建就自动装好依赖——并行的最大痛点「每棵树都要重新 npm install」就此消失。
再配一条 pre-merge 钩子跑测试:合并前自动验证,脏代码进不了主干。
更多钩子时机与写法见 worktrunk.dev 文档的 Hook 章节,照抄示例改命令即可。

Step 5: Clean up after finishing work第五步:收工清理
For trees where tasks have been completed and code has been merged, a single wt remove <branch name> command will clear both the working tree and the branch. If there are uncommitted changes in the tree, it will refuse to delete and display a prompt, preventing accidental deletion.
Run wt list before finishing the day's work and clear out any unnecessary trees – keeping your desktop (and working tree) tidy is a parallel discipline.
Advanced features: LLM automatic commit messages and copy-on-write build caches are all waiting for you in the documentation. The tools accompanying this article can be found via the download button above.
任务完成、代码已合并的树,一条 wt remove <分支名> 连工作树带分支一起清掉;带未提交改动的树它会拒绝删除并提示,不会误伤。
结束一天工作前跑一遍 wt list,把不需要的树清掉——保持桌面(和工作树)整洁是并行的纪律。
进阶玩法:LLM 自动 commit message、写时复制构建缓存,都在文档里等着你。本文配套工具见上方下载按钮。

Problem Encountered遇到问题
wt command not found: Check whether PATH contains the directory where wt.exe is located and reopen the terminal; Hook not working: Confirm that it is written in the repository-level configuration and not globally; Deletion rejected: Commit or stash uncommitted changes first. The official Worktrunk build that accompanies this article can be found via the download button above.
wt 找不到命令:检查 PATH 是否包含 wt.exe 所在目录并重开终端;钩子不生效:确认写在仓库级配置而非全局;删除被拒:先提交或 stash 未提交改动。本文配套 Worktrunk 官方构建见上方下载按钮。
想马上用起来?去「AI工具」栏挑一个直接下载,或在「AI教程」里跟着图文步骤做一遍。
去 AI工具 → 看 AI教程 →阅读与点赞数据保存在你的浏览器本地,欢迎留下你的想法。
今日正能量学一点,用一点;今天种下的种子,会长成明天的能力。去免费下载专区 →广告
评论 文明发言,让讨论更有价值