[FEATURE] allow skills to programmatically rename sessions

Status Open
Maintainer reply None cached
Activity 11 comments · opened Feb 11, 2026

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

Skills can instruct Claude to perform actions using tools (read/write files, run bash commands), but they cannot interact with Claude Code's own session management. Specifically, there's no way for a skill to rename the current session.

Proposed Solution

Provide a mechanism for skills (or Claude in general) to programmatically rename the current session. Some options:

  1. Expose /rename as a tool that Claude can invoke during a conversation
  2. Add a session management tool with actions like rename, that skills can reference
  3. Allow bash access to session metadata via an env var or file path that can be written to

Any of these would let skills automate session naming as part of their workflow.

Alternative Solutions

The skill outputs a suggested /rename command for the user to copy-paste manually.

Priority

Medium - Would be very helpful

Feature Category

CLI commands and flags

Use Case Example

I have a custom /save-issue skill that saves conversation content to a dated markdown file (e.g., 2026-02-11-01-claude-code-session-rename-feature-request.md). It would be natural for the skill to also rename the session to match the saved filename, so my session list stays organized.

Additional Context

_No response_

View original on GitHub ↗

11 Comments

DT209 · 6 months ago

This would be VERY useful. Any of the "Proposed Solution" options would be good, I think "Alternative Solutions" would not work as the session can't rename itself that way can it?

tim-mukhin · 6 months ago

+1
would be very helpful

tim-mukhin · 6 months ago

Created a workaround for vs code tabs + info in statusline
https://github.com/dxrayhq/claude-session-labels

<img width="400" height="400" alt="Image" src="https://github.com/user-attachments/assets/0e753cad-e306-43ed-a83b-7741b1a6c486" />

ojhurst · 4 months ago

+1 from a power user running 6 concurrent sessions on an ultrawide monitor.

My setup: I run 6 Claude Code VS Code sessions tiled in a 3x2 grid on a 3440x1440 ultrawide. Each session handles a different task. I built a nudge system that speaks reminders ("Hey James, back over here on the Postgres session, the red one"), shakes the window, and flashes a colored border when a session needs attention.

The missing piece: tab names go stale fast. A session that started as "Pull all updates" might pivot to error handling audits 10 minutes in, but the tab still says "Pull all updates." With 6 panels competing for attention, accurate names are critical for navigation.

What I would use:

  • A tool or slash command (/rename "new title") callable from within the session
  • Ideally also a hook trigger so a PostToolUse hook could periodically re-evaluate and update the name
  • Bonus: letting the model auto-regenerate the title on demand (the logic already exists for the initial naming)

The infrastructure is already there — the extension generates and sets a title from the first message. Exposing that for updates would be a small change with big UX impact for multi-session workflows.

mjmirza · 4 months ago

Coming at this from running ~50 Claude Code sessions per week where the session title is the workflow state. If the name is wrong, Resume Session becomes a guessing game across 8 active projects. So I built the workaround and have been living on it for 2 days.

Option 3 from the OP works. Option 1 does not, because the Skill tool rejects \/rename\ with \rename is a UI command, not a skill\.

What works today

  • Session state including the visible \name\ field lives at \~/.claude/sessions/<pid>.json\. The file has keys pid, sessionId, cwd, startedAt, version, kind, entrypoint, name.
  • Writing to that file and replacing the \name\ key persists immediately. The next session-picker load shows the new name.
  • Each session has a distinct pid file. sessionId comes through the UserPromptSubmit hook payload so matching is straightforward.

Our helper (~100 lines of bash and Python, shipped in production)

  • UserPromptSubmit hook reads session_id from the payload
  • Matches against \~/.claude/sessions/*.json\ by sessionId
  • Atomically rewrites the \name\ field via tempfile and \os.replace\
  • Format validator is 2 to 5 lowercase words, matching the /rename UI constraint
  • Bash allowlist entry added to avoid permission prompts on every rename
  • Two phase trigger. Initial name on first substantive prompt, refinement 3 to 30 minutes in once real context accumulates

This has been running for two days across multiple sessions with zero issues. But it is structurally fragile because the \sessions/<pid>.json\ schema is undocumented implementation detail. One CC upgrade that renames \name\ to \title\ or changes the file location silently breaks it.

Specific asks in priority order

  1. Option 2 (\session.rename\ as a first class tool) is the cleanest. ~30 LOC of Tool handler.
  2. If option 2 is not on the roadmap, documenting the sessions/<pid>.json contract as stable would unblock the community workaround pattern. The schema has been stable empirically. It just needs to be ratified.
  3. The UI level \/rename\ slash command should keep its current allowlist behavior (manual user input only). Mid session refinement via Skill or Tool needs a separate path because \/rename\ is cognitively invisible to agents.

Can open-source the helper if maintainers want a reference implementation against the undocumented schema.

moonjoungyoung · 4 months ago

It would be a very effective and good method.

NightMean · 4 months ago

+1 Would be really useful in combination with skills

tommympg00 · 3 months ago

+1000 please!

Duncan-Ritchie · 2 months ago

When using routines combined with the remote control in the phone app, it is very difficult to tell which session is which because they are assigned random names.

Allowing the agent to rename its session would massively improve usability!

cherrera-ux · 1 month ago

Bump. This seems like a must-have when automating workflows

ardakalayci · 27 days ago

Including this would be very helpful.