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.

๐Ÿ“š Shared input helpers

MethodDescription
sourceGet 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

MethodDescription
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.

๐Ÿ“š Shared output helpers

MethodDescription
output.additional_contextGet the additional context that was added

Hook Exit Codes

Exit CodeBehavior
exit 0Operation continues
STDOUT added as context to Claude
exit 1Non-blocking error
STDERR shown to user
exit 2N/A
STDERR shown to user only