Claude Code 30 分鐘省 81%:prompt caching 的三條鐵律 episode artwork

EPISODE · Apr 20, 2026 · 6 MIN

Claude Code 30 分鐘省 81%:prompt caching 的三條鐵律

from 脈報 · host 思思主播

Claude Code 一場 30 分鐘 session 省 81%、命中率 92%。這不是 API 開關,是三條 prompt caching 鐵律。拆 hash 折點「1+2=3 命中、2+1 miss」與三個 production 踩雷。 ⭐ 文章深度讀:整理了 92% 命中率背後的紀律與 3 個 production 踩雷 → https://heymaibao.com/claude-code-prompt-cache-discipline/ ⚡ 章節重點 一場 30 分鐘 session 省 81% 的帳單 00:00 開 cache 為什麼不等於省錢 00:46 前段 vs 後段:指紋一字之差就 miss 01:43 三條鐵律與 2+1 為什麼 miss 03:18 幫你的 agent 做快取健檢 04:52 📝 懶人包 ∙ Cache read 只要原價的 0.1 倍,但 prompt 的前段 (prefix) 只要被動到一個字,整段 20,000 tokens 就要以全價重新算一次。你想像的「開 cache 就等於省錢」是假的,真正省不省,看你能不能讓 prefix 完全不動。 ∙ Claude Code 30 分鐘 session 可以做到 92% cache 命中率,2M tokens 從 $6 降到 $1.15,省 81%。這個 81% 不是 API 設定好就有,是每個產品決策 (subagent 只收摘要不收原始結果、用 reminder tag 取代改 system prompt、tool 定義一次載入完不再動) 都在保護同一個 prefix 的指紋。 ∙ 三條鐵律:不要在 session 中途改 tools (會清空整份 cache)、不要中途切 model (cache 是綁 model 的)、不要為了更新 state 去改 prefix。想更新 state 的正確做法是在下一則 user message 後面掛一個 reminder tag (一段寫在對話裡的提示字串,不動 prefix 就能把訊息傳給模型),讓 prefix 完全不動。 ∙ 我的觀察:這套紀律比多數 agent 框架的預設做法都嚴格。很多框架會把 session state 塞進 system prompt、用 timestamp 當 prompt 一部分、根據情境動態增減工具,這些做法會讓 cache 命中率悄悄崩潰,成本不是線性增加,是階梯式飆升。讀完建議回頭檢查自己的系統有沒有中這些陷阱。 📚 參考資料 Daily Dose of Data Science - LLMOps Crash Course Part 1 → https://www.dailydoseofds.com/llmops-crash-course-part-1/ Avi Chawla 在 X 的 prompt caching 串文 → https://x.com/_avichawla/status/2044670188998803855

Episode metadata supplied by the publisher feed · Published Apr 20, 2026

Embed this episode

NOW PLAYING

Claude Code 30 分鐘省 81%:prompt caching 的三條鐵律

0:00 6:23

No transcript for this episode yet

We transcribe on demand. Request one and we'll notify you when it's ready — usually under 10 minutes.

No similar episodes found.

Frequently Asked Questions

How long is this episode of 脈報?

This episode is 6 minutes long.

When was this 脈報 episode published?

This episode was published on April 20, 2026.

Can I download this 脈報 episode?

Yes. Use the download control on the episode player to save the publisher-provided media file.
URL copied to clipboard!