Claude Code Hooks: Which Events Add Tokens and Which Reduce Them
The Claude Code hooks reference now documents 33 events, though most tutorials show only a handful of simple examples. Some hooks can raise token usage: stdout on UserPromptSubmit, UserPromptExpansion, SessionStart and PostModelSwitch is added to the conversation, and additionalContext stays there after it is inserted. Other hooks can cut tokens, such as updatedInput on PreToolUse, which rewrites a tool call before it runs, and updatedToolOutput on PostToolUse, which replaces a result before Claude reads it. Each injected string is capped at 10,000 characters, and hooks that fire on every tool call cost more than those that fire once per session. Several pitfalls, including exit code 1 not blocking and timed-out PreToolUse hooks letting calls through, can leave a hook silently ineffective.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in