Agent skill · Agent Skills for Context Engineering
/context-compression Compress long agent sessions without losing the file trail
This skill teaches the agent to compress conversation history in a way that keeps work moving. It sets tokens per task, not per request, as the goal, compares three summarization approaches, and favours structured summaries with fixed sections for intent, files changed, decisions, state and next steps, merged incrementally and checked with probe questions.
Works with
- Claude Code
- Cursor, Codex, Claude Code
Used forBuilding skills and MCP
When to use it
- Coding sessions keep hitting the context limit and the agent loses track of which files it changed.
- You are designing the summarization or handoff step of an agent framework.
- You need a way to measure whether a compression method preserves what matters.
How it works
- 1Pick an approach
Chooses anchored iterative summaries for long file-heavy sessions, opaque compression for short cheap ones, or full regeneration when humans read the summary.
- 2Fix the sections
Defines mandatory summary sections suited to the task, such as root cause for debugging or schemas for migrations.
- 3Merge, do not regenerate
Summarizes only the newly truncated span and folds it into existing sections, deduplicating by file and decision.
- 4Choose triggers
Uses a sliding window or a 70 to 80 percent utilization threshold, or task boundaries when sessions have clear phases.
- 5Probe the result
Asks recall, artifact, continuation and decision questions after compression and scores six dimensions.
What it steers the agent away from
- Compressing tool definitions or schemas, which breaks tool calls.
- Paraphrasing file paths, error codes and identifiers into vague prose.
- Losing the constraints set in the first turns of a session.
Install this skill
It installs with the Agent Skills for Context Engineering pack.
Claude Code (plugin marketplace)Installs all published skills as one plugin; they activate from task context.
/plugin marketplace add muratcankoylan/Agent-Skills-for-Context-Engineering
/plugin install context-engineering@context-engineering-marketplaceCursor, Codex, Claude Code (single skill copy)Run from a clone of the repo; copy whole folders, since flattening SKILL.md breaks its reference links.
mkdir -p .cursor/skills
cp -R skills/context-fundamentals .cursor/skills/
mkdir -p .claude/skills
cp -R skills/context-fundamentals .claude/skills/
mkdir -p .codex/skills
cp -R skills/context-fundamentals .codex/skills/Commands come from the author’s README; check it for changes before you run them.
Questions
Why not just compress as much as possible?
Lost details force the agent to re-read and re-derive, so the total tokens for the task can rise even when each request shrinks.
Are the compression ratios in the skill universal?
No. The skill presents them as figures from one benchmark source and says not to treat them as constants.
More guides from Agent Skills for Context Engineering
/filesystem-contextUse files as overflow memory for agentsMoves large tool outputs, plans, logs and sub-agent findings into files the agent searches on demand instead of keeping in chat.Read the guide →/harness-engineeringBuild autonomous agent loops that cannot game their metricDesigns autonomous agent loops with locked evaluators, editable surfaces, append-only logs, rollback and human approval points.Read the guide →/multi-agent-patternsDecide when multiple agents help and how to wire themChooses between supervisor, swarm and hierarchical agent setups, with isolation mechanisms, handoffs and failure mitigations.Read the guide →/tool-designDesign agent tools that get picked and called correctlyWrites agent-facing tool descriptions, schemas and recoverable errors, and merges overlapping tools into fewer clear ones.Read the guide →
Also in this pack
/advanced-evaluationSets up LLM-as-judge scoring, pairwise comparison and rubric calibration, with mitigations for known judge biases.↗/bdi-mental-statesModels agent beliefs, desires and intentions from RDF context using BDI ontology patterns for traceable deliberation.↗/context-fundamentalsExplains what a context window holds, how attention is spread across it and why fewer high-signal tokens beat more tokens.↗/evaluationBuilds agent evaluation with deterministic checks, multi-dimension rubrics, regression suites, baselines and production monitoring.↗/hosted-agentsPlans background coding agents in remote sandboxes with prebuilt images, warm pools, snapshots and multiplayer sessions.↗/latent-briefingShares an orchestrator's trajectory with workers by compacting it in the worker's KV cache when you control the runtime.↗/long-horizon-promptingWrites launch briefs for agents that run for hours, with exact success predicates, stop rules, audit gates and worker contracts.↗/memory-systemsDesigns cross-session memory with entity tracking, temporal validity and vector or graph retrieval, and picks memory benchmarks.↗/project-developmentDecides whether an LLM fits a task, shapes batch or agent pipelines, estimates token cost and designs parseable structured output.↗/self-improvement-loopsBuilds loops where the harness itself is optimized, such as failure-driven self-edits or scaffold search, behind acceptance gates.↗/self-managed-contextLets the model edit its own live context safely, with pinned prefixes, edit gates, receipts, budget readouts and rollback.↗/book-sft-pipelineTurns ePub books into segmented fine-tuning datasets and trains small models on an author's style with LoRA.↗
Summary by trendhub. The skill itself lives in muratcankoylan/Agent-Skills-for-Context-Engineering/skills/context-compression by Muratcan Koylan (MIT); read the full, current text there.