Agent turn traces

One column per API call (a turn); the agent's tools in that turn below the token bars. The top rows show what each turn costs: the context re-sent from the prompt cache, the new context written to it (tool results, the agent's own words) and the output. The file rows show where the agent read, searched and edited. Hover a cell for details, click a turn to list its commands; the ▸ next to "Re-sent from cache", "New, written to cache" and "Tool calls" opens their breakdown.

lines read (file) · context re-sent from cache (tokens) lines edited (file) · new context written to cache: tool results (tokens) … the agent's previous output, now context … session setup (first turn: dynamic system prompt, listings, CLAUDE.md, task prompt) … reminders, injected instructions shared prefix re-sent from cache: static system prompt and tool definitions, the same in every session lines of search output naming the file output tokens tool chips: S search · R read · E edit · B build/test · G git · ✓ final answer
Drop a trace JSON here (made with scripts/turn_trace.py --transcript ~/.claude/projects/<cwd slug>/<session>.jsonl from any Claude Code session) to render it.

Reading the bars: the blue bar grows every turn because the whole conversation so far is re-sent with each call, and the thin slice on top of it is what the turn added, which the next turn re-sends in blue; the second row shows that slice alone: the results of the tools it called last turn (orange, estimated at 2.3 characters per token, the rate measured on these transcripts), the agent's own previous words and tool calls (green), on the first turn the session setup (yellow: the session-specific system prompt sections, the skill and agent listings, CLAUDE.md, the task prompt) and later the per-turn reminders and instructions the CLI injects (grey). The light-blue base of every blue bar is the static prefix shared by all sessions, the fixed system prompt and the tool definitions, which the CLI keeps cached, so even the first call reads it rather than writing it. The cost of a session is mostly the area under the blue bars, so the number of turns and what each one appends matter more than any single read. Lines attributed to files are those in tool output: a Read or cat/sed/head of the file counts as read lines, an Edit as edited lines, a grep output line naming the file as a search hit.