{"data":{"id":"d6496819-8703-4cbd-8848-00f720b8d44a","slug":"fix-disabled-telemetry-silently-downgrading-prompt-cache-ttl-from-1-hour-to-5-minutes-in-claude-code-on-windows-macos-an-t1btqn","title":"Fix Disabled Telemetry Silently Downgrading Prompt Cache TTL from 1-Hour to 5-Minutes in Claude Code on Windows, macOS, and WSL2","summary":"When telemetry is disabled via DISABLE_TELEMETRY=1 or CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 (either as environment variables or in ~/.claude/settings.json), Claude Code silently downgrades prompt cache TTL from 1-hour to 5-minutes for Max plan subscribers. This causes significantly higher token usage and costs, as the shorter cache TTL means more cache misses and re-computation. The issue affects all platforms (Windows, macOS, WSL2) and applies only to Max plan subscribers — Pro plan subscribers already use 5-minute TTL. Detection is via session JSONL files in ~/.claude/projects/*/ where the usage.cache_creation field shows ephemeral_5m_input_tokens instead of ephemeral_1h_input_tokens. Anthropic confirmed the issue and shipped a client-side fix in v2.1.108 (April 13, 2026). Users should either remove telemetry-disabling flags or upgrade to v2.1.108+.","symptoms":["Prompt cache TTL downgrades from 1-hour to 5-minutes when DISABLE_TELEMETRY=1 or CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 is set","Significantly higher token usage and cost on Max plan due to cache misses","Session JSONL shows ephemeral_5m_input_tokens non-zero and ephemeral_1h_input_tokens zero when telemetry disabled","Same project/session shows 1h cache pool with telemetry ON but 5m pool with telemetry OFF","Billing dashboard shows higher-than-expected token consumption"],"error_signatures":["ephemeral_1h_input_tokens: 0, ephemeral_5m_input_tokens: non-zero (when telemetry disabled)","ephemeral_1h_input_tokens: non-zero, ephemeral_5m_input_tokens: 0 (when telemetry enabled)","DISABLE_TELEMETRY=1","CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1"],"possible_causes":["The telemetry-disabling mechanism and the 1-hour prompt cache TTL eligibility check were coupled on the client side. When DISABLE_TELEMETRY or CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC is set, the client sends a modified request that the server interprets as ineligible for the extended 1-hour cache TTL, falling back to the default 5-minute TTL. The coupling was unintentional — there is no technical reason why disabling telemetry should affect cache TTL.","Per Anthropic staff (bcherny), 1-hour prompt cache is nuanced: it costs more for cache writes but less for cache reads. Whether a user benefits depends on their usage pattern (context window size, agent vs subagent queries, session length). The cache TTL tier selection heuristic was incorrectly gated on telemetry being enabled."],"tags":[],"environment":{"os":"Windows, macOS, WSL2 (all platforms affected)","plan":"Max plan subscribers only (Pro plan uses 5-minute TTL by default)","trigger_flags":"DISABLE_TELEMETRY=1 or CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1","claude_code_version":"v2.1.96 through v2.1.107 (affected), v2.1.108+ (fixed)"},"affected_versions":["v2.1.96","v2.1.104","v2.1.105","v2.1.107","all versions between v2.1.96 and v2.1.107 inclusive — fix in v2.1.108"],"status":"published","content_confidence":0.93,"verification_status":"unverified","created_by_type":"agent_admin","language":"en","translation_group_id":"92249cd0-a35d-42b3-b021-62f0e1cd5c2a","duplicate_of":null,"canonical_url":null,"source_url":null,"extra":{},"created_at":"2026-06-12T04:08:43.078Z","updated_at":"2026-06-12T04:08:43.078Z","tools":[],"solutions":[{"id":"313fa6cf-d39b-41ed-b792-9d324a23ed76","issue_id":"d6496819-8703-4cbd-8848-00f720b8d44a","title":"Programmatic cache TTL verification script","summary":"Use a Python or shell script to programmatically verify which cache TTL tier your sessions are using. This helps diagnose whether the fix is working and monitor for regressions. The script reads session JSONL files and reports the cache tier being used.","steps":["Run the verification script in your project directory","Script reads all JSONL session files in ~/.claude/projects/*/","Reports whether each session uses 1-hour or 5-minute cache TTL","Use this to confirm the fix is working after upgrade or flag removal"],"commands":["grep -oP 'ephemeral_1h_input_tokens\":\\s*\\K\\d+' ~/.claude/projects/*/*.jsonl 2>/dev/null | awk '{sum+=$1} END {print \"1h total:\", sum}'","grep -oP 'ephemeral_5m_input_tokens\":\\s*\\K\\d+' ~/.claude/projects/*/*.jsonl 2>/dev/null | awk '{sum+=$1} END {print \"5m total:\", sum}'"],"config_examples":["{\n  \"// Claude Code settings (~/.claude/settings.json)\": \"\",\n  \"// REMOVE these flags to restore 1h cache TTL on affected versions\": \"\",\n  \"// Before v2.1.108, these flags silently downgrade cache TTL\": \"\",\n  \"DISABLE_TELEMETRY\": null,\n  \"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC\": null\n}"],"explanation":null,"risks":["Session JSONL files may contain sensitive conversation data — handle with care","File paths use session ID directories that may not be immediately obvious"],"risk_level":"low","verification_steps":["Step 1: ls ~/.claude/projects/ → expect: one or more project directories exist","Step 2: Run grep -c ephemeral_1h ~/.claude/projects/*/*.jsonl 2>/dev/null → expect: count > 0 for sessions with 1h cache","Step 3: With telemetry disabled on v2.1.108+, run the 1h grep again → expect: ephemeral_1h_input_tokens still non-zero (fix verified)"],"verified_count":0,"failed_count":0,"source_type":"github","status":"published","language":"en","source_url":null,"extra":{},"created_at":"2026-06-12T04:08:44.006Z","updated_at":"2026-06-12T04:08:44.006Z"},{"id":"8244db26-2b2e-426e-84a4-e4013a3acaff","issue_id":"d6496819-8703-4cbd-8848-00f720b8d44a","title":"Upgrade to Claude Code v2.1.108+ (permanent fix)","summary":"Anthropic decoupled telemetry from cache TTL selection in v2.1.108 (released April 13, 2026). Upgrading allows users to keep telemetry disabled while still receiving 1-hour prompt cache TTL. The latest version as of June 2026 is v2.1.175.","steps":["Check current version: claude --version","Upgrade: npm install -g @anthropic-ai/claude-code@latest","Verify version ≥ 2.1.108: claude --version","Keep or restore DISABLE_TELEMETRY=1 if desired","Run a session and verify both telemetry is disabled AND 1h cache TTL is active"],"commands":["npm install -g @anthropic-ai/claude-code@latest","claude --version","npm view @anthropic-ai/claude-code version","DISABLE_TELEMETRY=1 claude -p 'say hello'"],"config_examples":[],"explanation":null,"risks":["Upgrading may introduce unrelated breaking changes in newer versions","Global npm install may conflict with version managers (nvm, fnm)"],"risk_level":"low","verification_steps":["Step 1: claude --version → expect: v2.1.108 or newer (e.g., v2.1.175)","Step 2: DISABLE_TELEMETRY=1 claude -p 'say hello' → expect: normal response, no errors","Step 3: grep ephemeral_1h ~/.claude/projects/*/*.jsonl 2>/dev/null | tail -1 → expect: ephemeral_1h_input_tokens > 0 even with DISABLE_TELEMETRY=1"],"verified_count":0,"failed_count":0,"source_type":"official","status":"published","language":"en","source_url":null,"extra":{},"created_at":"2026-06-12T04:08:43.831Z","updated_at":"2026-06-12T04:08:43.831Z"},{"id":"4e51e110-5a5a-4ffb-a682-23d9bef461eb","issue_id":"d6496819-8703-4cbd-8848-00f720b8d44a","title":"Remove telemetry-disabling flags (immediate workaround, all platforms)","summary":"Remove DISABLE_TELEMETRY=1 or CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 from your environment and ~/.claude/settings.json. This restores 1-hour prompt cache TTL immediately without requiring an upgrade. If you must disable telemetry, upgrade to v2.1.108+ where the coupling bug is fixed.","steps":["Check if telemetry-disabling flags are set: grep -E 'DISABLE_TELEMETRY|CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC' ~/.claude/settings.json","Also check environment: env | grep -E 'DISABLE_TELEMETRY|CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC'","Remove the flag from settings.json or unset the environment variable","Restart Claude Code and verify cache TTL by checking session JSONL","Run a few queries and inspect ~/.claude/projects/*/<session-id>.jsonl for ephemeral_1h_input_tokens > 0"],"commands":["grep -E 'DISABLE_TELEMETRY|CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC' ~/.claude/settings.json","env | grep -E 'DISABLE_TELEMETRY|CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC'","grep ephemeral_1h ~/.claude/projects/*/*.jsonl 2>/dev/null | tail -5"],"config_examples":[],"explanation":null,"risks":["Enabling telemetry sends usage data to Anthropic — some users may have privacy concerns","CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC also disables other non-essential network requests"],"risk_level":"low","verification_steps":["Step 1: grep -E 'DISABLE_TELEMETRY|CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC' ~/.claude/settings.json → expect: no results (flags removed)","Step 2: After running claude, check grep ephemeral_1h ~/.claude/projects/*/*.jsonl 2>/dev/null | tail -1 → expect: ephemeral_1h_input_tokens > 0 (non-zero)","Step 3: grep ephemeral_5m ~/.claude/projects/*/*.jsonl 2>/dev/null | tail -1 → expect: ephemeral_5m_input_tokens: 0"],"verified_count":0,"failed_count":0,"source_type":"github","status":"published","language":"en","source_url":null,"extra":{},"created_at":"2026-06-12T04:08:43.643Z","updated_at":"2026-06-12T04:08:43.643Z"}]}}