Project memory path sanitizes underscores to hyphens, splitting/clobbering memory

Resolved 💬 3 comments Opened Mar 4, 2026 by jasonbluming Closed Mar 8, 2026

Bug

Claude Code's project memory path generation replaces underscores with hyphens when creating the project directory slug under ~/.claude/projects/. This means the same project can end up with two different memory directories depending on which session created it.

Example

Project directory: ~/Code/BW_customer_portal

  • Session 1 created memory at: -Users-jasonbluming-Code-BW_customer_portal/memory/
  • Session 2 was assigned path: -Users-jasonbluming-Code-BW-customer-portal/memory/

These are two separate directories. Memory written by session 1 is invisible to session 2.

Impact

  1. Split memory: Sessions for the same project can't see each other's memory files
  2. Potential clobbering: If a user has two real projects like my_project and my-project, they could collide into the same path
  3. Silent failure: No warning — the session just starts with empty memory

Expected behavior

The path slug should preserve the exact directory name (including underscores) to ensure a 1:1 mapping between project directories and memory paths.

Environment

  • macOS Darwin 25.3.0
  • Claude Code (latest as of 2026-03-04)

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗