Fix Claude liveness detection for project paths containing . or _ - #2
Open
nonusae wants to merge 1 commit into
Open
Fix Claude liveness detection for project paths containing . or _#2nonusae wants to merge 1 commit into
nonusae wants to merge 1 commit into
Conversation
…nd underscores Claude Code names ~/.claude/projects dirs by replacing every non-alphanumeric character in the cwd with "-", but the cwd fallback (the only liveness route for Claude, which append-and-closes its transcript so lsof never sees it) replaced only "/". Any project path containing "." or "_" — a github.com-style checkout layout, a snake_case dir name — never matched its project dir, so every session read as dead and the mascot never appeared. Repro: mkdir ~/test.dot && cd ~/test.dot && claude, then ./AgentNotch --scan shows live=false while the process is running. Route all three encoding sites through one helper that mirrors Claude Code's actual rule.
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
For any user whose project paths contain a
.or_— agithub.com-style checkout layout, a snake_case dir name — every Claude session reads as dead and the mascot never appears. The failure is completely silent.Root cause
Claude Code names its
~/.claude/projectsdirs by replacing every non-alphanumeric character in the cwd with-. The cwd fallback replaced only/:-Users-me-src-github-com-a-b-Users-me-src-github.com-a_bNever matches. And since Claude Code append-and-closes its transcript,
lsofnever sees an open jsonl — the cwd fallback is the only liveness route for Claude. When it misses:isLivefalse →isBusyfalse → no mascot, ever.Steps to reproduce
Fix
One helper mirroring Claude Code's actual rule (every non-
[a-zA-Z0-9]→-), routed through all three encoding sites. This also fixes thebestClaudeTranscriptpreference (choosing among multiple open transcripts) — three call sites, one rule.Verification
On a machine with 8 live Claude sessions under
github.com/...paths: 0 → 8 detected, and the mascot appears within the 3 s poll as documented.