← 返回
未分类 中文

Worktrunk

Git worktree manager for parallel AI agent workflows. Use when the user needs to manage multiple working directories for parallel development, create feature...
Git worktree 管理器,用于并行 AI Agent 工作流。适用于需要管理多个工作目录进行并行开发、创建功能分支等场景。
loonghao loonghao 来源
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 276
下载
💾 1
安装
1
版本
#latest

概述

Worktrunk — Git Worktree Manager for AI Agents

> One-sentence summary: vx worktrunk (alias vx wt) manages Git worktrees so you can run multiple AI agents in parallel without conflicts.

worktrunk is a Rust CLI tool designed for parallel AI agent workflows. It makes Git worktrees as easy to use as branches, with quality-of-life features like hooks, LLM commit messages, and per-worktree dev servers.

Why AI Agents Need This

When running multiple AI agents (Claude Code, Codex, etc.) on the same repo, they conflict:

  • Agent A modifies src/main.rs
  • Agent B modifies src/main.rsconflict

Solution: Give each agent its own worktree (isolated working directory).

Main repo:     ~/projects/my-app/          (main branch)
Agent 1:      ~/projects/my-app.wt/feat-auth/  (feat/auth branch)
Agent 2:      ~/projects/my-app.wt/feat-pay/   (feat/pay branch)

Installation (via vx)

vx install worktrunk
vx worktrunk --version    # verify

Core Commands

wt switch — Navigate Worktrees

# Create new worktree + switch to it
vx wt switch -c feat/auth

# Switch to existing worktree
vx wt switch feat/auth

# Switch back to main repo
vx wt switch -

# Create AND launch an AI agent in one command
vx wt switch -c -x claude feat/auth

wt list — Show All Worktrees

vx wt list            # compact list
vx wt list --full     # with CI status, AI-generated summaries, diff preview

wt merge — Clean Merge Workflow

vx wt merge          # squash merge + delete worktree + delete branch
vx wt merge --rebase  # rebase merge
vx wt merge --keep    # merge but keep worktree

wt remove — Clean Up

vx wt remove feat/auth          # remove worktree only
vx wt remove --with-branch feat/auth  # remove worktree + branch

Advanced Features

PR Checkout

vx wt switch pr:123    # checkout PR #123 into a worktree

Hooks (Automate Setup)

Configure in .worktrunk/hooks.toml:

[post_create]
command = "npm install"     # auto-install deps on create

[pre_merge]
command = "vx run test"      # run tests before merge

Share Build Caches Between Worktrees

# Copy node_modules/ to new worktree (skip cold install)
vx wt switch -c --copy-cache feat/auth

Per-Worktree Dev Server (Unique Port)

worktrunk can assign each worktree a unique port (via hash_port template filter):

# In package.json:
"scripts": {
  "dev": "next dev -p {{ hash_port 3000 }}"
}
# Main repo  → port 3000
# feat/auth → port 3217 (deterministic hash)

Typical AI Agent Workflow

# 1. Main repo: assign tasks to agents
cd ~/projects/my-app
echo "Add JWT auth" > .AITASK

# 2. Create isolated worktree for agent 1
vx wt switch -c -x claude feat/auth

# (inside worktree, agent runs autonomously)
# Agent modifies files, commits, etc.

# 3. Meanwhile, create another worktree for agent 2
vx wt switch -c -x claude feat/pay

# 4. When agents finish, merge both
vx wt merge feat/auth
vx wt merge feat/pay

vx Integration

worktrunk is installed and managed by vx:

# Install
vx install worktrunk

# Run (vx auto-installs if missing)
vx worktrunk --version
vx wt switch -c feat/auth

# Update
vx install worktrunk@latest

Command Reference

CommandDescription
-----------------------
vx wt switch [branch]Switch to worktree
vx wt switch -c [branch]Create worktree + switch
vx wt switch -c -x [branch]Create + run command (e.g., launch AI agent)
vx wt switch pr:Checkout PR into worktree
vx wt listList worktrees
vx wt list --fullDetailed list with CI/LLM summary
vx wt mergeSquash merge + cleanup
vx wt remove [branch]Remove worktree
vx wt remove --with-branch [branch]Remove worktree + branch

Tips for AI Agents

  1. Always use vx wt switch -c to create isolated environments before making changes
  2. Use -x claude to automatically launch the AI agent in the new worktree
  3. Use vx wt merge instead of manual git merge — it handles worktree cleanup
  4. Configure hooks in .worktrunk/hooks.toml to auto-install dependencies on create
  5. Use --copy-cache to share node_modules/ / target/ between worktrees

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-08 03:34 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

dev-programming

Mcporter

steipete
使用 mcporter CLI 直接列出、配置、认证及调用 MCP 服务器/工具(支持 HTTP 或 stdio),涵盖临时服务器、配置编辑及 CLI/类型生成功能。
★ 196 📥 67,943
dev-programming

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 75 📥 182,409
ai-agent

Dcc Cli Gateway

loonghao
默认统一入口,供代理和无头 CLI主机(OpenClaw、Hermes、Codex CLI、CI 机器人、自定义代理运行时)控制实时 DCC 应用程序...
★ 0 📥 2,042