Skip to content

Migrate Claude Code projects without losing conversation history. Preserves .jsonl and cccmemory files when moving directories.

License

Notifications You must be signed in to change notification settings

huansbox/claude-code-project-migrator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

claude-code-project-migrator

Moved your project folder and claude --resume stopped working? This tool fixes that.

A Claude Code skill that migrates project folders while preserving conversation history.

The Problem

When you move a project folder, Claude Code loses access to your conversation history because it stores conversations in ~/.claude/projects/ using path-encoded folder names.

Common symptoms:

  • claude --resume shows "No conversations found"
  • claude --continue can't find previous sessions
  • Conversation history disappears after renaming or moving a project

The Solution

This tool automatically migrates both storage systems:

  • Claude Code native (.jsonl files) - always migrated
  • cccmemory MCP (.cccmemory.db files) - migrated if present, skipped otherwise

Note: cccmemory is an optional MCP server for conversation memory. If you don't use it, the script will simply skip that step.

Features

  • Automatic path encoding for both storage systems
  • Dry-run mode to preview changes
  • Automatic backup before migration
  • Handles SQLite WAL files (.db-shm, .db-wal)
  • GitHub repo rename (optional) - Sync local folder name with GitHub repo name

Installation

Copy the skill folder to your Claude Code skills directory:

# Example location
cp -r claude-code-project-migrator ~/.claude/skills/

Or add the path to your Claude Code settings.

Usage

Via Claude Code

Just tell Claude what you want to do:

Move pacecalculator to D:\mywork\
Migrate my-project from 01_active to root

Via Command Line (PowerShell / CMD)

# Preview changes (recommended first step)
python scripts/migrate_project.py "D:\mywork\old\project" "D:\mywork\project" --dry-run

# Execute migration
python scripts/migrate_project.py "D:\mywork\old\project" "D:\mywork\project"

# Skip backup
python scripts/migrate_project.py "D:\mywork\old\project" "D:\mywork\project" --no-backup

# Rename folder AND GitHub repo
python scripts/migrate_project.py "D:\mywork\old-name" "D:\mywork\new-name" --rename-github

GitHub Repo Rename

When you rename a folder (not just move it), you can optionally sync the GitHub repo name:

# Just move (same name) - GitHub rename skipped automatically
python scripts/migrate_project.py "D:\mywork\01_active\project" "D:\mywork\project"

# Rename folder AND GitHub repo
python scripts/migrate_project.py "D:\mywork\old-name" "D:\mywork\new-name" --rename-github

Requirements for --rename-github:

  • GitHub CLI (gh) installed and authenticated
  • The repo must be on GitHub (not GitLab, Bitbucket, etc.)

After Migration

  1. Test with claude --resume in the new location
  2. Delete old folders after verification

How It Works

Claude Code uses two different path encoding systems:

System Encoding Example Required
Claude native D--mywork-path D:\mywork\project becomes D--mywork-project Yes
cccmemory D-mywork-path D:\mywork\project becomes D-mywork-project Optional

The script auto-detects which systems are in use and handles them appropriately:

  • .jsonl files go to D-- folder
  • .cccmemory.db* files go to D- folder (if present)

Requirements

  • Windows 10/11 (path encoding is Windows-specific)
  • Python 3.6+
  • No external dependencies

Important Notes

  • Backup behavior: Running migration twice will overwrite the previous backup. Save important backups manually before re-running.
  • macOS/Linux: Not supported. The path encoding logic is Windows-specific (D:\ style paths).

Related

License

MIT

About

Migrate Claude Code projects without losing conversation history. Preserves .jsonl and cccmemory files when moving directories.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages