bobmatnyc avatar

Session Compression

If your Claude conversations are bumping up against token limits, this gives you practical patterns to compress them without losing critical context. The progressive compression approach is smart: do nothing until 70% capacity, light cleanup at 85%, aggressive summarization at 95%. You'll find concrete code for LangChain integration, custom compressors, and prompt caching that can cut costs by 90%. The compression ratios are realistic (5-10x for most cases, up to 20x with hierarchical methods) and they're honest about the 2% accuracy tradeoff. Best for long-running support chats or coding sessions, not worth the complexity if your conversations stay under 10 turns.

skills.sh installs
664
GitHub stars
79
last updated
Aug 21, 2026

Install

$ npx -y skills add bobmatnyc/claude-mpm-skills --skill session-compression --agent claude-code

Installs into .claude/skills of the current project.

Files

AI Session Compression Techniques

Summary

Compress long AI conversations to fit context windows while preserving critical information.

Session compression enables production AI applications to manage multi-turn conversations efficiently by reducing token usage by 70-95% through summarization, embedding-based retrieval, and intelligent context management. Achieve 3-20x compression ratios with minimal performance degradation.

Key Benefits:

  • Cost Reduction: 80-90% token cost savings through hierarchical memory
  • Performance: 2x faster responses with compressed context
  • Scalability: Handle conversations exceeding 1M tokens
  • Quality: Preserve critical information with <2% accuracy loss

When to Use

Use session compression when:

  • Multi-turn conversations approach context window limits (>50% capacity)
  • Long-running chat sessions (customer support, tutoring, code assistants)
  • Token costs become significant (high-volume applications)
  • Response latency increases due to large context
  • Managing conversation history across multiple sessions

Sponsors

Details

Repository
github.com/bobmatnyc/claude-mpm-skills
Category
AI & Agent Building
First seen
Jun 3, 2026

More from bobmatnyc/claude-mpm-skills

All 158
1yeachan-heo avatarwikiyeachan-heo/oh-my-claudecodeLLM Wiki — persistent markdown knowledge base that compounds across sessions (Karpathy model)663skills.sh installs
2hkuds avatarcli-anything-inkscapehkuds/cli-anythingCommand-line interface for Inkscape - A stateful command-line interface for vector graphics editing, following the same patterns as the GI...651skills.sh installs
3voltagent avatarcreate-voltagentvoltagent/skillsSkill for creating AI agent projects using the VoltAgent framework. Guide for CLI setup and manual bootstrapping.628skills.sh installs
4vapiai avatarcreate-workflowvapiai/skillsBuild visual conversation workflows in Vapi with nodes for conversation steps, tool execution, conditional branching, and handoffs. Use when creating structured611skills.sh installs
5davila7 avatarcontext-window-managementdavila7/claude-code-templatesStrategies for managing LLM context windows including summarization, trimming, routing, and avoiding context rot Use when: context window, token limit, context 587skills.sh installs
6wuyoscar avatargpt-imagewuyoscar/gpt-image2-skillWraps the GPT Image 2 API with a 162-prompt reference gallery, a prompt-craft checklist, and a CLI that routes text-to-image,...585skills.sh installs