Follow Discord
Sweep 22 Oct 2026 · 04:32Z Build v2.1.308 527 read Stable v2.1.308 Latest v2.1.308 Next v2.1.308 Feeds RSS JSON llms.txt llms-full.txt Unofficial

Claude Code v2.1.251 ·

New PreModelSwitch and PostModelSwitch hooks

New PreModelSwitch and PostModelSwitch hooks let you gate or annotate every model change.

Use it now Notable New Features
JSON All of v2.1.251
Use it nowTier: how much it should matter to you
5Useful: my rating, 1 to 5
4Signal: worth watching, 1 to 5
HooksArea: what it touches
New FeaturesKind: in v2.1.251,
What probably matters to youSection of the release
What

Two hook events now fire around model changes. PreModelSwitch runs before a switch from /model, the model picker, the SDK or a resume, and can allow, deny or ask via permissionDecision (or block with exit code 2); deny cancels the switch and ask prompts for confirmation, except in headless sessions where it refuses. PostModelSwitch runs after the model changes and can inject additionalContext that reaches the model on the next request.

Details
  • Registered in the hook schema, the /hooks help text and the plugin hook-name validator, with their own dispatch and timeout handling.
  • Switch telemetry reports from_model, to_model, requested_model, whether the prompt cache is still warm, cache_ttl, an estimated_cache_write_usd re-caching estimate, and a source field distinguishing command, picker, sdk, auto and resume switches.
Evidence

hookEventName: N("PreModelSwitch"), PreModelSwitch, `PreModelSwitch: [],

PostModelSwitch: [],, PreModelSwitch: fdt`

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

Read from
Since it was published

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.

Confirmed since Anthropic's documentation has since written up PostModelSwitch, on Hooks reference. | SessionStart, SubagentStart, PostModelSwitch | Context only | `hookSpecificOutput.additionalContext` adds context for Claude. SessionStart also accepts [`initialUserMessage`, `watchPaths`, `sessionTitle`, and `reloadSkills`](#sessionstar… hooks see the edit
Confirmed since Anthropic's documentation has since written up PreModelSwitch, on Hooks reference. | PreModelSwitch | `hookSpecificOutput` or top-level `decision` | `permissionDecision` (allow/deny/ask), `permissionDecisionReason`. `decision: "block"` also [cancels the switch](#premodelswitch-decision-control) | hooks see the edit
Confirmed since Anthropic's documentation has since written up additionalContext, on Hooks reference. | UserPromptSubmit, UserPromptExpansion, PostToolUse, PostToolUseFailure, PostToolBatch, Stop, SubagentStop, ConfigChange, PreCompact | Top-level `decision` | `decision: "block"`, `reason`. Stop and SubagentStop also accept `hookSpecificOu… hooks see the edit
Confirmed since Anthropic's documentation has since written up permissionDecision, on Hooks reference. In [non-interactive mode](/docs/en/headless) with the `-p` flag, Claude Code offers `AskUserQuestion` and `ExitPlanMode` only when the run has a [permission host](/docs/en/headless#turn-off-permission-prompts-in-unattended-runs) to receive… hooks see the edit
How sure we are
Two sources agreeTwo things we can check say the same as this entry.
Anthropic's documentation agreesAnthropic's documentation has since written up permissionDecision, on Hooks reference.
Anthropic's release notes agreeAdded PreModelSwitch and PostModelSwitch hook events (block, confirm, or annotate a model switch); SessionStart resume hooks now receive…

See this entry in the whole of v2.1.251 →

Feedback