First-class session relocation and deletion (move/delete a transcript + its sidecar state)
Feature request
No supported operation exists to move a session to a different working directory/worktree or to delete a session and all its state. Both need manual file surgery today, and moving a session while it's live corrupts the transcript. Complements #88183 (reflect worktree lifecycle in the menu) and #86488 (link continuation chains) — those display session state; this acts on it.
Move a session to another directory
- A running session writes its transcript by path (reopen-by-path from the cwd-derived project dir). Moving the
.jsonlwhile live makes the daemon recreate a fresh file at the old path — the log splits — and the per-session sidecar dir (subagents/,tool-results/,workflows/) is orphaned if only the.jsonlis moved. - A background/worktree session's cwd is pinned: the shell cwd resets to the job's home dir after every command, so it can't
cdaway persistently or remove its own worktree. - The only working relocation today is
claude --resume <id> --fork-sessionfrom the destination dir — a new sessionId carrying a compacted copy, not a true move.
Ask: a first-class "relocate session to <dir>" that detaches safely, moves transcript + sidecar together, rewrites cwd, and re-homes it under the destination's project dir.
Delete a session and its state
Fully removing a session means deleting from ~six locations by hand: the transcript .jsonl + its sidecar dir, the job dir, the stale process-registry entry, and the tasks/, session-env/, file-history/ dirs. There is no session rm.
Ask: a single session rm <id> that removes a session and all its sidecar state (with confirmation / optional backup).
Why it matters
Re-homing a long-running session after its worktree is torn down currently forces either an unsafe live move (which splits the transcript) or a fork (which fragments the chain), followed by hunting scattered state dirs to clean up.