Permission prompt misclassifies edits inside `.claude/worktrees/` as Claude settings edits

Resolved 💬 3 comments Opened May 20, 2026 by raincoffeecode Closed May 24, 2026

Summary

When Claude Code edits a source file inside a path like .claude/worktrees/<slug>/..., the permission prompt offers the option "Yes, and allow Claude to edit its own settings for this session." This framing is wrong — the file being edited is ordinary project source code that happens to live in a git worktree placed under .claude/worktrees/, not anything related to Claude Code's settings/config.

The heuristic appears to key off the literal .claude/ path segment and assume everything underneath is Claude config.

Why this path exists

I use git worktree to run multiple concurrent Claude Code sessions on the same repo, with worktrees checked out under .claude/worktrees/<slug>/. This is a pattern set up by a helper script in the repo (scripts/worktree-add.sh) and documented in our project's .claude/rules/worktrees.md. The .claude/worktrees/ location keeps worktrees co-located with other per-project Claude state and out of the parent directory.

So .claude/worktrees/<slug>/src/foo.tsx is just src/foo.tsx on a feature branch — it has nothing to do with Claude settings.

Repro

  1. Create a worktree under .claude/worktrees/<some-slug>/ in any project.
  2. In Claude Code, cd into that worktree and ask Claude to edit a source file (e.g. src/...).
  3. Observe the permission prompt — the "allow Claude to edit its own settings" option appears.

Expected

Edits to files inside .claude/worktrees/<slug>/** should be treated as ordinary file edits in the project, with the standard "allow file edit" prompt. The "edit its own settings" framing should only apply to real Claude config paths (~/.claude/settings.json, project-level .claude/settings.json, .claude/settings.local.json, etc.) — not to anything that simply happens to be nested under a .claude/ directory.

Suggested fix direction

Tighten the matcher so it considers the specific config files/dirs Claude actually owns, rather than the .claude/ prefix in general. A worktree at .claude/worktrees/** should not match; neither should other ad-hoc subdirectories users put under .claude/ for project-local tooling.

View original on GitHub ↗

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