Answer: Add the `-p` (or `--print`) flag to any `claude` command to run it non-interactively, for example `claude -p "What does the auth module do?"`. Status: Confirmed Entry: tool/claude-code/agents-and-automation/run-non-interactively Revision: 3 Digest: sha256:9e4f62c348ed95b3 (changes whenever the content changes) Timeline: Created: 2026-11-13T03:04:20Z Last changed: 2026-11-19T12:16:44Z (bare mode example: claude --bare -p "Summarize README.md" --allowedTools "Read" → —) Last verified: 2026-11-20T12:21:12Z Next check: 2026-11-21T12:21:12Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of flag | -p | [1] | 2026-11-20 long flag | --print | [1] | 2026-11-20 example command | claude -p "What does the auth module do?" | [1] | 2026-11-20 recommended mode | --bare | [1] | 2026-11-20 success exit code | 0 | [1] | 2026-11-20 Sources: [1] Anthropic. "Run Claude Code programmatically". https://code.claude.com/docs/en/headless.md Role: primary. Accessed: 2026-11-20T12:21:12Z Quote: "Add the `-p` (or `--print`) flag to any `claude` command to run it non-interactively." (Supports: flag, long flag) Quote: "claude -p "What does the auth module do?"" (Supports: example command) Quote: "`--bare` is the recommended mode for scripted and SDK calls, and will become the default for `-p` in a future release." (Supports: recommended mode) Quote: "Claude Code exits with code 0 on success and a non-zero code when the run fails" (Supports: success exit code) Published: 2026-11-20T02:53:01Z Snapshot SHA-256: eae22eba29efbd00b5b2592bd64774ffd337ad0efe7645c4c842954c2d9cbcdd (captured 2026-11-20T12:21:14Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. Cross-check: not-available at 2026-11-20T12:21:12Z. No independent second source is configured for this entry Last successful check: 2026-11-20T12:21:12Z Last attempt: 2026-11-20T12:21:12Z Notes and limitations: Extracted automatically from a single official source (section "Basic usage"). Related: https://latestn.com/tool/claude-code/agents-and-automation/run-plugin-evals-in-ci How do I run Claude Code plugin evals in CI and gate on the score? https://latestn.com/tool/claude-code/agents-and-automation/run-prompt-fixed-interval How do I run a prompt repeatedly on a fixed interval in Claude Code? https://latestn.com/tool/claude-code/agents-and-automation/scale-concurrency-hosting How do I scale and handle concurrency when hosting the Claude Code Agent SDK? https://latestn.com/tool/claude-code/agents-and-automation/resume-session-from-store How do I resume a Claude Code Agent SDK session from an external session store? https://latestn.com/tool/claude-code/agents-and-automation/rewind-files-to-previous-state How do I rewind files to a previous state in Claude Code using rewindFiles()? https://latestn.com/tool/claude-code/agents-and-automation/run-bundled-workflow How do I run a bundled workflow in Claude Code? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-19T12:16:44Z | changed | bare mode example: claude --bare -p "Summarize README.md" --allowedTools "Read" → — | [1] 2026-11-16T12:09:21Z | changed | bare mode example: — → claude --bare -p "Summarize README.md" --allowedTools "Read" | [1] 2026-11-13T03:04:20Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/claude-code/agents-and-automation/run-non-interactively/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/claude-code/agents-and-automation/run-non-interactively POST: https://latestn.com/dispute/tool/claude-code/agents-and-automation/run-non-interactively with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/claude-code/agents-and-automation/run-non-interactively?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How do I run Claude Code non-interactively from the command line? Revision 3, last verified 2026-11-20T12:21:12Z. https://latestn.com/tool/claude-code/agents-and-automation/run-non-interactively (accessed 2026-11-21T10:01:30Z). @misc{LatestN_tool_claude_code_agents_and_automation_run_non_interactively_r3, title = {How do I run Claude Code non-interactively from the command line?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/claude-code/agents-and-automation/run-non-interactively}}, note = {Revision 3; digest sha256:9e4f62c348ed95b3; last verified 2026-11-20T12:21:12Z; accessed 2026-11-21T10:01:30Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/claude-code/agents-and-automation/run-non-interactively