Client-side estimate calibrated against cl100k_base and Claude BPE tokenization with separate weights for ASCII prose, code punctuation/identifiers, and CJK characters. 100% local — zero text leaves your browser.
Claude Code 40,000-Character Truncation Gauge (Rule I7)
Safely below Claude Code's 40,000-character hard limit. Related AgentLint rules: I7 (40K limit), I6 (length), I1/I2.
Context-Window Footprint Across Frontier Models
Monthly Prompt-Cache Cost Calculator (22 Working Days)
| Model | Monthly Prefix Tokens | Uncached / mo | With 90% Prompt Cache / mo | Monthly Savings |
|---|---|---|---|---|
| Claude Sonnet 4 (200K) | 105.2M | $315.48 | $67.83 | -$247.65 |
| Claude Opus 4 (200K) | 105.2M | $1577.40 | $339.14 | -$1238.26 |
| GPT-4.1 / 4o (128K) | 105.2M | $210.32 | $73.61 | -$136.71 |
| Gemini 2.5 Pro (1M) | 105.2M | $131.45 | $45.77 | -$85.68 |
Frequently Asked Questions
What happens when a CLAUDE.md exceeds 40,000 characters in Claude Code?
Claude Code enforces MAX_MEMORY_CHARACTER_COUNT = 40,000 characters on single memory entry files. Any rules appended past character 40,000 are silently truncated before the prompt reaches the model. AgentLint rule I7 catches this automatically.
Why do Chinese, Japanese, and Korean CLAUDE.md files use more tokens per character?
Standard BPE tokenizers encode common English words into a single token (~3.8–4.2 chars/token), whereas CJK ideographs typically split into 1–2 tokens per character. Keeping prose concise and moving deep docs into conditional read pointers saves both budget and compliance.
How does prompt caching affect CLAUDE.md monthly cost?
Because CLAUDE.md sits near the static prefix of every agent turn, prompt caching discounts repeated reads by up to 90% on Anthropic Claude models — yet oversized files still hurt instruction-following accuracy (IFScale) and cache-miss cold starts.