Skip to main content
Pass CLI flags when you launch Claude Code:
Run claude --help to see all available flags in your installed version.
Flags that configure session behavior (like --model and --permission-mode) can also be changed mid-session with the corresponding slash commands: /model and /permissions.

Core flags

Run Claude non-interactively. Claude processes the prompt (from the argument or stdin), prints the response, and exits. No REPL is started.
The workspace trust dialog is skipped in --print mode. Only use this flag in directories you trust.
Works with: --output-format, --model, --system-prompt, --permission-mode, --max-turns, --allowed-tools.
Set the output format. Only works with --print.
Use stream-json when you want to process Claude’s output incrementally as it arrives (useful for long-running tasks or piping into other tools).
Set the input format for stdin. Only works with --print.stream-json input requires --output-format stream-json.
Enable verbose output. Overrides the verbose setting in your config file.
Print the version number and exit.
Display help for the command and exit.

Session continuation flags

Resume the most recent conversation in the current directory without prompting for a session to resume.
Resume a conversation by session ID. Without a value, opens an interactive picker where you can search through past sessions. Accepts an optional search term to filter the list.
When used with --continue or --resume, creates a new session branched from the resumed conversation rather than continuing it in place.
Set a display name for the session. The name appears in /resume and in the terminal title.
Use a specific UUID as the session ID instead of a generated one. Must be a valid UUID. Cannot be used with --continue or --resume unless --fork-session is also specified.
Disable session persistence. The session will not be saved to disk and cannot be resumed. Only works with --print.

Model and capability flags

Set the model for the session. Accepts an alias (e.g. sonnet, opus, haiku) or a full model ID (e.g. claude-sonnet-4-6).
You can also change the model mid-session with /model.
Set the effort level for the session. Controls how much computation Claude applies to each response.
Enable automatic fallback to a different model when the primary model is overloaded. Only works with --print.

Permission and safety flags

Set the permission mode for the session.
bypassPermissions disables all confirmation prompts. Only use it inside Docker containers, CI sandboxes, or other isolated environments with no internet access.
Bypass all permission checks. Claude takes all actions (file edits, shell commands) without asking. Equivalent to --permission-mode bypassPermissions.
Only use this in sandboxed environments with no internet access. Claude Code enforces this: the flag is rejected when running with root/sudo privileges, or outside a Docker or bubblewrap container.
Make bypassing all permission checks available as an option during the session, without enabling it by default. Useful for automated pipelines that may need to escalate mid-session.
Aliases: --allowedToolsComma- or space-separated list of tools Claude is allowed to use. Tools not in this list are blocked.
Tool patterns support glob-style matching: Bash(git:*) permits any git command; Edit(src/**) permits edits under src/.
Aliases: --disallowedToolsComma- or space-separated list of tools Claude is not allowed to use.
Specify the exact set of built-in tools available for the session. Use "" to disable all tools, default to enable all tools, or name specific tools.

Context and prompt flags

Add one or more directories to the tool access context. Claude will be able to read and edit files in these directories in addition to the current working directory.
Useful for monorepos or projects where related code lives outside the current directory.
Override the default system prompt with a custom prompt. Cannot be used with --system-prompt-file.
Append text to the default system prompt. Unlike --system-prompt, this preserves Claude’s built-in instructions and adds to them.
Load MCP servers from one or more JSON config files or inline JSON strings. Multiple values are space-separated.
See the MCP servers guide for the config file format.
Only use MCP servers from --mcp-config, ignoring all other MCP configurations (user config, project config, etc.).
Load additional settings from a JSON file path or an inline JSON string.
Comma-separated list of settings sources to load. Controls which settings files are read at startup.
Define custom agents inline as a JSON object. Each key is the agent name; the value is an object with description and prompt.

Output control flags

Include all hook lifecycle events in the output stream. Only works with --output-format stream-json.
Limit the number of agentic turns in non-interactive mode. Claude stops after this many turns even if the task is incomplete. Only works with --print.
Set a maximum dollar amount to spend on API calls. Claude stops when the budget is reached. Only works with --print.
Provide a JSON Schema for structured output validation. Claude’s response will be validated against this schema.

Worktree flags

Create a new git worktree for this session. Optionally specify a name for the worktree branch. Accepts a PR number or GitHub PR URL to create a worktree from that PR.
Create a tmux session alongside the worktree. Requires --worktree. Uses iTerm2 native panes when available; pass --tmux=classic to force standard tmux behavior.

Debug flags

Enable debug mode. Optionally pass a filter to restrict which debug categories are shown.
Write debug logs to a specific file path instead of displaying them inline. Implicitly enables debug mode.
Minimal mode. Skips hooks, LSP, plugin sync, attribution, auto-memory, background prefetches, keychain reads, and CLAUDE.md auto-discovery. Sets CLAUDE_CODE_SIMPLE=1.Authentication is limited to ANTHROPIC_API_KEY or apiKeyHelper via --settings (OAuth and keychain are not used).Use --bare in scripted pipelines where startup latency matters and the features it disables are not needed. You can still provide context explicitly:

Flag combinations

Common flag patterns for scripting and automation: