Skip to content

Fix Claude liveness detection for project paths containing . or _ - #2

Open
nonusae wants to merge 1 commit into
realfishsam:mainfrom
nonusae:fix/claude-project-dir-encoding
Open

Fix Claude liveness detection for project paths containing . or _#2
nonusae wants to merge 1 commit into
realfishsam:mainfrom
nonusae:fix/claude-project-dir-encoding

Conversation

@nonusae

@nonusae nonusae commented Jul 28, 2026

Copy link
Copy Markdown

Problem

For any user whose project paths contain a . or _ — a github.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/projects dirs by replacing every non-alphanumeric character in the cwd with -. The cwd fallback replaced only /:

encoded path
Claude Code creates -Users-me-src-github-com-a-b
AgentNotch looked for -Users-me-src-github.com-a_b

Never matches. And since Claude Code append-and-closes its transcript, lsof never sees an open jsonl — the cwd fallback is the only liveness route for Claude. When it misses: isLive false → isBusy false → no mascot, ever.

Steps to reproduce

mkdir ~/test.dot && cd ~/test.dot && claude
# in another terminal:
./AgentNotch --scan    # → live=false while claude is running

Fix

One helper mirroring Claude Code's actual rule (every non-[a-zA-Z0-9]-), routed through all three encoding sites. This also fixes the bestClaudeTranscript preference (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.

…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.
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