When your agent session hits hundreds of thousands of tokens and starts forgetting which files it modified, you need compression that doesn't break task continuity. This skill walks through three production approaches: anchored iterative summarization for file-heavy work, opaque compression when you need maximum token savings, and regenerative summaries for readable handoffs. The key insight is optimizing for tokens per task, not per request. If your compression drops a file path and the agent has to re-explore the codebase, you've lost more tokens than you saved. Comes with structured templates, probe-based evaluation tactics, and honest tradeoffs between the approaches.

skills.sh installs
565
GitHub stars
18.3K
last updated
May 26, 2026

Install

$ npx -y skills add muratcankoylan/agent-skills-for-context-engineering --skill context-compression --agent claude-code

Installs into .claude/skills of the current project.

Files

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

Sponsors

Details

Repository
github.com/muratcankoylan/agent-skills-for-context-engineering
Category
AI & Agent Building
License
MIT
First seen
Jun 11, 2026

More from muratcankoylan/agent-skills-for-context-engineering

All 17
1plugin87 avatardesign-componentplugin87/ux-ui-agent-skillsDesign a UI component spec to the house quality bar — anatomy, variants, sizes, the 8 states, token mapping, and accessibility. Use when the user wants to desig565skills.sh installs
2jwynia avatarprose-stylejwynia/agent-skillsDiagnose sentence-level issues after structure is solid. Use when prose feels flat, sentences are monotonous, word choices are generic, or voice is inconsistent564skills.sh installs
3nousresearch avataryuanbaonousresearch/hermes-agentYuanbao (元宝) groups: @mention users, query info/members.564skills.sh installs
4plugin87 avatarux-writingplugin87/ux-ui-agent-skillsWrite or review UI copy — buttons, errors, empty states, microcopy, notifications, labels — using the voice & tone system (clear, concise, useful, human, honest564skills.sh installs
5aj-geddes avatarprocess-mappingaj-geddes/useful-ai-promptsVisualize and document current and future business processes. Identify inefficiencies, dependencies, and improvement opportunities through detailed process mapp563skills.sh installs
6auth0 avatarauth0-fastify-apiauth0/agent-skillsUse when protecting Fastify API endpoints with JWT Bearer token validation or scope checks. Integrates @auth0/auth0-fastify-api for stateless APIs receiving acc562skills.sh installs