Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Run automatically on Claude Code events. Claude doesn't decide.
No risk signals detected
Nothing flagged in this plugin's hooks, MCP servers or commands. Other components are not analyzed.
Static checks of hooks, mods, MCP servers and commands. Not a security audit.
1 marketplace, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
A Claude Code plugin that logs token usage for every subagent (Task tool) call, enabling cost attribution and skill optimization.
/plugin marketplace add clemux/claude-code-plugins
/plugin install subagent-metrics@clemux-claude-code-plugins
claude --plugin-dir ~/dev/claude-code-plugins/subagent-metrics
Each subagent call appends a JSON line to ~/.claude/subagent-metrics.jsonl:
{
"ts": "2026-02-07T12:00:00Z",
"session": "abc123",
"cwd": "/home/user/my-project",
"model": "haiku",
"subagent_type": "general-purpose",
"skill": "commit",
"description": "execute git add and commit",
"total_tokens": 1523,
"duration_ms": 3200
}
Skills that dispatch subagents should tag the Task description with the skill name in brackets:
description: "[commit] execute git add and commit"
The hook parses the [...] prefix as the triggering skill. Untagged calls get skill: null.
# Total tokens by skill
jq -s 'group_by(.skill) | map({skill: .[0].skill, total: map(.total_tokens // 0) | add})' ~/.claude/subagent-metrics.jsonl
# Average tokens per model
jq -s 'group_by(.model) | map({model: .[0].model, avg: (map(.total_tokens // 0) | add / length)})' ~/.claude/subagent-metrics.jsonl
The plugin registers a PostToolUse hook on the Task tool. After any subagent completes:
model, subagent_type, description from tool inputcwd (project path) from the hook eventtotal_tokens: N, duration_ms: N)[skill-name] prefix)flockjq — for JSON parsing and constructionflock — for atomic file append (standard on Linux)Uses flock for exclusive file locking when appending to the log file, preventing corruption from concurrent subagent completions.
Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
npx claudepluginhub clemux/claude-code-plugins --plugin subagent-metricsPlugins from other owners that cover similar ground