Interactive Playbook

Understand Claude Code from real code paths

Language
Theme

Execution Flows

Trace the important chains

These flow maps help you understand Claude Code as a running system rather than a pile of files.

Flow control board

Execution Panorama

Prompt intakeREPL, queued commands, attachmentsInput normalizationslash commands, hooks, pasted contentQuery loopmodel stream, retries, compaction, turn controlPermission gatemode, policy, auth state, risk classificationTool schedulingparallel-safe batches, serial batches, streaming executionPersistencetranscript durability, resume state, artifactsRendered outputincremental UI, notifications, next-turn context
REPLInput ProcessingQuery LoopTool RuntimeSession StorageUser promptnormalize prompt / commands / attachmentsstream model outputdispatch tool callspersist transcript + artifactsrender updates back to UI

Diagram views

Interactive turn sequence

How one user turn moves through REPL, query, tools, and storage.

Interactive turn sequence

Source anchors

Prompt ingestion

The REPL and input processor turn free-form user actions into structured runtime work.

  • src/screens/REPL.tsx
  • src/utils/processUserInput/processUserInput.ts

Query phase

The query loop coordinates model streaming, tool emission, and transcript updates.

  • src/query.ts
  • src/QueryEngine.ts

Persistence handoff

Transcript durability is a visible part of the normal turn lifecycle.

  • src/utils/sessionStorage.ts

Focused reading

If you care about turn mechanics

Read the prompt intake, query loop, and persistence panels in order. That gives you the cleanest model of a Claude Code turn.

Focused reading

If you care about control and safety

Read tool scheduling and permission resolution together. Those two panels explain most of the engineering discipline in the runtime.

Why this flow matters

Interactive Turn: input to streamed answer

The standard path for understanding how Claude Code works at runtime.

This flow connects REPL, input normalization, query orchestration, persistence, and rendering.

1

REPL captures prompt and queued commands

The UI gathers prompt text, attachments, and queued command metadata.

  • src/screens/REPL.tsx
  • src/components/PromptInput/
2

Input is normalized and hook-aware

Plain text, slash commands, and attachments go through one normalization layer.

  • src/utils/processUserInput/processUserInput.ts
3

Query loop drives model and tool phases

The runtime streams model output, reacts to tool blocks, and manages retries or compaction.

  • src/query.ts
  • src/QueryEngine.ts
4

Messages are persisted before and after execution

Session storage keeps transcript durability and resume compatibility.

  • src/utils/sessionStorage.ts
5

REPL renders stream, tools, and notifications

The UI updates incrementally instead of waiting for the whole turn.

  • src/screens/REPL.tsx
  • src/cli/print.ts