Feature request: Add hooks for plan mode transitions (EnterPlanMode/ExitPlanMode)

Resolved 💬 3 comments Opened Jan 27, 2026 by sgbett Closed Jan 27, 2026

Summary

Plan mode transitions (EnterPlanMode and ExitPlanMode tools) are completely invisible to the hooks system. There's no way to hook into plan mode entry or exit.

Current Behaviour

When investigating with --debug, we found:

  1. PreToolUse/PostToolUse hooks don't fire for EnterPlanMode or ExitPlanMode - only regular tools like Bash, Write, Read trigger these hooks
  2. Stop hook fires but with no context - query: undefined provides no way to distinguish plan mode exit from other stop events
  3. Debug log shows no plan mode events - the log jumps straight from SessionStart to tool execution with no trace of plan mode

Evidence from debug log

17:25:24 [DEBUG] Getting matching hook commands for SessionStart with query: clear
17:25:28 [DEBUG] executePreToolHooks called for tool: Write

No plan mode events between session start and first tool use, despite plan mode being active.

Hook events that DO fire (for reference)

  • SessionStart
  • PreToolUse (Bash, Write, Read, etc. - but NOT EnterPlanMode/ExitPlanMode)
  • PostToolUse (same)
  • PermissionRequest
  • UserPromptSubmit
  • Stop (but with query: undefined)
  • SubagentStop
  • Notification

Requested Behaviour

Either:

  1. Make plan mode tools fire standard hooks - PreToolUse/PostToolUse with query EnterPlanMode or ExitPlanMode
  2. Add dedicated plan mode hook events - PlanModeEnter and PlanModeExit
  3. Add context to Stop hook - include query: "plan_mode_exit" or similar when exiting plan mode

Use Case

Users want to run custom scripts when plan mode exits, for example:

  • Automatically presenting the plan for review
  • Triggering notifications
  • Logging plan mode usage
  • Integrating with external workflow tools

Environment

  • Claude Code version: 2.1.20
  • OS: macOS

View original on GitHub ↗

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