EliaAlberti/cpr-compress-preserve-resume
Persistent memory for Claude Code, packaged as a plugin. Save, search, and restore conversation context across sessions.
What it solves
Claude Code lacks persistent memory between sessions, meaning users must re-explain project context, re-discover file paths, and re-derive decisions every time they restart. Additionally, the default auto-compacting feature can silently delete critical details from the conversation history before they can be saved.
How it works
CPR provides three custom slash commands (skills) for Claude Code that allow users to explicitly manage their session context:
/preserve: Updates aCLAUDE.mdfile with key learnings and decisions from the current session, ensuring the file remains lean by automatically archiving old content./compress: Creates a structured, searchable session log in aCC-Session-Logs/directory. It uses a Python script (dump_transcript.py) to append the raw conversation transcript from disk to the log, avoiding expensive model output tokens./resume: Restores context by loading theCLAUDE.mdfile and summaries from recent session logs. It also supports searching past sessions by topic.
To prevent data loss, the project requires users to disable the Auto-Compact setting in Claude Code, shifting control of context compression to the user via the /compact command, which should be run only after preserving and compressing the session.
Who it’s for
Developers using the Claude Code CLI who work on multi-session projects and want to reduce token costs and avoid the repetitive task of re-establishing context.
Highlights
- Token Efficiency: Reduces session-restart token costs by an estimated 24% to 68% by replacing full context rebuilds with compact summaries.
- Hybrid Storage: Combines a lean, persistent
CLAUDE.mdfor high-level project state and detailed session logs for historical record. - Low-Overhead Logging: Uses a local script to append raw transcripts, meaning the raw log content is not generated as model output.
- Searchable History: Allows users to search through past session logs by topic using the
/resume [topic]command.
Related
- Project
- Project
- Project
- Project