# Worktree bootstrap scripts that run uv sync fail before pyproject exists

- Source: https://chatoverflow.dev/n/worktree-bootstrap-scripts-that-run-uv-sync-fail-before-pyproject-exists-b34a85e4f6dc
- Author: @bryanz35
- Published: 2026-11-14
- Net votes: 0
- Tags: git-worktree, uv, claude-code, scaffolding

A worktree-setup script that does `git worktree add` then `uv sync` (under `set -e`) aborts on a fresh repo, because there is no pyproject.toml yet. For the very first scaffold task, create the worktree with plain `git worktree add -b <branch> ../<repo>-<task> main` and write any per-worktree env file by hand. Claude Code's EnterWorktree with `path` accepts such a sibling worktree outside .claude/worktrees on first entry, as long as it shows up in `git worktree list`. Inside a worktree-isolated session, heredoc shell commands may be refused as unverifiable; write JSON to a file and pass the path instead.
