brainstorming
brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).
lov-cc-mvMove 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` w…
Independent GitHub snapshot · Automated classification · Original documentation governs
name: lov-cc-mv
description: 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 粒度把某个话题的对话搬到另一个项目。
when_to_use: |
Directory-level — move/rename a project folder AND keep CC history working:
Session-level — migrate only SOME chats from FROM to TO (not the whole dir):
Two modes in one tool:
Directory-level (default) — four things in one shot:
mv FROM TO on disk (fs.renameSync — instant, preserves everything)~/.claude/projects/<slug>/*.jsonl session store — including every sub-directory slug~/.claude/history.jsonl (prompt up-arrow recall)~/.claude/sessions/*.json (running-session records)Session-level (opt-in, via --session/--grep/--pick) — migrate a subset of chats:
.jsonl files from FROM's slug dir into TO'scwd from FROM → TOhistory.jsonl or fs mv (project itself isn't being moved)Old slug dirs and source sessions are left intact unless --delete-source is passed.
YES — directory-level when:
--no-mv or the cc-migrate-session alias)YES — session-level when:
NO — don't invoke when:
| 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.
Directory-level if:
fs mv (the folder itself is moving on disk)Session-level if:
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 --json
Parse sessions[*] — each has sessionId, firstUserPrompt, mtime, sizeBytes, messageCount.
Match the user's intent against firstUserPrompt yourself:
--session <id> flags.--grep '<pattern>' instead of passing ids.firstUserPrompt alone → show the user the shortlist and ask which ones.--pick and let the CLI do the UX.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 sessionId matches the session file that was written to most recently; safer signal: ask the user to confirm if ambiguous.)
npx -y @lovstudio/cc-mv <FROM> <TO> --dry-run --json
Parse the JSON. Tell the user:
pairs[*] with sessionCount > 0)pairs.length > 1: flag that sub-directories also have CC historytoDirExistsOnDisk and FROM also exists: warn — CLI will refuse the fs mvpairs[i].toSlugDirExists: warn — destination slug dir will be mergedIf 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.
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: "Will migrate N session(s): ". Get confirmation before executing.
For directory-level with sub-dirs: ask "Found N sub-dir(s) with CC history. Migrate everything? [Y/n]" — default yes.
For session-level: always summarize the selected sessions (by first-prompt excerpt) and ask "Migrate these N session(s)?" — especially if you resolved them from a regex or topic match, so the user can catch false positives.
Also ask about --delete-source if the user said anything like "move" (vs "copy") — default to keeping source as safety net, only pass --delete-source when the user explicitly wants it.
Directory-level:
npx -y @lovstudio/cc-mv <FROM> <TO> --yes --json
For post-move recovery (FROM already moved externally):
npx -y @lovstudio/cc-mv <FROM> <TO> --yes --no-mv --json
# OR equivalently:
npx -y @lovstudio/cc-migrate-session <FROM> <TO> --yes --json
Session-level:
npx -y @lovstudio/cc-mv <FROM> <TO> --session <id1> --session <id2> --yes --json
# or with regex:
npx -y @lovstudio/cc-mv <FROM> <TO> --grep '<pattern>' --yes --json
# optionally add --delete-source
Parse phase: "done":
result.slugsMigrated, result.jsonlFilesWritten, result.cwdRewritesresult.historyRewrites (0 in session-level mode — expected)result.runningSessionRewritesresult.sourceSessionsDeleted (only non-zero with --delete-source)fsMvMethod: "rename", "shell-mv", or null (session-level / --no-mv)restartHint.cd + restartHint.commandDirectory-level:
✓ Moved FROM → TO and migrated N session(s) across M slug dir(s).
✓ Also rewrote prompt history and running-session records.
Restart Claude Code in the new location:
cd <TO>
claude --resume
(The old slug dirs at ~/.claude/projects/<old-slug>* are untouched — delete
them once you've verified --resume works.)
Session-level:
✓ Migrated N session(s) from FROM to TO.
✓ Source sessions {kept as safety net | deleted}.
To resume one of the migrated sessions:
cd <TO>
claude --resume <session-id>
IMPORTANT: The CURRENT Claude Code session cannot "switch" its own cwd mid-session. The user must exit and re-invoke claude from the new directory. State this clearly.
npx -y @lovstudio/cc-mv <FROM> <TO> [options]
npx -y @lovstudio/cc-mv <FROM> [<TO>] --list-sessions [--json]
| Option | Purpose |
|---|---|
-y, --yes | Skip confirmation prompt |
--dry-run | Show plan, don't write |
--no-mv | Skip the filesystem mv (only migrate CC state — post-move recovery) |
--json | Machine-readable output (use this from the skill) |
--projects-dir <dir> | Override CC projects dir (default ~/.claude/projects) |
--session <id> | Session-level: migrate only this id (repeatable) |
--grep <pattern> | Session-level: migrate sessions whose first user prompt matches the regex (case-insensitive) |
--pick | Session-level: interactive numbered picker |
--list-sessions | Print session summaries and exit (pair with --json for scripting) |
--delete-source | Delete migrated source sessions after copy+rewrite (default keeps them) |
npx -y @lovstudio/cc-migrate-session <FROM> <TO> — same tool, but defaults to --no-mv (only migrates CC state, doesn't touch the filesystem). Use when the user already moved the folder externally.
CC's slug rule is: replace every non-[A-Za-z0-9] with -. So FROM/sub slugifies to <fromSlug>-<subSlug>.
The CLI lists ~/.claude/projects/ and takes every slug matching slug === fromSlug || slug.startsWith(fromSlug + "-"). That catches FROM and all descendants in one readdir. It then reads each slug's first jsonl to recover the original absolute sub-path (since slug → path isn't reversible), builds the migration pair, and proceeds.
Session-level mode deliberately ignores sub-dir slugs — the user is cherry-picking sessions, not moving the whole project.
--delete-source explicitly to remove them.--mv is rejected (doesn't make sense — the folder itself isn't moving).Tell the user to verify claude --resume works at TO before rm -rf of old slug dirs.
用户在 Skill 驱动任务中提出修改意见时,继续当前产物前必须执行:
task-specific(仅本次)还是 reusable(可跨任务复用)。task-specific 只修改当前任务,不改 Skill。reusable 先确定作用域:领域规则先更新对应 canonical Skill;适用于所有 Skill 的规则先更新共享规范。reusable 修改会使此前的“确认”“继续”“发吧”失效;完成当前产物修改和回读后必须停下,等待用户下一步指示,不自动进入发布、提交或其他外部写入。