Feature request: PostClear hook (or SessionReset event)

Resolved 💬 2 comments Opened Apr 7, 2026 by schpill Closed May 20, 2026

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

  • SessionStart fires once at process startup — context can be injected cheaply
  • /clear resets the conversation history but fires no hook
  • The only workaround is to use UserPromptSubmit to re-inject context, but this consumes tokens on every message — which is counterproductive if the whole point of using /clear was 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 /clear for 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.

View original on GitHub ↗

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