unclecode

Claude Compress — Communication skill for Claude Code

Communication community

Claude Code /compress command - compress chat sessions.

How to install Claude Compress

This entry records only its repository, not the path inside it, so there is no exact command to give. Open unclecode/claude-compress and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Claude Compress does

Claude Code /compress command - compress chat sessions.

Alternatives in Communication

README

Claude Code /ccomp Command

Compress Claude Code chat sessions to preserve key information while reducing size.

Quick Install

curl -sSL https://raw.githubusercontent.com/unclecode/claude-compress/main/install.sh | bash

Or with gh cli:

gh repo clone unclecode/claude-compress && cd claude-compress && ./install.sh

Update

Run the same install command to update to the latest version:

curl -sSL https://raw.githubusercontent.com/unclecode/claude-compress/main/install.sh | bash

Requirements

  • ANTHROPIC_API_KEY environment variable set
  • Python 3.8+ (uses only built-in modules, no pip dependencies)

Usage

In Claude Code

/ccomp
/ccomp 50%
/ccomp focus on API implementation, ignore debugging steps
/ccomp 40% keep file paths and commands, remove explanations

From Terminal (CLI)

ccomp                                      # Default 30% compression
ccomp --target 50                        # 50% compression
ccomp --focus "keep API calls"           # With focus guidelines
ccomp --target 40 --focus "ignore logs"  # Combined
ccomp --help                             # Show all options

This will:

  1. Detect your current chat session
  2. Extract all messages
  3. Compress long messages to ~30% of original size
  4. Save output to current directory as chat_compressed_.txt

Manual Installation

# Copy script
mkdir -p ~/.claude/scripts
cp compress_chat.py ~/.claude/scripts/
chmod +x ~/.claude/scripts/ccomp_chat.py

# Copy command
mkdir -p ~/.claude/commands
cp compress.md ~/.claude/commands/

Options

Run the script directly with custom options:

python3 ~/.claude/scripts/ccomp_chat.py --cwd "$(pwd)" \
  --target 30 \        # Target compression % (default: 30)
  --min-length 1000 \  # Only compress lines >= this length (default: 1000)
  --min-output 500 \   # Exclude lines < this from output (default: 500)
  --batch-size 5 \     # API batch size (default: 5)
  --wor