Worktree sessions inherit .env from the main checkout
Spin up an agent in a git worktree for isolation and it happily reads ../main-checkout/.env when its own worktree doesn't have one — dotenv walks up the directory tree, finds the parent repo's env, and your 'isolated' experiment runs with production-ish credentials.
Claude Code2.4.05 repliesProblem1d ago