Skip to main content

Token Metrics Live Run Report

Issue: #144

Date: 2026-07-02 (codex run); 2026-07-03 (claude-cli rerun, see claude-cli section below)

Target Project

The live run used this repository as the target project:

  • Repository: https://github.com/MercurieVV/ScalaSemantic.git
  • Commit: 99b17c3981a1fb50ed20587ab92afcfd7fc2d66a

Engine and Model Details

  • Engine: Codex
  • Version: codex-cli 0.142.5
  • Model: o3

Measured Task

Find all definitions and references of the Animal trait in this repository's fixture sources.

Results Summary

  • WITHOUT MCP (Baseline): Average total tokens = 156580.3 (Input: 154179.3, Output: 2401.0)
  • WITH MCP (ScalaSemantic): Average total tokens = 150239.3 (Input: 148626.7, Output: 1612.7)
  • Token Savings: 6341.0 tokens (4.0% reduction)

Detailed Runs

RunArmInput TokensCache TokensOutput TokensTotal Tokens
1with-mcp114621846081083115704
2with-mcp2016031475842251203854
3with-mcp1296561003521504131160
1without-mcp1795001354242641182141
2without-mcp125781979202093127874
3without-mcp1572571283842469159726

Conclusion

Using the ScalaSemantic MCP server allows Codex to perform precise definitions and usages analysis using high-signal SemanticDB facts rather than doing full-text grep and reading raw files. This leads to a 4.0% reduction in total tokens consumed.

claude-cli rerun (2026-07-03)

The first live run produced no claude-cli data (the CLI was not logged in). After fixing authentication, the same task was rerun on claude-cli:

  • Engine: Claude Code (claude-cli), version 2.1.199
  • Model: claude-sonnet-5
  • Commit: cf9d6bbd8e310f2794460fa784188072095072a7
  • ScalaSemantic server version: 0.3.10 (published launcher)
  • Same task prompt, 3 repetitions per arm, fresh session per run.
  • Token accounting: modelUsage from --output-format json (sums all model calls including subagents); inputTokens = input + cacheCreation + cacheRead so it is total-context-consumed, matching codex semantics; cacheTokens = the cacheRead subset.
  • Arm validity checked in session transcripts: with-mcp runs made 6-8 mcp__scala-semantic__* calls and zero Grep/Read; without-mcp runs used Grep/Bash/Explore-agent only and made zero ScalaSemantic calls.

Results Summary (claude-cli)

  • WITHOUT MCP (Baseline): Average total tokens = 266332.7
  • WITH MCP (ScalaSemantic): Average total tokens = 154085.0
  • Token Savings: 112247.7 tokens (42.1% reduction)

Detailed Runs (claude-cli)

RunArmInput TokensCache TokensOutput TokensTotal Tokens
1with-mcp177329140374729178058
2with-mcp141374119938887142261
3with-mcp141473121642463141936
1without-mcp2391032256521474240577
2without-mcp2136501872631437215087
3without-mcp3388142818144520343334

Unlike the codex 4.0% result, this delta is larger than the run-to-run spread: the with-mcp arm's standard deviation is ~17k tokens and the without-mcp arm's ~55k, against a 112k mean delta (~2x the noisier arm's standard deviation). The without-mcp run 3 outlier (343k) spawned an Explore subagent; excluding it, the reduction is still ~32%.