{"version":"2.1.296","anchor":"set-model-gains-only-if-model-is-current-guard","canonical_anchor":"set-model-gains-only-if-model-is-current-guard","heading":"set_model gains an only_if_model_is_current guard for swapping the system prompt","tier":"use","area":"Agents","scope":"individual","heads_up":false,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.296\/e\/set-model-gains-only-if-model-is-current-guard","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.296","markdown":"### set_model gains an only_if_model_is_current guard for swapping the system prompt\n\nSDK set_model requests can swap the system prompt only if a named model is running, failing with model_not_current otherwise; Remote Control refuses it\n\n**What**\n\nPrograms that drive Claude Code through the SDK (the software development kit for building on top of Claude Code) can send a `set_model` request to change the model. That request now accepts an optional true-or-false field, `only_if_model_is_current`.\n\n- When `only_if_model_is_current` is true, the request does not switch models. `model` must name a specific model, and `system_prompt` is required.\n\n- If the session confirms it is running the named model, `system_prompt` replaces the session's custom system prompt.\n\n- If the session cannot confirm that, the request fails with the new error code `model_not_current` and changes nothing.\n\n- The field is marked internal and is documented as supported by `claude -p` and by claude-code-server workers.\n\n- Remote Control, which lets you drive a session from another device, refuses the field with the error \"set_model: Remote Control does not implement only_if_model_is_current. The request changed nothing.\" Before, Remote Control ignored it.\n\nThe same release also changes how a remote cloud session is created. The request no longer sends a `builtinTools` field, an environment check now runs before launch, and branch-name generation is skipped when `builtinTools` is not empty.\n\n**Why**\n\nA program can now replace the system prompt only while a known model is running, so a model change happening at the same moment cannot leave the wrong prompt on the wrong model. When the condition is not met, nothing changes and the error code says why. Programs talking to Remote Control get an explicit error instead of having the field silently ignored.\n\n- Area: Agents\n- Names: `set_model`, `only_if_model_is_current`\n- Tier: Use it now\n- Useful: 5\/5\n- Signal: 3\/5\n- Scope: individual\n- Heads-up: no"}