[FEATURE] Compress session transcripts on disk (~65% reclaimed)

Status Open
Maintainer reply None cached
Activity 0 comments · opened Jul 25, 2026

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

Session transcripts accumulate as uncompressed .jsonl in ~/.claude/projects/<encoded-dir>/ and are never compacted. On my machine that directory is 423 MB across 732 transcripts, and the growth is fast: only 92 files are older than 30 days and they account for just 12 MB, so essentially all of it was written in the past month — about 13 MB/day. At that rate a year of normal use is several GB of plain-text JSON sitting on an SSD.

This is nearly all cold data. Transcripts are append-only and are read only when a session is resumed or searched; once a session is archived or simply not the one I'm working in, the file is never touched again. Paying full uncompressed size for it is pure waste.

Disk pressure from Claude Code has already caused real failures elsewhere — #69734 reports --resume hanging silently when the disk quota is exceeded — so this isn't only about tidiness.

Proposed Solution

Store transcripts compressed once a session is no longer active, and decompress transparently on read.

Measured on my own 388 MB of transcript content, compressing each file individually with plain gzip -6:

388 MB -> 137 MB 2.8x, saves 251 MB (65%)

Ratios per file typically run 3x–4.3x; the low outlier was 1.6x on a transcript carrying base64-heavy content. zstd would do better on both ratio and speed, but even stock gzip reclaims about two-thirds of the directory.

Suggested behavior:

  • Compress a transcript when its session stops being the active one — on archive at minimum, and ideally for any session not currently open. Compressing only archived sessions would reclaim very little in practice, since the bulk of the bytes are recent.
  • Decompress transparently on resume and on transcript search, so nothing user-facing changes. Keeping the .jsonl.gz (or .zst) name alongside the same UUID means external tooling can still find and open a session with a one-step decompress.
  • Optionally expose it as a setting for anyone who wants the files left as-is for external tooling.

Alternative Solutions

_No response_

Priority

Low - Nice to have

Feature Category

CLI commands and flags

Use Case Example

  1. I use Claude Code daily across several repos, accumulating roughly 13 MB of transcripts per day.
  2. After a few months ~/.claude/projects is multiple GB, nearly all of it sessions I will never resume.
  3. My options today are to leave it or to delete transcripts by hand, losing history and the ability to search it.
  4. With transparent compression the same history occupies about a third of the space, and resume and search behave exactly as they do now.

Additional Context

_No response_

View original on GitHub ↗