Fix transcript-dir encoding on Windows (and underscore paths) - #1
Open
Ethycs wants to merge 1 commit into
Open
Conversation
projects_dir_for() only rewrote '/' and '.', but Claude Code encodes the
~/.claude/projects/<dir> name by replacing every non-alphanumeric character
with '-'. On Windows the path separators ('\', ':') were left intact, so the
computed dir never existed and os.path.join collapsed onto the still-absolute
encoded path, making the skill silently report "0 sessions". POSIX paths
containing '_' were also mis-encoded.
Replace all non-alphanumerics with '-' to match Claude Code's actual encoding,
and add a case-insensitive fallback for Windows drive-letter casing (abspath
yields 'C:' while the stored dir starts 'c-').
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Problem
On Windows the skill silently reports "0 sessions" —
extract_chats.pynever finds the transcript directory.projects_dir_for()computed the~/.claude/projects/<dir>name with:But Claude Code encodes that directory name by replacing every non-alphanumeric character with
-. On Windows the separators (\,:) were left intact, e.g.:c--Users-Qeyto-Documents-GitHub-llmb-rts-notebookC:\Users\Qeyto\Documents\GitHub\llmb_rts_notebook(unchanged — no/or.present)Because the computed value was still an absolute Windows path,
os.path.join(home, ".claude", "projects", encoded)collapsed onto it,os.path.isdirhappened to be true (it's the project dir itself), the*.jsonlglob matched nothing, and the tool reported 0 sessions with no error.POSIX paths containing
_were also mis-encoded (underscores left intact when Claude Code turns them into-).Fix
-to match Claude Code's actual encoding (covers/,.,_,\,:).os.path.abspathyieldsC:while the stored dir startsc-).No change in behavior on POSIX for paths without underscores; underscore-containing POSIX paths are now encoded correctly too.
Verification
On Windows under the project's env, before the fix:
0 session(s). After: sessions are auto-detected with no--projects-diroverride needed.🤖 Generated with Claude Code