Parsing Claude Code Session Transcripts in Python: Turns, Tool Calls, and Results A developer documented how Claude Code silently writes each session to an append-only JSONL transcript under ~/.claude/projects//.jsonl, and showed how to parse those files in Python to extract conversation turns, tool_use blocks, and their matching tool_result blocks by id. The approach uses two passes to join calls to results by tool_use_id and skips torn final lines so live sessions can still be analyzed. Every time I run Claude Code, it quietly writes the entire session to disk. No flag, no setup, no instrumentation. The file is already there when I want it. That single fact is the reason I have been able to build small analysis tools on top of my own agent runs without ever touching the agent itself. In this tutorial I want to show you how to read those files and pull real structure out of them: the turns, the tool calls, and the results those calls produced. I learned this the boring way, by reading a real 34MB transcript line by line, so everything below is grounded in shapes I actually saw on disk rather than shapes I hoped were there. Claude Code stores one file per session under: ~/.claude/projects/