Auth method switch deletes user data in .claude/projects/
Resolved 💬 3 comments Opened Mar 11, 2026 by steelratsvibes Closed Mar 15, 2026
Bug Report
Summary
Switching authentication method (from OAuth to API key) deletes the entire ~/.claude/projects/<project>/memory/ directory, destroying accumulated user data (MEMORY.md, LEARNED.md, and other persistent files).
Steps to Reproduce
- Use Claude Code with OAuth authentication over multiple sessions
- Build up memory files (MEMORY.md, LEARNED.md, etc.) in
~/.claude/projects/-Users-<username>/memory/ - Switch to API key authentication (e.g. due to OAuth token issues / 401 errors)
- Observe that the memory directory and all its contents are deleted
Expected Behavior
Switching authentication method should never delete user data. Auth config and user-generated persistent files (memory, learned entries, project configs) are independent concerns.
Actual Behavior
- The
~/.claude/projects/directory structure was reset - All memory files (MEMORY.md, LEARNED.md, LEARNED_ARCHIVE.md, and additional topic files) were deleted
- The
.claude.jsonwas recreated (timestamp matches the switch), losing per-projectallowedToolslists built up over weeks - Only
.claude.jsonbackups from the moment of the switch exist — no pre-switch backups
Impact
- Weeks of accumulated learnings, project context, and tool permissions lost
- Had to recover from a VPS copy of the memory files
- Tool allow-lists could not be recovered at all
Environment
- macOS Darwin 25.3.0 (Tahoe)
- Claude Code (latest, auto-updates enabled)
- Switched from OAuth to
ANTHROPIC_API_KEYin.zshrc
Workaround
- Recovered memory files from a synced copy on a remote server
- Set up persistent allow-list in
~/.claude/settings.jsoninstead of relying on per-projectallowedToolsin.claude.json
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗