[BUG] /clear after /rename: new session inherits the previous session's custom-title

Resolved 💬 2 comments Opened May 14, 2026 by koccintosful Closed May 14, 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)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Summary

When a session is renamed with /rename <name> and then /clear is invoked (without an argument), the freshly created session JSONL inherits the previous session's customTitle in its very first records, even though /clear creates a brand new session (new sessionId, parentUuid:null, SessionStart:clear hook). This produces multiple separate sessions that all show up under the same name in /resume.

## Steps to reproduce

  1. Start a new session.
  2. Run /rename my_session_name.
  3. Do some work so the session has content.
  4. Run /clear (with no argument).
  5. Inspect ~/.claude/projects/<project-slug>/<new-session-uuid>.jsonl.

## Expected

The new session JSONL should have no custom-title record, or a fresh empty/default title — /clear is supposed to start a new session. (For the explicit case, /clear <name> exists since v2.1.136 — see #57445.)

Actual

The first two lines of the new session's JSONL are duplicated custom-title records carrying the previous session's name:

``jsonl
{"type":"custom-title","customTitle":"my_session_name","sessionId":"<NEW-UUID>"}
{"type":"custom-title","customTitle":"my_session_name","sessionId":"<NEW-UUID>"}
{"type":"file-history-snapshot", ...}
{"parentUuid":null,"isSidechain":false,"attachment":{"type":"hook_success","hookName":"SessionStart:clear", ...}}
``

Notes from the evidence:

  • parentUuid is null and the hook is SessionStart:clear, confirming this is a new session, not a continuation.
  • The custom-title record is written twice at the top of the file, which also looks suspicious — possibly a separate bug in /rename's write path.

## Impact

  • /resume lists multiple sessions under the same name with no way to disambiguate them.
  • Combined with the UI bug filed separately, the user cannot reliably return to a previously named session after a /clear.

## Environment

  • Claude Code v2.1.141
  • OS: Windows 11 Pro 26200
  • Shell: PowerShell / Git Bash

What Should Happen?

The new session JSONL should have no custom-title record, or a fresh empty/default title — /clear is supposed to start a new session. (For the explicit case, /clear <name> exists since v2.1.136 — see #57445.)

Error Messages/Logs

Steps to Reproduce

  1. Start a new session.
  2. Run /rename my_session_name.
  3. Do some work so the session has content.
  4. Run /clear (with no argument).
  5. Inspect ~/.claude/projects/<project-slug>/<new-session-uuid>.jsonl.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

v2.1.141

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

_No response_

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗