Skip to content

feat(analytics): per-agent cost breakdown and clickable Gantt timeline#363

Merged
codemie-ai merged 2 commits into
mainfrom
feat/analytics
Jun 16, 2026
Merged

feat(analytics): per-agent cost breakdown and clickable Gantt timeline#363
codemie-ai merged 2 commits into
mainfrom
feat/analytics

Conversation

@vadimvlasenko

Copy link
Copy Markdown
Collaborator

Summary

  • Per-agent cost & tokens: Reads agent-<id>.meta.json to match each Agent tool_use to its sub-agent transcript, then prices token usage per model and attaches costUSD / tokens to each dispatch event
  • Clickable Gantt: Timeline bars are now clickable; selecting a bar opens a side panel with the agent's full cost, token breakdown (input/output/cache), duration, start offset, and top tool call counts
  • Timeline layout fixes: Gantt scoped to agent-only bars (skills/commands excluded per spec); scale uses agent activity window so bars fill the track; min-width: 28px with calc(min(..., 100%-28px)) prevents right-edge clipping; tl-dur column narrowed from 120px to 72px

Code-review fixes applied

  • Removed description from agent dispatch name fallback (prevented long/sensitive text leaking into reports)
  • costUSD now omitted (not set to $0) when no model has a pricing entry
  • Reverted unrelated settings.json telemetry additions to keep them out of this PR scope

Test plan

  • Open analytics report for a session that has sub-agent dispatches — verify agent bars show cost and token data in the side panel
  • Click each agent bar — verify side panel updates with that agent's breakdown
  • Verify costUSD is absent (not $0) for agents whose model is not in the pricing table
  • Verify short agents near the session end are visible and clickable (not clipped)
  • Verify skills and commands do not appear as Gantt bars
  • Run npm run lint && npm run build && npm test — confirm 2161 tests pass (1 pre-existing failure in skills.test.ts unrelated to this branch)

…eline

- Extract sub-agent token usage by matching tool_use IDs against agent-<id>.meta.json
- Enrich each agent dispatch with costUSD and token breakdown from its transcript
- Add clickable timeline bars; side panel shows cost, tokens, duration, tool calls per agent
- Scope Gantt scale to agent activity window so bars fill the track proportionally
- Agent-only bars in Gantt (skills/commands removed per spec); proportional wall-clock scaling
- Fix: costUSD omitted when no model has a pricing entry (was incorrectly set to $0)
- Fix: agent description removed from dispatch name fallback (prevented info leaking into reports)
- Fix: tl-bar min-width 28px; bar left uses calc(min(..., 100%-28px)) to prevent clip at track edge
- Fix: tl-dur column narrowed to 72px to reduce gap between bars and duration label

Generated with AI

Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
@codemie-ai codemie-ai merged commit ec27ae8 into main Jun 16, 2026
5 checks passed
@codemie-ai codemie-ai deleted the feat/analytics branch June 16, 2026 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants