[DOCS] Hooks reference missing `hookSpecificOutput.sessionTitle` for `UserPromptSubmit`
Documentation Type
Incorrect/outdated documentation
Documentation Location
https://code.claude.com/docs/en/hooks
Section/Topic
UserPromptSubmit decision control / advanced JSON output
Current Documentation
The docs currently say:
UserPromptSubmithooks can control whether a user prompt is processed and add context. All [JSON output fields](#json-output) are available. There are two ways to add context to the conversation on exit code 0: Plain text stdout: any non-JSON text written to stdout is added as context JSON withadditionalContext: use the JSON format below for more control. TheadditionalContextfield is added as context
The guide currently says:
ForUserPromptSubmithooks, useadditionalContextinstead to inject text into Claude's context.
The Agent SDK type reference currently shows only additionalContext for UserPromptSubmit output:
class UserPromptSubmitHookSpecificOutput(TypedDict):hookEventName: Literal["UserPromptSubmit"]additionalContext: NotRequired[str]
What's Wrong or Missing?
Changelog v2.1.94 added hookSpecificOutput.sessionTitle to UserPromptSubmit hooks for setting the session title, but the current docs still present additionalContext as the only documented UserPromptSubmit-specific output. There is no documented field name, schema entry, JSON example, or behavior guidance for setting a session title from a hook, and the Agent SDK type definitions are stale for the same reason.
Suggested Improvement
Update the UserPromptSubmit hook docs everywhere the output schema is described:
- Add
hookSpecificOutput.sessionTitleto the field table and JSON examples on https://code.claude.com/docs/en/hooks - Update https://code.claude.com/docs/en/hooks-guide so it no longer implies
additionalContextis the onlyUserPromptSubmit-specific output - Add
sessionTitleto the Python and TypeScript Agent SDKUserPromptSubmitoutput types and related hook overview tables - Document how hook-set titles interact with existing naming mechanisms such as
--name,/rename, and auto-generated titles
For example, the hooks reference should include a UserPromptSubmit example like:
{
"hookSpecificOutput": {
"hookEventName": "UserPromptSubmit",
"sessionTitle": "auth-refactor"
}
}
Impact
Medium - Makes feature difficult to understand
Additional Context
Affected Pages:
| Page | Line(s) | Context |
|------|---------|---------|
| https://code.claude.com/docs/en/hooks | 820-845 | UserPromptSubmit decision control documents additionalContext but not sessionTitle |
| https://code.claude.com/docs/en/hooks-guide | 503-505 | Guide says to use additionalContext for UserPromptSubmit hooks |
| https://platform.claude.com/docs/en/agent-sdk/hooks | 143-149 | Hook summary describes UserPromptSubmit as injecting additional context into prompts |
| https://platform.claude.com/docs/en/agent-sdk/python | 2087-2089 | UserPromptSubmitHookSpecificOutput omits sessionTitle |
| https://platform.claude.com/docs/en/agent-sdk/typescript | 1221-1224 | UserPromptSubmit hook output union omits sessionTitle |
| https://platform.claude.com/docs/en/agent-sdk/agent-loop | 287-292 | Hook summary only mentions injecting additional context |
Total scope: 6 pages affected
Source: Changelog v2.1.94
Changelog entry: Added hookSpecificOutput.sessionTitle to UserPromptSubmit hooks for setting the session title
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗