跪拜 Guibai
← All articles
AI Programming

worktrunk: Five Agent Workspaces, Measured — Slower Creation, Near-Zero Dependency Copies

By 高调的涵涵 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

A practical overhead of parallel AI agent workflows disappears on APFS and other CoW filesystems, where copying a 120MB dependency drops from 0.20s to 0.02s; but the tool's whole disk-saving premise collapses on ext4, and creation gets slower, so teams on non-CoW filesystems get none of the upside.

Summary

Parallel AI agents need isolated directories. worktrunk, a 10.7k-star Rust tool, gives you one-line `wt switch -c -x` commands that create a worktree and launch an agent in it, a `wt list` dashboard that shows uncommitted changes and sync status in a single table, and lifecycle hooks for dependency install and dev-server ports. The genuine payoff is cold-start cost: `wt step copy-ignored` reflinks ignored files on APFS/btrfs/XFS, so copying a 120MB dependency took 0.02s with no visible `df` increase, versus 0.20s and 120MB for an ordinary `cp`.

That saving doesn't come free. Creating 5 worktrees took 0.45s versus 0.11s for native git in a single measurement (about 0.07s extra each). The tool adds 44MB of binaries, requires shell integration for automatic `cd`, and hooks need one-time approval. The author was explicit about what wasn't measured: real node_modules with thousands of small files, reflink after writes, merge conflicts, and five agents running to completion. On ext4, reflink doesn't apply and disk savings vanish.

The practical judgment: worktrunk isn't for making worktrees faster; it's for making the act of spawning another agent cheap enough that you actually do it. For developers running three or more agents on a CoW filesystem, the `wt list` overview and near-zero-copy dependency cloning change the workflow. For single-agent users on ext4, it's 44MB and three extra commands for no benefit.

Takeaways
— Creating 5 worktrees took 0.45s with worktrunk vs 0.11s for native git, a 0.34s total difference (about 0.07s per worktree) in a single measurement.
— Copying a single 120MB gitignored file: ordinary cp took 0.20s and added 122,916 KB per `df`; worktrunk's `copy-ignored` took 0.02s and showed −32 KB in `df`.
— Five ordinary `cp -R` copies of a 120MB file consumed 614,716 KB (about 600MB) by `df`; five reflinks were not measured.
— worktrunk uses APFS clonefile on macOS; btrfs and XFS support reflink on Linux, but ext4 falls back to ordinary copying.
— The `wt` binary is 22MB and the release tarball 6.4MB; the project is MIT OR Apache-2.0, written in Rust.
— Shell integration is required for automatic directory changes; without it, every command prints a warning.
— A `pre-start` hook with a 0.2s sleep ran in 0.36s total, leaving 0.16s for creation and hook execution.
— Removing a worktree with 120MB of dependencies (43 files) via `wt remove -y --foreground` took 0.09s and returned only after deletion.
— `wt list` shows branch, uncommitted changes, ahead/behind main, remote sync, path, commit, age, and message in one table.
— Hooks require one-time approval per command, stored in `~/.config/worktrunk/approvals.toml`; `--yes` skips it in CI.
— A branch name that already exists is refused on `switch -c`; worktrees with uncommitted changes block `remove` unless `--force` is used.
— The author tested only a single 120MB file, not real node_modules, and did not test merge conflicts, rebase, reflink after writes, or LLM-generated commit messages.
Conclusions

The measured 4x and 10x ratios are single-run numbers at 0.1-second and 0.02-second scales, where process startup and timer precision dominate; they should be read as order-of-magnitude, not benchmarks.

worktrunk's real contribution is lowering the friction of opening a new workspace, not making git faster; that aligns with the conclusion that it's only worth installing at three or more parallel agents.

The reflink benefit is tightly coupled to file-system support and read-only dependencies; since build caches get written, block splitting will reclaim disk usage, so the win concentrates on cold starts.

The author's refusal to test real node_modules and conflict workflows keeps the claims honest; the disk-saving conclusion would likely differ for tens of thousands of small files.

Concepts & terms
git worktree
A git feature that creates separate working directories for different branches of the same repository, sharing the object database so each worktree costs only a small pointer file instead of a full clone.
reflink (copy-on-write)
A file system operation that makes a new file reference the same disk blocks as the original instead of copying bytes; blocks only split when a write happens. APFS uses clonefile, and btrfs/XFS support reflink, but ext4 does not.
shell integration
An optional worktrunk component that hooks into your shell configuration so `wt switch` can automatically change the current directory; without it, the tool warns every time and you must `cd` manually.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗