Web app (claude.ai/code) auto-creates worktrees without user request

Resolved 💬 3 comments Opened Apr 2, 2026 by lucasgeeksinthewood Closed Apr 6, 2026

Description

When using Claude Code via the web app (claude.ai/code), a git worktree is automatically created on every new session without the user requesting it. There is no setting to disable this behavior.

Steps to Reproduce

  1. Open claude.ai/code on a git repository
  2. Start a new conversation
  3. Observe that a worktree is created automatically (e.g., .claude/worktrees/pensive-euclid)

Expected Behavior

Worktrees should only be created when explicitly requested by the user (e.g., "work in a worktree" or --worktree flag). By default, Claude Code should operate directly in the main repository.

Actual Behavior

Every new session auto-creates a worktree and operates from it. This causes several issues:

  • Files edited in the worktree are not visible in VS Code (which has the main repo open), making it hard to review changes
  • Turbopack/Next.js gets confused by duplicate package-lock.json files and may read source files from the wrong directory
  • .env files are not copied to the worktree, causing runtime errors (e.g., missing ANTHROPIC_API_KEY, SUPABASE_URL)
  • Migrations and other new files only exist in the worktree, not the main repo -- users can't see or run them
  • preview_start tool fails due to sandbox restrictions on worktree paths
  • The user has to manually copy files between worktree and main repo, defeating the purpose

Environment

  • Platform: macOS (Darwin 24.6.0)
  • Claude Code web app (claude.ai/code)
  • Repository: Next.js 16 + Supabase project

Requested Fix

Add a setting (e.g., in .claude/settings.json) to disable automatic worktree creation:

{
  "worktree": {
    "autoCreate": false
  }
}

Or change the default behavior so worktrees are opt-in, not opt-out.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗