Skip to content

fix: add 'clear' to SessionStart matcher#51

Open
ntroutman wants to merge 1 commit intoobra:mainfrom
ntroutman:fix/clear-session-start-matcher
Open

fix: add 'clear' to SessionStart matcher#51
ntroutman wants to merge 1 commit intoobra:mainfrom
ntroutman:fix/clear-session-start-matcher

Conversation

@ntroutman
Copy link

@ntroutman ntroutman commented Jan 28, 2026

Summary

  • Add clear to the SessionStart hook matcher so conversations are archived when users run /clear

Details

When users run /clear in Claude Code, it fires:

  • SessionEnd with reason clear
  • SessionStart with source clear

The current matcher (startup|resume) doesn't catch clear, so cleared conversations aren't archived until the next full CLI restart.

This one-line change adds clear to the matcher, making /clear behave consistently with CLI restart for archiving purposes.

Fixes #50

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Extended session start event detection to recognize an additional event type.

✏️ Tip: You can customize this high-level summary in your review settings.

When users run /clear in Claude Code, it fires SessionStart with
source='clear'. Without this matcher, cleared conversations aren't
archived until the next full CLI restart.

Fixes obra#50
@coderabbitai
Copy link

coderabbitai bot commented Jan 28, 2026

📝 Walkthrough

Walkthrough

The SessionStart hook matcher in hooks/hooks.json is updated to include the "clear" event, changing from "startup|resume" to "startup|resume|clear". This allows the hook to trigger when users execute the /clear command to archive conversations immediately.

Changes

Cohort / File(s) Summary
Hook Configuration
hooks/hooks.json
Updated SessionStart matcher pattern to include clear event, enabling conversation archiving when /clear command is executed

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 A whisper of clear through the hooks we weave,
The SessionStart listens when conversations leave,
Archive them swift, no waiting around—
Now every fresh start and clear makes a sound! 🌟

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'fix: add 'clear' to SessionStart matcher' accurately describes the main change in the changeset.
Linked Issues check ✅ Passed The pull request successfully implements the one-line change required by issue #50 to add 'clear' to the SessionStart hook matcher.
Out of Scope Changes check ✅ Passed The pull request contains only the minimal necessary change to address issue #50; no out-of-scope changes are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

gmax111 added a commit to gmax111/episodic-memory that referenced this pull request Jan 31, 2026
- Redirect embedding model log messages from stdout to stderr and
  suppress @xenova/transformers progress callbacks. Stdout is reserved
  for MCP JSON-RPC communication and any non-JSON output corrupts the
  protocol. (credit: obra#48)

- Add 'clear' to the SessionStart hook matcher so conversations are
  archived when users run /clear, not just on startup/resume. (credit: obra#51)

- Add SIGHUP handler and stdin close detection to the MCP server wrapper
  so child processes are cleaned up when the terminal closes or Claude
  crashes. (credit: obra#54)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SessionStart hook should also match 'clear' to archive conversations on /clear

1 participant