Skip to content

permissions hook blocks CLAUDE.md edits in worktrees #49

@frits-v

Description

@frits-v

Problem

The permissions.sh PreToolUse hook classifies all CLAUDE.md writes as config-file redirects, emitting:

REDIRECT: config path must persist across sessions. Write to: ~/src/cn/.github/CLAUDE.md

This blocks legitimate edits to CLAUDE.md on PR branches in worktrees (e.g. .worktrees/87b94d50/CLAUDE.md). The file is a committed repo artifact, not a session config file.

Reproduction

  1. Create a worktree for a repo that has CLAUDE.md committed
  2. Checkout a feature branch in the worktree
  3. Attempt to edit CLAUDE.md via the Edit tool

Expected: Edit succeeds (path is inside .worktrees/)
Actual: Hook blocks the edit and redirects to the main checkout path

Workaround

Use sed via the Bash tool instead of the Edit tool.

Suggested Fix

When the target path is inside a .worktrees/ directory, skip the config-file redirect logic. The worktree path signals that this is a branch-content edit, not a session-config write.

Source

Discovered during PR ChowNow/.github#116 review feedback implementation (2026-04-03).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions