fix(session): replace Skill(rename) with direct JSONL rename script#158
Merged
Merged
Conversation
Skill(rename) is a UI command that cannot be invoked programmatically — the harness rejects it with "rename is a UI command, not a skill." Replace it with a session-local script that renames the session without user input. - Add scripts/rename-session: finds the active session by CWD match in ~/.claude/sessions/<pid>.json, appends a custom-title record to the session JSONL, and patches the live PID file for immediate UI update - Update session-start step 4: call rename-session with the base name already built in step 3 (<type>-<slug> or wip-<kebab-slug>) - Update session-issue step 6: call rename-session with the <type>-<slug> base name already built in step 5 - Bump version 4.4.0 → 4.5.0 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR replaces the previous Skill(rename)-based session renaming (which the harness rejects programmatically) with a plugin-local Bash script that updates Claude Code’s on-disk session metadata, and updates the session workflow skills to call that script.
Changes:
- Added
plugins-claude/session/scripts/rename-sessionto rename the active Claude Code session by appending acustom-titleJSONL record and patching the live session cache file. - Updated
session-startandsession-issueskill procedures to call the new rename script using the base name computed earlier in each flow. - Bumped the
sessionplugin version to4.5.0in both Claude and Copilot plugin manifests.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| plugins-copilot/session/.claude-plugin/plugin.json | Version bump to publish the updated session plugin. |
| plugins-claude/session/.claude-plugin/plugin.json | Version bump to publish the updated session plugin. |
| plugins-claude/session/skills/session-start/SKILL.md | Switch session renaming step to call scripts/rename-session. |
| plugins-claude/session/skills/session-issue/SKILL.md | Switch session renaming step to call scripts/rename-session. |
| plugins-claude/session/scripts/rename-session | New script implementing non-interactive session renaming via Claude’s local session files. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+36
to
+38
| # Encode CWD: replace every / with - (leading / becomes leading -) | ||
| ENCODED_CWD=$(echo "$CWD" | sed 's|/|-|g') | ||
| JSONL_PATH="$HOME/.claude/projects/${ENCODED_CWD}/${SESSION_ID}.jsonl" |
Comment on lines
+50
to
+52
| TEMP=$(mktemp) | ||
| jq --arg n "$NEW_NAME" '.name = $n' "$SESSION_FILE" > "$TEMP" | ||
| rm -f "$SESSION_FILE" && mv "$TEMP" "$SESSION_FILE" |
Comment on lines
+1
to
+4
| #!/usr/bin/env bash | ||
| # Rename the active Claude Code session for the current CWD. | ||
| # Usage: rename-session <new-name> | ||
| set -euo pipefail |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Skill(rename)is a UI-only command — the harness rejects programmatic calls with "rename is a UI command, not a skill"custom-titlerecords in~/.claude/projects/<cwd>/<uuid>.jsonl, and the live display name is cached in~/.claude/sessions/<pid>.jsonscripts/rename-sessionwhich finds the active session by CWD, appends the custom-title record, and patches the PID file for immediate UI update — all without user interactionsession-start(step 4) andsession-issue(step 6) to call the script with the base name already built in the prior stepTest plan
/session:startwith a freeform description — session title updates automatically towip-<slug>without/renameprompt/session:issuewith an issue number — session title updates to<type>-<slug>without/renamepromptrename-sessionhandles no active session gracefully (exits non-zero with message)custom-titlerecord)🤖 Generated with Claude Code