[BUG] /memory command fails when project path contains spaces

Resolved 💬 4 comments Opened Jan 4, 2026 by waleedzeb Closed Feb 19, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

When using the /memory command in a project whose path contains spaces, Claude Code incorrectly opens two files named after path segments instead of the memory file.

Likely Cause:
The project path is not being properly quoted when passed to the file open command, causing shell word splitting on spaces.

What Should Happen?

The /memory command should open the Claude memory file (.claude/CLAUDE.md or project-specific memory file) regardless of spaces in the project path.

Error Messages/Logs

Steps to Reproduce

  1. Navigate to or open a project at a path containing spaces (e.g., /Users/username/Documents/Dev/1. Main Projects/MyProject)
  2. Start Claude Code in that directory
  3. Run the /memory command
  4. Observe that instead of opening the memory file, two files are created/opened: one named 1 and another named Main (these come from the path segment 1. Main Projects)

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.0.76 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

When Claude Code runs something like:
open /Users/username/Documents/Dev/1. Main Projects/MyProject/.claude/CLAUDE.md

The shell splits on spaces and interprets it as:
open /Users/username/Documents/Dev/1.
open Main
open Projects/MyProject/.claude/CLAUDE.md

The Fix

Wrap the path in quotes:
open "/Users/username/Documents/Dev/1. Main Projects/MyProject/.claude/CLAUDE.md"

In the Claude Code source, this would look something like:

// Before (broken)
exec(open ${memoryFilePath})

// After (fixed)
exec(open "${memoryFilePath}")

// Or better - use spawn with array args (no shell interpolation)
spawn('open', [memoryFilePath])

Best Practice

Using spawn with an array of arguments is the safest approach because it bypasses shell parsing entirely - each array element is passed as a literal argument.

View original on GitHub ↗

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