ClaudeCode.Hook.Output (ClaudeCode v0.36.3)

View Source

Top-level hook output struct returned to the CLI.

Wraps common fields (:continue, :decision, :stop_reason, etc.) and an optional :hook_specific_output carrying event-specific data.

Most hooks can use shorthand returns instead of building this struct directly:

# These are equivalent:
:ok
%Output{}

{:halt, stop_reason: "done"}
%Output{continue: false, stop_reason: "done"}

{:block, reason: "Rate limited"}
%Output{decision: "block", reason: "Rate limited"}

See ClaudeCode.Hook for the full shorthand reference.

Fields

  • :continue - whether the agent should keep running (false to halt)
  • :suppress_output - suppress the hook's output from the conversation
  • :stop_reason - reason string when halting
  • :decision - "block" to block a user prompt submission
  • :system_message - system message to inject into the conversation
  • :reason - human-readable reason for the decision
  • :hook_specific_output - event-specific output struct (e.g. PreToolUse, PostToolUse)

Summary

Types

decision()

@type decision() :: String.t()

hook_specific_output()

t()

@type t() :: %ClaudeCode.Hook.Output{
  continue: boolean() | nil,
  decision: decision() | nil,
  hook_specific_output: hook_specific_output() | nil,
  reason: String.t() | nil,
  stop_reason: String.t() | nil,
  suppress_output: boolean() | nil,
  system_message: String.t() | nil
}

Functions

to_wire(output)

@spec to_wire(struct()) :: map()