[BUG] SessionStart hook re-fires when switching between session tabs in Claude Code Desktop
Bug Description
In Claude Code Desktop, switching away from a session tab and then switching back causes the SessionStart hook to fire again within the same session. The hook should only fire once when the session is first created.
Steps to Reproduce
- Open Claude Code Desktop with a
SessionStarthook configured - Start a new session — hook fires correctly ("Initialized your session")
- Send a message (e.g., "Hello") — get a response
- Click on a different session tab in the left sidebar
- Click back on the original session tab
- Observe: "Initialized your session" appears again as a new message in the conversation
Expected Behavior
The SessionStart hook should fire once when the session is created. Switching tabs and returning should not re-trigger it.
Actual Behavior
Every time you switch away from a tab and return, the SessionStart hook fires again, adding a duplicate "Initialized your session" message to the conversation. This happens repeatedly — each round-trip adds another hook message.
The session conversation history IS preserved (Claude remembers prior messages). Only the hook re-fires incorrectly.
Impact
- Extra hook output injected into context on every tab switch (wastes tokens)
- Confusing UX — appears as if the session restarted
- Hook side effects (if any) execute multiple times unintentionally
Environment
- Platform: Claude Code Desktop (macOS, Darwin 25.3.0)
- Model: Opus 4.6 (1M context)
- Note: Terminal CLI (
claude) does not exhibit this behavior since there is no tab switching
Additional Context
- Related but different from #10373 (SessionStart hooks not working for new conversations) — in this case the hook fires correctly on session creation but then re-fires on every tab switch back
- The root cause appears to be that Desktop rehydrates sessions when switching tabs using the same initialization path as creating a new session, which re-triggers the
SessionStarthook
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗