{"name":"PreModelSwitch","slug":"premodelswitch","family":"hook","title":"Hook events","noun":"hook event","description":"Before Claude Code applies a model switch that you or a client requested. Can block the switch","description_source":"docs","described_by":{"doc":"claude-code\/hooks","title":"Hooks reference"},"presence":{"first_seen":null,"removed_in":null,"in_current_build":false,"newest_mined":"2.1.322","builds":0,"mined_builds":161,"first_cited":{"version":"2.1.251","released_at":"2026-08-28 15:34:26","spans":14}},"aliases":[],"entries":[{"version":"2.1.307","anchor":"model-switch-control-response-now-returns-the-resulting-mode","heading":"Changing the model from a program now reports the model that applies","line":"When a program changes Claude Code's model, the reply now names the model in use, and the wait message mentions the `PreModelSwitch` hook","released_at":"2026-10-21 20:47:18","reason":"found in this entry's text"},{"version":"2.1.302","anchor":"model-switch-ui-and-permission-relay-refactors","heading":"Tools run remotely can use a location already checked by the remote runner","line":"When a session runs a tool remotely, Claude Code can now use a location the remote runner has already checked","released_at":"2026-10-16 16:48:28","reason":"found in this entry's text"},{"version":"2.1.295","anchor":"new-claude-code-restrict-personal-config-mode-limits-what-a","heading":"A new setting limits what your own skills, agents and hooks can do","line":"Setting CLAUDE_CODE_RESTRICT_PERSONAL_CONFIG stops your own skills, agents and hooks from widening permissions, and makes key hooks required","released_at":"2026-10-08 18:22:58","reason":"found in this entry's text"},{"version":"2.1.295","anchor":"fast-mode-toggle-wrapped-for-remote-sessions-with-pre-switch","heading":"Switching fast mode can now run hooks and wait for the workspace","line":"Turning fast mode on or off now goes through a step that can run PreModelSwitch hooks and show \"Waiting for the workspace\u2026\"","released_at":"2026-10-08 18:22:58","reason":"found in this entry's text, named in this entry"},{"version":"2.1.284","anchor":"hooks-from-a-remote-machine-plugin-fail-cleanly-when-that-ma","heading":"Hooks from a plugin on an unavailable machine now fail with a clear message","line":"Hooks from a plugin that runs on another machine now report that the machine is unavailable, instead of failing with an unexplained error","released_at":"2026-09-28 17:11:59","reason":"found in this entry's text"},{"version":"2.1.260","anchor":"premodelswitchpostmodelswitch-hook-load-failures-now-give-m","heading":"PreModelSwitch\/PostModelSwitch hook-load failures now give more actionable errors","line":"Failed model-switch hook loads now give a specific, actionable error message.","released_at":"2026-09-03 22:32:02","reason":"found in this entry's text, named in this entry"},{"version":"2.1.251","anchor":"new-premodelswitch-and-postmodelswitch-hooks","heading":"New PreModelSwitch and PostModelSwitch hooks","line":"New PreModelSwitch and PostModelSwitch hooks let you gate or annotate every model change.","released_at":"2026-08-28 15:34:26","reason":"named in this entry, found in this entry's text"},{"version":"2.1.251","anchor":"model-switches-can-be-blocked-or-held-for-confirmation-by-a-","heading":"\/model switches can be blocked or held for confirmation by a hook","line":"A PreModelSwitch hook can block or hold your \/model change for confirmation.","released_at":"2026-08-28 15:34:26","reason":"named in this entry, found in this entry's text"},{"version":"2.1.251","anchor":"fast-mode-now-vets-the-model-change-through-a-hook-before-ap","heading":"Fast mode now vets the model change through a hook before applying","line":"Turning Fast mode on now runs your model-switch hook and can be refused.","released_at":"2026-08-28 15:34:26","reason":"found in this entry's text"},{"version":"2.1.251","anchor":"the-model-menu-and-sdk-flag-changes-wait-on-premodelswitch-h","heading":"The \/model menu and SDK flag changes wait on PreModelSwitch hooks","line":"Model and effort changes from the picker now run hooks first and can be cancelled.","released_at":"2026-08-28 15:34:26","reason":"found in this entry's text"}],"entries_total":13,"docs":[{"source":"claude-code","path":"hooks","title":"Hooks reference","documented":true},{"source":"claude-code","path":"agent-sdk\/hooks","title":"Intercept and control agent behavior with hooks","documented":true},{"source":"claude-code","path":"agent-sdk\/typescript","title":"Agent SDK reference - TypeScript","documented":false},{"source":"claude-code","path":"errors","title":"Error reference","documented":false},{"source":"claude-code","path":"hooks-guide","title":"Automate actions with hooks","documented":false},{"source":"claude-code","path":"model-config","title":"Model configuration","documented":false},{"source":"claude-code","path":"prompt-caching","title":"How Claude Code uses prompt caching","documented":false}],"docs_total":7,"gates":[],"related":[],"url":"https:\/\/changelogs.core-directive.com\/reference\/hook\/premodelswitch","family_url":"https:\/\/changelogs.core-directive.com\/reference\/hook.json"}