v0.18.0 | CC 2.1.37
Breaking
- SDK bundles its own CLI binary by default - The SDK now downloads and manages its own Claude CLI in
priv/bin/, auto-installing on first use. To use a globally installed CLI instead, setcli_path: :globalor pass an explicit path likecli_path: "/usr/local/bin/claude". The bundled version defaults to the latest CLI version tested with the SDK, configurable viacli_version. SeeClaudeCode.Optionsfor details.
# config.exs
config :claude_code, cli_path: :globalAdded
Control protocol
Runtime control of sessions without restarting. See Sessions — Runtime Control.
ClaudeCode.set_model/2- Change the model mid-conversation ([7ba2007])ClaudeCode.set_permission_mode/2- Change the permission mode mid-conversation ([7ba2007])ClaudeCode.get_mcp_status/1- Query MCP server connection status ([7ba2007])ClaudeCode.get_server_info/1- Get server info cached from handshake ([228c57f])ClaudeCode.rewind_files/2- Rewind files to a checkpoint. See File Checkpointing. ([7ba2007])- Returns
{:error, :not_supported}for adapters without control protocol support - Initialize handshake - Adapter sends
initializerequest on startup, transitions through:initializing→:ready. Agents are now delivered through the handshake (matching the Python SDK) instead of as a CLI flag. See Subagents. ([228c57f], [2a4473b])
New options
:sandbox- Sandbox config for bash isolation (map merged into--settings). See Secure Deployment. ([5f48858]):enable_file_checkpointing- Track file changes for rewinding. See File Checkpointing. ([5f48858]):allow_dangerously_skip_permissions- Required guard forpermission_mode: :bypass_permissions. See Permissions. ([c9dc6fa]):file- File resources (repeatable, format:file_id:path) ([d6c1869]):from_pr- Resume session linked to a PR ([d6c1869]):debug/:debug_file- Debug mode with optional filter and log file ([d6c1869])
Adapter system
Swappable backends for different execution environments.
ClaudeCode.Adapterbehaviour - 4 callbacks:start_link/2,send_query/4,health/1,stop/1([1582644])- Adapter notification helpers -
notify_message/2,notify_done/2,notify_error/2,notify_status/2([1704326]) ClaudeCode.health/1- Check adapter health (:healthy|:degraded|{:unhealthy, reason}). See Hosting. ([383dda6])
CLI management
mix claude_code.install- Install the bundled CLI binary, auto-updating on version mismatch. ([6e7c837])mix claude_code.path- Print resolved binary path, e.g.$(mix claude_code.path) /login([94b5143])mix claude_code.uninstall- Remove the bundled CLI binary ([6e7c837])
Changed
:cli_pathresolution modes -:bundled(default),:global, or explicit path string. SeeClaudeCode.Options. ([94b5143])- Async adapter provisioning -
start_link/1returns immediately; CLI setup runs in the background. Queries queue until ready. ([f1a0875], [91ee60d], [6a60eb4]) - Schema alignment with CLI v2.1.37 - New fields across message types ([482c603], [42b6c27])
AssistantMessage.error(:authentication_failed,:billing_error,:rate_limit,:invalid_request,:server_error,:unknown)UserMessage.tool_use_result,ResultMessage.stop_reason,AssistantMessageusageinference_geoSystemMessagehandles all subtypes (init, hook_started, hook_response);pluginssupports object format