claude-code - 💡(How to fix) Fix Agents view Ctrl+X ×2 leaves orphaned .jsonl transcript on disk [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#58814Fetched 2026-05-14 03:38:50
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Author
Timeline (top)
labeled ×4commented ×1

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.

Root Cause

Root cause (from binary inspection)

The delete handler mHH (deleteJob) only rm -rfs the job state directory and never unlinks the matching .jsonl:

Code Example

// 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
RAW_BUFFERClick to expand / collapse

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)

  1. Start a background agent session: claude --bg (or via Agents view), do one turn.
  2. 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)
  3. From the Agents view, focus that session and press Ctrl+X twice within 2 seconds.
  4. Confirm:
    • The session vanishes from the Agents view ✓
    • The <uuid>/ subdirectory is removed ✓
    • The <uuid>.jsonl transcript 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.json entries 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.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Agents view Ctrl+X ×2 leaves orphaned .jsonl transcript on disk [1 comments, 2 participants]