[BUG] /clear inherits previous session name instead of resetting it, causing duplicate-named sessions in /resume
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
What's Wrong?
Running /clear in the CLI terminal clears conversation history but does not reset the session name. The previous session's name persists in the macOS title bar after /clear, marked with a * prefix (e.g., * My Session Name). The new post-clear session is created with the same name as the old one.
When using /resume, both sessions appear under the same name with no way to distinguish them from the picker.
Steps to Reproduce
- Start a new Claude Code session in the terminal CLI
- Rename it via
/rename(e.g., "My Test Session") - Confirm the name appears in the macOS title bar
- Run
/clear - Observe: title bar still shows
* My Test Session— name was not reset - Have a new conversation in this cleared session
- Run
/resumefrom a new session — both the original and post-clear session appear as "My Test Session" with no way to differentiate them
Expected Behavior
/clear should reset the session name so the new session starts unnamed and is treated as distinct in /resume.
Actual Behavior
Session name persists after /clear. The new session inherits the name, creating duplicate-named entries in /resume with different content and no way to tell them apart.
Is this a regression?
Yes, this worked in a previous version
Last Working Version
v2.1.89
Claude Code Version
v2.1.146
Platform
Claude Max
Operating System
macOS
Terminal/Shell
fish
Related Issues
- #59534:
/cleardoes not preserve the previous session for/resume(related regression, different symptom) - #60106:
clear(new)/clear(reset)orphans sessions in agents-view under duplicate titles (same duplicate-title failure mode, different surface) - #37451:
/clearsemantics discussion (context)
Showing cached comments. Read the full discussion on GitHub ↗
9 Comments
Found 2 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
These both look like the same bug, but they're already closed (one completed in Feb, one stale). Since it works in v2.1.89 but not v2.1.146, this seems like a regression worth keeping open. Happy to share more details if useful.
Yes this bug is certainly still open or did re-appear. It is quiet annoying when you work a lot with sessions and have many duplicates of the same session name appearing under /resume 🫠 and you have to guess which was the one you actually meant and which were others which you did not explicitly rename.
Also reproducing on Windows 11 (PowerShell), Claude Code v2.1.181. Same repro as the original post. This issue is labelled
platform:macos, but it's happening on Windows too, so it doesn't look macOS-specific. Might be worth addingplatform:windowsor droppingplatform:macosto reflect that.FYI for anyone following: this repo's stale bot exempts issues with 10+ 👍 reactions on the original post, so reacting there is the most useful way to keep this open.
Reproducing on macOS CLI, v2.1.179 (also affected, with quantified data).
Same bug, plain
/clearin the terminal (no VS Code, no worktree isolation). Environment: macOS (Darwin 25.5.0), Claude Code v2.1.179.I scanned all 55 of my session JSONL files to measure the blast radius. Findings that may help pin the mechanism:
/clearsession's first records are duplicatedcustom-titleentries carrying the previous session's name - written at line 0 and** line 2 of the new file, before/clearand before the first real prompt. This matches the now-closed #59237 ("custom-title written twice at the top"), so that report and this one are the same bug./clear(each on a different topic). All three showed up under that one name in/resume./renameafterward. Sessions I happened to/renameself-corrected; the ones I didn't stayed permanently mislabeled./clear. Evidence: a session started after a 6-day gap (guaranteed fresh process) got the correct title, never inheriting anything. So fully quitting and relaunching Claude Code instead of using/clearavoids the leak entirely - a fresh process has no cached title to flush. That is a more reliable workaround than re-/renameing, for anyone hitting this.Confirming this is a CLI bug, not the VS Code last-prompt-override path (#32150/#40787). +1 to keep it open.
Confirming this regression also reproduces on Windows (not just macOS), on a newer version than reported here —
Claude Code v2.1.209, Windows Server 2022.
Working from a single long-lived project directory with many accumulated sessions, I found the same pattern
described above: several .jsonl session files with completely unrelated conversation content (different topics,
different dates, different session IDs) all sharing an identical customTitle value, with that value written as the
very first line of the file — before any conversation content exists — and no corresponding agent-name (manual
rename) event to explain it. One title string was reused across at least 3 sessions; another across 7 sessions
spanning multiple weeks. The /resume picker shows all of these as indistinguishable duplicate entries, matching the symptom in #59242.
This suggests the fix for #59237/#59242 either didn't fully address the root cause, or the regression reintroduced
it — and it isn't macOS-specific.
Possibly related: filed #81813 for what looks like the same underlying mechanism (a session's auto-generated name isn't freshly derived from its own conversation, but is instead carried over/reused from another, unrelated session), just triggered differently — opening a new session in a working directory another session was recently active in, rather than
/clearwithin the same session.Evidence in #81813: two sessions with different
sessionIds, samecwd, ended up with the identical name. One session's name was a correct summary of its own (extensive) conversation; the other session — which never discussed that topic at all — inherited that same name anyway. The two sessions' active time windows were adjacent/overlapping.If a maintainer confirms this is the same root cause as this issue, #81813 could probably be closed as a duplicate of this one — leaving that judgment call to you.
Correction to my earlier comment: #81813 turned out to be caused by a third-party
UserPromptSubmithook emittinghookSpecificOutput.sessionTitleon every prompt (title derived from a project file, identical for all sessions in the same cwd) — not by core title inheritance. It has been closed as not-a-Claude-Code-bug and is unrelated to this issue after all. Sorry for the noise.Reproducing this as well (macOS). Also noticed the companion problem:
/colorhas no way to persist across/clearor new sessions either — see the (closed as duplicate/not-planned) requests #28708, #41887, #50393. Both/renameand/colorstate seem to get lost or corrupted around/clear, would be great to see both addressed together since they're clearly related session-metadata issues.