Three ways I miscounted my own AI agents, and what the transcripts actually say
Описание и применение
Пользователи неправильно подсчитывают выводы и использование AI‑агентов из файлов транскриптов Claude. Скрипт roundtable корректно обрабатывает вложенные агенты, удаляет дублирующие строки и правильно считает хуки, выявляя 58,4 % вывода дочерних агентов и 6 898 запусков хуков.
Задача
Users miscount AI agent outputs and usage because of transcript file structure and duplicate lines, leading to inaccurate metrics.
Результат
Accurate measurement of child agent output (58.4% of total tokens), correct token usage (deduplicated to 46.96M), and precise hook firing counts (6,898 firings). Identified 13 silent children that produced no output.
Рабочий процесс
- 1. List all subagent JSONL files under ~/.claude/projects/*/*/subagents/*.jsonl and subagent workflow agent files.
- 2. Count lines per file and deduplicate by message.id to get true token usage.
- 3. Grep for "hookName" entries, sort, uniq, and count per hookName, then deduplicate by toolUseID to get true hook firings.
- 4. Run the provided script npx github:Kostakurta8/roundtable --stats to aggregate statistics across all sessions.
- 5. Review the output to understand child share, token usage, and hook activity.
- 6. Use the viewer component of the project to visualize agent timelines if needed.
Доказательства
On my machine, across 51 runs that used subagents, the children wrote 58.4% of all output tokens.
Summed per line that is 90,955,151 output tokens. Deduplicated on message.id it is 46,959,967.
Deduplicate and my 8,831 records become 6,898 firings.
- Дата записи: 2026-09-21T18:45:23.513Z