Zum Hauptinhalt springen

CLI Flags

Session management

FlagPurpose
--continueResume the most recent session
--resume [id]Resume a specific session by ID, or open a picker
-n <name> / --name <name>Name the session for easy retrieval later (e.g. claude -n auth-refactor)
--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
--teleportPull a session started on the web or iOS app into the local terminal
--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, high, xhigh, or max. Available levels depend on the model.
--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, auto, dontAsk, bypassPermissions
--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). Equivalent to --permission-mode bypassPermissions
--allow-dangerously-skip-permissionsAdd bypassPermissions to the Shift+Tab mode cycle without starting in it
warnung

--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)
--bareMinimal mode: skip auto-discovery of hooks, skills, plugins, MCP servers, auto memory, and CLAUDE.md. Faster starts for scripted calls.

Background agents

FlagPurpose
--bgStart the session as a background agent and return immediately. Prints the session ID and management commands.
--execRun a shell command as a background job instead of starting a Claude session. Use with --bg.

System prompts

FlagPurpose
--system-prompt <prompt>Replace the default system prompt entirely
--system-prompt-file <path>Replace the default system prompt with contents of a file
--append-system-prompt <prompt>Append instructions to the default system prompt
--append-system-prompt-file <path>Append file contents to the default system prompt

--system-prompt and --system-prompt-file are mutually exclusive. Append flags can be combined with either replacement flag. Use an append flag to preserve Claude's default coding assistant identity while adding extra rules; use a replacement flag when the identity or permission model differs from Claude Code's defaults.

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 or .zip archives for this session
--plugin-url <urls>Load a plugin from a hosted .zip URL for this session
--teammate-mode <mode>Set Agent Teams display mode: auto, tmux, or in-process

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: low, medium, high, xhigh, or max
MAX_THINKING_TOKENSControl how many tokens the model uses for reasoning (set to 0 to disable thinking)
CLAUDE_CODE_DISABLE_ADAPTIVE_THINKINGSet to 1 to revert to a fixed thinking token budget instead of adaptive reasoning (applies to Sonnet 4.6 and Opus 4.6 only)
CLAUDE_CODE_DISABLE_AUTO_MEMORYSet to 1 to disable auto memory globally
ANTHROPIC_MODELOverride the default model for all sessions