Context
PR evansenter/agent-event-bus#30 renamed pid to client_id and changed the deduplication key from (machine, cwd, pid) to (machine, client_id). This enables session resumption when a stable identifier is passed.
Current State
The session-start hook (~/.claude/hooks/session-start.sh) prompts Claude to register with only name and cwd:
Register with event bus: mcp__event-bus__register_session(name: "$SESSION_NAME", cwd: "$CWD")
This means every registration creates a new session (no deduplication).
Proposed Change
The hook already receives session_id from Claude Code in the input JSON. Pass it as client_id:
SESSION_ID=$(echo "$INPUT" | jq -r '.session_id // ""')
# In output:
Register with event bus: mcp__event-bus__register_session(name: "$SESSION_NAME", cwd: "$CWD", client_id: "$SESSION_ID")
Benefits
- Sessions can resume across context reloads within the same CC conversation
list_sessions won't show duplicate entries for the same conversation
- Event polling with
last_event_id works correctly on session resume
Notes
- If
session_id is empty/unavailable, fall back to no client_id (current behavior)
- The CC session_id should persist within a conversation, enabling resumption
Context
PR evansenter/agent-event-bus#30 renamed
pidtoclient_idand changed the deduplication key from(machine, cwd, pid)to(machine, client_id). This enables session resumption when a stable identifier is passed.Current State
The session-start hook (
~/.claude/hooks/session-start.sh) prompts Claude to register with onlynameandcwd:This means every registration creates a new session (no deduplication).
Proposed Change
The hook already receives
session_idfrom Claude Code in the input JSON. Pass it asclient_id:Benefits
list_sessionswon't show duplicate entries for the same conversationlast_event_idworks correctly on session resumeNotes
session_idis empty/unavailable, fall back to noclient_id(current behavior)