context-compression
This skill should be used when long-running agent sessions need context compression, structured summarization, compaction, token-per-task optimization, or durable handoff summaries that preserve decisions, files, risks, and next actions.
npx skills add guanyang/open-agent-hub --skill context-compression --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Context Compression Strategies When agent sessions generate millions of tokens of conversation history, compression becomes mandatory. The naive approach is aggressive compression to minimize tokens per request. The correct optimization target is tokens per task: total tokens consumed to complete a task, including re-fetching costs when compression loses critical information. ## When to Activate Activate this skill when: - Agent sessions exceed context window limits - Codebases exceed context windows (5M+ token systems) - Designing conversation summarization strategies - Debugging cases where agents "forget" what files they modified - Building evaluation frameworks for compression quality - Creating durable handoff summaries that preserve decisions, files, risks, and next actions Do not activate this skill for adjacent work owned by other skills: - General token-efficiency tactics such as masking, prefix caching, or partitioning: `context-optimization`. - Diagnosing why a long context is failing before choosing a mitigation: `context-degradation`. - Writing raw outputs, logs, or plans to files without summarizing them: `filesystem-context`. - Designing long-term semantic memory a
- When to Activate
- Core Concepts
- Detailed Topics
- Optimize for Tokens-Per-Task, Not Tokens-Per-Request
- Solve the Artifact Trail Problem First
- Structure Summaries with Mandatory Sections
- Choose Compression Triggers Strategically
- Evaluate Compression with Probes, Not Metrics
- Score Compression Across Six Dimensions
- Practical Guidance
- Apply the Three-Phase Compression Workflow for Large Codebases
- Use Example Artifacts as Compression Seeds
- Implement Anchored Iterative Summarization Step by Step
- Select the Right Approach for the Session Profile
What does the context-compression skill do?
This skill should be used when long-running agent sessions need context compression, structured summarization, compaction, token-per-task optimization, or durable handoff summaries that preserve decisions, files, risks, and next actions.
How do I install it?
Run `npx skills add guanyang/open-agent-hub --skill context-compression --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From guanyang/open-agent-hub, a repository with 940 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
