Skip to content

refactor(agents): simplify metrics by removing token tracking utilities#183

Merged
8nevil8 merged 4 commits intomainfrom
EPMCDME-10048
Mar 4, 2026
Merged

refactor(agents): simplify metrics by removing token tracking utilities#183
8nevil8 merged 4 commits intomainfrom
EPMCDME-10048

Conversation

@8nevil8
Copy link
Collaborator

@8nevil8 8nevil8 commented Mar 3, 2026

Summary

Refactors the metrics system across all agent plugins by removing token tracking utilities and simplifying the metrics pipeline.

Changes

  • Removed tokenUtils.ts and token-aggregator.ts files entirely
  • Removed tokens field from MetricDelta type and related session types
  • Simplified metrics processors for Claude, Gemini, and OpenCode plugins — removed token aggregation logic
  • Cleaned up analytics aggregator, data-loader, formatter, and exporter
  • Added header injection plugin support in SSO proxy

Impact

Significantly reduces code complexity (~1250 lines removed, ~200 added). Token tracking is no longer part of the delta/metrics pipeline.

Checklist

  • Self-reviewed
  • Manual testing performed
  • Documentation updated (if needed)
  • No breaking changes (or clearly documented)

8nevil8 and others added 4 commits March 3, 2026 21:39
- Remove tokenUtils.ts and token-aggregator.ts files
- Remove token fields from MetricDelta and session types
- Simplify metrics processors for Claude, Gemini, and OpenCode plugins
- Clean up analytics aggregator, data-loader, and types
- Add header injection plugin support in SSO proxy

Generated with AI

Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
- Fix repository field in metrics-aggregator to use parent/repo format
  instead of full absolute path (added extractRepository helper)
- Remove stale tokens field from gemini.session-adapter (removed from
  ParsedSession.metrics interface); clean up unused variables and debug log
- Remove save_history property from assistants chat call (not in type)
- Delete token-aggregator.ts and its test (tokens removed from system)
- Remove all token field assertions from conversation and metrics tests
- Remove tokens field from all MetricDelta test fixtures
- Update session-syncer test metric name to codemie_cli_tool_usage_total
- Remove total_*_tokens assertions from integration tests

Generated with AI

Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
MetricDelta.tokens was removed from the schema; remove all d.tokens.*
accesses and analytics.totalTokens.* assertions from the analytics
integration test.

Generated with AI

Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
Generated with AI

Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
@codemie-ai codemie-ai self-requested a review March 4, 2026 08:22
@8nevil8 8nevil8 merged commit 3ee529f into main Mar 4, 2026
5 checks passed
@8nevil8 8nevil8 deleted the EPMCDME-10048 branch March 4, 2026 08:49
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