# context-compressor

context-compressor compresses large text files, chat histories, and RAG payloads before sending to the model while preserving evidence for correct answers. Reduces token spend when context balloons.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 274 installs · ★ 45 repo stars
- Author: oimiragieo
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/oimiragieo/agent-studio/tree/HEAD/.claude/skills/context-compressor/SKILL.md
- Updated: 2026-07-14
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/context-compressor

## What it does

This skill bundles Python scripts for local token profiling and context compression without uploading to a server. Three modes: baseline for quick general compression, query_guided to extract text relevant to a specific question, and evidence_aware to verify that compressed output still contains the facts needed to answer safely.

Works with text files, JSON payloads from RAG systems, and multi-turn histories. Scripts measure token savings before and after. A Node.js wrapper integrates the skill into other agents. Requires Python 3.10+.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add oimiragieo/agent-studio --skill context-compressor -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/context-compressor/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/context-compressor/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add oimiragieo/agent-studio --skill context-compressor -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/context-compressor/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add oimiragieo/agent-studio --skill context-compressor -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/context-compressor/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install oimiragieo/agent-studio .claude/skills/context-compressor
```

2. **Manually: put the files in place**
- File: `.github/skills/context-compressor/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add oimiragieo/agent-studio --skill context-compressor -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/oimiragieo/agent-studio --path .claude/skills/context-compressor
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/context-compressor/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add oimiragieo/agent-studio --skill context-compressor -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/oimiragieo/agent-studio/tree/HEAD/.claude/skills/context-compressor/SKILL.md

## When to use it
- measure token cost in a large file before sending it
- compact chat history while keeping recent turns intact
- prepare RAG payload for caching with a stable prefix
- check whether compressed context retains enough evidence to answer correctly
- cut session cost when context grows expensive

## Example prompts
- Compress this log file and keep only errors and surrounding context
- Show me how many tokens I save if I compress this RAG data for the question about Kubernetes deployment
- Verify the compressed code still has enough info to locate the bug described in the issue

## Similar
- [context-optimization](https://affpapa.org/en/nevibecode/skills/context-optimization.md) — skill · 532 installs
- [omni-context-rtk](https://affpapa.org/en/nevibecode/skills/omni-context-rtk.md) — skill · 1300 installs
- [llm-context](https://affpapa.org/en/nevibecode/skills/llm-context.md) — skill · 1300 installs
- [llm-transpile](https://affpapa.org/en/nevibecode/plugins/llm-transpile.md) — plugin · ★ 9 repo stars
- [lcc — Local Context Compiler](https://affpapa.org/en/nevibecode/mcp/lcc-local-context-compiler.md) — MCP server · ★ 20 repo stars
- [caveman-compress](https://affpapa.org/en/nevibecode/skills/caveman-compress.md) — skill · 440900 installs

From the same set: [oimiragieo/agent-studio](https://affpapa.org/en/nevibecode/by/oimiragieo/agent-studio.md) — 8 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
