Skip to content

CLI Overview

Reference for the claude command-line interface — flags, subcommands, invocation modes, and env-var / settings.json equivalents.

  1. How CLI invocation works
  2. Subcommands
  3. Flag reference
  4. Invocation modes
  5. Environment-driven behavior
  6. Undocumented & internal flags
  7. Discrepancies & notes

7 sections, ~103 entries total — 20 subcommands + 61 documented flags (across 14 categories) + 15 undocumented/internal flags + 7 invocation modes.

#SectionDescriptionEntries
1How CLI invocation worksInvocation patterns (interactive REPL, one-shot, piped stdin, subcommands), flag conventions, and precedence rules.narrative
2Subcommandsclaude config, claude mcp, claude plugin, claude login/logout, claude doctor, claude update, etc.20 entries
3Flag referenceDetailed per-flag entries grouped by category (Model/Effort, Invocation, Session, Worktrees, Permissions, MCP, Plugins, Output, Debug, Help).61 flags / 14 categories
4Invocation modesInteractive REPL, one-shot prompt, piped stdin, session resume/continue, fork-session, remote/teleport, SDK entrypoints.7 entries
5Environment-driven behaviorCross-links to ENV/README.md for env vars that modify CLI behavior (entrypoint, config dir, provider selection, auth).narrative
6Undocumented & internal flagsFlags found in main.tsx with hidden: true or feature-gated that don’t appear in public docs.15 entries
7Discrepancies & notesPrecedence puzzles, mutual exclusivity, deprecated-but-accepted flags, and feature-gate surprises.narrative
FlagShortArgumentCategoryEnv varDescription
--add-dir<paths...>DirectoriesAdd additional working directories for Claude to read and edit files
--agent<name>Agent / ModelSpecify a subagent for the current session
--agents<json>Agent / ModelDefine custom subagents dynamically via JSON
--allow-dangerously-skip-permissionsPermissionsAdd bypassPermissions to the Shift+Tab mode cycle without starting in it
--allowedTools<tools...>PermissionsTools that execute without prompting for permission
--append-system-prompt<text>System PromptAppend custom text to the end of the default system prompt
--append-system-prompt-file<path>System PromptLoad additional system prompt text from a file and append
--bareInvocation ModeCLAUDE_CODE_SIMPLEMinimal mode: skip auto-discovery, hooks, plugins, MCP servers for faster startup
--betas<headers>Model / EffortBeta headers to include in API requests (API key users only)
--channels<servers...>MCPMCP servers whose channel notifications Claude should listen for (research preview)
--chromeTools & FeaturesEnable Chrome browser integration for web automation and testing
--continue-cInvocation ModeLoad the most recent conversation in the current directory
--dangerously-load-development-channels<servers...>MCPEnable non-approved channels for local channel development
--dangerously-skip-permissionsPermissionsSkip permission prompts (equivalent to --permission-mode bypassPermissions)
--debug[category]DebugCLAUDE_CODE_DEBUGEnable debug mode with optional category filtering
--debug-file<path>DebugCLAUDE_CODE_DEBUG_LOGS_DIRWrite debug logs to a specific file path
--disable-slash-commandsSkills & CommandsDisable all skills and commands for this session
--disallowedTools<tools...>PermissionsTools to remove from the model’s context and deny
--effort<level>Model / EffortSet effort level: low, medium, high, xhigh, max
--exclude-dynamic-system-prompt-sectionsSystem PromptMove per-machine sections into the first user message (improves prompt-cache reuse)
--fallback-model<model>Model / EffortAutomatic fallback to specified model when default is overloaded (print mode only)
--fork-sessionInvocation ModeCreate a new session ID instead of reusing the original (with --resume or --continue)
--from-pr<pr>Invocation ModeResume sessions linked to a specific GitHub PR
--ideTools & FeaturesAutomatically connect to IDE on startup if exactly one is available
--initInvocation ModeRun initialization hooks and start interactive mode
--init-onlyInvocation ModeRun initialization hooks and exit (no interactive session)
--include-hook-eventsOutputInclude all hook lifecycle events in the output stream
--include-partial-messagesOutputInclude partial streaming events in output
--input-format<format>OutputSpecify input format for print mode: text, stream-json
--json-schema<schema>OutputGet validated JSON output matching a JSON Schema (print mode only)
--maintenanceInvocation ModeRun maintenance hooks and start interactive mode
--max-budget-usd<amount>Model / EffortMaximum dollar amount to spend on API calls (print mode only)
--max-turns<count>Model / EffortLimit the number of agentic turns (print mode only)
--mcp-config<files...>MCPLoad MCP servers from JSON files or strings (space-separated)
--model<model>Model / EffortANTHROPIC_MODELSets the model: alias (sonnet, opus) or full model ID
--name-n<name>SessionSet a display name for the session
--no-chromeTools & FeaturesDisable Chrome browser integration for this session
--no-session-persistenceOutputDisable session persistence (print mode only)
--output-format<format>OutputSpecify output format: text, json, stream-json
--permission-mode<mode>PermissionsBegin in a specified permission mode: default, acceptEdits, plan, auto, dontAsk, bypassPermissions
--permission-prompt-tool<tool>PermissionsMCP tool to handle permission prompts in non-interactive mode
--plugin-dir<paths...>PluginsLoad plugins from a directory for this session only (repeatable)
--print-p[prompt]Invocation ModePrint response without interactive mode (Agent SDK mode)
--remote[description]RemoteCreate a new web session on claude.ai with the provided task description
--remote-control--rc[name]RemoteStart interactive session with Remote Control enabled (optionally named)
--remote-control-session-name-prefix<prefix>RemoteCLAUDE_REMOTE_CONTROL_SESSION_NAME_PREFIXPrefix for auto-generated Remote Control session names
--replay-user-messagesOutputRe-emit user messages from stdin back on stdout (requires stream-json I/O)
--resume-r<session>Invocation ModeResume a specific session by ID or name
--session-id<uuid>SessionUse a specific session ID for the conversation
--setting-sources<sources>SettingsComma-separated list of setting sources to load: user, project, local
--settings<file/json>SettingsPath to a settings JSON file or inline JSON string
--strict-mcp-configMCPOnly use MCP servers from --mcp-config, ignoring all other configurations
--system-prompt<text>System PromptReplace the entire system prompt with custom text
--system-prompt-file<path>System PromptLoad system prompt from a file, replacing the default
--teleport[session]RemoteResume a web session in your local terminal
--teammate-mode<mode>Agent / ModelSet how agent teammates display: auto, in-process, or tmux
--tmux[style]SessionCreate a tmux session for the worktree (requires --worktree)
--tools<tools>Tools & FeaturesRestrict which built-in tools Claude can use
--verboseDebugCLAUDE_CODE_VERBOSEEnable verbose logging showing full turn-by-turn output
--version-vHelpOutput the version number
--worktree-w[name]SessionCreate a new git worktree for this session (optionally name it)