编程

Snip Compressor

试用

Semantic conversation compressor — intelligently summarize long chat history while preserving key decisions, facts, and context.

它能做什么

Semantic conversation compressor — intelligently summarize long chat history while preserving key decisions, facts, and context.

技能文档

Snip Compressor

Distilled from Claude Code's Snip compression engine. Analyzes conversation history and generates a compressed summary that preserves semantic continuity — not a simple truncation.

When to use

  • Conversation exceeds 60% of context window
  • User says "continue" / "刚才说到哪了" / "where were we"
  • Before compaction to preserve key context
  • Session handoff between agents

How it works

  1. Parse — Split conversation into segments (user messages, assistant replies, tool calls, tool results)
  2. Score — Each segment gets a retention score based on:
    • Contains decision/agreement (high)
    • Contains factual data/numbers (high)
    • Contains tool results (medium, summarized)
    • Contains greetings/small talk (low)
  3. Compress — Low-score segments get dropped or condensed; high-score segments preserved verbatim or lightly summarized
  4. Rebuild — Output a compressed transcript that reads naturally

Usage

# Compress a conversation file
python3 {baseDir}/compressor.py --input conversation.json --output compressed.md

# Compress with custom token budget
python3 {baseDir}/compressor.py --input conversation.json --budget 2000

# Compress from stdin
cat conversation.json | python3 {baseDir}/compressor.py --budget 1500

Input format

JSON array of message objects:

[
  {
    "role": "user",
    "content": "帮我分析一下这个股票"
  },
  {
    "role": "assistant",
    "content": "好的,我来看看...",
    "tool_calls": [
      {"name": "exec", "result": "{...}"}
    ]
  }
]

Output

Markdown with sections:

  • Summary: 1-2 paragraph overview
  • Key Decisions: bullet list of decisions made
  • Active Context: what's currently in progress
  • Compressed Transcript: compressed conversation (token-optimized)

Algorithm reference

Based on Claude Code's src/services/snip/ module:

  • Semantic boundary detection: topic shift → new segment
  • Importance scoring: decision > data > tool_result > greeting
  • Token-aware truncation: respects model-specific limits
  • Cross-segment reference preservation: if segment B references segment A, both are retained

相关技能

Compress and decompress text files using smart abbreviation and whitespace normalization. Use when user asks to compress, shrink, reduce, or optimize text fi...

12 次安装

压缩任意来源,保留每一条论断、对冲、数值与归属。

240 次安装5 星标

Compresses verbose responses by removing filler and framing to save 200-400 tokens

23 次安装

Quickly summarize any text, URL, or file content into a concise structured brief. Use when the user wants a TL;DR, executive summary, or needs to distill long content into key points without reading the full source.

面向长文本场景的语义压缩工具,通过迭代验证与锚点校验机制,在保证关键信息完整的前提下大幅缩减Token占用。核心能力:,可自发提升工作效率. 适用于需要file compressor相关能力的开发场景,包含结构化的工作流程和可复用的模板,帮助用户快速完成任务并保持代码质量. 适用于需要file compressor相关能力的开发场景,包含结构化的工作流程和配置指引.

1 次安装