context-compress

Compresses the current session context by identifying relevant info, summarizing key findings, and discarding noise. Produces a compact briefing that replaces long conversation history. The mid-session equivalent of generate-handover.

23 stars

Best use case

context-compress is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Compresses the current session context by identifying relevant info, summarizing key findings, and discarding noise. Produces a compact briefing that replaces long conversation history. The mid-session equivalent of generate-handover.

Teams using context-compress should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/context-compress/SKILL.md --create-dirs "https://raw.githubusercontent.com/christophacham/agent-skills-library/main/skills/design/context-compress/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/context-compress/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How context-compress Compares

Feature / Agentcontext-compressStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Compresses the current session context by identifying relevant info, summarizing key findings, and discarding noise. Produces a compact briefing that replaces long conversation history. The mid-session equivalent of generate-handover.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Skill: Context Compress

## What This Skill Does

**Mid-session reset for long conversations.** When a session grows too long and context becomes expensive, this skill compresses the relevant context into a compact briefing — keeping what matters, discarding noise.

Think of it as `generate-handover` but for the middle of a session, not the end.

## When to Use

- When a session is running long (50+ messages)
- When the conversation has explored multiple tangents
- When you notice repetition or context confusion
- Before switching to a different task within the same session

Do NOT use at session end — use `generate-handover` for that.

## Execution Model

- **Always**: the primary agent runs this skill directly.
- **Token budget**: ~2-3k tokens to produce the summary. Goal: save 10-20k+ tokens going forward.
- **Output**: chat-based briefing (not persisted — it IS the new context).

## Workflow

### Step 1: Identify Active Context

1. **Active task**: what are we working on right now?
2. **Key decisions made**: what was decided and why?
3. **Current file state**: which files were modified?
4. **Pending items**: what still needs to be done?
5. **Blockers**: any unresolved issues?

### Step 2: Identify Noise

Flag context that can be discarded:

- Exploratory discussions that led nowhere
- Debugging steps that were dead ends
- Verbose tool output that's been processed
- Repeated explanations and off-topic tangents

### Step 3: Generate Compressed Context

```markdown
## Session Context (Compressed)

### Active Task
<one sentence: what we're doing right now>

### Progress
- Completed: <completed step>
- In Progress: <current step>
- Pending: <pending step>

### Key Decisions
- <decision>: <rationale>

### Modified Files
- `<file>`: <what changed>

### Next Steps
1. <immediate next action>
2. <after that>
```

### Step 4: Confirm with User

Use the `question` tool: "I've compressed the session context. Anything important I missed?"

## Rules

1. **Relevance over completeness**: include only what's needed to continue the current task.
2. **Decisions are critical**: always preserve key decisions and their rationale.
3. **File state matters**: list modified files so the agent doesn't re-read unchanged files.
4. **Be honest about what's lost**: note when detail is omitted.
5. **No built-in explore agent**: do NOT use the built-in `explore` subagent type.

Related Skills

hig-project-context

23
from christophacham/agent-skills-library

Create or update a shared Apple design context document that other HIG skills use to tailor guidance.

audit-context-building

23
from christophacham/agent-skills-library

Enables ultra-granular, line-by-line code analysis to build deep architectural context before vulnerability or bug finding.

context-manager

23
from christophacham/agent-skills-library

Elite AI context engineering specialist mastering dynamic context management, vector databases, knowledge graphs, and intelligent memory systems.

mcp:setup-context7-mcp

23
from christophacham/agent-skills-library

Guide for setup Context7 MCP server to load documentation for specific technologies.

context-management-context-restore

23
from christophacham/agent-skills-library

Use when working with context management context restore

code-refactoring-context-restore

23
from christophacham/agent-skills-library

Use when working with code refactoring context restore

filesystem-context

23
from christophacham/agent-skills-library

This skill should be used when the user asks to "offload context to files", "implement dynamic context discovery", "use filesystem for agent memory", "reduce context window bloat", or mentions file-based context management, tool output persistence, agent scratch pads, or just-in-time context loading.

context-window-management

23
from christophacham/agent-skills-library

Strategies for managing LLM context windows including summarization, trimming, routing, and avoiding context rot Use when: context window, token limit, context management, context engineering, long...

context-fundamentals

23
from christophacham/agent-skills-library

Understand what context is, why it matters, and the anatomy of context in agent systems

customaize-agent:context-engineering

23
from christophacham/agent-skills-library

Understand the components, mechanics, and constraints of context in agent systems. Use when writing, editing, or optimizing commands, skills, or sub-agents prompts.

context-degradation

23
from christophacham/agent-skills-library

Recognize patterns of context failure: lost-in-middle, poisoning, distraction, and clash

context-compression

23
from christophacham/agent-skills-library

Design and evaluate compression strategies for long-running sessions