Agent Profiler

See where a slow Claude Code session spends time

·

source at 93fa0f7

·

Apache-2.0 license

A live pane and status entry that split agent time into model wait, tools, subagents and engine overhead, with /profile reports and OTLP traces for Jaeger or Grafana Tempo.

What this mod can do

  • Reviewed at commit 93fa0f7
  • Writes files
  • Connects to the internet
  • Reads environment variables
  • Sees each tool call before it runs and can block or change it
  • Also uses telemetry.log{to=collector}, which this page doesn't describe yet
5 more things it can do
  • Adds the /profile-export command
  • Adds the /profile-pane command
  • Adds the /profile command
  • Runs on a timer
  • Runs on Claude Code hooks, such as session start
Good to know (3)
  • Nothing leaves your machine until you set otlpEndpoint; left empty, traces are only written as files
  • Turn prompts, Bash commands and search patterns are exported only with exportCommandText on
  • Time inside the model server can't be split: time to first token lumps network, queueing and prefill
Are mods safe?

Preview

Terminal

⎿ agent-profiler: Agent Profiler pane opened (shown in the terminal and the desktop app). ╭────────────────────────────────────────────────────────────────────────────────────────────────✕─╮ │ 175ms agent time · 1 turn(s) │ │ model ███████░░░░░░░░░░░░░ 35% │ │ tools ░░░░░░░░░░░░░░░░░░░░ 0% │ │ subagents ░░░░░░░░░░░░░░░░░░░░ 0% │ │ engine/other █████████████░░░░░░░ 65% │ │ │ │ Running │ │ idle │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ ⚠ agent-profiler: ⏱ model 35% · tools 0%

Claude Desktop

Agent Profiler in Claude Desktop

What it does

In the author's words

Execution profiler for Claude Code: model wait vs tools vs subagents, live, with OTLP export

What you see
A live pane, a status entry, and a toast if export fails
Works in
Terminal and Claude Desktop
Slash commands
/profile-export, /profile-pane, /profile
Uses your tokens
No
Changes files
.otlp.json trace files under ~/.claude/agent-profiler
Network access
Your own OTLP collector, only if you set otlpEndpoint
Reviewed commit
93fa0f7
Preview recorded with
Claude Code 2.1.309

How it works

  1. Times every turn, model request, tool call and subagent from the start of the session
  2. Reads tool durations from Claude Code and the token usage the API reports
  3. Updates a status entry like model 61% - tools 28% at most twice a second
  4. Writes OTLP trace files after each turn; /profile-pane opens the live pane

Common questions

Why is my Claude Code session slow?

This mod splits agent time into model wait, tool execution, subagents and engine overhead, so you can see which part is large. /profile prints a report for the whole session and /profile turn for the last turn, with tool and model stats, repeated file reads and findings.

How do I send Claude Code traces to Jaeger or Grafana Tempo?

Set otlpEndpoint to your collector's OTLP/HTTP base URL, such as http://localhost:4318, and the mod POSTs each trace batch to /v1/traces. Without it, the trace files in ~/.claude/agent-profiler can be sent by hand. Span names follow the GenAI conventions, like chat <model> and execute_tool <tool>.

Does it measure the model's inference time?

No. It reports what the client can observe. Time to first token mixes network, queueing and prefill, and stream times are waits seen at the client, not time the model spent computing.

Does it work in VS Code or with claude -p?

It still records, exports and answers /profile there, but the pane and status entry only draw in the terminal and the Desktop Code tab.

Badge for your README

Own this listing? Add it to your README. The badge shows the install count as it grows.

Reviewed on statuslin.es
[![Reviewed on statuslin.es](https://statuslin.es/badge/mods/agent-profiler.svg)](https://statuslin.es/mods/agent-profiler?utm_source=readme-badge)

Or show the preview card:

Preview on statuslin.es
[![Preview on statuslin.es](https://statuslin.es/og/mods/agent-profiler.png)](https://statuslin.es/mods/agent-profiler?utm_source=readme-badge)

More like this

Deck in Claude Desktop

A cockpit for Claude Code: plan bars and subagent strips, context, usage limits with reset countdowns and burn rates, spend, the model route and a pet. Six bar styles, three collapsed looks. CLI and Desktop.

Mod Gallery in Claude Desktop

Browse the reviewed mods on statuslin.es in a pane, with their install counts and what each can reach, and put one's install prompt in your prompt box. /gallery opens it. It runs nothing: you read the prompt and send it.

[-] ▄▄▄▄▀▀▀▀▄▄▄▄ ▀ ▀ ▀ ▀ ▄▀ ▀▄ ▀▀▀▀▀ ▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀▀ ▄▄▀▀▀ ▀▀ ▀▀▀▄▄ Lv 5 ▀▀▀ ▀▀ ▀▀▀ ▀▀▀ ●●●●○ ▀▀ ▀▀ ♥♥♥♥♡

A pixel Pokémon that lives at the right edge of the band above the prompt

Opus 4.8 │ main │ app │ ▓▓░░░░░░░░ 44k/200k │ $0.41

Catppuccin Frappé-themed status line with model, git branch and dirty flag, folder, a block context bar, and session cost.

Opus 4.8 high ✦ │ ctx 22% │ app (main) │ PR #1287 ● │ $0.41 · 10m +128 -34 Session ● ● ● ● ● ● ● ● ○ ○ ○ 74% left Resets in 2h 6m Weekly ● ● ● ● ● ● ● ● ● ● ○ 93% left Resets in 2d 0h Fable ● ● ● ● ● ● ● ● ● ○ ○ 85% left Resets in 2d 0h ◐ Read:index.ts ✓ Read×1 ✓ Bash×1 ✓ Edit×1 ✓ Grep×1 ◐ code-reviewer Review the change for regressions

A header with model, context and burn rate per hour, then live tool and agent activity parsed from the session transcript.

Model: Opus 4.8 | Thinking: high | Context: [▰▰▱▱▱▱▱▱▱▱] 45k/200k (22%) | cwd: ~/app | ⎇ main | (+0,-0) Cost: $0.41 | Block: 2hr 6m | Weekly: 7.0% | Session: 10m | In: 916.7 t/s | Out: 29.2 t/s | Cached: 2k | Session: [▰▱▱▱▱] 26.0% Mem: 0.8G/1.0G | (*゚∀゚*) | Session ID: b8e1c0d2-4a6f-4e2a-9c1b-3f5d7a9e2c10

Three lines in One Dark: model, thinking effort and a context bar up top; cost, quota, session clock and token throughput in the middle; weather, free memory and a rotating kaomoji below.

Opus 4.8 │ ✍️ 22% │ app (main) │ ● high current ●●○○○○○○○○ 26% ⟳ 6:59pm weekly ○○○○○○○○○○ 7% ⟳ aug 1, 5:52pm

Model, context, directory and branch up top; five-hour and weekly quota as dot bars with reset times underneath. Flags --dangerously-skip-permissions with a lightning bolt. By Kamran Ahmed of roadmap.sh.