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, decisions, and fixes every time they restart. Additionally, standard context compaction flattens important details, causing nuanced decisions and specific file paths to be lost over time.

How it works

CPR is a plugin for Claude Code that implements a system of curated session logs and automated hooks:

  • Curated Logs: Using /cpr:compress, the tool creates structured markdown files containing summaries of decisions, learnings, and pending tasks. It appends the raw conversation transcript via a Python script to avoid wasting model tokens.
  • Automated Hooks: A PreCompact hook autosaves raw transcripts before any compaction occurs, and a SessionStart hook automatically injects a brief memory summary into new sessions.
  • Context Restoration: The /cpr:resume command allows users to restore recent context or search past sessions by topic across both summaries and raw logs.
  • Knowledge Preservation: The /cpr:preserve command updates the CLAUDE.md file with key architectural decisions and patterns to ensure they persist across all future sessions.

Who it’s for

Developers working on the same project across multiple Claude Code sessions who want to avoid repetitive context-setting and maintain a searchable history of their work state.

Highlights

  • Token Efficiency: Reduces session-restart token costs by an estimated 51-74% by replacing manual re-explanation with compact summaries.
  • Searchable History: Maintains a full, on-disk archive of raw transcripts that can be searched by topic without being loaded into the model's context window.
  • Automated Safety Net: PreCompact hooks ensure raw conversation data is never lost during automatic or manual compaction.
  • Customizable Storage: Supports routing logs to specific directories or mirroring them to multiple folders via a configuration file.

Related

  • Project
  • Project
  • Dispatch
  • Dispatch
  • Dispatch