How to make Claude Code's claude -p start in auto mode on third-party providers or with telemetry off
Starting with Claude Code 2.1.302 (October 16), claude -p and Agent SDK sessions that don't set a permission mode start in default mode in three situations: on a third-party provider such as Amazon Bedrock or Vertex AI, with telemetry off via DISABLE_TELEMETRY, DO_NOT_TRACK, DISABLE_GROWTHBOOK or CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC, and in the first session after a fresh install. From 2.1.285 through 2.1.301 those sessions started in auto, so a script or CI job that used to run without prompts can get stuck waiting for approval after the update.
- Pin the mode with a flag for non-interactive runs.
claude -p "fix the failing tests" --permission-mode auto
- If you don't want the flag every time, set the default mode in your user settings (
~/.claude/settings.json). For a whole organization, put the same value in managed settings.
{
"permissions": {
"defaultMode": "auto"
}
}
- In the Agent SDK, pass it as a query option:
permissionMode: "auto"in TypeScript,permission_mode="auto"in Python.
Auto mode only turns on with a supported model. If any settings file sets disableAutoMode to "disable", the session starts in default even with --permission-mode auto. The official docs' "Which mode a session starts in" table still reflects 2.1.285 and lists third-party and telemetry-off sessions as auto; for 2.1.302 and later, the changelog is the current behavior.
Sources
Get notified when a new tip lands
Tip alerts only go out in the app. Install it and turn notifications on.