BACK_TO_FEEDAICRIER_2
Claude Code runs headless with `--print`
OPEN_SOURCE ↗
REDDIT · REDDIT// 13d agoTUTORIAL

Claude Code runs headless with `--print`

A Reddit post points out that Claude Code can run non-interactively with --print, letting you pipe in a prompt and capture the result in scripts or automation. That makes it easy to slot into CI/CD jobs, git hooks, and bash workflows.

// ANALYSIS

This is less a launch than a workflow unlock: --print turns Claude Code into a scriptable primitive, which is exactly where many AI coding tools still feel half-finished. The tradeoff is that it behaves like a batch command, so it shines for one-shot jobs more than interactive agent loops. That makes it easy to embed in CI/CD, pre-commit hooks, release scripts, and other local automation, and non-interactive output is ideal for quick transformations, scaffolding, and other deterministic tasks. Anthropic documents headless mode in the official Claude Code docs, so this is supported behavior rather than a brittle hack. If you need streaming feedback or longer tool loops, Anthropic's Agent SDK is a better fit, and the no-streaming caveat means this is better for batch jobs than live supervision.

// TAGS
claude-codecliautomationai-codingdevtool

DISCOVERED

13d ago

2026-03-29

PUBLISHED

14d ago

2026-03-29

RELEVANCE

8/ 10

AUTHOR

prompt_tide