/Catalogue/Prompt/hoangsonww/hoangsonww-claude-code-agent-monitor-session-report

Origin: github

session-report

Generate a comprehensive session report with per-model token usage (input, output, cache_read, cache_write including compaction baselines), cost breakdown via the pricing engine, tool invocations, agent hierarchy, compaction events, API errors, turn durations, and thinking block counts. Use when reviewing a specific session or summarizing activity over a date range.

by hoangsonww · updated 21h ago · imported from GitHub

Installs0+0/7d
Security score0/100
Retention 14d0%
GitHub stars1K

Skill logic

Execution graph
User message
Prompt rewrites behaviour
Response

SKILL.md

View on GitHub ↗

Session Report

Generate a detailed session report from the Claude Code Agent Monitor.

Input

The user provides: $ARGUMENTS

This may be a session ID, "latest", or a date range like "last 24 hours".

Data Sources

All data comes from the Agent Monitor API at http://localhost:4820:

EndpointWhat it returns
GET /api/sessions/{id}Session with nested .agents[] and .events[]
GET /api/sessions?limit=50Session list with agent_count, last_activity, and inline cost per session (bulk pricing applied server-side)
GET /api/pricing/cost/{sessionId}{ total_cost, breakdown: [{ model, input_tokens, output_tokens, cache_read_tokens, cache_write_tokens, cost, matched_rule }] }
GET /api/events?session_id={id}Event stream: each has event_type, tool_name, summary, data (JSON), created_at

Key data points available per session

  • Status: active / completed / error / abandoned
  • Model: primary model (e.g. claude-sonnet-4-20250514)
  • Metadata (JSON): thinking_blocks count, turn_count, total_turn_duration_ms, usage_extras (service_tier, speed, inference_geo)
  • Token usage per model: Pricing breakdown reports input_tokens, output_tokens, cache_read_tokens, cache_write_tokens per model (baselines are pre-summed into these totals at the DB level)
  • Cost formula: (tokens / 1,000,000) × rate_per_mtok for each of 4 token types, using longest-match pricing rule
  • Agent hierarchy: recursive parent_agent_id tree, subagent_type (e.g. "task", "explore", "code-review", "compaction")
  • Event types: PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, Notification, Compaction, APIError, TurnDuration

Report Sections

1. Session Overview

  • ID (first 16 chars), name, status, model, working directory
  • Start → end time, total duration
  • Turn count and avg turn duration (from metadata)

2. Token Usage (per model)

Include these columns: Model, Input, Output, Cache Read, Cache Write, and Total. Show effective totals (current + baseline) since baselines preserve tokens lost during compaction. Calculate cache hit rate: cache_read / (cache_read + input) × 100.

3. Cost Breakdown

From /api/pricing/cost/{id} — show each model's cost with the matched pricing rule. Note rates are per million tokens.

4. Agent Hierarchy

Render the agent tree (main → subagents, with nested children). For each agent: name, type, subagent_type, status, task (first 60 chars), duration.

5. Tool Activity

Count PreToolUse events by tool_name. Flag tools that appear in error events. Note subagent spawns (tool_name = "Agent").

6. Compaction & Context Health

  • Count of Compaction events (each = context was compressed)
  • Baseline tokens recovered (sum of baseline_* columns)
  • Thinking block count from metadata

7. API Errors

List any APIError events with type (quota, rate_limit, overloaded) and message.

8. Timeline

Key lifecycle events: SessionStart → first tool → compactions → errors → Stop → SessionEnd. Include TurnDuration events.

Output Format

Clean Markdown: executive summary line, structured tables, agent tree, numbered timeline. Bold key metrics.

Discussion

No comments yet — start the thread.

Sign in to join the discussion.

/More from hoangsonww/Claude-Code-Agent-Monitor

hoangsonww· 21h agoSandbox
config-audit

Prompts · TypeScript · v0.1.0

Run a full audit of the user's Claude Code configuration via the Agent Monitor Config Explorer API: counts per surface (user vs project), duplicate or overlapping skills and subagents, hooks that run shell commands, and which surfaces are read-only vs mutable. Reads /api/cc-config/overview, /skills, /agents, /commands, /hooks, and /settings. Use when reviewing your Claude Code setup for sprawl, duplication, or risk.

#ai-agents#claude-agents#claude-code

0 1K
hoangsonww· 21h agoSandbox
hook-inventory

Prompts · TypeScript · v0.1.0

Inventory hooks across the user, project, and project-local settings plus the ~/.claude/hooks scripts directory — read through the Agent Monitor Config Explorer API — and flag hooks that POST to the network or run arbitrary commands. Reads /api/cc-config/hooks and /api/cc-config/hook-scripts. Use when auditing hook safety.

#ai-agents#claude-agents#claude-code

0 1K
hoangsonww· 21h agoSandbox
mcp-audit

Prompts · TypeScript · v0.1.0

Audit the configured MCP servers (user + project scope) via the Agent Monitor Config Explorer API: transport (stdio vs http), command/args and env variable names, headers, and the source file each definition came from. Reads /api/cc-config/mcp. Use when reviewing MCP integrations for hygiene, duplication, or unexpected transports.

#ai-agents#claude-agents#claude-code

0 1K
hoangsonww· 21h agoSandbox
memory-review

Prompts · TypeScript · v0.1.0

Review the file-based memory store via the Agent Monitor Config Explorer API: the user and project CLAUDE.md plus per-project auto-memory files under ~/.claude/projects/<slug>/memory/*.md. Groups by project, shows the index (MEMORY.md) vs per-fact files, and flags stale or oversized facts. Reads /api/cc-config/memory and /api/cc-config/file?path=. Use when curating agent memory.

#ai-agents#claude-agents#claude-code

0 1K