compress

GitHub

将当前对话会话保存为可搜索的日志文件,包含结构化摘要和原始记录。通过交互式提问确认关键内容、自定义备注及主题名称,生成Markdown格式日志以便后续快速恢复上下文或检索信息。

Trigger Scenarios

用户要求压缩会话 结束对话前保存上下文

Install

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

Use without installing

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

指定 Agent (Claude Code)

npx skills add EliaAlberti/cpr-compress-preserve-resume --skill compress -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": "compress",
    "description": "Save this session to a searchable CPR log with a curated summary plus the raw transcript. Run before \/compact or before ending a session. Add \"quick\" to skip the questions.",
    "allowed-tools": "Read, Write, AskUserQuestion, Bash(python3 *), Bash(mkdir *)",
    "argument-hint": "[quick] [topic-name]",
    "disable-model-invocation": true
}

/cpr:compress

Save this conversation as a session log that a future session can load in seconds and search by topic. The log has two parts: a structured summary you write, and the raw transcript a script appends. Run it before /compact or before ending the session. The CPR hooks also autosave the raw transcript before every compaction, so this skill is where the curated summary comes from.

Where this log goes

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

Session id for the raw transcript: ${CLAUDE_SESSION_ID}

Arguments

$ARGUMENTS

  • Contains quick: skip the three questions below. Include every section that has real content, and derive the topic name yourself.
  • Any other words: use them as the topic name (lowercase, hyphens), and still ask the first two questions.
  • Empty: run all three questions.

The questions

Ask them with AskUserQuestion, one call each. The tool adds its own free-text option, so never add an "Other" option and never fall back to a plain-text prompt.

  1. What to preserve. Multi-select, header "Preserve". Options: Key Learnings, Solutions & Fixes, Decisions Made, Files Modified, Setup & Config, Pending Tasks, Errors & Workarounds. Recommend the ones this session actually produced.
  2. Custom note. Single-select, header "Custom note", exactly two options: Skip and Add a custom note. A free-text answer is the note, kept verbatim.
  3. Topic name. Derive a 3-5 word, lowercase, hyphenated topic first (for example api-auth-refactor). Single-select, header "Topic name", exactly two options: Accept: {suggested-name} and Provide a different name. A free-text answer is the topic, normalised to lowercase and hyphens.

Write the log

Filename: {timestamp_slug}-{topic}.md inside logs_dir from the block above. Create the folder if it is missing. Write only the sections the user chose, plus the three that are always present: Quick Reference, Quick Resume Context, and Custom Notes.

# Session Log: {timestamp_display} - {topic}

## Quick Reference (for AI scanning)
**Confidence keywords:** {10-20 search terms: project names, technologies, actions, identifiers, people relevant to decisions}
**Projects:** {project names or references mentioned}
**Outcome:** {one sentence}

## Decisions Made
- {decision and the reason}

## Key Learnings
- {learning}

## Solutions & Fixes
- {what was broken, what fixed it, the command or code if short}

## Files Modified
- `{path}`: {what changed}

## Setup & Config
- {exact values: paths, flags, env names. Never paraphrase an identifier}

## Pending Tasks
- [ ] {unfinished work, next steps, blockers}

## Errors & Workarounds
- {error and the workaround}

## Key Exchanges
- {notable exchange, one line}

## Custom Notes
{the note from question 2, or "None"}

---

## Quick Resume Context
{2-3 sentences a future session needs before touching anything. This paragraph is what the SessionStart hook shows at the start of every new session, so make it carry the state.}

Keep bullets short and concrete. Preserve exact values. Keywords matter more than they look: /cpr:resume <topic> searches them.

Append the raw transcript

Do not type the conversation yourself. After the file is saved, run:

python3 "${CLAUDE_PLUGIN_ROOT}/scripts/dump_transcript.py" "{logs_dir}/{filename}" ${CLAUDE_SESSION_ID}

It appends ## Raw Session Log with every user message and assistant reply, skips tool calls and thinking, mirrors the file if routing is configured, and prints the number of turns written. The archive costs zero model output tokens.

Confirm

## Session Saved

`{logs_dir}/{filename}`

- **Project:** {project_name}
- **Topic:** {topic}
- **Sections:** {chosen sections}
- **Keywords:** {keywords}
- **Raw log:** {N} turns appended

Next: `/compact` if you are continuing, or just close the session. `/cpr:resume` loads this back next time.

Version History

  • cfd1e77 Current 2026-09-22 12:44

Same Skill Collection

skills/preserve/SKILL.md
skills/resume/SKILL.md

Metadata

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

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