Claude Code CLI reference - CLI flags
Claude Code command-line flags
Claude Code documents 80 CLI flags, including --add-dir, --advisor <model> and --agent. You pass these to claude on the command line. Each row gives the docs' description, accepted values and an example where one is documented.
Last verified 1 official pageFull Claude Code reference
| Flag | Description | Example |
|---|---|---|
--add-dir | Add additional working directories for Claude to read and edit files. Docs: --add-dir | claude --add-dir ../apps ../lib |
--advisor <model> | Enable the server-side advisor tool for this session with a model alias or full model ID. fable, opus, sonnet, or a full model ID Docs: --advisor <model> | claude --advisor opus |
--agent | Specify an agent for the current session (overrides the agent setting) Docs: --agent | claude --agent my-custom-agent |
--agents | Define custom subagents dynamically via JSON. Docs: --agents | -no example |
--allow-dangerously-skip-permissions | Add bypassPermissions to the Shift+Tab mode cycle without starting in it. Docs: --allow-dangerously-skip-permissions | claude --permission-mode plan --allow-dangerously-skip-permissions |
--allowedTools, --allowed-tools | Tools that execute without prompting for permission, apart from reads from network paths. Docs: --allowedTools, --allowed-tools | "Bash(git log *)" "Bash(git diff *)" "Read" |
--append-subagent-system-prompt | Append custom text to the end of every subagent's system prompt. Only applies in non-interactive mode with -p. Docs: --append-subagent-system-prompt | -no example |
--append-subagent-system-prompt-file | Load text from a file and append it to subagent system prompts. Docs: --append-subagent-system-prompt-file | -no example |
--append-system-prompt | Append custom text to the end of the default system prompt Docs: --append-system-prompt | claude --append-system-prompt "Always use TypeScript" |
--append-system-prompt-file | Load additional system prompt text from a file and append to the default prompt Docs: --append-system-prompt-file | claude --append-system-prompt-file ./extra-rules.txt |
--autocompact <auto|tokens> | Set the auto-compact window for this session without changing your saved settings. Docs: --autocompact <auto|tokens> | claude --autocompact 500k |
--ax-screen-reader | Render screen-reader friendly output: flat text without decorative borders or animations. Docs: --ax-screen-reader | claude --ax-screen-reader |
--bare | Minimal mode: skip auto-discovery of hooks, skills, custom commands, subagents, plugins, MCP servers, auto memory, and CLAUDE.md so scripted calls start faster. Docs: --bare | claude --bare -p "query" |
--betas | Beta headers to include in API requests (API key users only) Docs: --betas | claude --betas interleaved-thinking |
--bg, --background | Start the session as a background agent and return immediately. Docs: --bg, --background | claude --bg "investigate the flaky test" |
--channels | (Research preview) MCP servers whose channel notifications Claude should listen for in this session. Space-separated plugin:<name>@<marketplace> entries Docs: --channels | claude --channels plugin:my-notifier@my-marketplace |
--chrome | Enable Chrome browser integration for web automation and testing Docs: --chrome | claude --chrome |
--cloud | With a task description, create a new cloud session. With a session ID or claude.ai/code URL, queue a message into that session instead, with -p. Docs: --cloud | claude --cloud "Fix the login bug" |
--continue, -c | Load the most recent conversation in the current directory. Docs: --continue, -c | claude --continue |
--dangerously-load-development-channels | Enable channels that are not on the approved allowlist, for local development. plugin:<name>@<marketplace> and server:<name> entries Docs: --dangerously-load-development-channels | claude --dangerously-load-development-channels server:webhook |
--dangerously-skip-permissions | Skip permission prompts. Equivalent to --permission-mode bypassPermissions. Docs: --dangerously-skip-permissions | claude --dangerously-skip-permissions |
--debug | Enable debug mode with optional category filtering, such as --debug='mcp,startup' or --debug='!mcp'. Docs: --debug | claude --debug='mcp,startup' |
--debug-file <path> | Write debug logs to a specific file path. Implicitly enables debug mode. Docs: --debug-file <path> | claude --debug-file /tmp/claude-debug.log |
--desktop | Open the Claude Desktop app on the current directory and exit without starting a session in the terminal. Docs: --desktop | claude --desktop |
--disable-slash-commands | Disable all skills and commands for this session Docs: --disable-slash-commands | claude --disable-slash-commands |
--disallowedTools, --disallowed-tools | Deny rules. A bare tool name removes the matching tools from Claude's context; a scoped rule denies only matching calls. Docs: --disallowedTools, --disallowed-tools | "Bash(git log *)" "Bash(git diff *)" "Edit" |
--effort | Set the effort level for the current session. Available levels depend on the model. low, medium, high, xhigh, max, or ultracode Docs: --effort | claude --effort high |
--enable-auto-mode | Removed in v2.1.111. Auto mode is now in the Shift+Tab cycle by default; use --permission-mode auto to start in it. Docs: --enable-auto-mode | claude --permission-mode auto |
--environment <environment-id> | Create a new cloud session that runs on the self-hosted environment with the given ID. Environment IDs start with ccpool_. Docs: --environment <environment-id> | claude -p "Fix the login bug" --environment ccpool_abc123 |
--exclude-dynamic-system-prompt-sections | Move per-user context, such as the auto memory location, out of the system prompt and into the first user message. Docs: --exclude-dynamic-system-prompt-sections | claude -p --exclude-dynamic-system-prompt-sections "query" |
--exec | Run a shell command as a PTY-backed background job instead of starting a Claude session. Use with --bg. Docs: --exec | claude --bg --exec 'pytest -x' |
--fallback-model | Enable automatic fallback to the specified model(s) when the primary model is overloaded or not available. Comma-separated list tried in order Docs: --fallback-model | claude --fallback-model sonnet,haiku |
--fork-session | When resuming, create a new session ID instead of reusing the original (use with --resume or --continue) Docs: --fork-session | claude --resume abc123 --fork-session |
--forward-subagent-text | Emit subagent text and thinking blocks in the output stream as assistant and user messages with parent_tool_use_id set. Docs: --forward-subagent-text | -no example |
--from-pr | Open the session picker filtered to sessions linked to a specific pull request. PR number, GitHub/GitHub Enterprise PR URL, GitLab MR URL, or Bitbucket PR URL Docs: --from-pr | claude --from-pr 123 |
--ide | Automatically connect to IDE on startup if exactly one valid IDE is available Docs: --ide | claude --ide |
--init | Run Setup hooks with the init matcher before the session (print mode only) Docs: --init | claude -p --init "query" |
--init-only | Run Setup and SessionStart hooks, then exit without starting a conversation Docs: --init-only | claude --init-only |
--include-hook-events | Include hook lifecycle events in the output stream. Docs: --include-hook-events | -no example |
--include-partial-messages | Include partial streaming events in output. Requires --print and --output-format stream-json. Docs: --include-partial-messages | -no example |
--input-format | Specify input format for print mode. text, stream-json Docs: --input-format | claude -p --output-format json --input-format stream-json |
--json-schema | Get validated JSON output matching a JSON Schema after the agent completes its workflow (print mode only). Docs: --json-schema | claude -p --json-schema '{"type":"object","properties":{...}}' "query" |
--maintenance | Run Setup hooks with the maintenance matcher before the session (print mode only) Docs: --maintenance | claude -p --maintenance "query" |
--max-budget-usd | Stop the run once estimated spend on API calls reaches this amount (print mode only). Docs: --max-budget-usd | claude -p --max-budget-usd 5.00 "query" |
--max-turns | Limit the number of agentic turns (print mode only). Exits with an error when the limit is reached. No limit by default Docs: --max-turns | claude -p --max-turns 3 "query" |
--mcp-config | Load MCP servers from JSON files or strings (space-separated). Docs: --mcp-config | claude --mcp-config ./mcp.json |
--model | Sets the model for the current session with a model alias such as sonnet, opus, haiku, or fable, or a model's full name. Docs: --model | claude --model claude-sonnet-5 |
--name, -n | Set a display name for the session, shown in /resume and the terminal title. Docs: --name, -n | claude -n "my-feature-work" |
--no-chrome | Disable Chrome browser integration for this session Docs: --no-chrome | claude --no-chrome |
--no-session-persistence | Disable session persistence so sessions are not saved to disk and cannot be resumed. Print mode only. Docs: --no-session-persistence | claude -p --no-session-persistence "query" |
--output-format | Specify output format for print mode. text, json, stream-json Docs: --output-format | claude -p "query" --output-format json |
--permission-mode | Begin in a specified permission mode. default, acceptEdits, plan, auto, dontAsk, bypassPermissions, or manual (alias for default) Docs: --permission-mode | claude --permission-mode plan |
--permission-prompt-tool | Specify an MCP tool to handle permission prompts in non-interactive mode. Docs: --permission-prompt-tool | claude -p --permission-prompt-tool mcp_auth_tool "query" |
--permission-prompts | Set who answers permission prompts in print mode. host (default) or none Docs: --permission-prompts | claude -p --permission-prompts none "query" |
--plugin-dir | Load a plugin from a directory or .zip archive, or several from a folder of plugins, for this session only. Docs: --plugin-dir | claude --plugin-dir ./my-plugin |
--plugin-url | Fetch a plugin .zip archive from a URL for this session only. Docs: --plugin-url | claude --plugin-url https://example.com/plugin.zip |
--print, -p | Print response without interactive mode. Docs: --print, -p | claude -p "query" |
--prompt-suggestions | Emit a prompt_suggestion message with a predicted next user prompt after each turn that generates one. Docs: --prompt-suggestions | -no example |
--ref <branch> | With --environment, base the new session's checkout on a named ref instead of local HEAD Docs: --ref <branch> | claude -p "Run the smoke test" --environment ccpool_abc123 --ref main |
--remote | Deprecated alias for --cloud, including the existing-session form Docs: --remote | claude --remote "Fix the login bug" |
--remote-control, --rc | Start an interactive session with Remote Control enabled so you can also control it from claude.ai or the Claude app. Docs: --remote-control, --rc | claude --remote-control "My Project" |
--remote-control-session-name-prefix <prefix> | Prefix for auto-generated Remote Control session names when no explicit name is set. Defaults to your machine's hostname Docs: --remote-control-session-name-prefix <prefix> | claude remote-control --remote-control-session-name-prefix dev-box |
--replay-user-messages | Re-emit user messages from stdin back on stdout for acknowledgment. Docs: --replay-user-messages | -no example |
--restricted | Start in restricted mode, for evaluation harnesses where Claude Code must not run commands or read the machine's user and project settings. Docs: --restricted | claude --restricted -p "query" |
--resume, -r | Resume a specific session by ID or name, or show an interactive picker to choose a session. Docs: --resume, -r | claude --resume auth-refactor |
--safe-mode | Start with all customizations disabled to troubleshoot a broken configuration. Docs: --safe-mode | claude --safe-mode |
--session-id | Use a specific session ID for the conversation (must be a valid UUID) Docs: --session-id | claude --session-id "550e8400-e29b-41d4-a716-446655440000" |
--setting-sources | Comma-separated list of setting sources to load. user, project, local Docs: --setting-sources | claude --setting-sources user,project |
--settings | Path to a settings JSON file or an inline JSON string. Values override the same keys in settings.json files for this session. Docs: --settings | claude --settings ./settings.json |
--strict-mcp-config | Only use MCP servers from --mcp-config, ignoring all other MCP configurations. Docs: --strict-mcp-config | claude --strict-mcp-config --mcp-config ./mcp.json |
--system-prompt | Replace the entire system prompt with custom text Docs: --system-prompt | claude --system-prompt "You are a Python expert" |
--system-prompt-file | Load system prompt from a file, replacing the default prompt Docs: --system-prompt-file | claude --system-prompt-file ./custom-prompt.txt |
--system-prompt-snapshot | Pass off to rebuild the system prompt on every request instead of reusing the prompt recorded on the conversation's first request. on (default) or off Docs: --system-prompt-snapshot | claude --system-prompt-snapshot off |
--teleport | Resume a cloud session in your local terminal Docs: --teleport | claude --teleport |
--teammate-mode | Set how agent team teammates display. Overrides the teammateMode setting for this session. in-process (default), auto, tmux, or iterm2 Docs: --teammate-mode | claude --teammate-mode auto |
--tmux | Create a tmux session for the worktree. Requires --worktree. --tmux=classic for traditional tmux Docs: --tmux | claude -w feature-auth --tmux |
--tools | Restrict which built-in tools Claude can use. "" to disable all, "default", or tool names like "Bash,Edit,Read" Docs: --tools | claude --tools "Bash,Edit,Read" |
--verbose | Enable verbose logging, shows full turn-by-turn output. Docs: --verbose | claude --verbose |
--version, -v | Output the version number Docs: --version, -v | claude -v |
--worktree, -w | Start Claude in an isolated git worktree at <repo>/.claude/worktrees/<name>. Docs: --worktree, -w | claude -w feature-auth |
The rest of the Claude Code reference
FAQ
How many CLI flags does Claude Code have?
The official Claude Code docs list 80 CLI flags, including --add-dir, --advisor <model> and --agent. All of them are in the table above, in the docs' order.
What does --add-dir do in Claude Code?
Add additional working directories for Claude to read and edit files. Example: claude --add-dir ../apps ../lib
Where are Claude Code CLI flags documented?
On 1 official docs page at code.claude.com, last read on October 17, 2026. Every row in the table links the exact section it came from.
More on Claude Code
- Claude Code in the tools directoryWhat it is, who makes it and how it fits next to other coding agents.
- Claude Code errors and fixes18 error messages, quoted verbatim, with the documented fix for each.
- Claude Code usage limitsPlan and tier limits for this tool, copied from the official docs.
- Claude Code feature guidesHooks, subagents, permissions, memory and the rest, one guide per feature.
Use other models in Claude Code
Setup guides from the model-in-tool directory, each with the env vars and base URL from official docs.
Sources
Last verified . Names and examples are copied verbatim from the official page below, and every row above links the exact section it came from.
Newsletter
Know when your tools change
One email per week. New coding agent releases, the flags and commands they add, and what they mean for how you work.