Choose an execution mode
Interactive for collaborative work; print mode for bounded automation; background mode for work that should keep running.
OPERATOR GUIDE / 2.1.220
A practical route through Claude Code: choose the right execution mode, preserve context, control authority, connect tools, and verify what actually loaded.
Open the exhaustive reference →Interactive for collaborative work; print mode for bounded automation; background mode for work that should keep running.
Continue the newest project session, resume by ID or name, and attach to background work without losing its transcript.
Permission mode, allowed tools, sandbox settings, and safe mode determine what the agent may do.
Pick the configuration scope, inspect approval and health, then authenticate remote servers separately.
Plugins distribute components; skills teach workflows; hooks observe or gate lifecycle events.
Monitor background sessions, inspect logs, and use doctor and the source ledger before assuming behavior.
CHAPTER / 01
claude runtime-confirmed Start Claude Code interactively, run a headless prompt, or manage a session.
claude -p, --print Print a non-interactive response and exit.
none--background, --bg Control Claude Code background behavior.
none--output-format Select print-mode output: text, json, or stream-json.
noneUse print mode with bounded turns, structured output, and explicit permissions for scripts and CI.
claude -p --max-turns 8 "Review the current diff" Print mode writes the final response and exits.
claude -p --output-format json --json-schema '{"type":"object"}' "Summarize the diff" JSON output and a schema make downstream parsing explicit.
claude -p --allowed-tools "Read" "Grep" "Bash(git diff *)" "Review this change" Narrow permission rules keep automation bounded.
CHAPTER / 02
claude runtime-confirmed Start Claude Code interactively, run a headless prompt, or manage a session.
claude claude attach runtime-confirmed Attach this terminal to a background session.
claude logs runtime-confirmed Print recent terminal output for a background session.
-c, --continue Continue the most recent conversation in the current directory.
none-r, --resume Resume a session by ID or name, or open the session picker.
none-n, --name Name the session.
noneContinue the latest conversation, resume a named session, or attach to a background session.
claude --continue Loads the most recent conversation associated with this directory.
claude --resume auth-refactor Resumes by session ID or user-assigned name.
claude attach 7c5dcf5d Connects the current terminal while the session keeps running.
CHAPTER / 03
claude runtime-confirmed Start Claude Code interactively, run a headless prompt, or manage a session.
claude --permission-mode Start in a selected permission mode.
review--allowed-tools, --allowedTools Grant matching tools without a permission prompt.
review--safe-mode Control Claude Code safe mode behavior.
none--dangerously-skip-permissions Control Claude Code dangerously skip permissions behavior.
highChoose a permission mode, add narrow allow rules, and keep bypass mode visibly high risk.
claude --permission-mode plan Plan mode supports repository analysis before edits.
claude --allowed-tools "Read" "Grep" "Bash(git diff *)" Tool-pattern rules are safer than broad shell access.
claude --safe-mode Safe mode disables project customizations, hooks, plugins, skills, and MCP.
CHAPTER / 04
claude mcp add runtime-confirmed Add a stdio, SSE, or HTTP MCP server.
claude mcp add --transport http sentry https://mcp.sentry.dev/mcp claude mcp get runtime-confirmed Inspect one configured MCP server and its approval state.
claude mcp get sentry claude mcp login runtime-confirmed Run the OAuth flow for a configured remote MCP server.
claude mcp login sentry --no-browser claude mcp serve runtime-confirmed Expose Claude Code tools as a local stdio MCP server.
claude mcp serve Register a server at the intended scope, inspect it, and run OAuth separately when required.
claude mcp add --transport http sentry https://mcp.sentry.dev/mcp --scope user Choose local, user, or project scope deliberately.
claude mcp get sentry Unapproved project servers remain pending and are not connected.
claude mcp login sentry --no-browser Prints an authorization URL rather than opening a browser.
CHAPTER / 05
claude plugin marketplace add runtime-confirmed Register a plugin marketplace source.
claude plugin marketplace add anthropics/claude-plugins-official claude plugin install runtime-confirmed Install a plugin from a configured marketplace.
claude plugin install code-review@claude-plugins-official claude plugin details runtime-confirmed Show a plugin component inventory and projected token cost.
claude plugin details code-review claude plugin validate runtime-confirmed Validate plugin structure and metadata.
claude plugin validate ./my-plugin --strict --plugin-dir Load plugins from directories for this session.
reviewAdd a trusted marketplace, install at a scope, then inspect the loaded skills and hooks in-session.
claude plugin marketplace add anthropics/claude-plugins-official Marketplace sources determine which plugins are installable.
claude plugin install code-review@claude-plugins-official --scope project Project scope shares plugin policy with the repository.
Use /skills, /hooks, and /plugin inside Claude Code to verify what loaded.
CHAPTER / 06
claude agents runtime-confirmed Open agent view or query active background sessions.
claude agents --json claude logs runtime-confirmed Print recent terminal output for a background session.
claude stop runtime-confirmed Stop a background session while retaining its conversation.
claude respawn runtime-confirmed Restart a background session with its conversation intact.
--agent Use a named agent for this session.
review--agents Define session subagents with a JSON object.
review--background, --bg Control Claude Code background behavior.
noneDefine a session agent, start work in the background, and inspect active sessions as JSON.
claude --background --agent reviewer "Review the current branch" The command returns a session ID for later management.
claude agents --json JSON mode supports external monitoring and orchestration.
claude logs 7c5dcf5d Inspect progress without attaching to the session.
CHAPTER / 07
claude runtime-confirmed Start Claude Code interactively, run a headless prompt, or manage a session.
claude -p, --print Print a non-interactive response and exit.
none--max-turns Limit agentic turns in print mode.
none--max-budget-usd Stop print-mode execution at an approximate dollar budget.
none--json-schema Validate print-mode structured output against a JSON Schema.
none--input-format Select print-mode input: text or stream-json.
none--output-format Select print-mode output: text, json, or stream-json.
noneUse print mode with bounded turns, structured output, and explicit permissions for scripts and CI.
claude -p --max-turns 8 "Review the current diff" Print mode writes the final response and exits.
claude -p --output-format json --json-schema '{"type":"object"}' "Summarize the diff" JSON output and a schema make downstream parsing explicit.
claude -p --allowed-tools "Read" "Grep" "Bash(git diff *)" "Review this change" Narrow permission rules keep automation bounded.
CHAPTER / 08