Source Intelligence

DisclaimerUnofficial, and not affiliated with Anthropic. Nearly all of this is read straight out of what ships: npm bundles, captured prompts, published docs. Anthropic's own notes go in verbatim, marked as theirs. The rest is my reading, and every entry carries the strings behind it. If one looks wrong, vote it down and say why.

All of v2.1.251 Home All releases olderv2.1.250
Claude Code v2.1.251

The /model menu and SDK flag changes wait on PreModelSwitch hooks

Use it now
Useful3 Signal3
Hooks

Model and effort changes from the picker now run hooks first and can be cancelled.

/model
What

Changing model or effort level from the /model menu now runs hooks first, showing a "Running PreModelSwitch hooks…" spinner. A block decision cancels the switch and shows the hook's reason; ask sends you to the confirmation dialog with that reason as the prompt. Any system messages the hook returns are appended to the resulting notice.

Details
  • The same pass runs when an SDK client changes model or agent through apply_flag_settings; anything other than proceed blocks the switch and reports back over the control channel.
  • If the session's model changes while the hooks are still running, the request is rejected with "agent switch not applied: the session's model changed while PreModelSwitch hooks ran; send the request again".
  • Only has an effect if a PreModelSwitch hook is configured.
Evidence

Running PreModelSwitch hooks…, agent switch not applied: the session's model changed while PreModelSwitch hooks ran; send the request again

Strings lifted out of the shipped bundle, so the claim above can be checked against them.

Related

Other releases about the same thing. Found by shared names or similar wording; neither means one caused the other.

See this entry in the whole of v2.1.251 →