How do I track subagents in Claude Code?
Rius traces Claude Code subagents through its plugin: each subagent gets its own spans, nested under the tool call that started it, with its own model calls, tokens and cost. Turn tracing on for a folder with /rius:enable-here, then open the session in the trace list and read the subagents in the waterfall. Subagent types are recorded even when you send structure only. Rius does not send prompts or tool output from a folder unless you enable content for it.
How it works
The Rius plugin turns each Claude Code session into one trace. A subagent is recorded as a branch inside that trace:
AGENT the session
└─ CHAIN a turn: one prompt and everything it caused
└─ LLM a model call
└─ TOOL Agent: the call that started a subagent
└─ AGENT the subagent, named by its type
└─ LLM the subagent's own model calls and toolsWhat this gives you for subagents:
- A span for the start. The tool call named Agent marks the moment Claude Code started a subagent.
- A span for the subagent. It is named by its type, so you can tell one kind of subagent from another.
- Its own tokens and cost. The subagent’s model calls carry the model, input and output tokens, cache reads and writes, and cost, separate from the main session’s calls. This matters because in long sessions subagents can account for more than half of all tokens.
- Its own tool calls. Bash, Read, Edit and other tools a subagent runs sit under the subagent, with errors marked on the span.
A session is one trace, with the same session id throughout. If you resume a session, it continues the same trace. Tracing is off until each developer turns it on for a folder, and Claude can’t turn it on itself.
Set it up
-
Install, sign in and enable a folder. Install the plugin in a terminal:
claude plugin marketplace add glassflow/rius-coding-agents && claude plugin install rius@rius-coding-agentsThen run
/rius:loginin Claude Code, pick a workspace and click Connect. In the repo you want traced, run/rius:enable-here, and check that/rius:statusstarts withRius tracing: on. The Claude Code plugin guide covers each step, requirements and troubleshooting. -
Choose how much to send.
/rius:enable-heresends structure only, which already includes subagent types, tokens and cost. To also see what each subagent was asked and what it answered, run/rius:enable-content-herein that folder instead. The plugin removes the secrets it recognizes first, on a best-effort basis. Everyone with access to the workspace can read what is sent. -
Start a new session in the folder. Start Claude Code from inside the enabled repo, not from a parent folder, and give it work that uses subagents. A session already open when you enable its folder is traced from its start, including what was said earlier.
-
Open the session. In the console, find it in the trace list while it runs. The waterfall shows each Agent call with the subagent nested under it. Open a subagent’s model calls to see tokens and cost.
-
Ask from the terminal. Run
/mcp, pickriusand sign in with your Rius account once. Then ask a question such as “How much did subagents cost me this week compared with the main session?”
For a team rollout, Track Claude Code usage and cost across a team shows how to put every developer’s sessions in one workspace.
What you get
- Subagents in the waterfall. You see which turn started a subagent, what type it was, which tools it ran and where a tool call failed.
- Cost you can attribute. Subagent spend is separate from the main session’s, so you can see how much of a session’s tokens a subagent used.
- Roll-ups per developer. Each session shows on the Users page under the email the developer signed in with, and Claude Code shows on the Agents page as an agent named
claude-code. - Answers in plain language. Through the Rius MCP server you can compare subagent and main-session cost without leaving Claude Code.
What Claude Code tracing does not report, or reports with limits:
- Structure only hides content. With
/rius:enable-here, you get no prompts, replies, tool inputs or file contents, and no error details of a failed tool call. Claude’s thinking is never sent, even with content on. - Model-call durations are approximate. Claude Code’s transcript records when a reply finished, not when the request went out, so a model span can include time you spent reading a permission prompt. Tool durations are exact.
- Totals wait for the session to end. The trace list shows spans while the session runs, but the Users and Agents figures count a session only after it ends. A session that crashes or is killed is never counted there.
- Cost is an estimate at API rates. On a Claude Pro or Max subscription, it measures usage and is not what you pay.
When something else fits
- If you build your own agent on the Claude Agent SDK rather than using Claude Code, use the Claude Agent SDK integration instead of the plugin.
- If you work in Codex (beta) or Cursor (beta) as well, the same plugin covers them, but each has its own sign-in and folder rules. See Coding agents to compare what each agent reports.