Skip to content

[Feature Request] Session Export/Import for Cross-Machine Portability #18645

Description

@fpelliccioni

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single feature request

Problem

There's no official way to export/import Claude Code sessions between machines. Users who work across multiple devices (desktop + laptop, macOS + Linux, work + home) cannot continue conversations on a different machine.

Use Cases

  • Backups: Save important conversations for disaster recovery
  • Machine migration: Moving from one computer to another
  • Multi-device workflow: Start conversation on laptop, continue on desktop
  • Team sharing: Share a conversation with a colleague

Current Behavior

Sessions are stored in ~/.claude/projects/<project>/ with .jsonl files and a sessions-index.json. Manually copying these files to another machine results in:

$ claude -c
No conversation found to continue

Regression Note

With version 2.1.5, manually copying session files between machines (and updating paths) worked as a workaround. After updating to 2.1.9, this no longer works - sessions are not recognized even after:

  1. Updating all hardcoded paths (/Users/username/home/username)
  2. Fixing sessions-index.json entries (fullPath, projectPath, fileMtime)
  3. Patching session version field and thinkingMetadata structure

This suggests additional validation was added that blocks sessions not originally created on the current machine.

Proposed Solution

Add official export/import commands:

claude session export <sessionId> -o conversation-backup.json
claude session import conversation-backup.json

The export format should:

  • Be self-contained (include all necessary metadata)
  • Use relative paths or no paths (portable)
  • Be human-readable (JSON)
  • Support optional anonymization of file contents

Environment

  • Source machine: macOS, Claude Code 2.1.5
  • Target machine: NixOS, Claude Code 2.1.9

Priority

Medium

Category

Enhancement

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