Summary
TheInputs namespace contains classes for deserializing JSON data that Claude Code sends to hooks via stdin. Each hook event type has a corresponding input class.
Input Classes
| Class | Hook Event | Description |
|---|---|---|
PreToolUseHookInput<T> | PreToolUse | Received before a tool executes |
PostToolUseHookInput<T,R> | PostToolUse | Received after a tool completes |
PermissionRequestHookInput<T> | PermissionRequest | Received when permission is requested |
UserPromptSubmitHookInput | UserPromptSubmit | Received when user submits a prompt |
StopHookInput | Stop | Received when Claude finishes responding |
SubagentStopHookInput | SubagentStop | Received when a subagent completes |
NotificationHookInput | Notification | Received for notifications |
SessionStartHookInput | SessionStart | Received when a session starts |
SessionEndHookInput | SessionEnd | Received when a session ends |
PreCompactHookInput | PreCompact | Received before context compaction |
HookInputBase which provides common properties like SessionId, TranscriptPath, and CurrentWorkingDirectory.
Usage
Deserializing Hook Input
UseClaudeHooksSerializer to deserialize input from stdin:
Common Base Properties
All inputs include these properties fromHookInputBase:
SessionId- Unique session identifierTranscriptPath- Path to conversation transcriptCurrentWorkingDirectory- Active working directoryPermissionMode- Current permission modeHookEventName- The event that triggered this hook
Types
Classes
| Name | Summary |
|---|---|
| HookInputBase | Base class containing common fields present in all hook inputs. All hooks receive these fields via JSON through stdin. |
| ToolHookInputBase | Base class for tool-related hook inputs that contain tool name, input, and use ID. Used as a base for PreToolUse and PostToolUse hook inputs. |
| NotificationHookInput | Represents the input received by a Notification hook. This hook runs when Claude Code sends notifications. |
| PermissionRequestHookInput | Represents the input received by a PermissionRequest hook. This hook runs when a permission dialog is shown and can automatically allow or deny permissions. |
| PostToolUseHookInput | Represents the input received by a PostToolUse hook. This hook runs after tool calls complete and includes the tool’s response. |
| PreCompactHookInput | Represents the input received by a PreCompact hook. This hook runs before a compact operation. |
| PreToolUseHookInput | Represents the input received by a PreToolUse hook. This hook runs before tool calls are executed and can block or modify them. |
| SessionEndHookInput | Represents the input received by a SessionEnd hook. This hook runs when a Claude Code session ends. |
| SessionStartHookInput | Represents the input received by a SessionStart hook. This hook runs when Claude Code starts a new session or resumes one. |
| StopHookInput | Represents the input received by a Stop hook. This hook runs when Claude Code finishes responding. |
| SubagentStopHookInput | Represents the input received by a SubagentStop hook. This hook runs when subagent tasks complete. |
| UserPromptSubmitHookInput | Represents the input received by a UserPromptSubmit hook. This hook runs when the user submits a prompt, before Claude processes it. |