[FEATURE] Allow hooks to switch permission mode

Resolved 💬 3 comments Opened May 12, 2026 by tomasz-tomczyk Closed Jun 12, 2026

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] 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.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗