Feature request: PostClear hook (or SessionReset event)
Summary
When using /clear to reset the conversation context, there is currently no hook event fired. This makes it impossible to automatically re-inject project context after a clear without paying token costs on every single prompt.
Current behavior
SessionStartfires once at process startup — context can be injected cheaply/clearresets the conversation history but fires no hook- The only workaround is to use
UserPromptSubmitto re-inject context, but this consumes tokens on every message — which is counterproductive if the whole point of using/clearwas to save tokens
Desired behavior
A new PostClear hook (or SessionReset event) that fires immediately after /clear completes, allowing the same additionalContext injection pattern as SessionStart.
Use case
Many users maintain a resume.md / context file at the project root and inject it via SessionStart to orient Claude at session startup. After /clear, this context is lost and must be re-injected manually (e.g. via a slash command like /gg-remember).
A PostClear hook would allow:
"PostClear": [
{
"hooks": [
{
"type": "command",
"command": "python3 inject_context.py",
"timeout": 5
}
]
}
]
This mirrors the SessionStart pattern exactly, keeping token usage minimal while restoring context automatically after a clear.
Alternatives considered
UserPromptSubmit: injects context on every message — defeats the purpose of/clearfor token savings- Manual slash command: works but requires user action every time
- New terminal session: works but heavier UX than
/clear
A PostClear hook would be a lightweight, targeted solution for a common workflow.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗