SessionStart API
October 13, 2025 ยท View on GitHub
Available when inheriting from ClaudeHooks::SessionStart:
Input Helpers
Input helpers to access the data provided by Claude Code through STDIN.
| Method | Description |
|---|---|
source | Get the session start source: 'startup', 'resume', 'clear', or 'compact' |
Hook State Helpers
Hook state methods are helpers to modify the hook's internal state (output_data) before yielding back to Claude Code.
๐ Shared hook state methods
| Method | Description |
|---|---|
add_additional_context!(context) | Add contextual information for Claude's session |
add_context!(context) | Alias for add_additional_context! |
empty_additional_context! | Clear additional context |
Output Helpers
Output helpers provide access to the hook's output data and helper methods for working with the output state.
| Method | Description |
|---|---|
output.additional_context | Get the additional context that was added |
Hook Exit Codes
| Exit Code | Behavior |
|---|---|
exit 0 | Operation continuesSTDOUT added as context to Claude |
exit 1 | Non-blocking errorSTDERR shown to user |
exit 2 | N/ASTDERR shown to user only |