Skip to content

Transcript parser misses subagent dispatches: matches name == "Task" but current Claude emits name == "Agent" #1

Description

@James-Bugden

Summary

The transcript parser at internal/claude/transcripts.go:262 only recognizes subagent dispatches when the tool_use block's name is "Task". In real Claude Desktop / current Claude Code transcripts, subagents are dispatched via the "Agent" tool with an identical input shape (subagent_type, description, prompt, run_in_background). As a result, get_agent_performance, the metrics "Agent Performance" section, and the "Consider using task agents" suggestion all under-report by ~100%.

Evidence

Across the tool_use blocks in my local ~/.claude/projects/ transcripts (30 sampled session files):

tool_use name count
Bash 2667
Read 650
Edit 544
TodoWrite 517
Write 383
Agent 279
Task 0

Full repo (125 sessions):

input.subagent_type value count
general-purpose 769
Explore 44
claude-code-guide 3
Total subagent dispatches 816

claudewatch metrics --days 30 for the same data prints:

Agent Performance
──────────────────────────────────────────────────────────────────
 No agent tasks found in session transcripts

claudewatch suggest prints:

#1 [MEDIUM] Consider using task agents
   Impact: 62.5  |  Category: adoption
   Agent usage is low (0% of 125 sessions).

…both incorrect — the user dispatched 816 subagents in those sessions.

Sample JSON shape

The Agent tool's input is structurally identical to what the existing taskInput struct already deserializes:

{
  "type": "tool_use",
  "id": "tu_…",
  "name": "Agent",
  "input": {
    "description": "",
    "subagent_type": "general-purpose",
    "prompt": ""
  }
}

Proposed fix

One line in internal/claude/transcripts.go:

-case block.Type == "tool_use" && block.Name == "Task":
+case block.Type == "tool_use" && (block.Name == "Task" || block.Name == "Agent"):

The downstream taskInput unmarshal + pending[block.ID] flow already handles the rest correctly — SubagentType, Description, Prompt, RunInBackground are all populated identically by the Agent tool.

Tests: the existing transcripts_test.go cases can be parameterized over name="Task" / name="Agent" to cover both, or a new fixture added.

Why this matters

Beyond fixing the headline metric, this gap hides subagent-derived stalls from the rest of the analysis surface:

  • correlate friction --factor uses_task_agent returns the wrong correlation
  • per-subagent-type success rates can't be computed (e.g. Explore vs general-purpose)
  • suggest keeps recommending "use task agents" to users already using them, which erodes signal trust

Happy to send a PR if useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions