
Context Optimization
Strategies for extending effective context capacity through KV-cache ordering, observation masking, compaction, and partitioning.
- skills.sh installs
- 506
- GitHub stars
- 18.4K
- last updated
- May 26, 2026
What it does
- Covers context budgeting, observation masking, prefix or KV-cache ordering, context partitioning, and retrieval scoping, applied in priority order
- Includes compaction triggers at 70% utilization, masking rules for tool outputs after 3+ turns, and cache-stable prompt ordering
- Enforces a rule to never compress the system prompt and to measure quality before and after each optimization
- Designed for agents hitting context limits or incurring high token costs, with adjacent topics routed to other skills
Install
$ npx -y skills add muratcankoylan/agent-skills-for-context-engineering --skill context-optimization -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
Context Optimization Techniques
Context optimization extends the effective capacity of limited context windows through strategic compression, masking, caching, and partitioning. Effective optimization increases useful capacity without requiring larger models or longer windows — but only when applied with measurement discipline. The techniques below are ordered by impact and risk.
When to Activate
Activate this skill when:
- Context budgets or token costs constrain task complexity
- Observation masking can replace verbose tool outputs with retrievable references
- Prefix or KV-cache hit rate needs improvement
- Retrieval scoping can reduce irrelevant loaded context
- Context partitioning can extend effective capacity across agents
- Budget triggers are needed for masking, compaction, or partitioning
Details
- Repository
- github.com/muratcankoylan/agent-skills-for-context-engineering
- Categories
- Memory & Context, AI Agents & LLM Apps
- License
- MIT
- First seen
- Jun 11, 2026
More from muratcankoylan/agent-skills-for-context-engineering
All 17- Filesystem Context404
- Multi Agent Patterns356
- Memory Systems354
- Tool Design313
- Context Degradation300
- Evaluation283
- Context Fundamentals272
- Harness Engineering207
- Latent Briefing205
- Project Development203
- Advanced Evaluation199
- Hosted Agents176
- Bdi Mental States171
- Context Engineering Collection
- Context Engineering Collection4.5K
- Context Compression644
Similar to Context Optimization
More Memory & Context
context-degradationmuratcankoylan/agent-skills-for-context-engineering300 installsDiagnose and fix context failures such as lost-in-middle recall loss, poisoning, and clash before they cascade.
context-window-managementdavila7/claude-code-templates589 installsStrategies for managing LLM context windows through summarization, trimming, routing, and avoiding context rot.
context-engineeringmrgoonie/claudekit-skills508 installsCurated context engineering playbook for agent systems covering compaction, memory, multi-agent patterns, and evaluation.
context-fundamentalsmuratcankoylan/agent-skills-for-context-engineering272 installsFoundational concepts for context engineering: what context is, how attention works, and why quality beats quantity.
prompt-cachingdavila7/claude-code-templates440 installsMulti-level LLM caching guide covering prompt prefixes, full responses, and cache-augmented generation patterns.
session-compressionbobmatnyc/claude-mpm-skills672 installsCompression techniques for long multi-turn AI conversations, covering summarization, embedding retrieval, and context budgeting.