Description
The token-usage metrics quartet {InputTokens, OutputTokens, CacheReadTokens, CacheWriteTokens} (plus Effective/Reasoning) is modeled four times, with an inconsistency worth fixing during consolidation:
pkg/cli/copilot_events_jsonl.go:100 — copilotUsageMetrics (uses camelCase json tags)
pkg/cli/token_usage.go:75 — ModelTokenUsage (snake_case json tags)
pkg/cli/token_usage.go:90 — ModelTokenUsageRow (a flattened near-dup of ModelTokenUsage)
pkg/cli/token_usage.go:27 — TokenUsageEntry
Extract a shared token-metrics core struct and embed it, aligning the json tag casing (the camelCase vs snake_case split is a latent serialization footgun).
Expected Impact
Single source of truth for token metrics, removes the camelCase/snake_case json-tag inconsistency, and collapses the ModelTokenUsage/ModelTokenUsageRow near-dup.
Suggested Agent
Code Quality agent (Go refactor). Typist audit context available.
Estimated Effort
Medium (1-4 hours)
Data Source
DeepReport Intelligence Briefing 2026-07-16, from the [typist] Go Type Consistency report (Cluster 8). Clusters 1/2/3/6 were already filed (#46000/#46001/#46002); Cluster 8 was un-filed as of this run.
Generated by 🔬 Deep Report · 247.5 AIC · ⌖ 12.4 AIC · ⊞ 10K · ◷
Description
The token-usage metrics quartet
{InputTokens, OutputTokens, CacheReadTokens, CacheWriteTokens}(plusEffective/Reasoning) is modeled four times, with an inconsistency worth fixing during consolidation:pkg/cli/copilot_events_jsonl.go:100—copilotUsageMetrics(uses camelCase json tags)pkg/cli/token_usage.go:75—ModelTokenUsage(snake_case json tags)pkg/cli/token_usage.go:90—ModelTokenUsageRow(a flattened near-dup ofModelTokenUsage)pkg/cli/token_usage.go:27—TokenUsageEntryExtract a shared token-metrics core struct and embed it, aligning the json tag casing (the camelCase vs snake_case split is a latent serialization footgun).
Expected Impact
Single source of truth for token metrics, removes the camelCase/snake_case json-tag inconsistency, and collapses the
ModelTokenUsage/ModelTokenUsageRownear-dup.Suggested Agent
Code Quality agent (Go refactor). Typist audit context available.
Estimated Effort
Medium (1-4 hours)
Data Source
DeepReport Intelligence Briefing 2026-07-16, from the [typist] Go Type Consistency report (Cluster 8). Clusters 1/2/3/6 were already filed (#46000/#46001/#46002); Cluster 8 was un-filed as of this run.