AI News
All stories
Official

Claude Code 2.1.328 changes hook behaviour in Code Mode and managed PostToolUse hooks

The 2.1.328 changelog stops Code Mode running UserPromptSubmit hooks on script output and stops managed PostToolUse hooks firing for refused calls.

Products · · 2 min read

Anthropic's Claude Code 2.1.328 changelog changes two hook behaviours that matter to anyone who uses hooks to log, redact or gate tool calls. Code Mode no longer runs UserPromptSubmit hooks on the output of scripts. Managed PostToolUse hooks no longer fire for calls that are refused before they run. The release notes also add a new failure option for MCP tool hooks, but the two removals are the changes that can quietly break existing setups.

The Code Mode change is the more direct one. Code Mode lets Claude run scripts that call tools. Until this release, UserPromptSubmit hooks, including managed ones, ran on what those scripts printed. The changelog now says they don't. Anyone who relied on that path to screen or redact script output has to move the job. The changelog recommends a PostToolUse hook that uses updatedToolOutput to rewrite the tool's output.

The second change concerns refusals. Managed PostToolUse hooks are where a log entry, rewrite, block or stop can happen. The changelog says that for calls refused before they ran, managed PostToolUse hooks no longer fire at all, so none of those actions happen there. The PostToolBatch hook receives most of these events, but the entry says it does not mark them as refused. A team that logs refused calls through PostToolUse will need to account for that gap.

The new onFailure option works in the opposite direction. The release adds "onFailure": "block" for mcp_tool hooks, so that a hook whose call fails blocks the action, the same behaviour command and HTTP hooks already have. For a team that wants a failed external check to stop an action rather than let it through, this is the relevant addition.

The release is long. Many of its 91 bug fixes and 19 improvements concern Code Mode, remote sessions, the terminal and self-hosted runners. Among the Code Mode fixes is one that addresses Claude not being told that a Code Mode script was cut off when a session was resumed from the picker or in a mode that asks for permission. Those fixes don't bear on the hook changes. Anyone running managed hooks alongside Code Mode should read the two hook entries together, because the redaction path moves and the refusal path narrows in the same release.

What changed

Code Mode no longer runs UserPromptSubmit hooks on script output, and managed PostToolUse hooks no longer fire for calls refused before they run.

Type: Breaking change · Applies to: Claude Code 2.1.328, Code Mode, UserPromptSubmit hooks, managed PostToolUse hooks, PostToolBatch hook, mcp_tool hooks

Why it matters

Companies that use hooks for logging, redaction or policy enforcement may find that some events no longer reach them. Gaps in audit or redaction could go unnoticed unless the hook setup is checked.

What you can do

Teams with managed or custom hooks should test their logging and redaction against version 2.1.328 before rolling it out.

Original source

Where we saw it

1 source

Claude Code changelog

AI wrote this summary from the sources listed, and nobody reviewed it individually before publication. Check the original source before you rely on it. How it works