lov-cc-mv
БесплатноБез исполняемых скриптовНе проверенMove a project folder AND migrate all its Claude Code state in one shot — session store, prompt-up-arrow history, running-session records. Supports both…
от lovstudio★ 72 звезды на GitHubОб этом скилле
会话搬家 · Session Mover
Two modes in one tool:
Directory-level (default) — four things in one shot:
mv FROM TOon disk (fs.renameSync — instant, preserves everything)- Rewrites
~/.claude/projects/<slug>/*.jsonlsession store — including every sub-directory slug - Rewrites
~/.claude/history.jsonl(prompt up-arrow recall) - Rewrites
~/.claude/sessions/*.json(running-session records)
Session-level (opt-in, via --session/--grep/--pick) — migrate a subset of chats:
- Copies only the selected
.jsonlfiles from FROM's slug dir into TO's - Rewrites each file's
cwdfrom FROM → TO - Rewrites only the matching running-session records
- Does not touch
history.jsonlorfs mv(project itself isn't being moved) - Sub-dir slugs are ignored (root only by design)
Old slug dirs and source sessions are left intact unless --delete-source is passed.
When to Trigger
YES — directory-level when:
- User wants to move/rename a project folder (prospective move — we do the mv)
- User already moved the folder externally and CC lost history (post-move recovery — use
--no-mvor thecc-migrate-sessionalias) - Sub-dir sessions under FROM should come along (handled automatically)
YES — session-level when:
- User wants to migrate only some sessions from FROM to TO — identified by id, topic/content, or to be picked interactively
- User said "只搬这几个" / "those chats about X" / "not all of them"
- User needs to split one project's chat history across two projects
NO — don't invoke when:
- Renaming a file, function, variable, or branch (not the project root)
- General question about CC's storage model (explain, don't migrate)
- Paths are ambiguous — ask first
Workflow
Step 1 — Gather FROM and TO
| User said | FROM | TO |
|---|---|---|
| "把 /a 搬到 /b" / "mv /a to /b" | /a | /b |
| "rename ~/foo to ~/bar" | ~/foo | ~/bar |
| "this project used to be at /old" (cwd is the new location) | /old | process.cwd() |
| "本项目已迁移到 /new" (cwd is the old location) | process.cwd() |
/new |
If either side is ambiguous, ask once with AskUserQuestion. Don't guess.
Always expand ~ and resolve to absolute paths before running the CLI.
Step 2 — Decide directory-level vs session-level
Directory-level if:
- User said "move the whole project" / "rename the folder"
- User wants
fs mv(the folder itself is moving on disk) - User wants ALL sessions (including any sub-dir sessions) migrated
Session-level if:
- User said "only the sessions about X" / "just these chats" / "not all of them"
- User referenced sessions by content/topic or explicit id
- The folder itself should stay put (only CC state for a subset is moving)
Step 3 — Session-level: resolve the session set
The key design point: AI should auto-filter whenever possible, only prompt the user when ambiguous.
Run:
npx -y @lovstudio/cc-mv <FROM> --list-sessions --jsonParse
sessions[*]— each hassessionId,firstUserPrompt,mtime,sizeBytes,messageCount.Match the user's intent against
firstUserPromptyourself:- If the topic is unambiguous (e.g. "about command vs skill" + exactly one session's prompt obviously matches) → pick it directly, proceed to Step 4 with
--session <id>flags. - If a regex captures it cleanly (e.g. topic = "slash command") → use
--grep '<pattern>'instead of passing ids. - If multiple sessions could match and you can't disambiguate from
firstUserPromptalone → show the user the shortlist and ask which ones. - If the user asked for interactive picking explicitly → run with
--pickand let the CLI do the UX.
- If the topic is unambiguous (e.g. "about command vs skill" + exactly one session's prompt obviously matches) → pick it directly, proceed to Step 4 with
Exclude the current running CC session from the selection — it's the one the user is talking to you from right now, migrating it mid-conversation will break things. (Its
sessionIdmatches the session file that was written to most recently; safer signal: ask the user to confirm if ambiguous.)
Step 4a — Dry-run + json to preview (directory-level)
npx -y @lovstudio/cc-mv <FROM> <TO> --dry-run --json
Parse the JSON. Tell the user:
- Total sessions and affected slug count (
pairs[*]withsessionCount > 0) - If
pairs.length > 1: flag that sub-directories also have CC history - If
toDirExistsOnDiskand FROM also exists: warn — CLI will refuse the fs mv - If any
pairs[i].toSlugDirExists: warn — destination slug dir will be merged
If totalSessions === 0 AND the user wanted post-move recovery (FROM path doesn't exist): stop, tell them either (a) FROM path is wrong, or (b) CC never ran there.
Step 4b — Dry-run + json to preview (session-level)
npx -y @lovstudio/cc-mv <FROM> <TO> --session <id> --session <id> --dry-run --json
# or
npx -y @lovstudio/cc-mv <FROM> <TO> --grep '<pattern>' --dry-run --json
The JSON's sessionLevel: true, resolvedSessionIds: [...], and pairs[0].sessionFilter: [...] confirm which sessions will move.
Summarize for the user: "
Установить lov-cc-mv в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл lov-cc-mv?
Move a project folder AND migrate all its Claude Code state in one shot — session store, prompt-up-arrow history, running-session records. Supports both directory-level moves AND session-level cherry-picking (by id, regex on first user prompt, or interactive picker). Use whenever the user wants to rename/move a project directory and keep `claude --resume` working, or wants to move a subset of chats from one project to another. 移动/重命名项目目录并迁移所有 CC 历史,或按 session 粒度把某个话题的对话搬到另一个项目。
Как установить скилл lov-cc-mv?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл lov-cc-mv запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
от AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
от Anthropicxlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
от Anthropicpptx
Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…
от Anthropic