Move a conversation to a new project root folder

Open
#2 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
rust
Domain
cli, tooling

Research direction

Start by tracing the existing Provider boundary, session scanning, cache handling, and running-session detection, then inspect src/providers/claude/ for encoding and transcript handling. Define the relocation plan and apply flow around the TUI and --move --dry-run entry point. Done means safe, provider-scoped relocation with correct cwd rewrites, backups, conflict and running-session checks, and resumability.

Written by the indexing model from the issue text.

Description

Summary

Let the user change a session's project root folder from ccpick, so a conversation whose project was moved or renamed on disk can be resumed from the new location.

Today such a session is dimmed and Enter is blocked with project dir no longer exists. Claude Code ties a session to its original directory: the transcript lives under projects/<encoded-cwd>/<session-id>.jsonl and every message line records cwd. Resuming from a different folder doesn't find the session.

Proposed behaviour

  • A key on the selected session (e.g. Ctrl-M / "move") opens a dialog to enter the new root folder. Pre-filled with the current cwd and completed against real directories.
  • It works for sessions whose project dir is missing and for ones that still exist (e.g. a repo cloned to a new path).
  • Before applying, a confirmation shows what will change: files moved and number of lines rewritten.
  • After a move the session is re-scanned and resumable from the new folder.

What a move does (Claude provider)

To verify against current Claude Code behaviour before implementing:

  1. Compute the new project directory name with Claude's encoding (every non-alphanumeric character in the absolute path becomes -, e.g. /home/me/code/app-home-me-code-app).
  2. Move <store>/<old-encoded>/<session-id>.jsonl to <store>/<new-encoded>/<session-id>.jsonl. Also move the session's sibling data directory (<session-id>/, e.g. subagent transcripts) if present.
  3. Rewrite cwd on every line that has it, only where it equals the old root or is under it (/old/root/sub/new/root/sub). Leave all other content untouched, including message text and tool payloads.
  4. Check other per-session state that references the path (e.g. file-history, todos, sessions/<pid>.json) and decide per item whether to update it or leave it.

Safety

  • Refuse while the session is running (running-session detection already exists).
  • Write atomically: the new file goes to a temp path and is renamed; the old file is removed only after the new one is fully written.
  • Keep a backup of the original transcript (e.g. <session-id>.jsonl.ccpick-bak), or offer an undo of the last move.
  • If the destination already has a file for that session id, abort.
  • Dry-run output (ccpick --move <session-id> <new-root> --dry-run) so the change can be inspected, and so it can be scripted and tested.

Architecture

  • This is ccpick's first write operation. It needs an explicit new Provider method, e.g. relocate_session(&self, source, session, new_root) -> Result<RelocationPlan> and apply(plan). Claude-specific encoding and line rewriting stay in src/providers/claude/.
  • Shared UI shows the plan and asks for confirmation.
  • The cache entry for the old path is dropped and the new file scanned.
  • Sessions from the other environment (WSL ↔ Windows, see #1): support moving within that environment's path form, or disable the action for foreign sessions in the first version.

Acceptance criteria

  • A session whose project dir was renamed can be moved to the new dir from the TUI and then resumed with its history intact.
  • --move … --dry-run prints the planned file moves and cwd rewrites without changing anything; without --dry-run it applies them.
  • Only cwd values equal to or under the old root are rewritten; tests prove message content containing the old path is untouched.
  • Running sessions can't be moved; destination conflicts abort without changes; the original is backed up.
  • Encoding matches Claude Code's for paths with spaces, dots, underscores and non-ASCII characters (fixtures).
  • Provider boundary kept: no Claude-specific logic outside src/providers/claude/.
Dominant language
Rust
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from outsharked/ccpick

All issues in outsharked/ccpick

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.