auditing-agent-token-usage

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Auditing agent token usage

审计 Agent Token 使用量

Run the deterministic audit, then explain its results. The script is the measurement; do not substitute your own log reading for it.
sh
"<skill-dir>/scripts/audit-token-usage.sh" <days>
<days>
is a positive integer, default seven unless the user names another window. The script needs
jq
and reads Claude Code transcripts and Codex rollouts under the home directory. On a nonzero exit, relay stderr and stop.
运行确定性审计,然后解释其结果。该脚本是度量依据;不要以自行阅读日志所得的结果代替它。
sh
"<skill-dir>/scripts/audit-token-usage.sh" <days>
<days>
是一个正整数,除非用户指定其他时间窗口,否则默认为 7。该脚本需要
jq
,并读取用户主目录下的 Claude Code transcripts 和 Codex rollouts。如果退出码非零,则转发 stderr 并停止。

Analyze

分析

  • State the window and which sources had data. Claude Code sections, [1] to [5], measure transcript proxies such as turn counts and character sizes. The Codex section, [6], uses recorded token counts.
  • Identify the largest evidenced costs: expensive model usage, inherited subagent routing, long sessions, compactions, context re-reading, oversized tool results, and configured MCP servers absent from section [5].
  • Recommend only changes the output supports: at most three, ranked by expected impact, each citing the count or percentage behind it.
  • Never present Claude Code proxy values as measured tokens.
  • When a source is absent or the script fails, report the missing data or prerequisite. Do not infer its usage.
  • 说明时间窗口以及哪些数据源有数据。Claude Code 的第 [1] 至 [5] 节衡量 transcripts 的代理指标,例如轮次数和字符大小。Codex 的第 [6] 节使用已记录的 Token 数量。
  • 找出有证据支持的最大成本项:昂贵模型的使用、继承的 subagent 路由、长会话、compactions、上下文重读、过大的工具结果,以及未出现在第 [5] 节中的已配置 MCP 服务器。
  • 仅推荐输出结果所支持的更改:最多三项,按预期影响排序,每项均引用相应的数量或百分比。
  • 绝不能将 Claude Code 的代理指标值表述为实际测得的 Token 数量。
  • 如果某个数据源缺失或脚本运行失败,请报告缺失的数据或先决条件。不要推断其使用情况。