context-optimization
Что он делает
Этот инструмент помогает ИИ лучше использовать доступную ему память (контекст). Он суммирует старую информацию, оставляя только главное, чтобы ИИ мог работать с большим объёмом данных или более длинными диалогами, не теряя нити.
Когда использовать
- ✓Когда ИИ нужно одновременно помнить много информации.
- ✓Чтобы ИИ быстрее отвечал в длинных диалогах.
- ✓Чтобы обрабатывать большие документы без потери ориентации у ИИ.
Ссылка на скилл
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/context-optimization/SKILL.mdСкопируйте и вставьте её в ваш ИИ (Claude, ChatGPT или Cursor) с просьбой следовать инструкциям.
Как использовать
Самый простой способ: скопируйте сообщение и вставьте его в свой ИИ. Он прочитает скилл и выполнит инструкции.
Готовое сообщение для вставки
Для Claude Code, Codex или Cursor: запустите в папке проекта, и скилл установится.
Скачайте SKILL.md и положите его в папку скиллов вашего агента.
Пример запроса к вашему ИИ
“Кратко перескажи этот длинный диалог, чтобы я понял главные мысли.”
5 новых скиллов в неделю. 1 минута чтения.
Как это работает
Инструмент определяет, что важнее всего в диалоге или документах, которые читает ИИ. Затем он создаёт краткие пересказы или оставляет только ключевые части, освобождая место в памяти для новой информации.
Технический текст (оригинальный SKILL.md)
Оригинальный текст автора на английском, прямо с GitHub.
Context Optimization Techniques
Context optimization extends the effective capacity of limited context windows through strategic compression, masking, caching, and partitioning. The goal is not to magically increase context windows but to make better use of available capacity. Effective optimization can double or triple effective context capacity without requiring larger models or longer contexts.
When to Use
Activate this skill when:
- Context limits constrain task complexity
- Optimizing for cost reduction (fewer tokens = lower costs)
- Reducing latency for long conversations
- Implementing long-running agent systems
- Needing to handle larger documents or conversations
- Building production systems at scale
Core Concepts
Context optimization extends effective capacity through four primary strategies: compaction (summarizing context near limits), observation masking (replacing verbose outputs with references), KV-cache optimization (reusing cached computations), and context partitioning (splitting work across isolated contexts).
The key insight is that context quality matters more than quantity. Optimization preserves signal while reducing noise. The art lies in selecting what to keep versus what to discard, and when to apply each technique.
Detailed Topics
Compaction Strategies
What is Compaction Compaction is the practice of summarizing context contents when approaching limits, then reinitializing a new context window with the summary. This distills the contents of a context window in a high-fidelity manner, enabling the agent to continue with minimal performance degradation.
Compaction typically serves as the first lever in context optimization. The art lies in selecting what to keep versus what to discard.
Compaction Implementation Compaction works by identifying sections that can be compressed, generating summaries that capture essential points, and replacing full content with summaries. Priority for compression goes to tool outputs (replace with summaries), old turns (summarize early conversation), retrieved docs (summarize if recent versions exist), and never compress system prompt.
Summary Generation Effective summaries preserve different elements depending on message type:
Tool outputs: Preserve key findings, metrics, and conclusions. Remove verbose raw output.
Conversational turns: Preserve key decisions, commitments, and context shifts. Remove filler and back-and-forth.
Retrieved documents: Preserve key facts and claims. Remove supporting evidence and elaboration.
Observation Masking
The Observation Problem Tool outputs can comprise 80%+ of token usage in agent trajectories. Much of this is verbose output that has already served its purpose. Once an agent has used a tool output to make a decision, keeping the full output provides diminishing value while consuming significant context.
Observation masking replaces verbose tool outputs with compact references. The information remains accessible if needed but does not consume context continuously.
Masking Strategy Selection Not all observations should be masked equally:
Never mask: Observations critical to current task, observations from the most recent turn, observations used in active reasoning.
Consider masking: Observations from 3+ turns ago, verbose outputs with key points extractable, observations whose purpose has been served.
Always mask: Repeated outputs, boilerplate headers/footers, outputs already summarized in conversation.
KV-Cache Optimization
Understanding KV-Cache The KV-cache stores Key and Value tensors computed during inference, growing linearly with sequence length. Caching the KV-cache across requests sharing identical prefixes avoids recomputation.
Prefix caching reuses KV blocks across requests with identical prefixes using hash-based block matching. This dramatically reduces cost and latency for requests with common prefixes like system prompts.
Cache Optimization Patterns Optimize for caching by reordering context elements to maximize cache hits. Place stable elements first (system prompt, tool definitions), then frequently reused elements, then unique elements last.
Design prompts to maximize cache stability: avoid dynamic content like timestamps, use consistent formatting, keep structure stable across sessions.
Context Partitioning
Sub-Agent Partitioning
…
Частые вопросы
Этот инструмент увеличивает память ИИ?
Нет, он не увеличивает память ИИ, но позволяет использовать имеющееся пространство более разумно.
ИИ забудет важные вещи?
Цель обратная. Инструмент сохраняет главное и отбрасывает менее важное или повторяющееся, чтобы ИИ не потерял нить.
Когда стоит использовать этот инструмент?
Когда ИИ, кажется, путается из-за слишком большого объёма информации, когда ответы занимают слишком много времени или когда нужно обработать обширные тексты.
Подробности
Оригинальное описание автора
Context optimization extends the effective capacity of limited context windows through strategic compression, masking, caching, and partitioning. The goal is not to magically increase context windows but to make better use of available capacity.
Популярность
- Звёзды на GitHub
- 48k
- Место в рейтинге
- #4259
- Лицензия
- MIT
- Обновлён
- 15.10.2026
Комментарии
- …
Другие скиллы из этого репозитория
00-andruia-consultant
48kПомогает агенту начинать или улучшать ИИ-проекты: анализирует код, подбирает инструменты и составляет план на испанском.
007
48kАгент проводит аудит безопасности и моделирование угроз для защиты проектов.
10-andruia-skill-smith
48kПомогает агенту создавать и улучшать ИИ-инструменты: описание работы, документация и проверка структуры.
20-andruia-niche-intelligence
48kАгент составляет обзор отрасли: контекст, правила, паттерны использования и риски по надёжным источникам.
Похожие скиллы
add-model-provider
394kПомогает агенту подключить нового провайдера ИИ-моделей к OpenClaw безопасными командами, хранить ключи API не в открытом виде и провести живой тест.
acp-router
394kПомогает агенту передать задачу инструменту для программирования, например Claude Code или Cursor, через OpenClaw, чтобы работа шла в этом инструменте.
browser-automation
394kУчит агента пошагово управлять веб-страницами: входить в аккаунты, работать с вкладками и восстанавливаться, если страница перестала отвечать.