What this thread does
Use Worktrunk to create one worktree per coding session and put required dependency installation in a blocking pre-start hook.
Do first: install the CLI and shell integration using the Worktrunk install instructions:
brew install worktrunk
wt config shell install
1. Open a new terminal so the shell integration can change directories. In a committed Git project whose default branch contains package.json and a matching package-lock.json, add this to .config/wt.toml; preserve any existing hooks:
[pre-start]
deps = "npm ci"
2. Create a trial branch and worktree:
wt switch --create agent-example
Read the project hook commands before accepting their first-run approval. pre-start blocks until setup completes; post-start runs in the background. Use the blocking hook for dependencies that the agent immediately needs. See the hook lifecycle and configuration.
3. Confirm the directory and branch with pwd and git branch --show-current, run the project's existing check, then start your coding agent. Use another terminal and a different branch name for a second session. New branches start from the default branch; use --base=@ when you need the current commit instead. See wt switch.
4. If creation leaves an existing worktree after a dependency failure, enter that worktree, correct the underlying install problem, and ensure its .config/wt.toml contains the hook above before explicitly rerunning setup:
wt hook pre-start --foreground
Do not assume switching to the existing branch reruns creation hooks. Make setup commands safe to repeat. The hook reference documents explicit execution and the use of project config from the worktree where the command runs; issue #4143 explains the incomplete-setup case.
Diagnostic: the worktree exists but dependencies are missing
A successful switch is not a dependency-readiness check. Inspect the setup command's exit status and run the project's normal check before handing the directory to an agent. Required setup belongs in pre-start; optional watchers belong in post-start. Hook semantics.
Evidence
- Independent attention: GitHubTrending.today's November 7, 2026 capture places Worktrunk fourth in its weekly list. This measures interest, not coding outcomes. Weekly capture.
- Public trial report: ee-prog, September 16, 2026, describes Worktrunk 0.77.0 on macOS arm64 leaving dependency setup incomplete after a failed hook: “
pre-startnever runs” on the subsequent switch. The report includes reproduction commands. Issue #4143 was closed as completed on 20 November 2026 by PR #4705. As of November 2026, Worktrunk 0.83.0, released 21 November, includes a retry hint after failedpre-startsetup. Issue #4143.
Limits
This is a small Node-project trial, not a general dependency recipe. Substitute the project's own setup command for other stacks. Separate working directories do not isolate external services or resolve merge conflicts. The issue establishes one failure path, not a reliability rate or evidence of faster coding.
Not for: dev-server port clashes between worktrees; see portless-named-urls-for-parallel-worktrees.
Started from a post by @max-sixty, packaged by the editor. Original post