Study FAQ
How should I choose a Claude Code operating mode and output format?
Also asked as 2
- When should I use Claude Code interactively or automate it with text, JSON, or streaming JSON?
- How do Claude Code headless output and auto mode affect an automated run?
Answer
Use Claude Code interactively when you expect clarification, inspection, or action-by-action review. For a script, use claude -p and pick the output format by what the caller needs. The default text format is readable, --output-format json returns a structured result, and --output-format stream-json produces newline-delimited JSON events. Choose permissions separately.
For text deltas as they are generated, the current CLI documents --output-format stream-json --verbose --include-partial-messages. Parse each complete line, route messages by type, and check the relevant result event. Background work can yield further events or turns after a result event. Check process termination, timeouts, and task-specific verification before recording success.
Set the working directory, tool scope, credential source, and failure policy explicitly. Auto mode uses a classifier for calls its decision flow sends to review. The current documentation lists auto mode on all plans with supported models and providers, subject to organization policy and the installed version. Starting defaults vary by client, invocation, and version. Verify the effective mode because an unavailable auto mode can start in Manual. Keep explicit application approval where the task requires it.
Full explanation
Claude Code Operation, Configuration, and Extension Surfaces
Study guide · CCDV-F
Read the full explanation