AI agents

Claude Code

Claude Code — CLI Flags

Flags modify how claude starts and runs. Pass them on the command line; several can also be set permanently in settings.json (see Claude Code — Configuration). Interactive-only and print-only restrictions are noted in each table.

Session

FlagPurposeExample
--continue, -cLoad the most recent conversation in the current directoryclaude -c
--resume, -rResume a session by ID or name, or open the interactive pickerclaude -r billing-refactor
--fork-sessionWhen resuming, create a new session ID (with --resume/--continue)claude -r my-session --fork-session
--from-pr <n|url>Resume sessions linked to a GitHub PRclaude --from-pr 123
--session-id <uuid>Use a specific session ID (must be a valid UUID)claude --session-id 9f1c...
--no-session-persistenceDon’t save the session to disk (print mode only)claude -p "..." --no-session-persistence
--add-dir <dirs...>Add additional working directories (validates each path exists)claude --add-dir ../shared-lib
--worktree, -w [name]Start in an isolated git worktree at <repo>/.claude/worktrees/<name>claude -w experiment
--teleportResume a web session in your local terminalclaude --teleport
--remote "<task>"Create a new web session on claude.ai with the given taskclaude --remote "triage open issues"

Models

FlagPurposeExample
--model <model>Model alias (sonnet, opus) or full model nameclaude --model claude-sonnet-4-6
--fallback-model <model>Automatic fallback when the default model is overloaded (print mode only)claude -p "..." --fallback-model sonnet
--betas <headers>Beta headers for API requests (API key users only)claude --betas "feature-x"

Permissions

FlagPurposeExample
--permission-mode <mode>Begin in the specified permission mode (e.g. plan)claude --permission-mode plan
--allowedTools <list>Tools that execute without prompting (permission rule syntax)claude --allowedTools "Bash(git log *)" "Read"
--disallowedTools <list>Tools removed from the model’s context entirelyclaude --disallowedTools "Task(Explore)"
--tools <list>Restrict which built-in tools Claude can use; "" disables all, "default" = allclaude --tools "Bash,Edit,Read"
--permission-prompt-tool <tool>MCP tool to handle permission prompts in non-interactive modeclaude -p ... --permission-prompt-tool mcp__auth__approve
--allow-dangerously-skip-permissionsMake permission bypassing available without activating it; composable with --permission-modeclaude --allow-dangerously-skip-permissions
--dangerously-skip-permissionsSkip all permission prompts — see the warning in Claude Code — Permissionsclaude --dangerously-skip-permissions

Context

FlagPurposeExample
--system-prompt <text>Replace the entire system prompt (interactive + print)claude --system-prompt "You are a strict reviewer"
--system-prompt-file <path>Replace the system prompt from a file (print only)claude -p ... --system-prompt-file prompt.txt
--append-system-prompt <text>Append to the default system prompt (interactive + print)claude --append-system-prompt "Prefer pnpm"
--append-system-prompt-file <path>Append system-prompt text from a file (print only)claude -p ... --append-system-prompt-file extra.txt
--agent <name>Run the session as the given agent (overrides the agent setting); it runs as the main thread and can spawn subagentsclaude --agent code-reviewer
--agents <json>Define custom subagents dynamically via JSONclaude --agents '{"reviewer":{"description":"...","prompt":"..."}}'
--settings <path-or-json>Load additional settings from a JSON file or stringclaude --settings ./ci-settings.json
--setting-sources <list>Comma-separated setting sources to load (user, project, local)claude --setting-sources user,project
--disable-slash-commandsDisable all skills and slash commands for the sessionclaude --disable-slash-commands

--system-prompt and --system-prompt-file are mutually exclusive; the append variants can combine with a replacement flag.

Output

FlagPurposeExample
--print, -pPrint the response without interactive modeclaude -p "summarize README.md"
--output-format <fmt>Print-mode output: text, json, stream-jsonclaude -p "..." --output-format json
--input-format <fmt>Print-mode input: text, stream-jsonclaude -p --input-format stream-json
--json-schema <schema>Validated JSON output matching a JSON Schema (print only); result lands in structured_outputclaude -p "..." --json-schema '{"type":"object",...}'
--include-partial-messagesInclude partial streaming events (requires --print --output-format stream-json)claude -p ... --output-format stream-json --include-partial-messages
--verboseFull turn-by-turn output (both modes)claude --verbose

Debugging

FlagPurposeExample
--debug [categories]Debug mode, filterable by categoryclaude --debug "api,mcp"
--version, -vOutput the version numberclaude --version

Automation

FlagPurposeExample
--max-turns <n>Limit agentic turns (print only); errors when the limit is reachedclaude -p "fix tests" --max-turns 10
--max-budget-usd <n>Max dollars to spend on API calls before stopping (print only)claude -p "..." --max-budget-usd 2
--init / --init-onlyRun initialization hooks and start interactive mode / and exitclaude --init-only
--maintenanceRun maintenance hooks and exitclaude --maintenance
--teammate-mode <mode>Agent-team teammate display: auto (default), in-process, tmuxclaude --teammate-mode tmux

Integrations

FlagPurposeExample
--mcp-config <files-or-json>Load MCP servers from JSON files or stringsclaude --mcp-config ./mcp.json
--strict-mcp-configOnly use MCP servers from --mcp-config, ignoring all other MCP configclaude --mcp-config ./mcp.json --strict-mcp-config
--ideAuto-connect to an IDE on startup if exactly one valid IDE is availableclaude --ide
--chrome / --no-chromeEnable / disable Chrome browser integrationclaude --no-chrome
--plugin-dir <dir>Load plugins from directories for this session only (repeatable)claude --plugin-dir ./my-plugin

Last verified: 2026-09-07

Official sources:

AI coding tools evolve quickly. If you find outdated information, please open an issue or pull request.