{"version":"2.1.330","anchor":"code-mode-headless-launch-decision-logic-added","canonical_anchor":"code-mode-headless-launch-decision-logic-added","heading":"Experimental code mode can now be opted into from SDK and headless launches","tier":"notice","area":"SDK","scope":"individual","heads_up":false,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.330\/e\/code-mode-headless-launch-decision-logic-added","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.330","markdown":"### Experimental code mode can now be opted into from SDK and headless launches\n\nSDK launches can opt into experimental code mode through CLAUDE_CODE_EXPERIMENTAL_CODE_MODE, and refusals now arrive as JSON notifications\n\n**Unclear.** Whether `CLAUDE_CODE_EXPERIMENTAL_CODE_MODE` alone switches code mode on for SDK launches, and what it falls back to when unset, is not stated.\n\n**What**\n\nCode mode is an experimental way of running Claude Code. Headless mode means Claude Code runs without an interactive screen, often driven by another program through the SDK (a library for building on Claude Code). The rules for using code mode this way have changed:\n\n- The `sdk-cli`, `sdk-ts` and `sdk-py` entry points can now opt into code mode through `CLAUDE_CODE_EXPERIMENTAL_CODE_MODE`. Before, only the `cli` entry point was allowed and headless use was refused.\n\n- A launch check can still refuse, with reasons such as `unprefixed_tools`, `headless_provider` and `admin_unread`.\n\n- A refusal in headless mode now goes through a shared warning helper. In `stream-json` output it is sent as a notification with the key `code-mode-opt-in`. Before, a \"Warning:\" line went to the error output unless the format was `json` or `stream-json`.\n\n- Interactive startup now runs a new permission check after the onboarding screens. It can change the permission mode, which sets how freely Claude may act without asking, and then reload MCP server settings.\n\n**Why**\n\nPrograms built on the SDK can now try code mode. If they read `stream-json` output, they can see why code mode was refused instead of missing a warning.\n\n- Area: SDK\n- Tier: You'll notice\n- Useful: 4\/5\n- Signal: 3\/5\n- Scope: individual\n- Heads-up: no"}