C.W.K.
Stream
Lesson 02 of 04 · published

Interactive, Print, and Automation Modes

~16 min · modes, interactive, scripting, non-interactive

Level 0🌱 Novice
0 XP0/70 lessons0/11 achievements
0/120 XP to next level120 XP to go0% complete

Three modes, one CLI

Every serious AI CLI ships three execution modes, and they map onto fundamentally different jobs. Recognize which mode you want before typing a flag — most "the CLI doesn't work for me" stories are mode confusion.

Interactive (default). A live REPL. You type, it streams a response, you redirect mid-thought, you press Esc to interrupt. This is where exploration, debugging, and mid-task pivots happen. Conversation state is in memory; close the terminal and it's gone unless you resume by id.

Print / exec / non-interactive. Single-shot, exits when done, writes to stdout. The same model running, but no UI, no streaming, no follow-up. This is the mode you script around: claude -p, codex exec, gemini -p. It pipes, it composes with other tools, it cron-jobs. If you find yourself copy-pasting a prompt twice, switch to print mode.

Automation / cloud. Long-running, no human in the loop. Background agents, GitHub Actions runs, scheduled jobs. Same engine, but with pre-approved tools (--allowedTools) so there's nothing to click on. Automation is print mode plus a permission story plus a logging story.

Code

All three modes side by side (Claude Code)·bash
# Interactive — REPL session, conversation state in memory
claude
claude "explain the auth flow then suggest two refactors"

# Print — one shot, stdout out, exit
claude -p "summarize today's git log" > today.md
git diff HEAD~1 | claude -p "review for bugs"

# Resume — pick up an interactive session by id
claude -c                    # most recent
claude -r "abc123def456"     # specific id

# Automation — pre-approved tools, no prompts
claude -p "fix lint errors" \
  --allowedTools "Read,Edit,Bash(npx eslint *)" \
  --output-format json
Three CLIs, same mode shape·bash
# Print mode is the universal automation primitive
claude -p     "review the staged diff" < /dev/stdin
codex exec    "review the staged diff" --output-last-message
gemini -p     "review the staged diff"

# All three: read stdin or args, write stdout, exit cleanly

External links

Exercise

Pick any one of the three CLIs you have installed (or will install). Pipe git diff HEAD~5 into print mode with the prompt "summarize what changed and flag anything that looks risky." Capture the output to a file. Note in your terminal-quest journal: how was that different from running the same prompt interactively?

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.