Give your Claude Code sessions meaningful names so you can recognise them at a glance — especially useful when you're running several agents or coding sessions in parallel and need to find the one you're looking for.
A Claude Code plugin that adds the session-rename skill. Trigger it with
/session-rename (or just /rename), and the plugin will:
- Read the recent transcript turns from the current session,
- Ask Haiku for a fresh 3–6-word name via your subscription auth,
- Validate the result (rejects preambles, error messages, full sentences),
- Write the name to the title cache and patch
~/.claude/sessions/<pid>.jsonso the UI'snamefield updates.
The skill is manual on-demand. It does not install any background hooks on its own — but it pairs naturally with a session-titler hook for fully automatic naming (the manual command stays useful as an override when the auto-generated name is stale or wrong).
When you have several Claude Code sessions running at once — multiple terminals, an agent dashboard, parallel cloud workers — the default session labels are all variations of the same thing and you can't tell them apart. A meaningful name like "fixing auth flow" or "reviewing PR #482" turns the session picker into something you can actually navigate.
/plugin marketplace add parasxos/claude-plugins
/plugin install session-rename@parasxos/claude-plugins
After install, restart Claude Code (or run /reload-skills).
Type any of these in chat — Claude routes them automatically:
/session-rename— primary slash form/rename-session— alias/rename— short alias- "rename this session"
- "retitle the session"
- "update session name"
The script is synchronous (~10–15 s) and prints exactly one status line.
| Output starts with | Meaning |
|---|---|
OK: session renamed → … |
New name written and session.json patched. |
NO CHANGE: recompute produced the same name |
Haiku returned the same name; nothing to update. |
NO CHANGE: Haiku output was rejected |
Haiku returned a preamble, error, or full sentence; previous name kept. |
PARTIAL: name cache updated … but session.json patch failed |
Cache updated; UI may not refresh until next session. |
ERROR: … |
Could not resolve the session or transcript. |
- macOS or Linux (any OS where Claude Code runs).
- Claude Code CLI authenticated via OAuth / Max subscription. The script
scrubs
ANTHROPIC_API_KEYfrom the subprocess env so naming uses your subscription instead of API credits. - Python 3.8+ (standard library only; no third-party packages).
When triggered, the bundled session_rename.py:
- Resolves the current session from
$CLAUDE_CODE_SESSION_ID. - Locates the JSONL transcript under
~/.claude/projects/. - Extracts the last 30 user/assistant text turns (skips tool calls and long tool results that confuse Haiku).
- Calls
claude -p --model claude-haiku-4-5with the transcript tail and a strict 3–6-word title prompt.ANTHROPIC_API_KEYis removed from the subprocess environment so Claude Code falls through to OAuth / keychain (subscription) auth instead of billing the API account. - Rejects responses with
returncode != 0, more than 10 words, or any recognised error-message / preamble shape. - Writes the validated name to
<transcript>.computed-titleand patches thenamefield of the matching~/.claude/sessions/<pid>.json.
session-rename is the manual command. For fully automatic naming
during a session, install it alongside a UserPromptSubmit hook that
periodically calls the same script (e.g. on a backoff schedule like
turns 1, 5, 15, 50, 150). The plugin works standalone; pairing is optional.
Claude Code reads sessions/<pid>.json name at session start and caches
the rendered label. Patching the file mid-session updates the disk truth,
but the visible label may not refresh until the next time Claude Code
re-reads the file (typically a new session or a UI refresh).
MIT. See LICENSE.