[Bug] Usage attribution overstates skills with handoffs and inconsistent subagent handling
Bug Description
Usage-by-skill attribution overstates skills that hand off to work, and is inconsistent
around subagents
Version: Claude Code 2.1.280, macOS arm64
What I see
The usage command charges a lot of usage to my "backlog" skill. The session transcripts
show why: each assistant API call carries an attributionSkill field, and the stamp is
applied like this:
- It starts on the first call after a Skill tool call. Calls earlier in the turn, and the
call that requested the skill, are not stamped.
- It stays on every later call in the turn until the next user prompt.
- A later Skill call in the same turn replaces it.
- A subagent spawned while it is active inherits it for its whole run, even though the
subagent never calls Skill itself.
- When a background subagent's report comes back to the main thread, the stamp clears
mid-turn.
Why it matters
- A skill's attribution has no end. My "backlog pick" skill picks an item and sets up a
worktree in a few calls, then the implementation continues in the same turn (tens of
calls) and is all charged to the skill. Across 40 recent sessions, "backlog" was about
11% of main-thread tokens, and most of that was not the skill's own work. So the
breakdown can't answer "which skills are expensive to run".
- The subagent handling is inconsistent. Spawning a subagent extends the stamp: 14
subagent transcripts were stamped for their whole run, 16-31 calls each. The same
subagent's report coming back ends the stamp on the main thread. Both events belong to
the same delegation, but they have opposite effects.
Repro
- Invoke a skill, then keep working in the same turn (edits, Bash).
- Spawn a subagent (Agent tool) in that same turn and let it return.
- Compare
attributionSkillin the session .jsonl with the one in
<session>/subagents/*.jsonl.
Expected
Either attribution that follows what the skill itself did (for example ending when the
skill's own work ends, or giving the user a way to mark that), or documented rules, with
subagents and their returns handled the same way.
Environment Info
- Platform: darwin
- Terminal: vscode
- Version: 2.1.280
- Feedback ID: 1f9a310e-6cbb-47d5-9291-b2e9686b56a4
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗