如何在同一代码库中并行运行 5 个以上的 AI 代理,使用 Git 工作树

📄 中文摘要

在同一代码库中并行运行多个 AI 编程代理(如 Claude Code、Cursor 和 Windsurf)时,使用 Git 工作树作为隔离机制,使每个代理拥有自己的工作目录,同时共享相同的 .git 历史。这种方法避免了代码库的重复克隆和磁盘浪费。然而,管理这些工作树存在困难,原生的 git worktree 命令功能有限,缺乏统一的路径、命名和配置复制方式。为了简化管理,开发了一个名为 git-wt 的 Bash 包装器,提供了一个统一的命令行接口,方便用户列出、切换和清理工作树。

📄 English Summary

How I Run 5+ AI Agents in Parallel on the Same Repo with Git Worktrees

Running multiple AI coding agents (such as Claude Code, Cursor, and Windsurf) in parallel on the same repository utilizes Git worktrees for isolation, allowing each agent to have its own working directory while sharing the same .git history. This approach avoids unnecessary cloning and disk usage. However, managing these worktrees can be challenging due to the limited functionality of native git worktree commands, which lack unified paths, naming, and configuration copying. To address these management issues, a Bash wrapper called git-wt was developed, providing a single command-line interface for listing, switching, and cleaning up worktrees.

Powered by Cloudflare Workers + Payload CMS + Claude 3.5

数据源: OpenAI, Google AI, DeepMind, AWS ML Blog, HuggingFace 等