[BUG] PostToolUse hook for ExitPlanMode does not fire when you clear context
Resolved 💬 3 comments Opened Jan 23, 2026 by pathouse Closed Feb 28, 2026
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
I have a PostToolUse hook for ExitPlanMode tool
this hook works fine when i accept the plan without clearing context
but when you accept the plan and clear context, then the hook is not triggered
What Should Happen?
accepting a plan with the clear context action should still trigger the hook
Error Messages/Logs
no error message
Steps to Reproduce
create an exit plan mode hook:
e.g.
{
"hooks": {
"PostToolUse": [
{
"matcher": "ExitPlanMode",
"hooks": [
{
"type": "command",
"command": "echo \"=== $(date) ===\" >> \"$CLAUDE_PROJECT_DIR/exitplanmode-hook.log\"; jq '.' >> \"$CLAUDE_PROJECT_DIR/exitplanmode-hook.log\" 2>&1 || cat >> \"$CLAUDE_PROJECT_DIR/exitplanmode-hook.log\""
}
]
}
]
}
}
start claude code, generate a plan, accept it with the clear context option, see that no exitplanmode-hook.log file is created
start claude code, generate a plan, accept it without clearing context, see that the exitplanmode-hook.log file is correctly created
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.17
Platform
AWS Bedrock
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗