Kipt

Your prompts and skills, one keystroke away.

Explore

Claude Code CLI reference: every command, subcommand and flag

Claude Code CLI reference: every documented claude command, subcommand and flag in tables, from -p and --resume to --permission-mode, --bare and --worktree.

By the Kipt team · Updated 26 October 2026

The Claude Code CLI is the claude command: run it alone for an interactive session, add -p "prompt" to get one answer and exit, and add flags such as --model, --permission-mode or --resume to change how the session starts. This page lists every subcommand and flag in Anthropic's CLI reference, read on 26 October 2026, grouped by what you use them for.

One warning from the docs before you start: "claude --help does not list every flag, so a flag's absence from --help does not mean it is unavailable." Many flags below also carry a minimum version. Run claude -v to check yours and claude update to move to the latest release.

How do you start, continue and resume a session?

These are the basic ways to call claude. Everything else on this page is a subcommand or a flag added to one of them.

Command What it does
claude Start an interactive session
claude "query" Start an interactive session with a first prompt
claude -p "query" Run one query through the SDK, print the result, exit
cat file | claude -p "query" Process piped content
claude -c Continue the most recent conversation in the current directory
claude -c -p "query" Continue that conversation non-interactively
claude -r "<session>" "query" Resume a session by ID or name
# ask a question about a log file and exit
cat logs.txt | claude -p "explain the errors in this log"

# pick up yesterday's named session
claude -r "auth-refactor" "Finish this PR"

If you mistype a subcommand, Claude Code suggests the closest match and exits without starting a session. claude udpate prints Did you mean claude update?.

What subcommands does the claude CLI have?

Subcommands run a specific job instead of a chat. Several of them manage background sessions, which you can also watch from agent view.

Subcommand What it does
claude update Update to the latest version
claude install [version] Install or reinstall the native binary. Accepts a version such as 2.1.118, or stable or latest
claude auth login Sign in. --email pre-fills your address, --sso forces SSO, --console signs in with the Anthropic Console for API billing
claude auth logout Log out
claude auth status Show sign-in status as JSON (--text for readable output). Exits 0 when logged in, 1 when not
claude setup-token Print a long-lived OAuth token for CI and scripts. Requires a Claude subscription
claude doctor Read-only install and settings diagnostics without starting a session
claude mcp Configure MCP servers
claude mcp login <name> Run an MCP server's OAuth flow from the shell. --no-browser prints the URL instead, useful over SSH
claude mcp logout <name> Clear stored OAuth credentials for an MCP server
claude plugin Manage plugins (alias claude plugins)
claude agents Open agent view to monitor and dispatch background sessions. --json prints active sessions for scripts
claude attach <id> Attach this terminal to a background session. Part of a running session's name also works from v2.1.290
claude logs <id> Print recent output from a background session
claude stop <id> Stop a background session. claude kill also works
claude respawn <id> Restart a background session with its conversation intact. --all restarts every running one
claude rm <id> Remove a background session from the list. The transcript stays on your machine
claude daemon logs Follow the background-session supervisor log at ~/.claude/daemon.log
claude daemon run Run the supervisor in the foreground
claude daemon status Print the supervisor's state. Exits 1 if it isn't running
claude daemon stop --any Stop the supervisor and its sessions. --keep-workers leaves sessions running
claude auto-mode defaults Print the built-in auto mode classifier rules as JSON
claude auto-mode config Show your effective auto mode config with settings applied
claude auto-mode reset Remove the autoMode section from your user settings. -y skips the prompt
claude import [source] Start a session that runs /import to bring in config from other coding agents. Supports --dry-run and --yes
claude purge [path] Delete all local Claude Code state for a project. Supports --dry-run, -y, -i and --all
claude remote-control Start a Remote Control server so you can drive Claude Code from claude.ai or the Claude app
claude ultrareview [target] Run ultrareview non-interactively. --json, --timeout <minutes> (default 45) and --post for a GitHub PR
claude gateway Start the self-hosted Claude apps gateway. Requires --config gateway.yaml
claude self-hosted-runner Register a machine or container with a self-hosted environment for cloud sessions. Has setup, doctor and orchestrator

For the plugin subcommands, see Anthropic's plugin commands reference or our Claude Code plugins guide. For MCP, see the Claude Code MCP guide.

Which flags control sessions and resuming?

Flag What it does
--continue, -c Load the most recent conversation in the current directory. Skips -p and SDK sessions unless you also pass -p
--resume, -r Resume a session by ID or name, a transcript .jsonl path, or open a picker
--fork-session With --resume or --continue, create a new session ID instead of reusing the original
--session-id Use a specific session ID (must be a valid UUID)
--name, -n Set a display name, shown in /resume and the terminal title
--from-pr Open the picker filtered to sessions linked to a PR number or URL (GitHub, GitLab, Bitbucket)
--no-session-persistence Don't save the session to disk. Print mode only
--worktree, -w Start in an isolated git worktree at <repo>/.claude/worktrees/<name>. Also accepts #<number> or a PR URL
--tmux Create a tmux session for the worktree. Requires --worktree; --tmux=classic for plain tmux
--add-dir Add extra working directories Claude can read and edit
--ide Connect to your IDE on startup if exactly one is available

Our sessions guide and worktrees guide cover these in practice.

Which flags set the model, effort and context?

Flag What it does
--model Set the model with an alias (sonnet, opus, haiku, fable) or a full name. Overrides the model setting and ANTHROPIC_MODEL
--fallback-model Comma-separated models to try in order when the primary is overloaded or unavailable
--effort Effort level: low, medium, high, xhigh, max or ultracode. Available levels depend on the model
--advisor <model> Enable the server-side advisor tool with fable, opus, sonnet or a full model ID
--autocompact <auto|tokens> Set the auto-compact window for this session, such as 500k
--betas Beta headers for API requests (API key users only)

Note that the CLAUDE_CODE_EFFORT_LEVEL environment variable overrides --effort, while --model overrides ANTHROPIC_MODEL. See our models guide and environment variables guide.

Which flags control permissions and tools?

Flag What it does
--permission-mode Start in default (alias manual), acceptEdits, plan, auto, dontAsk or bypassPermissions
--dangerously-skip-permissions Skip permission prompts. Same as --permission-mode bypassPermissions
--allow-dangerously-skip-permissions Add bypassPermissions to the Shift+Tab cycle without starting in it
--allowedTools, --allowed-tools Tools that run without a prompt, such as "Bash(git log *)" "Read"
--disallowedTools, --disallowed-tools Deny rules. A bare name removes the tool; a scoped rule such as Bash(rm *) denies matching calls
--tools Restrict built-in tools: "" for none, "default", or names such as "Bash,Edit,Read"
--permission-prompt-tool An MCP tool that answers permission prompts in non-interactive mode
--permission-prompts In print mode, host (default) sends prompts to the SDK host; none denies them
--restricted For evaluation harnesses: removes command-running tools and WebFetch, loads only managed settings and --settings
--disable-slash-commands Disable all skills and commands for this session
--enable-auto-mode Removed in v2.1.111. Use --permission-mode auto
# read-only review in plan mode
claude --permission-mode plan

# allow git inspection without prompts, block edits entirely
claude --allowedTools "Bash(git log *)" "Bash(git diff *)" --disallowedTools "Edit"

The permission modes page says to run --dangerously-skip-permissions sessions inside a container, a VM or the sandbox runtime, and the CLI refuses the flag as root on Linux and macOS. Our permissions guide and Docker guide go further.

Which flags change the system prompt?

Flag What it does
--system-prompt Replace the whole default system prompt with your text
--system-prompt-file Replace it with a file's contents
--append-system-prompt Append text to the default prompt
--append-system-prompt-file Append a file's contents to the default prompt
--system-prompt-snapshot off rebuilds the prompt on every request instead of reusing the recorded one
--append-subagent-system-prompt Append text to every subagent's prompt. Print mode only
--append-subagent-system-prompt-file Same, from a file. Print mode only
--exclude-dynamic-system-prompt-sections Move per-user context into the first user message for better prompt-cache reuse across machines

Anthropic's advice: use an append flag when Claude should stay a coding assistant with extra rules, and a replace flag only when the job is not coding, because replacing drops the default tool guidance and safety instructions.

Which flags matter for scripts and CI?

Most of these require -p. Our headless mode guide walks through full examples.

Flag What it does
--print, -p Print the response without interactive mode
--output-format text, json or stream-json
--input-format text or stream-json
--json-schema Return validated JSON matching a schema after the run
--max-turns Limit agentic turns; exits with an error at the limit. No limit by default
--max-budget-usd Stop once estimated API spend reaches this amount
--bare Minimal mode: skip hooks, skills, plugins, MCP servers, auto memory and CLAUDE.md for faster starts
--include-partial-messages Include partial streaming events. Needs stream-json
--include-hook-events Include hook lifecycle events in the stream
--forward-subagent-text Emit subagent text and thinking blocks in the stream
--replay-user-messages Echo stdin user messages back on stdout
--prompt-suggestions Emit a predicted next prompt after each turn
--init Run Setup hooks with the init matcher before the session
--maintenance Run Setup hooks with the maintenance matcher
--init-only Run Setup and SessionStart hooks, then exit
--verbose Full turn-by-turn output
claude -p "list TODO comments in src as JSON" \
  --output-format json --max-turns 5 --max-budget-usd 2.00

Which flags load settings, MCP servers, plugins and agents?

Flag What it does
--settings A settings JSON file or inline JSON that overrides your settings files for this session
--setting-sources Which sources to load: user, project, local
--mcp-config Load MCP servers from JSON files or strings
--strict-mcp-config Use only the servers from --mcp-config
--plugin-dir Load a plugin from a directory or .zip for this session. Repeat for more
--plugin-url Fetch a plugin .zip from a URL for this session
--agent Use a specific agent for the session
--agents Define subagents inline as JSON
--teammate-mode Agent team display: in-process, auto, tmux or iterm2
--channels (Research preview) MCP servers whose channel notifications to listen for
--dangerously-load-development-channels Enable channels not on the approved allowlist, for local development

Which flags handle cloud, remote, background and debugging?

Flag What it does
--bg, --background Start as a background agent and return at once. Can't combine with -p
--exec With --bg, run a shell command as a background job, such as 'pytest -x'
--cloud Create a cloud session from a task, or queue a message into an existing one
--remote Deprecated alias for --cloud
--teleport Resume a cloud session in your local terminal
--environment <id> Create a cloud session on a self-hosted environment (ccpool_ IDs)
--ref <branch> With --environment, base the checkout on a named ref
--remote-control, --rc Start an interactive session you can also control from claude.ai or the Claude app
--remote-control-session-name-prefix Prefix for auto-generated Remote Control session names
--desktop Open the Claude Desktop app on the current directory and exit
--chrome / --no-chrome Turn Chrome browser integration on or off
--debug Debug mode, with an optional filter such as --debug='mcp,startup'
--debug-file <path> Write debug logs to a file; implies debug mode
--safe-mode Start with all customizations off to troubleshoot a broken config
--ax-screen-reader Screen-reader friendly output
--version, -v Print the version

If a session behaves oddly, claude --safe-mode tells you whether a customization is the cause. Our troubleshooting guide has more checks.

How do you keep the flags you use often?

Flags are for one session. Anything you pass on every run belongs in a settings file instead: model, permissions and env in ~/.claude/settings.json or .claude/settings.json. See our settings guide. For printable shortcuts and slash commands next to these flags, keep the Claude Code cheat sheet open.

The prompts you pass to claude -p repeat too. Kipt keeps prompts as Markdown in a private GitHub repo you own, with {{name}} blanks you fill in before copying, so a tested review or triage prompt is a Cmd+K search away instead of buried in shell history.

Questions

How do I see all Claude Code CLI flags?

Run claude --help for a quick list, but Anthropic notes that --help does not list every flag. The complete list is the CLI reference at code.claude.com/docs/en/cli-reference, which this page follows.

What is the difference between claude -c and claude -r?

claude -c (--continue) reopens the most recent conversation in the current directory. claude -r (--resume) takes a session ID or name, or opens a picker if you pass nothing, so you can return to any earlier session.

What does claude -p do?

-p, or --print, runs one prompt without the interactive interface, prints the answer and exits. It is how you use Claude Code in scripts and CI, and it unlocks print-only flags such as --output-format, --max-turns, --max-budget-usd and --json-schema.

How do I skip permission prompts in Claude Code?

--dangerously-skip-permissions starts the session in bypassPermissions mode, which is the same as --permission-mode bypassPermissions. Anthropic says to run such sessions only inside a container, VM or the sandbox runtime, and on Linux and macOS the CLI refuses the flag when run as root.

How do I pick a model from the command line?

Pass --model with an alias such as sonnet, opus, haiku or fable, or a full model name. It overrides the model setting and ANTHROPIC_MODEL for that session. Add --fallback-model with a comma-separated list to switch models automatically when the primary one is overloaded.

What is the difference between --bare and --safe-mode?

--bare is for fast scripted runs: it skips hooks, skills, plugins, MCP servers, auto memory and CLAUDE.md and keeps only Bash, file read and file edit tools. --safe-mode is for troubleshooting: it turns off your customizations but keeps authentication, model selection, built-in tools and permissions working normally.

More in Claude Code

All guides

Keep your prompts and skills in one place, in your own GitHub. Install every skill with one command.

Get started

Kipt is an independent product, not affiliated with or endorsed by Anthropic, OpenAI, Cursor or GitHub. Claude, ChatGPT, Codex, Cursor and GitHub are trademarks of their owners.