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

Interactive, Print, Automation 세 모드

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

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

한 CLI, 세 모드

제대로 된 AI CLI 는 다 세 가지 실행 모드를 갖고 있고, 셋이 근본적으로 다른 일에 매핑돼. flag 치기 전에 어느 모드 쓸지 알아두는 게 중요해 — "CLI 가 안 되네" 의심 대부분이 모드 혼동이야.

Interactive (기본). 라이브 REPL. 입력하면 streaming 답이 오고, 중간에 redirect 도 되고, Esc 누르면 인터럽트 돼. 탐색, 디버깅, mid-task 전환은 여기서. 대화 state 는 메모리에 있고, 터미널 닫으면 날아가 (id 로 resume 안 하면).

Print / exec / non-interactive. 단발성. exits when done, stdout 으로 출력. 같은 모델이 돌지만 UI 도, streaming 도, follow-up 도 없어. script 짜는 모드: claude -p, codex exec, gemini -p. pipe 되고, 다른 도구랑 합성되고, cron 에도 박혀. 같은 prompt 두 번 copy-paste 하고 있으면 print 모드로 갈아타야 해.

Automation / cloud. 장기 실행, 사람 개입 없음. background agent, GitHub Actions, scheduled job. 같은 엔진인데 미리 승인된 도구 (--allowedTools) 라서 클릭할 게 없어. Automation = print 모드 + 권한 스토리 + 로깅 스토리.

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

설치한 (또는 설치할) CLI 중 하나 골라. git diff HEAD~5 를 print 모드로 파이프하면서 "무슨 변화가 있었는지 요약하고 위험해 보이는 거 플래그해" prompt 넣어. output 파일로 저장. 같은 prompt 를 interactive 로 돌렸을 때랑 워크플로우가 어떻게 달랐는지 terminal-quest 일지에 적어.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.