preserve

GitHub

将会话中的关键决策、状态变更和洞察持久化到CLAUDE.md,保持文件精简并归档过时内容。

Trigger Scenarios

重要决策后 项目状态变更时

Install

npx skills add EliaAlberti/cpr-compress-preserve-resume --skill preserve -g -y
More Options

Use without installing

npx skills use EliaAlberti/cpr-compress-preserve-resume@preserve

指定 Agent (Claude Code)

npx skills add EliaAlberti/cpr-compress-preserve-resume --skill preserve -a claude-code -g -y

安装 repo 全部 skill

npx skills add EliaAlberti/cpr-compress-preserve-resume --all -g -y

预览 repo 内 skill

npx skills add EliaAlberti/cpr-compress-preserve-resume --list

SKILL.md

Frontmatter
{
    "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)

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.

Version History

  • cfd1e77 Current 2026-09-22 12:44

Same Skill Collection

skills/compress/SKILL.md
skills/resume/SKILL.md

Metadata

Files
0
Version
cfd1e77
Hash
d0c1cd8c
Indexed
2026-09-22 12:44

ホーム - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-30 20:41
浙ICP备14020137号-1