[BUG] /clear inherits previous session name instead of resetting it, causing duplicate-named sessions in /resume

Status Open
Maintainer reply None cached
Activity 12 comments · opened May 21, 2026

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

  1. Start a new Claude Code session in the terminal CLI
  2. Rename it via /rename (e.g., "My Test Session")
  3. Confirm the name appears in the macOS title bar
  4. Run /clear
  5. Observe: title bar still shows * My Test Session — name was not reset
  6. Have a new conversation in this cleared session
  7. Run /resume from 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: /clear does 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: /clear semantics discussion (context)

View original on GitHub ↗

9 Comments

github-actions[bot] · 3 months ago

Found 2 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/27329
  2. https://github.com/anthropics/claude-code/issues/26082

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

eliasjamesbermudez · 3 months ago

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.

virhdr · 2 months ago

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.

RonUlitsky · 2 months ago

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 adding platform:windows or dropping platform:macos to 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.

carlbastos · 2 months ago

Reproducing on macOS CLI, v2.1.179 (also affected, with quantified data).

Same bug, plain /clear in 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:

  • **The new post-/clear session's first records are duplicated custom-title entries carrying the previous session's name - written at line 0 and** line 2 of the new file, before /clear and 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.
  • The stale title propagates across multiple unrelated sessions. In my data a single custom title leaked onto 3 completely unrelated sessions created later via /clear (each on a different topic). All three showed up under that one name in /resume.
  • It only sticks when you don't /rename afterward. Sessions I happened to /rename self-corrected; the ones I didn't stayed permanently mislabeled.
  • The title is held in memory per-process and flushed into the new session on /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 /clear avoids 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.

Lord0fBytes · 1 month ago

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.

heestore · 1 month ago

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 /clear within the same session.

Evidence in #81813: two sessions with different sessionIds, same cwd, 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.

heestore · 1 month ago

Correction to my earlier comment: #81813 turned out to be caused by a third-party UserPromptSubmit hook emitting hookSpecificOutput.sessionTitle on 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.

Polloinfilzato · 28 days ago

Reproducing this as well (macOS). Also noticed the companion problem: /color has no way to persist across /clear or new sessions either — see the (closed as duplicate/not-planned) requests #28708, #41887, #50393. Both /rename and /color state seem to get lost or corrupted around /clear, would be great to see both addressed together since they're clearly related session-metadata issues.

Showing cached comments. Read the full discussion on GitHub ↗