[Feature Request] Auto-select ExitPlanMode option via settings

Resolved 💬 4 comments Opened Feb 14, 2026 by Nucs Closed Mar 15, 2026

Summary

When Claude calls ExitPlanMode, users are presented with a menu to choose how to proceed:

  1. Yes, clear context and bypass permissions - Clears conversation context, starts fresh with plan
  2. Yes, and bypass permissions - Keeps context, enables bypass mode
  3. Yes, manually approve edits - Keeps context, default mode
  4. No, keep planning - Stay in plan mode

Currently, there's no way to configure a default selection for this menu. This creates friction for both headless automation (where no interactive menu is available) and interactive workflows (where users consistently want the same option).

Use Cases

Headless/CI Automation (-p mode)

When running claude -p --permission-mode plan "task", if Claude calls ExitPlanMode, the current options are:

  • PermissionRequest hook can auto-approve, but always uses "keep context" behavior
  • No way to trigger the "clear context" options that reset the conversation with just the plan

Interactive Speed Optimization

Power users who always want the same option (e.g., "clear context and bypass") currently must manually select it every time.

Proposed Solutions

Option A: Settings-based Configuration

Add a setting to configure the default ExitPlanMode behavior:

// settings.json
{
  "permissions": {
    "autoExitPlanMode": "clearAndBypass"
  }
}

Possible values:
| Value | Equivalent Menu Option |
|-------|------------------------|
| "clearAndBypass" | Yes, clear context and bypass permissions |
| "clearAndAcceptEdits" | Yes, clear context and auto-accept edits |
| "keepAndBypass" | Yes, and bypass permissions |
| "keepAndDefault" | Yes, manually approve edits |
| "compactAndAccept" | Compact context, then accept plan (see below) |
| null / not set | Show interactive menu (current behavior) |

Option B: Enhanced Hook Support

Extend the PermissionRequest hook output schema to support context clearing:

{
  "hookSpecificOutput": {
    "hookEventName": "PermissionRequest",
    "decision": {
      "behavior": "allow",
      "clearContext": true,
      "updatedPermissions": [
        { "type": "setMode", "mode": "bypassPermissions", "destination": "session" }
      ]
    }
  }
}

This would be powerful because:

  • Dynamic decisions: Hooks can conditionally decide based on tool input, context, or external factors
  • Existing infrastructure: PermissionRequest hooks already support updatedPermissions with setMode
  • Consistency: Keeps configuration in the hook system rather than splitting across settings

Option C: Both

Settings for simple static defaults, hooks for dynamic/conditional behavior.

Option D: Compact Context Before Accept (Thanks @Joilence!)

As suggested in #18523, add a "compact and accept" option that runs context compaction before accepting the plan, rather than clearing entirely:

  • Preserves important context while reducing token usage
  • Middle ground between "clear everything" and "keep everything"
  • Could be: "compactAndBypass" or "compactAndAcceptEdits"

This addresses the concern that clearing context loses valuable information, while still managing context size.

Current Hook Limitation

The PermissionRequest hook can return decision.behavior: "allow" with updatedPermissions to set the mode, but currently:

  1. Context clearing (clearContext: true) only happens in the interactive menu handler
  2. The hook bypasses the menu entirely, so it can't trigger the "clear context" code path
  3. updatedPermissions can set mode but can't clear conversation context

Adding clearContext (or compactContext) support to the hook output schema would unlock this capability.

Related Improvements

Other enhancements discovered during investigation:

  1. Plan Mode Entry Behavior - Configure whether to "always start fresh" or "always continue" when re-entering plan mode with an existing plan file
  1. requiresUserInteraction Hook Override - Allow hooks to fully bypass tools that require user interaction (currently hooks can approve but the permission check still runs)
  1. Keyboard Shortcut - Shift+Tab already auto-selects "yes-accept-edits"; add a shortcut for "clear + bypass" (e.g., Ctrl+Shift+Tab)
  1. CLI Flag - For headless mode: --plan-exit-mode=clearAndBypass

Benefits

  • Automation-friendly: Enables fully non-interactive plan mode workflows
  • Consistent UX: Users who always want the same option can skip the menu
  • Backward compatible: Default behavior unchanged (show menu)
  • Flexible: Settings for simple cases, hooks for advanced/dynamic scenarios

Additional Context

  • This affects both -p headless mode and interactive sessions
  • The setting could also be useful for teammates/subagents where plan_mode_required is set
  • Shift+Tab already provides a keyboard shortcut for "accept edits" option, showing precedent for quick selection
  • Related: #18523

View original on GitHub ↗

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