Skip to content

Fix transcript-dir encoding on Windows (and underscore paths) - #1

Open
Ethycs wants to merge 1 commit into
mainfrom
fix/windows-transcript-dir-encoding
Open

Fix transcript-dir encoding on Windows (and underscore paths)#1
Ethycs wants to merge 1 commit into
mainfrom
fix/windows-transcript-dir-encoding

Conversation

@Ethycs

@Ethycs Ethycs commented Jun 27, 2026

Copy link
Copy Markdown
Owner

Problem

On Windows the skill silently reports "0 sessions"extract_chats.py never finds the transcript directory.

projects_dir_for() computed the ~/.claude/projects/<dir> name with:

encoded = re.sub(r"[/.]", "-", os.path.abspath(cwd))

But Claude Code encodes that directory name by replacing every non-alphanumeric character with -. On Windows the separators (\, :) were left intact, e.g.:

  • actual stored dir: c--Users-Qeyto-Documents-GitHub-llmb-rts-notebook
  • computed by old code: C:\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.isdir happened to be true (it's the project dir itself), the *.jsonl glob 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

  • Replace all non-alphanumeric chars with - to match Claude Code's actual encoding (covers /, ., _, \, :).
  • Add a case-insensitive fallback for the Windows drive-letter casing mismatch (os.path.abspath yields C: while the stored dir starts c-).

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-dir override needed.

🤖 Generated with Claude Code

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant