Back to feed
Dev.to
Dev.to
7/23/2026
Hunting Down Zombie Agents: Logging Subagent Usage with a Claude Code Stop Hook

Hunting Down Zombie Agents: Logging Subagent Usage with a Claude Code Stop Hook

Short summary

A detailed tutorial on building a system to track Claude Code subagent invocations using Stop hooks, JSONL logging, and daily summary reports. The author discovered 44 unused agents out of their defined set and built a three-component pipeline to identify zombie agents. Includes real Python parsing code, deduplication logic, and aggregation scripts for 7-day and 30-day windows.

  • Stop hook parses session transcripts to log Agent tool invocations to JSONL
  • Daily launchd job generates usage summaries showing top agents and zero-invocation zombies
  • System helps decide which agent definitions to cull based on actual usage data

Generated with AI, which can make mistakes.

Is this a good recommendation for you?

Comments

Failed to load comments. Please try again.

Explore more