DEV Community

Dinesh Rajendran
Dinesh Rajendran

Posted on Originally published at l2cache.app

Why Resuming Cold Claude Code Sessions Burns Your Quota (and How to Stop It)

If you use Claude Code or OpenAI Codex CLI, you may have experienced hitting your 5-hour quota or weekly allowance on your very first turn of the day.

Here is the technical reason:
Anthropic's prompt cache TTL is 60 minutes (and Codex CLI is just 10 minutes).

When you resume an active 150k+ token conversation after the cache expires (claude --resume), Anthropic cannot perform an ephemeral cache read ($0.30/M). Instead, the model is forced to re-write and re-index the entire history at full cache creation rates ($3.75/M).

A single message sent into a cold session burns ~18% of your rolling 5-hour quota and ~2% of your weekly allowance before you write a single line of new code.


The Fix: Cold Resume Guard

We built and open-sourced cold-resume-guard, a lightweight terminal wrapper:

brew install amvotech/tap/cold-resume-guard && cold-resume-guard --setup
Enter fullscreen mode Exit fullscreen mode

(Or via pip: pip install claude-cold-resume-guard)

What It Does:

  1. Intercepts Resumes: Monitors claude --resume and codex resume.
  2. Evaluates Cache TTL: Checks session age and accumulated token size. If warm, it launches transparently with zero latency.
  3. Calculates Exact Penalty: If cold, it halts and shows you the exact reload penalty (~18.3% of 5h quota · ~2.3% of weekly).
  4. Enriched Git Handoff: If you abort ([N]), it inspects your git repository (active branch, last commit message, modified files) and generates a structured ~75-token handoff prompt copied straight to your macOS clipboard (pbcopy).
⚠️  [Claude Code Guard] Prompt Cache Expired
• Session: Frontend refactor and ant plugins (id: e1af7753)
• Context: Project: web-client | Branch: main
• Last Active: 20.0h ago (TTL is 60m)
• Accumulated Context: ~365,675 tokens (1338 events)
• Cold Reload Penalty: ~457,093 weighted input tokens (~18.3% of 5h quota · ~2.3% of weekly)

Proceed into cold Claude Code session anyway? [y/N]: N

✓ Launch blocked.
📋 Rich handoff prompt copied to your clipboard.
Run a fresh session (claude) and press ⌘V to continue at ~3k tokens.
Enter fullscreen mode Exit fullscreen mode

Instead of sending 175,000 tokens into an expired cache, you start a clean session with claude, press ⌘V, and continue immediately.

Top comments (0)