fix(coding-agents): find Claude sessions for underscore paths (#3732)
* fix(coding-agents): find Claude sessions for underscore paths
* fix(coding-agents): encode every non-alphanumeric in the Claude project dir
Claude Code does not special-case underscores: it replaces EVERY
non-alphanumeric character in the absolute path with `-`. Encoding only
`/`, `.` and `_` still missed whole repositories, most commonly ones with
a space in the path (`~/Documents/My Projects/...`), which reported
"no past sessions found on disk" while the transcripts sat on disk under
their real name.
Verified against Claude Code 2.1.241 by running it in two directories:
.../hs_under_test -> ...-hs-under-test
.../hs+odd@repo v2 -> ...-hs-odd-repo-v2
Case is preserved and runs are not collapsed, so the encoding is a 1:1
character substitution.
Widening the class cannot misattribute a session: the directory name only
narrows the candidate set, and each transcript must still record a `cwd`
inside the repository before it is imported. A regression test covers that
collision directly.
Claude-Session: https://claude.ai/code/session_01HVZ94d143NPSsZjbnvwqba
---------
Co-authored-by: Nicolò Boschi <boschi1997@gmail.com> P
pstanton237 committed
b448202bd3a60aa9aaca3f40d730f3549e72beed
Parent: d8a71c3
Committed by GitHub <noreply@github.com>
on 8/24/2026, 11:26:45 AM