Unclear What value the variable must be set to is not stated.
A hook is a command you configure to run automatically at a set point. A UserPromptSubmit hook runs when a prompt is submitted, before Claude processes it. Claude Code can send messages saying when a hook starts (hook_started) and when it responds, but until now it did not send them for UserPromptSubmit hooks.
Setting the new environment variable CLAUDE_CODE_EMIT_USER_PROMPT_SUBMIT_HOOK_EVENTS turns these start and end messages on for UserPromptSubmit. Whether they are sent for other hook types is decided separately.
Claude Code reads the variable once when it starts and then removes it, so programs that Claude Code launches do not inherit it.
Programs that drive Claude Code and read its output stream, such as ones built with the Agent SDK, can now see when a UserPromptSubmit hook begins and ends, but only if they set this variable.
The entry above is what we published on the day. These lines were added later, as Anthropic's own pages caught up, and they sit beside the original rather than replacing it.
Of the [`hook_progress`](#sdkhookprogressmessage) messages a `SessionStart` or `Setup` hook emits before the handshake completes, you get only the newest, which carries all of the hook's output so far. `startup()` holds that message, the h…agent-sdk/typescript see the edit
What value the variable must be set to is not stated.
Anthropic's documentation has since written up hook_started, on Agent SDK reference - TypeScript.