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

  1. Use Claude Code with OAuth authentication over multiple sessions
  2. Build up memory files (MEMORY.md, LEARNED.md, etc.) in ~/.claude/projects/-Users-<username>/memory/
  3. Switch to API key authentication (e.g. due to OAuth token issues / 401 errors)
  4. 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.json was recreated (timestamp matches the switch), losing per-project allowedTools lists built up over weeks
  • Only .claude.json backups 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_KEY in .zshrc

Workaround

  • Recovered memory files from a synced copy on a remote server
  • Set up persistent allow-list in ~/.claude/settings.json instead of relying on per-project allowedTools in .claude.json

View original on GitHub ↗

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