Skip to content

Switching folders in UI causes confusing session loss - no warning, hard to recover #16266

Closed

Description

@edumusikse

Summary

When using the Claude Code UI to open a new folder, the previous session becomes inaccessible without knowing to press A in the /resume picker. This creates a very frustrating experience where users believe they've lost all their work.

Steps to Reproduce

  1. Start Claude Code in folder A
  2. Work on a substantial session (hours of context, many interactions)
  3. Click the folder icon in the UI and select a different folder B
  4. Try to get back to your previous session

Expected Behavior

  • Warning before switching folders: "This will switch to a new session. Your current session will be saved and can be resumed later."
  • Clear indication of how to get back to previous sessions
  • The /resume picker should default to showing recent sessions across all projects, or at minimum clearly indicate that pressing A shows more sessions

Actual Behavior

  • Session switches immediately with no warning
  • Previous session appears to be "gone"
  • /resume only shows sessions from current directory by default
  • User must know to press A to see "all projects" - this is not discoverable
  • Quitting and restarting loses folder context

Impact

  • Users lose hours of work context
  • Very frustrating and trust-breaking experience
  • Users may not realize their session still exists in ~/.claude/projects/

Suggested Fixes

  1. Add confirmation dialog when switching folders: "Switch to [folder]? Your current session will be saved."
  2. Show recent sessions from all projects in /resume by default, or add a "Recent" section at the top
  3. Add visual indicator in the picker showing that A toggles project scope
  4. Remember last working directory when restarting Claude Code
  5. Add "Return to previous session" option after switching folders

Additional Issue: Mac App and Terminal Not Synced

When resuming a session via terminal (claude --resume <session-id>), the session does not appear in the Mac app. The two interfaces appear to have separate session state:

  • Session restored successfully in terminal
  • Same session not visible in Mac app
  • No way to "transfer" or sync the session to the Mac app

This creates further confusion - users may have Claude Code open in the Mac app but need to use terminal commands to recover sessions, and then can't get those sessions back into the app they're actually using.

Environment

  • Claude Code version: 2.0.65
  • Platform: macOS Darwin 25.2.0

Additional Context

Session files are preserved in ~/.claude/projects/ but the UI makes them effectively invisible. The workaround (pressing A in the resume picker) is not discoverable through normal usage.

Activity

  1. edumusikse commented on Jan 4, 2026

    @edumusikse
    Author

    Additional Finding: Session file exists but won't load

    After further investigation, the session file still exists and is intact (2.9MB):

    ~/.claude/projects/-Users-stephan--claude-worktrees-public-vibrant-robinson/e986589c-0371-495c-80cc-4b9225c637cd.jsonl
    

    The file contains the full conversation history in JSONL format. However:

    1. The Mac app doesn't show this session in the session picker
    2. Running claude --resume <session-id> from terminal works, but the session doesn't appear in the Mac app
    3. Even after resuming via terminal, the Mac app and terminal appear to be running separate instances that don't sync

    This means users' work isn't actually deleted - it's just inaccessible through normal UI flows. The session recovery mechanism is broken or not properly integrated between the Mac app and terminal CLI.

    This is especially frustrating because the data is RIGHT THERE but users have no way to access it through the app they're using.

  2. github-actions commented on Jan 4, 2026

    @github-actions

    Found 3 possible duplicate issues:

    1. [BUG] Switching folders in UI causes confusing session "loss" #16264
    2. [BUG] claude --resume only shows one session despite multiple saved sessions (Windows) #16235
    3. claude --resume lists only recent ~10 sessions despite having 38 in ~/.claude/projects #2333

    This issue will be automatically closed as a duplicate in 3 days.

    • If your issue is a duplicate, please close it and 👍 the existing issue instead
    • To prevent auto-closure, add a comment or 👎 this comment

    🤖 Generated with Claude Code

  3. edumusikse commented on Jan 4, 2026

    @edumusikse
    Author

    Feature Request: Reliable Session Archive & Restore for Mac App

    This issue has caused real productivity loss. The user had a substantial session (444 user messages, 635 assistant responses, ~63k tokens of context) that is now inaccessible through the Mac app despite the session file being intact on disk.

    What's needed:

    1. Session export/backup - Ability to explicitly save a session to a portable format that can be restored later

    2. Session sync between Mac app and terminal - Currently these run as separate processes with no shared state. A session resumed in terminal doesn't appear in the Mac app.

    3. Session browser in Mac app - A clear UI to browse ALL sessions across all projects, not just the current directory. The current /resume picker defaults to current directory only, hiding other sessions.

    4. Confirmation before destructive actions - Switching folders should warn users that they'll lose access to their current session context.

    5. "Return to previous session" option - After switching folders, there should be an obvious way to get back.

    This is a paying customer who lost hours of built-up context. The data exists in ~/.claude/projects/ but there's no reliable way to restore it in the Mac app. This undermines trust in the tool for any serious work.

  4. edumusikse commented on Jan 4, 2026

    @edumusikse
    Author

    Workaround: Session Backup Script

    Until this is fixed, here's a backup script that runs hourly via cron to prevent session loss:

    Gist: https://gist.github.com/edumusikse/c824afa6d4eb6e74cf284a06025e09fc

    Setup

    # Create backup directory
    mkdir -p ~/Documents/claude-session-backups
    
    # Download script
    curl -o ~/Documents/claude-session-backups/backup-claude-sessions.sh \
      https://gist.githubusercontent.com/edumusikse/c824afa6d4eb6e74cf284a06025e09fc/raw/backup-claude-sessions.sh
    
    # Make executable
    chmod +x ~/Documents/claude-session-backups/backup-claude-sessions.sh
    
    # Add to crontab (runs every hour at :30)
    (crontab -l 2>/dev/null; echo ""; echo "# CLAUDE CODE SESSION BACKUP"; echo "30 * * * * /bin/bash -lc \"$HOME/Documents/claude-session-backups/backup-claude-sessions.sh\" >/dev/null 2>&1") | crontab -

    Features

    • Backs up all non-empty session files from ~/.claude/projects/
    • Creates timestamped backups in ~/Documents/claude-session-backups/
    • Only backs up sessions modified in last 24 hours
    • Auto-cleans backups older than 30 days
    • Logs activity to backup.log

    This won't restore sessions to the Mac app, but at least you won't lose the data.

  5. github-actions commented on Jan 12, 2026

    @github-actions

    This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

  6. locked as resolved and limited conversation to collaborators on Jan 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions