claude-code - 💡(How to fix) Fix bypassPermissions mode still shows dialog for .claude/hooks/ edits despite permissions.allow settings [1 comments, 2 participants]

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…
GitHub stats
anthropics/claude-code#46804Fetched 2026-04-12 13:32:38
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Author
Timeline (top)
labeled ×4commented ×1

When using --dangerously-skip-permissions (bypassPermissions mode), Claude Code still shows a 3-choice approval dialog when editing files under .claude/hooks/:

Do you want to make this edit to pre-tool-use-model-role-policy.py?
❯ 1. Yes
  2. Yes, and allow Claude to edit its own settings for this session
  3. No

This happens even when permissions.allow in settings.json contains patterns like:

  • Edit(~/.claude/**)
  • Edit(/home/fumi/.claude/**)
  • Edit(~/.claude/hooks/*.py)

Root Cause

When using --dangerously-skip-permissions (bypassPermissions mode), Claude Code still shows a 3-choice approval dialog when editing files under .claude/hooks/:

Do you want to make this edit to pre-tool-use-model-role-policy.py?
❯ 1. Yes
  2. Yes, and allow Claude to edit its own settings for this session
  3. No

This happens even when permissions.allow in settings.json contains patterns like:

  • Edit(~/.claude/**)
  • Edit(/home/fumi/.claude/**)
  • Edit(~/.claude/hooks/*.py)

Fix Action

Workaround

We implemented a PreToolUse hook that explicitly returns {"permissionDecision": "allow"} for trusted delegated sessions (verified via environment variable nonce). This bypasses the dialog. Note: sys.exit(0) from a hook is insufficient — only an explicit allow JSON response bypasses the built-in gate.

Code Example

Do you want to make this edit to pre-tool-use-model-role-policy.py?
1. Yes
  2. Yes, and allow Claude to edit its own settings for this session
  3. No
RAW_BUFFERClick to expand / collapse

Description

When using --dangerously-skip-permissions (bypassPermissions mode), Claude Code still shows a 3-choice approval dialog when editing files under .claude/hooks/:

Do you want to make this edit to pre-tool-use-model-role-policy.py?
❯ 1. Yes
  2. Yes, and allow Claude to edit its own settings for this session
  3. No

This happens even when permissions.allow in settings.json contains patterns like:

  • Edit(~/.claude/**)
  • Edit(/home/fumi/.claude/**)
  • Edit(~/.claude/hooks/*.py)

Expected behavior

In --dangerously-skip-permissions mode, if permissions.allow already contains a matching pattern for the file being edited, the dialog should not appear.

Actual behavior

The built-in .claude/ self-edit protection overrides permissions.allow and still shows the dialog, even with --dangerously-skip-permissions.

Investigation findings

From official docs (confirmed): "writes to sensitive directories like .git, .claude, and .vscode still require confirmation" even in bypassPermissions mode. The exceptions documented are only commands/, agents/, and skills/ subdirectories — .claude/hooks/ is NOT in the exceptions list.

Workaround

We implemented a PreToolUse hook that explicitly returns {"permissionDecision": "allow"} for trusted delegated sessions (verified via environment variable nonce). This bypasses the dialog. Note: sys.exit(0) from a hook is insufficient — only an explicit allow JSON response bypasses the built-in gate.

Request

Either:

  1. Allow permissions.allow patterns to override the .claude/ built-in protection in bypassPermissions mode, OR
  2. Extend the exceptions list (currently commands/, agents/, skills/) to include hooks/ when bypassPermissions mode is active and a matching permissions.allow entry exists, OR
  3. Document the PreToolUse hook workaround in the official docs

Environment

  • Claude Code version: latest
  • Platform: Linux
  • Mode: --dangerously-skip-permissions (bypassPermissions)

extent analysis

TL;DR

Implement a PreToolUse hook that returns {"permissionDecision": "allow"} for trusted delegated sessions to bypass the approval dialog when editing files under .claude/hooks/.

Guidance

  • The built-in .claude/ self-edit protection overrides permissions.allow and requires confirmation even in --dangerously-skip-permissions mode, unless an exception applies.
  • The current exceptions are commands/, agents/, and skills/ subdirectories, and do not include .claude/hooks/.
  • To mitigate this, implement a PreToolUse hook that checks for trusted delegated sessions and returns {"permissionDecision": "allow"} to bypass the dialog.
  • Ensure the hook is properly configured and returns the correct JSON response, as sys.exit(0) is insufficient.

Example

{
  "permissionDecision": "allow"
}

This JSON response should be returned by the PreToolUse hook to bypass the approval dialog.

Notes

The official documentation should be updated to reflect the available workarounds, including the PreToolUse hook solution, to help users understand the limitations and capabilities of --dangerously-skip-permissions mode.

Recommendation

Apply the PreToolUse hook workaround, as it provides a functional solution to bypass the approval dialog when editing files under .claude/hooks/, and allows for trusted delegated sessions to be explicitly allowed.

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…

FAQ

Expected behavior

In --dangerously-skip-permissions mode, if permissions.allow already contains a matching pattern for the file being edited, the dialog should not appear.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING