[BUG] SessionStart hook not invoked when prompt contains @ folder/file references
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When the opening prompt includes @folder or @file context references, the SessionStart hook does not fire. Without @ references, the hook works correctly. Suspected cause: @ reference resolution runs in a preprocessing path that doesn't raise the session-start event.
What Should Happen?
session start hook should still be invoked irrespective of what character user prompt has
Error Messages/Logs
Steps to Reproduce
- Add a SessionStart hook to .claude/settings.json:
{
"hooks": {
"SessionStart": [
{
"hooks": [
{ "type": "command", "command": "echo 'hook fired' >> /tmp/hook-test.log" }
]
}
]
}
}
- Start a new Claude Code session with an opening prompt that includes an @ reference:
@src/components can you help me onboard my library
→ Check /tmp/hook-test.log — hook does not fire
- Start another new session with the same prompt but without the @ reference:
can you help me onboard my library
→ Check /tmp/hook-test.log — hook fires
Expected: Hook fires in both cases.
Actual: Hook is skipped when @ references are present.
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.233
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_