Under ~/.claude/projects/ on your Mac. There is one folder per project
directory and one file per session, and they hold everything needed to work out where your tokens went.
The layout
~/.claude/projects/
<project folder>/
<session id>.jsonl the main session
<session id>/subagents/
agent-<id>.jsonl one file per subagent
Each file is a list of records, one per line. The useful ones for cost are the assistant replies. Each carries a timestamp, the model, and a usage block with four counts: fresh input, input written to the cache, input read from the cache, and output.
What you can work out
- Size per turn: add the three input counts for a reply. That is how much the session re-read to produce it.
- Starting size: the same sum for the first reply in the file.
- Tokens per day and per session: add up the replies by date and by file.
- The session's name: a title record, or failing that the first thing you typed.
Two traps
- One reply, several lines. A reply is written once for each part of it (the thinking, the text, each tool call), and every one of those lines repeats the same usage numbers. In one checked session, 27 replies were spread over 63 lines. Count by the reply's message id, or your totals will be far too high.
- Subagents are one folder down. A search that only looks at the top level misses them completely.
Codex keeps logs too
Codex writes its sessions under ~/.codex/sessions/, grouped by date. Each model reply has a usage
record with input, cached input and output counts. In those records the input figure already includes the cached
part, which is the opposite of how Claude Code records it.
Reading them without writing a script
Cost Doctor reads both sets of logs, counts each reply once, includes subagents, and shows the result in the menu bar. It only reads the files; it never changes a session.
See it on your own sessions
Cost Doctor is a Mac menu bar app that reads the logs Claude Code and Codex already write. It names the session that is using your tokens, says why, and turns your screen red when a check fails while an agent sits waiting. Nothing leaves your Mac.
Download the free trialHow it works14 days free, no account. Then $19 once, plus tax where it applies. For Apple silicon and Intel Macs on macOS 13 or later.