---
name: learned-claude-token-optimization
description: Use when a Claude or Claude Code session is hitting usage limits or you want to cut token consumption. Provides concrete habits to reduce context-reload costs.
---
# Claude Token Optimization

Core mechanic: Claude re-reads the ENTIRE conversation history (every message, reply, and uploaded file) on every new message before answering. Token cost compounds as the session grows — a message costing 500 tokens early can cost ~10x more by message 30. Reduce what sits in context and how often it reloads.

## The 5 habits

1. **Convert PDFs to text/markdown before uploading.** Claude charges PDFs twice — it reads the text AND renders every page as an image (1,500–3,000 tokens/page; a 50-page PDF ≈ 150,000 tokens just sitting there). Converting to plain `.txt` or `.md` drops the same document to a few thousand tokens.

2. **Batch requests into a single message.** Every separate message = a full context reload. Instead of three messages ("summarize this article", "list the main points", "suggest a headline"), combine into one. Same result at ~1/3 the token cost.

3. **Keep CLAUDE.md under 500 tokens (Claude Code).** The file loads automatically and is charged on every turn for the whole session. A 5,000-token CLAUDE.md costs 5,000 tokens before you type anything, every message. Keep it a tight summary of only what Claude actually needs.

4. **Switch models mid-session with `/model`.** You can change models without losing context. Use Haiku for quick lookups and simple edits; bump to Sonnet/Opus only for heavy lifting. Haiku costs a fraction of Opus. Author reports this alone cut weekly token use by ~60%.

5. **Fix errors surgically, never full redos.** A full redo regenerates the entire output (output tokens) AND that big output then gets re-read on every subsequent message. Instead, point at the exact part: "Only fix the third paragraph, keep everything else." Same result at ~1/10 the tokens.

## Rule of thumb
Before upgrading a plan, audit for these habits first — most limit-hitting is caused by context bloat, not message volume.

Source: https://www.youtube.com/watch?v=4oUNG6PSul4