CLI reference - Claude Code Docs
Skip to main content

CLI commands

You can start sessions, pipe content, resume conversations, and manage updates with these commands: 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?. As of v2.1.199, claude --dangerously-skip-permissions daemon <subcommand> runs the daemon subcommand. Earlier versions treated daemon <subcommand> as the prompt for a new interactive session, so the subcommand never ran when the flag came first, a common setup when claude is aliased to include the flag. Only a leading --dangerously-skip-permissions or --allow-dangerously-skip-permissions routes to daemon this way; any other leading flag still starts an interactive session.

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.

System prompt flags

Claude Code provides five flags for customizing the system prompt. Four set its text, and with --system-prompt-snapshot you control whether a conversation keeps the text it started with. All five work in both interactive and non-interactive modes. --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. 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.

System prompt flags in resumed conversations

By default, Claude Code builds the system prompt once, on a conversation’s first request, with the text from any system prompt flags applied, and records it in the session. Until the conversation is compacted, every later request uses that recorded prompt, including after you return to the conversation with --resume or --continue. If you pass different system prompt flag text, or none, on that later launch, it takes effect once the conversation is compacted or when you start a new conversation. Recording applies in sessions that fetch feature flags, as sessions signed in with a claude.ai or Console account do by default. On Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and in other sessions that don’t fetch them, Claude Code rebuilds the prompt on every request and --system-prompt-snapshot has no effect. If you start Claude Code in bare mode, by passing --bare or setting CLAUDE_CODE_SIMPLE=1, recording stays off unless you pass --system-prompt-snapshot on. To rebuild the prompt on every request instead, for example while you iterate on its wording across --continue runs, pass --system-prompt-snapshot off. Before v2.1.265, passing any of the system prompt flags also turned recording off unless you passed --system-prompt-snapshot on.

See also