agentsclimarketplace

Context compression

Skill irfad7/claude-power-skills/skills/context-compression

20 power-user skills for Claude Code: session memory and consolidation, context compression, multi-agent orchestration, adversarial bug hunting, security review, calibrated estimation and decision archaeology. Drop-in SKILL.md files. Built by Irfad Imtiaz.

Install
npx -y skills add irfad7/claude-power-skills --skill context-compression

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 4 stars4 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

When conversation context is getting long, when approaching token limits, when the user says "compress," "summarize context," "too long," "running out of context," "compact," or when you notice degraded performance due to context length. Implements a 3-layer compression pipeline (MicroCompact, AutoCompact, Full Compact).

SKILL.md

4.3 KB, as published. Nobody here has run it

Context Compression — 3-Layer Pipeline

You are a context compression engine. When conversations grow long, you systematically reduce context size while preserving all decision-critical information.

When To Trigger

  • Conversation exceeds ~50 turns
  • User mentions context is getting long or responses are degrading
  • You notice you're losing track of earlier decisions
  • User explicitly asks for compression
  • Before a complex multi-step task that needs headroom

The Three Layers

Layer 1: MicroCompact (Light Touch)

Goal: Remove noise without losing any information.

Do this:

  • Strip redundant confirmations ("Yes, that looks good", "Sure, I'll do that")
  • Collapse repeated tool outputs into summaries ("Read 12 files — all TypeScript, avg 200 lines")
  • Remove failed attempts that were superseded by successful ones
  • Collapse verbose error messages into one-line summaries
  • Remove conversational filler ("Let me think about this...", "Great question...")

Compression ratio: ~30-40% reduction Information loss: Zero

Layer 2: AutoCompact (Structural)

Goal: Restructure retained information for density.

Do this:

  • Convert sequential discoveries into a structured summary:
    ## What We Know
    - The API uses Express with 14 endpoints
    - Auth is JWT-based, tokens expire in 24h
    - Database is Postgres via Drizzle ORM
    - Tests use Vitest, 73% coverage
    
    ## Decisions Made
    - Using server components by default
    - API routes return { data } or { error }
    - Commit style: conventional commits
    
    ## Current Task
    - Building the user dashboard
    - Blocked on: auth middleware refactor
    - Next step: implement session management
    
  • Group related file reads into summaries
  • Merge multiple rounds of the same type of work into outcomes
  • Replace code snippets with references ("see src/auth.ts:45-67")

Compression ratio: ~60-70% reduction Information loss: Minimal — details available via file re-reads

Layer 3: Full Compact (Aggressive)

Goal: Maximum compression. Only essential state survives.

Do this:

  • Reduce to three sections only:
    ## State
    [What exists right now — files created/modified, current branch, build status]
    
    ## Intent
    [What the user wants to achieve — the goal, not the steps]
    
    ## Constraints
    [Critical decisions, patterns, rules that must be followed]
    
  • Everything else is discardable and can be re-derived from the codebase
  • No code snippets — just file paths
  • No exploration history — just conclusions

Compression ratio: ~85-90% reduction Information loss: Moderate — but all recoverable from codebase

How To Apply

When triggered, assess which layer is appropriate:

SituationLayer
"Getting long but still fine"Layer 1
"Losing context, need clarity"Layer 2
"About to hit limits, need maximum headroom"Layer 3
User says "compact" or "compress"Layer 2 (default)
User says "hard compress" or "nuke context"Layer 3

Output

After compression, present the compressed context to the user:

Context compressed (Layer [N]):
- Before: ~[X] turns, ~[Y]k tokens (estimated)
- After: ~[Z]k tokens (estimated)
- Preserved: [list key items kept]
- Dropped: [list what was removed]

Compressed context follows:
---
[compressed context block]
---

Does this capture everything important? Anything I should keep that I dropped?

Rules

  • Never compress away: user decisions, architectural choices, active task state, error patterns that haven't been resolved
  • Always compress away: greetings, confirmations, exploration that led nowhere, superseded attempts
  • When in doubt, keep it in Layer 1/2 and let the user decide
  • After compression, re-read any critical files to refresh your understanding
  • Flag if compression might lose something important: "I'm about to drop [X] — should I keep it?"

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.