Feature: Allow AI to programmatically update session name (sync UI display)

Status Fixed / completed
Reported on v2.1.107
Maintainer reply None cached
Activity 4 comments · opened Apr 14, 2026 · closed Apr 14, 2026

Summary

Currently, the session name displayed in Claude Code's input area (top-right UI element) can only be updated via the /rename slash command, which must be typed by the user. There is no way for the AI assistant to trigger a session rename programmatically.

Problem

When a user asks the AI to rename the current session, the AI can update file-based workarounds (e.g. a session-name-override file used by custom status line scripts), but cannot update the session name shown in Claude Code's own UI — the top-right label in the input area.

The user must still manually type /rename <name> to update the UI, even after the AI has already determined an appropriate name.

Proposed Solution

One or more of the following:

  1. Expose a tool or hook that allows the AI to call /rename programmatically (e.g. a RenameSession tool similar to existing tools like TaskCreate).
  2. Have Claude Code watch the sessions JSON file (~/.claude/sessions/<pid>.json) for changes to the name field and reflect them in the UI without requiring an in-memory update via /rename.
  3. Provide a documented IPC mechanism (e.g. via hs.ipc or a named pipe) so external scripts or the AI can signal Claude Code to refresh the session name from disk.

Use Case

Users who want the AI to auto-name sessions based on conversation content (e.g. via a UserPromptSubmit hook) currently need a two-step workaround:

  • AI updates a custom override file → status line reflects new name
  • User must still manually run /rename → Claude Code UI reflects new name

A unified mechanism would allow full automation of session naming without user intervention.

Environment

  • Claude Code: 2.1.107
  • macOS: 15.7.4 (Sequoia, Apple Silicon)
  • Terminal: iTerm2 3.6.9

🤖 Generated with Claude Code

View original on GitHub ↗

4 Comments

hyj1116 · 6 months ago

Additional Context: Continuous Auto-Rename Use Case

The core use case I want to clarify:

The user has a UserPromptSubmit hook that triggers every 5% of context usage. At each trigger, the hook asks the AI to suggest a new session name based on the current conversation content. The intent is that the session title evolves automatically as the conversation progresses — reflecting the latest topic at each 5% milestone.

Current flow (broken):

  1. Context reaches next 5% threshold → hook fires
  2. Hook asks AI to suggest a new name based on recent conversation
  3. AI suggests a /rename command
  4. ❌ User must manually type /rename to update the UI title
  5. Repeat at next 5%

Desired flow (fully automatic):

  1. Context reaches next 5% threshold → hook fires
  2. Hook asks AI to suggest a new name based on recent conversation
  3. AI determines appropriate name
  4. ✅ UI title updates automatically — no user action needed
  5. Repeat at next 5%

This is a continuous, evolving rename throughout the session lifetime, not a one-time operation. The manual step breaks the entire automation. A programmatic rename API would make this fully hands-free.

github-actions[bot] · 6 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/34243
  2. https://github.com/anthropics/claude-code/issues/47262
  3. https://github.com/anthropics/claude-code/issues/33165

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

hyj1116 · 6 months ago

Closing as duplicate. Similar requests already tracked in #43700, #29355, #37592. The specific use case (continuous auto-rename every 5% context based on conversation content) has been added as a comment to #43700.

github-actions[bot] · 5 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.