I measured 8 weeks of Claude Code: 87% lower cost, 86% first-try typecheck
说明与用途
测量了 Claude Code 8 周的使用:提示缓存降低成本 87%,首次类型检查通过率 86%。
问题
Determine the cost savings from prompt caching and the first-try pass rate of typechecks and tests when using Claude Code in a large TypeScript project.
结果
Prompt caching achieved 98.4% cache read, reducing cost by 87.4% over 7.5B input tokens. First-try typecheck passed 86.3% of the time, tests 75.2% (filtered). Unfiltered test pass rate dropped to 52.4%.
工作流
- Collect Claude Code session logs from ~/.claude/projects/**/*.jsonl
- Parse assistant responses for token usage and tool calls
- Deduplicate responses by message id
- Calculate cache ratios and savings using token multipliers
- Replay sessions to identify first-try typecheck and test runs
- Count passes vs. attempts for each check type
- Report filtered and unfiltered pass rates
- Generate summary and actionable insights
证据
Over 8 weeks and 7.5B input tokens: Input tokens read from cache 98.4%
Typecheck 205 attempts, 86.3% passed on first run
One gotcha: Claude Code logs one line per content block, all with the same message id. If you don't deduplicate by id, you count the same response several times.
- 记录日期: 2026-11-03T17:29:11.900Z