Skip to main content

CLI Flags

Session management

FlagPurpose
--continueResume the most recent session
--resume [id]Resume a specific session by ID, or open a picker
--fork-sessionBranch off from a resumed session without modifying the original (use with --resume or --continue)
--from-pr [number]Start a session from a GitHub pull request
--session-id <uuid>Use a specific session ID (must be a valid UUID)

Model and effort

FlagPurpose
--model sonnetUse a specific model (aliases like sonnet, opus, or full model IDs)
--fallback-model <model>Automatic fallback when the primary model is overloaded (headless mode only)
--effort <level>Set reasoning depth: low, medium, or high
--max-budget-usd 5Set a spending cap for the session (headless mode only)
--max-turns 20Limit the number of agentic turns

Permissions and tool control

FlagPurpose
--permission-mode <mode>Permission mode: default, acceptEdits, plan, bypassPermissions, dontAsk
--allowedTools <tools>Allow specific tools (e.g. "Bash(git:*) Edit Read")
--disallowedTools <tools>Deny specific tools (e.g. "Bash(rm:*)")
--tools <tools>Restrict the available tool set entirely ("" to disable all, "default" for all)
--dangerously-skip-permissionsBypass all permission checks (sandboxed environments only)
warning

--dangerously-skip-permissions disables all safety prompts. Claude Code will read, write, and execute anything without asking. Only use this inside a fully sandboxed environment with no internet access and no access to sensitive data (e.g. a disposable Docker container or CI job). Never use it on your main development machine. Prefer scoped --allowedTools rules to grant exactly the access you need instead.

Headless and scripting

FlagPurpose
--print "prompt"Run a single prompt in headless mode (no interactive session)
--output-format <format>Output format with --print: text, json, or stream-json
--input-format <format>Input format with --print: text or stream-json
--json-schema <schema>Enforce structured output with a JSON Schema
--no-session-persistenceDo not save the session to disk (headless mode only)

System prompts

FlagPurpose
--system-prompt <prompt>Replace the default system prompt entirely
--append-system-prompt <prompt>Append instructions to the default system prompt

Agents and plugins

FlagPurpose
--agent <agent>Use a named agent for the session
--agents <json>Define custom agents inline as JSON
--plugin-dir <paths>Load plugins from directories for this session

MCP servers

FlagPurpose
--mcp-config <config>Load MCP servers from a JSON file or string
--strict-mcp-configOnly use MCP servers from --mcp-config, ignore all other config

Files and directories

FlagPurpose
--add-dir <directories>Grant tool access to directories outside the working directory
--worktree [name]Create a new git worktree for isolated work
--tmuxCreate a tmux session for the worktree (requires --worktree)

Debug

FlagPurpose
--debug [filter]Enable debug mode with optional category filtering (e.g. "api,hooks")
--verboseEnable verbose output

Environment variables

VariablePurpose
CLAUDE_CODE_EFFORT_LEVELSet effort level: high, medium, or low
MAX_THINKING_TOKENSControl how many tokens the model uses for reasoning