Skip to main content

Documentation Index

Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

CLI commands

You can start sessions, pipe content, resume conversations, and manage updates with these commands:
CommandDescriptionExample
claudeStart interactive sessionclaude
claude "query"Start interactive session with initial promptclaude "explain this project"
claude -p "query"Query via SDK, then exitclaude -p "explain this function"
cat file | claude -p "query"Process piped contentcat logs.txt | claude -p "explain"
claude -cContinue most recent conversation in current directoryclaude -c
claude -c -p "query"Continue via SDKclaude -c -p "Check for type errors"
claude -r "<session>" "query"Resume session by ID or nameclaude -r "auth-refactor" "Finish this PR"
claude updateUpdate to latest versionclaude update
claude install [version]Install or reinstall the native binary. Accepts a version like 2.1.118, or stable or latest. See Install a specific versionclaude install stable
claude auth loginSign in to your Anthropic account. Use --email to pre-fill your email address, --sso to force SSO authentication, and --console to sign in with Anthropic Console for API usage billing instead of a Claude subscriptionclaude auth login --console
claude auth logoutLog out from your Anthropic accountclaude auth logout
claude auth statusShow authentication status as JSON. Use --text for human-readable output. Exits with code 0 if logged in, 1 if notclaude auth status
claude agentsOpen agent view to monitor and dispatch parallel background sessions. When output is piped, lists configured subagents insteadclaude agents
claude attach <id>Attach to a background session in this terminalclaude attach 7c5dcf5d
claude auto-mode defaultsPrint the built-in auto mode classifier rules as JSON. Use claude auto-mode config to see your effective config with settings appliedclaude auto-mode defaults > rules.json
claude logs <id>Print recent output from a background sessionclaude logs 7c5dcf5d
claude mcpConfigure Model Context Protocol (MCP) serversSee the Claude Code MCP documentation.
claude pluginManage Claude Code plugins. Alias: claude plugins. See plugin reference for subcommandsclaude plugin install code-review@claude-plugins-official
claude project purge [path]Delete all local Claude Code state for a project: transcripts, task lists, debug logs, file-edit history, prompt history lines, and the project’s entry in ~/.claude.json. Omit [path] to pick from an interactive list. Flags: --dry-run to preview, -y/--yes to skip confirmation, -i/--interactive to confirm each item, --all for every project. See Clear local dataclaude project purge ~/work/repo --dry-run
claude remote-controlStart a Remote Control server to control Claude Code from Claude.ai or the Claude app. Runs in server mode (no local interactive session). See Server mode flagsclaude remote-control --name "My Project"
claude respawn <id>Restart a stopped background session with its conversation intact. Use --all to restart every stopped sessionclaude respawn 7c5dcf5d
claude rm <id>Remove a background session from the listclaude rm 7c5dcf5d
claude setup-tokenGenerate a long-lived OAuth token for CI and scripts. Prints the token to the terminal without saving it. Requires a Claude subscription. See Generate a long-lived tokenclaude setup-token
claude stop <id>Stop a background session. Also accepts claude killclaude stop 7c5dcf5d
claude ultrareview [target]Run ultrareview non-interactively. Prints findings to stdout and exits 0 on success or 1 on failure. Use --json for the raw payload and --timeout <minutes> to override the 30-minute defaultclaude ultrareview 1234 --json
If you mistype a subcommand, Claude Code suggests the closest match and exits without starting a session. For example, claude udpate prints Did you mean claude update?.

CLI flags

Customize Claude Code’s behavior with these command-line flags. claude --help does not list every flag, so a flag’s absence from --help does not mean it is unavailable.
FlagDescriptionExample
--add-dirAdd additional working directories for Claude to read and edit files. Grants file access; most .claude/ configuration is not discovered from these directories. Validates each path exists as a directory. To persist these directories across sessions, set permissions.additionalDirectories in settingsclaude --add-dir ../apps ../lib
--agentSpecify an agent for the current session (overrides the agent setting)claude --agent my-custom-agent
--agentsDefine custom subagents dynamically via JSON. Uses the same field names as subagent frontmatter, plus a prompt field for the agent’s instructionsclaude --agents '{"reviewer":{"description":"Reviews code","prompt":"You are a code reviewer"}}'
--allow-dangerously-skip-permissionsAdd bypassPermissions to the Shift+Tab mode cycle without starting in it. Lets you begin in a different mode like plan and switch to bypassPermissions later. See permission modesclaude --permission-mode plan --allow-dangerously-skip-permissions
--allowedToolsTools that execute without prompting for permission. See permission rule syntax for pattern matching. To restrict which tools are available, use --tools instead"Bash(git log *)" "Bash(git diff *)" "Read"
--append-system-promptAppend custom text to the end of the default system promptclaude --append-system-prompt "Always use TypeScript"
--append-system-prompt-fileLoad additional system prompt text from a file and append to the default promptclaude --append-system-prompt-file ./extra-rules.txt
--bareMinimal mode: skip auto-discovery of hooks, skills, plugins, MCP servers, auto memory, and CLAUDE.md so scripted calls start faster. Claude has access to Bash, file read, and file edit tools. Sets CLAUDE_CODE_SIMPLE. See bare modeclaude --bare -p "query"
--betasBeta headers to include in API requests (API key users only)claude --betas interleaved-thinking
--bgStart the session as a background agent and return immediately. Prints the session ID and management commands. Combine with --agent to run a specific subagentclaude --bg "investigate the flaky test"
--channels(Research preview) MCP servers whose channel notifications Claude should listen for in this session. Space-separated list of plugin:<name>@<marketplace> entries. Requires Claude.ai authenticationclaude --channels plugin:my-notifier@my-marketplace
--chromeEnable Chrome browser integration for web automation and testingclaude --chrome
--continue, -cLoad the most recent conversation in the current directory. Includes sessions that added this directory with /add-dirclaude --continue
--dangerously-load-development-channelsEnable channels that are not on the approved allowlist, for local development. Accepts plugin:<name>@<marketplace> and server:<name> entries. Prompts for confirmationclaude --dangerously-load-development-channels server:webhook
--dangerously-skip-permissionsSkip permission prompts. Equivalent to --permission-mode bypassPermissions. See permission modes for what this does and does not skipclaude --dangerously-skip-permissions
--debugEnable debug mode with optional category filtering (for example, "api,hooks" or "!statsig,!file")claude --debug "api,mcp"
--debug-file <path>Write debug logs to a specific file path. Implicitly enables debug mode. Takes precedence over CLAUDE_CODE_DEBUG_LOGS_DIRclaude --debug-file /tmp/claude-debug.log
--disable-slash-commandsDisable all skills and commands for this sessionclaude --disable-slash-commands
--disallowedToolsTools that are removed from the model’s context and cannot be used"Bash(git log *)" "Bash(git diff *)" "Edit"
--effortSet the effort level for the current session. Options: low, medium, high, xhigh, max; available levels depend on the model. Overrides the effortLevel setting for this session and does not persistclaude --effort high
--enable-auto-modeRemoved in v2.1.111. Auto mode is now in the Shift+Tab cycle by default; use --permission-mode auto to start in itclaude --permission-mode auto
--exclude-dynamic-system-prompt-sectionsMove per-machine sections from the system prompt (working directory, environment info, memory paths, git-repo flag) into the first user message. Improves prompt-cache reuse across different users and machines running the same task. Only applies with the default system prompt; ignored when --system-prompt or --system-prompt-file is set. Use with -p for scripted, multi-user workloadsclaude -p --exclude-dynamic-system-prompt-sections "query"
--fallback-modelEnable automatic fallback to specified model when default model is overloaded (print mode only)claude -p --fallback-model sonnet "query"
--fork-sessionWhen resuming, create a new session ID instead of reusing the original (use with --resume or --continue)claude --resume abc123 --fork-session
--from-prResume sessions linked to a specific pull request. Accepts a PR number, a GitHub or GitHub Enterprise PR URL, a GitLab merge request URL, or a Bitbucket pull request URL. Sessions are linked automatically when Claude creates the pull requestclaude --from-pr 123
--ideAutomatically connect to IDE on startup if exactly one valid IDE is availableclaude --ide
--initRun Setup hooks with the init matcher before the session (print mode only)claude -p --init "query"
--init-onlyRun Setup and SessionStart hooks, then exit without starting a conversationclaude --init-only
--include-hook-eventsInclude all hook lifecycle events in the output stream. Requires --output-format stream-jsonclaude -p --output-format stream-json --include-hook-events "query"
--include-partial-messagesInclude partial streaming events in output. Requires --print and --output-format stream-jsonclaude -p --output-format stream-json --include-partial-messages "query"
--input-formatSpecify input format for print mode (options: text, stream-json)claude -p --output-format json --input-format stream-json
--json-schemaGet validated JSON output matching a JSON Schema after agent completes its workflow (print mode only, see structured outputs)claude -p --json-schema '{"type":"object","properties":{...}}' "query"
--maintenanceRun Setup hooks with the maintenance matcher before the session (print mode only)claude -p --maintenance "query"
--max-budget-usdMaximum dollar amount to spend on API calls before stopping (print mode only)claude -p --max-budget-usd 5.00 "query"
--max-turnsLimit the number of agentic turns (print mode only). Exits with an error when the limit is reached. No limit by defaultclaude -p --max-turns 3 "query"
--mcp-configLoad MCP servers from JSON files or strings (space-separated)claude --mcp-config ./mcp.json
--modelSets the model for the current session with an alias for the latest model (sonnet or opus) or a model’s full name. Overrides the model setting and ANTHROPIC_MODELclaude --model claude-sonnet-4-6
--name, -nSet a display name for the session, shown in /resume and the terminal title. You can resume a named session with claude --resume <name>.

/rename changes the name mid-session and also shows it on the prompt bar
claude -n "my-feature-work"
--no-chromeDisable Chrome browser integration for this sessionclaude --no-chrome
--no-session-persistenceDisable session persistence so sessions are not saved to disk and cannot be resumed. Print mode only. The CLAUDE_CODE_SKIP_PROMPT_HISTORY environment variable does the same in any modeclaude -p --no-session-persistence "query"
--output-formatSpecify output format for print mode (options: text, json, stream-json)claude -p "query" --output-format json
--permission-modeBegin in a specified permission mode. Accepts default, acceptEdits, plan, auto, dontAsk, or bypassPermissions. Overrides defaultMode from settings filesclaude --permission-mode plan
--permission-prompt-toolSpecify an MCP tool to handle permission prompts in non-interactive modeclaude -p --permission-prompt-tool mcp_auth_tool "query"
--plugin-dirLoad a plugin from a directory or .zip archive for this session only. Each flag takes one path. Repeat the flag for multiple plugins: --plugin-dir A --plugin-dir B.zipclaude --plugin-dir ./my-plugin
--plugin-urlFetch a plugin .zip archive from a URL for this session only. Repeat the flag for multiple plugins, or pass space-separated URLs in a single quoted valueclaude --plugin-url https://example.com/plugin.zip
--print, -pPrint response without interactive mode (see Agent SDK documentation for programmatic usage details)claude -p "query"
--remoteCreate a new web session on claude.ai with the provided task descriptionclaude --remote "Fix the login bug"
--remote-control, --rcStart an interactive session with Remote Control enabled so you can also control it from claude.ai or the Claude app. Optionally pass a name for the sessionclaude --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, producing names like myhost-graceful-unicorn. Set CLAUDE_REMOTE_CONTROL_SESSION_NAME_PREFIX for the same effectclaude remote-control --remote-control-session-name-prefix dev-box
--replay-user-messagesRe-emit user messages from stdin back on stdout for acknowledgment. Requires --input-format stream-json and --output-format stream-jsonclaude -p --input-format stream-json --output-format stream-json --replay-user-messages
--resume, -rResume a specific session by ID or name, or show an interactive picker to choose a session. Includes sessions that added this directory with /add-dirclaude --resume auth-refactor
--session-idUse a specific session ID for the conversation (must be a valid UUID)claude --session-id "550e8400-e29b-41d4-a716-446655440000"
--setting-sourcesComma-separated list of setting sources to load (user, project, local)claude --setting-sources user,project
--settingsPath to a settings JSON file or an inline JSON string. Values you set here override the same keys in your settings.json files for this session. Keys you omit keep their file-based values. See settings precedenceclaude --settings ./settings.json
--strict-mcp-configOnly use MCP servers from --mcp-config, ignoring all other MCP configurationsclaude --strict-mcp-config --mcp-config ./mcp.json
--system-promptReplace the entire system prompt with custom textclaude --system-prompt "You are a Python expert"
--system-prompt-fileLoad system prompt from a file, replacing the default promptclaude --system-prompt-file ./custom-prompt.txt
--teleportResume a web session in your local terminalclaude --teleport
--teammate-modeSet how agent team teammates display: auto (default), in-process, or tmux. Overrides the teammateMode setting for this session. See Choose a display modeclaude --teammate-mode in-process
--tmuxCreate a tmux session for the worktree. Requires --worktree. Uses iTerm2 native panes when available; pass --tmux=classic for traditional tmuxclaude -w feature-auth --tmux
--toolsRestrict which built-in tools Claude can use. Use "" to disable all, "default" for all, or tool names like "Bash,Edit,Read"claude --tools "Bash,Edit,Read"
--verboseEnable verbose logging, shows full turn-by-turn output. Overrides the viewMode setting for this sessionclaude --verbose
--version, -vOutput the version numberclaude -v
--worktree, -wStart Claude in an isolated git worktree at <repo>/.claude/worktrees/<name>. If no name is given, one is auto-generated. Pass #<number> or a GitHub pull request URL to fetch that PR from origin and branch the worktree from itclaude -w feature-auth

System prompt flags

Claude Code provides four flags for customizing the system prompt. All four work in both interactive and non-interactive modes.
FlagBehaviorExample
--system-promptReplaces the entire default promptclaude --system-prompt "You are a Python expert"
--system-prompt-fileReplaces with file contentsclaude --system-prompt-file ./prompts/review.txt
--append-system-promptAppends to the default promptclaude --append-system-prompt "Always use TypeScript"
--append-system-prompt-fileAppends file contents to the default promptclaude --append-system-prompt-file ./style-rules.txt
--system-prompt and --system-prompt-file are mutually exclusive. The append flags can be combined with either replacement flag. Choose based on whether Claude Code’s default identity still fits your task. Use an append flag when Claude should remain a coding assistant that also follows your extra rules: per-invocation instructions, output formatting, or domain context for a -p script. Appending preserves the default tool guidance, safety instructions, and coding conventions, so you only supply what differs. Use a replacement flag when the surface, identity, or permission model differs from Claude Code’s, like a non-coding agent in a pipeline that no human watches. Replacing drops all of the default prompt, including tool guidance and safety instructions, so you take responsibility for whatever your task still needs. These flags apply only to the current invocation. For persistent personas you can switch between and share across a project, use output styles. For project conventions Claude should always follow, use CLAUDE.md. The Agent SDK guide on system prompts covers the same decision in more depth.

See also