[BUG] Claude code always uses home directory as working directory, and writes memory to home dir and only enforces home dir permission settings
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?
Claude code always use home directory as working directory, and instructs in system prompt to write memory and artifacts to home directory session folder, rather than actualy working directory session folder. It also needs hasTrustDialogAccepted to be true for home dir session, to read and trust the "allow" configs in settings.local.json in other folders.
`> whats cur working dir?
● The current working directory is C:\Users\elaine\Desktop\etw.
✻ Cogitated for 6s
whats cur memory dir
● Your memory directory is C:\Users\elaine\.claude\projects\C--Users-elaine\memory\.
✻ Brewed for 2s`
What Should Happen?
Claude code's session folder should be the actual slugified working directory. i.e. C--Users-elaine-Desktop-etw instead of C--Users-elaine
Error Messages/Logs
Steps to Reproduce
1.Open claude code under any folder.
2.Type "whats cur working dir" and "whats cur memory dir".
3.See the conflict.
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
2.1.191
Claude Code Version
2.1.198
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
_No response_