Skip to content

v1.4.3 — stop Claude Code deleting your cost history

Choose a tag to compare

@jayson-jia-dev jayson-jia-dev released this 20 Apr 13:52

⚠️ If you've used Claude Code for more than a month

Your oldest session JSONLs have likely been silently deleted. Claude Code's default cleanupPeriodDays is 30, and on every claude startup it quietly removes files in ~/.claude/projects/**/*.jsonl older than 30 days. No warning, no log, no undo.

For anyone using this plugin, that means cost and token history just evaporates after a month. For heavy users with multiple hundred-dollar months on their stats, 16 days of real data can disappear with no trace.

What v1.4.3 does

On every plugin refresh:

  1. Reads ~/.claude/settings.json
  2. If cleanupPeriodDays < 3650, writes back 99999 (≈274 years — pragmatic "never")
  3. First time it patches, sends a macOS notification so the change isn't invisible
  4. Preserves all other keys in settings.json (atomic write)

Runs before anything else in the plugin so protection activates even if later code crashes.

Why 99999 and not 0?

The docs say 0 means "disable cleanup," but issue #23710 shows it actually disables writing transcripts at all — a silent footgun. 99999 works reliably, matches community workaround recommendations, and is reversible (just edit settings.json).

This doesn't recover lost data

It only prevents future loss. If you've already lost old JSONLs:

  • Anthropic Console is the only place old spend is still visible
  • Future releases won't add recovery capability — the data is gone

For admin-managed Macs

If your team's settings.json is managed by MDM / dotfiles and needs to stay unchanged, you can disable this behavior by removing the plugin before first run — or upstream your own cleanupPeriodDays override so the plugin's patch is a no-op.

Sources