From: Maciej Ciemborowicz Date: Sat, 03 Oct 2026 18:47:25 GMT Subject: Re: [PATCH v2 0/4] worktree: add lifecycle hooks Message-ID: <20261003184725.29917-1-maciej.ciemborowicz@gmail.com> In-Reply-To: Hi Junio, Thank you for the detailed explanation. I agree that a wrapper is the right answer when the user controls the invocation of `git worktree`. I tried that approach for a tool I am building: it creates an isolated container environment for each worktree. This matters in particular for projects with databases and migrations, where two agents working in parallel must not share an environment. The problem is that, in this case, the worktree is often created by the IDE rather than by the user or the agent. For example, Codex in VS Code creates worktrees itself when it starts parallel agent sessions. A `git-wt` wrapper is therefore bypassed, and asking agents to use one does not help: by the time an agent begins work, the worktree may already exist and its environment needs to have been provisioned. It is possible to approximate this with polling or instructions in an AGENTS.md file, but neither provides a reliable lifecycle boundary. There is a race between worktree creation and the agent beginning work, and cleanup on removal has the same issue. So I wanted to report a concrete case where wrappers do not reach the actor that performs the operation. This has also been the most consistent feedback I have heard from people using parallel AI agents: they do not want to replace every worktree caller with a wrapper; they need a repository-local way to react when Git creates, moves, or removes a worktree. Best regards, Maciej Ciemborowicz