Developer Builds Claude Code Hook to Auto-Log and Analyze AI Agent Usage
A developer has created a logging system for Claude Code that automatically records every AI agent invocation using the platform's Stop hook and transcript_path payload. When a session ends, a chain of shell scripts triggers a Python parser that reads the conversation transcript and appends structured records to a JSONL log file. The system has so far captured 553 agent invocations, revealing that 47 defined agents had never been called even once. Unused agent definitions are considered actively harmful because they add unnecessary context to every session. The tool uses a combination of session ID and tool-use ID as a uniqueness key to prevent duplicate entries across multiple Stop hook firings within the same session.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in