Skip to content
BENIBIX Learn

--include-hook-events Flag

Also known as claude --include-hook-events, Hook events in the stream

It adds hook events to the output stream.

Think of it like

It is like a list that shows when each helper starts and ends their part.

Example

Emma's hook blocks some commands, and her CI run fails without saying why. With --include-hook-events, the stream shows the hook that said no.

Why it matters

When a hook changes what Claude does, the stream is where a script can see it.

Definition

--include-hook-events adds events about hooks to the output stream: when a hook starts, what it prints, and how it ends. Events from SessionStart and Setup hooks show up even without it. It needs --output-format stream-json. A program uses it to see what your hooks did during a run.

Example code

bash
claude -p --output-format stream-json --verbose --include-hook-events "Run the tests"
See each hook start and finish.
This flag adds the hook lines to the stream.

Common mistake

Expecting a start event for each hook. Some never send one, even with this flag. Notification and SessionEnd are two.

Key takeaways

  1. 1
    Start, output, end. For each hook.
  2. 2
    Some always shown. SessionStart, Setup.
  3. 3
    Not every hook. Sends a start event.

Learn it properly