Why Git Worktrees Fail as Isolation Boundaries for AI Coding Agents

Git worktrees are not an isolation boundary for coding agents

Why Git Worktrees Fail as Isolation Boundaries for AI Coding Agents

I discovered that Git worktrees do not provide true isolation for AI coding agents because they share critical repository state like hooks and configuration. An agent in a worktree can execute code on your host or rewrite your commit identity. My benchmarks show that using a fully isolated clone costs the same in time and disk space, making it the only safe option for running agents in parallel.

A worktree was never a boundary. It is a second working directory attached to one .git, and everything interesting lives in that .git.

More from this day

2026-07-30