Repository navigation
fix(claude-ls,claude-rm): find sessions under underscore paths and after a late rename - #420
Merged
Merged
Conversation
…ter a late rename (#419) claude-ls derived the project name by replacing only `/`, but Claude Code replaces every non-alphanumeric char with `-`, so a cwd such as ~/Desktop/arch_drawio (stored as ...-arch-drawio) was never matched in the current-folder view. _claude_sessions.py only scanned the first 50 lines for customTitle, and claude-rm.fish did the same with `head -50`. A /branch'd and renamed session carries its custom-title records far past that window, so claude-ls showed the wrong title and claude-rm <title> found nothing. Take the last customTitle in the file (the current name) and make claude-rm resolve titles through the helper so both tools share one rule. Add a claude-ls spec for the underscore path and a new claude-sessions spec covering the late/last title and the claude-rm title match; add a CHANGELOG entry.
ycpss91255
enabled auto-merge (squash)
November 13, 2026 11:50
…ule (#419) fish_spec still pinned the old fixed 50-line window (`head -50` in claude-rm.fish, `i > 50` in _claude_sessions.py), so the fix for #419 failed test-unit (fish). Assert the new shape instead: claude-rm resolves titles through _claude_sessions.py with no head-N scan, and the helper overwrites the title with each customTitle record so the last one wins.
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
Fix two independent ways
claude-ls/claude-rmfail to find a Claude Code session: directories with an underscore (or other non-alphanumeric characters) in their path, and sessions whose title was written or changed late in the transcript. Closes #419.Changes
module/config/fish/functions/claude-ls.fish: derive the project name by replacing every non-alphanumeric character with-, matching how Claude Code names~/.claude/projects/<dir>(~/Desktop/arch_drawiois stored as...-arch-drawio).module/config/fish/_claude_sessions.py: the title is the lastcustomTitlein the transcript instead of the first one within the first 50 lines.module/config/fish/functions/claude-rm.fish: match titles through_claude_sessions.pyinstead of its ownhead -50scan, so both tools share one rule. The sessionId-prefix fallback is unchanged.test/unit/module/claude-ls_spec.bats: project-name fixture now uses the non-alphanumeric rule; new spec for an underscore directory.test/unit/module/claude-sessions_spec.bats(new): helper title cases and theclaude-rmtitle match (a declined prompt must not callgio).doc/changelog/CHANGELOG.md:[Unreleased]/Fixedentry.Decision
/branched session that is then renamed gets itscustom-titlerecords far past the header (line 538 and later in a 2271-line transcript), and/renameappends a new record each time. The last record is the current name, so "last one wins" is the correct rule and the first-50-lines window from fix(claude-rm): customTitle match only reads first line, misses fork/resumed sessions #33 is dropped.claude-rmdelegates to the helper rather than keeping a second scan, so the two commands cannot drift apart again. The helper already scans each file fully for message counts andclaude-rmalready invoked it for the fork-dependents check, so there is no new cost class.$PWDrather than from each session's recordedcwd; only the character mapping changed.Tests
just -f justfile.ci test-unit claude-sessions: 5/5 pass.just -f justfile.ci test-unit claude-ls: all pass, including the new underscore-path spec.origin/mainand re-ran both specs: the new specs fail (claude-ls 1, 2, 3, 4, 7, 9; claude-sessions 1-4), then pass again with the fix restored.just -f justfile.ci lintdid not finish locally within 5 minutes (timed out, result unknown); relying on CI (ci-passed).