claude-code - 💡(How to fix) Fix Permission prompt misclassifies edits inside `.claude/worktrees/` as Claude settings edits

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

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.

Root Cause

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.

RAW_BUFFERClick to expand / collapse

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.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING