token-report

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

/token-report — Roslyn Navigator token savings

/token-report — Roslyn Navigator token 节省报告

What

是什么

Reports what the Roslyn MCP server has actually saved, measured rather than asserted. Two surfaces:
ScopeSurfaceUse when
This repository, mid-session
get_token_savings
MCP tool
"how are we doing here?"
All repositories, aggregate
CWM.RoslynNavigator.Stats
CLI
producing a public number
报告 Roslyn MCP server 实际节省了什么——基于实测,而非口头声称。 两种入口:
范围入口何时使用
当前仓库,会话进行中
get_token_savings
MCP 工具
“我们目前做得怎么样?”
全部仓库,聚合统计
CWM.RoslynNavigator.Stats
CLI
需要对外公布数据时

When

何时使用

  • Deciding whether the MCP server earns its context cost
  • Finding tools nobody calls — a description problem, or a tool that should not exist
  • Backing a claim about token efficiency with something checkable
  • 判断这个 MCP server 是否值得它占用的 context 成本
  • 找出没人调用的工具——可能是描述写得不好,或者这个工具根本不该存在
  • 为关于 token 效率的说法提供可核查的依据

Prerequisite

前置条件

Collection is opt-in and off by default. Nothing was recorded unless the server was started with it enabled:
bash
CWM_ROSLYN_TELEMETRY=on cwm-roslyn-navigator --solution MySolution.sln
Nothing is transmitted. Records are written under
%LOCALAPPDATA%/cwm-roslyn-navigator/
(or the XDG equivalent), outside the repository. Delete that directory to erase everything.
Adoption rate is read from Claude Code transcripts and needs no opt-in, so it is available even when telemetry was never enabled.
数据采集是可选的,默认关闭。 除非启动 server 时显式开启,否则不会有任何记录:
bash
CWM_ROSLYN_TELEMETRY=on cwm-roslyn-navigator --solution MySolution.sln
不会向外传输任何数据。记录写入
%LOCALAPPDATA%/cwm-roslyn-navigator/
(或对应的 XDG 路径)目录,位于仓库之外。删除该目录即可抹除全部数据。
采用率数据从 Claude Code 的会话记录(transcripts)中读取,无需开启采集,因此即使从未启用 telemetry 也依然可用。

How

如何使用

1 — This repository, mid-session. Call the
get_token_savings
MCP tool. Returns totals, a per-tool leaderboard, separate zero-result / not-ready / error counts, and the methodology. If it reports
Enabled: false
, telemetry was never turned on — say so rather than reporting zero as if it were a measurement.
2 — All repositories.
bash
cd mcp/CWM.RoslynNavigator
dotnet run --project stats/CWM.RoslynNavigator.Stats.csproj            # table
dotnet run --project stats/CWM.RoslynNavigator.Stats.csproj -- --markdown
dotnet run --project stats/CWM.RoslynNavigator.Stats.csproj -- --json
dotnet run --project stats/CWM.RoslynNavigator.Stats.csproj -- --repo myapp
3 — Interpret it honestly. Three things must be said whenever a number is quoted:
  • The divisor is uncalibrated. 3.5 bytes/token is an estimate, and it scales every figure linearly. If
    DivisorCalibrated
    is false, the number is indicative, not precise.
  • The baseline understates. It counts only the files an answer came from, ignoring the wrong files a text search would have opened first.
  • Adoption is biased upward. Its denominator counts only Read/Grep/Glob calls that demonstrably targeted C#; ambiguous searches are excluded.
4 — Act on the leaderboard. A tool with no calls is the actionable finding. Low adoption in a configured repository usually means a tool description is not attracting the work it should — more useful than the savings figure itself.
1 — 当前仓库,会话进行中。 调用
get_token_savings
MCP 工具。它会返回 总量、按工具划分的排行榜、零结果/未就绪/错误的独立计数,以及测算方法。 如果它返回
Enabled: false
,说明从未开启过 telemetry——请如实说明,而不是把零当作 测量结果来汇报。
2 — 全部仓库。
bash
cd mcp/CWM.RoslynNavigator
dotnet run --project stats/CWM.RoslynNavigator.Stats.csproj            # 表格
dotnet run --project stats/CWM.RoslynNavigator.Stats.csproj -- --markdown
dotnet run --project stats/CWM.RoslynNavigator.Stats.csproj -- --json
dotnet run --project stats/CWM.RoslynNavigator.Stats.csproj -- --repo myapp
3 — 如实解读。 只要引用某个数字,就必须同时说明三件事:
  • 除数(divisor)未经校准。 3.5 bytes/token 只是一个估算值,且会线性地放大 所有结果。如果
    DivisorCalibrated
    为 false,该数字仅供参考,并不精确。
  • 基线被低估。 它只统计最终产生答案所依据的文件,忽略了文本搜索会先打开的那些 无关文件。
  • 采用率存在向上偏差。 它的分母只统计明确指向 C# 的 Read/Grep/Glob 调用,含义不明的 搜索被排除在外。
4 — 根据排行榜采取行动。 没有被调用的工具才是真正有行动价值的发现。在一个已配置的 仓库中采用率偏低,通常意味着某个工具的描述没有吸引到它本该承担的工作——这一点比节省数字 本身更有意义。

Calibrating the divisor

校准除数(divisor)

Turns the one estimated input into a measurement. Free, manual, and never run by the server:
bash
dotnet run --project stats/CWM.RoslynNavigator.Stats.csproj -- calibrate \
  --api-key $ANTHROPIC_API_KEY --path /path/to/dotnet/repo --sample 200
Samples C# files, gets exact counts from the Anthropic
count_tokens
endpoint, and regresses bytes against tokens. Apply the result to
TokenEstimator
in the server and record the sample size and R² next to the constant so the figure stays checkable.
把唯一的估算输入变成实测值。免费、手动执行,server 自身绝不会运行:
bash
dotnet run --project stats/CWM.RoslynNavigator.Stats.csproj -- calibrate \
  --api-key $ANTHROPIC_API_KEY --path /path/to/dotnet/repo --sample 200
它会对 C# 文件取样,通过 Anthropic 的
count_tokens
接口获取精确计数,并对 bytes 与 tokens 做回归分析。将结果应用到 server 中的
TokenEstimator
,并把样本量与 R² 记录在常量 旁边,以便该数字始终可核查。

Example

示例

  Repositories        3  (1 with telemetry)
  Tool calls          412
  Tokens saved        1,284,000
  Adoption            68%

  Tool leaderboard
  tool                  calls      saved   p50 ms  0-result
  find_references         180    612,000       84        4%
  find_symbol             150    431,000       22        2%

  Never called (2): get_nuget_packages, resolve_stack_trace
  Divisor: 3.5 bytes/token — UNCALIBRATED estimate.
When the server was never invoked, the report says so plainly instead of printing zeros — "no calls" and "no savings" are different findings.
  Repositories        3  (1 with telemetry)
  Tool calls          412
  Tokens saved        1,284,000
  Adoption            68%

  Tool leaderboard
  tool                  calls      saved   p50 ms  0-result
  find_references         180    612,000       84        4%
  find_symbol             150    431,000       22        2%

  Never called (2): get_nuget_packages, resolve_stack_trace
  Divisor: 3.5 bytes/token — UNCALIBRATED estimate.
当 server 从未被调用时,报告会直白地说明这一点,而不是打印一串零——“没有调用”和 “没有节省”是两种不同的结论。

Related

相关

  • /verify
    — quality gates before a PR
  • /health-check
    — codebase health grades
  • /verify
    — PR 前的质量门禁
  • /health-check
    — 代码库健康度评分