loading
loading
Running Claude Code non-interactively from the command line so it executes a prompt and exits, no chat UI.
Headless mode (claude -p "..." / --print) runs a single prompt to completion and prints the result, optionally as JSON or a stream, making the agent scriptable in pipelines, cron jobs, and CI. There's no human in the loop, so you lean on permission flags, allowed-tools, and hooks to keep it safe. Example: a GitHub Action that runs claude -p 'fix the failing test and open a PR' on every red build. It's how you turn an interactive coding assistant into automation infrastructure.
Plainly
Think of Headless Mode as the checklist that keeps the app open for real people. Running Claude Code non-interactively from the command line so it executes a prompt and exits, no chat UI.
In practice
Use it when a change has to survive deploys, users, incidents, analytics, or billing reality. In practice, define the owner, input, output, and failure mode before you rely on it.