Skip to content

parasxos/session-rename

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

session-rename

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:

  1. Read the recent transcript turns from the current session,
  2. Ask Haiku for a fresh 3–6-word name via your subscription auth,
  3. Validate the result (rejects preambles, error messages, full sentences),
  4. Write the name to the title cache and patch ~/.claude/sessions/<pid>.json so the UI's name field 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).

Why you'd want this

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.

Install

/plugin marketplace add parasxos/claude-plugins
/plugin install session-rename@parasxos/claude-plugins

After install, restart Claude Code (or run /reload-skills).

Use

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.

Expected outputs

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.

Requirements

  • macOS or Linux (any OS where Claude Code runs).
  • Claude Code CLI authenticated via OAuth / Max subscription. The script scrubs ANTHROPIC_API_KEY from the subprocess env so naming uses your subscription instead of API credits.
  • Python 3.8+ (standard library only; no third-party packages).

How it works

When triggered, the bundled session_rename.py:

  1. Resolves the current session from $CLAUDE_CODE_SESSION_ID.
  2. Locates the JSONL transcript under ~/.claude/projects/.
  3. Extracts the last 30 user/assistant text turns (skips tool calls and long tool results that confuse Haiku).
  4. Calls claude -p --model claude-haiku-4-5 with the transcript tail and a strict 3–6-word title prompt. ANTHROPIC_API_KEY is removed from the subprocess environment so Claude Code falls through to OAuth / keychain (subscription) auth instead of billing the API account.
  5. Rejects responses with returncode != 0, more than 10 words, or any recognised error-message / preamble shape.
  6. Writes the validated name to <transcript>.computed-title and patches the name field of the matching ~/.claude/sessions/<pid>.json.

Pairs well with: an auto-rename hook

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.

Mid-session UI caveat

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).

License

MIT. See LICENSE.

About

Give your Claude Code sessions meaningful names so you can recognise them at a glance — especially useful when running several agents or coding sessions in parallel.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages