Expand description
Prompt cache misses: prompt tokens that were in the previous request’s prompt but were billed again instead of read from the cache.
Port of packages/coding-agent/src/core/cache-stats.ts in pi v1.0.0.
Structs§
- Cache
Miss - A counted cache miss on one assistant message.
- Cache
Waste - Counted misses across a session.
Constants§
- CACHE_
TTL_ MS - Idle gaps longer than this are worth naming as the likely cause of a miss: Anthropic’s default cache lifetime.
Functions§
- collect_
cache_ misses - pi’s
collectCacheMisses: each counted miss with the id of the entry whose message paid for it, for notices when the transcript is drawn again. - compute_
cache_ waste - pi’s
computeCacheWaste: the misses over every entry of a session, in file order. - detect_
cache_ miss - pi’s
detectCacheMiss: the miss a newly finished assistantmessagepaid for.entriesmay already hold the message, where the scan stops.