0PricingLogin
Claude Architect · Lesson

Interactive vs Headless

Conversational sessions vs scripted, non-interactive runs.

Two Ways to Run Claude Code

Claude Code runs in two fundamentally different modes, and choosing the right one is a real architectural decision.

  • Interactive: a conversational session. You type, Claude responds, you steer, it asks for approvals. A human is in the loop.
  • Headless (non-interactive): a single scripted invocation that runs to completion with no human present. Built for pipelines and automation.

Same engine, very different control model. This lesson shows when each one wins.

The Headless Flag

You switch into headless mode with -p (also written --print). It runs the prompt once, prints the result, and exits. No back-and-forth, no TTY required.

This is the required form for CI/CD pipelines: there is no human to answer prompts inside a build job, so an interactive session would simply hang.

# Interactive: opens a conversational session
claude

# Headless: runs once and exits (required in pipelines)
claude -p "Review the staged diff and flag correctness bugs"

All lessons in this course

  1. What Is Claude Code
  2. Interactive vs Headless
  3. The Read / Edit / Write Loop
  4. Memory & Compact Commands
← Back to Claude Architect