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.
What
Code 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:
- The
sdk-cli,sdk-tsandsdk-pyentry points can now opt into code mode throughCLAUDE_CODE_EXPERIMENTAL_CODE_MODE. Before, only theclientry point was allowed and headless use was refused. - A launch check can still refuse, with reasons such as
unprefixed_tools,headless_providerandadmin_unread. - A refusal in headless mode now goes through a shared warning helper. In
stream-jsonoutput it is sent as a notification with the keycode-mode-opt-in. Before, a "Warning:" line went to the error output unless the format wasjsonorstream-json. - 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.
Why
Programs 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.
Something disagreesSomething we can check disagrees with this entry, or the writer said they could not settle it.
The writer flagged doubt
Whether `CLAUDE_CODE_EXPERIMENTAL_CODE_MODE` alone switches code mode on for SDK launches, and what it falls back to when unset, is not…