What problem does it solve? Long-running agents and extended conversations quickly exhaust limited context windows, driving up token costs, latency, and response quality degradation. This Skill provides concrete techniques to compress, mask, cache, and partition context so agents stay effective within fixed token budgets. ## Core Features & Use Cases - Compaction Strategies: Summarize tool outputs, old conversation turns, and retrieved documents when context utilization crosses thresholds, preserving key decisions and metrics. - Observation Masking: Replace verbose tool outputs with compact reference IDs stored in an ObservationStore, reclaiming 60-80% of tokens while keeping content retrievable. - KV-Cache Optimization: Reorder prompts with stable prefixes first and strip dynamic content like timestamps to maximize cache hit rates and reduce cost and latency. - Context Partitioning & Budgeting: Split work across isolated sub-agent contexts and enforce explicit token budgets per category with trigger-based optimization. - Use Case: A customer support agent handling multi-hour conversations hits 80% context utilization; apply compaction to summarize early turns and mask stale tool outputs, cutting token usage in half without losing task state. ## Quick Start Use the context-optimization skill to compact this conversation history and mask verbose tool outputs so the agent can continue within its context limit.