Claude Code CLI reference
Every documented Claude Code CLI flag and command, organized by what you're trying to do. The canonical source is code.claude.com/docs/en/cli-reference; this page groups the same facts by intent and cross-links the deeper guides we've written.
claude --bare -p "$PROMPT" \
--permission-mode dontAsk \
--settings '{"permissions":{"allow":["Read","Edit","Bash(npm test)"]}}' \
--max-turns 40 \
--max-budget-usd 3 \
--output-format stream-json --verbose --include-partial-messages--bare for reproducibility, --permission-mode dontAsk for bounded authority, a narrow allow list, --max-turns + --max-budget-usd as safety nets, and --output-format stream-json so you can watch the run.
Commands
The top-level claude subcommands.
claudeclaude "query"claude -p "query"cat file | claude -p "query"claude -cclaude -r "<session>" "query"claude updateclaude auth loginclaude auth statusclaude agentsclaude auto-mode defaultsclaude mcpclaude pluginclaude remote-controlclaude setup-tokenHeadless mode essentials
The headless mode guide →The flags that turn claude into a one-shot CLI you can script against. Start here if you're building anything unattended.
--print, -pclaude -p "query"--bareDeep dive: --bare →claude --bare -p "query"--output-formatDeep dive: stream-json →claude -p "q" --output-format json--input-formatclaude -p --input-format stream-json --output-format json--include-partial-messagesclaude -p --output-format stream-json --verbose --include-partial-messages "query"--include-hook-events--verbose--replay-user-messagesPermissions and tools
Deep dive: the 6 permission modes →How Claude decides what it can do without asking. There are six permission modes and three ways to narrow the allowlist.
--permission-modeclaude --permission-mode dontAsk--allowedToolsclaude --allowedTools "Bash(git:*),Read,Edit"--disallowedToolsclaude --disallowedTools "Bash(rm *),Edit"--toolsclaude --tools "Bash,Edit,Read"--dangerously-skip-permissions--allow-dangerously-skip-permissions--enable-auto-mode--permission-prompt-toolLimits and budgets
The safety net behind the safety net. Set these on every unattended run.
--max-turnsclaude -p --max-turns 40 "query"--max-budget-usdclaude -p --max-budget-usd 5.00 "query"--fallback-modelclaude -p --fallback-model sonnet "query"Model and effort
Which model runs the session and how hard it tries.
--modelclaude --model claude-sonnet-4-6--effortclaude --effort highSystem prompt and context
The four prompt-shaping flags and the handful of context flags around them. For scripted runs, appending beats replacing — you keep Claude Code's built-in capabilities.
--append-system-promptclaude --append-system-prompt "Always use TypeScript"--append-system-prompt-fileclaude --append-system-prompt-file ./style-rules.txt--system-prompt--system-prompt-file--exclude-dynamic-system-prompt-sections--add-dirclaude --add-dir ../apps ../lib--settings--setting-sourcesMCP servers
Bring Model Context Protocol servers into the session. Pair with --bare for reproducibility.
--mcp-configclaude --mcp-config ./mcp.json--strict-mcp-configAgents and plugins
Subagents and plugin loading for this session.
--agent--agents--plugin-dir--disable-slash-commandsSession management
Continue, resume, name, fork, or discard sessions.
--continue, -cclaude -c -p "follow-up question"--resume, -rclaude --resume auth-refactor--session-id--fork-session--name, -nclaude -n "feature-work"--no-session-persistence--from-prclaude --from-pr 123Worktrees and panes
Deep dive: git worktree →Run isolated Claude Code sessions in their own git worktrees. Every background agent ends up doing this.
--worktree, -wclaude -w feature-auth--tmuxStructured output
Schema-driven results, for when you're piping into automation that doesn't want to guess.
--json-schemaclaude -p --json-schema '{"type":"object",...}' "query"Debug and diagnostics
When something is wrong and you need to know why.
--debugclaude --debug "api,mcp"--debug-file <path>--betas--init--init-only--maintenance--version, -vIDE and browser
Connect to external surfaces.
--ide--chrome--no-chromeWeb and remote sessions
Control Claude Code from claude.ai, or kick off a cloud session.
--remoteclaude --remote "Fix the login bug"--remote-control, --rc--remote-control-session-name-prefix--teleportChannels and agent teams
Research previews.
--channels--dangerously-load-development-channels--teammate-modeYou now know every flag. Cyrus wires them up for you.
Worktree isolation, bare mode, narrow allowlists, stream-json piped to the Linear issue as it updates — all the reference patterns on this page, already shipped, BYOK across Claude/Codex/Cursor/Gemini. Community self-hosted is free forever.
Try Cyrus free →