Track + break down workflow/ultra subagent usage (fix #470)#471
Merged
Conversation
collectJsonlFiles only read agent transcripts directly under `subagents/`, but the workflow feature nests them at `subagents/workflows/<wf>/agent-*.jsonl`, so their tokens were dropped — undercounting whenever workflow/ultracode was on. Walk the `subagents/` subtree recursively. Verified on real data: a workflow- using project recovered ~16% of its cost, with no change to other projects.
Surfaces real subagent-transcript spend grouped by agentType (workflow-subagent / Explore / general-purpose / …), read from each agent's sibling .meta.json (cached on CachedFile; session cache bumped 3→4). This makes ultra/workflow usage visible — the existing Task-input-based "subagents" section never sees workflow agents. Shown in `report --format json` (claudeAgentTypes) and a "Claude Agent Types" dashboard panel that renders only when Claude agent transcripts exist, so it never appears for the other providers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #470, and adds a Claude-scoped agent-type breakdown so workflow/ultra usage is visible.
1. Fix: workflow/ultra subagent usage was undercounted (#470)
collectJsonlFilesonly read agent transcripts directly undersubagents/, but the workflow feature nests them atsubagents/workflows/<wf>/agent-*.jsonl, so their tokens were dropped. Now walks thesubagents/subtree recursively. Verified live: a workflow-using project recovered ~16% of its cost (no change to other projects, no double-counting). Also confirmed through the installed global CLI.2. Feature: Claude-scoped agent-type breakdown
Surfaces real subagent-transcript spend grouped by
agentType(workflow-subagent/Explore/general-purpose/ …), read from each agent's sibling.meta.json(cached onCachedFile; session cache bumped 3→4).report --format json:claudeAgentTypes.subagentssection is untouched (it's Task-input-based and never sees workflow agents).Live (week):
general-purpose $87.83 · workflow-subagent $4.94 · Explore $3.34.tsc clean, full suite 1166/1166 (5 new tests). No menubar change.