Course B · Module B2 Going Agentic · Lesson 13 of 18
The transcript of every step your agent took is already on disk. Learning to read it turns a black box into something you can supervise and fix.
You deployed an agent. It ran. But what exactly did it do? If you can't answer that, you don't really own it — you just hope it did the right thing. Session logs are your answer. Claude Code writes a complete transcript of every session to disk automatically: the goal you set, every tool it called, every result it got back, every piece of reasoning it did in between. Your single win: by the end of this lesson you'll know where to find that file, how to read it, and how to use it to find exactly where things went sideways — the same debugging loop you learned in Course A, now applied to agents.
A session log is a line-by-line record of the agent's full loop. Each entry is one of these four types:
Claude Code stores sessions as .jsonl files (one JSON object per line)
under ~/.claude/projects/<your-project>/. You can open them in any text
editor, or pipe them through a formatter to make them readable.
# Find your session files ls ~/.claude/projects/ # Pretty-print the latest session log cat ~/.claude/projects/<project>/<session>.jsonl \ | python3 -m json.tool
This is the debugging loop from Course A, applied to agents. Same posture — start at the point of failure and work backwards:
A session log is like flight-recorder data. After an incident, investigators don't guess — they read the tape: altitude, heading, control inputs, cockpit conversation, one second at a time, working from the moment of failure backwards to the cause. You're doing the same thing. The log is your tape.
Tool calls are the lines in the log you must review for any agent that touches live data — a database, email, or external API. Before you declare an agent safe to run unsupervised, go through at least one full session log and ask for every tool call:
Answer before opening — recalling it now is what makes it stick.
The tool call entry for send_email — specifically the arguments it passed. That line will show you exactly what address the agent passed to the tool. Then look one entry earlier at the reasoning step: where did it get that address from? Was it pulled from a bad search result, a misread file, or an ambiguous goal? Trace back from the call to the root.
Under ~/.claude/projects/<project-name>/ as .jsonl files — one JSON object per line, one file per session. You can open them in any text editor or format them with a JSON tool.
Because the final output only tells you what the agent produced — not what it did along the way. A tool call is an action on the outside world: it sent an email, deleted a record, ran a query. The final answer can look correct while a tool call mid-run did something unintended. Auditing tool calls is how you catch side-effects, not just bad answers.
Read this next (primary source)
Monitoring usage — Claude Code Docs.
The official reference for session storage paths, OpenTelemetry integration, and the
event log format. Start with the session storage section — it shows you exactly where
your .jsonl files live and what each field means.
See RESOURCES.md for more.
Terms from this lesson — debugging, agent, human-in-the-loop, action — are in the course glossary. Keep it open.