claude-code - 💡(How to fix) Fix [FEATURE] Allow hooks to switch permission mode

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…

Code Example

{
  "hookSpecificOutput": {
    "hookEventName": "PostToolUse",
    "permissionMode": "auto"
  }
}
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing requests and this feature hasn't been requested yet
  • This is a single feature request (not multiple features)

Problem Statement

No hook or tool output field can switch the permission mode. Approval-based workflows — code review tools, plan approvers, deployment gates — know the user has explicitly approved something but can't communicate "switch to auto mode" back to the harness. The user has to manually Shift+Tab after every approval cycle.

For example: a code review tool presents a browser UI, the user clicks "Approve", the tool returns structured output indicating approval — but Claude stays in whatever mode it was in. The user must manually cycle to auto or accept-edits mode every time.

Proposed Solution

Add a permissionMode field to hook output (PostToolUse, Stop, or UserPromptSubmit) that the harness honors:

{
  "hookSpecificOutput": {
    "hookEventName": "PostToolUse",
    "permissionMode": "auto"
  }
}

Open to other mechanisms — the core need is: let an external process signal a mode switch after user-initiated approval.

Alternative Solutions

  • additionalContext in hooks can inject text the model sees, but this only influences the model's decisions — the harness still gates permissions at the old mode level.
  • Setting defaultMode: "auto" globally works but is permanent, not contextual.
  • Simulating keystrokes to cycle Shift+Tab (fragile, platform-dependent).

Priority

Medium - Would be very helpful

Feature Category

MCP server integration

Use Case Example

  1. User is working with Claude Code and triggers a code review tool (via Bash or MCP)
  2. The tool opens a browser UI where the user reviews changes and clicks "Approve"
  3. A PostToolUse hook detects the approval and outputs {"permissionMode": "auto"}
  4. Claude Code switches to auto mode and continues implementing without per-file permission prompts
  5. User doesn't have to manually Shift+Tab after every review cycle

Additional Context

Previously requested via hooks — all closed as stale, none implemented:

  • #29820 — "Allow Stop hooks to switch permission mode"
  • #19514 — same request, original filing
  • #14044 — "Allow hooks to programmatically exit plan mode"

Related open issues expanding hook capabilities:

  • #54822 — let hooks invoke slash commands via invokeCommand
  • #57306 — session metrics + warm-reset primitive in hooks

The underlying need is unchanged: external workflows that involve explicit user approval need a way to influence permission mode.

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

claude-code - 💡(How to fix) Fix [FEATURE] Allow hooks to switch permission mode