Agent skill

CLAUDE.md Preserve

by EliaAlberti in EliaAlberti/cpr-compress-preserve-resume

Writes this session's durable learnings into the project's CLAUDE.md and keeps the file short by archiving stale sections.

MITAuto-check passedAgent Workflows

Install CLAUDE.md Preserve

skills CLI
$ npx skills add EliaAlberti/cpr-compress-preserve-resume --skill preserve -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install EliaAlberti/cpr-compress-preserve-resume preserve --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/EliaAlberti/cpr-compress-preserve-resume.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/preserve .claude/skills/preserve && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
preserve
GitHub stars
514
Token cost
~889 tokens
SKILL.md length
451 words
Files
1
Skills in repo
3
Repo updated
First seen
Licence
MIT

At a glance

Writes this session's durable learnings into the project's CLAUDE.md and keeps the file short by archiving stale sections.

  • Works in 4 steps: Find archivable content: ## Session… → Show the user what archiving those would… → If it is still over 200 after that, list… → …
  • Finishing a work session that changed the project's status or key decisions
  • SKILL.md covers Project, Find CLAUDE.md, What to preserve and Read, then edit, plus 2 more sections
  • Calls python3

What it does

The agent looks for CLAUDE.md in the project root or under .claude, and if none exists it asks whether to create one or print the notes in the conversation. It then asks once, with a multi-select, what to preserve: phase or status changes, key decisions, new files and structure, patterns and insights, blockers and warnings, or next steps. Passing quick skips the question and keeps every category that has real content. It reads the current file, matches its structure and voice, and updates sections in place rather than appending duplicates.

Entries stay brief: status changes as single lines, decisions with their reason, new directories as a short list and next steps as a checklist. Implementation detail, full file contents, timestamps and anything git or the code already records are left out. The skill aims for fewer than 200 lines. If the file grows past that, it finds archivable sections such as session notes older than 7 days, completed projects and anything marked archivable, shows what removing them would save and asks before archiving.

When your agent uses it

  • Finishing a work session that changed the project's status or key decisions
  • Recording blockers and next steps so future sessions start informed
  • Trimming a CLAUDE.md file that has grown too long

Example prompts

  • “/cpr:preserve quick”
  • “Preserve this session's decisions and next steps in CLAUDE.md.”
  • “Update CLAUDE.md with the new project phase and trim it back under the line limit.”
  • “We changed the build setup today, so record it for future sessions.”

Requirements

  • Python 3, used by the plugin's path helper
  • Pre-approved tools (allowed-tools): Read, Edit, Write, Glob, AskUserQuestion, Bash(python3 *), Bash(wc *)

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. Find archivable content: ## Session Notes (DATE) sections older than 7 days, ## Completed Projects, and any section whose heading contains…
  2. Show the user what archiving those would remove and the resulting line count, and ask with AskUserQuestion: archive now, or keep everything.
  3. If it is still over 200 after that, list the remaining non-core sections and ask which to archive.
  4. Never propose archiving a section whose heading contains (PROTECTED), or the core sections: Approach, Philosophy, Paths, Structure, Key…

What it can do on your machine

Read from SKILL.md and the folder at commit cfd1e77. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Edit
    • Write
    • Glob
    • AskUserQuestion
    • Bash(python3 *)
    • Bash(wc *)

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • python3

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

CLAUDE.md Preserve loads about 889 tokens when it runs. Until then it costs about 48 tokens; SKILL.md has 451 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~48
When it runs · the whole SKILL.md, loaded when a task matches
~889

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from EliaAlberti/cpr-compress-preserve-resume at commit cfd1e77, republished under its MIT licence (© EliaAlberti). 451 words, ~889 tokens.

Download SKILL.mdSave it as .claude/skills/preserve/SKILL.md (or your agent's skills folder).
name
preserve
description
Write this session's durable learnings into the project's CLAUDE.md, keeping it short and archiving stale sections. Run after important decisions or when the project's status changes.
allowed-tools
Read, Edit, Write, Glob, AskUserQuestion, Bash(python3 *), Bash(wc *)
argument-hint
[quick]
disable-model-invocation
true

/cpr:preserve

Update the project's CLAUDE.md with what this session taught that every future session should know from the first message. CLAUDE.md is loaded at the start of every session and re-injected after compaction, so it is the right home for status, decisions, conventions and next steps, and the wrong home for narrative or anything the code already says.

Project

!python3 "${CLAUDE_PLUGIN_ROOT}/scripts/cpr_paths.py"

$ARGUMENTS containing quick means: skip the question, preserve every category that has real content.

Find CLAUDE.md

Look in project_root for CLAUDE.md, Claude.md, or .claude/CLAUDE.md. If none exists, ask with AskUserQuestion whether to create one at {project_root}/CLAUDE.md or to print the notes into the conversation instead. If the user chooses the conversation, write the same content as a short markdown block and stop.

What to preserve

Ask once with AskUserQuestion, multi-select, header "Preserve". Options: Phase/Status Changes, Key Decisions, New Files/Structure, Patterns/Insights, Blockers/Warnings, Next Steps. Recommend the ones this session produced.

Read, then edit

Read the current CLAUDE.md and match its structure and voice. Update existing sections in place rather than appending duplicates. Every addition should be something a future session would otherwise have to rediscover or be told again:

  • Status changes as one line each.
  • Decisions with the reason, in a table if the file already uses tables.
  • New directories or files as a short list, not a tree of everything.
  • Next steps as a checklist.

Leave out implementation detail, full file contents, timestamps, and anything the code or git history already records. Point to files instead of copying them. Keep exact values for paths, flags and identifiers.

Edit the file directly, then report:

CLAUDE.md updated

Preserved:
- {what changed}

CLAUDE.md is now {X} lines (target: under 200)
Show full SKILL.md (187 more words)Show less

Keep it short

Claude Code recommends CLAUDE.md files under 200 lines for adherence. After editing, check wc -l. If the file is over 200 lines:

  1. Find archivable content: ## Session Notes (DATE) sections older than 7 days, ## Completed Projects, and any section whose heading contains (ARCHIVABLE).
  2. Show the user what archiving those would remove and the resulting line count, and ask with AskUserQuestion: archive now, or keep everything.
  3. If it is still over 200 after that, list the remaining non-core sections and ask which to archive.
  4. Never propose archiving a section whose heading contains (PROTECTED), or the core sections: Approach, Philosophy, Paths, Structure, Key References, Links, Skills, Commands, Key Patterns, Conventions. Adapt the list to the names the file actually uses.

Archived sections go to {project_root}/CLAUDE-Archive.md, appended under a ## Archived: {date} heading, and are removed from CLAUDE.md. Create the archive file with a one-line intro if it does not exist.

No CLAUDE.md and the user declined to create one

Print a compact preservation block to the conversation with the selected categories and a two-sentence resume context, then suggest creating a CLAUDE.md so it persists.

© EliaAlberti, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/preserve of EliaAlberti/cpr-compress-preserve-resume.

Open the folder on GitHubat commit cfd1e77

Compare with similar skills

CLAUDE.md Preserve next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

CLAUDE.md Preserve compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
CLAUDE.md Preserve this skillEliaAlberti/cpr-compress-preserve-resume514—~889Automated safety check: PassMIT
Harness Engineering10xChengTu/harness-engineering1021 repos~1kAutomated safety check: PassNone
Neat-Freak Knowledge CloseoutKKKKhazix/khazix-skills21k—~1.9kAutomated safety check: PassMIT
Beads Task Memorygastownhall/beads28k—~1.2kAutomated safety check: PassMIT
Session History Searchslopus/happy24k—~3.1kAutomated safety check: PassMIT
Memori Long-Term MemoryMemoriLabs/Memori17k—~2kAutomated safety check: NotesCustom licence

Similar skills

  • Harness Engineering

    10xChengTu/harness-engineering

    Set up and improve harness engineering (AGENTS.md, docs/, lint rules, eval systems, project-level prompt engineering) for AI-agent-friendly codebases.

    102 GitHub starsUsed in 1 repo~1k tokens
    Agent WorkflowsAuto-check passed
  • Neat-Freak Knowledge Closeout

    KKKKhazix/khazix-skills

    Brings project docs, agent rule files, authorized memory and leftover workspace files back in line with what the code and runtime actually do at the end of a work session.

    21k GitHub stars~1.9k tokensUpdated 8 days ago
    Agent WorkflowsAuto-check passed
  • Beads Task Memory

    gastownhall/beads

    Tracks multi-session work with dependencies in the bd issue tracker so the agent can find ready tasks and recover its context after conversation compaction.

    28k GitHub stars~1.2k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Searches past Claude Code, Codex and Cursor sessions and summarizes what was worked on, tried or decided, using extraction scripts instead of reading raw logs.

    24k GitHub stars~3.1k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Memori Long-Term Memory

    MemoriLabs/Memori

    Connects Claude Code to Memori Cloud for long-term memory, recalling stored context before substantive replies and saving new context afterward.

    17k GitHub stars~2k tokensUpdated 6 days ago
    Agent WorkflowsAuto-check: notes
  • SkillOpt Sleep Cycle

    microsoft/SkillOpt

    Official

    Runs an on-demand or nightly sleep cycle that reviews past Claude Code sessions and proposes validated updates to CLAUDE.md and skills.

    18k GitHub stars~2.3k tokensUpdated 3 days ago
    Agent WorkflowsAuto-check passed

More from EliaAlberti/cpr-compress-preserve-resume

  • CPR Compress

    EliaAlberti/cpr-compress-preserve-resume

    Saves the current session as a searchable log with a curated summary and the raw transcript, so a later session can resume from it.

    514 GitHub stars~1.1k tokensUpdated 1 mo ago
    Auto-check passed
  • CPR Session Resume

    EliaAlberti/cpr-compress-preserve-resume

    Loads context from recent CPR session logs at the start of a session and can search past sessions by topic, then writes a short resume report.

    514 GitHub stars~623 tokensUpdated 1 mo ago
    Auto-check passed

Categories

Questions about CLAUDE.md Preserve

What does CLAUDE.md Preserve do?

Writes this session's durable learnings into the project's CLAUDE.md and keeps the file short by archiving stale sections. claude, and if none exists it asks whether to create one or print the notes in the conversation. It then asks once, with a multi-select, what to preserve: phase or status changes, key decisions, new files and structure, patterns and insights, blockers and warnings, or next steps.

When should I use CLAUDE.md Preserve?

CLAUDE.md Preserve fits situations like: finishing a work session that changed the project's status or key decisions; recording blockers and next steps so future sessions start informed; trimming a CLAUDE.md file that has grown too long.

How do I install CLAUDE.md Preserve in Claude Code?

Run `npx skills add EliaAlberti/cpr-compress-preserve-resume --skill preserve -a claude-code`. Or copy the skill folder (skills/preserve in EliaAlberti/cpr-compress-preserve-resume) into .claude/skills/preserve in your project. Claude Code loads it when a task matches its description.

How do I install CLAUDE.md Preserve in Codex?

Run `npx skills add EliaAlberti/cpr-compress-preserve-resume --skill preserve -a codex`. Or copy the skill folder (skills/preserve in EliaAlberti/cpr-compress-preserve-resume) into .agents/skills/preserve in your project. Codex loads it when a task matches its description.

Can I use CLAUDE.md Preserve in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add EliaAlberti/cpr-compress-preserve-resume --skill preserve -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/preserve, .gemini/skills/preserve, .github/skills/preserve and .opencode/skills/preserve in your project.

What does CLAUDE.md Preserve need to run?

Going by SKILL.md and its folder, CLAUDE.md Preserve needs the command-line tools its instructions call (python3). Our summary lists: Python 3, used by the plugin's path helper. Its frontmatter pre-approves these tools: Read, Edit, Write, Glob, AskUserQuestion, Bash(python3 *), Bash(wc *).

Does CLAUDE.md Preserve access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is CLAUDE.md Preserve safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does CLAUDE.md Preserve use?

CLAUDE.md Preserve is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does CLAUDE.md Preserve use?

About 889 tokens (SKILL.md is roughly 3.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to CLAUDE.md Preserve?

Skills that share tags, products or a category with CLAUDE.md Preserve: Harness Engineering (10xChengTu/harness-engineering, 102 stars), Neat-Freak Knowledge Closeout (KKKKhazix/khazix-skills, 21k stars), Beads Task Memory (gastownhall/beads, 28k stars) and Session History Search (slopus/happy, 24k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains CLAUDE.md Preserve?

EliaAlberti (a GitHub user) maintains it in EliaAlberti/cpr-compress-preserve-resume, which has 514 GitHub stars. The repository holds 3 skills in this directory. The repository was last updated on September 9, 2026.

Source: EliaAlberti/cpr-compress-preserve-resume on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.