[Feature Request] Add hookable event for plan acceptance with context clear

Resolved 💬 2 comments Opened Jan 26, 2026 by ckl2007 Closed Jan 26, 2026

---

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:

  1. Validate the plan contains concrete values (paths, branch names, etc.) before context is cleared
  2. Inject critical context that should survive the clear
  3. Log/track context-clearing events

Steps to Reproduce:

  1. 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"
}]
}]
}
}
``

  1. Start a Claude Code session (hook fires with source=startup ✓)
  2. Enter plan mode and create a plan
  3. Accept with "Yes, clear context and auto-accept edits" (shift+tab)
  4. 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

---

View original on GitHub ↗

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