context-compression
Что он делает
Этот скилл объясняет, как сжать длинный разговор агента в более короткую сводку, не потеряв решения, файлы и следующие шаги. Он нужен тем, кто ведёт длинные ИИ-сессии или передаёт работу другому агенту.
Когда использовать
- ✓Когда длинная ИИ-сессия вот-вот упрётся в лимит и нужна сводка.
- ✓Когда агент забывает, какие файлы он изменил или что решил раньше.
- ✓Когда нужна сводка для передачи, чтобы другой агент мог продолжить работу.
Ссылка на скилл
https://github.com/muratcankoylan/Agent-Skills-for-Context-Engineering/blob/main/skills/context-compression/SKILL.mdСкопируйте и вставьте её в ваш ИИ (Claude, ChatGPT или Cursor) с просьбой следовать инструкциям.
Как использовать
Самый простой способ: скопируйте сообщение и вставьте его в свой ИИ. Он прочитает скилл и выполнит инструкции.
Готовое сообщение для вставки
Для Claude Code, Codex или Cursor: запустите в папке проекта, и скилл установится.
Скачайте SKILL.md и положите его в папку скиллов вашего агента.
Пример запроса к вашему ИИ
“Суммируй эту длинную сессию программирования, чтобы новый агент мог продолжить работу, не потеряв того, что мы решили.”
5 новых скиллов в неделю. 1 минута чтения.
Как это работает
Скилл показывает, как написать структурированную сводку, которая сохраняет решения, изменённые файлы, риски и следующие действия, и как проверить, что сводка всё ещё работает.
Технический текст (оригинальный SKILL.md)
Оригинальный текст автора на английском, прямо с GitHub.
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
Do not activate this skill for adjacent work owned by other skills:
- General token-efficiency tactics such as masking, prefix caching, or partitioning:
context-optimization. - Diagnosing why a long context is failing before choosing a mitigation:
context-degradation. - Writing raw outputs, logs, or plans to files without summarizing them:
filesystem-context. - Designing long-term semantic memory across sessions:
memory-systems. - The model deciding when and where to rewrite its own context:
self-managed-context. This skill still owns what the replacement text must preserve.
Core Concepts
Context compression trades token savings against information loss. Select from three production-ready approaches based on session characteristics:
Anchored Iterative Summarization: Implement this for long-running sessions where file tracking matters. Maintain structured, persistent summaries with explicit sections for session intent, file modifications, decisions, and next steps. When compression triggers, summarize only the newly-truncated span and merge with the existing summary rather than regenerating from scratch. This prevents drift that accumulates when summaries are regenerated wholesale — each regeneration risks losing details the model considers low-priority but the task requires. Structure forces preservation because dedicated sections act as checklists the summarizer must populate, catching silent information loss.
Opaque Compression: Reserve this for short sessions where re-fetching costs are low and maximum token savings are required. It produces compressed representations optimized for reconstruction fidelity, achieving 99%+ compression ratios but sacrificing interpretability entirely. The tradeoff matters: there is no way to verify what was preserved without running probe-based evaluation, so never use this when debugging or artifact tracking is critical.
Regenerative Full Summary: Use this when summary readability is critical and sessions have clear phase boundaries. It generates detailed structured summaries on each compression trigger. The weakness is cumulative detail loss across repeated cycles — each full regeneration is a fresh pass that may deprioritize details preserved in earlier summaries.
Detailed Topics
Optimize for Tokens-Per-Task, Not Tokens-Per-Request
Measure total tokens consumed from task start to completion, not tokens per individual request. When compression drops file paths, error messages, or decision rationale, the agent must re-explore, re-read files, and re-derive conclusions — wasting far more tokens than the compression saved. A strategy saving 0.5% more tokens per request but causing 20% more re-fetching costs more overall. Track re-fetching frequency as the primary quality signal: if the agent repeatedly asks to re-read files it already processed, compression is too aggressive.
Solve the Artifact Trail Problem First
Artifact trail integrity is often the weakest dimension in compression evaluations (claim-context-compression-factory-benchmark). Address this proactively because general summarization cannot reliably maintain it.
Preserve these categories explicitly in every compression cycle:
- Which files were created (full paths)
- Which files were modified and what changed (include function names, not just file names)
- Which files were read but not changed
- Specific identifiers: function names, variable names, error messages, error codes
Implement a separate artifact index or explicit file-state tracking in agent scaffolding rather than relying on the summarizer to capture these details. Even structured summarization with dedicated file sections st
Частые вопросы
Что должна сохранять хорошая сводка?
Принятые решения, изменённые файлы, открытые риски и следующие действия.
Почему не сделать всё просто короче?
Скилл стремится к меньшему общему числу токенов на завершённую задачу, так как потерянные детали могут заставить агента повторять работу.
Это то же, что долговременная память?
Нет. Скилл сосредоточен на сводке одной сессии, а память между сессиями это отдельная тема.
Подробности
Оригинальное описание автора
This skill should be used when long-running agent sessions need context compression, structured summarization, compaction, token-per-task optimization, or durable handoff summaries that preserve decisions, files, risks, and next actions.
Популярность
- Звёзды на GitHub
- 18k
- Место в рейтинге
- #10637
- Лицензия
- MIT
- Обновлён
- 11.10.2026
Комментарии
- …
Другие скиллы из этого репозитория
context-engineering-collection
18kПомогает агенту управлять тем, что попадает в контекстное окно ИИ-модели: от памяти и инструментов до систем из нескольких агентов и оценки.
advanced-evaluation
18kУчит агента оценивать ответы ИИ с помощью другого ИИ: с баллами, попарным сравнением и проверкой на смещение.
bdi-mental-states
18kУчит агента моделировать убеждения, цели и планы по подходу BDI, чтобы его решения можно было проследить и объяснить.
context-degradation
18kПомогает агенту находить и исправлять ответы ИИ, которые ухудшаются в длинных разговорах, например когда детали теряются в середине.
Похожие скиллы
add-model-provider
394kПомогает агенту подключить нового провайдера ИИ-моделей к OpenClaw безопасными командами, хранить ключи API не в открытом виде и провести живой тест.
acp-router
394kПомогает агенту передать задачу инструменту для программирования, например Claude Code или Cursor, через OpenClaw, чтобы работа шла в этом инструменте.
browser-automation
394kУчит агента пошагово управлять веб-страницами: входить в аккаунты, работать с вкладками и восстанавливаться, если страница перестала отвечать.