[BUG] /rename session name is lost after process exit — /resume from new terminal shows first message instead of session name

Resolved 💬 2 comments Opened Apr 13, 2026 by c-b-a Closed Apr 13, 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?

Session name only survives within the same terminal session. Closing the terminal loses the name permanently.

What Should Happen?

The session name set via /rename should persist across terminal restarts. The name should be written to a durable location —
either:

  • Embedded in the JSONL file as a metadata entry (e.g. {"type":"session-meta","name":"MySessionName"})
  • Or stored in a separate index file not keyed by PID

Error Messages/Logs

Steps to Reproduce

  1. Start a Claude Code session: claude
  2. Rename the session: /rename MySessionName
  3. Exit the session: /exit
  4. In the same terminal, run claude again and type /resume → session name "MySessionName" is displayed correctly
  5. Close the terminal window entirely
  6. Open a new terminal, run claude, type /resume → session name is gone, first user message is shown instead

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.92 (Claude Code)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

Root Cause Analysis:

The /rename command writes the name field only to ~/.claude/sessions/{pid}.json (the session metadata file keyed by process
ID). The conversation JSONL file (~/.claude/projects/{project-hash}/{session-id}.jsonl) does not store the session name
anywhere.

When the process exits and the terminal is closed, the sessions/{pid}.json file is cleaned up (since the PID is no longer
valid). On next launch, /resume rebuilds the session list from the JSONL files, which contain no name field — so it falls
back to displaying the first message content.

View original on GitHub ↗

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