Read auto-accept writes rules with doubled leading slash; broad allow-rule doesn't match linked-worktree paths

Status Fixed / completed
Reported on v2.1.122
Maintainer reply None cached
Activity 3 comments · opened Apr 28, 2026 · closed Apr 28, 2026

Description

A Read(/Users/me/code/**) rule at the user level does not match Read calls targeting paths inside a linked git worktree that lives outside the cwd repo, even though the path is lexically a subpath of the rule.

When I "always allow" the prompt, Claude Code writes the auto-generated rule to settings.local.json with a doubled leading slash:

"Read(//Users/me/code/tasks/codegen/<branch>/**)"

The doubled // suggests path normalization is concatenating "/" + already-absolute path. The single-slash rule never matches that internal representation.

Repro

  1. In user settings.json, allow "Read(/Users/me/code/**)".
  2. cwd is /Users/me/code/repo-A (a regular git checkout).
  3. git worktree add /Users/me/code/tasks/codegen/branch-x … (peer to repo-A).
  4. Have Claude Code Read a file under /Users/me/code/tasks/codegen/branch-x/….

Expected: Read is allowed by the existing rule.
Observed: Prompt; on "always allow", a rule with the doubled-slash form gets written into <repo-A>/.claude/settings.local.json.

Workaround

Add a parallel doubled-slash rule to user settings:

"Read(//Users/me/code/**)"

Environment

  • Claude Code 2.1.122
  • macOS Darwin 25.4.0

View original on GitHub ↗

3 Comments

github-actions[bot] · 5 months ago

Found 2 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/44106
  2. https://github.com/anthropics/claude-code/issues/52835

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

w-goog · 5 months ago

Duplicate of #44106

github-actions[bot] · 5 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.