Unknown by wonbywondev · 1 stars
Preserves Claude Code session history across project directory renames, moves, and copies by assigning each project a path-independent UUID and maintaining a global registry mapping UUID to current path. Addresses a long-standing pain point: --resume and --continue silently lose session history when paths change. Closes anthropics/claude-code#5768; also tracked in #38089, #28745, #26766, #27883. Commands: /preserve-session:fix recovers sessions after rename/move (with copy detection and automatic .jsonl merge on destination collision), /preserve-session:inherit copies session history from another registered project, /preserve-session:doctor diagnoses hash/registry state and slug collisions including non-ASCII path issues on macOS, /preserve-session:uninstall removes all preserve-session data with a preview-then-confirm safety pattern. A SessionStart hook auto-initializes .claude/hash.txt on first run — zero manual setup. Demo: https://www.youtube.com/watch?v=lWMrzASG7_o Quality signals: 24 verified test scenarios (rename, move, copy, slug collision, non-ASCII paths, registry corruption recovery, full --resume E2E). Atomic registry writes via fcntl.LOCK_EX + tempfile.mkstemp + os.replace. NFC slug normalization to match Claude Code's path encoding on macOS. Python heredoc isolation against shell injection. Symlink-safe uninstall (isinstance/dict guards). Shared helpers in hooks/common.sh with cross-platform Python discovery and uuidgen fallback. Full design rationale, security notes, and test plan are in two related submissions: • https://github.com/anthropics/claude-code/pull/39148 (initial bundled-plugin attempt; comprehensive design + 24-item test plan with collapsible sections) • https://github.com/anthropics/claude-plugins-official/pull/1347 (auto-closed by submission bot; retained as reference for the proposed marketplace.json entry) Plugin location: lives at plugins/preserve-session/ inside the wonbywondev/claude-plugins monorepo. The marketplace entry should use the git-subdir source format pointing to that subdirectory.
/plugin install preserve-session@claude-community