[Feature Request] Add hookable event for plan acceptance with context clear
---
Title: Plan acceptance with "clear context" does not fire SessionStart hook
Description:
When accepting a plan with "Yes, clear context and auto-accept edits" (shift+tab), no SessionStart hook is fired. This creates a gap where context is wiped with no opportunity for hooks to:
- Validate the plan contains concrete values (paths, branch names, etc.) before context is cleared
- Inject critical context that should survive the clear
- Log/track context-clearing events
Steps to Reproduce:
- Add a SessionStart hook that logs the source value:
``json``
{
"hooks": {
"SessionStart": [{
"hooks": [{
"type": "command",
"command": "cat | jq -r '\"SessionStart: source=\" + .source' >> ~/.claude/session-events.log"
}]
}]
}
}
- Start a Claude Code session (hook fires with
source=startup✓) - Enter plan mode and create a plan
- Accept with "Yes, clear context and auto-accept edits" (shift+tab)
- Check log file — no entry added
Expected Behavior:
SessionStart should fire with a new source value (e.g., source=plan_clear or source=clear) when accepting a plan that clears context.
Why This Matters:
"Accept plan and clear context" is functionally equivalent to compaction from a failure-mode perspective, Claude loses context and must operate from the plan summary alone.
A hookable event would allow validation and verification of specific verified values before the context wipe occurs.
Environment:
- Version: 2.1.15
- Platform: Linux
- Terminal: VS Code
---
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗