Three-Stage Message Pipeline

Description

Southbridge Research architectural analysis: Claude Code maintains three simultaneous representations of every message. Stage 1 CliMessage — CLI internal representation with UUID, timestamp, type discriminator, and embedded APICompatibleMessage. Stage 2 APIMessage — clean API wire format with role and content only, no CLI-specific fields. Stage 3 StreamAccumulator — streaming partial representation holding deltas and per-tool_use_id JSON buffers. The separation allows progress indicators, partial rendering, and UUID tracking while keeping the API payload minimal and correct.

Key claims

Relations

Sources

src-20260423-542f02260352