The short answer
To monitor Claude Code, combine four built-in pieces:
- Agent view (
claude agents) for a live list of sessions and which ones need you. - The statusline for context use, cost and model at a glance inside each session.
- Hooks that report waiting, idle, finished and failed states to wherever you look.
- A command log from a
PreToolUsehook, so you can see what actually ran.
Add usage checks with /usage or /cost, and you'll know which session is working, which is stuck and what it's spending.

"claude code monitor" gets about 320 US searches a month at a keyword difficulty of 30 (Semrush, November 2026). Most people searching it run more than one session and have lost one at some point to a permission prompt nobody saw.
What "stuck" usually means
Claude Code sessions rarely crash. They stall, and each stall has a different signal.
| Stall | What you see | Signal to watch |
|---|---|---|
| Waiting on a permission prompt | Nothing moving in a terminal you're not looking at | permission_prompt notification |
| Finished, waiting for your next message | Idle session | idle_prompt notification |
| Waiting on an MCP form | A dialog no one answered | elicitation_dialog notification |
| Looping on a failing command | Lots of activity, no progress | Repeated identical commands in the log |
| Context nearly full | Slower, compaction soon | Context percentage in the statusline |
| Machine asleep | Session paused | No events at all |
Most monitoring setups only catch the last row. The first three are where the time goes.
Agent view: the session list
Agent view is the closest thing Claude Code has to a built-in dashboard. Run claude agents and it lists every background session grouped by state, with the ones that need your input at the top. You can peek, reply or attach without hunting for the right terminal tab.
While agent view is open, Claude Code also sends a terminal notification when a local background session starts needing input, finishes or fails. It's a research preview, so expect changes.
The statusline: one line per session
The statusline is a bar at the bottom of Claude Code that runs a script you choose. The script gets session data as JSON on stdin and prints whatever you like. The fastest way to set one up is to describe it:
/statusline show model, context percentage with a bar, and session cost
Or configure it yourself in ~/.claude/settings.json:
{
"statusLine": {
"type": "command",
"command": "jq -r '\"[\\(.model.display_name)] \\(.context_window.used_percentage // 0)% context · $\\(.cost.total_cost_usd)\"'"
}
}
Useful fields include model.display_name, workspace.current_dir, context_window.used_percentage, cost.total_cost_usd and cost.total_lines_added. Updates are debounced at 300 ms, and refreshInterval re-runs the script on a timer if you show time-based data. The cost figure is an estimate at list price and can differ from your bill. Full setup in Claude Code statusline.
Hooks: report state changes outward
Agent view and the statusline only help when you're looking at the terminal. Hooks push state changes to wherever you are. The Notification event covers the stalls in the table above:
permission_promptafter a prompt has waited about six secondsidle_promptabout 60 seconds after Claude stops and you haven't typedelicitation_dialogwhen an MCP form is waitingagent_needs_inputandagent_completedfor background sessions while agent view is open
Add a Stop hook to record when each turn ends. Send all of these to one place, such as a webhook, a push service or an agent inbox, and you have a live picture across machines. Configs are in Claude Code notifications.
A command log: what actually ran
For "what did it do while I was out", nothing beats a plain log. A PreToolUse hook on Bash that appends each command to a file gives you a timestamped history:
#!/usr/bin/env bash
# ~/.claude/hooks/log-bash.sh
cmd=$(jq -r '.tool_input.command')
echo "$(date -u +%FT%TZ) $(basename "$PWD") $cmd" >> ~/.claude/bash-history.log
exit 0
Loops jump out of this file immediately: the same failing command fifteen times in four minutes. Exit 0 means the hook never blocks anything.
Usage and cost
Run /usage to see your plan's usage, or /cost for the session's spend when you're on API billing. For a running view, put cost.total_cost_usd in the statusline. For a history across sessions, log it from a Stop hook. We build that out in a Claude Code usage dashboard.
Putting it together
| Need | Tool | Where you see it |
|---|---|---|
| Which sessions need me | Agent view, Notification hooks |
Terminal, phone |
| Health inside a session | Statusline | Terminal |
| What ran | PreToolUse command log |
Log file |
| What it cost | /usage, /cost, statusline |
Terminal |
| Sessions on other machines | Hooks sending to one place | Inbox or dashboard |
The last row is the one that grows. Once Claude Code runs on a laptop, a desktop and a VPS, terminal-based views stop covering everything. Sending every machine's hook events to one inbox turns three blind spots into one list.
Thresholds that work
Monitoring only helps if it tells you something you'd act on. These starting thresholds suit most solo and small-team setups:
| Signal | Act when |
|---|---|
| Permission prompt waiting | More than 10 minutes on work that blocks others |
| Idle after finishing | Review within the day, no alert needed |
| Same command repeating | Three identical failures in a row |
| Context used | Above 80%, wrap up or summarize |
| Session cost | Above your per-task ceiling |
| No events from a machine | Longer than its normal working rhythm |
Tune them after a week. If you never act on an alert, raise its threshold or drop it.
A worked example
Picture two sessions on a laptop and one on a VPS. Each machine has the same three hooks: Notification events with permission_prompt and idle_prompt go to an inbox webhook, a Stop hook posts "turn finished" with the folder name, and a PreToolUse logger writes commands to a local file.
At 15:10 the VPS session asks to run a migration. The card reaches your phone with the command shown, and you approve it. At 15:40 one laptop session goes idle after finishing. At 16:05 the other laptop session's log shows the same pytest command failing every 20 seconds; you open it and see a missing environment variable. Three different states, all visible from one place.
Key takeaways
- Agent view shows background sessions and which ones need you.
- The statusline shows context, cost and model inside each session.
NotificationandStophooks report waiting, idle and finished states to wherever you look.- A
PreToolUsecommand log reveals loops and answers what ran while you were away.
FAQ
How do I monitor multiple Claude Code sessions?
Use agent view (claude agents) for background sessions on one machine, and Notification and Stop hooks that send events to a shared place for sessions across machines.
How can I tell if Claude Code is stuck?
Watch for permission_prompt, idle_prompt and elicitation_dialog notifications, and check a command log for the same command repeating.
How do I see Claude Code's context usage?
Configure a statusline that prints context_window.used_percentage, or run /statusline and describe what you want.
Can I monitor Claude Code from my phone?
Yes, with Remote Control push notifications in the Claude app, or hooks that forward events to a push service or agent inbox.
Where Tapnod fits
Tapnod's agent monitoring shows each Claude Code session's last contact and open decisions next to your other agents, and lets you answer from your phone. Start free.