context-compression

context-compression is a skill for Claude Code, Codex from seb1n/awesome-ai-agent-skills. It costs 52 tokens per session (1,820 once invoked), scanned A, original, MIT.

A method for shortening selected text while keeping the decisions, evidence, limits, and unanswered questions that matter. Tokens are the small pieces of text used to measure an AI model’s input size.

In plain words
What is it for?
Condensing a long conversation or a set of already chosen documents when the material is too large for the available context budget.
Why use it?
It reduces oversized prompts and documents so they fit within the model’s input limit without losing important task information.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: positional $N argument.

Good fit Condensing a long conversation or a set of already chosen documents when the material is too large for the available context budget.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/seb1n/awesome-ai-agent-skills/context-compression
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add seb1n/awesome-ai-agent-skills --skill context-compression
Clone the repo
git clone --depth 1 https://github.com/seb1n/awesome-ai-agent-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for context-compression

README.md
[![agentmods](https://agentmods.dev/badge/skills/seb1n/awesome-ai-agent-skills/context-compression/github.svg)](https://agentmods.dev/skills/seb1n/awesome-ai-agent-skills/context-compression)
Your own site
<a href="https://agentmods.dev/skills/seb1n/awesome-ai-agent-skills/context-compression"><img src="https://agentmods.dev/badge/skills/seb1n/awesome-ai-agent-skills/context-compression/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for context-compression

Your own site · 80×15
<a href="https://agentmods.dev/skills/seb1n/awesome-ai-agent-skills/context-compression"><img src="https://agentmods.dev/badge/skills/seb1n/awesome-ai-agent-skills/context-compression.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 52 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,820 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00052 $0.01820
Opus 5 $0.00026 $0.00910
Sonnet 5 $0.00010 $0.00364
Haiku 4.5 $0.00005 $0.00182

Measured 10d ago against content hash 72d52b24c93d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

context-compression scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

context-engineering/context-compression/SKILL.md · 86 lines

How it starts

The opening of the file, as written. The whole thing — 86 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Context Compression

Context compression is the process of reducing the size of textual context provided to a language model while retaining the information most essential to the task. As conversations grow longer and retrieved documents grow larger, compression becomes critical for staying within token limits and keeping inference costs manageable without sacrificing answer quality.

Workflow

  1. Measure the Token Budget: Determine the model's total context window (e.g., 4K, 32K, 128K tokens) and subtract the tokens reserved for the system prompt, instructions, and the model's generation output. The remainder is your available context budget. If the raw context already fits, compression may be unnecessary.

  2. Score Information Density: Analyze each paragraph, sentence, or chunk of the raw context and assign an information-density score based on how many task-relevant facts it contains per token. Sentences that are purely stylistic, redundant, or off-topic receive low scores. This can be done heuristically (keyword overlap with the query) or via a lightweight classifier.

  3. Select a Compression Strategy: Choose the most appropriate technique based on the compression ratio needed and the nature of the content:

    • Extractive summarization — select the most important sentences verbatim.
    • Abstractive summarization — rewrite content in fewer words while preserving meaning.
    • Key-point extraction — pull out only named entities, facts, and figures.
    • Selective pruning — remove low-density sentences, boilerplate, and repeated information.
  4. Apply Compression: Execute the chosen strategy. For aggressive compression (>80% reduction), combine techniques — for example, first prune boilerplate, then abstractively summarize the remainder. For moderate compression (40–60%), extractive selection is often sufficient and avoids introducing paraphrasing errors.

  5. Validate Information Retention: Compare the compressed output against the original to ensure no critical facts were lost. A quick validation pass can check that key entities, numbers, and conclusions from the original are still present in the compressed version.

Read the full file on GitHub · 86 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 86 lines · 52 tokens per session scan A 72d52b24c93d

Subscribe to this mod's changes

context-compression is a skill published in the GitHub repository seb1n/awesome-ai-agent-skills (179 stars, last pushed 1mo ago), licensed MIT. It adds 52 tokens to every session and 1,820 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

context-engineering

A project documentation framework that records a project's goals, requirements, roadmap, and current state in separate files. It also keeps those documents within set size limits for an AI coding agent.

hashgraph-online/awesome-codex-plugins · 73 tokens

promote-memory

Review candidate learnings in Claude Code's native auto memory (/.claude/projects/ /memory/, machine-local) and run them through a five-critic council in parallel: generality, staleness, redundancy, evidence, format. Majority vote (3+ of 5) promotes the entry to MEMORY.md. Use when user says "promote memory", "review…

pedrohcgs/claude-code-my-workflow · 0 tokens

compress-session

Distill the current conversation into a structured note (decisions made, open questions, file pointers with line numbers, next 1–3 actions) and save to qualityreports/sessionlogs/ before auto-compression. Differs from /checkpoint (explicit stop-point snapshot) and from auto-compaction (which truncates rather than…

pedrohcgs/claude-code-my-workflow · 123 tokens

cross-border-ecommerce

Cross-border e-commerce expansion advisor. Scores target markets on 8 weighted dimensions (market size, ecommerce penetration, competition, regulatory complexity, logistics infrastructure, payment ecosystem, cultural distance, IP protection), compares 5 fulfillment models with cost and transit data, provides…

nexscope-ai/eCommerce-Skills · 106 tokens

ecommerce-email-marketing-builder

E-commerce email marketing system builder. Creates complete email automation flows with full copywriting, subject lines, ESP setup instructions, segmentation rules, and annual campaign calendars. Generates copy-paste-ready email sequences for Klaviyo, Omnisend, Mailchimp, or any ESP. Covers welcome series, cart…

nexscope-ai/eCommerce-Skills · 159 tokens

ecommerce-growth-strategy

E-commerce growth strategy advisor. Diagnoses current business health using unit economics (CAC, LTV, AOV, contribution margin), identifies the highest-impact growth opportunities across 5 levers (traffic, conversion, AOV, retention, expansion), and builds a prioritized 90-day growth roadmap. Uses the Ansoff Matrix…

nexscope-ai/eCommerce-Skills · 175 tokens