Skip to main content
Run claude [prompt] to start an interactive session, or combine flags to control behavior. Use -p / --print for non-interactive (pipe-friendly) output.
claude [prompt] [flags]
Flags marked print-only only take effect when --print (-p) is also passed. Using them in interactive mode has no effect.

General

Type: booleanDisplay help for the command and exit.
claude --help
Type: booleanPrint the response to stdout and exit instead of starting an interactive session. Useful for pipes and scripts.
claude -p "Summarize this file" < README.md
The workspace trust dialog is skipped in --print mode. Only use this flag in directories you trust.
Type: booleanOverride the verbose mode setting from config. Enables extra output including tool inputs and outputs.
claude --verbose -p "List files in src/"
Type: boolean or stringEnable debug logging. Pass an optional comma-separated filter to restrict which categories are logged.
# All debug output
claude --debug

# Only API and hooks categories
claude --debug "api,hooks"

# Everything except 1p and file categories
claude --debug "!1p,!file"
Type: stringWrite debug logs to a file instead of (or in addition to) the terminal. Implicitly enables debug mode.
claude --debug-file /tmp/claude-debug.log
Type: booleanMinimal startup mode. Disables hooks, LSP, plugin sync, commit attribution, auto-memory, background prefetches, keychain reads, and CLAUDE.md auto-discovery. Sets CLAUDE_CODE_SIMPLE=1.In --bare mode:
  • Anthropic auth is strictly ANTHROPIC_API_KEY or apiKeyHelper via --settings. OAuth and keychain are never read.
  • Third-party providers (Bedrock, Vertex, Foundry) use their own credentials as normal.
  • Skills still resolve via /skill-name.
Provide context explicitly using: --system-prompt, --append-system-prompt, --add-dir, --mcp-config, --settings, --agents, --plugin-dir.
claude --bare --settings settings.json -p "Review this code"

Session control

Type: booleanContinue the most recent conversation in the current working directory.
claude -c
claude -c -p "Keep going"
Type: boolean or stringResume a conversation. Pass a session UUID to jump directly to that session, a search term to pre-filter the picker, or omit the value to open the interactive picker.
# Open picker
claude --resume

# Filter picker
claude -r "my-feature"

# Jump directly to session
claude -r 550e8400-e29b-41d4-a716-446655440000
Type: booleanWhen used with --resume or --continue, creates a new forked session from that point instead of continuing the original. Combine with --session-id to specify the ID of the new fork.
claude --resume --fork-session
Type: boolean or stringResume a session linked to a GitHub PR. Pass a PR number or URL to jump directly, or omit to open the interactive picker.
claude --from-pr 123
claude --from-pr https://github.com/owner/repo/pull/123
Type: stringAssign a specific UUID to the new session. Must be a valid UUID and must not already be in use.
claude --session-id 550e8400-e29b-41d4-a716-446655440000
When used with --resume or --continue, requires --fork-session to be present.
Type: stringSet a display name for the session. Shown in /resume and in the terminal title bar.
claude -n "refactor-auth-module"
Type: boolean (print-only)Disable session persistence. The session will not be saved to disk and cannot be resumed.
claude -p --no-session-persistence "One-shot task"

Model and compute

Type: stringSet the model for the session. Accepts an alias for the latest model version (sonnet, opus) or a full model name (claude-sonnet-4-6).
claude --model sonnet
claude --model claude-opus-4-6
Type: string — one of low, medium, high, maxSet the reasoning effort level for the session.
claude --effort high -p "Analyze this architecture"
Type: stringOverride the agent setting for this session. Selects which agent definition to use.
claude --agent reviewer
Type: string (JSON)Inline agent definitions as a JSON object. Each key is the agent name; the value is an object with description and prompt.
claude --agents '{"reviewer": {"description": "Reviews code", "prompt": "You are a code reviewer"}}'
Type: string (print-only)Enable automatic fallback to the specified model when the primary model is overloaded.
claude --model opus --fallback-model sonnet -p "Analyze this"
Type: string list (API key users only)Pass beta feature headers to include in API requests.
claude --betas interleaved-thinking-2025-05-14

Output format

Type: string — one of text, json, stream-json (print-only)Control the output format when running in --print mode.
ValueDescription
textPlain text (default)
jsonSingle JSON object with the complete result
stream-jsonNewline-delimited JSON events streamed in real time
claude -p --output-format json "List the top 3 issues"
claude -p --output-format stream-json "Implement the feature"
Type: string — one of text, stream-json (print-only)Control how stdin is interpreted when running in --print mode.
ValueDescription
textPlain text (default)
stream-jsonNewline-delimited JSON event stream
cat events.ndjson | claude -p --input-format stream-json --output-format stream-json ""
Type: boolean (requires --output-format=stream-json)Include all hook lifecycle events in the output stream. Without this flag only SessionStart and Setup events are emitted.
claude -p --output-format stream-json --include-hook-events "Run tests"
Type: string (JSON Schema)Provide a JSON Schema for structured output validation. Claude will produce output that conforms to the schema.
claude -p --json-schema '{"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}' \
  "Extract the author name from this file"
Type: integer (print-only)Limit the number of agentic turns before stopping. Useful to cap costs in automated pipelines.
claude -p --max-turns 5 "Fix the failing tests"
Type: number — must be greater than 0 (print-only)Set a hard budget cap in USD. Claude stops before exceeding this amount.
claude -p --max-budget-usd 0.50 "Refactor this module"
Type: boolean (requires --input-format=stream-json and --output-format=stream-json)Re-emit user messages from stdin back on stdout for acknowledgment.
claude -p --input-format stream-json --output-format stream-json --replay-user-messages ""

Tools and permissions

Aliases: --allowedToolsType: string listComma or space-separated list of tool names to allow. Supports glob-style patterns.
claude --allowed-tools "Bash(git:*) Edit Read"
claude --allowed-tools Bash Edit
Aliases: --disallowedToolsType: string listComma or space-separated list of tool names to deny.
claude --disallowed-tools "Bash(rm:*)"
Type: string listSpecify the exact set of built-in tools to make available. Use "" to disable all tools, "default" for all tools, or list tool names explicitly.
# No tools
claude --tools ""

# All built-in tools
claude --tools default

# Specific tools only
claude --tools "Bash,Edit,Read"
Type: stringSet the permission mode for the session. Controls how Claude handles tool approval prompts.
claude --permission-mode auto
Run claude --help to see the current list of valid permission mode values.
Type: booleanSkip all permission prompts. All tool calls are approved automatically.
Only use this in fully sandboxed or trusted automated environments. This flag removes all safety guardrails.
claude -p --dangerously-skip-permissions "Run the full test suite"

MCP configuration

Type: string listLoad MCP servers from one or more JSON configuration files or inline JSON strings (space-separated).
# From a file
claude --mcp-config ./mcp-servers.json

# Multiple files
claude --mcp-config ./servers-a.json ./servers-b.json
Type: booleanOnly use MCP servers defined via --mcp-config. Ignores all project-level and user-level MCP configurations.
claude --strict-mcp-config --mcp-config ./servers.json

System prompt

Type: stringReplace the default system prompt with a custom prompt for the session.
claude --system-prompt "You are a security auditor. Focus only on vulnerabilities."
Type: stringAppend additional text to the default system prompt without replacing it.
claude --append-system-prompt "Always output results as a numbered list."

File and directory access

Type: string listGrant tool access to additional directories beyond the current working directory.
claude --add-dir /shared/libs --add-dir /shared/configs
Type: string listDownload file resources at startup. Format: file_id:relative_path.
claude --file file_abc123:doc.txt file_def456:image.png

Settings

Type: stringLoad additional settings from a JSON file path or an inline JSON string.
# From a file
claude --settings ./my-settings.json

# Inline JSON
claude --settings '{"model": "sonnet", "verbose": true}'
Type: stringComma-separated list of setting sources to load. Accepted values: user, project, local.
# Load only user-level settings (ignore project and local)
claude --setting-sources user

# Load user and project settings
claude --setting-sources user,project

Plugins

Type: string (repeatable)Load plugins from a directory for this session only. Repeat the flag to specify multiple directories.
claude --plugin-dir ./my-plugins
claude --plugin-dir ./plugins-a --plugin-dir ./plugins-b
Type: booleanDisable all skills (slash commands loaded from skills/ directories and plugins).
claude --disable-slash-commands -p "Do this without any custom skills"

IDE integration

Type: booleanAutomatically connect to an IDE on startup if exactly one valid IDE integration is available.
claude --ide

Chrome integration

Type: booleanEnable the Claude in Chrome integration.
claude --chrome
Type: booleanDisable the Claude in Chrome integration.
claude --no-chrome

Build docs developers (and LLMs) love