Feature request: Hook event for /clear command
Status Closed — not planned
Maintainer reply ✓ Yes — dicksontsai
Workaround ✓ Mentioned in description ↑
Activity 6 comments · opened Jan 29, 2026 · closed Mar 1, 2026
💡 Likely answer: A maintainer (dicksontsai, collaborator)
responded on this thread — see the highlighted reply below.
Summary
Add a hook event that fires when the user runs /clear to reset the conversation.
Use Case
I use multi-project planning with progress tracking in markdown files. Currently I have:
SessionStarthook to load planning contextStophook to remind about updating progress docs
However, /clear bypasses both — it resets context without triggering SessionEnd or Stop. This means:
- Progress tracking reminders are skipped
- Planning context isn't reloaded after clear
Proposed Solution
Add a Clear or PreClear hook event that fires when /clear is invoked, before the context is wiped. This would allow:
- Saving state before clear
- Prompting about unsaved work
- Running cleanup tasks
Alternatively, /clear could trigger SessionEnd then SessionStart to reuse existing hooks.
Workaround
Currently none — /clear cannot be intercepted or wrapped.
6 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
This is important.. feels like we should be able to deterministically control the hook sequence.
Closing for now — inactive for too long. Please open a new issue if this is still relevant.
SessionStart already fires with /clear. You'll need to use the proper matcher: https://code.claude.com/docs/en/hooks#sessionstart
Yeah, it wasn't working reliably.
But, things have improved significantly.
What I was more interested in was control of the context. Which doesn't
seem like it will happen.
On Sun, Mar 8, 2026, 2:03 PM Dickson Tsai @.***> wrote:
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.