
Read Claude Code Hooks Output and Logs
Where Claude Code writes hook output, which fields matter, and a one-line jq filter that turns a day of gate fires into a readable markdown log.
Claude Code hooks fire on every tool call, prompt submit, agent stop, and session event. They print structured output to stderr and append to log files you can tail. Most developers set hooks up once, then never open the logs. That is a waste of good signal. The logs explain exactly why an agent took a path, why a tool got blocked, and why a session ended early. You only need a comfortable way to read them.
This guide shows where Claude Code writes hook output, which fields matter, and how to open a day of logs without scrolling through terminal noise. If you already keep a reading setup for AI transcripts, hook logs slot right into the same workflow. The same filters and readers that handle transcripts handle hook JSONL with no extra configuration. You can reuse your existing outline navigation, search, and syntax rendering. The only new piece is a filter line that strips the transcript entries and leaves the gate fires.
Where Claude Code puts hook output
Claude Code runs hooks defined in ~/.claude/settings.json or project-local .claude/settings.json. Each hook is a shell command. The stdout of that command feeds back into the agent, and stderr is captured to the session log. The session log lives inside ~/.claude/projects/<workspace-hash>/<session-id>.jsonl. Every tool call, hook invocation, and stderr line lands there as one JSONL entry per turn. Each entry carries a type field you can filter on.
If you tail that file directly, you will drown in binary metadata, tool schemas, and transcript chunks. What you want is the slim subset: the hook name, the input it received, the exit code, and the stderr payload. A small jq filter does this in one line, and the output is clean markdown-ready text. You can save the filter as a shell alias and run it against any session file in one keystroke. For a longer history view, point the same filter at an entire project folder and pipe the result into a single daily note.
The filter that makes hooks readable
Run this against today's session file to pull the hook entries out. The filter selects only entries tagged as hook events, then rebuilds each one as a small markdown block with a heading, the exit code, and a fenced stderr body. The result is a flat document that opens cleanly in any reader. Save it next to your session notes and you have a timeline of every gate that fired during the day.
jq -r 'select(.type == "hook") | "## \(.hookName)\n**exit:** \(.exitCode)\n```\n\(.stderr)\n```"' \
~/.claude/projects/<hash>/<session>.jsonl > hooks.md
That produces a flat markdown document with one H2 per hook fire. You can open it in Prism MD, paginate through fires with keyboard shortcuts, and search by hook name. If your filter produces broken fences because stderr contains backticks, our note on fixing broken markdown from AI copy paste covers the three cleanups that fix most cases. Save the output next to your session notes so you can cross-reference agent behavior with the gate that shaped it. Small habit, large payoff after a week of use.
Which hook fields carry signal
Not every field matters. In practice four fields tell the story of a session, and the rest are noise you can hide behind a collapsible block. Treat the first pass as a scan, then dig into entries where exit codes jump out. Keep a short list of your own hook names in a cheat sheet so you recognise the gates by muscle memory.
hookName: tells you which gate fired, usuallyPreToolUse,PostToolUse,UserPromptSubmit, orStop.toolName: present on tool-scoped hooks, tells you whether the gate was reacting to a Bash call, an Edit, or a WebFetch.exitCode: a non-zero exit means the hook blocked or warned the agent. This is the single most useful field for debugging surprising agent behavior.stderr: the human-readable reason. Most hook authors write a one-line explanation here. Read the line, close the file, move on.
A clean markdown render puts the four fields in order, each on its own line, and buries the raw JSON in a collapsible block. That is roughly the shape your jq filter should output. Add the timestamp field so you can correlate hook fires with your own notes from the session. For teams, prepend the hostname so you can distinguish who tripped which gate when reviewing a shared log. These small formatting choices turn a wall of events into a scannable timeline.
Reading a full day of hook activity
For a daily review, concatenate every session file from the day into one markdown document. The one-liner below walks the projects folder, pulls files modified since midnight, applies the same filter, and streams the result into a dated note. Thirty seconds of setup, then every morning you open one file and see the whole prior day of gate activity in order. The dated filename makes it trivial to compare today against last Monday and spot drift in your hook config.
find ~/.claude/projects -name "*.jsonl" -newermt "today 00:00" \
-exec jq -r '... same filter ...' {} \; > ~/notes/hooks-today.md
Open the file in your reader of choice. A reader that renders fenced code with proper monospace and syntax hints is useful here, since stderr often contains commands, JSON snippets, or stack traces. The Claude Code archive guide explains the folder layout in more detail if you want to split by project instead of day. One habit that pays off: when a hook blocks you three times in a week with the same stderr, the fix almost always lives in the hook definition, not in your agent prompt. The log tells you where to look. Review once a week and your hook config will drift toward quieter, sharper gates over time.
When to switch readers
Terminal pagers like less work for a quick peek at one file. For reviewing a week of activity, a proper markdown reader wins on three axes: search across files, outline navigation, and readable typography on code-heavy content. Our comparison of Prism MD vs Obsidian for AI conversations applies to hook logs too, since both are structured text with heavy code fences and short prose blocks. If you work on a tablet or phone between sessions, a reader with offline support matters more than feature count. Hook logs are small, so a full week of history fits in a few megabytes and syncs instantly across devices. The reading surface is where the value lands, so pick the one that fits your hands.
FAQ
Where exactly are Claude Code session files stored?
On macOS and Linux, they live under ~/.claude/projects/<workspace-hash>/<session-id>.jsonl. On Windows, replace ~/ with %USERPROFILE%\. The workspace hash is a stable hash of the project root path, so a given repo keeps the same folder across sessions. If you move the project folder, Claude Code creates a new hash and a fresh set of session files under the new path.
Can I pipe hook output somewhere else instead of the session log?
Yes. Any stdout your hook prints goes back to the agent, but you can also write directly from inside the hook to ~/.claude/logs/hooks-$(date +%F).md. This gives you a pre-formatted daily log without a jq step, at the cost of duplicating output in two places. The duplicate is usually worth it for fast grepping and for keeping a readable log even if the raw JSONL gets rotated.
Do hook logs include the full transcript?
No. The session JSONL contains transcript entries too, but the hook entries carry their own type. Filter by type == "hook" to get the gate fires, or drop the filter to read the full session in one pass. Most reviewers keep two files open side by side: the filtered hook log for scanning, and the full transcript for context when a gate looks suspicious.
Will hook logs rotate automatically?
Not by default. Each session file persists on disk until you delete it. A short cron job that gzips files older than thirty days keeps the folder small without losing history, and the gzipped files remain searchable with zgrep. For long-term archives, move the gzipped files to a cold folder outside ~/.claude/projects so Claude Code stops scanning them at startup.
Read your Claude Code hook logs on any device
Free to start — no credit card.
Related reading
Ready to read your own AI documents?
Open ChatGPT, Claude, Gemini, or any markdown file in the reader built for the way models write.
- ✓Renders code, math & Mermaid out of the box
- ✓Works offline once you've opened a doc
- ✓Free forever for personal reading


