You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm seeing duplicated projects in the sidebar like in this screenshot:
There is a 3rd entry with the same name which actually has sessions under it, but the two in the image don't. I'm not able to archive them or anything, they just clutter the sidebar. Not sure if it might be due to spaces in the folder name or something else.
This only replaces / and _. Claude CLI uses a broader formula that replaces all non-alphanumeric characters (spaces, dots, etc.) with hyphens.
Example:
Project path: /Users/jla/claude-projects/AI Enablement Plan
Switchboard creates: -Users-jla-claude-projects-AI Enablement Plan ← space preserved
Claude CLI creates: -Users-jla-claude-projects-AI-Enablement-Plan ← space → hyphen
The result is two folders on disk for the same project. Every real session the CLI writes goes into its folder; the Switchboard-created folder contains only the seed .jsonl stub.
This also affects paths with dots (e.g. msci-6.1-upgrade-analysis → msci-6-1-upgrade-analysis).
Fix: Update Switchboard's folder naming formula to match Claude CLI: projectPath.replace(/[^a-zA-Z0-9-]/g, '-')
Bug 2: buildProjectsFromCache creates project entries for folders with only archived sessions
File: session-cache.js:175–196
In buildProjectsFromCache, the project entry for a folder is added to projectMap before the archive filter runs:
if (!projectMap.has(row.folder)) {
projectMap.set(row.folder, { ..., sessions: [] }); // created here
}
// ...
if (!showArchived && s.archived) continue; // filtered here
projectMap.get(row.folder).sessions.push(s);
If a folder has sessions in the DB but all are archived, and showArchived=false (the default), the folder appears in the sidebar as an empty project with no sessions.
This compounds Bug 1: the Switchboard-created stub folder has one session (the seed .jsonl). Once that seed session gets treated as archived or otherwise hidden, the folder shows up as an empty phantom project. The archive button is
then a no-op because its handler exits early when project.sessions is empty:
// sidebar.js — archive button handler
const sessions = project.sessions.filter(s => !s.archived);
if (sessions.length === 0) return; // ← nothing to archive, can't dismiss the entry
Fix: After the loop in buildProjectsFromCache, remove any project entry that (a) has sessions in the DB but (b) ended up with zero visible sessions due to archive filtering. Truly empty projects (no sessions in DB at all, just a new
folder on disk) should still appear.
Reproduction
Add a project whose path contains spaces (e.g. /Users/you/projects/My Project) via the "Add project" button
Run claude in that directory — the CLI creates a differently-named folder
Both folders appear in the sidebar as the same project name
The Switchboard-created entry shows no sessions and cannot be archived
Confirmed both bugs and put up a fix in #41. tl;dr:
Bug 1 (folder-name mismatch): the analysis above is correct that Switchboard's regex was too narrow, but the suggested fix [^a-zA-Z0-9-] still doesn't fully match the CLI. I pulled the actual algorithm out of the claude 2.1.126 binary:
It's [^a-zA-Z0-9] (not [^a-zA-Z0-9-]), and there's a 200-char cap with a Java-style String.hashCode-derived suffix on overflow that Switchboard wasn't handling. The function is pure and deterministic, so mirroring it produces byte-identical folder names to the CLI for any project path.
Bug 2 (phantom empty projects): confirmed and fixed by moving the projectMap.set(...) call to after the archive filter in session-cache.js. Folders whose sessions are all archived no longer appear as undismissable empty entries when "show archived" is off.
Migration: existing duplicate folders on disk from before the fix are left alone (auto-cleanup felt risky). If you have leftover dupes, you can rm -rf ~/.claude/projects/<the-bad-folder-name> manually. Any project you add or claude you run after the fix will encode correctly and merge with the CLI's folder.
PR #41 also supersedes #37, which fixed the Windows half of Bug 1 — [^a-zA-Z0-9] covers \ and : for free.
Activity
joshmlambert commentedon May 1, 2026
Here's some analysis found from Claude... it does indeed look like a couple bugs:
Bug: Duplicate projects in sidebar for paths with spaces or dots
Description
Two separate bugs combine to produce phantom duplicate project entries in the sidebar that cannot be dismissed.
Bug 1: Folder naming mismatch between Switchboard and Claude CLI
File: main.js:296
When a project is added via the "Add project" button, Switchboard creates a folder in ~/.claude/projects/ using this formula:
projectPath.replace(/[/_]/g, '-').replace(/^-/, '-')
This only replaces / and _. Claude CLI uses a broader formula that replaces all non-alphanumeric characters (spaces, dots, etc.) with hyphens.
Example:
The result is two folders on disk for the same project. Every real session the CLI writes goes into its folder; the Switchboard-created folder contains only the seed .jsonl stub.
This also affects paths with dots (e.g. msci-6.1-upgrade-analysis → msci-6-1-upgrade-analysis).
Fix: Update Switchboard's folder naming formula to match Claude CLI: projectPath.replace(/[^a-zA-Z0-9-]/g, '-')
Bug 2: buildProjectsFromCache creates project entries for folders with only archived sessions
File: session-cache.js:175–196
In buildProjectsFromCache, the project entry for a folder is added to projectMap before the archive filter runs:
if (!projectMap.has(row.folder)) {
projectMap.set(row.folder, { ..., sessions: [] }); // created here
}
// ...
if (!showArchived && s.archived) continue; // filtered here
projectMap.get(row.folder).sessions.push(s);
If a folder has sessions in the DB but all are archived, and showArchived=false (the default), the folder appears in the sidebar as an empty project with no sessions.
This compounds Bug 1: the Switchboard-created stub folder has one session (the seed .jsonl). Once that seed session gets treated as archived or otherwise hidden, the folder shows up as an empty phantom project. The archive button is
then a no-op because its handler exits early when project.sessions is empty:
// sidebar.js — archive button handler
const sessions = project.sessions.filter(s => !s.archived);
if (sessions.length === 0) return; // ← nothing to archive, can't dismiss the entry
Fix: After the loop in buildProjectsFromCache, remove any project entry that (a) has sessions in the DB but (b) ended up with zero visible sessions due to archive filtering. Truly empty projects (no sessions in DB at all, just a new
folder on disk) should still appear.
Reproduction
abasiri commentedon May 4, 2026
Confirmed both bugs and put up a fix in #41. tl;dr:
Bug 1 (folder-name mismatch): the analysis above is correct that Switchboard's regex was too narrow, but the suggested fix
[^a-zA-Z0-9-]still doesn't fully match the CLI. I pulled the actual algorithm out of theclaude2.1.126 binary:It's
[^a-zA-Z0-9](not[^a-zA-Z0-9-]), and there's a 200-char cap with a Java-styleString.hashCode-derived suffix on overflow that Switchboard wasn't handling. The function is pure and deterministic, so mirroring it produces byte-identical folder names to the CLI for any project path.Bug 2 (phantom empty projects): confirmed and fixed by moving the
projectMap.set(...)call to after the archive filter insession-cache.js. Folders whose sessions are all archived no longer appear as undismissable empty entries when "show archived" is off.Migration: existing duplicate folders on disk from before the fix are left alone (auto-cleanup felt risky). If you have leftover dupes, you can
rm -rf ~/.claude/projects/<the-bad-folder-name>manually. Any project you add orclaudeyou run after the fix will encode correctly and merge with the CLI's folder.PR #41 also supersedes #37, which fixed the Windows half of Bug 1 —
[^a-zA-Z0-9]covers\and:for free.— Claude (Opus 4.7), on behalf of @abassiri
fix: match Claude CLI's project-folder encoding to prevent duplicate …