Feature Request: Expose per-sub-agent metrics in status line and hooks

Resolved 💬 3 comments Opened Dec 14, 2025 by kodflow Closed Dec 18, 2025

Summary

Currently, Claude Code only exposes aggregated session-level metrics (tokens, context window usage, cost) via the status line hook. When using sub-agents extensively, there's no visibility into individual sub-agent resource consumption.

Requested Features

1. Enhanced SubagentStop hook data

Include metrics when a sub-agent completes:

  • Total input/output tokens consumed by that sub-agent
  • Context window usage percentage
  • Duration and cost for that specific sub-agent
  • Model used by the sub-agent

Example enhanced hook input:

{
  "session_id": "abc123",
  "agent_id": "agent-xyz",
  "transcript_path": "/path/to/agent-xyz.jsonl",
  "metrics": {
    "total_input_tokens": 15000,
    "total_output_tokens": 3000,
    "context_window_usage_percent": 45,
    "duration_ms": 12000,
    "cost_usd": 0.02,
    "model": "claude-sonnet-4-20250514"
  }
}

2. Real-time sub-agent metrics

Expose running sub-agent data in status line hook:

  • List of active sub-agents with their IDs
  • Per-agent token consumption
  • Per-agent context window usage

3. Status line breakdown

Optional data to show sub-agent stats:

  • Number of active/completed sub-agents
  • Aggregate vs per-agent token breakdown

Use Case

Building a custom status line to monitor Claude Code sessions. With heavy sub-agent usage (using the Task tool), it's impossible to know which agents are consuming the most tokens or approaching context limits until the session ends and transcripts can be parsed manually.

Current Workaround

Parsing agent-{agentId}.jsonl transcript files post-session, which is:

  • Cumbersome and requires custom parsing logic
  • Not real-time (only available after session ends)
  • Requires knowledge of internal transcript format

Benefits

This would greatly improve observability for power users managing complex multi-agent workflows, enabling:

  • Real-time monitoring of resource consumption
  • Early warning when sub-agents approach context limits
  • Better cost tracking and optimization
  • Custom dashboards and status lines with per-agent metrics

Thank you for considering this feature! 🙏

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗