Profiling coding-agent runs
Long coding-agent runs felt slow, and the obvious suspect was the model. In August I measured where the time went in 255 of my own agent runs and turned the findings into rules and hooks. Eleven weeks later I measured again with an adapted method and compared 340 runs from before the rules with 708 runs from October to see which changes held.
- Role
- Measurement, tooling and analysis
- Data
- 255 runs in August, 2,818 subagent runs from June 15 to October 26, 2026, all from my own session logs
- Dates
- August 7 and October 26, 2026
- Limits
- One person’s runs. Before and after, without a control group.
Where 36.7 hours of agent runs went
- Session idle
- 19.8 h · 54 %not counted
- Tool execution
- 9.2 h · 25 %54 %
- Model response time
- 5.7 h · 16 %34 %
- Other
- 2.0 h · 5 %12 %
Method: matching start and end of each run
Run time comes from pairing the start in the main thread with the last completion message of each agent. A first approach used the first completion message and was off by up to 75 percent, because a completion fires every time an agent pauses, not only at the end.
Cross-check: against the independent timestamps of the eight full transcripts, the method deviates by 0.1 percent for all eight. One run of 703 hours was a mismatched pair and is excluded.
Finding 1: the biggest block was a night
- 36.7 hours of wall-clock time, 19.8 of them idle.
- The two largest gaps ran from 11:15 p.m. to 8:34 a.m.: nobody was there. (My first reading, finished agents waiting to be picked up, was wrong.)
- Six of eight runs had no idle time and worked 1.1 to 2.5 hours in one stretch: slow runs are a question of work time.
Finding 2: half the tool time was waiting in loops
- Tools 9.2 hours, model 5.7; median gap per model turn 7 seconds.
- 4.47 hours in 67 calls, about half the tool time, were foreground wait loops.
- Rerun of a 120-second job: the foreground blocked 130.2 seconds, the background returned in under one second.
- Afterwards I added a hook that blocks timeouts above the tool limit; because of a broken setting it took effect only on August 20. It logged foreground wait loops, and since October 26 it also tells the agent about them.
Eleven weeks later
For the second measurement, the older subagent logs were still available, while the older main-session logs were gone. It therefore reads each subagent run from its first to its last timestamp. As a cross-check I recomputed the two longest July runs with the new method: 24.6 hours of wall-clock time, the same as in August. Of the 2,818 runs, 1,393 are short workflow agents that I leave out of the comparison. The table compares the 340 direct subagent runs before the August measurement with the 708 in October. The 255 runs of the first measurement were read from main-session logs that no longer exist, so they are not part of this comparison.
You can explore the runs yourself on a separate page, through October 27: play a real run, cancel it or send it to the background.
Before the August measurement and in October
| Measure | Until Aug 7 | October |
|---|---|---|
| Commands killed at the tool time limit, per 10,000 tool calls | 7.7 | 0 |
| Tools per tool-using turn | 1.18 | 1.63 |
| Gaps attributed to the model, share of working time, eight runs with the most work | 28% | 14% |
| Detected wait-loop patterns per 100 tool calls | 1.16 | 0.82 |
Where the total time of the eight runs with the most working time went
- Session idle
- 18.6 h 1.1 h
- Tool execution
- 16.7 h · 66% of work 26.5 h · 78% of work
- Model response time
- 7.0 h · 28% of work 4.7 h · 14% of work
- Other
- 1.4 h 2.8 h
What held
The hook that blocks timeouts above the tool limit stopped every attempt it saw. Until August 19 it did not run because of a broken setting, and none of the 1,483 such commands from June 15 to then was blocked. From August 20 on, all 84 attempts were blocked. Since October 5 there has been no attempt in 55,972 tool calls.
Attempts to set a timeout above the tool limit
No command was killed at the tool time limit in October, against 28 in the 340 subagent runs before the measurement. Turns that use tools now contain 1.63 tool calls on average, up from 1.18. I did not measure how much time that saves.
What did not hold
Foreground wait loops came back. Per 100 tool calls they fell from 1.16 before the measurement to 0.26 in the twelve days after it, were back at 0.86 from August 20 to the end of September and at 0.82 in October, about seven tenths of the earlier rate. My own briefing still asked subagents to collect finished background jobs in the same turn, and the hook only logged the loops without telling the agent. Since October 26 the briefing no longer asks for that and the hook tells the agent; whether the loops become rarer will show in the next measurement.
The dashboard I built to watch all of this logged its own use. The log recorded 27 requests on August 18 and 19, the two days I built it, and none afterward. I stopped developing it. The verification status now sits at the end of every check run, where I read it anyway.
The model and Claude Code changed too
Until August 7, 92 percent of the responses in direct subagent runs came from Opus 5. In October, 99.5 percent came from Opus 5.5. My work log recorded 28 Claude Code versions between August 9 (2.1.222) and October 26 (2.1.308).
Several changes in the table coincide with the new model. The median gap between a tool result and the next response fell from 7.1 to 4.8 seconds. In the eight runs with the most working time, gaps attributed to model responses fell from 28 to about 14 percent of the estimated working time, and tool execution, such as builds, test chains and waiting, took 78 percent. Tools per turn rose at the same time as a written rule asked for it. The data cannot separate these causes.
One change in Claude Code touches my own rules. In August, a subagent that started a background job and ended its turn stayed asleep, and my briefing was written around that. The wake test on October 26 ran on version 2.1.308. When the behavior changed, I cannot tell from my logs.
Errors in a measuring tool and in two sabotage tests
Re-running the tests of the setup itself found two problems. A check that counts tools per turn reported exactly 1.00 for all 26 recent runs. In the subagent logs since June, almost every log line with a tool call contains exactly one, and the check counted lines. So since I built it on August 7 it reported too little bundling for every longer run, whether the agent bundled or not, and its own test had no case for it. It now counts per message, and a new test case fails against the old version.
Two sabotage tests, which break a rule on purpose to prove that its test notices, wrote the breakage into the live hook files. Any session that called the hook during such a run got the deliberately altered version. They now work on a copy, end with an error if a sabotage goes unnoticed, and the hook files are byte-identical before and after a run.
In my own setup, 842 test cases and 382 sabotages ran on October 26, 2026; 105 slow sabotages of one check were left out for time.
The guard hook with the new hint mode, the profiler behind these numbers and the tests for both are open source in agent-guard-hook on GitHub.