Skip to content

SyncHookJSONOutput

Base classes

Name Children Inherits
dict
builtins
dict() -> new empty dictionary

⋔ Inheritance diagram

graph TD
  2628884760["hooks.SyncHookJSONOutput"]
  2645524081["builtins.dict"]
  2751680898["builtins.object"]
  2645524081 --> 2628884760
  2751680898 --> 2645524081

🛈 DocStrings

Bases: TypedDict

Synchronous hook output with control and decision fields.

This defines the structure for hook callbacks to control execution and provide feedback to Claude.

Common Control Fields

continue_: Whether Claude should proceed after hook execution (default: True). Note: This is converted to "continue" when sent to the CLI. suppressOutput: Hide stdout from transcript mode (default: False). stopReason: Message shown when continue is False.

Decision Fields

decision: Set to "block" to indicate blocking behavior. systemMessage: Warning message displayed to the user. reason: Feedback message for Claude about the decision.

Hook-Specific Output

hookSpecificOutput: Event-specific controls (e.g., permissionDecision for PreToolUse, additionalContext for PostToolUse).

Note: The CLI documentation shows field names without underscores ("async", "continue"), but Python code should use the underscore versions ("async_", "continue_") as they are automatically converted.

Source code in src/clawd_code_sdk/models/hooks.py
class SyncHookJSONOutput(TypedDict):
    """Synchronous hook output with control and decision fields.

    This defines the structure for hook callbacks to control execution and provide
    feedback to Claude.

    Common Control Fields:
        continue_: Whether Claude should proceed after hook execution (default: True).
            Note: This is converted to "continue" when sent to the CLI.
        suppressOutput: Hide stdout from transcript mode (default: False).
        stopReason: Message shown when continue is False.

    Decision Fields:
        decision: Set to "block" to indicate blocking behavior.
        systemMessage: Warning message displayed to the user.
        reason: Feedback message for Claude about the decision.

    Hook-Specific Output:
        hookSpecificOutput: Event-specific controls (e.g., permissionDecision for
            PreToolUse, additionalContext for PostToolUse).

    Note: The CLI documentation shows field names without underscores ("async", "continue"),
    but Python code should use the underscore versions ("async_", "continue_") as they
    are automatically converted.
    """

    # Common control fields
    continue_: NotRequired[bool]  # Avoid name clash (converted to "continue" for CLI)
    suppressOutput: NotRequired[bool]
    stopReason: NotRequired[str]
    # Decision fields
    # Note: "approve" is deprecated for PreToolUse (use permissionDecision instead)
    # For other hooks, only "block" is meaningful
    decision: NotRequired[Literal["approve", "block"]]
    systemMessage: NotRequired[str]
    terminalSequence: NotRequired[str]
    reason: NotRequired[str]
    # Hook-specific outputs
    hookSpecificOutput: NotRequired[HookSpecificOutput]

:fa-brands-github: Show source on GitHub