Developer Builds One-Line Wrapper to Measure Claude Code Hook Latency
A developer working with Claude Code, Anthropic's AI coding tool, created a lightweight bash wrapper script to identify which hooks are causing slowdowns between user prompts and responses. The wrapper records each hook's execution time in milliseconds to a JSONL log file, allowing users to pinpoint performance bottlenecks without altering hook behavior. The solution relies on bash 5's built-in EPOCHREALTIME variable for microsecond precision, making it compatible with both Linux and macOS Ventura or later. Deploying it requires only a one-line change per hook entry in Claude Code's settings.json configuration file. Real-world measurements from the author's setup revealed significant variance, with one hook taking over 5,000 milliseconds compared to another at just 827 milliseconds.
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