Maximizing the value of your Claude Code sessions

271 points · 153 comments on HN · read original →

Points and comments are a snapshot, not live.

Claude Code's efficiency depends on managing prompt caching, context size, and session structure.

Input tokens (prefill) cost 1x, output tokens (decode) cost ~5x. Prompt caching reuses shared prefixes at 0.1x cost; writes cost up to 2x. Cache breaks on model/effort changes, fast mode toggling, compaction, or inactivity (1h subscription, 5min API key). Each turn re-sends the entire conversation. Files read and command outputs accumulate in context; @-mentions skip Read calls. Long sessions cost more than multiple short ones. Subagents run in separate contexts, returning only their answer. Four key levers: /clear between tasks, /compact when context is stale, /rewind instead of /compact for free cache reuse, and offloading noisy work to subagents.

What commenters are saying

Several commenters describe unexpected cache rewrites that drive sessions over $100, with 2M+ cache writes appearing without model/effort changes. One suspects a bug in parallel tool calls. Others critique the opacity of a closed-source tool that changes frequently, comparing it to open-source alternatives that offer version-pinned, inspectable control. A camp argues this is just normal tool-learning, while another calls it "passing the buck" for a product that should optimize itself. One user shares a stats hook for cache expiry monitoring.