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.

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

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