Skip to content

CLI Startup Flags Best Practice

Reference for Claude Code startup flags, top-level subcommands, and startup environment variables when launching Claude Code from the terminal.

Session Management

FlagShortDescription
--continue-cContinue the most recent conversation in the current directory
--resume-rResume a specific session by ID or name, or show interactive picker
--from-pr <NUMBER|URL>Resume sessions linked to a specific GitHub PR
--fork-sessionCreate a new session ID when resuming (use with --resume or --continue)
--session-id <UUID>Use a specific session ID (must be valid UUID)
--no-session-persistenceDisable session persistence (print mode only)
--remoteCreate a new web session on claude.ai
--teleportResume a web session in your local terminal

Model & Configuration

FlagShortDescription
--model <NAME>Set model with alias (sonnet, opus, haiku) or full model ID
--fallback-model <NAME>Auto-fallback model when default is overloaded (print mode only)
--betas <LIST>Beta headers to include in API requests (API key users only)

Permissions & Security

FlagShortDescription
--dangerously-skip-permissionsSkip ALL permission prompts. Use with extreme caution
--allow-dangerously-skip-permissionsEnable permission bypassing as an option without activating it
--permission-mode <MODE>Begin in specified permission mode: default, plan, acceptEdits, bypassPermissions
--allowedTools <TOOLS>Tools that execute without prompting (permission rule syntax)
--disallowedTools <TOOLS>Tools removed from model context entirely
--tools <TOOLS>Restrict which built-in tools Claude can use (use "" to disable all)
--permission-prompt-tool <TOOL>Specify MCP tool to handle permission prompts in non-interactive mode

WARNING

The --dangerously-skip-permissions flag bypasses all safety prompts. Only use this in trusted, sandboxed environments such as CI pipelines or Docker containers.

Output & Format

FlagShortDescription
--print-pPrint response without interactive mode (headless/SDK mode)
--output-format <FORMAT>Output format: text, json, stream-json
--input-format <FORMAT>Input format: text, stream-json
--json-schema <SCHEMA>Get validated JSON matching schema (print mode only)
--include-partial-messagesInclude partial streaming events (requires --print and --output-format=stream-json)
--verboseEnable verbose logging with full turn-by-turn output

System Prompt

FlagShortDescription
--system-prompt <TEXT>Replace entire system prompt with custom text
--system-prompt-file <PATH>Load system prompt from file, replacing default (print mode only)
--append-system-prompt <TEXT>Append custom text to default system prompt
--append-system-prompt-file <PATH>Append file contents to default prompt (print mode only)

Agent & Subagent

FlagShortDescription
--agent <NAME>Specify an agent for the current session
--agents <JSON>Define custom subagents dynamically via JSON
--teammate-mode <MODE>Set agent team display: auto, in-process, tmux

MCP & Plugins

FlagShortDescription
--mcp-config <PATH|JSON>Load MCP servers from JSON file or string
--strict-mcp-configOnly use MCP servers from --mcp-config, ignore all others
--plugin-dir <PATH>Load plugins from directory for this session only (repeatable)

Directory & Workspace

FlagShortDescription
--add-dir <PATH>Add additional working directories for Claude to access
--worktree-wStart Claude in an isolated git worktree (branched from HEAD)

Budget & Limits

FlagShortDescription
--max-budget-usd <AMOUNT>Maximum dollar amount for API calls before stopping (print mode only)
--max-turns <NUMBER>Limit number of agentic turns (print mode only)

Integration

FlagShortDescription
--chromeEnable Chrome browser integration for web automation
--no-chromeDisable Chrome browser integration for this session
--ideAutomatically connect to IDE on startup if exactly one valid IDE available

Initialization & Maintenance

FlagShortDescription
--initRun initialization hooks and start interactive mode
--init-onlyRun initialization hooks and exit (no interactive session)
--maintenanceRun maintenance hooks and exit

Debug & Diagnostics

FlagShortDescription
--debug <CATEGORIES>Enable debug mode with optional category filtering (e.g., "api,hooks")

Settings Override

FlagShortDescription
--settings <PATH|JSON>Path to settings JSON file or JSON string to load
--setting-sources <LIST>Comma-separated list of sources to load: user, project, local
--disable-slash-commandsDisable all skills and slash commands for this session

Version & Help

FlagShortDescription
--version-vOutput the version number
--help-hShow help information

Subcommands

These are top-level commands run as claude <subcommand>:

SubcommandDescription
claudeStart interactive REPL
claude "query"Start REPL with initial prompt
claude agentsList configured agents
claude authManage Claude Code authentication
claude doctorRun diagnostics from the command line
claude installInstall or switch Claude Code native builds
claude mcpConfigure MCP servers (add, remove, list, get, enable)
claude pluginManage Claude Code plugins
claude remote-controlManage remote control sessions
claude setup-tokenCreate a long-lived token for subscription usage
claude update / claude upgradeUpdate to the latest version

Environment Variables

These startup-only environment variables are set in your shell before launching Claude Code (they cannot be configured via settings.json):

VariableDescription
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1Enable experimental agent teams
CLAUDE_CODE_TMPDIROverride temp directory for internal files. Also configurable via env key in settings
CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1Enable additional directory CLAUDE.md loading
DISABLE_AUTOUPDATER=1Disable auto-updates
CLAUDE_CODE_EFFORT_LEVELControl thinking depth
USE_BUILTIN_RIPGREP=0Use system ripgrep instead of built-in (Alpine Linux)
CLAUDE_CODE_SIMPLEEnable simple mode (Bash + Edit tools only). Also configurable via env key in settings
CLAUDE_BASH_NO_LOGIN=1Skip login shell for BashTool

Additional Environment Variables

For environment variables configurable via the "env" key in settings.json (including MAX_THINKING_TOKENS, CLAUDE_CODE_SHELL, CLAUDE_CODE_ENABLE_TASKS, CLAUDE_CODE_DISABLE_BACKGROUND_TASKS, CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS, and more), see the Claude Settings Reference.

Sources