agent-profiler

Reviewed at commit 2274d09

Sends data to Your configured OTLP collector, only when you set an endpoint

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

Made by
YeonwooSung
What we checked

Times every model request, tool call and subagent in your session and shows where the time went in a status line, a live pane and /profile. After each turn it saves a trace with timings, token counts, tool names and file paths to ~/.claude/agent-profiler. Prompts and commands are left out unless you turn that on, and nothing leaves your machine unless you set a collector address.

Review details

Static review of the source at the pinned commit; not run. Registers session.start, turn.start, turn.complete, turn.step (wraps the model stream and yields every chunk unchanged, recording only chunk kinds, timing and usage), tool.call (records the tool name and a summarized input, then forwards the call and returns its answer unchanged), telemetry.log filtered to the collector (keeps only tool_decision id, accept/reject, a fixed source enum and timestamp, and passes the record on), classic.PostToolUse, classic.PostToolUseFailure, classic.SubagentStart, classic.SubagentStop, classic.StopFailure, session.end, command.run for /profile, /profile-pane and /profile-export, and ui.render for its pane. Runtime calls: $.session.id, $.command.register, $.clock.every/after/sleep, $.ui.status, $.ui.toast, $.ui.open, $.ui.invalidate, $.env.get('HOME'), $.fs.write and $.http.fetch. It keeps the first 120 characters of each prompt, Bash commands (512 chars) and search patterns in memory after best-effort regex redaction of common secret shapes; these go into the OTLP files and POSTs only when the exportCommandText option is on (off by default), while file paths of Read/Write/Edit/Glob/Grep calls are always exported. After every turn and at session end it writes OTLP JSON batches (at most 3.5 MiB each) to <outputDir>/<sessionId>/, default ~/.claude/agent-profiler, which persist and are never cleaned up. The only network call is a POST of that JSON to <otlpEndpoint>/v1/traces when the user sets otlpEndpoint (empty by default); the response is checked for status only. No permission hooks, no tool blocking or rewriting, no programs run, no model calls. Every bookkeeping step is wrapped in try/catch so failures never break the session; failed writes or POSTs show once as a toast. Span memory is capped at 20,000 by dropping old finished turns. The qa/permission_smoke.py script, tests and the Jaeger docker-compose example are not loaded by the mod and were not reviewed.

What it uses
  • Reads your prompts: yes
  • Sees tool calls: yes
  • Blocks or changes tool calls: no
  • Reads or writes files: yes
  • Runs programs on your machine: no
  • Calls the model (uses tokens): no
  • Sends data over the network: yes
  • Stores data: yes
  • Shows something on screen: yes
Hooked events
Made this mod? Add a badge to your README

modsforClaude badge for agent-profiler

Paste this into your README. The badge says reviewed once the current version has been reviewed, and links readers to this page.

[![Listed on modsforClaude](https://modsforclaude.com/badge/agent-profiler.svg)](https://modsforclaude.com/mods/agent-profiler/)

← All mods