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

Interaction Modes — Interactive, -p, -c, -r

~16 min · modes, interactive, print, continue, resume, scripting

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

Four flags that cover 95% of how you'll use the CLI

Claude Code's interaction model is small on purpose: one default mode, three flag-toggled variants. Once you can answer "which one for this job?" instantly, you stop fighting the tool.

Default — interactive. claude with no flags drops you into the streaming REPL. Persistent conversation, multi-turn tool calls, free-form exploration. This is the mode to think in.

-p / --print. Single-shot. Prompt in, answer to stdout, exit. Pipes natively into the Unix world. The mode for cron jobs, GitHub Actions, and any script that needs an AI step.

-c / --continue. Resume the most recent session as if you never closed the terminal. Conversation history intact. The "I came back to my desk" command.

-r <id> / --resume. Resume a specific named session. Use it when you have multiple parallel threads and need to pick the right one. claude --list-sessions shows the inventory.

Code

Print mode is the secret weapon·bash
# Trivial: one-shot Q&A
claude -p "what does jq -r do?"

# Real: pipe the staged diff into AI review
git diff --staged | claude -p "review for bugs and missing tests"

# Compose: read a file in, write to another
claude -p "convert this README to a one-paragraph elevator pitch" \
  < README.md > pitch.md

# JSON for downstream parsing
claude -p "list every TODO in src/" --output-format json | jq '.result'
Resume after a long break·bash
# Pick up the last conversation, full context restored
claude -c

# Continue with a follow-up
claude -c "now write the integration tests for what you just wrote"

# Multiple parallel projects? List and pick
claude --list-sessions
claude -r "abc123def456"

External links

Exercise

Pick a real diff from a real branch. Run two reviews of it: once interactively (claude, paste diff, ask for review) and once via git diff | claude -p. Note the difference in your workflow — which felt right for what?

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.