{"id":51509432,"url":"https://github.com/justinstimatze/claude-mv","last_synced_at":"2026-07-08T04:30:45.789Z","repository":{"id":363048226,"uuid":"1208924000","full_name":"justinstimatze/claude-mv","owner":"justinstimatze","description":"Update Claude Code's internal state when a project directory moves. Covers all 9 layers.","archived":false,"fork":false,"pushed_at":"2026-06-07T06:21:43.000Z","size":48,"stargazers_count":2,"open_issues_count":2,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-07T08:11:28.547Z","etag":null,"topics":["claude-code","cli","developer-tools","python"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/justinstimatze.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-12T23:13:56.000Z","updated_at":"2026-06-07T06:21:47.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/justinstimatze/claude-mv","commit_stats":null,"previous_names":["justinstimatze/claude-mv"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/justinstimatze/claude-mv","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinstimatze%2Fclaude-mv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinstimatze%2Fclaude-mv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinstimatze%2Fclaude-mv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinstimatze%2Fclaude-mv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/justinstimatze","download_url":"https://codeload.github.com/justinstimatze/claude-mv/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinstimatze%2Fclaude-mv/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35252324,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-08T02:00:06.796Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["claude-code","cli","developer-tools","python"],"created_at":"2026-07-08T04:30:45.210Z","updated_at":"2026-07-08T04:30:45.781Z","avatar_url":"https://github.com/justinstimatze.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# claude-mv\n\nUpdate Claude Code's internal state when a project directory moves.\n\nWhen you `mv` or rename a project directory, Claude Code loses track of your\nsessions, memory, and settings because its internal state is keyed to the\nabsolute path. `claude-mv` rewrites all 9 layers of path-dependent state so\nthat `claude --continue` works seamlessly from the new location.\n\nThis solves [anthropics/claude-code#1516](https://github.com/anthropics/claude-code/issues/1516).\n\n## Installation\n\nclaude-mv is a single Python script with no dependencies beyond Python 3.11+.\n\n```bash\n# Download the script\ncurl -fsSL https://raw.githubusercontent.com/justinstimatze/claude-mv/main/claude-mv -o claude-mv\nchmod +x claude-mv\n\n# Move it somewhere on your PATH\nmv claude-mv ~/.local/bin/\n```\n\n## Usage\n\nFirst, move your project directory with `mv`, then run `claude-mv` to update\nClaude Code's state:\n\n```bash\n# Move the directory yourself\nmv ~/projects/myapp ~/work/myapp\n\n# Then update Claude Code's state\nclaude-mv ~/projects/myapp ~/work/myapp\n```\n\n### Auto-detect old path\n\nIf you only provide the new path, claude-mv will scan Claude Code's state to\nfind the old path automatically:\n\n```bash\nclaude-mv ~/work/myapp\n```\n\n### Dry run\n\nPreview what would change without modifying anything:\n\n```bash\nclaude-mv ~/projects/myapp ~/work/myapp --dry-run\n```\n\n### JSON output\n\nGet machine-readable output on stdout (logs still go to stderr):\n\n```bash\nclaude-mv ~/projects/myapp ~/work/myapp --json\n```\n\n### Force mode\n\nProceed even if active Claude Code sessions are detected:\n\n```bash\nclaude-mv ~/projects/myapp ~/work/myapp --force\n```\n\n## What It Covers\n\nclaude-mv updates all 9 layers of Claude Code's path-dependent state:\n\n1. **Project directory** -- `~/.claude/projects/\u003cencoded\u003e/` rename and deep merge\n2. **JSONL transcripts** -- `cwd` and `file_path` fields in session logs\n3. **Subagent transcripts** -- stale paths in subagent `.jsonl` and `.meta.json` files\n4. **Memory files** -- path references in `memory/` content\n5. **Global history** -- `project` field in `~/.claude/history.jsonl`\n6. **Claude config** -- project key in the `projects` object of `~/.claude.json`\n7. **MCP config** -- absolute paths in `\u003cproject\u003e/.mcp.json`\n8. **Project settings** -- path refs in `.claude/settings.json` and `.claude/settings.local.json`\n9. **Session tracking** -- stale `cwd` in `~/.claude/sessions/*.json`\n\n## Exit Codes\n\n| Code | Meaning |\n| ---- | ------- |\n| `0`  | Success -- state updated |\n| `1`  | Fatal error |\n| `2`  | No-op -- nothing to change |\n| `3`  | Active session detected (use `--force` to override) |\n| `4`  | Error occurred, rolled back to pre-migration state |\n\n## How It Works\n\n1. **Backup** -- Before any changes, all files that will be modified are copied\n   to a timestamped backup directory.\n2. **Atomic writes** -- Each file is written to a temporary location and renamed\n   into place, so a crash mid-write never leaves a half-written file.\n3. **Rollback** -- If any layer fails or the process is interrupted\n   (SIGINT/SIGTERM), all changes are reverted from the backup automatically.\n4. **Verification** -- After migration, a residual-path scan checks that no\n   old-path references remain.\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustinstimatze%2Fclaude-mv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjustinstimatze%2Fclaude-mv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustinstimatze%2Fclaude-mv/lists"}