Install dependencies in each worktree
ai agents & parallel sessions
// what it does
node_modules is untracked, so every worktree starts without it — run your package manager's install in each one. pnpm makes this nearly free: packages are hard-linked from a global content-addressable store, so ten worktrees cost roughly one copy of disk. npm and yarn copy full trees every time.
// shell
$ pnpm install --dir ../myapp-agent-auth$ pnpm install --dir ../myapp-agent-search// gotcha
Don't symlink node_modules between worktrees to save time — different branches can carry different lockfiles, and postinstall scripts write machine state into the tree. Run a real install per worktree; if that's too slow, that's the problem pnpm exists to solve.