Agents view Ctrl+X ×2 leaves orphaned .jsonl transcript on disk
Summary
In Claude Code 2.1.139–2.1.140, the Agents view's documented two-press delete (Ctrl+X stop, Ctrl+X again within 2s to delete) does not fully delete the session: the <uuid>/ subdirectory is removed, but the corresponding ~/.claude/projects/<encoded-cwd>/<uuid>.jsonl transcript file is left orphaned on disk.
This contradicts the Agent View docs which state: "To remove a session, press Ctrl+X to stop it and Ctrl+X again within two seconds to delete it." No carve-out for transcript preservation is mentioned.
Reproduction (macOS, claude --version 2.1.140)
- Start a background agent session:
claude --bg(or via Agents view), do one turn. - Note the session UUID and confirm both files exist:
~/.claude/projects/-Users-<you>/<uuid>.jsonl~/.claude/projects/-Users-<you>/<uuid>/(subdir, if any subagent/tool spilled)
- From the Agents view, focus that session and press
Ctrl+Xtwice within 2 seconds. - Confirm:
- The session vanishes from the Agents view ✓
- The
<uuid>/subdirectory is removed ✓ - The
<uuid>.jsonltranscript file is still on disk ✗
Expected
Per the docs, Ctrl+X×2 deletes the session entirely — both the subdir and the .jsonl transcript.
Actual
Only the <uuid>/ subdir is deleted. The .jsonl file orphans, accumulating over time.
Root cause (from binary inspection)
The delete handler mHH (deleteJob) only rm -rfs the job state directory and never unlinks the matching .jsonl:
// mHH (deleteJob):
await BNH.rm(W4(H), {recursive:true, force:true}).catch(()=>{})
// W4(H) returns the job state dir; no matching unlinkSync on <uuid>.jsonl
The jsonl path is derivable elsewhere in the binary (e.g. in ioH / respawn: path.join(zG(await _Y(K.cwd)), ${w}.jsonl)), but mHH simply never calls it.
Related
- #45903 — mirror-image bug (jsonl deleted, subdirs orphaned)
- #41591, #48334 — auto-update cleanup leaves
sessions-index.jsonentries stale - Meta thread on cleanup gaps: #33979
Environment
- macOS 15 (Darwin 24.6.0), Apple Silicon
- Claude Code 2.1.139 and 2.1.140 (Mach-O arm64 native bundle)
- Reproduced multiple times
Impact
Disk usage accumulates indefinitely. Users believe their sessions are deleted but transcripts persist. Third-party cleaners (CC-Cleaner, claude-code-cleaner) exist precisely because of this class of orphan accumulation.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗